Show createPrescription.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="urn:hl7-org:v3">
<xsl:template match="text()|@*"/>
<xsl:param name="now"/>
<xsl:param name="OID"/>
<xsl:param name="patientPHN"/>
<xsl:param name="providerName"/>
<xsl:param name="Drug-name"/>
<xsl:param name="Drug-quantity"/>
<xsl:param name="Drug-doseInstruction"/>
<xsl:param name="Drug-dosePerDay"/>
<xsl:param name="Drug-dosePerDay-unit"/>
<xsl:param name="Drug-refills">1</xsl:param>
<xsl:param name="xslDir"/>
<xsl:variable name="datafile">
<xsl:value-of select="$xslDir"/>Data.xml
</xsl:variable>
<xsl:variable name="Data" select="document($datafile)/Data"/>
<xsl:variable name="Drugs" select="$Data/drugs"/>
<xsl:variable name="Providers" select="$Data/providers"/>
<xsl:template match="/">
<xsl:variable name="Drug" select="$Drugs/drug[name = $Drug-name]"/>
<xsl:variable name="provider" select="$Providers/provider[name = $providerName]"/>
<PORX_IN010380CA ITSVersion="XML_1.0" xmlns="urn:hl7-org:v3" xmlns:hl7="urn:hl7-org:v3">
<id root="2.16.124.9.101.1.8.1" extension="df7fdf18-ff9b-48c4-98c6-9a7891e64e94">
<xsl:attribute name="extension">
<xsl:value-of select="$OID"/>
</xsl:attribute>
</id>
<creationTime value="20060101000001">
<xsl:attribute name="value">
<xsl:value-of select="$now"/>
</xsl:attribute>
</creationTime>
<versionCode code="V3-2005-05"/>
<interactionId root="2.16.840.1.113883.1.6" extension="PORX_IN010380CA"/>
<processingCode code="P"/>
<processingModeCode code="T"/>
<acceptAckCode code="ER"/>
<receiver>
<telecom use="WP" value="uri:198.203.1.23"/>
<device>
<id root="2.16.124.9.101.1.1"/>
</device>
</receiver>
<sender>
<telecom use="WP" value="uri:198.203.1.21"/>
<device>
<id root="2.16.124.9.101.1.3"/>
</device>
</sender>
<controlActEvent classCode="CACT" moodCode="EVN">
<id root="2.16.124.9.101.1.8.5" extension="df7fdf18-ff9b-48c4-98c6-9a7891e64e94">
<xsl:attribute name="extension">
<xsl:value-of select="$OID"/>
</xsl:attribute>
</id>
<code code="PORX_TE010730UV"/>
<statusCode code="completed"/>
<effectiveTime value="20060101000001">
<xsl:attribute name="value">
<xsl:value-of select="$now"/>
</xsl:attribute>
</effectiveTime>
<!-- person responsible for the event that caused this message - the pharmacist, doctor, or most likely a public health nurse -->
<author typeCode="AUT">
<time value="20050101102001">
<xsl:attribute name="value">
<xsl:value-of select="$now"/>
</xsl:attribute>
</time>
<!--ParticipationMode - Indicates how the person who recorded the event became aware of it -->
<modeCode code="PHYSICAL"/>
<assignedPerson>
<!-- pharmacist or prescriber id -->
<id root="2.16.124.9.101.1.1.7" extension="123456">
<xsl:attribute name="root">
<xsl:value-of select="$provider/id/@root"/>
</xsl:attribute>
<xsl:attribute name="extension">
<xsl:value-of select="$provider/id/@extension"/>
</xsl:attribute>
</id>
<!-- HealthcareProviderRoleType -->
<code nullFlavor="NI"/>
<representedPerson>
<name nullFlavor="NI"/>
</representedPerson>
</assignedPerson>
</author>
<!-- An identification of a service location (or facility) where health service has been or can be delivered. E.g. Pharmacy -->
<location>
<serviceDeliveryLocation>
<!-- a pharmacy id -->
<id root="2.16.124.9.101.1.1.2" extension="123445">
<xsl:attribute name="root">
<xsl:value-of select="$provider/location/@root"/>
</xsl:attribute>
<xsl:attribute name="extension">
<xsl:value-of select="$provider/location/@extension"/>
</xsl:attribute>
</id>
<addr/>
<telecom nullFlavor="NI"/>
<location>
<name nullFlavor="NI"/>
</location>
</serviceDeliveryLocation>
</location>
<subject contextConductionInd="false">
<combinedMedicationRequest>
<code code="DRUG"/>
<statusCode code="active"/>
<confidentialityCode code="NORMAL"/>
<directTarget>
<medication>
<player>
<code code="1911473" codeSystem="2.16.840.1.113883.5.1105">
<xsl:attribute name="code">
<xsl:value-of select="$Drug/code/@code"/>
</xsl:attribute>
<xsl:attribute name="codeSystem">
<xsl:value-of select="$Drug/code/@codeSystem"/>
</xsl:attribute>
</code>
<name>
<xsl:value-of select="$Drug/name"/>
</name>
<asContent>
<quantity value="100">
<xsl:attribute name="value">
<xsl:value-of select="$Drug-quantity"/>
</xsl:attribute>
</quantity>
<containerPackagedMedicine>
<formCode code="STRIP"/>
</containerPackagedMedicine>
</asContent>
</player>
</medication>
</directTarget>
<subject>
<patient>
<id root="2.1" extension="">
<xsl:attribute name="extension">
<xsl:value-of select="$patientPHN"/>
</xsl:attribute>
</id>
<telecom nullFlavor="NI"/>
<patientPerson>
<name nullFlavor="NI"/>
<administrativeGenderCode nullFlavor="NI"/>
<birthTime nullFlavor="NI"/>
</patientPerson>
</patient>
</subject>
<reason>
<priorityNumber value="1"/>
<observationDiagnosis classCode="OBS">
<code code="DX"/>
<statusCode code="completed"/>
<value code="1" codeSystem="2.16.840.1.113883.11.19436"/>
</observationDiagnosis>
</reason>
<precondition>
<verificationEventCriterion>
<code code="VFPAPER"/>
</verificationEventCriterion>
</precondition>
<component1>
<dosageInstruction moodCode="EVN">
<code code="DRUG"/>
<text>
<xsl:value-of select="$Drug-doseInstruction"/>
</text>
<routeCode code="PO"/>
<maxDoseQuantity>
<numerator value="1" unit="cap">
<xsl:attribute name="value">
<xsl:value-of select="$Drug-dosePerDay"/>
</xsl:attribute>
<xsl:attribute name="unit">
<xsl:value-of select="$Drug-dosePerDay-unit"/>
</xsl:attribute>
</numerator>
<denominator value="1" unit="day"/>
</maxDoseQuantity>
<administrationUnitCode code="PUFF"/>
<consumable>
<medication3>
<player>
<code code="1911473" codeSystem="2.16.840.1.113883.5.1105">
<xsl:attribute name="code">
<xsl:value-of select="$Drug/code/@code"/>
</xsl:attribute>
<xsl:attribute name="codeSystem">
<xsl:value-of select="$Drug/code/@codeSystem"/>
</xsl:attribute>
</code>
<name>
<xsl:value-of select="$Drug/name"/>
</name>
<asContent>
<quantity value="100">
<xsl:attribute name="value">
<xsl:value-of select="$Drug-quantity"/>
</xsl:attribute>
</quantity>
<containerPackagedMedicine>
<formCode code="STRIP"/>
</containerPackagedMedicine>
</asContent>
</player>
</medication3>
</consumable>
</dosageInstruction>
</component1>
<component2 negationInd="false">
<trialSupplyPermission>
<code code="TF"/>
</trialSupplyPermission>
</component2>
<component3>
<!-- 1..1 nillable PORX_MT010120CA.SupplyRequest -->
<supplyRequest>
<!-- 1..1 nillable PORX_MT010120CA.Location2 -->
<!-- Indicates the pharmacy to which the prescription has been directed or which has currently assumed responsibility for dispensing the prescription. -->
<!-- Allows prescriptions to be directed on the request of the patient or by legal requirement. Also allows indication of which pharmacy is the current 'custodian' of the prescription.
This should always be known or should have an explicit null flavor of 'NA' (non-assigned) or 'UNK' (paper prescription). Thus the association is 'populated'. -->
<location>
<!-- 1..1 nillable COCT_MT240003CA.ServiceDeliveryLocation -->
<!-- An identification of a service location (or facility) where health service has been or can be delivered. E.g. Pharmacy, Medical Clinic, Hospital -->
<!-- Used for tracking service delivery responsibility, to provide contact information for follow-up and for statistical analysis. Also important for indicating where paper records can be located. -->
<serviceDeliveryLocation>
<!-- 1..1 II -->
<!-- Unique identifier for a healthcare service location. -->
<!-- Allows for lookup and retrieval of detailed information about a specific service location. Also ensures unique identification of service location and is therefore mandatory.
The identifier is mandatory because it is the principal mechanism for uniquely identifying the facility. -->
<id nullFlavor="NI"/>
<!-- 1..1 AD -->
<!-- The information by which a service location may be contacted either physically or by mail. -->
<!-- Identifies the physical location of a service location and also allows for the location to be contacted.
The address is marked as 'populated' because it is considered a critical piece of information about the facility, but may not always be available or meaningful. -->
<addr/>
<!-- 1..5 TEL -->
<!-- The phone numbers and/or electronic mail adresses by which a service location may be contacted. -->
<!-- Allows a service location to be communicated with and is therefore important. Because a contact number won't always exist, the field is marked 'populated'. -->
<!-- Check: Validation says that WP is not an allowed value -->
<telecom nullFlavor="NI"/>
<!-- 1..1 nillable COCT_MT240003CA.Place -->
<location>
<!-- 1..1 ST -->
<!-- The name assigned to the service location. -->
<!-- Used for human communication but may not always be available. It is therefore marked as 'populated'. -->
<name/>
</location>
</serviceDeliveryLocation>
</location>
<!-- 1..5 PORX_MT010120CA.Component -->
<!-- Identifies the dispense instructions for each drug to be dispensed -->
<!-- Handled as a separate class to allow for multi-drug prescriptions. E.g. 40mg tablets + 50mg tablets.
Note that this is NOT intended to combine independent drugs, but rather multiple strengths of the same overall drug.
The association is mandatory because specific supply instructions must be given for at least one medication. -->
<component>
<!-- 1..1 PORX_MT010120CA.SupplyRequestItem -->
<!-- Specification of the overall use duration of the prescrbed medication and/or overall quantity to be dispensed. -->
<!-- Sets the parameters within which the dispenser must operate in dispensing the medication to the patient. -->
<supplyRequestItem>
<quantity>
<xsl:attribute name="value"><xsl:value-of select="$Drug-quantity"/></xsl:attribute>
</quantity>
<!-- 1..1 IVL_TS -->
<!-- The number of days that the overall prescribed item is expected to last, if the patient is compliant with the dispensing and administration of the prescription. -->
<!-- Used to specify a total authorization as a duration rather than a quantity with refills. E.g. dispense 30 at a time, refill for 1 year.
May also be sent as an estimate of the expected overall duration of the prescription based on the quantity prescribed.
This attribute is mandatory because the prescriber (in discussion with the patient) has a better understanding of the days supply needed by the patient. -->
<expectedUseTime>
<width value="100" unit="d"/>
</expectedUseTime>
<!-- 1..1 PORX_MT010120CA.Component8 -->
<!-- Indicates the total number of fills allowed on this prescription.
This number includes the first fill. Thus, number of refills on the prescription is this number less 1. -->
<!-- Used for compliance checking
This participation is mandatory to ensure that a dispense instruction has at least one fill specification. -->
<component1>
<!-- 1..1 INT -->
<sequenceNumber value="1"/>
<!-- 1..1 PORX_MT010120CA.SubsequentSupplyRequest -->
<subsequentSupplyRequest>
<repeatNumber value="">
<xsl:attribute name="value">
<xsl:value-of select="$Drug-refills"/>
</xsl:attribute>
</repeatNumber>
</subsequentSupplyRequest>
</component1>
</supplyRequestItem>
</component>
</supplyRequest>
</component3>
<componentOf>
<workingListEvent>
<code code="CHRON"/>
</workingListEvent>
</componentOf>
</combinedMedicationRequest>
</subject>
</controlActEvent>
</PORX_IN010380CA>
</xsl:template>
</xsl:stylesheet>
See more files for this project here