Hi There! Early this morning, my buddy SC and I rode the 4 or so miles from the neighborhood here to the Blue Hills. At the Blue Hills SC showed off some great trails. Thanks SC!
Temps were from 32 to 34 F. Sunny. Frosty mud. With a light wind. Minus winter boots, I think I have most of my winter riding gear all set.
SC reported these ride stats: We did 15.75 miles in about 90 minutes of pedalling time.
Happy Trails!
JT
Saturday, December 15, 2012
Blue Hills Ride
Labels:
Blue Hills,
Mountain Bike Log,
Mountain Biking,
outdoors
Location:
Chickatawbut Rd, Milton, MA 02186, USA
Friday, December 7, 2012
c sharp enum examples
Using enumeration in your code is a quick way to make your code
more readable.
Declare a new type
private enum _medTypes { newMed, changeMed, stopMed };
//newMed =0, changedMed = 1, stopMed =2
Declare a variable of your new type
private _medTypes _medType;
Converting an int to your new type
_medType = (_medTypes)int.Parse(Request.QueryString["medType"]);
Testing your new type
if (_medType == _medTypes.newMed || _medType == _medTypes.changeMed)
switch(_medType)
{
case _medTypes.newMed:
msgSpan.InnerHtml = @"Meds written since ED Reg date default as new. " +
"To exclude a medication from appearing on the discharge note the user needs to uncheck the new box.";
medsGridView.Columns[0].Visible = true;
break;
case _medTypes.changeMed:
msgSpan.InnerHtml = @"Medication changes must be made in LMR.";
medsGridView.Columns[1].Visible = true;
break;
case _medTypes.stopMed:
msgSpan.InnerHtml = @"Meds discontinued since the ED Reg date are displayed below.";
medsGridView.Columns[2].Visible = true;
break;
default:
break;
}
Thursday, November 15, 2012
c# Generic List sorting
Here's a quick code snip of sorting a generic list of object, by a DateTime object property in descending order.
1. Your class has to inherit IComparable
2. Implement IComparable's CompareTo method
3. After your generic list of objects is built, then call the lists .Sort method.
In this code I needed the LmrMed's serviceDate sorted in descending order. The Sort method does not create a new list, it changes the order of the nodes in the current list.
I found this article helpful in learning about c# generic list sorting: http://www.codedigest.com/Articles/CSHARP/84_Sorting_in_Generic_List.aspx
1. Your class has to inherit IComparable
2. Implement IComparable's CompareTo method
3. After your generic list of objects is built, then call the lists .Sort method.
In this code I needed the LmrMed's serviceDate sorted in descending order. The Sort method does not create a new list, it changes the order of the nodes in the current list.
I found this article helpful in learning about c# generic list sorting: http://www.codedigest.com/Articles/CSHARP/84_Sorting_in_Generic_List.aspx
public class LmrMed : IComparable<LmrMed>
{
public int recId { get; set; }
public string medText { get; set; }
public DateTime? startDate { get; set; }
public DateTime? endDate { get; set; }
public DateTime serviceDate { get; set; }
public LmrMed(int recId, string medText, DateTime startDate, DateTime endDate, DateTime serviceDate)
{
this.recId = recId;
this.medText = medText;
this.startDate = startDate;
this.endDate = endDate;
this.serviceDate = serviceDate;
}
public int CompareTo(LmrMed lm)
{
return lm.serviceDate.CompareTo(this.serviceDate);
}
List<LmrMed> lmrMeds = GetMeds(_mrn);
lmrMeds.Sort();
Friday, November 2, 2012
upgrade
I had been thinking about upgrading the stump jumper. This Halloween my wife asked me if I wanted to go to the bike barn. I said sure! just to look! Well I ended up getting a 29er Stump Jumper hard tail.
My wife bought it for me. I am a lucky guy!
I was concerned about going to a 29 from a 26. I thought I would feel top heavy. At the bike barn Kevin took time to explain to me how that's not true. He said I'ts more stable. And it will ride though more stuff than a 26 can. How he explained things was much more detailed and elegant.
I tried it out in the parking lot, and I wanted the bike that day. We went home with our new ride.
I took it out on some local trails, and this ride is awesome! I feel I'm riding faster with ease, and I have more balance. Plus I don't feel like I'm inside a bike anymore, it's quite a natural fit.
Thanks to my wonderful wife for such an awesome gift! Staying fit by mountain biking pays great dividends to all.
My wife bought it for me. I am a lucky guy!
I was concerned about going to a 29 from a 26. I thought I would feel top heavy. At the bike barn Kevin took time to explain to me how that's not true. He said I'ts more stable. And it will ride though more stuff than a 26 can. How he explained things was much more detailed and elegant.
I tried it out in the parking lot, and I wanted the bike that day. We went home with our new ride.
I took it out on some local trails, and this ride is awesome! I feel I'm riding faster with ease, and I have more balance. Plus I don't feel like I'm inside a bike anymore, it's quite a natural fit.
Thanks to my wonderful wife for such an awesome gift! Staying fit by mountain biking pays great dividends to all.
Tuesday, October 30, 2012
asp.net Using WebHandler to generate images on Server Side and send to Client
I had to create dynamic 2D Data Matrix bar code images on the server and send to the client for MeadCo printing. Found out you can do this by using Web Handlers.
This is a simple example, the value of the bar code is
hardcoded. Since you can pass query
strings from the client to the handler, there is the possibility of creating
dynamic barcodes. This I will be doing
using this prototype as a framework.
WebHandler:
<%@ WebHandler Language="C#" Class="ImageHandler" %>
using System;
using System.Web;
using System.IO;
using System.Drawing;
public class ImageHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
//NOTE: You can get parameters from the client using Query Strings
IEC16022Sharp.DataMatrix dm = new IEC16022Sharp.DataMatrix("<00007>"00007>);
context.Response.ContentType = "image/bmp";
using (Bitmap image = dm.Image)
{
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
ms.WriteTo(context.Response.OutputStream);
}
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
Client code:
The code below shows embedded html being generated (This is
used for printing). The option is there
just to place an img element within the html document and set it’s src attribute
to the name of your handler.
Labels:
.NET,
2D barcode,
ASP.NET,
barcode,
Bitmap,
c sharp,
c#,
code,
Data Matrix,
handlers,
html,
Images,
javaScript,
Visual Studio,
VS2010,
Web Development,
WebHandler
Friday, October 19, 2012
GridView: Getting access to it's datasource properties via DataKeyNames
Client:
<asp:GridView ID="followUpAppointments" CssClass="Report" runat="server" AutoGenerateColumns="false" Width="270" AllowPaging="false" AlternatingRowStyle-CssClass="DataAlternateRow" CellPadding="1" CellSpacing="1" HeaderStyle-HorizontalAlign="Center" EmptyDataText="No Results." DataKeyNames="Id,Name,Description,FollowUpList" >
<Columns>
<asp:TemplateField ItemStyle-Width="10">
<ItemTemplate>
<center>
<asp:CheckBox ID="selectedRowCb" runat="server" />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Name" HeaderText="Follow Up Appointments" ItemStyle-Width="250"
ItemStyle-Wrap="true" />
</Columns>
</asp:GridView>
Class:
public class FollowUp
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public bool FollowUpList { get; set; }
public FollowUp(int id, string name, string description, bool followUpList)
{
this.Id = id;
this.Name = name;
this.Description = description;
this.FollowUpList = followUpList;
}
}
Accessing on Server side:
for (int i = 0; i < followUpAppointments.Rows.Count; i++)
{
GridViewRow row = followUpAppointments.Rows[i];
bool isChecked = ((CheckBox)row.FindControl("selectedRowCb")).Checked;
if (isChecked)
{
int id = (Int32)followUpAppointments.DataKeys[i]["Id"];
string name = followUpAppointments.DataKeys[i]["Name"].ToString();
string description = followUpAppointments.DataKeys[i]["Description"].ToString();
bool followup = (bool)followUpAppointments.DataKeys[i]["FollowUpList"];
_selectedServices.Add(new FollowUp(id,name,description,followup));
}
}
Wednesday, October 17, 2012
JSON serialize with c# deserialize with javascript via pop up window
I created a modal window pop up that shows search results in a gridview. In this gridview there is a checkbox for each row returned. The user can select any rows they want by checking the associated checkbox. One way to send the user's selected data back to the parent window is to use JSON. Below are code snips on how to to do this.
The c# code serializes the generic list of Icd9 objects into a JSON string. This new JSON string is sent to a hidden input on the client side. Upon unload of this child window, the window return value is set to the value of the hidden input that was populated on server side. The parent window client code then evals the returned window value. Once this has been done the value is copied to collection of Icd9 objects. I for loop my way though this collection accessing the Name and Code properties.
Note: This works in IE. I think IE is only browser that supports showModalDialog
This should work in other browsers if you use winodow.open etc.
The c# code serializes the generic list of Icd9 objects into a JSON string. This new JSON string is sent to a hidden input on the client side. Upon unload of this child window, the window return value is set to the value of the hidden input that was populated on server side. The parent window client code then evals the returned window value. Once this has been done the value is copied to collection of Icd9 objects. I for loop my way though this collection accessing the Name and Code properties.
Note: This works in IE. I think IE is only browser that supports showModalDialog
This should work in other browsers if you use winodow.open etc.
Class:
public class Icd9
{
public string Name { get; set; }
public string Code { get; set; }
public Icd9(string name, string code)
{
this.Code = code;
this.Name = name;
}
}
Child Window:
Server side:
using System.Web.Script.Serialization;
...
List<CommonTasks.Icd9> selectedCodes = new List<CommonTasks.Icd9>();
for (int i = 0; i < icdGridView.Rows.Count; i++)
{
GridViewRow row = icdGridView.Rows[i];
bool isChecked = ((CheckBox)row.FindControl("selectedRowCb")).Checked;
if (isChecked)
{
selectedCodes.Add(new CommonTasks.Icd9(icdGridView.Rows[i].Cells[2].Text, icdGridView.Rows[i].Cells[1].Text));
}
}
JavaScriptSerializer js = new JavaScriptSerializer();
string str = js.Serialize(selectedCodes);
hdnIcd.Value = str;
...
Client:
function setWindow_return() {
var selectedCodes = document.getElementById("hdnIcd");
window.returnValue = selectedCodes.value;
}
Parent Window:
Client:
function GetIcd9()
{
var searchText = document.getElementById("f129").value;
var url = "Icd.aspx?searchText=" + searchText;
if (searchText.length==0)
alert(" no value retrieved ");
else {
var results =
window.showModalDialog(url,"","center:yes;dialogWidth:775px;dialogHeight:480px;resizable:no;status:no;;help:no");
if(results.length > 0)
{
var data = eval(results);
if(data.length > 0)
{
var icd9Text = "";
var icd9Code = "";
for(i=0; i < data.length; i++)
{
icd9Text += data[i].Name + " ";
icd9Code += data[i].Code + ",";
}
document.getElementById("petsText").value += icd9Text;
document.getElementById("hidIcd9Code").value += icd9Code;
}
}
}
}
Labels:
.NET,
Browser,
c sharp,
c#,
deserialize,
IE,
javaScript,
JSON,
serialize,
showModalDialog,
window.returnValue
Tuesday, October 9, 2012
Production Issue! Patient Vitals Documentation: XSL Transform
Last week there was serious production issue that I had to fix. The issue was patients acute (critical) vital signs were not showing up on patient documentation.
The analyst found out acute vital signs would not show up if there was more than one set of acute vital signs. In their testing, they found out if you only have one set of acute vital signs then the acute vital signs would show up.
Here's a very simple diagram of how Emergency Documentation system flows:
Database <---> dll <---> web service <---> .Net website
I had a lot of places to look.
I found a method that had an XML transform. This transform was converting XML returned by a stored procedure into HTML. In debugging the web application I determined that the acute vitals data 'went missing' in the code below.
Code from private method in web service:
For XML clause in the select statement from the stored procedure:
FOR XML PATH('Vitals'),root('Visit')
I needed a lesson in XSLT but first I had to understand the business rules.
The users did not want to see any acute vital column headers in the patient documentation if there was no acute vitals taken. Examples below:
The analyst found out acute vital signs would not show up if there was more than one set of acute vital signs. In their testing, they found out if you only have one set of acute vital signs then the acute vital signs would show up.
Here's a very simple diagram of how Emergency Documentation system flows:
Database <---> dll <---> web service <---> .Net website
I had a lot of places to look.
I found a method that had an XML transform. This transform was converting XML returned by a stored procedure into HTML. In debugging the web application I determined that the acute vitals data 'went missing' in the code below.
Code from private method in web service:
XmlReader reader = XmlReader.Create(new StringReader(xml)); StringBuilder output = new StringBuilder(); XmlWriter writer = XmlWriter.Create(output); XslCompiledTransform Xsl = new XslCompiledTransform(); Xsl.Load(xslFile); Xsl.Transform(reader, writer); html = output.ToString(0, output.Length); return html.Substring(html.IndexOf("));
For XML clause in the select statement from the stored procedure:
FOR XML PATH('Vitals'),root('Visit')
I needed a lesson in XSLT but first I had to understand the business rules.
The users did not want to see any acute vital column headers in the patient documentation if there was no acute vitals taken. Examples below:
Vitals Table without Acute Data |
Vitals Table with Acute Data |
A team leader here told me the XSL file could have a bug in it. He also said that I could debug these XSL files in Visual Studio. I did some online research to find out what XSL files and what transforming is. XML transforms is a way of converting XML data to: Another XML, HTML, or other text. I can see how handy this would be.
In debugging the XSL I found that there was a variable called accuteV. If this variable contained the value of "on" then the extra acute columns would be rendered in the html output. This variable was being set in a For-Each statement. While debugging, I noticed if there was more than one row being returned with acute data, the accuteV variable would no longer contain any value. It was like accuteV went out of scope!
I did more online research and found out that variables in XSLT are immutable! They can only be assigned to once. Turns out that XSLT is a function language. The original developer had treated this as a procedural language.
This bug of assigning a value to a variable within a For-Each explained why acute data would show up when there was only one row of acute data, but would disappear if more than one row of acute data.
A very strange bug is very easily explained with some knowledge of how XLST works.
Now knowing the exact problem the challenge was to fix it quickly with little code changes as possible.
I tried a few workarounds with setting the variable The goal was not to change any other part of the XSL. I wanted all the existing code to remain the same. I did not have time to become a XSL expert and did not want to take ownership of this file either. I tried to add an 'and' to the if statement checking if acuteV was all ready 'on'. I also tried to store the sum of the lengths of the acute nodes in question. Neither of these worked. I was stuck.
Lucky for me the same team leader who had lead me to the XSL was working on this as well. His found a solution to find out if there's any acute data anywhere in the XML, and only assign 'on' to acuteV once. This solution worked like a charm! Big Thank yous were given and Hi Fives all around.
Original XLS snip:
<xsl:variable name="acuteV" > <xsl:for-each select="Visit/Vitals/Acute"> <xsl:if test="string-length(Aline)>0 or string-length(CVP)>0 or string-length(ICP)>0 or string-length(ET)>0 or string-length(FI)>0"> <xsl:text>on</xsl:text> </xsl:if> </xsl:for-each> </xsl:variable>
Fixed XLS full file:
XML:
xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.stylusstudio.com/xquery">
<xsl:variable name="WeGotData" >
<xsl:for-each select="Visit/Vitals/Acute">
<xsl:value-of select='concat(Aline,CVP,ICP,ET,FI)'/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="acuteV">
<xsl:choose>
<xsl:when test="$WeGotData!=''">
<xsl:text>on</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>off</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="cols">
<xsl:choose>
<xsl:when test="$acuteV='on'">
<xsl:text>13</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>8</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:attribute-set name="borders">
<xsl:attribute name="style">border-bottom:solid 1px;border-right:solid 1px;</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="bordersWithColspan">
<xsl:attribute name="colspan"><xsl:value-of select="$cols"></xsl:value-of></xsl:attribute>
<xsl:attribute name="style">border-bottom:solid 1px;border-right:solid 1px;</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="markinError">
<xsl:attribute name="style">text-align:center;text-decoration:line-through;</xsl:attribute>
</xsl:attribute-set>
<xsl:template match="/">
<html>
<head/>
<body style="font-size:9pt;font-family:Verdana;">
<div style="text-align: none;">
<br/>
<table align="none" style="border-style: none;border-width: 0pt;background-color:transparent;font-family:Verdana;" cellspacing="1pt">
<tbody>
<tr>
<td style="border-style: none;border-width: 2pt;padding: 2pt;vertical-align: middle;">
<span style="font-size: 10.5pt;font-weight: bold;">
Vitals/Progress Notes
</span>
</td>
</tr>
</tbody>
</table>
<br/>
<table style="border-style:none;border-color:black;border-collapse:collapse;background-color:transparent;font-family:Verdana;" cellpadding="0" cellspacing="0" >
<tbody >
<tr >
<td style="border-style: solid;border-width: 1px;width:60pt;padding: 0pt;vertical-align: middle;">
<div style="text-align: left;">
<span style="font-size: 9pt;font-weight: bold;">
Event Time
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size: 9pt;font-weight: bold;">
Temp
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size: 9pt;font-weight: bold;">
P
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size: 9pt;font-weight: bold;">
BP
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size: 9pt;font-weight: bold;">
RR
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size: 9pt;font-weight: bold;">
Sat
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size:9pt;font-weight: bold;">
Pain
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size:9pt;font-weight: bold;">
Pupils
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size: 9pt;font-weight: bold;">
GCS
</span>
</div>
</td>
<xsl:if test="$acuteV='on'">
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size:9pt;font-weight: bold;">
A-line
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size:9pt;font-weight: bold;">
CVP
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size:9pt;font-weight: bold;">
ICP
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size:9pt;font-weight: bold;">
ET C02
</span>
</div>
</td>
<td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
<div style="text-align: center;">
<span style="font-size:9pt;font-weight: bold;">
FiO2
</span>
</div>
</td>
</xsl:if>
</tr>
<xsl:for-each select="Visit/Vitals">
<xsl:choose>
<xsl:when test="Type='NOTE'">
<tr>
<td style="border-right: solid 1px;border-bottom: solid 1px; border-left:solid 1px; width:60pt;">
<div style="text-align: left; font-size:9pt">
<xsl:variable name="lastDate" select="DateTimeTaken/Date"/>
<xsl:if test="not(preceding-sibling::Vitals[DateTimeTaken/Date=$lastDate])">
<xsl:value-of select="DateTimeTaken/Date"/>
<br/>
</xsl:if>
<xsl:value-of select="DateTimeTaken/Time"/>
</div>
</td>
<td xsl:use-attribute-sets="bordersWithColspan" >
<div style="text-align: left;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="ProgressNote"/>
</div>
<xsl:if test="IsDeleted='1'" >
<div style="text-align: left;font-size:9pt">
<xsl:value-of select="ErrorReason"/>
</div>
</xsl:if>
</td>
</tr>
</xsl:when>
<xsl:when test="Type='ED' or Type='TRIAGE'">
<tr>
<td >
<xsl:choose>
<xsl:when test="string-length(ProgressNote)>0 or string-length(ErrorReason)>0" >
<xsl:attribute name="style">border-left:solid 1px;border-bottom:none;border-right:solid 1px</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="style">border-left:solid 1px;border-right: solid 1px;border-bottom:solid 1px;width:60pt;</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<div style="text-align: left;font-size:9pt">
<xsl:variable name="lastDate" select="DateTimeTaken/Date"/>
<xsl:if test="not(preceding-sibling::Vitals[DateTimeTaken/Date=$lastDate])">
<xsl:value-of select="DateTimeTaken/Date"/>
<br/>
</xsl:if>
<xsl:value-of select="DateTimeTaken/Time"/>
<xsl:if test="Type='TRIAGE'">(T)</xsl:if>
</div>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(Temp/Temp)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="Temp/Temp"/>
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(Pulse/Pulse)>0 or string-length(Pulse/Rhythm)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="Pulse/Pulse" />
<xsl:if test="'string=length(Pulse/Rhythm>0'">
<br/>
<xsl:value-of select="Pulse/Rhythm" />
</xsl:if>
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(BP/High)>0 or string-length(BP/Low)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="BP/High"/>
<xsl:if test="string-length(BP/High) >0">
<xsl:text> / </xsl:text>
</xsl:if>
<xsl:value-of select="BP/Low"/>
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(RespRate/RespRate)" >
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="RespRate/RespRate" />
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(Sat/SaO2)>0 or string-length(Sat/RA)>0 or string-length(Sat/Liters>0)" >
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="Sat/SaO2" />
<xsl:if test="string-length(Sat/Liters)>0">
<br/>
<xsl:value-of select="concat(Sat/Liters,'L')"/>
</xsl:if>
<xsl:if test="string-length(Sat/RA)>0">
<br/>
<xsl:value-of select="Sat/RA" />
</xsl:if>
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(Pain/Level)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="Pain/Level" />
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td style="border-right: solid 1px;border-bottom:solid 1px;">
<xsl:choose>
<xsl:when test="string-length(Pupils/LeftPupils)>0 or string-length(Pupils/RightPupils)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:if test="string-length(Pupils/Leftmm) >0">
<xsl:text>L:</xsl:text>
<xsl:value-of select="concat(Pupils/Leftmm,substring(Pupils/LeftPupils,1,1))" />
</xsl:if>
<br/>
<xsl:if test="string-length(Pupils/Rightmm) >0">
<xsl:text> R:</xsl:text>
<xsl:value-of select="concat(Pupils/Rightmm,substring(Pupils/RightPupils,1,1))"/>
</xsl:if>
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="GCS/Score>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="substring(GCS/EyeOpening,1,1)" />
<xsl:text>,</xsl:text>
<xsl:value-of select="substring(GCS/VerbalResponse,1,1)" />
<xsl:text>,</xsl:text>
<xsl:value-of select="substring(GCS/Motor,1,1)"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="GCS/Score"/>
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<xsl:if test="$acuteV='on'">
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(Acute/Aline)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="Acute/Aline" />
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(Acute/CVP)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="Acute/CVP" />
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(Acute/ICP)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="Acute/ICP" />
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(Acute/ET)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="Acute/ET" />
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
<td xsl:use-attribute-sets="borders" >
<xsl:choose>
<xsl:when test="string-length(Acute/FI)>0">
<div style="text-align: center;font-size:9pt">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<xsl:value-of select="Acute/FI" />
</div>
</xsl:when>
<xsl:otherwise>
<span> </span>
</xsl:otherwise>
</xsl:choose>
</td>
</xsl:if>
<xsl:if test="string-length(ProgressNote)>0 or string-length(ErrorReason)>0" >
<tr>
<td style="border-left:solid 1px black; border-bottom:solid 1px;border-right:solid 1px;"> </td>
<td xsl:use-attribute-sets="bordersWithColspan" >
<xsl:if test="string-length(ProgressNote)>0" >
<div style="font-size:9pt;">
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-decoration:line-through</xsl:attribute>
</xsl:if>
<xsl:value-of select="ProgressNote" />
</div>
</xsl:if>
<xsl:if test="string-length(ErrorReason)>0" >
<div style="font-size:9pt;">
<xsl:value-of select="ErrorReason" />
</div>
</xsl:if>
</td>
</tr>
</xsl:if>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</tbody>
</table>
<br/>
<table align="none" style="border-style: none;border-width: 0pt;background-color:transparent;" cellspacing="1pt">
<tbody>
<tr>
<td style="border-style: none;border-width: 2pt;padding: 2pt;vertical-align: middle;">
<div style="font-size: 10pt;font-weight: bold;">
Details:
</div>
</td>
</tr>
</tbody>
</table>
<table style="background-color:transparent;font-family:Verdana;font-size:9pt">
<xsl:for-each select="Visit/Vitals">
<tr>
<td>
<div>
<xsl:if test="IsDeleted='1'" >
<xsl:attribute name="style">text-decoration:line-through;font-size:9pt</xsl:attribute>
</xsl:if>
<span style="font-size: 9pt;font-style: italic">
Event Time:
</span>
<xsl:value-of select="DateTimeTaken/Date"/>
<xsl:text> </xsl:text>
<xsl:value-of select="DateTimeTaken/Time"/>
<br/>
<span style="font-size: 9pt;font-style: italic;">
Time Recorded:
</span>
<xsl:value-of select="DateTimeRecorded"/>
<br/>
<span style="font-size: 9pt;font-style: italic;">
Entered By:
</span>
<xsl:value-of select="username"/>
<xsl:choose>
<xsl:when test="Type='ED' or Type='TRIAGE'">
<xsl:if test="string-length(BP) > 0">
<div style="text-align: none;">
<span style="font-size: 9pt;font-style: italic;">
BP:
</span>
<xsl:value-of select="BP/High" />
<xsl:text>/</xsl:text>
<xsl:value-of select="BP/Low" />
<xsl:if test="string-length(BP/Site) > 0">
<xsl:text> Site:</xsl:text>
<xsl:text> </xsl:text>
<xsl:value-of select="BP/Site"/>
</xsl:if>
<xsl:if test="string-length(BP/Position) > 0">
<xsl:text> Position: </xsl:text>
<xsl:text> </xsl:text>
<xsl:value-of select="BP/Position"/>
</xsl:if>
</div>
</xsl:if>
<xsl:if test="string-length(Temp/Temp) > 0">
<div style="text-align: none;">
<span style="font-size: 9pt;font-style: italic;">
Temp:
</span>
<xsl:value-of select="Temp/Temp"/>
<xsl:if test="string-length(Temp/Site) > 0">
<xsl:text> Site: </xsl:text>
<xsl:value-of select="Temp/Site"/>
</xsl:if>
</div>
</xsl:if>
<xsl:if test="string-length(Pain/Level) > 0">
<div style="text-align: none;">
<span style="font-size: 9pt;font-style: italic;">
Pain Scale:
</span>
<xsl:value-of select="Pain/Scale"/>
<xsl:text> - </xsl:text>
<xsl:value-of select="Pain/Level" />
</div>
</xsl:if>
<xsl:if test="string-length(Pupils/LeftPupils) >0">
<div style="text-align: none;">
<span style="font-size: 9pt;font-style: italic;">
Pupils:
</span>
<xsl:text>Left: </xsl:text>
<xsl:value-of select="Pupils/LeftPupils"/>
<xsl:text> </xsl:text>
<xsl:value-of select="Pupils/Leftmm"/>
<xsl:text> mm</xsl:text>
<xsl:text> Right: </xsl:text>
<xsl:value-of select="Pupils/RightPupils"/>
<xsl:text> </xsl:text>
<xsl:value-of select="Pupils/Rightmm"/>
<xsl:if test="string-length(Pupils/RightPupils) >0">
<xsl:text> mm</xsl:text>
</xsl:if>
</div>
</xsl:if>
<xsl:if test="string-length(GCS/Type) > 0">
<div style="text-align: none;">
<span style="font-size: 9pt;font-style: italic;">
Glasgow Coma Scale:
</span>
<xsl:if test="string-length(GCS/EyeOpening) > 0">
<xsl:text>Eye Opening: </xsl:text>
<xsl:value-of select="GCS/EyeOpening" />
</xsl:if>
<xsl:if test="string-length(GCS/VerbalResponse) > 0">
<xsl:text> Verbal: </xsl:text>
<xsl:value-of select="GCS/VerbalResponse" />
</xsl:if>
<xsl:if test="string-length(GCS/Motor) > 0">
<xsl:text> Motor: </xsl:text>
<xsl:value-of select="GCS/Motor" />
</xsl:if>
<xsl:if test="string-length(GCS/Score) > 0">
<xsl:text> Score: </xsl:text>
<xsl:value-of select="GCS/Score" />
</xsl:if>
</div>
</xsl:if>
</xsl:when>
</xsl:choose>
</div>
<br/>
</td>
</tr>
</xsl:for-each>
</table>
<br/>
<br/>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XML:
<Visit> <Vitals> <Type>ED</Type> <DateTimeTaken> <datetimetaken>2012-10-09T10:08:00</datetimetaken> <Date>10/09/2012</Date> <Time>10:08</Time> </DateTimeTaken> <DateTimeRecorded>10/09/2012 10:09</DateTimeRecorded> <BP> <High>110</High> <Low>180</Low> <Site></Site> <Position></Position> <Deferred></Deferred> </BP> <Temp> <Temp>99.0</Temp> <Site>Temporal</Site> <Deferred></Deferred> </Temp> <RespRate> <RespRate>11</RespRate> <Deferred></Deferred> </RespRate> <Pulse> <Pulse>11</Pulse> <Rhythm></Rhythm> <Deferred></Deferred> </Pulse> <Sat> <SaO2>1</SaO2> <Liters></Liters> <RA></RA> </Sat> <Pain> <Level>4</Level> <Scale>Numeric</Scale> <Deferred></Deferred> </Pain> <Pupils> <LeftPupils>Brisk</LeftPupils> <Leftmm>1</Leftmm> <RightPupils>Brisk</RightPupils> <Rightmm>1</Rightmm> </Pupils> <GCS> <Score>6</Score> <Type>adult</Type> <EyeOpening>4 - Spontaneous</EyeOpening> <VerbalResponse>1 - None</VerbalResponse> <Motor>1 - None</Motor> </GCS> <Acute> <Aline></Aline> <CVP></CVP> <ICP></ICP> <ET></ET> <FI></FI> </Acute> <username>Jay Tarantino, MD-Attending</username> <ProgressNote></ProgressNote> <ErrorReason></ErrorReason> <IsDeleted>0</IsDeleted> <UserId>jmt67</UserId> <vitalsid>140</vitalsid> </Vitals> <Vitals> <Type>ED</Type> <DateTimeTaken> <datetimetaken>2012-10-09T10:27:00</datetimetaken> <Date>10/09/2012</Date> <Time>10:27</Time> </DateTimeTaken> <DateTimeRecorded>10/09/2012 10:28</DateTimeRecorded> <BP> <High>111</High> <Low>1</Low> <Site>LeftArm</Site> <Position>Sitting</Position> <Deferred></Deferred> </BP> <Temp> <Temp>111.0</Temp> <Site>Temporal</Site> <Deferred></Deferred> </Temp> <RespRate> <RespRate>1</RespRate> <Deferred></Deferred> </RespRate> <Pulse> <Pulse>11</Pulse> <Rhythm>Regular</Rhythm> <Deferred></Deferred> </Pulse> <Sat> <SaO2>1</SaO2> <Liters></Liters> <RA>RA</RA> </Sat> <Pain> <Level>4</Level> <Scale>Numeric</Scale> <Deferred></Deferred> </Pain> <Pupils> <LeftPupils>Brisk</LeftPupils> <Leftmm>1</Leftmm> <RightPupils>Brisk</RightPupils> <Rightmm>1</Rightmm> </Pupils> <GCS> <Score>6</Score> <Type>adult</Type> <EyeOpening>4 - Spontaneous</EyeOpening> <VerbalResponse>1 - None</VerbalResponse> <Motor=""> 1 - None</Motor> </GCS> <Acute> <Aline>110/80</Aline> <CVP></CVP> <ICP></ICP> <ET></ET> <FI></FI> </Acute> <username>Jay Test, MD-Attending</username> <ProgressNote></ProgressNote> <ErrorReason></ErrorReason> <IsDeleted>0</IsDeleted> <UserId>fake</UserId> <vitalsid>141</vitalsid> </Vitals> </Visit>
Labels:
.NET,
c sharp,
c#,
code,
html,
transforms,
Web Development,
XML,
XSL,
XSLT
Subscribe to:
Posts (Atom)