source: ccr2ccd-xslt/trunk/make/New-ccr_qrda.xsl@ 1004

Last change on this file since 1004 was 1004, checked in by George Lilly, 13 years ago

final PQRI files

File size: 63.0 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<?xml-stylesheet type="text/xsl" href="cda.xsl"?>
3
4<!--
5Conversion of CCR to Level 3 CCD
6
7Orginal Author: Ken Miller
8Solventus LLC
9ken.miller@solventus.coms
10
11Contributors:
12Richard Braman, EHR Doctors, Inc rbraman@ehrdoctors.com
13George Lilly (WorldVistA glilly@glilly.net)
14Nancy Antracite, WorldVistA
15xxxx - Oroville Hospital
16
17Date: 2010-05-5
18Version: 0.1
19
20License :
21
22 This program is free software: you can redistribute it and/or modify
23 it under the terms of the GNU General Public License as published by
24 the Free Software Foundation, either version 3 of the License, or
25 (at your option) any later version.
26
27 This program is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
31
32 You should have received a copy of the GNU General Public License
33 along with this program. If not, see http://www.gnu.org/licenses.
34
35-->
36<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"
37xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="a date">
38 <xsl:import href="./templates/cdavocablookup.xsl"/>
39 <xsl:import href="./templates/hl7oidlookup.xsl"/>
40 <xsl:import href="./templates/code.xsl"/>
41 <xsl:import href="./templates/actor.xsl"/>
42 <xsl:import href="./templates/datetime.xsl"/>
43 <xsl:import href="./templates/problemDescription.xsl"/>
44
45 <xsl:output method="xml" encoding="utf-8" version="1.0" indent="yes"/>
46 <xsl:template match="/">
47<!--WV Added new munltiple documentation of added have to do with encounter times, etc.-->
48
49<!--
50********************************************************
51CDA Header
52********************************************************
53-->
54
55<!--
56******************
57Document Information
58**********************
59-->
60<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd">
61 <!-- Created with XML Copy Editor Open Source Sourceforge project. -->
62<!--WVP This is the clinical document type ID-->
63 <realmCode code="US"/>
64 <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
65 <!-- QRDA Category I generic template ID. -->
66 <!--WVP these next two lines are fixed-->
67 <templateId root="2.16.840.1.113883.10.20.12" />
68 <!--only in the july spec so not sure if it should be here-->
69 <templateId root="2.16.840.1.113883.3.249.11.100.1"/>
70 <!--WVV 2.16.840.1.113883.3.543 is fixed and is the beginninng of WorldVistAs OID, change the extension for a new document and the version for changes to this one-->
71
72
73 <!--Script replaces UUID each time if the version number is 1-->
74 <id root="2.16.840.1.113883.3.543" extension="@@@UUID-DOC@@@"/>
75
76 <!-- <xsl:attribute name="root">
77 <xsl:value-of select="/a:ContinuityOfCareRecord/a:CCRDocumentObjectID"></xsl:value-of>
78 </xsl:attribute>
79 </id>-->
80 <!--WVP next two lines fixed-->
81 <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
82 <title>QRDA Incidence Report</title>
83 <!--WVV time-->
84 <effectiveTime value="20100703"/>
85 <!--WVP for next two lines-->
86 <confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
87 <languageCode code="en-US"/>
88 <!--WV? Don't change this in the document set we are working on-->
89 <setId root="2.16.840.1.113883.3.543" extension="@@@UUID-SET@@@"/>
90 <versionNumber value="1"/>
91 <!--WVP I made one up but we will have to have an OID for the Clincal Document SET which we will make up for ourselves eventually-->
92
93 <!--
94 *******************
95 Patient Information
96 ****************
97 -->
98 <!-- This is the patient for which the report is describing. -->
99 <recordTarget>
100<patientRole>
101 <xsl:call-template name="ccdPatientRole">
102 <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:Patient[1]/a:ActorID"/>
103 </xsl:call-template>
104 </patientRole>
105 </recordTarget>
106
107<!--
108*****************************
109Author
110**************
111-->
112 <!-- This example assumes the doctor is creating the report and it is Required. -->
113 <author>
114 <!--WVV Edit time has to be precise at least to the day-->
115 <time value="20100703" />
116 <assignedAuthor>
117 <!--WVP eventually id this is required, the root is fixed -->
118 <!--andn the extension is the SOFTWARE version number assigned by CMS to WV EHR-->
119 <id root="2.16.840.1.113883.3.249.6" extension="100001" />
120 <!--WVVassignedPerson not required-->
121 <assignedPerson>
122 <name>
123 <!--WV Edit-->
124 <given>Nancy</given>
125 <family>Anthracite</family>
126 <suffix>MD</suffix>
127 </name>
128 </assignedPerson>
129 <representedOrganization>
130 <!--WV? id root is OID for the organization so I made one up for this document set-->
131 <id root="2.16.840.1.113883.3.543" extension="1558574526" />
132 <name>WorldVistA Test Clinic</name>
133 </representedOrganization>
134 </assignedAuthor>
135 </author>
136 <!-- The reporting healthcare facility is represented using the CCD "Source of Information" construct, via the Informant participant. -->
137 <informant>
138 <assignedEntity>
139 <!--WV this null flavor is required as is-->
140 <id nullFlavor="NA"/>
141 <representedOrganization>
142 <!--WV root is the OID of the organization. ID is required but name is not and id is OID stated earlier-->
143 <id root="2.16.840.1.113883.3.543" extension="1558574526" />
144 <name>World VistA Test Clinic</name>
145 </representedOrganization>
146 </assignedEntity>
147 </informant>
148
149 <!-- This example assumes that the institution responsible for the data is serving as custodian. -->
150 <!--WV This element is required as is the sSD which is not stated if it is an OID but assumed it is-->
151 <!--WV Name is not required, only ID is required.-->
152 <custodian>
153 <assignedCustodian>
154 <representedCustodianOrganization>
155 <id root="2.16.840.1.113883.3.543" extension="1558574526" />
156 <name>WorldVistA Test Clinic</name>
157 </representedCustodianOrganization>
158 </assignedCustodian>
159 </custodian>
160
161 <!-- In this example, the author is also serving as legal authenticator. -->
162 <!--WV section is this is not required-->
163<legalAuthenticator>
164 <time value="20100703" />
165 <!--WV the signature code of S is required-->
166 <signatureCode code="S" />
167 <assignedEntity>
168 <!--WV document does not specify the requirements of the id but it is required-->
169 <!--WVP and the sample suggests it is the number below and extension is ???-->
170 <id root="2.16.840.1.113883.3.543" extension="111111" />
171 <assignedPerson>
172 <name>
173 <given>Nancy</given>
174 <family>Anthracite</family>
175 <suffix>MD</suffix>
176 </name>
177 </assignedPerson>
178 <representedOrganization>
179 <!--WV? and is fixed for the WorldVistA Test Clinic in this submitted document series-->
180 <id root="2.16.840.1.113883.3.543" extension="1558574526" />
181 <name>WorldVistA Test Clinic</name>
182 </representedOrganization>
183 </assignedEntity>
184 </legalAuthenticator>
185
186
187
188 <!--Added to sample as it is new since 2008-->
189 <!--WVP permanent for participant in the primary care provider participant-->
190<!--WVP performer type codes are numerous but PRF is performer or the person who did it-->
191 <participant typeCode="PRF">
192 <!--WVP required as is for function-->
193 <!-- WVP I believe PCP is primary care provider but not sure-->
194 <functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
195 <!--WVP Associated Entity is required ti be there with this PROV-->
196 <associatedEntity classCode="PROV">
197 <!--WV? OID of the provider fixed for this series of documents-->
198 <id root="2.16.840.1.113883.3.249.6" extension="111111" />
199 <!--WV associated person is not required so presumabley the code will suffice not sure??-->
200 <associatedPerson>
201 <name>
202 <prefix>Dr.</prefix>
203 <given>Nancy</given>
204 <family>Anthracite</family>
205 </name>
206 </associatedPerson>
207 </associatedEntity>
208 </participant>
209
210 <!--The service event is the encounter that describes tehe encunter as well as the provider, location and time-->
211 <!--!There can be one or more documentation elements depending on the number of encounters during the reporting period-->
212 <!--WVV IMPORTANT!! The encounter codeds are recorded here-->
213 <!-- They are in appendix B of the downloadable resource document-->
214 <!-- Each documentation of is a single service event-->
215
216<!--Occurence of Measures episode documention-->
217<!--Like an encounter section only for QRDA-->
218<!--Same doctor, same clinic, different date and different enconter code-->
219
220
221 <!--First Visit documentationOf section-->
222<!--DOCUMENTATIONOFSECTION-->
223
224 <!--
225********************************************************
226CDA Body
227********************************************************
228-->
229 <component>
230 <structuredBody>
231 <MeasuresSection/>
232 <!--***********the following two component and sections tags will have to be removed when the measures section is put back in -->
233 <component>
234 <section>
235 <component>
236 <section>
237 <!--
238 ********************************************************
239 Patient Data
240 ********************************************************
241 -->
242 <component>
243 <section>
244 <code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
245 <title>Patient Data</title>
246
247 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Problems">
248 <component>
249 <section>
250 <templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
251 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
252 <templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
253 <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
254 <title>Problems</title>
255 <text>
256 <table>
257 <tbody>
258 <tr>
259 <th>Type</th>
260 <th>Date</th>
261 <th>Code</th>
262 <th>Description</th>
263 <th>Status</th>
264 <th>Source</th>
265 </tr>
266 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
267 <tr>
268 <td>
269 <xsl:value-of select="a:Type/a:Text"/>
270 </td>
271 <td>
272 <table>
273 <tbody>
274 <xsl:apply-templates select="a:DateTime"/>
275 </tbody>
276 </table>
277 </td>
278 <td>
279 <xsl:apply-templates select="a:Description/a:Code"/>
280 </td>
281 <td>
282 <xsl:attribute name="ID">
283 <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
284 </xsl:attribute>
285 <xsl:value-of select="a:Description/a:Text"/>
286 </td>
287 <td>
288 <xsl:value-of select="a:Status/a:Text"/>
289 </td>
290 <td>
291 <xsl:call-template name="actorName">
292 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
293 </xsl:call-template>
294 </td>
295 </tr>
296 </xsl:for-each>
297 </tbody>
298 </table>
299 </text>
300 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
301 <entry typeCode="DRIV">
302 <act classCode="ACT" moodCode="EVN">
303 <templateId root="2.16.840.1.113883.10.20.1.27"/>
304 <!-- Problem act template -->
305
306 <!-- <id> -->
307 <xsl:call-template name="ccdID">
308 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
309 </xsl:call-template>
310
311 <code nullFlavor="NA"/>
312
313 <xsl:call-template name="ccdPerformer">
314 <xsl:with-param name="ccrActorReference" select="a:Source/a:Actor"/>
315 </xsl:call-template>
316
317 <entryRelationship typeCode="SUBJ">
318 <observation classCode="OBS" moodCode="EVN">
319 <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
320 <!--Problem observation template-->
321 <templateId root="2.16.840.1.113883.3.249.11.100.8"/>
322
323 <!-- <id> -->
324 <xsl:call-template name="ccdID">
325 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
326 <xsl:with-param name="suffix"></xsl:with-param>
327 </xsl:call-template>
328 <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
329<!--SEE IF THIS FIXES OUR PROBLEM-->
330 <!-- <code xsi:type="CE" code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>-->
331 <statusCode code="completed"/>
332 <!-- <text>
333 <reference>
334 <xsl:attribute name="value">
335 <xsl:text>#</xsl:text>
336 <xsl:value-of select="a:CCRDataObjectID"/>
337 </xsl:attribute>
338 </reference>
339 </text>-->
340
341 <xsl:call-template name="ccdDateTime">
342 <xsl:with-param name="dt" select="a:DateTime"/>
343 </xsl:call-template>
344
345 <xsl:call-template name="ccdCodedValue">
346 <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
347 </xsl:call-template>
348
349 <xsl:call-template name="ccdStatus">
350 <xsl:with-param name="ccrStatus" select="a:Status"/>
351 </xsl:call-template>
352 </observation>
353 </entryRelationship>
354
355 </act>
356 </entry>
357 </xsl:for-each>
358 </section>
359 </component>
360 </xsl:if>
361 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Procedures">
362 <component>
363 <section>
364 <templateId root="2.16.840.1.113883.10.20.1.12"/>
365 <code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
366 <title>Procedures</title>
367 <text>
368 <table>
369 <tbody>
370 <tr>
371 <th>Type</th>
372 <th>Date</th>
373 <th>Code</th>
374 <th>Description</th>
375 <th>Location</th>
376 <th>Substance</th>
377 <th>Method</th>
378 <th>Position</th>
379 <th>Site</th>
380 <th>Status</th>
381 <th>Source</th>
382 </tr>
383 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
384 <tr>
385 <xsl:attribute name="id">
386 <xsl:value-of select="a:CCRDataObjectID"/>
387 </xsl:attribute>
388
389 <td>
390 <xsl:value-of select="a:Type/a:Text"/>
391 </td>
392 <table>
393 <tbody>
394 <xsl:apply-templates select="a:DateTime"/>
395 </tbody>
396 </table>
397 <td>
398 <xsl:apply-templates select="a:Description/a:Code"/>
399 </td>
400 <td>
401 <xsl:value-of select="a:Description/a:Text"/>
402 </td>
403 <td>
404 <xsl:for-each select="a:Locations/a:Location">
405 <xsl:value-of select="a:Description/a:Text"/>
406 <xsl:if test="a:Actor">
407 (<xsl:call-template name="actorName">
408 <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
409 </xsl:call-template>
410 <xsl:if test="a:Actor/a:ActorRole/a:Text">
411 <xsl:text xml:space="preserve"> - </xsl:text><xsl:value-of select="a:ActorRole/a:Text"/>)
412 </xsl:if>
413 </xsl:if>)
414 <xsl:if test="position() != last()">
415 <br/>
416 </xsl:if>
417 </xsl:for-each>
418 </td>
419 <td>
420 <xsl:for-each select="a:Substance">
421 <xsl:value-of select="a:Text"/>
422 </xsl:for-each>
423 </td>
424 <td>
425 <xsl:value-of select="a:Method/a:Text"/>
426 </td>
427 <td>
428 <xsl:value-of select="a:Position/a:Text"/>
429 </td>
430 <td>
431 <xsl:value-of select="a:Site/a:Text"/>
432 </td>
433 <td>
434 <xsl:value-of select="a:Status/a:Text"/>
435 </td>
436 <td>
437 <xsl:call-template name="actorName">
438 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
439 </xsl:call-template>
440 </td>
441 </tr>
442 </xsl:for-each>
443 </tbody>
444 </table>
445 </text>
446
447 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
448 <entry typeCode="DRIV">
449 <procedure classCode="PROC" moodCode="EVN">
450 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
451 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
452 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
453
454 <!-- <id> -->
455 <xsl:call-template name="ccdID">
456 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
457 </xsl:call-template>
458
459 <!-- <code> -->
460 <xsl:call-template name="ccdCodedValue">
461 <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
462 <xsl:with-param name="nodeName" select="'code'"/>
463 </xsl:call-template>
464
465 <text>
466 <reference>
467 <xsl:attribute name="value">
468 <xsl:text>#</xsl:text>
469 <xsl:value-of select="a:CCRDataObjectID"/>
470 </xsl:attribute>
471 </reference>
472 </text>
473
474 <xsl:call-template name="ccdStatusProcedure">
475 <xsl:with-param name="status" select="a:Status"/>
476 </xsl:call-template>
477
478 <xsl:call-template name="ccdDateTime">
479 <xsl:with-param name="dt" select="a:DateTime"/>
480 </xsl:call-template>
481
482 <xsl:if test="a:Method">
483 <xsl:call-template name="ccdCodedValue">
484 <xsl:with-param name="ccrCodedDescription" select="a:Method"/>
485 <xsl:with-param name="nodeName" select="'approachSiteCode'"/>
486 </xsl:call-template>
487 </xsl:if>
488
489 <xsl:if test="a:Site">
490 <xsl:call-template name="ccdCodedValue">
491 <xsl:with-param name="ccrCodedDescription" select="a:Site"/>
492 <xsl:with-param name="nodeName" select="'targetSiteCode'"/>
493 </xsl:call-template>
494 </xsl:if>
495
496 <xsl:if test="a:Practitioners/a:Practitioner">
497 <xsl:call-template name="ccdPerformer">
498 <xsl:with-param name="ccrActorReference" select="a:Practitioners/a:Practitioner[1]"/>
499 </xsl:call-template>
500 </xsl:if>
501 </procedure>
502 </entry>
503 </xsl:for-each>
504 </section>
505 </component>
506 </xsl:if>
507<component>
508<section>
509<!--We are including only a coverage activity for Medicare here. There is also policy activity and and authorization activity that I don't think we need to report for QRDA, at least not for most reports-->
510<templateId root="2.16.840.1.113883.10.20.1.9"/>
511<!-- 48768-6 is payment sources and is fixed CQ-188,189,190-->
512<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
513<!--CQ-191,192-->
514<title>Payers</title>
515<text>
516</text>
517<!--medicare-->
518<entry typeCode="DRIV">
519<!--WVP moodCode is DEF is definition to describe the characteristics of who must be involved in an act CQ-194,195-->
520<act classCode="ACT" moodCode="DEF">
521<!--WVP coverage activity template is the 10.20.1.20 CQ-193-->
522<templateId root="2.16.840.1.113883.10.20.1.20"/>
523<!--Coverage Shall Include and Act ID CQ-196-->
524<!--looks like a UUID to me-->
525<id root="2.16.840.1.113883.3.543" extension="@@@UUID-PAYER@@@"/><!--FIX!!!???-->
526<!--CQ-197-198 It appears that statusCode="completed" need to follow the code code ... here and below-->
527
528<!--CQ199,200-->
529<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
530<statusCode code="completed"/>
531
532<!--A coverage activity shall contain on or more act/entryRelationship. The value for act/entryRelationship/@typeCode shall be COMP which SHALL be the CMS QRDA Policy Activity CQ-201, 203-->
533<!--It MAY contain an entryRelationship/sequenceNumber CQ-202-->
534<entryRelationship typeCode="COMP">
535<!-- for the act is event with moodCode EVN CQ-205,206,207-->
536<act classCode="ACT" moodCode="EVN">
537<!--Policy activity is the 10.20.1.26 template CQ-205-->
538<templateId root="2.16.840.1.113883.10.20.1.26"/>
539<templateId root="2.16.840.1.113883.3.249.11.100.7"/>
540
541<!-- act/id which is the group or contract number related to the insurance policy or program CQ-208-->
542<id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/><!--!!!FIX-->
543<!--Act statusCode must be completed CQ-210-->
544<!--This SHOULD be present and comes from the downloadable resource S display name is in quotes AUTOPOL - "automobile" policy;EHCPOL additional insurance in addition to Medicare in this case
545HSAPOL "Health Spending Account";PUBLICPOL "public healthcare" which is NOT Medicare - maybe a state program for example
546WBCPOL is "workers compensation" CQ-211,212-->
547<!--<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>-->
548<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
549<!--WVP performer type codes are numerous but PRF is performer representing the Payer CQ-213-->
550<statusCode code="completed"/>
551<performer typeCode="PRF">
552
553<!--performer/assignedEntity id is the payer identification and the extension comes from the downloadable resource section I insurance plan TYPE CQ-214-->
554<assignedEntity>
555<id root="2.16.840.1.113883.12.86" extension="MC"/>
556<!--<representedOrganization>
557<name>CMS</name>
558</representedOrganization>-->
559</assignedEntity>
560</performer>
561<!-- Act/participant @typeCode this represents the covered party CQ-215-->
562<participant typeCode="COV">
563<participantRole>
564<!--A covered party in a policy activity SHOULD contain one or more participant/participantRole/id to represent the patien's member of subscriber identifier with respect to the payer
565For participant/paricipantRole/id either the Social Security Number or HIC Number SHALL be submitted for Medicare patients. for SSN the ID @root SHALL be 2.16.840.1.113883.4.1 where
566the HIC id/@root shall be 2.16.840.1.113883.3.249.13 CQ-216"RoleCode" in the downloadable resource-->
567<!-- in this case theextension is the patients SSN for a medicare patient so it is the same each time for one patient-->
568<id root="2.16.840.1.113883.4.1" extension="@@SSN@@"/>
569<!--The covered party in tha policy activity SHOULD contain exactly one particpant/participantRole/code for self, family etc from the valuse set PolicyOrPrograCoverageRoleType 2.16.840.1.113883.1.11.19809 CQ-217,218-->
570<code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
571</participantRole>
572</participant>
573</act>
574</entryRelationship>
575</act>
576</entry>
577</section>
578</component>
579</section>
580</component>
581</section>
582</component>
583</section>
584</component>
585</structuredBody>
586</component>
587</ClinicalDocument>
588 </xsl:template>
589 <xsl:template name="ccdAssignedEntity">
590 <xsl:param name="ccrActorObjectID"/>
591
592 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
593
594 <assignedEntity>
595 <xsl:call-template name="ccdEntityID">
596 <xsl:with-param name="CCRActor" select="$CCRActor"/>
597 </xsl:call-template>
598
599 <xsl:call-template name="ccdAddress">
600 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address"/>
601 </xsl:call-template>
602
603 <xsl:call-template name="ccdTelecom">
604 <xsl:with-param name="CCRActor" select="$CCRActor"/>
605 </xsl:call-template>
606
607 <xsl:if test="$CCRActor/a:Person">
608 <xsl:call-template name="ccdPerson">
609 <xsl:with-param name="CCRActorPerson" select="$CCRActor/a:Person"/>
610 <xsl:with-param name="personNodeName" select="'assignedPerson'"/>
611 </xsl:call-template>
612 </xsl:if>
613
614 <xsl:if test="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']">
615 <xsl:call-template name="ccdOrganization">
616 <xsl:with-param name="ccrActorObjectID" select="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']/a:LinkID"/>
617 <xsl:with-param name="organizationNodeName" select="'representedOrganization'"/>
618 </xsl:call-template>
619 </xsl:if>
620
621 </assignedEntity>
622 </xsl:template>
623
624 <xsl:template name="ccdPatient">
625 <xsl:param name="CCRActorPerson"/>
626 <patient>
627 <xsl:call-template name="ccdPersonName">
628 <xsl:with-param name="CCRActorName" select="$CCRActorPerson/a:Name"/>
629 </xsl:call-template>
630
631 <xsl:if test="$CCRActorPerson/a:Gender">
632 <xsl:call-template name="ccdCodedValue">
633 <xsl:with-param name="ccrCodedDescription" select="$CCRActorPerson/a:Gender"/>
634 <xsl:with-param name="domain" select="'AdministrativeGender'"/>
635 <xsl:with-param name="nodeName" select="'administrativeGenderCode'"/>
636 </xsl:call-template>
637 </xsl:if>
638
639 <xsl:if test="$CCRActorPerson/a:DateOfBirth">
640 <birthTime>
641 <xsl:attribute name="value">
642 <xsl:call-template name="date:format-date">
643 <xsl:with-param name="date-time" select="$CCRActorPerson/a:DateOfBirth/a:ExactDateTime"/>
644 <xsl:with-param name="pattern">yyyyMMddhhmmss</xsl:with-param>
645 </xsl:call-template>
646 </xsl:attribute>
647 </birthTime>
648 </xsl:if>
649
650 <xsl:if test="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Marital Status']">
651 <xsl:call-template name="ccdCodedValue">
652 <xsl:with-param name="ccrCodedDescription" select="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Marital Status']/a:Description"/>
653 <xsl:with-param name="domain" select="'MaritalStatus'"/>
654 <xsl:with-param name="nodeName" select="'maritalStatusCode'"/>
655 </xsl:call-template>
656 </xsl:if>
657
658 <xsl:if test="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Language']">
659 <languageCommunication>
660 <templateId root="2.16.840.1.113883.3.88.11.83.2" assigningAuthorityName="HITSP/C83"/>
661 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1" assigningAuthorityName="IHE/PCC"/>
662 <xsl:call-template name="ccdCodedValue">
663 <xsl:with-param name="ccrCodedDescription" select="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Language']/a:Description"></xsl:with-param>
664 <xsl:with-param name="domain" select="'HumanLanguage'"/>
665 <xsl:with-param name="nodeName" select="'languageCode'"/>
666 </xsl:call-template>
667 </languageCommunication>
668 </xsl:if>
669 </patient>
670 </xsl:template>
671
672 <xsl:template name="ccdPerformer">
673 <xsl:param name="ccrActorReference"/>
674 <performer typeCode="PRF">
675 <xsl:if test="$ccrActorReference/a:ActorRole">
676 <xsl:call-template name="ccdCodedValue">
677 <xsl:with-param name="ccrCodedDescription" select="$ccrActorReference/a:ActorRole"/>
678 <xsl:with-param name="nodeName" select="'functionCode'"/>
679 </xsl:call-template>
680 </xsl:if>
681 <xsl:call-template name="ccdAssignedEntity">
682 <xsl:with-param name="ccrActorObjectID" select="$ccrActorReference/a:ActorID"/>
683 </xsl:call-template>
684 </performer>
685 </xsl:template>
686
687 <xsl:template name="ccdPerson">
688 <xsl:param name="CCRActorPerson"/>
689 <xsl:param name="personNodeName">assignedPerson</xsl:param>
690 <xsl:element name="{$personNodeName}">
691 <xsl:call-template name="ccdPersonName">
692 <xsl:with-param name="CCRActorName" select="$CCRActorPerson/a:Name"/>
693 </xsl:call-template>
694 </xsl:element>
695 </xsl:template>
696
697 <xsl:template name="ccdPersonName">
698 <xsl:param name="CCRActorName"/>
699 <name>
700 <xsl:if test="$CCRActorName/a:CurrentName/a:Title">
701 <prefix>
702 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Title"/>
703 </prefix>
704 </xsl:if>
705 <xsl:if test="$CCRActorName/a:CurrentName/a:Given">
706 <given>
707 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Given"/>
708 </given>
709 </xsl:if>
710 <xsl:if test="$CCRActorName/a:CurrentName/a:Middle">
711 <given>
712 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Middle"/>
713 </given>
714 </xsl:if>
715 <xsl:if test="$CCRActorName/a:CurrentName/a:Family">
716 <family>
717 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Family"/>
718 </family>
719 </xsl:if>
720 <xsl:if test="$CCRActorName/a:CurrentName/a:Suffix">
721 <suffix>
722 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Suffix"/>
723 </suffix>
724 </xsl:if>
725 </name>
726 </xsl:template>
727
728 <xsl:template name="ccdOrganization">
729 <xsl:param name="ccrActorObjectID"/>
730 <xsl:param name="organizationNodeName"/>
731
732 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
733
734 <xsl:element name="{$organizationNodeName}">
735 <xsl:call-template name="ccdEntityID">
736 <xsl:with-param name="CCRActor" select="$CCRActor"/>
737 </xsl:call-template>
738 <xsl:call-template name="ccdTelecom">
739 <xsl:with-param name="CCRActor" select="$CCRActor"/>
740 </xsl:call-template>
741
742 <xsl:call-template name="ccdAddress">
743 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
744 </xsl:call-template>
745 </xsl:element>
746 </xsl:template>
747
748 <xsl:template name="ccdPatientRole">
749 <xsl:param name="ccrActorObjectID"/>
750
751 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
752
753 <xsl:call-template name="ccdEntityID">
754 <xsl:with-param name="CCRActor" select="$CCRActor"/>
755 </xsl:call-template>
756
757 <xsl:call-template name="ccdAddress">
758 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
759 </xsl:call-template>
760
761 <xsl:call-template name="ccdTelecom">
762 <xsl:with-param name="CCRActor" select="$CCRActor"/>
763 </xsl:call-template>
764
765 <xsl:call-template name="ccdPatient">
766 <xsl:with-param name="CCRActorPerson" select="$CCRActor/a:Person"/>
767 </xsl:call-template>
768 </xsl:template>
769
770 <xsl:template name="ccdAssignedAuthor">
771 <xsl:param name="ccrActorObjectID"/>
772 <assignedAuthor>
773 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
774
775 <xsl:call-template name="ccdEntityID">
776 <xsl:with-param name="CCRActor" select="$CCRActor"/>
777 </xsl:call-template>
778
779 <xsl:call-template name="ccdAddress">
780 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
781 </xsl:call-template>
782
783 <xsl:call-template name="ccdTelecom">
784 <xsl:with-param name="CCRActor" select="$CCRActor"/>
785 </xsl:call-template>
786
787 <xsl:call-template name="ccdPerson">
788 <xsl:with-param name="CCRActorPerson" select="$CCRActor/a:Person"/>
789 </xsl:call-template>
790
791 <xsl:if test="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']">
792 <representedOrganization>
793 <xsl:call-template name="ccdOrganization">
794 <xsl:with-param name="ccrActorObjectID" select="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']/a:LinkID"/>
795 </xsl:call-template>
796 </representedOrganization>
797 </xsl:if>
798 </assignedAuthor>
799 </xsl:template>
800
801 <xsl:template name="ccdParticipantRoleActor">
802 <xsl:param name="ccrActorObjectID"/>
803
804 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
805
806 <xsl:call-template name="ccdEntityID">
807 <xsl:with-param name="CCRActor" select="$CCRActor"/>
808 </xsl:call-template>
809
810 <xsl:call-template name="ccdAddress">
811 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
812 </xsl:call-template>
813
814 <xsl:call-template name="ccdTelecom">
815 <xsl:with-param name="CCRActor" select="$CCRActor"/>
816 </xsl:call-template>
817
818 <xsl:if test="$CCRActor/a:Organization/a:Name">
819 <playingEntity classCode="PLC">
820 <name>
821 <xsl:value-of select="$CCRActor/a:Organization/a:Name"/>
822 </name>
823 </playingEntity>
824 </xsl:if>
825 </xsl:template>
826
827 <xsl:template name="ccdParticipantRoleCodedDescription">
828 <xsl:param name="ccrCodedDescription"/>
829 <participantRole classCode="MANU">
830 <!--Product Detail-->
831 <playingEntity classCode="MMAT">
832 <xsl:if test="$ccrCodedDescription/a:Code">
833 <xsl:call-template name="ccdCodedValue">
834 <xsl:with-param name="ccrCodedDescription" select="$ccrCodedDescription"/>
835 <xsl:with-param name="nodeName" select="'code'"/>
836 </xsl:call-template>
837 </xsl:if>
838 <name>
839 <xsl:value-of select="$ccrCodedDescription/a:Text"/>
840 </name>
841 </playingEntity>
842 </participantRole>
843 </xsl:template>
844
845 <xsl:template name="ccdEntityID">
846 <xsl:param name="CCRActor"/>
847 <id>
848 <xsl:choose>
849 <xsl:when test="$CCRActor/a:IDs">
850 <xsl:attribute name="extension">
851 <xsl:value-of select="$CCRActor/a:IDs[1]/a:ID"/>
852 </xsl:attribute>
853 <xsl:attribute name="root">
854 <xsl:value-of select="$CCRActor/a:IDs[1]/a:Type/a:Text"/>
855 </xsl:attribute>
856 </xsl:when>
857 <xsl:otherwise>
858 <xsl:attribute name="extension">
859 <xsl:value-of select="$CCRActor/a:ActorObjectID"/>
860 </xsl:attribute>
861 <xsl:attribute name="root">
862 <xsl:text>CCRActorID</xsl:text>
863 </xsl:attribute>
864 </xsl:otherwise>
865 </xsl:choose>
866 </id>
867 <xsl:if test="$CCRActor/a:Organization">
868 <name><xsl:value-of select="$CCRActor/a:Organization/a:Name"></xsl:value-of></name>
869 </xsl:if>
870 </xsl:template>
871 <xsl:template name="ccdAddress">
872 <xsl:param name="CCRActorAddress"/>
873 <addr>
874 <xsl:choose>
875 <xsl:when test="$CCRActorAddress">
876 <xsl:attribute name="use">
877 <xsl:call-template name="CDAVocabularyLookup">
878 <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
879 <xsl:with-param name="ccrtext" select="$CCRActorAddress/a:Type/a:Text"/>
880 </xsl:call-template>
881 </xsl:attribute>
882 <streetAddressLine>
883 <xsl:value-of select="$CCRActorAddress/a:Line1"/>
884 </streetAddressLine>
885 <city>
886 <xsl:value-of select="$CCRActorAddress/a:City"/>
887 </city>
888 <state>
889 <xsl:value-of select="$CCRActorAddress/a:State"/>
890 </state>
891 <postalCode>
892 <xsl:value-of select="$CCRActorAddress/a:PostalCode"/>
893 </postalCode>
894 </xsl:when>
895 <xsl:otherwise>
896 <streetAddressLine/>
897 </xsl:otherwise>
898 </xsl:choose>
899 </addr>
900 </xsl:template>
901
902 <xsl:template name="ccdTelecom">
903 <xsl:param name="CCRActor"/>
904 <telecom>
905 <xsl:if test="$CCRActor/a:Telephone">
906 <xsl:attribute name="use">
907 <xsl:call-template name="CDAVocabularyLookup">
908 <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
909 <xsl:with-param name="ccrtext" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
910 </xsl:call-template>
911 </xsl:attribute>
912 <xsl:attribute name="value">
913 <xsl:text>tel:+1-</xsl:text>
914 <xsl:value-of select="$CCRActor/a:Telephone[1]/a:Value"/>
915 </xsl:attribute>
916 </xsl:if>
917 </telecom>
918
919 <xsl:if test="$CCRActor/a:Email">
920 <telecom>
921 <xsl:choose>
922 <xsl:when test="$CCRActor/a:Telephone">
923 <xsl:attribute name="use">
924 <xsl:call-template name="CDAVocabularyLookup">
925 <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
926 <xsl:with-param name="ccrtext" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
927 </xsl:call-template>
928 </xsl:attribute>
929 <xsl:attribute name="value">
930 <xsl:text>mailto:</xsl:text>
931 <xsl:value-of select="$CCRActor/a:Email[1]/a:Value"/>
932 </xsl:attribute>
933 </xsl:when>
934 <xsl:otherwise>
935 <xsl:attribute name="value">
936 <xsl:text>Unknown</xsl:text>
937 </xsl:attribute>
938 </xsl:otherwise>
939 </xsl:choose>
940 </telecom>
941 </xsl:if>
942 </xsl:template>
943
944 <xsl:template name="ccdID">
945 <xsl:param name="ccrObjectID"/>
946 <xsl:param name="suffix"/>
947 <id>
948 <xsl:attribute name="root">
949 <xsl:value-of select="$ccrObjectID"></xsl:value-of>
950 </xsl:attribute>
951 <xsl:attribute name="extension">CCRObjectID</xsl:attribute>
952 </id>
953 </xsl:template>
954
955 <xsl:template name="ccdCodedValue">
956 <xsl:param name="ccrCodedDescription"/>
957 <xsl:param name="type"/>
958 <xsl:param name="domain"/>
959 <xsl:param name="nodeName">value</xsl:param>
960 <xsl:param name="originalTextReference"/>
961
962 <xsl:element name="{$nodeName}">
963 <xsl:if test="$type">
964 <xsl:attribute name="xsi:type">
965 <xsl:value-of select="$type"/>
966 </xsl:attribute>
967 </xsl:if>
968 <xsl:choose>
969 <xsl:when test="$ccrCodedDescription/a:Code">
970 <xsl:attribute name="displayName">
971 <xsl:value-of select="$ccrCodedDescription/a:Text"/>
972 </xsl:attribute>
973 <xsl:attribute name="code">
974 <xsl:value-of select="$ccrCodedDescription/a:Code/a:Value"/>
975 </xsl:attribute>
976 <xsl:attribute name="codeSystemName">
977 <xsl:value-of select="$ccrCodedDescription/a:Code/a:CodingSystem"/>
978 </xsl:attribute>
979 <xsl:attribute name="codeSystem">
980 <xsl:call-template name="HL7OIDLookup">
981 <xsl:with-param name="name" select="$ccrCodedDescription/a:Code/a:CodingSystem"/>
982 </xsl:call-template>
983 </xsl:attribute>
984 </xsl:when>
985 <xsl:when test="$domain">
986 <xsl:variable name="cdaCode">
987 <xsl:call-template name="CDAVocabularyLookup">
988 <xsl:with-param name="domain" select="$domain"/>
989 <xsl:with-param name="ccrtext" select="$ccrCodedDescription/a:Text"/>
990 </xsl:call-template>
991 </xsl:variable>
992 <xsl:attribute name="displayName">
993 <xsl:call-template name="CDADisplayNameLookup">
994 <xsl:with-param name="domain" select="$domain"/>
995 <xsl:with-param name="cdacode" select="$cdaCode"/>
996 </xsl:call-template>
997 </xsl:attribute>
998 <xsl:attribute name="code">
999 <xsl:value-of select="$cdaCode"></xsl:value-of>
1000 </xsl:attribute>
1001 <xsl:attribute name="codeSystemName">
1002 <xsl:call-template name="CDAVocabularyCodeSystemNameLookup">
1003 <xsl:with-param name="domain" select="$domain"/>
1004 </xsl:call-template>
1005 </xsl:attribute>
1006 <xsl:attribute name="codeSystemName">
1007 <xsl:call-template name="CDAVocabularyCodeSystemLookup">
1008 <xsl:with-param name="domain" select="$domain"/>
1009 </xsl:call-template>
1010 </xsl:attribute>
1011 </xsl:when>
1012 <xsl:otherwise>
1013 <originalText>
1014 <xsl:value-of select="$ccrCodedDescription/a:Text"/>
1015 <xsl:if test="$originalTextReference">
1016 <reference>
1017 <xsl:attribute name="value">
1018 <xsl:value-of select="$originalTextReference"/>
1019 </xsl:attribute>
1020 </reference>
1021 </xsl:if>
1022 </originalText>
1023 </xsl:otherwise>
1024 </xsl:choose>
1025 </xsl:element>
1026 </xsl:template>
1027
1028 <xsl:template name="ccdDateTime">
1029 <xsl:param name="dt"/>
1030 <xsl:param name="type"/>
1031 <xsl:if test="$dt">
1032 <xsl:if test="$dt[1]/a:ExactDateTime">
1033 <effectiveTime>
1034 <xsl:if test="$type">
1035 <xsl:attribute name="xsi:type">
1036 <xsl:value-of select="$type"></xsl:value-of>
1037 </xsl:attribute>
1038 </xsl:if>
1039 <low>
1040 <xsl:attribute name="value">
1041 <xsl:call-template name="date:format-date">
1042 <xsl:with-param name="date-time" select="$dt[1]/a:ExactDateTime"/>
1043 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
1044 </xsl:call-template>
1045 </xsl:attribute>
1046 </low>
1047 <high nullFlavor="UNK"/>
1048 </effectiveTime>
1049 </xsl:if>
1050 <xsl:if test="$dt[1]/a:DateTimeRange">
1051 <effectiveTime>
1052 <low>
1053 <xsl:attribute name="value">
1054 <xsl:call-template name="date:format-date">
1055 <xsl:with-param name="date-time" select="$dt[1]/a:DateTimeRange/a:BeginRange/a:ExactDateTime"/>
1056 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
1057 </xsl:call-template>
1058 </xsl:attribute>
1059 </low>
1060 <high>
1061 <xsl:attribute name="value">
1062 <xsl:call-template name="date:format-date">
1063 <xsl:with-param name="date-time" select="$dt[1]/a:DateTimeRange/a:EndRange/a:ExactDateTime"/>
1064 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
1065 </xsl:call-template>
1066 </xsl:attribute>
1067 </high>
1068 </effectiveTime>
1069 </xsl:if>
1070 </xsl:if>
1071 </xsl:template>
1072
1073 <xsl:template name="ccdMedicationFrequency">
1074 <xsl:param name="frequency"/>
1075 <xsl:if test="$frequency">
1076 <xsl:choose>
1077 <xsl:when test="$frequency/a:Value='qd'">
1078 <effectiveTime xsi:type="PIVL_TS" operator="A">
1079 <xsl:attribute name="institutionSpecified">true</xsl:attribute>
1080 <period>
1081 <xsl:attribute name="value">24</xsl:attribute>
1082 <xsl:attribute name="unit">h</xsl:attribute>
1083 </period>
1084 </effectiveTime>
1085 </xsl:when>
1086 <xsl:when test="$frequency/a:Value='bid'">
1087 <effectiveTime xsi:type="PIVL_TS" operator="A">
1088 <xsl:attribute name="institutionSpecified">true</xsl:attribute>
1089 <period>
1090 <xsl:attribute name="value">12</xsl:attribute>
1091 <xsl:attribute name="unit">h</xsl:attribute>
1092 </period>
1093 </effectiveTime>
1094 </xsl:when>
1095 <xsl:when test="$frequency/a:Value='tid'">
1096 <effectiveTime xsi:type="PIVL_TS" operator="A">
1097 <xsl:attribute name="institutionSpecified">true</xsl:attribute>
1098 <period>
1099 <xsl:attribute name="value">8</xsl:attribute>
1100 <xsl:attribute name="unit">h</xsl:attribute>
1101 </period>
1102 </effectiveTime>
1103 </xsl:when>
1104 <xsl:when test="$frequency/a:Value='qid'">
1105 <effectiveTime xsi:type="PIVL_TS" operator="A">
1106 <xsl:attribute name="institutionSpecified">true</xsl:attribute>
1107 <period>
1108 <xsl:attribute name="value">6</xsl:attribute>
1109 <xsl:attribute name="unit">h</xsl:attribute>
1110 </period>
1111 </effectiveTime>
1112 </xsl:when>
1113 <xsl:when test="$frequency/a:Value='qam'">
1114 <effectiveTime xsi:type='EIVL' operator='A'>
1115 <event code='ACM'/>
1116 </effectiveTime>
1117 </xsl:when>
1118 <xsl:when test="$frequency/a:Value='qpm'">
1119 <effectiveTime xsi:type='EIVL' operator='A'>
1120 <event code='PCV'/>
1121 </effectiveTime>
1122 </xsl:when>
1123 </xsl:choose>
1124 </xsl:if>
1125 </xsl:template>
1126
1127 <xsl:template name="ccdStatus">
1128 <xsl:param name="ccrStatus"/>
1129
1130 <entryRelationship typeCode="REFR">
1131 <observation classCode="OBS" moodCode="EVN">
1132 <templateId root="2.16.840.1.113883.10.20.1.50"/>
1133 <!-- Problem status observation template -->
1134 <code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
1135 <statusCode code="completed"/>
1136 <xsl:call-template name="ccdCodedValue">
1137 <xsl:with-param name="ccrCodedDescription" select="$ccrStatus"/>
1138 </xsl:call-template>
1139 </observation>
1140 </entryRelationship>
1141 </xsl:template>
1142
1143 <xsl:template name="ccdStatusObservation">
1144 <xsl:param name="status"/>
1145 <xsl:variable name="statusText" select="$status/a:Text"></xsl:variable>
1146 <xsl:choose>
1147 <xsl:when test="$statusText='Active'">
1148 <xsl:call-template name="ccdStatusElement">
1149 <xsl:with-param name="statusCode" select="'55561003'"/>
1150 <xsl:with-param name="statusDisplayName" select="$statusText"/>
1151 </xsl:call-template>
1152 </xsl:when>
1153 <xsl:when test="$statusText='Inactive'">
1154 <xsl:call-template name="ccdStatusElement">
1155 <xsl:with-param name="statusCode" select="'73425007'"/>
1156 <xsl:with-param name="statusDisplayName" select="$statusText"/>
1157 </xsl:call-template>
1158 </xsl:when>
1159 <xsl:when test="$statusText='Chronic'">
1160 <xsl:call-template name="ccdStatusElement">
1161 <xsl:with-param name="statusCode" select="'90734009'"/>
1162 <xsl:with-param name="statusDisplayName" select="$statusText"/>
1163 </xsl:call-template>
1164 </xsl:when>
1165 </xsl:choose>
1166 </xsl:template>
1167
1168 <xsl:template name="ccdStatusProcedure">
1169 <xsl:param name="status"/>
1170 <xsl:variable name="statusText" select="$status/a:Text"></xsl:variable>
1171 <xsl:choose>
1172 <xsl:when test="$statusText='Completed'">
1173 <statusCode code="completed"/>
1174 </xsl:when>
1175 <xsl:when test="$statusText='Active'">
1176 <statusCode code="active"/>
1177 </xsl:when>
1178 <xsl:when test="$statusText='Aborted'">
1179 <statusCode code="aborted"/>
1180 </xsl:when>
1181 <xsl:when test="$statusText='Cancelled' or $statusText='Canceled'">
1182 <statusCode code="cancelled"/>
1183 </xsl:when>
1184 <xsl:otherwise>
1185 <statusCode>
1186 <xsl:attribute name="code">
1187 <xsl:value-of select="$statusText"></xsl:value-of>
1188 </xsl:attribute>
1189 </statusCode>
1190 </xsl:otherwise>
1191 </xsl:choose>
1192 </xsl:template>
1193
1194 <xsl:template name="ccdStatusElement">
1195 <xsl:param name="statusCode"/>
1196 <xsl:param name="statusDisplayName"/>
1197 <value>
1198 <xsl:attribute name="xsi:type">CE</xsl:attribute>
1199 <xsl:attribute name="code">
1200 <xsl:value-of select="$statusCode"></xsl:value-of>
1201 </xsl:attribute>
1202 <xsl:attribute name="codeSystem">2.16.840.1.113883.6.96</xsl:attribute>
1203 <xsl:attribute name="displayName">
1204 <xsl:value-of select="$statusDisplayName"></xsl:value-of>
1205 </xsl:attribute>
1206 </value>
1207 </xsl:template>
1208
1209 <xsl:template name="ccdObservation">
1210 <xsl:param name="ccrTestNode"/>
1211 <xsl:param name="testDate"/>
1212
1213 <component>
1214 <observation classCode="OBS" moodCode="EVN">
1215 <templateId root="2.16.840.1.113883.3.88.11.83.15" assigningAuthorityName="HITSP C83"/>
1216 <templateId root="2.16.840.1.113883.10.20.1.31" assigningAuthorityName="CCD"/>
1217 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.13" assigningAuthorityName="IHE PCC"/>
1218
1219 <!-- Result observation template -->
1220
1221 <xsl:call-template name="ccdID">
1222 <xsl:with-param name="ccrObjectID" select="$ccrTestNode/a:CCRDataObjectID"/>
1223 </xsl:call-template>
1224
1225 <!-- <code> -->
1226 <xsl:call-template name="ccdCodedValue">
1227 <xsl:with-param name="ccrCodedDescription" select="$ccrTestNode/a:Description"/>
1228 <xsl:with-param name="nodeName" select="'code'"/>
1229 </xsl:call-template>
1230
1231 <text>
1232 <reference>
1233 <xsl:attribute name="value">
1234 <xsl:text>#</xsl:text>
1235 <xsl:value-of select="$ccrTestNode/a:CCRDataObjectID"/>
1236 </xsl:attribute>
1237 </reference>
1238 </text>
1239
1240 <statusCode code="completed"/>
1241
1242 <!-- <effectiveTime> -->
1243 <xsl:choose>
1244 <xsl:when test="$ccrTestNode/a:DateTime">
1245 <xsl:call-template name="ccdDateTime">
1246 <xsl:with-param name="dt" select="$ccrTestNode/a:DateTime"/>
1247 </xsl:call-template>
1248 </xsl:when>
1249 <xsl:otherwise>
1250 <xsl:call-template name="ccdDateTime">
1251 <xsl:with-param name="dt" select="$testDate"/>
1252 </xsl:call-template>
1253 </xsl:otherwise>
1254 </xsl:choose>
1255
1256 <xsl:choose>
1257 <xsl:when test="$ccrTestNode/a:TestResult[a:Value!='']">
1258 <value xsi:type="PQ">
1259 <xsl:attribute name="value">
1260 <xsl:value-of select="$ccrTestNode/a:TestResult/a:Value"/>
1261 </xsl:attribute>
1262 <xsl:attribute name="unit">
1263 <xsl:value-of select="$ccrTestNode/a:TestResult/a:Units/a:Unit"/>
1264 </xsl:attribute>
1265 </value>
1266 </xsl:when>
1267 <xsl:when test="$ccrTestNode/a:TestResult[a:Description/a:Text!='']">
1268 <value xsi:type="TX">
1269 <xsl:attribute name="value">
1270 <xsl:value-of select="$ccrTestNode/a:TestResult/a:Description/a:Text"/>
1271 </xsl:attribute>
1272 </value>
1273 </xsl:when>
1274 </xsl:choose>
1275
1276 <xsl:if test="$ccrTestNode/a:Flag">
1277 <xsl:call-template name="ccdCodedValue">
1278 <xsl:with-param name="ccrCodedDescription" select="$ccrTestNode/a:Flag"/>
1279 <xsl:with-param name="nodeName" select="'interpretationCode'"/>
1280 <xsl:with-param name="domain" select="'ObservationInterpretation'"/>
1281 </xsl:call-template>
1282 </xsl:if>
1283
1284 <xsl:if test="$ccrTestNode/a:NormalResult">
1285 <referenceRange>
1286 <xsl:if test="$ccrTestNode/a:NormalResult/a:Normal/a:Description/a:Text">
1287 <observationRange>
1288 <text>
1289 <xsl:value-of select="$ccrTestNode/a:NormalResult/a:Normal/a:Description/a:Text"/>
1290 </text>
1291 </observationRange>
1292 </xsl:if>
1293 </referenceRange>
1294 </xsl:if>
1295
1296 </observation>
1297 </component>
1298
1299 </xsl:template>
1300</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.