source: ccr2ccd-xslt/trunk/make/ccd-header.xsl@ 1119

Last change on this file since 1119 was 875, checked in by George Lilly, 14 years ago

broke the stylesheet into pieces with a script to reassemble

File size: 7.9 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3Conversion of CCR to Level 3 CCD
4
5Orginal Author: Ken Miller
6Solventus LLC
7ken.miller@solventus.coms
8
9Contributors:
10Richard Braman, EHR Doctors, Inc rbraman@ehrdoctors.com
11George Lilly (WorldVistA glilly@glilly.net)
12xxxx - Oroville Hospital
13
14Date: 2010-05-5
15Version: 0.1
16
17License :
18
19 This program is free software: you can redistribute it and/or modify
20 it under the terms of the GNU General Public License as published by
21 the Free Software Foundation, either version 3 of the License, or
22 (at your option) any later version.
23
24 This program is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 GNU General Public License for more details.
28
29 You should have received a copy of the GNU General Public License
30 along with this program. If not, see http://www.gnu.org/licenses.
31
32-->
33<xsl:stylesheet version="1.0" xmlns="urn:hl7-org:v3" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:astm-org:CCR" xmlns:date="http://exslt.org/dates-and-times"
34xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="a date">
35 <xsl:import href="./templates/cdavocablookup.xsl"/>
36 <xsl:import href="./templates/hl7oidlookup.xsl"/>
37 <xsl:import href="./templates/code.xsl"/>
38 <xsl:import href="./templates/actor.xsl"/>
39 <xsl:import href="./templates/datetime.xsl"/>
40 <xsl:import href="./templates/problemDescription.xsl"/>
41
42 <xsl:output method="xml" encoding="utf-8" version="1.0" indent="yes"/>
43 <xsl:template match="/">
44 <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:sdtc="urn:hl7-org:sdtc" xsi:schemaLocation="urn:hl7-org:v3 http://xreg2.nist.gov:8080/hitspValidation/schema/cdar2c32/infrastructure/cda/C32_CDA.xsd" classCode="DOCCLIN" moodCode="EVN">
45 <realmCode code="US"/>
46 <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
47 <templateId root="2.16.840.1.113883.10.20.1"/>
48 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.1"/>
49 <templateId root="2.16.840.1.113883.10.20.3"/>
50 <templateId root="2.16.840.1.113883.3.88.11.32.1"/>
51
52 <id>
53 <xsl:attribute name="root">
54 <xsl:value-of select="/a:ContinuityOfCareRecord/a:CCRDocumentObjectID"></xsl:value-of>
55 </xsl:attribute>
56 </id>
57 <code code="34133-9" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Summarization of episode note"/>
58 <xsl:variable name="fromID" select="/a:ContinuityOfCareRecord/a:From/a:ActorLink[1]/a:ActorID"/>
59 <xsl:variable name="ccrFromActorObjectID" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$fromID]/a:InternalCCRLink[a:LinkRelationship='representedOrganization']/a:LinkID"/>
60 <title>Continuity of Care Document from <xsl:value-of select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrFromActorObjectID]/a:Organization/a:Name"/></title>
61 <effectiveTime>
62 <xsl:attribute name="value">
63 <xsl:call-template name="date:format-date">
64 <xsl:with-param name="date-time" select="/a:ContinuityOfCareRecord/a:DateTime/a:ExactDateTime"/>
65 <xsl:with-param name="pattern">yyyyMMddhhmmss+0000</xsl:with-param>
66 </xsl:call-template>
67 </xsl:attribute>
68 </effectiveTime>
69 <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
70 <languageCode code="en-US"/>
71
72 <recordTarget typeCode="RCT" contextControlCode="OP">
73 <patientRole>
74 <xsl:call-template name="ccdPatientRole">
75 <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:Patient[1]/a:ActorID"/>
76 </xsl:call-template>
77 </patientRole>
78 </recordTarget>
79
80 <author>
81 <time>
82 <xsl:attribute name="value">
83 <xsl:call-template name="date:format-date">
84 <xsl:with-param name="date-time" select="/a:ContinuityOfCareRecord/a:DateTime/a:ExactDateTime"/>
85 <xsl:with-param name="pattern">yyyyMMddhhmmss</xsl:with-param>
86 </xsl:call-template>
87 </xsl:attribute>
88 </time>
89 <xsl:call-template name="ccdAssignedAuthor">
90 <xsl:with-param name="ccrActorObjectID" select="$fromID"/>
91 </xsl:call-template>
92 </author>
93
94 <xsl:if test="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$fromID]/a:InternalCCRLink[a:LinkRelationship='representedOrganization']">
95 <custodian>
96 <assignedCustodian>
97 <xsl:call-template name="ccdOrganization">
98 <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$fromID]/a:InternalCCRLink[a:LinkRelationship='representedOrganization']/a:LinkID"/>
99 <xsl:with-param name="organizationNodeName" select="'representedCustodianOrganization'"/>
100 </xsl:call-template>
101 </assignedCustodian>
102 </custodian>
103 </xsl:if>
104
105 <documentationOf>
106 <serviceEvent classCode="PCPR">
107 <effectiveTime>
108 <low>
109 <xsl:attribute name="value">
110 <xsl:call-template name="date:format-date">
111 <xsl:with-param name="date-time">
112 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body//a:DateTime//a:ExactDateTime">
113 <xsl:sort order="ascending"/>
114 <xsl:if test="position()=1">
115 <xsl:value-of select="."/>
116 </xsl:if>
117 </xsl:for-each>
118 </xsl:with-param>
119 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
120 </xsl:call-template>
121 </xsl:attribute>
122 </low>
123 <high>
124 <xsl:attribute name="value">
125 <xsl:call-template name="date:format-date">
126 <xsl:with-param name="date-time">
127 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body//a:DateTime//a:ExactDateTime">
128 <xsl:sort order="descending"/>
129 <xsl:if test="position()=1">
130 <xsl:value-of select="."/>
131 </xsl:if>
132 </xsl:for-each>
133 </xsl:with-param>
134 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
135 </xsl:call-template>
136 </xsl:attribute>
137 </high>
138 </effectiveTime>
139 </serviceEvent>
140
141 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:HealthCareProviders/a:Provider">
142 <xsl:call-template name="ccdAssignedEntity">
143 <xsl:with-param name="ccrActorObjectID" select="a:ActorID"/>
144 </xsl:call-template>
145 </xsl:for-each>
146
147 </documentationOf>
148
149 <component>
150 <structuredBody>
Note: See TracBrowser for help on using the repository browser.