Code Search for Developers
 
 
  

prescriptionGrid.xsl from HL7v3 Test Harness at Krugle


Show prescriptionGrid.xsl syntax highlighted

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:hl7="urn:hl7-org:v3">
  
    <xsl:param name="DataSet"/>
    
    <xsl:template match="text()|@*"></xsl:template>
    
    
    <xsl:template match="/">
        <Items>
            <xsl:if test="$DataSet/Items">
                <xsl:copy-of select="$DataSet/Items/*"/>
            </xsl:if>
            <xsl:apply-templates/>
        </Items>
    </xsl:template>
    
    <xsl:template match="hl7:combinedMedicationRequest">
        <xsl:variable name="total-quantity" select="hl7:component3[1]/hl7:supplyRequest[1]/hl7:component[1]/hl7:supplyRequestItem[1]/hl7:quantity[1]/@value"/>
        <xsl:variable name="total-quantity-unit" select="hl7:component3[1]/hl7:supplyRequest[1]/hl7:component[1]/hl7:supplyRequestItem[1]/hl7:quantity[1]/@unit"/>
        <xsl:variable name="refills" select="hl7:component3[1]/hl7:supplyRequest[1]/hl7:component[1]/hl7:supplyRequestItem[1]/hl7:component2[1]/hl7:subsequentSupplyRequest[1]/hl7:repeatNumber[1]/@value"/>
        <xsl:variable name="quantity" select="hl7:component3[1]/hl7:supplyRequest[1]/hl7:component[1]/hl7:supplyRequestItem[1]/hl7:component2[1]/hl7:subsequentSupplyRequest[1]/hl7:quantity[1]/@value"/>
        <xsl:variable name="quantity-unit" select="hl7:component3[1]/hl7:supplyRequest[1]/hl7:component[1]/hl7:supplyRequestItem[1]/hl7:component2[1]/hl7:subsequentSupplyRequest[1]/hl7:quantity[1]/@unit"/>

        <prescription>
            <xsl:variable name="Rx-number" select="hl7:id/@extension"/>
            <xsl:attribute name="Rx"><xsl:value-of select="$Rx-number"/></xsl:attribute>
            <xsl:attribute name="Date"><xsl:value-of select="hl7:author[1]/hl7:time"/></xsl:attribute>
            <xsl:attribute name="Status"><xsl:value-of select="hl7:statusCode/@code"/></xsl:attribute>
            <xsl:attribute name="Drug"><xsl:value-of select="hl7:directTarget[1]/hl7:medication[1]/hl7:player[1]/hl7:name[1]"/></xsl:attribute>
            <xsl:attribute name="Quantity"><xsl:value-of select="$total-quantity"/><xsl:value-of select="$total-quantity-unit"/></xsl:attribute>
            <xsl:attribute name="Refills"><xsl:value-of select="$refills"/></xsl:attribute>
            <xsl:attribute name="Dosage_Per_Day"><xsl:value-of select="hl7:component1[1]/hl7:dosageInstruction[1]/hl7:maxDoseQuantity[1]/hl7:numerator[1]/@value"/></xsl:attribute>
            <xsl:attribute name="Dosage_Instruction"><xsl:value-of select="hl7:component1[1]/hl7:dosageInstruction[1]/hl7:text[1]"/></xsl:attribute>
            <xsl:attribute name="Prescriber"><xsl:value-of select="hl7:author[1]/hl7:assignedPerson[1]/hl7:representedPerson[1]/hl7:name[1]/hl7:given[1]"/><xsl:text> </xsl:text><xsl:value-of select="hl7:author[1]/hl7:assignedPerson[1]/hl7:representedPerson[1]/hl7:name[1]/hl7:family[1]"/></xsl:attribute>
            <xsl:attribute name="Dispensed">
                <xsl:choose>
                    <xsl:when test="hl7:fulfillment[1]/hl7:medicationDispense[1]"><xsl:text>true (</xsl:text><xsl:value-of select="count(hl7:fulfillment/hl7:medicationDispense)"/><xsl:text>)</xsl:text></xsl:when>
                    <xsl:otherwise>false</xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
            <xsl:for-each select="hl7:fulfillment/hl7:medicationDispense">
                <dispense>
                    <xsl:attribute name="ID"><xsl:value-of select="hl7:id/@extension"/></xsl:attribute>
                    <xsl:attribute name="Rx"><xsl:value-of select="$Rx-number"/></xsl:attribute>
                    <xsl:attribute name="Date"><xsl:value-of select="hl7:component1/hl7:supplyEvent/hl7:effectiveTime/hl7:low/@value"/></xsl:attribute>
                    <xsl:attribute name="Pickup_date"><xsl:value-of select="hl7:component1/hl7:supplyEvent/hl7:effectiveTime/hl7:high/@value"/></xsl:attribute>
                    <xsl:attribute name="Drug"><xsl:value-of select="hl7:component1[1]/hl7:supplyEvent[1]/hl7:product[1]/hl7:medication[1]/hl7:player[1]/hl7:name[1]"/></xsl:attribute>
                    <xsl:attribute name="Quantity"><xsl:value-of select="hl7:component1/hl7:supplyEvent/hl7:quantity/@value"/><xsl:value-of select="hl7:component1/hl7:supplyEvent/hl7:quantity/@unit"/></xsl:attribute>
                    <xsl:attribute name="Dosage_Per_Day"><xsl:value-of select="hl7:component2[1]/hl7:dosageInstruction[1]/hl7:maxDoseQuantity[1]/hl7:numerator[1]/@value"/></xsl:attribute>
                    <xsl:attribute name="Dosage_Instruction"><xsl:value-of select="hl7:component2[1]/hl7:dosageInstruction[1]/hl7:text[1]"/></xsl:attribute>
                </dispense>
            </xsl:for-each>
        </prescription>
    </xsl:template>
    
</xsl:stylesheet>



See more files for this project here

HL7v3 Test Harness

The HL7 Test Harness system is an HL7 v3 message conformance testing application that also provides the ability to simulate the message processing actions of a client and/or server system. The app provides message workflow, format and content testing.

Project homepage: http://sourceforge.net/projects/hl7-testharness
Programming language(s): C#,XML
License: gpl2

  Data.xml
  allergyGrid.xsl
  allergyQuery.xsl
  createAllergy.xsl
  createDispense.xsl
  createDispensePickup.xsl
  createPrescription.xsl
  dispenseGrid.xsl
  patientSearch.xsl
  prescriptionGrid.xsl
  prescriptionQuery.xsl
  searchGrid.xsl