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

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

latest version

File size: 163.3 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)
12Nancy Antracite, WorldVistA
13xxxx - Oroville Hospital
14
15Date: 2010-05-5
16Version: 0.1
17
18License :
19
20 This program is free software: you can redistribute it and/or modify
21 it under the terms of the GNU General Public License as published by
22 the Free Software Foundation, either version 3 of the License, or
23 (at your option) any later version.
24
25 This program is distributed in the hope that it will be useful,
26 but WITHOUT ANY WARRANTY; without even the implied warranty of
27 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 GNU General Public License for more details.
29
30 You should have received a copy of the GNU General Public License
31 along with this program. If not, see http://www.gnu.org/licenses.
32
33-->
34<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"
35xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="a date">
36 <xsl:import href="./templates/cdavocablookup.xsl"/>
37 <xsl:import href="./templates/hl7oidlookup.xsl"/>
38 <xsl:import href="./templates/code.xsl"/>
39 <xsl:import href="./templates/actor.xsl"/>
40 <xsl:import href="./templates/datetime.xsl"/>
41 <xsl:import href="./templates/problemDescription.xsl"/>
42
43 <xsl:output method="xml" encoding="utf-8" version="1.0" indent="yes"/>
44 <xsl:template match="/">
45<!--WV Added new munltiple documentation of added have to do with encounter times, etc.-->
46
47<!--
48********************************************************
49CDA Header
50********************************************************
51-->
52
53<!--
54******************
55Document Information
56**********************
57-->
58<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">
59 <!-- Created with XML Copy Editor Open Source Sourceforge project. -->
60<!--WVP This is the clinical document type ID-->
61 <realmCode code="US"/>
62 <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
63 <!-- QRDA Category I generic template ID. -->
64 <!--WVP these next two lines are fixed-->
65 <templateId root="2.16.840.1.113883.10.20.12" />
66 <!--only in the july spec so not sure if it should be here-->
67 <templateId root="2.16.840.1.113883.3.249.11.100.1"/>
68 <!--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-->
69 <id>
70 <xsl:attribute name="root">
71 <xsl:value-of select="/a:ContinuityOfCareRecord/a:CCRDocumentObjectID"></xsl:value-of>
72 </xsl:attribute>
73 </id>
74 <!--WVP next two lines fixed-->
75 <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
76 <title>QRDA Incidence Report</title>
77 <!--WVV time-->
78 <effectiveTime value="20100703"/>
79 <!--WVP for next two lines-->
80 <confidentialityCode codeSystem="2.16.840.1.113883.5.25" code="N"/>
81 <languageCode code="en-US"/>
82 <!--WV? Don't change this in the document set we are working on-->
83 <setId root="2.16.840.1.113883.3.543" extension="01.01.01.100000001"/>
84 <versionNumber value="1"/>
85 <!--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-->
86
87 <!--
88 *******************
89 Patient Information
90 ****************
91 -->
92 <!-- This is the patient for which the report is describing. -->
93 <recordTarget>
94<patientRole>
95 <xsl:call-template name="ccdPatientRole">
96 <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:Patient[1]/a:ActorID"/>
97 </xsl:call-template>
98 </patientRole>
99 </recordTarget>
100
101<!--
102*****************************
103Author
104**************
105-->
106 <!-- This example assumes the doctor is creating the report and it is Required. -->
107 <author>
108 <!--WVV Edit time has to be precise at least to the day-->
109 <time value="20100703" />
110 <assignedAuthor>
111 <!--WVP eventually id this is required, the root is fixed -->
112 <!--andn the extension is the SOFTWARE version number assigned by CMS to WV EHR-->
113 <id root="2.16.840.1.113883.3.249.6" extension="100001" />
114 <!--WVVassignedPerson not required-->
115 <assignedPerson>
116 <name>
117 <!--WV Edit-->
118 <given>Nancy</given>
119 <family>Anthracite</family>
120 <suffix>MD</suffix>
121 </name>
122 </assignedPerson>
123 <representedOrganization>
124 <!--WV? id root is OID for the organization so I made one up for this document set-->
125 <id root="2.16.840.1.113883.3.543" extension="1558574526" />
126 <name>WorldVistA Test Clinic</name>
127 </representedOrganization>
128 </assignedAuthor>
129 </author>
130 <!-- The reporting healthcare facility is represented using the CCD "Source of Information" construct, via the Informant participant. -->
131 <informant>
132 <assignedEntity>
133 <!--WV this null flavor is required as is-->
134 <id nullFlavor="NA"/>
135 <representedOrganization>
136 <!--WV root is the OID of the organization. ID is required but name is not and id is OID stated earlier-->
137 <id root="2.16.840.1.113883.3.543" extension="1558574526" />
138 <name>World VistA Test Clinic</name>
139 </representedOrganization>
140 </assignedEntity>
141 </informant>
142
143 <!-- This example assumes that the institution responsible for the data is serving as custodian. -->
144 <!--WV This element is required as is the sSD which is not stated if it is an OID but assumed it is-->
145 <!--WV Name is not required, only ID is required.-->
146 <custodian>
147 <assignedCustodian>
148 <representedCustodianOrganization>
149 <id root="2.16.840.1.113883.3.543" extension="1558574526" />
150 <name>WorldVistA Test Clinic</name>
151 </representedCustodianOrganization>
152 </assignedCustodian>
153 </custodian>
154
155 <!-- In this example, the author is also serving as legal authenticator. -->
156 <!--WV section is this is not required-->
157<legalAuthenticator>
158 <time value="20100703" />
159 <!--WV the signature code of S is required-->
160 <signatureCode code="S" />
161 <assignedEntity>
162 <!--WV document does not specify the requirements of the id but it is required-->
163 <!--WVP and the sample suggests it is the number below and extension is ???-->
164 <id root="2.16.840.1.113883.3.543" extension="111111" />
165 <assignedPerson>
166 <name>
167 <given>Nancy</given>
168 <family>Anthracite</family>
169 <suffix>MD</suffix>
170 </name>
171 </assignedPerson>
172 <representedOrganization>
173 <!--WV? and is fixed for the WorldVistA Test Clinic in this submitted document series-->
174 <id root="2.16.840.1.113883.3.543" extension="1558574526" />
175 <name>WorldVistA Test Clinic</name>
176 </representedOrganization>
177 </assignedEntity>
178 </legalAuthenticator>
179
180
181
182 <!--Added to sample as it is new since 2008-->
183 <!--WVP permanent for participant in the primary care provider participant-->
184<!--WVP performer type codes are numerous but PRF is performer or the person who did it-->
185 <participant typeCode="PRF">
186 <!--WVP required as is for function-->
187 <!-- WVP I believe PCP is primary care provider but not sure-->
188 <functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
189 <!--WVP Associated Entity is required ti be there with this PROV-->
190 <associatedEntity classCode="PROV">
191 <!--WV? OID of the provider fixed for this series of documents-->
192 <id root="2.16.840.1.113883.3.249.6" extension="111111" />
193 <!--WV associated person is not required so presumabley the code will suffice not sure??-->
194 <associatedPerson>
195 <name>
196 <prefix>Dr.</prefix>
197 <given>Nancy</given>
198 <family>Anthracite</family>
199 </name>
200 </associatedPerson>
201 </associatedEntity>
202 </participant>
203
204 <!--The service event is the encounter that describes tehe encunter as well as the provider, location and time-->
205 <!--!There can be one or more documentation elements depending on the number of encounters during the reporting period-->
206 <!--WVV IMPORTANT!! The encounter codeds are recorded here-->
207 <!-- They are in appendix B of the downloadable resource document-->
208 <!-- Each documentation of is a single service event-->
209
210<!--Occurence of Measures episode documention-->
211<!--Like an encounter section only for QRDA-->
212<!--Same doctor, same clinic, different date and different enconter code-->
213
214
215 <!--First Visit documentationOf section-->
216
217 <documentationOf>
218 <serviceEvent>
219 <!--WV serviceEvent codes from Tab B from the downloadabe resource coding system is -->
220 <!--WVF codeSystem is 2.16.840.1.113883 -->
221 <!--WV code root shall be WVP 2.16.840.1.113883.6.12 and the extension shall be the encounter code -->
222 <!-- WV? like the length of visit and complexity codes for example-->
223
224 <code code="99202" codeSystem="2.16.840.1.113883.6.12" codeSystemName="C4"/>
225 <effectiveTime>
226 <!--WV Edit-->
227 <!-- This has to be precise at least to the day. Something with time would be better. Not sure of the necessary format so did not add time-->
228 <low value="20100205"/>
229 <high value="20100205"/>
230 </effectiveTime>
231 <performer typeCode="PRF">
232 <assignedEntity>
233 <!-- WV? Provider NPI Required root 2.16.840.1.113883.9.96 is ?? and the NPI is an extension for the provider-->
234 <!--This is variable but may remain unchanged for this document set-->
235 <id root="2.16.840.1.113883.3.543" extension="6558574524"/>
236 <!--<id root="2.16.840.1.113883.3.543" extension="1457402711"/>-->
237 <!--WV this element should be present and the code is probably for a General Physician for!-->
238 <!--It may be the type of provider as the example as I think 2.16.840.1.113883.6.69is the NDC-->
239 <!-- codeSystemName is SNOMED CT and code is an 8 digit num and display name is for a physician-->
240 <!--O6120 is SPECIALIZED PHYSICIAN when I looked it up so I don't know where to look for this 8 digit number-->
241 <!-- http://terminology.vetmed.vt.edu/SCT/menu.cfm to look up codes-->
242 <!--59058001 is general physician ;Family Medicine specialist is 62247001-->
243 <code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNOMED CT" displayName="Internal Medician Specialist"/>
244 <addr>
245 <streetAddressLine>123 Maple Ave</streetAddressLine>
246 <city>Gaithersburg</city>
247 <state>MD</state>
248 <postalCode>20877</postalCode>
249 </addr>
250 <assignedPerson>
251 <name>
252 <given>Nancy</given>
253 <family>Anthracite</family>
254 <suffix>MD</suffix>
255 </name>
256 </assignedPerson>
257 </assignedEntity>
258 </performer>
259 </serviceEvent>
260 </documentationOf>
261
262
263 <!--Second Visit documentationOf section-->
264
265 <documentationOf>
266 <serviceEvent>
267 <!--WV serviceEvent codes from Tab B from the downloadabe resource coding system is -->
268 <!--WVF codeSystem is 2.16.840.1.113883 -->
269 <!--WV code root shall be WVP 2.16.840.1.113883.6.12 and the extension shall be the encounter code -->
270 <!-- WV? like the length of visit and complexity codes for example-->
271
272 <code code="99204" codeSystem="2.16.840.1.113883.6.12" codeSystemName="C4"/>
273 <effectiveTime>
274 <!--WV Edit-->
275 <!-- This has to be precise at least to the day. Something with time would be better. Not sure of the necessary format so did not add time-->
276 <low value="20100703"/>
277 <high value="20100703"/>
278 </effectiveTime>
279 <performer typeCode="PRF">
280 <assignedEntity>
281 <!-- WV? Provider NPI Required root 2.16.840.1.113883.9.96 is ?? and the NPI is an extension for the provider-->
282 <!--This is variable but may remain unchanged for this document set-->
283 <id root="2.16.840.1.113883.3.543" extension="6558574524"/>
284 <!--<id root="2.16.840.1.113883.3.543" extension="1457402711"/>-->
285 <!--WV this element should be present and the code is probably for a General Physician for!-->
286 <!--It may be the type of provider as the example as I think 2.16.840.1.113883.6.69is the NDC-->
287 <!-- codeSystemName is SNOMED CT and code is an 8 digit num and display name is for a physician-->
288 <!--O6120 is SPECIALIZED PHYSICIAN when I looked it up so I don't know where to look for this 8 digit number-->
289 <!-- http://terminology.vetmed.vt.edu/SCT/menu.cfm to look up codes-->
290 <!--59058001 is general physician ;Family Medicine specialist is 62247001-->
291 <code code="62247001" codeSystem="2.16.840.1.113883.6.69" codeSystemName="SNOMED CT" displayName="Internal Medician Specialist"/>
292 <addr>
293 <streetAddressLine>123 Maple Ave</streetAddressLine>
294 <city>Gaithersburg</city>
295 <state>MD</state>
296 <postalCode>20877</postalCode>
297 </addr>
298 <assignedPerson>
299 <name>
300 <given>Nancy</given>
301 <family>Anthracite</family>
302 <suffix>MD</suffix>
303 </name>
304 </assignedPerson>
305 </assignedEntity>
306 </performer>
307 </serviceEvent>
308 </documentationOf>
309 <!--
310********************************************************
311CDA Body
312********************************************************
313-->
314 <component>
315 <structuredBody>
316 <!--
317 ********************************************************
318 Measure Set Section
319 ********************************************************
320 -->
321 <component>
322 <section>
323 <!-- WVP QRDA Category I measure-specific template ID for 2010 #1. -->
324 <!--WP Next 3 lines do not change during the reporting period, for the measures section-->
325 <templateId root="2.16.840.1.113883.3.249.11.12" />
326 <code code="55185-3" codeSystem="2.16.840.1.113883.6.1" />
327 <title>Measure set: CMS EHR Measure Set</title>
328 <text>2010 Measures Set Measures</text>
329 <!--
330 ***************************************************
331 Measure Section
332 ***************************************************
333 -->
334 <component>
335 <section>
336 <!--template ID for each measure being reported-->
337 <templateId root="2.16.840.1.113883.3.249.11.2" />
338 <templateId root="2.16.840.1.113883.3.249.11.3" />
339 <templateId root="2.16.840.1.113883.3.249.11.4" />
340 <templateId root="2.16.840.1.113883.3.249.11.5" />
341 <templateId root="2.16.840.1.113883.3.249.11.6" />
342 <templateId root="2.16.840.1.113883.3.249.11.7" />
343 <templateId root="2.16.840.1.113883.3.249.11.8" />
344 <templateId root="2.16.840.1.113883.3.249.11.9" />
345 <templateId root="2.16.840.1.113883.3.249.11.10" />
346 <templateId root="2.16.840.1.113883.3.249.11.11" />
347 <templateId root="2.16.840.1.113883.3.249.11.15" />
348 <code code="55186-1" codeSystem="2.16.840.1.113883.6.1" />
349 <title>Measure Section</title>
350 <!--Here is where the HTML begins for the above and it is optional-->
351 <text>
352 <list>
353 <item>CMS Measure #1: Diabetes Mellitus: Hemoglobin A1c Poor Control in Diabetes Mellitus</item>
354 <item>CMS Measure #2: Diabetes Mellitus: Low Density Lipoprotein (LDL-C) Control in Diabetes Mellitus</item>
355 <item>CMS Measure #3: Diabetes Mellitus: High Blood Pressure Control in Diabetes Mellitus</item>
356 <item>CMS Measure #5: Heart Failure: Angiotensin-Converting Enzyme (ACE) Inhibitor or Angiotensin Receptor Blocker (ARB) Therapy for Left Ventricular Systolic Dysfunction (LVSD)</item>
357 <item>CMS Measure #7: Coronary Artery Disease (CAD): Beta-Blocker Therapy for CAD Patients with Prior Myocardial Infarction (MI)</item>
358 <item>CMS Measure #110: Preventive Care and Screening: Influenza Immunization for Patients >= 50 Years</item>
359 <item>CMS Measure #111: Preventive Care and Screening: Pneumonia Vaccination for Patients 65 Years and Older</item>
360 <item>CMS Measure #112: Preventive Care and Screening: Screening Mammography</item>
361 <item>CMS Measure #113: Preventive Care and Screening: Colorectal Cancer Screening</item>
362 <item>CMS Measure #124: Health Information Technology (HIT): Adoption/Use of Electronic Health Records (EHR)</item>
363 <item>CMS Measure eRx:Adoption/Use of Medication Electronic Prescribing Measure</item>
364 </list>
365 </text>
366 <!--Begin listing of acts-->
367 <entry typeCode="DRIV">
368 <act classCode="ACT" moodCode="DEF">
369 <id root="3944fd20-865c-11df-a4ee-0800200c9a66"/>
370 <code code="PQRI-1" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
371 <text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent hemoglobin A1C greater than 9.0%</text>
372 <statusCode code="completed"/>
373 </act>
374 </entry>
375 <entry typeCode="DRIV">
376 <act classCode="ACT" moodCode="DEF">
377 <id root="3944fd21-865c-11df-a4ee-0800200c9a66"/>
378 <code code="PQRI-2" codeSystem="2.16.840.1.113883.3.249.12" displayName="Low Density Lipoprotein (LDL-C) Control in Diabetes Mellitus"/>
379 <text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent LDL-C level in control (less than 100 mg./dL)</text>
380 <statusCode code="completed"/>
381 </act>
382 </entry>
383 <entry typeCode="DRIV">
384 <act classCode="ACT" moodCode="DEF">
385 <id root="3944fd22-865c-11df-a4ee-0800200c9a66"/>
386 <code code="PQRI-3" codeSystem="2.16.840.1.113883.3.249.12" displayName="Hemoglobin A1c Poor Control in Diabetes Mellitus"/>
387 <text>Percentage of patients 18 through 75 years with diabetes mellitus who had most recent blood pressure in control (less than 140/80 mmHg)</text>
388 <statusCode code="completed"/>
389 </act>
390 </entry>
391 <entry typeCode="DRIV">
392 <act classCode="ACT" moodCode="DEF">
393 <id root="3944fd23-865c-11df-a4ee-0800200c9a66"/>
394 <code code="PQRI-5" codeSystem="2.16.840.1.113883.3.249.12" displayName="Heart Failure: Angiotensin-Converting Enzyme (ACE) Inhibitor or Angiotensin Receptor Blocker (ARB) Therapy for Left Ventricular Systolic Dysfunction (LVSD)"/>
395 <text>Percentage of patients 18 years and older with a diagnosis of heart frilure and LVSD who were prescribed ACE inhibitor or ARB therapy</text>
396 <statusCode code="completed"/>
397 </act>
398 </entry>
399 <entry typeCode="DRIV">
400 <act classCode="ACT" moodCode="DEF">
401 <id root="3944fd24-865c-11df-a4ee-0800200c9a66"/>
402 <code code="PQRI-7" codeSystem="2.16.840.1.113883.3.249.12" displayName="Beta-Blocker Therapy for CAD Patients with Prior Myocardial Infarction"/>
403 <text>Percentage of patients 18 aged 18 years and older wit a diagnosis of CAD and prior MI who were prescribed beta-blocker therapy</text>
404 <statusCode code="completed"/>
405 </act>
406 </entry>
407 <entry typeCode="DRIV">
408 <act classCode="ACT" moodCode="DEF">
409 <id root="3944fd25-865c-11df-a4ee-0800200c9a66"/>
410 <code code="PQRI-110" codeSystem="2.16.840.1.113883.3.249.12" displayName="Influenza Immunization for Patients >= 50 Years"/>
411 <text>Percentage of patients aged 50 years and older who received an influenza immunization during the flu season (September through February)</text>
412 <statusCode code="completed"/>
413 </act>
414 </entry>
415 <entry typeCode="DRIV">
416 <act classCode="ACT" moodCode="DEF">
417 <id root="3944fd26-865c-11df-a4ee-0800200c9a66"/>
418 <code code="PQRI-111" codeSystem="2.16.840.1.113883.3.249.12" displayName="Pneumonia Vaccination for Patients 65 Years and Older"/>
419 <text>Percentage of patients afed 65 years and older who have ever received a pneumoccal vaccine</text>
420 <statusCode code="completed"/>
421 </act>
422 </entry>
423 <entry typeCode="DRIV">
424 <act classCode="ACT" moodCode="DEF">
425 <id root="3944fd27-865c-11df-a4ee-0800200c9a66"/>
426 <code code="PQRI-112" codeSystem="2.16.840.1.113883.3.249.12" displayName="Screening Mammography"/>
427 <text>Percentage of womaen aged 40 through 69 years who had a mammogram to screen for breast cancer within 24 months</text>
428 <statusCode code="completed"/>
429 </act>
430 </entry>
431 <entry typeCode="DRIV">
432 <act classCode="ACT" moodCode="DEF">
433 <id root="3944fd28-865c-11df-a4ee-0800200c9a66"/>
434 <code code="PQRI-113" codeSystem="2.16.840.1.113883.3.249.12" displayName="Colorectal Cancer Screening"/>
435 <text>Percentage of patients aged 50 through 80 who received the appropriate colorectal cancer screening</text>
436 <statusCode code="completed"/>
437 </act>
438 </entry>
439 <entry typeCode="DRIV">
440 <act classCode="ACT" moodCode="DEF">
441 <id root="3944fd29-865c-11df-a4ee-0800200c9a66"/>
442 <code code="PQRI-124" codeSystem="2.16.840.1.113883.3.249.12" displayName="Adoption/Use of Electronic Health Records (EHR)"/>
443 <text>Documents whether provider has adopted and is using health information technology. To qualify, the provider must havea adopted and be using a certified/qualified electronic health record (EHR)</text>
444 <statusCode code="completed"/>
445 </act>
446 </entry>
447 <entry typeCode="DRIV">
448 <act classCode="ACT" moodCode="DEF">
449 <id root="3944fd30-865c-11df-a4ee-0800200c9a66"/>
450 <code code="eRx" codeSystem="2.16.840.1.113883.3.249.12" displayName="Adoption/Use of Medication Electronic Prescribing Measure"/>
451 <text>Documents whether provider has adopted and is using ePrescribing</text>
452 <statusCode code="completed"/>
453 </act>
454 </entry>
455 <!--
456 *******************************
457 Reporting Parameters Section
458 *****************************
459 -->
460 <component>
461 <section>
462 <code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
463 <title>Reporting Parameters</title>
464 <text>
465 <list>
466 <item>Reporting Period Jan 1, 2010 to Dec 31, 2010</item>
467 </list>
468 </text>
469 <entry>
470 <act classCode="ACT" moodCode="EVN">
471 <code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
472 <effectiveTime>
473 <low value="20100101"/>
474 <high value="20101231"/>
475 </effectiveTime>
476 </act>
477 </entry>
478 </section>
479 </component>
480 <component>
481 <section>
482 <templateId root="2.16.840.1.113883.10.20.1.13"/>
483 <code code="48764-5" codeSystem="2.16.840.1.113883.6.1" />
484 <title>Purpose</title>
485 <text>
486 <xsl:value-of select="/a:ContinuityOfCareRecord/a:Purpose/a:Description/a:Text"></xsl:value-of>
487 </text>
488 </section>
489 </component>
490 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Alerts">
491 <component>
492 <section>
493 <templateId root="2.16.840.1.113883.10.20.1.2" />
494 <!--C83 Allergies and Other Adverse Reactions Section Conformance Identifier-->
495 <templateId root="2.16.840.1.113883.3.88.11.83.102" />
496 <!--IHE Allergies and Other Adverse Reactions Section Conformance Identifier-->
497 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.13" />
498 <code code="48765-2" displayName="Allergies, adverse reactions, alerts" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" />
499 <title>Alerts</title>
500 <text>
501 <table>
502 <tbody>
503 <tr>
504 <th>Type</th>
505 <th>Date</th>
506 <th>Code</th>
507 <th>Description</th>
508 <th>Reaction</th>
509 <th>Source</th>
510 </tr>
511 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Alerts/a:Alert">
512 <tr>
513 <td>
514 <xsl:value-of select="a:Type/a:Text"/>
515 </td>
516 <td>
517 <xsl:call-template name="date:format-date">
518 <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
519 </xsl:call-template>
520 </td>
521 <td>
522 <xsl:apply-templates select="a:Description/a:Code"/>
523 </td>
524 <td>
525 <xsl:attribute name="ID">
526 <xsl:value-of select="a:CCRDataObjectID"/>
527 </xsl:attribute>
528 <xsl:value-of select="a:Description/a:Text"/>
529 </td>
530 <td>
531 <xsl:value-of select="a:Reaction/a:Description/a:Text"/>
532 <xsl:if test="a:Reaction/a:Severity/a:Text">
533 -<xsl:value-of select="a:Reaction/a:Severity/a:Text"/>
534 </xsl:if>
535 </td>
536 <td>
537 <xsl:call-template name="actorName">
538 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
539 </xsl:call-template>
540 </td>
541 </tr>
542 </xsl:for-each>
543 </tbody>
544 </table>
545 </text>
546 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Alerts/a:Alert">
547 <entry typeCode="DRIV">
548 <act classCode="ACT" moodCode="EVN">
549 <!--CCD Problem Act Identifier-->
550 <templateId root="2.16.840.1.113883.10.20.1.27"></templateId>
551 <!--C83 Allergy Entry-->
552 <templateId root="2.16.840.1.113883.3.88.11.83.6" />
553 <!--IHE Concern Entry Conformance Identifier-->
554 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.5.1"></templateId>
555 <!--IHE Allergy and Intolerance Concerns Entry-->
556 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.5.3"></templateId>
557
558 <!-- <id> -->
559 <xsl:call-template name="ccdID">
560 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
561 </xsl:call-template>
562
563 <code nullFlavor="NA"/>
564 <entryRelationship typeCode="SUBJ">
565 <observation classCode="OBS" moodCode="EVN">
566 <!--CCD Alert Observation-->
567 <templateId root="2.16.840.1.113883.10.20.1.18"></templateId>
568 <!--CCD Problem Observation-->
569 <templateId root="2.16.840.1.113883.10.20.1.28" />
570 <!--IHE Problem Entry-->
571 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.5" />
572 <!--IHE Allergies and Intolerances Entry-->
573 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.6" />
574 <!-- <id> -->
575 <xsl:call-template name="ccdID">
576 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
577 <xsl:with-param name="suffix"></xsl:with-param>
578 </xsl:call-template>
579
580 <code code="416098002" codeSystem="2.16.840.1.113883.6.96" displayName="drug allergy" codeSystemName="SNOMED CT"/>
581
582 <text>
583 <reference>
584 <xsl:attribute name="value">
585 <xsl:text>#</xsl:text>
586 <xsl:value-of select="a:CCRDataObjectID"/>
587 </xsl:attribute>
588 </reference>
589 </text>
590
591 <statusCode code="completed"/>
592 <value xsi:type="CD" />
593
594 <participant typeCode="CSM">
595 <xsl:choose>
596 <xsl:when test="a:Agent/a:Products/a:Product/a:Product">
597 <xsl:call-template name="ccdParticipantRoleCodedDescription">
598 <xsl:with-param name="ccrCodedDescription" select="a:Product/a:Description"/>
599 </xsl:call-template>
600 </xsl:when>
601
602 </xsl:choose>
603 </participant>
604
605 <xsl:if test="a:Reaction">
606 <entryRelationship typeCode="MFST" inversionInd="true">
607 <observation classCode="OBS" moodCode="EVN">
608 <templateId root="2.16.840.1.113883.10.20.1.54"/>
609 <!--Reaction observation template -->
610 <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
611 <statusCode code="completed"/>
612 <xsl:call-template name="ccdCodedValue">
613 <xsl:with-param name="ccrCodedDescription" select="a:Reaction/a:Description"/>
614 </xsl:call-template>
615 </observation>
616 </entryRelationship>
617 </xsl:if>
618
619 <xsl:call-template name="ccdStatus">
620 <xsl:with-param name="ccrStatus" select="a:Status"/>
621 </xsl:call-template>
622
623 </observation>
624 </entryRelationship>
625 </act>
626 </entry>
627 </xsl:for-each>
628 </section>
629 </component>
630 </xsl:if>
631 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Problems">
632 <component>
633 <section>
634 <templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
635 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
636 <templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
637 <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
638 <title>Problems</title>
639 <text>
640 <table>
641 <tbody>
642 <tr>
643 <th>Type</th>
644 <th>Date</th>
645 <th>Code</th>
646 <th>Description</th>
647 <th>Status</th>
648 <th>Source</th>
649 </tr>
650 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
651 <tr>
652 <td>
653 <xsl:value-of select="a:Type/a:Text"/>
654 </td>
655 <td>
656 <table>
657 <tbody>
658 <xsl:apply-templates select="a:DateTime"/>
659 </tbody>
660 </table>
661 </td>
662 <td>
663 <xsl:apply-templates select="a:Description/a:Code"/>
664 </td>
665 <td>
666 <xsl:attribute name="ID">
667 <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
668 </xsl:attribute>
669 <xsl:value-of select="a:Description/a:Text"/>
670 </td>
671 <td>
672 <xsl:value-of select="a:Status/a:Text"/>
673 </td>
674 <td>
675 <xsl:call-template name="actorName">
676 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
677 </xsl:call-template>
678 </td>
679 </tr>
680 </xsl:for-each>
681 </tbody>
682 </table>
683 </text>
684 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
685 <entry typeCode="DRIV">
686 <act classCode="ACT" moodCode="EVN">
687 <templateId root="2.16.840.1.113883.10.20.1.27"/>
688 <!-- Problem act template -->
689
690 <!-- <id> -->
691 <xsl:call-template name="ccdID">
692 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
693 </xsl:call-template>
694
695 <code nullFlavor="NA"/>
696
697 <xsl:call-template name="ccdPerformer">
698 <xsl:with-param name="ccrActorReference" select="a:Source/a:Actor"/>
699 </xsl:call-template>
700
701 <entryRelationship typeCode="SUBJ">
702 <observation classCode="OBS" moodCode="EVN">
703 <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
704 <!--Problem observation template-->
705
706 <!-- <id> -->
707 <xsl:call-template name="ccdID">
708 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
709 <xsl:with-param name="suffix"></xsl:with-param>
710 </xsl:call-template>
711
712 <code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
713
714 <text>
715 <reference>
716 <xsl:attribute name="value">
717 <xsl:text>#</xsl:text>
718 <xsl:value-of select="a:CCRDataObjectID"/>
719 </xsl:attribute>
720 </reference>
721 </text>
722
723 <statusCode code="completed"/>
724
725 <xsl:call-template name="ccdDateTime">
726 <xsl:with-param name="dt" select="a:DateTime"/>
727 </xsl:call-template>
728
729 <xsl:call-template name="ccdCodedValue">
730 <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
731 </xsl:call-template>
732
733 <xsl:call-template name="ccdStatus">
734 <xsl:with-param name="ccrStatus" select="a:Status"/>
735 </xsl:call-template>
736 </observation>
737 </entryRelationship>
738
739 </act>
740 </entry>
741 </xsl:for-each>
742 </section>
743 </component>
744 </xsl:if>
745 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Procedures">
746 <component>
747 <section>
748 <templateId root="2.16.840.1.113883.10.20.1.12"/>
749 <code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
750 <title>Procedures</title>
751 <text>
752 <table>
753 <tbody>
754 <tr>
755 <th>Type</th>
756 <th>Date</th>
757 <th>Code</th>
758 <th>Description</th>
759 <th>Location</th>
760 <th>Substance</th>
761 <th>Method</th>
762 <th>Position</th>
763 <th>Site</th>
764 <th>Status</th>
765 <th>Source</th>
766 </tr>
767 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
768 <tr>
769 <xsl:attribute name="id">
770 <xsl:value-of select="a:CCRDataObjectID"/>
771 </xsl:attribute>
772
773 <td>
774 <xsl:value-of select="a:Type/a:Text"/>
775 </td>
776 <table>
777 <tbody>
778 <xsl:apply-templates select="a:DateTime"/>
779 </tbody>
780 </table>
781 <td>
782 <xsl:apply-templates select="a:Description/a:Code"/>
783 </td>
784 <td>
785 <xsl:value-of select="a:Description/a:Text"/>
786 </td>
787 <td>
788 <xsl:for-each select="a:Locations/a:Location">
789 <xsl:value-of select="a:Description/a:Text"/>
790 <xsl:if test="a:Actor">
791 (<xsl:call-template name="actorName">
792 <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
793 </xsl:call-template>
794 <xsl:if test="a:Actor/a:ActorRole/a:Text">
795 <xsl:text xml:space="preserve"> - </xsl:text><xsl:value-of select="a:ActorRole/a:Text"/>)
796 </xsl:if>
797 </xsl:if>)
798 <xsl:if test="position() != last()">
799 <br/>
800 </xsl:if>
801 </xsl:for-each>
802 </td>
803 <td>
804 <xsl:for-each select="a:Substance">
805 <xsl:value-of select="a:Text"/>
806 </xsl:for-each>
807 </td>
808 <td>
809 <xsl:value-of select="a:Method/a:Text"/>
810 </td>
811 <td>
812 <xsl:value-of select="a:Position/a:Text"/>
813 </td>
814 <td>
815 <xsl:value-of select="a:Site/a:Text"/>
816 </td>
817 <td>
818 <xsl:value-of select="a:Status/a:Text"/>
819 </td>
820 <td>
821 <xsl:call-template name="actorName">
822 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
823 </xsl:call-template>
824 </td>
825 </tr>
826 </xsl:for-each>
827 </tbody>
828 </table>
829 </text>
830
831 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
832 <entry typeCode="DRIV">
833 <procedure classCode="PROC" moodCode="EVN">
834 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
835 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
836 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
837
838 <!-- <id> -->
839 <xsl:call-template name="ccdID">
840 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
841 </xsl:call-template>
842
843 <!-- <code> -->
844 <xsl:call-template name="ccdCodedValue">
845 <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
846 <xsl:with-param name="nodeName" select="'code'"/>
847 </xsl:call-template>
848
849 <text>
850 <reference>
851 <xsl:attribute name="value">
852 <xsl:text>#</xsl:text>
853 <xsl:value-of select="a:CCRDataObjectID"/>
854 </xsl:attribute>
855 </reference>
856 </text>
857
858 <xsl:call-template name="ccdStatusProcedure">
859 <xsl:with-param name="status" select="a:Status"/>
860 </xsl:call-template>
861
862 <xsl:call-template name="ccdDateTime">
863 <xsl:with-param name="dt" select="a:DateTime"/>
864 </xsl:call-template>
865
866 <xsl:if test="a:Method">
867 <xsl:call-template name="ccdCodedValue">
868 <xsl:with-param name="ccrCodedDescription" select="a:Method"/>
869 <xsl:with-param name="nodeName" select="'approachSiteCode'"/>
870 </xsl:call-template>
871 </xsl:if>
872
873 <xsl:if test="a:Site">
874 <xsl:call-template name="ccdCodedValue">
875 <xsl:with-param name="ccrCodedDescription" select="a:Site"/>
876 <xsl:with-param name="nodeName" select="'targetSiteCode'"/>
877 </xsl:call-template>
878 </xsl:if>
879
880 <xsl:if test="a:Practitioners/a:Practitioner">
881 <xsl:call-template name="ccdPerformer">
882 <xsl:with-param name="ccrActorReference" select="a:Practitioners/a:Practitioner[1]"/>
883 </xsl:call-template>
884 </xsl:if>
885 </procedure>
886 </entry>
887 </xsl:for-each>
888 </section>
889 </component>
890 </xsl:if>
891 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Medications">
892 <component>
893 <section>
894 <templateId root="2.16.840.1.113883.3.88.11.83.112" assigningAuthorityName="HITSP/C83"/>
895 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.19" assigningAuthorityName="IHE PCC"/>
896 <templateId root="2.16.840.1.113883.10.20.1.8" assigningAuthorityName="HL7 CCD"/>
897 <!--Medications section template-->
898 <code code="10160-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="History of medication use"/>
899 <title>Medications</title>
900 <text>
901 <table>
902 <tbody>
903 <tr>
904 <th>Medication</th>
905 <th>Date</th>
906 <th>Status</th>
907 <th>Form</th>
908 <th>Strength</th>
909 <th>Quantity</th>
910 <th>SIG</th>
911 <th>Indications</th>
912 <th>Instruction</th>
913 <th>Refills</th>
914 <th>Source</th>
915 </tr>
916 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Medications/a:Medication">
917 <tr>
918 <td>
919 <xsl:value-of select="a:Product/a:ProductName/a:Text"/>
920 <xsl:if test="a:Product/a:BrandName">
921 <xsl:text xml:space="preserve"> </xsl:text>(<xsl:value-of select="a:Product/a:BrandName/a:Text"/>)
922 </xsl:if>
923 </td>
924 <td>
925 <xsl:call-template name="date:format-date">
926 <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
927 </xsl:call-template>
928 </td>
929 <td>
930 <xsl:value-of select="a:Status/a:Text"/>
931 </td>
932 <td>
933 <xsl:value-of select="a:Product/a:Form/a:Text"/>
934 </td>
935 <td>
936 <xsl:for-each select="a:Product/a:Strength">
937 <xsl:if test="position() > 1">
938 <xsl:text>/</xsl:text>
939 </xsl:if>
940 <xsl:value-of select="a:Value"/>
941 <xsl:text xml:space="preserve"> </xsl:text>
942 <xsl:value-of select="a:Units/a:Unit"/>
943 </xsl:for-each>
944 </td>
945 <td>
946 <xsl:value-of select="a:Quantity/a:Value"/>
947 <xsl:text xml:space="preserve"> </xsl:text>
948 <xsl:value-of select="a:Quantity/a:Units/a:Unit"/>
949 </td>
950 <td>
951 <xsl:for-each select="a:Directions/a:Direction">
952 <xsl:choose>
953 <xsl:when test="a:Description/a:Text">
954 <xsl:value-of select="a:Description/a:Text"/>
955 </xsl:when>
956 <xsl:otherwise>
957 <xsl:value-of select="a:Dose/a:Value"/>
958 <xsl:text xml:space="preserve"> </xsl:text>
959 <xsl:value-of select="a:Dose/a:Units/a:Unit"/>
960 <xsl:text xml:space="preserve"> </xsl:text>
961 <xsl:value-of select="a:Route/a:Text"/>
962 <xsl:text xml:space="preserve"> </xsl:text>
963 <xsl:value-of select="a:Frequency/a:Value"/>
964 <xsl:if test="a:Duration">
965 <xsl:text xml:space="preserve">( </xsl:text>for <xsl:value-of select="a:Duration/a:Value"/><xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="a:Duration/a:Units/a:Unit"/><xsl:text xml:space="preserve"> )</xsl:text>
966 </xsl:if>
967 <xsl:if test="a:MultipleDirectionModifier/a:ObjectAttribute">
968 <xsl:for-each select="a:MultipleDirectionModifier/a:ObjectAttribute">
969 <xsl:value-of select="a:Attribute"/>
970 <br/>
971 <xsl:value-of select="a:AttributeValue/a:Value"/>
972 </xsl:for-each>
973 </xsl:if>
974 </xsl:otherwise>
975 </xsl:choose>
976 </xsl:for-each>
977 </td>
978 <td>
979 <xsl:for-each select="a:Directions/a:Direction[1]/a:Indication">
980 <xsl:call-template name="problemDescription">
981 <xsl:with-param name="objID" select="a:InternalCCRLink/a:LinkID"/>
982 </xsl:call-template>
983 <br/>
984 </xsl:for-each>
985 </td>
986 <td>
987 <xsl:for-each select="a:PatientInstructions/a:Instruction">
988 <xsl:value-of select="a:Text"/>
989 <br/>
990 </xsl:for-each>
991 </td>
992 <td>
993 <xsl:for-each select="a:Refills/a:Refill">
994 <xsl:value-of select="a:Number"/>
995 <xsl:text xml:space="preserve"> </xsl:text>
996 </xsl:for-each>
997 </td>
998 <td>
999 <xsl:call-template name="actorName">
1000 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1001 </xsl:call-template>
1002 </td>
1003 </tr>
1004 </xsl:for-each>
1005 </tbody>
1006 </table>
1007 </text>
1008 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Medications/a:Medication">
1009 <entry typeCode="DRIV">
1010 <substanceAdministration classCode="SBADM" moodCode="EVN">
1011 <templateId root="2.16.840.1.113883.10.20.1.24" assigningAuthorityName="CCD"/>
1012 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.7.1" assigningAuthorityName="IHE PCC"/>
1013
1014 <!--Medication activity template -->
1015
1016 <!-- <id> -->
1017 <xsl:call-template name="ccdID">
1018 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
1019 </xsl:call-template>
1020
1021 <statusCode code='completed'/>
1022
1023 <xsl:call-template name="ccdDateTime">
1024 <xsl:with-param name="dt" select="a:DateTime"/>
1025 <xsl:with-param name="type" select="'IVL_TS'"/>
1026 </xsl:call-template>
1027
1028 <xsl:call-template name="ccdMedicationFrequency">
1029 <xsl:with-param name="frequency" select="a:Directions/a:Direction/a:Frequency"/>
1030 </xsl:call-template>
1031
1032 <xsl:call-template name="ccdCodedValue">
1033 <xsl:with-param name="ccrCodedDescription" select="a:Directions/a:Direction/a:Route"/>
1034 <xsl:with-param name="nodeName" select="'routeCode'"/>
1035 <xsl:with-param name="domain" select="'RouteOfAdministration'"/>
1036 </xsl:call-template>
1037
1038 <xsl:if test="a:Directions/a:Direction/a:Dose">
1039 <doseQuantity>
1040 <low>
1041 <xsl:attribute name="value">
1042 <xsl:value-of select="a:Directions/a:Direction/a:Dose/a:Value"></xsl:value-of>
1043 </xsl:attribute>
1044 <xsl:attribute name="unit">
1045 <xsl:value-of select="a:Directions/a:Direction/a:Dose/a:Unit"></xsl:value-of>
1046 </xsl:attribute>
1047 </low>
1048 <high>
1049 <xsl:attribute name="value">
1050 <xsl:value-of select="a:Directions/a:Direction/a:Dose/a:Value"></xsl:value-of>
1051 </xsl:attribute>
1052 <xsl:attribute name="unit">
1053 <xsl:value-of select="a:Directions/a:Direction/a:Dose/a:Unit"></xsl:value-of>
1054 </xsl:attribute>
1055 </high>
1056 </doseQuantity>
1057 </xsl:if>
1058 <consumable>
1059 <manufacturedProduct>
1060 <templateId root="2.16.840.1.113883.3.88.11.83.8.2" assigningAuthorityName="HITSP C83"/>
1061 <templateId root="2.16.840.1.113883.10.20.1.53" assigningAuthorityName="CCD"/>
1062 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.7.2" assigningAuthorityName="IHE PCC"/>
1063
1064 <!-- Product template -->
1065
1066 <manufacturedMaterial>
1067 <xsl:call-template name="ccdCodedValue">
1068 <xsl:with-param name="ccrCodedDescription" select="a:Product/a:ProductName"/>
1069 <xsl:with-param name="nodeName" select="'code'"/>
1070 </xsl:call-template>
1071 <name>
1072 <xsl:value-of select="a:Product/a:BrandName/a:Text"/>
1073 </name>
1074 </manufacturedMaterial>
1075 </manufacturedProduct>
1076 </consumable>
1077 </substanceAdministration>
1078 </entry>
1079 </xsl:for-each>
1080 </section>
1081 </component>
1082 </xsl:if>
1083 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Immunizations">
1084 <component>
1085 <section>
1086 <templateId root="2.16.840.1.113883.10.20.1.6"/>
1087 <code code="11369-6" codeSystem="2.16.840.1.113883.6.1"/>
1088 <title>Immunizations</title>
1089 <text>
1090 <table>
1091 <tbody>
1092 <tr>
1093 <th>Code</th>
1094 <th>Vaccine</th>
1095 <th>Date</th>
1096 <th>Route</th>
1097 <th>Site</th>
1098 <th>Source</th>
1099 </tr>
1100 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Immunizations/a:Immunization">
1101 <tr>
1102 <xsl:attribute name="id">
1103 <xsl:value-of select="a:CCRDataObjectID"/>
1104 </xsl:attribute>
1105 <td>
1106 <xsl:apply-templates select="a:Product/a:ProductName/a:Code"/>
1107 </td>
1108 <td>
1109
1110 <xsl:value-of select="a:Product/a:ProductName/a:Text"/>
1111 <xsl:if test="a:Product/a:Form">
1112 <xsl:text xml:space="preserve"> </xsl:text>(<xsl:value-of select="a:Product/a:Form/a:Text"/>)
1113 </xsl:if>
1114 </td>
1115 <td>
1116 <xsl:call-template name="date:format-date">
1117 <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
1118 </xsl:call-template>
1119 </td>
1120 <td>
1121 <xsl:value-of select="a:Directions/a:Direction/a:Route/a:Text"/>
1122 </td>
1123 <td>
1124 <xsl:attribute name="id">
1125 <xsl:value-of select="a:CCRDataObjectID"/>
1126 <xsl:text>:Site</xsl:text>
1127 </xsl:attribute>
1128
1129 <xsl:value-of select="a:Directions/a:Direction/a:Site/a:Text"/>
1130 </td>
1131 <td>
1132 <xsl:call-template name="actorName">
1133 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1134 </xsl:call-template>
1135 </td>
1136 </tr>
1137 </xsl:for-each>
1138 </tbody>
1139 </table>
1140 </text>
1141 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Immunizations/a:Immunization">
1142 <entry typeCode="DRIV">
1143 <substanceAdministration classCode="SBADM" moodCode="EVN">
1144 <templateId root="2.16.840.1.113883.10.20.1.24" assigningAuthorityName="CCD"/>
1145 <templateId root="2.16.840.1.113883.3.88.11.83.13" assigningAuthorityName="HITSP C83"/>
1146 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.12" assigningAuthorityName="IHE PCC"/>
1147
1148 <!-- Medication activity template -->
1149
1150 <!-- <id> -->
1151 <xsl:call-template name="ccdID">
1152 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
1153 </xsl:call-template>
1154
1155 <code code="IMMUNIZ" codeSystem="2.16.840.1.113883.5.4" codeSystemName="HL7 ActCode"/>
1156 <text>
1157 <reference>
1158 <xsl:attribute name="value">
1159 <xsl:text>#</xsl:text>
1160 <xsl:value-of select="a:CCRDataObjectID"/>
1161 </xsl:attribute>
1162 </reference>
1163 </text>
1164
1165 <statusCode code='completed'/>
1166
1167 <xsl:call-template name="ccdDateTime">
1168 <xsl:with-param name="dt" select="a:DateTime"/>
1169 <xsl:with-param name="type" select="'IVL_TS'"/>
1170 </xsl:call-template>
1171
1172 <xsl:call-template name="ccdCodedValue">
1173 <xsl:with-param name="ccrCodedDescription" select="a:Directions/a:Direction/a:Route"/>
1174 <xsl:with-param name="nodeName" select="'routeCode'"/>
1175 <xsl:with-param name="domain" select="'RouteOfAdministration'"/>
1176 </xsl:call-template>
1177
1178 <xsl:if test="a:Directions/a:Direction/a:Site">
1179 <xsl:call-template name="ccdCodedValue">
1180 <xsl:with-param name="ccrCodedDescription" select="a:Directions/a:Direction/a:Site"/>
1181 <xsl:with-param name="nodeName" select="'approachSiteCode'"/>
1182 <xsl:with-param name="originalTextReference">
1183 <xsl:text>#</xsl:text>
1184 <xsl:value-of select="a:CCRDataObjectID"/>
1185 <xsl:text>:Site</xsl:text>
1186 </xsl:with-param>
1187 </xsl:call-template>
1188 </xsl:if>
1189
1190 <consumable>
1191 <manufacturedProduct>
1192 <templateId root="2.16.840.1.113883.3.88.11.83.8.2" assigningAuthorityName="HITSP C83"/>
1193 <templateId root="2.16.840.1.113883.10.20.1.53" assigningAuthorityName="CCD"/>
1194 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.7.2" assigningAuthorityName="IHE PCC"/>
1195
1196 <!-- Product template -->
1197
1198 <manufacturedMaterial>
1199 <xsl:call-template name="ccdCodedValue">
1200 <xsl:with-param name="ccrCodedDescription" select="a:Product/a:ProductName"/>
1201 <xsl:with-param name="nodeName" select="'code'"/>
1202 </xsl:call-template>
1203 <name>
1204 <xsl:value-of select="a:Product/a:BrandName/a:Text"/>
1205 </name>
1206 </manufacturedMaterial>
1207 </manufacturedProduct>
1208 </consumable>
1209
1210 </substanceAdministration>
1211 </entry>
1212 </xsl:for-each>
1213 </section>
1214 </component>
1215 </xsl:if>
1216 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:VitalSigns">
1217 <component>
1218 <section>
1219 <templateId root="2.16.840.1.113883.10.20.1.16"/>
1220 <code code="8716-3" codeSystem="2.16.840.1.113883.6.1"/>
1221 <title>Vital Signs</title>
1222 <text>
1223 <table>
1224 <tbody>
1225 <tr>
1226 <th>Vital Sign</th>
1227 <th>Date</th>
1228 <th>Result</th>
1229 <th>Source</th>
1230 </tr>
1231 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:VitalSigns/a:Result">
1232 <tr>
1233 <xsl:attribute name="id">
1234 <xsl:value-of select="a:CCRDataObjectID"/>
1235 </xsl:attribute>
1236
1237 <td>
1238 <xsl:value-of select="a:Description/a:Text"/>
1239 </td>
1240 <td>
1241 <xsl:call-template name="date:format-date">
1242 <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
1243 </xsl:call-template>
1244 </td>
1245 <td>
1246 <xsl:for-each select="a:Test">
1247 <xsl:value-of select="a:Description/a:Text"/>
1248 <xsl:text xml:space="preserve"> </xsl:text>
1249 <xsl:value-of select="a:TestResult/a:Value"/>
1250 <xsl:text xml:space="preserve"> </xsl:text>
1251 <xsl:value-of select="a:TestResult/a:Units/a:Unit"/>
1252 <xsl:text xml:space="preserve"> </xsl:text>
1253 <xsl:value-of select="a:Flag/a:Text"/>
1254 <br/>
1255 </xsl:for-each>
1256 </td>
1257 <td>
1258 <xsl:call-template name="actorName">
1259 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1260 </xsl:call-template>
1261 </td>
1262 </tr>
1263 </xsl:for-each>
1264 </tbody>
1265 </table>
1266 </text>
1267 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:VitalSigns/a:Result">
1268 <entry typeCode="DRIV">
1269 <organizer classCode="CLUSTER" moodCode="EVN">
1270 <templateId root="2.16.840.1.113883.10.20.1.32" assigningAuthorityName="CCD"/>
1271 <templateId root="2.16.840.1.113883.10.20.1.35" assigningAuthorityName="CCD"/>
1272 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.13.1" assigningAuthorityName="IHE PCC"/>
1273 <!-- Vital signs organizer template -->
1274
1275 <xsl:variable name="testDate" select="a:DateTime"/>
1276
1277 <!-- <id> -->
1278 <xsl:call-template name="ccdID">
1279 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
1280 </xsl:call-template>
1281
1282 <code code="46680005" codeSystem="2.16.840.1.113883.6.96" displayName="Vital signs" codeSystemName="SNOMED CT"/>
1283 <statusCode code="completed"/>
1284 <xsl:call-template name="ccdDateTime">
1285 <xsl:with-param name="dt" select="$testDate"/>
1286 </xsl:call-template>
1287
1288 <xsl:call-template name="ccdObservation">
1289 <xsl:with-param name="ccrTestNode" select="a:Test[1]"/>
1290 <xsl:with-param name="testDate" select="$testDate"/>
1291 </xsl:call-template>
1292
1293 </organizer>
1294 </entry>
1295 </xsl:for-each>
1296 </section>
1297 </component>
1298 </xsl:if>
1299 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Encounters">
1300 <component>
1301 <section>
1302 <templateId root="2.16.840.1.113883.3.88.11.83.127" assigningAuthorityName="HITSP/C83"/>
1303 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.5.3.3" assigningAuthorityName="IHE PCC"/>
1304 <templateId root="2.16.840.1.113883.10.20.1.3" assigningAuthorityName="HL7 CCD"/>
1305 <!--Encounters section template-->
1306 <code code="46240-8" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="History of encounters"/>
1307 <title>Encounters</title>
1308 <text>
1309 <table>
1310 <tbody>
1311 <tr>
1312 <th>Type</th>
1313 <th>Date</th>
1314 <th>Location</th>
1315 <th>Status</th>
1316 <th>Practitioner</th>
1317 <th>Description</th>
1318 <th>Indications</th>
1319 <th>Source</th>
1320 </tr>
1321 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Encounters/a:Encounter">
1322 <tr>
1323 <xsl:attribute name="id">
1324 <xsl:value-of select="a:CCRDataObjectID"/>
1325 </xsl:attribute>
1326
1327 <td>
1328 <xsl:value-of select="a:Type/a:Text"/>
1329 </td>
1330 <td>
1331 <xsl:call-template name="date:format-date">
1332 <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
1333 </xsl:call-template>
1334 </td>
1335 <td>
1336 <xsl:for-each select="a:Locations/a:Location">
1337 <xsl:value-of select="a:Description/a:Text"/>
1338 <xsl:call-template name="actorName">
1339 <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
1340 </xsl:call-template>
1341 <br/>
1342 </xsl:for-each>
1343 </td>
1344 <td>
1345 <xsl:value-of select="a:Status/a:Text"/>
1346 </td>
1347 <td>
1348 <xsl:for-each select="a:Practitioners/a:Practitioner">
1349 <xsl:call-template name="actorName">
1350 <xsl:with-param name="objID" select="a:ActorID"/>
1351 </xsl:call-template>
1352 <br/>
1353 </xsl:for-each>
1354 </td>
1355 <td>
1356 <xsl:value-of select="a:Description/a:Text"/>
1357 </td>
1358 <td>
1359 <xsl:for-each select="a:Indications/a:Indication">
1360 <xsl:call-template name="problemDescription">
1361 <xsl:with-param name="objID" select="a:InternalCCRLink/a:LinkID"/>
1362 </xsl:call-template>
1363 <br/>
1364 </xsl:for-each>
1365 </td>
1366 <td>
1367 <xsl:call-template name="actorName">
1368 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1369 </xsl:call-template>
1370 </td>
1371 </tr>
1372 </xsl:for-each>
1373 </tbody>
1374 </table>
1375 </text>
1376 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Encounters/a:Encounter">
1377 <entry typeCode="DRIV">
1378 <encounter classCode="ENC" moodCode="EVN">
1379 <templateId root="2.16.840.1.113883.3.88.11.83.16" assigningAuthorityName="HITSP C83"/>
1380 <templateId root="2.16.840.1.113883.10.20.1.21" assigningAuthorityName="CCD"/>
1381 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.14" assigningAuthorityName="IHE PCC"/>
1382
1383 <!-- Encounter activity template -->
1384
1385 <!-- <id> -->
1386 <xsl:call-template name="ccdID">
1387 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
1388 </xsl:call-template>
1389
1390 <xsl:call-template name="ccdCodedValue">
1391 <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
1392 <xsl:with-param name="nodeName" select="'code'"/>
1393 </xsl:call-template>
1394
1395 <text>
1396 <reference>
1397 <xsl:attribute name="value">
1398 <xsl:text>#</xsl:text>
1399 <xsl:value-of select="a:CCRDataObjectID"/>
1400 </xsl:attribute>
1401 </reference>
1402 </text>
1403
1404 <xsl:call-template name="ccdDateTime">
1405 <xsl:with-param name="dt" select="a:DateTime"/>
1406 </xsl:call-template>
1407
1408 <xsl:if test="a:Practitioners[1]/a:Practitioner">
1409 <xsl:call-template name="ccdPerformer">
1410 <xsl:with-param name="ccrActorReference" select="a:Practitioners/a:Practitioner[1]"/>
1411 </xsl:call-template>
1412 </xsl:if>
1413
1414 <xsl:if test="a:Locations[1]/a:Location">
1415 <participant typeCode="LOC">
1416 <templateId root="2.16.840.1.113883.10.20.1.45"/>
1417 <!-- Location participation template -->
1418 <xsl:choose>
1419 <xsl:when test="a:Locations[1]/a:Location/a:ActorID">
1420 <xsl:call-template name="ccdParticipantRoleActor">
1421 <xsl:with-param name="ccrActorObjectID" select="a:Locations[1]/a:Location/a:ActorID"/>
1422 </xsl:call-template>
1423 </xsl:when>
1424 <xsl:otherwise>
1425 <xsl:call-template name="ccdParticipantRoleCodedDescription">
1426 <xsl:with-param name="ccrCodedDescription" select="a:Locations[1]/a:Location/a:Description"/>
1427 </xsl:call-template>
1428 </xsl:otherwise>
1429 </xsl:choose>
1430 </participant>
1431 </xsl:if>
1432 </encounter>
1433 </entry>
1434 </xsl:for-each>
1435 </section>
1436 </component>
1437 </xsl:if>
1438 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Results/a:Result">
1439 <component>
1440 <section>
1441 <templateId root="2.16.840.1.113883.10.20.1.14"/>
1442 <code code="30954-2" codeSystem="2.16.840.1.113883.6.1"/>
1443 <title>Results</title>
1444 <text>
1445 <table>
1446 <tbody>
1447 <tr>
1448 <th>Test</th>
1449 <th>Date</th>
1450 <th>Result</th>
1451 <th>Source</th>
1452 </tr>
1453 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Results/a:Result">
1454 <tr>
1455 <xsl:attribute name="id">
1456 <xsl:value-of select="a:CCRDataObjectID"/>
1457 </xsl:attribute>
1458 <td>
1459 <xsl:value-of select="a:Description/a:Text"/>
1460 </td>
1461 <td>
1462 <xsl:call-template name="date:format-date">
1463 <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
1464 </xsl:call-template>
1465 </td>
1466 <td>
1467 <xsl:for-each select="a:Test[a:TestResult/a:Value!='']">
1468 <div>
1469 <xsl:attribute name="id">
1470 <xsl:value-of select="a:CCRDataObjectID"/>
1471 </xsl:attribute>
1472
1473 <xsl:value-of select="a:Description/a:Text"/>
1474 <xsl:text xml:space="preserve"> </xsl:text>
1475 <xsl:value-of select="a:TestResult/a:Value"/>
1476 <xsl:text xml:space="preserve"> </xsl:text>
1477 <xsl:value-of select="a:TestResult/a:Units/a:Unit"/>
1478 <xsl:text xml:space="preserve"> </xsl:text>
1479 <xsl:value-of select="a:Flag/a:Text"/>
1480 <br/>
1481 </div>
1482 </xsl:for-each>
1483 <xsl:for-each select="a:Test[a:TestResult/a:Description/a:Text!='']">
1484 <div>
1485 <xsl:attribute name="id">
1486 <xsl:value-of select="a:CCRDataObjectID"/>
1487 </xsl:attribute>
1488
1489 <xsl:value-of select="a:Description/a:Text"/>
1490 <xsl:text xml:space="preserve"> </xsl:text>
1491 <xsl:value-of select="a:TestResult/a:Description/a:Text" disable-output-escaping="yes"/>
1492 <xsl:text xml:space="preserve"> </xsl:text>
1493 <xsl:value-of select="a:Flag/a:Text"/>
1494 <br/>
1495 </div>
1496 </xsl:for-each>
1497 </td>
1498 <td>
1499 <xsl:call-template name="actorName">
1500 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1501 </xsl:call-template>
1502 </td>
1503 </tr>
1504 </xsl:for-each>
1505 </tbody>
1506 </table>
1507 </text>
1508 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Results/a:Result">
1509 <entry typeCode="DRIV">
1510 <xsl:variable name="testDate" select="a:DateTime"/>
1511
1512 <xsl:choose>
1513 <xsl:when test="count(a:Test)>1">
1514 <organizer classCode="BATTERY" moodCode="EVN">
1515 <templateId root="2.16.840.1.113883.10.20.1.32"/>
1516 <!--Result organizer template -->
1517
1518 <!-- <id> -->
1519 <xsl:call-template name="ccdID">
1520 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
1521 </xsl:call-template>
1522
1523 <!-- <code> -->
1524 <xsl:call-template name="ccdCodedValue">
1525 <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
1526 <xsl:with-param name="nodeName" select="'code'"/>
1527 </xsl:call-template>
1528
1529 <statusCode code="completed"/>
1530
1531 <!-- <effectiveTime> -->
1532 <xsl:call-template name="ccdDateTime">
1533 <xsl:with-param name="dt" select="$testDate"/>
1534 </xsl:call-template>
1535
1536 <xsl:call-template name="ccdPerformer">
1537 <xsl:with-param name="ccrActorReference" select="a:Source/a:Actor"/>
1538 </xsl:call-template>
1539
1540 <xsl:for-each select="a:Test">
1541 <xsl:call-template name="ccdObservation">
1542 <xsl:with-param name="ccrTestNode" select="."/>
1543 <xsl:with-param name="testDate" select="$testDate"/>
1544 </xsl:call-template>
1545 </xsl:for-each>
1546
1547 </organizer>
1548
1549 </xsl:when>
1550 <xsl:otherwise>
1551 <xsl:call-template name="ccdObservation">
1552 <xsl:with-param name="ccrTestNode" select="a:Test[1]"/>
1553 <xsl:with-param name="testDate" select="$testDate"/>
1554 </xsl:call-template>
1555 </xsl:otherwise>
1556 </xsl:choose>
1557 </entry>
1558 </xsl:for-each>
1559 </section>
1560 </component>
1561 </xsl:if>
1562 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Payers">
1563 <component>
1564 <section>
1565 <templateId root="2.16.840.1.113883.10.20.1.9"/>
1566 <code code="48768-6" codeSystem="2.16.840.1.113883.6.1"/>
1567 <title>Insurance</title>
1568 <text>
1569 <table>
1570 <tbody>
1571 <tr>
1572 <th>Type</th>
1573 <th>Date</th>
1574 <th>Identification Numbers</th>
1575 <th>Payment Provider</th>
1576 <th>Subscriber</th>
1577 <th>Source</th>
1578 </tr>
1579 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Payers/a:Payer">
1580 <tr>
1581 <td>
1582 <xsl:value-of select="a:Type/a:Text"/>
1583 </td>
1584 <td>
1585 <xsl:call-template name="date:format-date">
1586 <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
1587 </xsl:call-template>
1588 </td>
1589 <td>
1590 <xsl:for-each select="a:IDs">
1591 <xsl:value-of select="a:Type/a:Text"/>:<xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="a:ID"/><br/>
1592 </xsl:for-each>
1593 </td>
1594 <td>
1595 <xsl:call-template name="actorName">
1596 <xsl:with-param name="objID" select="a:PaymentProvider/a:ActorID"/>
1597 </xsl:call-template>
1598 </td>
1599 <td>
1600 <xsl:call-template name="actorName">
1601 <xsl:with-param name="objID" select="a:Subscriber/a:ActorID"/>
1602 </xsl:call-template>
1603 </td>
1604 <td>
1605 <xsl:call-template name="actorName">
1606 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1607 </xsl:call-template>
1608 </td>
1609 </tr>
1610 </xsl:for-each>
1611 </tbody>
1612 </table>
1613 </text>
1614 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Payers/a:Payer">
1615 <entry typeCode="DRIV">
1616 <act classCode="ACT" moodCode="DEF">
1617 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.17" assigningAuthorityName="IHE PCC"/>
1618 <templateId root="2.16.840.1.113883.10.20.1.20" assigningAuthorityName="CCD"/>
1619 <!-- Coverage entry template -->
1620 <!-- <id> -->
1621 <xsl:call-template name="ccdID">
1622 <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
1623 </xsl:call-template>
1624 <code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment sources"/>
1625 <statusCode code="completed"/>
1626 <entryRelationship typeCode="COMP">
1627 <act classCode="ACT" moodCode="EVN">
1628 <templateId root="2.16.840.1.113883.3.88.11.83.5" assigningAuthorityName="HITSP C83"/>
1629 <templateId root="2.16.840.1.113883.10.20.1.26" assigningAuthorityName="CCD"/>
1630 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.18" assigningAuthorityName="IHE PCC"/>
1631 <!--Insurance provider template -->
1632 <id>
1633 <xsl:attribute name="root">
1634 <xsl:value-of select="a:IDs[1]/a:ID"/>
1635 </xsl:attribute>
1636 <xsl:attribute name="extension">
1637 <xsl:value-of select="a:IDs[1]/a:Type/a:Text"/>
1638 </xsl:attribute>
1639 </id>
1640
1641 <!-- <code> -->
1642 <xsl:call-template name="ccdCodedValue">
1643 <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
1644 <xsl:with-param name="nodeName" select="'code'"/>
1645 </xsl:call-template>
1646
1647 <statusCode code="completed"/>
1648
1649 <xsl:call-template name="ccdPerformer">
1650 <xsl:with-param name="ccrActorReference" select="a:PaymentProvider"/>
1651 </xsl:call-template>
1652
1653 <participant typeCode="HLD">
1654 <xsl:call-template name="ccdParticipantRoleActor">
1655 <xsl:with-param name="ccrActorReference" select="a:Subscriber"/>
1656 </xsl:call-template>
1657 </participant>
1658 </act>
1659 </entryRelationship>
1660 </act>
1661 </entry>
1662 </xsl:for-each>
1663 </section>
1664 </component>
1665 </xsl:if>
1666 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:HealthCareProviders">
1667 <component>
1668 <section>
1669 <title>Health Care Providers</title>
1670 <text>
1671 <table>
1672 <tbody>
1673 <tr>
1674 <th>Role</th>
1675 <th>Name</th>
1676 </tr>
1677 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:HealthCareProviders/a:Provider">
1678 <tr>
1679 <td>
1680 <xsl:value-of select="a:ActorRole/a:Text"/>
1681 </td>
1682 <td>
1683 <xsl:call-template name="actorName">
1684 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1685 </xsl:call-template>
1686 </td>
1687 </tr>
1688 </xsl:for-each>
1689 </tbody>
1690 </table>
1691 </text>
1692 </section>
1693 </component>
1694 </xsl:if>
1695 <!--
1696 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:SupportProviders">
1697 <component>
1698 <section>
1699 <title>Support Providers</title>
1700 <text>
1701 <table>
1702 <tbody>
1703 <tr>
1704 <th>Role</th>
1705 <th>Name</th>
1706 </tr>
1707 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Support/a:SupportProvider">
1708 <tr>
1709 <td>
1710 <xsl:value-of select="a:ActorRole/a:Text"/>
1711 </td>
1712 <td>
1713 <xsl:call-template name="actorName">
1714 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1715 </xsl:call-template>
1716 </td>
1717 </tr>
1718 </xsl:for-each>
1719 </tbody>
1720 </table>
1721 </text>
1722 </section>
1723 </component>
1724 </xsl:if>
1725 <xsl:if test="a:ContinuityOfCareRecord/a:References">
1726 <component>
1727 <section>
1728 <title>References</title>
1729 <text>
1730 <table>
1731 <tbody>
1732 <tr>
1733 <th>Type</th>
1734 <th>Date</th>
1735 <th>Description</th>
1736 <th>Location</th>
1737 <th>Source</th>
1738 </tr>
1739 <xsl:for-each select="/a:ContinuityOfCareRecord/a:References/a:Reference">
1740 <tr>
1741 <td>
1742 <xsl:value-of select="a:Type/a:Text"/>
1743 </td>
1744 <td>
1745 <xsl:call-template name="date:format-date">
1746 <xsl:with-param name="date-time" select="a:DateTime/a:ExactDateTime"/>
1747 </xsl:call-template>
1748 </td>
1749 <td>
1750 <strong class="clinical">
1751 <xsl:value-of select="a:Description/a:Text"/>
1752 </strong>
1753 </td>
1754 <td>
1755 <xsl:value-of select="a:Locations/a:Location/a:Description/a:Text"/>
1756 </td>
1757 <td>
1758 <xsl:call-template name="actorName">
1759 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1760 </xsl:call-template>
1761 </td>
1762 </tr>
1763 </xsl:for-each>
1764 </tbody>
1765 </table>
1766 </text>
1767 </section>
1768 </component>
1769 </xsl:if>
1770 -->
1771 <!--
1772 <component>
1773 <section>
1774 <title>Additional Information About People &amp; Organizations</title>
1775 <text>
1776 <xsl:if test="a:ContinuityOfCareRecord/a:Actors/a:Actor[a:Person]">
1777 <table>
1778 <tbody>
1779 <tr>
1780 <th>Name</th>
1781 <th>Specialty</th>
1782 <th>Relation</th>
1783 <th>Identification Numbers</th>
1784 <th>Phone</th>
1785 <th>Address/ E-mail</th>
1786 </tr>
1787 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor">
1788 <xsl:sort select="a:Person/a:Name/a:DisplayName|a:Person/a:Name/a:CurrentName/a:Family" data-type="text" order="ascending"/>
1789 <xsl:if test="a:Person">
1790 <tr>
1791 <td>
1792 <xsl:call-template name="actorName">
1793 <xsl:with-param name="objID" select="a:ActorObjectID"/>
1794 </xsl:call-template>
1795 </td>
1796 <td>
1797 <xsl:value-of select="a:Specialty/a:Text"/>
1798 </td>
1799 <td>
1800 <xsl:value-of select="a:Relation/a:Text"/>
1801 </td>
1802 <td>
1803 <xsl:for-each select="a:IDs">
1804 <xsl:value-of select="a:Type/a:Text"/>
1805 <xsl:text>: </xsl:text>
1806 <xsl:value-of select="a:ID"/>
1807 </xsl:for-each>
1808 </td>
1809 <td>
1810 <xsl:for-each select="a:Telephone">
1811 <xsl:value-of select="a:Type/a:Text"/>
1812 <xsl:text>: </xsl:text>
1813 <xsl:value-of select="a:Value"/>
1814 </xsl:for-each>
1815 </td>
1816 <td>
1817 <xsl:for-each select="a:Address">
1818 <xsl:if test="a:Type">
1819 <xsl:value-of select="a:Type/a:Text"/>
1820 <xsl:text>:</xsl:text>
1821 <br/>
1822 </xsl:if>
1823 <xsl:if test="a:Line1">
1824 <xsl:value-of select="a:Line1"/>
1825 <br/>
1826 </xsl:if>
1827 <xsl:if test="a:Line2">
1828 <xsl:value-of select="a:Line2"/>
1829 <br/>
1830 </xsl:if>
1831 <xsl:if test="a:City">
1832 <xsl:value-of select="a:City"/>
1833 <xsl:text>, </xsl:text>
1834 </xsl:if>
1835 <xsl:value-of select="a:State"/>
1836 <xsl:value-of select="a:PostalCode"/>
1837 <br/>
1838 </xsl:for-each>
1839 <xsl:for-each select="a:EMail">
1840 <br/>
1841 <xsl:value-of select="a:Value"/>
1842 </xsl:for-each>
1843 </td>
1844 </tr>
1845 </xsl:if>
1846 </xsl:for-each>
1847 </tbody>
1848 </table>
1849 </xsl:if>
1850 <xsl:if test="a:ContinuityOfCareRecord/a:Actors/a:Actor[a:Organization]">
1851 <table>
1852 <tbody>
1853 <tr>
1854 <th>Name</th>
1855 <th>Specialty</th>
1856 <th>Relation</th>
1857 <th>Identification Numbers</th>
1858 <th>Phone</th>
1859 <th>Address/ E-mail</th>
1860 </tr>
1861 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor">
1862 <xsl:sort select="a:Organization/a:Name" data-type="text" order="ascending"/>
1863 <xsl:if test="a:Organization">
1864 <tr>
1865 <td>
1866 <xsl:value-of select="a:Organization/a:Name"/>
1867 </td>
1868 <td>
1869 <xsl:value-of select="a:Specialty/a:Text"/>
1870 </td>
1871 <td>
1872 <xsl:value-of select="a:Relation/a:Text"/>
1873 </td>
1874 <td>
1875 <xsl:for-each select="a:IDs">
1876 <xsl:value-of select="a:Type/a:Text"/>
1877 <xsl:text>: </xsl:text>
1878 <xsl:value-of select="a:ID"/>
1879 </xsl:for-each>
1880 </td>
1881 <td>
1882 <xsl:for-each select="a:Telephone">
1883 <xsl:value-of select="a:Type/a:Text"/>
1884 <xsl:text>: </xsl:text>
1885 <xsl:value-of select="a:Value"/>
1886 </xsl:for-each>
1887 </td>
1888 <td>
1889 <xsl:for-each select="a:Address">
1890 <xsl:if test="a:Type">
1891 <xsl:value-of select="a:Type/a:Text"/>
1892 <xsl:text>:</xsl:text>
1893 <br/>
1894 </xsl:if>
1895 <xsl:if test="a:Line1">
1896 <xsl:value-of select="a:Line1"/>
1897 <br/>
1898 </xsl:if>
1899 <xsl:if test="a:Line2">
1900 <xsl:value-of select="a:Line2"/>
1901 <br/>
1902 </xsl:if>
1903 <xsl:if test="a:City">
1904 <xsl:value-of select="a:City"/>
1905 <xsl:text>, </xsl:text>
1906 </xsl:if>
1907 <xsl:value-of select="a:State"/>
1908 <xsl:value-of select="a:PostalCode"/>
1909 <br/>
1910 </xsl:for-each>
1911 <xsl:for-each select="a:EMail">
1912 <br/>
1913 <xsl:value-of select="a:Value"/>
1914 </xsl:for-each>
1915 </td>
1916 </tr>
1917 </xsl:if>
1918 </xsl:for-each>
1919 </tbody>
1920 </table>
1921 </xsl:if>
1922 <xsl:if test="a:ContinuityOfCareRecord/a:Actors/a:Actor[a:InformationSystem]">
1923 <table>
1924 <tbody>
1925 <tr>
1926 <th>Name</th>
1927 <th>Type</th>
1928 <th>Version</th>
1929 <th>Identification Numbers</th>
1930 <th>Phone</th>
1931 <th>Address/ E-mail</th>
1932 </tr>
1933 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor">
1934 <xsl:sort select="a:InformationSystem/a:Name" data-type="text" order="ascending"/>
1935 <xsl:if test="a:InformationSystem">
1936 <tr>
1937 <td>
1938 <xsl:value-of select="a:InformationSystem/a:Name"/>
1939 </td>
1940 <td>
1941 <xsl:value-of select="a:InformationSystem/a:Type"/>
1942 </td>
1943 <td>
1944 <xsl:value-of select="a:InformationSystem/a:Version"/>
1945 </td>
1946 <td>
1947 <xsl:for-each select="a:IDs">
1948 <xsl:value-of select="a:Type/a:Text"/>
1949 <xsl:text>: </xsl:text>
1950 <xsl:value-of select="a:ID"/>
1951 </xsl:for-each>
1952 </td>
1953 <td>
1954 <xsl:for-each select="a:Telephone">
1955 <xsl:value-of select="a:Type/a:Text"/>
1956 <xsl:text>: </xsl:text>
1957 <xsl:value-of select="a:Value"/>
1958 </xsl:for-each>
1959 </td>
1960 <td>
1961 <xsl:for-each select="a:Address">
1962 <xsl:if test="Type">
1963 <xsl:value-of select="a:Type/a:Text"/>
1964 <xsl:text>:</xsl:text>
1965 <br/>
1966 </xsl:if>
1967 <xsl:if test="a:Line1">
1968 <xsl:value-of select="a:Line1"/>
1969 <br/>
1970 </xsl:if>
1971 <xsl:if test="a:Line2">
1972 <xsl:value-of select="a:Line2"/>
1973 <br/>
1974 </xsl:if>
1975 <xsl:if test="a:City">
1976 <xsl:value-of select="a:City"/>
1977 <xsl:text>, </xsl:text>
1978 </xsl:if>
1979 <xsl:value-of select="a:State"/>
1980 <xsl:value-of select="a:PostalCode"/>
1981 <br/>
1982 </xsl:for-each>
1983 <xsl:for-each select="a:EMail">
1984 <br/>
1985 <xsl:value-of select="a:Value"/>
1986 </xsl:for-each>
1987 </td>
1988 </tr>
1989 </xsl:if>
1990 </xsl:for-each>
1991 </tbody>
1992 </table>
1993 </xsl:if>
1994 </text>
1995 </section>
1996 </component>
1997 -->
1998</section>
1999</component>
2000</section>
2001</component>
2002</structuredBody>
2003</component>
2004</ClinicalDocument>
2005 </xsl:template>
2006 <xsl:template name="ccdAssignedEntity">
2007 <xsl:param name="ccrActorObjectID"/>
2008
2009 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
2010
2011 <assignedEntity>
2012 <xsl:call-template name="ccdEntityID">
2013 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2014 </xsl:call-template>
2015
2016 <xsl:call-template name="ccdAddress">
2017 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address"/>
2018 </xsl:call-template>
2019
2020 <xsl:call-template name="ccdTelecom">
2021 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2022 </xsl:call-template>
2023
2024 <xsl:if test="$CCRActor/a:Person">
2025 <xsl:call-template name="ccdPerson">
2026 <xsl:with-param name="CCRActorPerson" select="$CCRActor/a:Person"/>
2027 <xsl:with-param name="personNodeName" select="'assignedPerson'"/>
2028 </xsl:call-template>
2029 </xsl:if>
2030
2031 <xsl:if test="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']">
2032 <xsl:call-template name="ccdOrganization">
2033 <xsl:with-param name="ccrActorObjectID" select="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']/a:LinkID"/>
2034 <xsl:with-param name="organizationNodeName" select="'representedOrganization'"/>
2035 </xsl:call-template>
2036 </xsl:if>
2037
2038 </assignedEntity>
2039 </xsl:template>
2040
2041 <xsl:template name="ccdPatient">
2042 <xsl:param name="CCRActorPerson"/>
2043 <patient>
2044 <xsl:call-template name="ccdPersonName">
2045 <xsl:with-param name="CCRActorName" select="$CCRActorPerson/a:Name"/>
2046 </xsl:call-template>
2047
2048 <xsl:if test="$CCRActorPerson/a:Gender">
2049 <xsl:call-template name="ccdCodedValue">
2050 <xsl:with-param name="ccrCodedDescription" select="$CCRActorPerson/a:Gender"/>
2051 <xsl:with-param name="domain" select="'AdministrativeGender'"/>
2052 <xsl:with-param name="nodeName" select="'administrativeGenderCode'"/>
2053 </xsl:call-template>
2054 </xsl:if>
2055
2056 <xsl:if test="$CCRActorPerson/a:DateOfBirth">
2057 <birthTime>
2058 <xsl:attribute name="value">
2059 <xsl:call-template name="date:format-date">
2060 <xsl:with-param name="date-time" select="$CCRActorPerson/a:DateOfBirth/a:ExactDateTime"/>
2061 <xsl:with-param name="pattern">yyyyMMddhhmmss</xsl:with-param>
2062 </xsl:call-template>
2063 </xsl:attribute>
2064 </birthTime>
2065 </xsl:if>
2066
2067 <xsl:if test="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Marital Status']">
2068 <xsl:call-template name="ccdCodedValue">
2069 <xsl:with-param name="ccrCodedDescription" select="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Marital Status']/a:Description"/>
2070 <xsl:with-param name="domain" select="'MaritalStatus'"/>
2071 <xsl:with-param name="nodeName" select="'maritalStatusCode'"/>
2072 </xsl:call-template>
2073 </xsl:if>
2074
2075 <xsl:if test="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Language']">
2076 <languageCommunication>
2077 <templateId root="2.16.840.1.113883.3.88.11.83.2" assigningAuthorityName="HITSP/C83"/>
2078 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1" assigningAuthorityName="IHE/PCC"/>
2079 <xsl:call-template name="ccdCodedValue">
2080 <xsl:with-param name="ccrCodedDescription" select="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement[a:Type/a:Text='Language']/a:Description"></xsl:with-param>
2081 <xsl:with-param name="domain" select="'HumanLanguage'"/>
2082 <xsl:with-param name="nodeName" select="'languageCode'"/>
2083 </xsl:call-template>
2084 </languageCommunication>
2085 </xsl:if>
2086 </patient>
2087 </xsl:template>
2088
2089 <xsl:template name="ccdPerformer">
2090 <xsl:param name="ccrActorReference"/>
2091 <performer typeCode="PRF">
2092 <xsl:if test="$ccrActorReference/a:ActorRole">
2093 <xsl:call-template name="ccdCodedValue">
2094 <xsl:with-param name="ccrCodedDescription" select="$ccrActorReference/a:ActorRole"/>
2095 <xsl:with-param name="nodeName" select="'functionCode'"/>
2096 </xsl:call-template>
2097 </xsl:if>
2098 <xsl:call-template name="ccdAssignedEntity">
2099 <xsl:with-param name="ccrActorObjectID" select="$ccrActorReference/a:ActorID"/>
2100 </xsl:call-template>
2101 </performer>
2102 </xsl:template>
2103
2104 <xsl:template name="ccdPerson">
2105 <xsl:param name="CCRActorPerson"/>
2106 <xsl:param name="personNodeName">assignedPerson</xsl:param>
2107 <xsl:element name="{$personNodeName}">
2108 <xsl:call-template name="ccdPersonName">
2109 <xsl:with-param name="CCRActorName" select="$CCRActorPerson/a:Name"/>
2110 </xsl:call-template>
2111 </xsl:element>
2112 </xsl:template>
2113
2114 <xsl:template name="ccdPersonName">
2115 <xsl:param name="CCRActorName"/>
2116 <name>
2117 <xsl:if test="$CCRActorName/a:CurrentName/a:Title">
2118 <prefix>
2119 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Title"/>
2120 </prefix>
2121 </xsl:if>
2122 <xsl:if test="$CCRActorName/a:CurrentName/a:Given">
2123 <given>
2124 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Given"/>
2125 </given>
2126 </xsl:if>
2127 <xsl:if test="$CCRActorName/a:CurrentName/a:Middle">
2128 <given>
2129 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Middle"/>
2130 </given>
2131 </xsl:if>
2132 <xsl:if test="$CCRActorName/a:CurrentName/a:Family">
2133 <family>
2134 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Family"/>
2135 </family>
2136 </xsl:if>
2137 <xsl:if test="$CCRActorName/a:CurrentName/a:Suffix">
2138 <suffix>
2139 <xsl:value-of select="$CCRActorName/a:CurrentName/a:Suffix"/>
2140 </suffix>
2141 </xsl:if>
2142 </name>
2143 </xsl:template>
2144
2145 <xsl:template name="ccdOrganization">
2146 <xsl:param name="ccrActorObjectID"/>
2147 <xsl:param name="organizationNodeName"/>
2148
2149 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
2150
2151 <xsl:element name="{$organizationNodeName}">
2152 <xsl:call-template name="ccdEntityID">
2153 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2154 </xsl:call-template>
2155 <xsl:call-template name="ccdTelecom">
2156 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2157 </xsl:call-template>
2158
2159 <xsl:call-template name="ccdAddress">
2160 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
2161 </xsl:call-template>
2162 </xsl:element>
2163 </xsl:template>
2164
2165 <xsl:template name="ccdPatientRole">
2166 <xsl:param name="ccrActorObjectID"/>
2167
2168 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
2169
2170 <xsl:call-template name="ccdEntityID">
2171 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2172 </xsl:call-template>
2173
2174 <xsl:call-template name="ccdAddress">
2175 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
2176 </xsl:call-template>
2177
2178 <xsl:call-template name="ccdTelecom">
2179 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2180 </xsl:call-template>
2181
2182 <xsl:call-template name="ccdPatient">
2183 <xsl:with-param name="CCRActorPerson" select="$CCRActor/a:Person"/>
2184 </xsl:call-template>
2185 </xsl:template>
2186
2187 <xsl:template name="ccdAssignedAuthor">
2188 <xsl:param name="ccrActorObjectID"/>
2189 <assignedAuthor>
2190 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
2191
2192 <xsl:call-template name="ccdEntityID">
2193 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2194 </xsl:call-template>
2195
2196 <xsl:call-template name="ccdAddress">
2197 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
2198 </xsl:call-template>
2199
2200 <xsl:call-template name="ccdTelecom">
2201 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2202 </xsl:call-template>
2203
2204 <xsl:call-template name="ccdPerson">
2205 <xsl:with-param name="CCRActorPerson" select="$CCRActor/a:Person"/>
2206 </xsl:call-template>
2207
2208 <xsl:if test="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']">
2209 <representedOrganization>
2210 <xsl:call-template name="ccdOrganization">
2211 <xsl:with-param name="ccrActorObjectID" select="$CCRActor/a:InternalCCRLink[a:LinkRelationship='Organization']/a:LinkID"/>
2212 </xsl:call-template>
2213 </representedOrganization>
2214 </xsl:if>
2215 </assignedAuthor>
2216 </xsl:template>
2217
2218 <xsl:template name="ccdParticipantRoleActor">
2219 <xsl:param name="ccrActorObjectID"/>
2220
2221 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$ccrActorObjectID]"/>
2222
2223 <xsl:call-template name="ccdEntityID">
2224 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2225 </xsl:call-template>
2226
2227 <xsl:call-template name="ccdAddress">
2228 <xsl:with-param name="CCRActorAddress" select="$CCRActor/a:Address[1]"/>
2229 </xsl:call-template>
2230
2231 <xsl:call-template name="ccdTelecom">
2232 <xsl:with-param name="CCRActor" select="$CCRActor"/>
2233 </xsl:call-template>
2234
2235 <xsl:if test="$CCRActor/a:Organization/a:Name">
2236 <playingEntity classCode="PLC">
2237 <name>
2238 <xsl:value-of select="$CCRActor/a:Organization/a:Name"/>
2239 </name>
2240 </playingEntity>
2241 </xsl:if>
2242 </xsl:template>
2243
2244 <xsl:template name="ccdParticipantRoleCodedDescription">
2245 <xsl:param name="ccrCodedDescription"/>
2246 <participantRole classCode="MANU">
2247 <!--Product Detail-->
2248 <playingEntity classCode="MMAT">
2249 <xsl:if test="$ccrCodedDescription/a:Code">
2250 <xsl:call-template name="ccdCodedValue">
2251 <xsl:with-param name="ccrCodedDescription" select="$ccrCodedDescription"/>
2252 <xsl:with-param name="nodeName" select="'code'"/>
2253 </xsl:call-template>
2254 </xsl:if>
2255 <name>
2256 <xsl:value-of select="$ccrCodedDescription/a:Text"/>
2257 </name>
2258 </playingEntity>
2259 </participantRole>
2260 </xsl:template>
2261
2262 <xsl:template name="ccdEntityID">
2263 <xsl:param name="CCRActor"/>
2264 <id>
2265 <xsl:choose>
2266 <xsl:when test="$CCRActor/a:IDs">
2267 <xsl:attribute name="extension">
2268 <xsl:value-of select="$CCRActor/a:IDs[1]/a:ID"/>
2269 </xsl:attribute>
2270 <xsl:attribute name="root">
2271 <xsl:value-of select="$CCRActor/a:IDs[1]/a:Type/a:Text"/>
2272 </xsl:attribute>
2273 </xsl:when>
2274 <xsl:otherwise>
2275 <xsl:attribute name="extension">
2276 <xsl:value-of select="$CCRActor/a:ActorObjectID"/>
2277 </xsl:attribute>
2278 <xsl:attribute name="root">
2279 <xsl:text>CCRActorID</xsl:text>
2280 </xsl:attribute>
2281 </xsl:otherwise>
2282 </xsl:choose>
2283 </id>
2284 <xsl:if test="$CCRActor/a:Organization">
2285 <name><xsl:value-of select="$CCRActor/a:Organization/a:Name"></xsl:value-of></name>
2286 </xsl:if>
2287 </xsl:template>
2288 <xsl:template name="ccdAddress">
2289 <xsl:param name="CCRActorAddress"/>
2290 <addr>
2291 <xsl:choose>
2292 <xsl:when test="$CCRActorAddress">
2293 <xsl:attribute name="use">
2294 <xsl:call-template name="CDAVocabularyLookup">
2295 <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
2296 <xsl:with-param name="ccrtext" select="$CCRActorAddress/a:Type/a:Text"/>
2297 </xsl:call-template>
2298 </xsl:attribute>
2299 <streetAddressLine>
2300 <xsl:value-of select="$CCRActorAddress/a:Line1"/>
2301 </streetAddressLine>
2302 <city>
2303 <xsl:value-of select="$CCRActorAddress/a:City"/>
2304 </city>
2305 <state>
2306 <xsl:value-of select="$CCRActorAddress/a:State"/>
2307 </state>
2308 <postalCode>
2309 <xsl:value-of select="$CCRActorAddress/a:PostalCode"/>
2310 </postalCode>
2311 </xsl:when>
2312 <xsl:otherwise>
2313 <streetAddressLine/>
2314 </xsl:otherwise>
2315 </xsl:choose>
2316 </addr>
2317 </xsl:template>
2318
2319 <xsl:template name="ccdTelecom">
2320 <xsl:param name="CCRActor"/>
2321 <telecom>
2322 <xsl:if test="$CCRActor/a:Telephone">
2323 <xsl:attribute name="use">
2324 <xsl:call-template name="CDAVocabularyLookup">
2325 <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
2326 <xsl:with-param name="ccrtext" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
2327 </xsl:call-template>
2328 </xsl:attribute>
2329 <xsl:attribute name="value">
2330 <xsl:text>tel:+1-</xsl:text>
2331 <xsl:value-of select="$CCRActor/a:Telephone[1]/a:Value"/>
2332 </xsl:attribute>
2333 </xsl:if>
2334 </telecom>
2335
2336 <xsl:if test="$CCRActor/a:Email">
2337 <telecom>
2338 <xsl:choose>
2339 <xsl:when test="$CCRActor/a:Telephone">
2340 <xsl:attribute name="use">
2341 <xsl:call-template name="CDAVocabularyLookup">
2342 <xsl:with-param name="domain" select="'telecommunicationsAddressUse'"/>
2343 <xsl:with-param name="ccrtext" select="$CCRActor/a:Telephone/a:Type/a:Text"/>
2344 </xsl:call-template>
2345 </xsl:attribute>
2346 <xsl:attribute name="value">
2347 <xsl:text>mailto:</xsl:text>
2348 <xsl:value-of select="$CCRActor/a:Email[1]/a:Value"/>
2349 </xsl:attribute>
2350 </xsl:when>
2351 <xsl:otherwise>
2352 <xsl:attribute name="value">
2353 <xsl:text>Unknown</xsl:text>
2354 </xsl:attribute>
2355 </xsl:otherwise>
2356 </xsl:choose>
2357 </telecom>
2358 </xsl:if>
2359 </xsl:template>
2360
2361 <xsl:template name="ccdID">
2362 <xsl:param name="ccrObjectID"/>
2363 <xsl:param name="suffix"/>
2364 <id>
2365 <xsl:attribute name="root">
2366 <xsl:value-of select="$ccrObjectID"></xsl:value-of>
2367 </xsl:attribute>
2368 <xsl:attribute name="extension">CCRObjectID</xsl:attribute>
2369 </id>
2370 </xsl:template>
2371
2372 <xsl:template name="ccdCodedValue">
2373 <xsl:param name="ccrCodedDescription"/>
2374 <xsl:param name="type"/>
2375 <xsl:param name="domain"/>
2376 <xsl:param name="nodeName">value</xsl:param>
2377 <xsl:param name="originalTextReference"/>
2378
2379 <xsl:element name="{$nodeName}">
2380 <xsl:if test="$type">
2381 <xsl:attribute name="xsi:type">
2382 <xsl:value-of select="$type"/>
2383 </xsl:attribute>
2384 </xsl:if>
2385 <xsl:choose>
2386 <xsl:when test="$ccrCodedDescription/a:Code">
2387 <xsl:attribute name="displayName">
2388 <xsl:value-of select="$ccrCodedDescription/a:Text"/>
2389 </xsl:attribute>
2390 <xsl:attribute name="code">
2391 <xsl:value-of select="$ccrCodedDescription/a:Code/a:Value"/>
2392 </xsl:attribute>
2393 <xsl:attribute name="codeSystemName">
2394 <xsl:value-of select="$ccrCodedDescription/a:Code/a:CodingSystem"/>
2395 </xsl:attribute>
2396 <xsl:attribute name="codeSystem">
2397 <xsl:call-template name="HL7OIDLookup">
2398 <xsl:with-param name="name" select="$ccrCodedDescription/a:Code/a:CodingSystem"/>
2399 </xsl:call-template>
2400 </xsl:attribute>
2401 </xsl:when>
2402 <xsl:when test="$domain">
2403 <xsl:variable name="cdaCode">
2404 <xsl:call-template name="CDAVocabularyLookup">
2405 <xsl:with-param name="domain" select="$domain"/>
2406 <xsl:with-param name="ccrtext" select="$ccrCodedDescription/a:Text"/>
2407 </xsl:call-template>
2408 </xsl:variable>
2409 <xsl:attribute name="displayName">
2410 <xsl:call-template name="CDADisplayNameLookup">
2411 <xsl:with-param name="domain" select="$domain"/>
2412 <xsl:with-param name="cdacode" select="$cdaCode"/>
2413 </xsl:call-template>
2414 </xsl:attribute>
2415 <xsl:attribute name="code">
2416 <xsl:value-of select="$cdaCode"></xsl:value-of>
2417 </xsl:attribute>
2418 <xsl:attribute name="codeSystemName">
2419 <xsl:call-template name="CDAVocabularyCodeSystemNameLookup">
2420 <xsl:with-param name="domain" select="$domain"/>
2421 </xsl:call-template>
2422 </xsl:attribute>
2423 <xsl:attribute name="codeSystemName">
2424 <xsl:call-template name="CDAVocabularyCodeSystemLookup">
2425 <xsl:with-param name="domain" select="$domain"/>
2426 </xsl:call-template>
2427 </xsl:attribute>
2428 </xsl:when>
2429 <xsl:otherwise>
2430 <originalText>
2431 <xsl:value-of select="$ccrCodedDescription/a:Text"/>
2432 <xsl:if test="$originalTextReference">
2433 <reference>
2434 <xsl:attribute name="value">
2435 <xsl:value-of select="$originalTextReference"/>
2436 </xsl:attribute>
2437 </reference>
2438 </xsl:if>
2439 </originalText>
2440 </xsl:otherwise>
2441 </xsl:choose>
2442 </xsl:element>
2443 </xsl:template>
2444
2445 <xsl:template name="ccdDateTime">
2446 <xsl:param name="dt"/>
2447 <xsl:param name="type"/>
2448 <xsl:if test="$dt">
2449 <xsl:if test="$dt[1]/a:ExactDateTime">
2450 <effectiveTime>
2451 <xsl:if test="$type">
2452 <xsl:attribute name="xsi:type">
2453 <xsl:value-of select="$type"></xsl:value-of>
2454 </xsl:attribute>
2455 </xsl:if>
2456 <low>
2457 <xsl:attribute name="value">
2458 <xsl:call-template name="date:format-date">
2459 <xsl:with-param name="date-time" select="$dt[1]/a:ExactDateTime"/>
2460 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
2461 </xsl:call-template>
2462 </xsl:attribute>
2463 </low>
2464 <high nullFlavor="UNK"/>
2465 </effectiveTime>
2466 </xsl:if>
2467 <xsl:if test="$dt[1]/a:DateTimeRange">
2468 <effectiveTime>
2469 <low>
2470 <xsl:attribute name="value">
2471 <xsl:call-template name="date:format-date">
2472 <xsl:with-param name="date-time" select="$dt[1]/a:DateTimeRange/a:BeginRange/a:ExactDateTime"/>
2473 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
2474 </xsl:call-template>
2475 </xsl:attribute>
2476 </low>
2477 <high>
2478 <xsl:attribute name="value">
2479 <xsl:call-template name="date:format-date">
2480 <xsl:with-param name="date-time" select="$dt[1]/a:DateTimeRange/a:EndRange/a:ExactDateTime"/>
2481 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
2482 </xsl:call-template>
2483 </xsl:attribute>
2484 </high>
2485 </effectiveTime>
2486 </xsl:if>
2487 </xsl:if>
2488 </xsl:template>
2489
2490 <xsl:template name="ccdMedicationFrequency">
2491 <xsl:param name="frequency"/>
2492 <xsl:if test="$frequency">
2493 <xsl:choose>
2494 <xsl:when test="$frequency/a:Value='qd'">
2495 <effectiveTime xsi:type="PIVL_TS" operator="A">
2496 <xsl:attribute name="institutionSpecified">true</xsl:attribute>
2497 <period>
2498 <xsl:attribute name="value">24</xsl:attribute>
2499 <xsl:attribute name="unit">h</xsl:attribute>
2500 </period>
2501 </effectiveTime>
2502 </xsl:when>
2503 <xsl:when test="$frequency/a:Value='bid'">
2504 <effectiveTime xsi:type="PIVL_TS" operator="A">
2505 <xsl:attribute name="institutionSpecified">true</xsl:attribute>
2506 <period>
2507 <xsl:attribute name="value">12</xsl:attribute>
2508 <xsl:attribute name="unit">h</xsl:attribute>
2509 </period>
2510 </effectiveTime>
2511 </xsl:when>
2512 <xsl:when test="$frequency/a:Value='tid'">
2513 <effectiveTime xsi:type="PIVL_TS" operator="A">
2514 <xsl:attribute name="institutionSpecified">true</xsl:attribute>
2515 <period>
2516 <xsl:attribute name="value">8</xsl:attribute>
2517 <xsl:attribute name="unit">h</xsl:attribute>
2518 </period>
2519 </effectiveTime>
2520 </xsl:when>
2521 <xsl:when test="$frequency/a:Value='qid'">
2522 <effectiveTime xsi:type="PIVL_TS" operator="A">
2523 <xsl:attribute name="institutionSpecified">true</xsl:attribute>
2524 <period>
2525 <xsl:attribute name="value">6</xsl:attribute>
2526 <xsl:attribute name="unit">h</xsl:attribute>
2527 </period>
2528 </effectiveTime>
2529 </xsl:when>
2530 <xsl:when test="$frequency/a:Value='qam'">
2531 <effectiveTime xsi:type='EIVL' operator='A'>
2532 <event code='ACM'/>
2533 </effectiveTime>
2534 </xsl:when>
2535 <xsl:when test="$frequency/a:Value='qpm'">
2536 <effectiveTime xsi:type='EIVL' operator='A'>
2537 <event code='PCV'/>
2538 </effectiveTime>
2539 </xsl:when>
2540 </xsl:choose>
2541 </xsl:if>
2542 </xsl:template>
2543
2544 <xsl:template name="ccdStatus">
2545 <xsl:param name="ccrStatus"/>
2546
2547 <entryRelationship typeCode="REFR">
2548 <observation classCode="OBS" moodCode="EVN">
2549 <templateId root="2.16.840.1.113883.10.20.1.50"/>
2550 <!-- Problem status observation template -->
2551 <code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
2552 <statusCode code="completed"/>
2553 <xsl:call-template name="ccdCodedValue">
2554 <xsl:with-param name="ccrCodedDescription" select="$ccrStatus"/>
2555 </xsl:call-template>
2556 </observation>
2557 </entryRelationship>
2558 </xsl:template>
2559
2560 <xsl:template name="ccdStatusObservation">
2561 <xsl:param name="status"/>
2562 <xsl:variable name="statusText" select="$status/a:Text"></xsl:variable>
2563 <xsl:choose>
2564 <xsl:when test="$statusText='Active'">
2565 <xsl:call-template name="ccdStatusElement">
2566 <xsl:with-param name="statusCode" select="'55561003'"/>
2567 <xsl:with-param name="statusDisplayName" select="$statusText"/>
2568 </xsl:call-template>
2569 </xsl:when>
2570 <xsl:when test="$statusText='Inactive'">
2571 <xsl:call-template name="ccdStatusElement">
2572 <xsl:with-param name="statusCode" select="'73425007'"/>
2573 <xsl:with-param name="statusDisplayName" select="$statusText"/>
2574 </xsl:call-template>
2575 </xsl:when>
2576 <xsl:when test="$statusText='Chronic'">
2577 <xsl:call-template name="ccdStatusElement">
2578 <xsl:with-param name="statusCode" select="'90734009'"/>
2579 <xsl:with-param name="statusDisplayName" select="$statusText"/>
2580 </xsl:call-template>
2581 </xsl:when>
2582 </xsl:choose>
2583 </xsl:template>
2584
2585 <xsl:template name="ccdStatusProcedure">
2586 <xsl:param name="status"/>
2587 <xsl:variable name="statusText" select="$status/a:Text"></xsl:variable>
2588 <xsl:choose>
2589 <xsl:when test="$statusText='Completed'">
2590 <statusCode code="completed"/>
2591 </xsl:when>
2592 <xsl:when test="$statusText='Active'">
2593 <statusCode code="active"/>
2594 </xsl:when>
2595 <xsl:when test="$statusText='Aborted'">
2596 <statusCode code="aborted"/>
2597 </xsl:when>
2598 <xsl:when test="$statusText='Cancelled' or $statusText='Canceled'">
2599 <statusCode code="cancelled"/>
2600 </xsl:when>
2601 <xsl:otherwise>
2602 <statusCode>
2603 <xsl:attribute name="code">
2604 <xsl:value-of select="$statusText"></xsl:value-of>
2605 </xsl:attribute>
2606 </statusCode>
2607 </xsl:otherwise>
2608 </xsl:choose>
2609 </xsl:template>
2610
2611 <xsl:template name="ccdStatusElement">
2612 <xsl:param name="statusCode"/>
2613 <xsl:param name="statusDisplayName"/>
2614 <value>
2615 <xsl:attribute name="xsi:type">CE</xsl:attribute>
2616 <xsl:attribute name="code">
2617 <xsl:value-of select="$statusCode"></xsl:value-of>
2618 </xsl:attribute>
2619 <xsl:attribute name="codeSystem">2.16.840.1.113883.6.96</xsl:attribute>
2620 <xsl:attribute name="displayName">
2621 <xsl:value-of select="$statusDisplayName"></xsl:value-of>
2622 </xsl:attribute>
2623 </value>
2624 </xsl:template>
2625
2626 <xsl:template name="ccdObservation">
2627 <xsl:param name="ccrTestNode"/>
2628 <xsl:param name="testDate"/>
2629
2630 <component>
2631 <observation classCode="OBS" moodCode="EVN">
2632 <templateId root="2.16.840.1.113883.3.88.11.83.15" assigningAuthorityName="HITSP C83"/>
2633 <templateId root="2.16.840.1.113883.10.20.1.31" assigningAuthorityName="CCD"/>
2634 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.13" assigningAuthorityName="IHE PCC"/>
2635
2636 <!-- Result observation template -->
2637
2638 <xsl:call-template name="ccdID">
2639 <xsl:with-param name="ccrObjectID" select="$ccrTestNode/a:CCRDataObjectID"/>
2640 </xsl:call-template>
2641
2642 <!-- <code> -->
2643 <xsl:call-template name="ccdCodedValue">
2644 <xsl:with-param name="ccrCodedDescription" select="$ccrTestNode/a:Description"/>
2645 <xsl:with-param name="nodeName" select="'code'"/>
2646 </xsl:call-template>
2647
2648 <text>
2649 <reference>
2650 <xsl:attribute name="value">
2651 <xsl:text>#</xsl:text>
2652 <xsl:value-of select="$ccrTestNode/a:CCRDataObjectID"/>
2653 </xsl:attribute>
2654 </reference>
2655 </text>
2656
2657 <statusCode code="completed"/>
2658
2659 <!-- <effectiveTime> -->
2660 <xsl:choose>
2661 <xsl:when test="$ccrTestNode/a:DateTime">
2662 <xsl:call-template name="ccdDateTime">
2663 <xsl:with-param name="dt" select="$ccrTestNode/a:DateTime"/>
2664 </xsl:call-template>
2665 </xsl:when>
2666 <xsl:otherwise>
2667 <xsl:call-template name="ccdDateTime">
2668 <xsl:with-param name="dt" select="$testDate"/>
2669 </xsl:call-template>
2670 </xsl:otherwise>
2671 </xsl:choose>
2672
2673 <xsl:choose>
2674 <xsl:when test="$ccrTestNode/a:TestResult[a:Value!='']">
2675 <value xsi:type="PQ">
2676 <xsl:attribute name="value">
2677 <xsl:value-of select="$ccrTestNode/a:TestResult/a:Value"/>
2678 </xsl:attribute>
2679 <xsl:attribute name="unit">
2680 <xsl:value-of select="$ccrTestNode/a:TestResult/a:Units/a:Unit"/>
2681 </xsl:attribute>
2682 </value>
2683 </xsl:when>
2684 <xsl:when test="$ccrTestNode/a:TestResult[a:Description/a:Text!='']">
2685 <value xsi:type="TX">
2686 <xsl:attribute name="value">
2687 <xsl:value-of select="$ccrTestNode/a:TestResult/a:Description/a:Text"/>
2688 </xsl:attribute>
2689 </value>
2690 </xsl:when>
2691 </xsl:choose>
2692
2693 <xsl:if test="$ccrTestNode/a:Flag">
2694 <xsl:call-template name="ccdCodedValue">
2695 <xsl:with-param name="ccrCodedDescription" select="$ccrTestNode/a:Flag"/>
2696 <xsl:with-param name="nodeName" select="'interpretationCode'"/>
2697 <xsl:with-param name="domain" select="'ObservationInterpretation'"/>
2698 </xsl:call-template>
2699 </xsl:if>
2700
2701 <xsl:if test="$ccrTestNode/a:NormalResult">
2702 <referenceRange>
2703 <xsl:if test="$ccrTestNode/a:NormalResult/a:Normal/a:Description/a:Text">
2704 <observationRange>
2705 <text>
2706 <xsl:value-of select="$ccrTestNode/a:NormalResult/a:Normal/a:Description/a:Text"/>
2707 </text>
2708 </observationRange>
2709 </xsl:if>
2710 </referenceRange>
2711 </xsl:if>
2712
2713 </observation>
2714 </component>
2715
2716 </xsl:template>
2717</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.