source: ccr2ccd-xslt/trunk/ccr_ccd.xsl@ 757

Last change on this file since 757 was 757, checked in by Richard Braman, 14 years ago

results of merge between Ken's Code and Rich's shadow development.

File size: 122.4 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 Gilly (WorldVistA glilly@glilly.net)
12xxxx - Oroville Hospital
13
14Date: 2010-05-5
15Version: 0.1
16
17License :
18
19 This program is free software: you can redistribute it and/or modify
20 it under the terms of the GNU General Public License as published by
21 the Free Software Foundation, either version 3 of the License, or
22 (at your option) any later version.
23
24 This program is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 GNU General Public License for more details.
28
29 You should have received a copy of the GNU General Public License
30 along with this program. If not, see http://www.gnu.org/licenses.
31
32-->
33<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:astm-org:CCR" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="a date" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:str="http://exslt.org/strings" extension-element-prefixes="str" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
34 <xsl:import href="./templates/code.xsl"/>
35 <xsl:import href="./templates/ccdcodedvalue.xsl"/>
36 <xsl:import href="./templates/ccdentity.xsl"/>
37 <xsl:import href="./templates/ccdid.xsl"/>
38 <xsl:import href="./templates/ccddatetime.xsl"/>
39 <xsl:import href="./templates/ccdstatus.xsl"/>
40 <xsl:import href="./templates/ccdmedicationfrequency.xsl"/>
41 <xsl:import href="./templates/actor.xsl"/>
42 <xsl:import href="./templates/problemDescription.xsl"/>
43 <xsl:import href="./templates/HL7OIDLookup.xsl"/>
44
45 <xsl:output method="xml" encoding="utf-8" version="1.0" indent="yes"/>
46 <xsl:template match="/">
47 <xsl:processing-instruction name="xml-stylesheet">type="text/xsl" href="CCD.xsl"</xsl:processing-instruction>
48 <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:sdtc="urn:hl7-org:sdtc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://xreg2.nist.gov:8080/hitspValidation/schema/cdar2c32/infrastructure/cda/C32_CDA.xsd" classCode="DOCCLIN" moodCode="EVN">
49 <realmCode code="US"/>
50 <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
51 <templateId root="2.16.840.1.113883.10.20.1"/>
52 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.1"/>
53 <templateId root="2.16.840.1.113883.10.20.3"/>
54 <templateId root="2.16.840.1.113883.3.88.11.32.1"/>
55
56 <id>
57 <xsl:attribute name="root">
58 <xsl:value-of select="/a:ContinuityOfCareRecord/a:CCRDocumentObjectID"></xsl:value-of>
59 </xsl:attribute>
60 </id>
61 <code code="34133-9" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Summarization of episode note"/>
62 <title>Continuity of Care Document</title>
63 <effectiveTime>
64 <xsl:attribute name="value">
65 <xsl:call-template name="date:format-date">
66 <xsl:with-param name="date-time">
67 <xsl:value-of select="/a:ContinuityOfCareRecord/a:DateTime/a:ExactDateTime"/>
68 </xsl:with-param>
69 <xsl:with-param name="pattern">yyyyMMddhhmmss+0000</xsl:with-param>
70 </xsl:call-template>
71 </xsl:attribute>
72 </effectiveTime>
73 <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
74 <languageCode code="en-US"/>
75 <xsl:variable name="patientID" select="/a:ContinuityOfCareRecord/a:Patient[1]/a:ActorID"/>
76 <recordTarget>
77 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$patientID]">
78 <patientRole>
79 <xsl:call-template name="ccdEntity">
80 <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:Patient[1]/a:ActorID"></xsl:with-param>
81 <xsl:with-param name="personNodeName">patient</xsl:with-param>
82 </xsl:call-template>
83 </patientRole>
84 </xsl:for-each>
85 </recordTarget>
86
87 <xsl:variable name="fromID" select="/a:ContinuityOfCareRecord/a:From/a:ActorLink[1]/a:ActorID"/>
88 <author>
89 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$fromID]">
90 <time>
91 <xsl:attribute name="value">
92 <xsl:call-template name="date:format-date">
93 <xsl:with-param name="date-time">
94 <xsl:value-of select="/a:ContinuityOfCareRecord/a:DateTime/a:ExactDateTime"/>
95 </xsl:with-param>
96 <xsl:with-param name="pattern">yyyyMMddhhmmss</xsl:with-param>
97 </xsl:call-template>
98 </xsl:attribute>
99 </time>
100 <xsl:call-template name="ccdEntity">
101 <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:From/a:ActorLink[1]/a:ActorID"></xsl:with-param>
102 </xsl:call-template>
103 </xsl:for-each>
104 </author>
105
106 <custodian>
107 <assignedCustodian>
108 <representedCustodianOrganization>
109 <xsl:call-template name="ccdEntity">
110 <xsl:with-param name="ccrActorObjectID" select="/a:ContinuityOfCareRecord/a:Actors/a:Actor[a:ActorObjectID=$fromID]/a:InternalCCRLink[a:LinkRelationship='Organization']/a:LinkID"></xsl:with-param>
111 </xsl:call-template>
112 </representedCustodianOrganization>
113 </assignedCustodian>
114 </custodian>
115
116 <documentationOf>
117 <serviceEvent classCode="PCPR">
118 <effectiveTime>
119 <low>
120 <xsl:attribute name="value">
121 <xsl:call-template name="date:format-date">
122 <xsl:with-param name="date-time">
123 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body//a:DateTime//a:ExactDateTime">
124 <xsl:sort order="ascending"/>
125 <xsl:if test="position()=1">
126 <xsl:value-of select="."/>
127 </xsl:if>
128 </xsl:for-each>
129 </xsl:with-param>
130 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
131 </xsl:call-template>
132 </xsl:attribute>
133 </low>
134 <high>
135 <xsl:attribute name="value">
136 <xsl:call-template name="date:format-date">
137 <xsl:with-param name="date-time">
138 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body//a:DateTime//a:ExactDateTime">
139 <xsl:sort order="descending"/>
140 <xsl:if test="position()=1">
141 <xsl:value-of select="."/>
142 </xsl:if>
143 </xsl:for-each>
144 </xsl:with-param>
145 <xsl:with-param name="pattern">yyyyMMdd</xsl:with-param>
146 </xsl:call-template>
147 </xsl:attribute>
148 </high>
149 </effectiveTime>
150 </serviceEvent>
151
152 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:HealthCareProviders/a:Provider">
153 <assignedEntity>
154 <xsl:call-template name="ccdEntity">
155 <xsl:with-param name="a:ccrActorObjectID" select="a:ActorID"/>
156 </xsl:call-template>
157 </assignedEntity>
158 </xsl:for-each>
159
160 </documentationOf>
161
162 <component>
163 <structuredBody>
164 <component>
165 <section>
166 <templateId root="2.16.840.1.113883.10.20.1.13"/>
167 <code code="48764-5" codeSystem="2.16.840.1.113883.6.1" />
168 <title>Purpose</title>
169 <text>
170 <xsl:value-of select="/a:ContinuityOfCareRecord/a:Purpose/a:Description/a:Text"></xsl:value-of>
171 </text>
172 </section>
173 </component>
174 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Alerts">
175 <component>
176 <section>
177 <templateId root="2.16.840.1.113883.10.20.1.2"/>
178 <code code="46240-8" codeSystem="2.16.840.1.113883.6.1"/>
179 <title>Alerts</title>
180 <text>
181 <table>
182 <tbody>
183 <tr>
184 <th>Type</th>
185 <th>Date</th>
186 <th>Code</th>
187 <th>Description</th>
188 <th>Reaction</th>
189 <th>Source</th>
190 </tr>
191 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Alerts/a:Alert">
192 <tr>
193 <td>
194 <xsl:value-of select="a:Type/a:Text"/>
195 </td>
196 <td>
197 <xsl:call-template name="date:format-date">
198 <xsl:with-param name="date-time">
199 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
200 </xsl:with-param>
201 </xsl:call-template>
202 </td>
203 <td>
204 <xsl:apply-templates select="a:Description/a:Code"/>
205 </td>
206 <td>
207 <xsl:value-of select="a:Description/a:Text"/>
208 </td>
209 <td>
210 <xsl:value-of select="a:Reaction/a:Description/a:Text"/>
211 <xsl:if test="a:Reaction/a:Severity/a:Text">
212 -<xsl:value-of select="a:Reaction/a:Severity/a:Text"/>
213 </xsl:if>
214 </td>
215 <td>
216 <xsl:call-template name="actorName">
217 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
218 </xsl:call-template>
219 </td>
220 </tr>
221 </xsl:for-each>
222 </tbody>
223 </table>
224 </text>
225 </section>
226 </component>
227 </xsl:if>
228 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:AdvanceDirectives">
229 <component>
230 <section>
231 <templateId root="2.16.840.1.113883.10.20.1.1"/>
232 <code code="42348-3" codeSystem="2.16.840.1.113883.6.1"/>
233 <title>Advance Directives</title>
234 <text>
235 <table>
236 <tbody>
237 <tr>
238 <th>Type</th>
239 <th>Date</th>
240 <th>Description</th>
241 <th>Status</th>
242 <th>Source</th>
243 </tr>
244 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:AdvanceDirectives/a:AdvanceDirective">
245 <tr>
246 <td>
247 <xsl:value-of select="a:Type/a:Text"/>
248 </td>
249 <td>
250 <xsl:call-template name="date:format-date">
251 <xsl:with-param name="date-time">
252 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
253 </xsl:with-param>
254 </xsl:call-template>
255 </td>
256 <td>
257 <xsl:value-of select="a:Description/a:Text"/>
258 </td>
259 <td>
260 <xsl:value-of select="a:Status/a:Text"/>
261 </td>
262 <td>
263 <xsl:call-template name="actorName">
264 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
265 </xsl:call-template>
266 </td>
267 </tr>
268 </xsl:for-each>
269 </tbody>
270 </table>
271
272 </text>
273 </section>
274 </component>
275 </xsl:if>
276 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:FunctionalStatus">
277 <component>
278 <section>
279 <templateId root="2.16.840.1.113883.10.20.1.5"/>
280 <code code="47420-5" codeSystem="2.16.840.1.113883.6.1"/>
281 <title>Functional Status</title>
282 <text>
283 <table>
284 <tbody>
285 <tr>
286 <th>Type</th>
287 <th>Date</th>
288 <th>Code</th>
289 <th>Description</th>
290 <th>Status</th>
291 <th>Source</th>
292 </tr>
293 <tr>
294 <td>
295 <xsl:value-of select="a:Type/a:Text"/>
296 </td>
297 <td>
298 <xsl:call-template name="date:format-date">
299 <xsl:with-param name="date-time">
300 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
301 </xsl:with-param>
302 </xsl:call-template>
303 </td>
304 <td>
305 <xsl:apply-templates select="a:Description/a:Code"/>
306 </td>
307 <td>
308 <xsl:value-of select="a:Description/a:Text"/>
309 </td>
310 <td>
311 <xsl:value-of select="a:Status/a:Text"/>
312 </td>
313 <td>
314 <xsl:call-template name="actorName">
315 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
316 </xsl:call-template>
317 </td>
318 </tr>
319 </tbody>
320 </table>
321 </text>
322 </section>
323 </component>
324 </xsl:if>
325 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Problems">
326 <component>
327 <section>
328 <templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
329 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
330 <templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
331 <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
332 <title>Problems</title>
333 <text>
334 <table>
335 <tbody>
336 <tr>
337 <th>Type</th>
338 <th>Date</th>
339 <th>Code</th>
340 <th>Description</th>
341 <th>Status</th>
342 <th>Source</th>
343 </tr>
344 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
345 <tr>
346 <xsl:attribute name="id">
347 <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
348 </xsl:attribute>
349
350 <td>
351 <xsl:value-of select="a:Type/a:Text"/>
352 </td>
353 <td>
354 <table>
355 <tbody>
356 <xsl:apply-templates select="a:DateTime"/>
357 </tbody>
358 </table>
359 </td>
360 <td>
361 <xsl:apply-templates select="a:Description/a:Code"/>
362 </td>
363 <td>
364 <xsl:value-of select="a:Description/a:Text"/>
365 </td>
366 <td>
367 <xsl:value-of select="a:Status/a:Text"/>
368 </td>
369 <td>
370 <xsl:call-template name="actorName">
371 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
372 </xsl:call-template>
373 </td>
374 </tr>
375 </xsl:for-each>
376 </tbody>
377 </table>
378 </text>
379 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
380 <entry typeCode="DRIV">
381 <act classCode="ACT" moodCode="EVN">
382 <templateId root="2.16.840.1.113883.10.20.1.27"/>
383 <!-- Problem act template -->
384
385 <!-- <id> -->
386 <xsl:call-template name="ccdID">
387 <xsl:with-param name="ccrObjectID">
388 <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
389 </xsl:with-param>
390 </xsl:call-template>
391
392 <code nullFlavor="NA"/>
393
394 <performer typeCode="PRF">
395 <assignedEntity>
396 <xsl:call-template name="ccdEntity">
397 <xsl:with-param name="ccrActorObjectID">
398 <xsl:value-of select="a:Source/a:Actor/a:ActorID"></xsl:value-of>
399 </xsl:with-param>
400 </xsl:call-template>
401 </assignedEntity>
402 </performer>
403
404 <entryRelationship typeCode="SUBJ">
405 <observation classCode="OBS" moodCode="EVN">
406 <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
407 <!--Problem observation template-->
408
409 <!-- <id> -->
410 <xsl:call-template name="ccdID">
411 <xsl:with-param name="ccrObjectID">
412 <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
413 </xsl:with-param>
414 <xsl:with-param name="suffix">.1</xsl:with-param>
415 </xsl:call-template>
416
417 <code code="64572001" displayName="Condition" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
418
419 <text>
420 <reference>
421 <xsl:attribute name="value">
422 <xsl:text>#</xsl:text>
423 <xsl:value-of select="a:CCRDataObjectID"/>
424 </xsl:attribute>
425 </reference>
426 </text>
427
428 <statusCode code="completed"/>
429
430 <xsl:call-template name="ccdDateTime">
431 <xsl:with-param name="dt" select="a:DateTime"/>
432 </xsl:call-template>
433
434 <xsl:call-template name="ccdCodedValue">
435 <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
436 </xsl:call-template>
437
438 <xsl:call-template name="ccdStatus">
439 <xsl:with-param name="ccrStatus" select="a:Status"/>
440 </xsl:call-template>
441 </observation>
442 </entryRelationship>
443
444 </act>
445 </entry>
446 </xsl:for-each>
447 </section>
448 </component>
449 </xsl:if>
450 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Procedures">
451 <component>
452 <section>
453 <templateId root="2.16.840.1.113883.10.20.1.12"/>
454 <code code="47519-4" codeSystem="2.16.840.1.113883.6.1"/>
455 <title>Procedures</title>
456 <text>
457 <table>
458 <tbody>
459 <tr>
460 <th>Type</th>
461 <th>Date</th>
462 <th>Code</th>
463 <th>Description</th>
464 <th>Location</th>
465 <th>Substance</th>
466 <th>Method</th>
467 <th>Position</th>
468 <th>Site</th>
469 <th>Status</th>
470 <th>Source</th>
471 </tr>
472 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
473 <tr>
474 <xsl:attribute name="id">
475 <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
476 </xsl:attribute>
477
478 <td>
479 <xsl:value-of select="a:Type/a:Text"/>
480 </td>
481 <table>
482 <tbody>
483 <xsl:apply-templates select="a:DateTime"/>
484 </tbody>
485 </table>
486 <td>
487 <xsl:apply-templates select="a:Description/a:Code"/>
488 </td>
489 <td>
490 <xsl:value-of select="a:Description/a:Text"/>
491 </td>
492 <td>
493 <xsl:for-each select="a:Locations/a:Location">
494 <xsl:value-of select="a:Description/a:Text"/>
495 <xsl:if test="a:Actor">
496 (<xsl:call-template name="actorName">
497 <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
498 </xsl:call-template>
499 <xsl:if test="a:Actor/a:ActorRole/a:Text">
500 <xsl:text xml:space="preserve"> - </xsl:text><xsl:value-of select="a:ActorRole/a:Text"/>)
501 </xsl:if>
502 </xsl:if>)
503 <xsl:if test="position() != last()">
504 <br/>
505 </xsl:if>
506 </xsl:for-each>
507 </td>
508 <td>
509 <xsl:for-each select="a:Substance">
510 <xsl:value-of select="a:Text"/>
511 </xsl:for-each>
512 </td>
513 <td>
514 <xsl:value-of select="a:Method/a:Text"/>
515 </td>
516 <td>
517 <xsl:value-of select="a:Position/a:Text"/>
518 </td>
519 <td>
520 <xsl:value-of select="a:Site/a:Text"/>
521 </td>
522 <td>
523 <xsl:value-of select="a:Status/a:Text"/>
524 </td>
525 <td>
526 <xsl:call-template name="actorName">
527 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
528 </xsl:call-template>
529 </td>
530 </tr>
531 </xsl:for-each>
532 </tbody>
533 </table>
534 </text>
535 </section>
536 </component>
537 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Procedures/a:Procedure">
538 <entry typeCode="DRIV">
539 <procedure classCode="PROC" moodCode="EVN">
540 <templateId root="2.16.840.1.113883.3.88.11.83.17" assigningAuthorityName="HITSP C83"/>
541 <templateId root="2.16.840.1.113883.10.20.1.29" assigningAuthorityName="CCD"/>
542 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.19" assigningAuthorityName="IHE PCC"/>
543 <id>
544 <xsl:attribute name="root">
545 <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
546 </xsl:attribute>
547 </id>
548 <code>
549 <xsl:attribute name="code">
550 <xsl:value-of select="a:Description/a:Code/a:Value"/>
551 </xsl:attribute>
552 <xsl:attribute name="codeSystemName">
553 <xsl:value-of select="a:Description/a:Code/a:CodingSystem"/>
554 </xsl:attribute>
555 <xsl:attribute name="codeSystem">
556 <xsl:call-template name="HL7OIDLookup">
557 <xsl:with-param name="name" select="a:Description/a:Code/a:CodingSystem"/>
558 </xsl:call-template>
559 </xsl:attribute>
560 <xsl:attribute name="displayName">
561 <xsl:value-of select="a:Description/a:Text"/>
562 </xsl:attribute>
563 </code>
564 <text>
565 <reference>
566 <xsl:attribute name="value">
567 <xsl:value-of select="a:CCRDataObjectID"/>
568 </xsl:attribute>
569 </reference>
570 </text>
571 <statusCode>
572 <xsl:attribute name="value">
573 <xsl:value-of select="a:Status/a:Text"/>
574 </xsl:attribute>
575 </statusCode>
576 <xsl:call-template name="ccdDateTime">
577 <xsl:with-param name="dt" select="a:DateTime"/>
578 </xsl:call-template>
579 <xsl:if test="a:Method">
580 <approachSiteCode>
581 <xsl:attribute name="code">
582 <xsl:value-of select="a:Method/a:Code/a:Value"/>
583 </xsl:attribute>
584 <xsl:attribute name="codeSystemName">
585 <xsl:value-of select="a:Method/a:Code/a:CodingSystem"/>
586 </xsl:attribute>
587 <xsl:attribute name="codeSystem">
588 <xsl:call-template name="HL7OIDLookup">
589 <xsl:with-param name="name" select="a:Method/a:Code/a:CodingSystem"/>
590 </xsl:call-template>
591 </xsl:attribute>
592 <xsl:attribute name="displayName">
593 <xsl:value-of select="a:Method/a:Text"/>
594 </xsl:attribute>
595 </approachSiteCode>
596 </xsl:if>
597 <xsl:if test="a:Site">
598 <targetSiteCode>
599 <xsl:attribute name="code">
600 <xsl:value-of select="a:Site/a:Code/a:Value"/>
601 </xsl:attribute>
602 <xsl:attribute name="codeSystemName">
603 <xsl:value-of select="a:Site/a:Code/a:CodingSystem"/>
604 </xsl:attribute>
605 <xsl:attribute name="codeSystem">
606 <xsl:call-template name="HL7OIDLookup">
607 <xsl:with-param name="name" select="a:Site/a:Code/a:CodingSystem"/>
608 </xsl:call-template>
609 </xsl:attribute>
610 <xsl:attribute name="displayName">
611 <xsl:value-of select="a:Site/a:Text"/>
612 </xsl:attribute>
613 </targetSiteCode>
614 </xsl:if>
615 <xsl:if test="a:Practitioners/a:Practitioner">
616 <xsl:variable name="PractitionerActorID" select="a:Practitioners/a:Practitioner[0]/a:ActorID"/>
617 <performer typeCode="PRF">
618 <assignedEntity>
619 <xsl:variable name="CCRActor" select="/a:ContinuityOfCareRecord/a:Actors[a:ActorObjectID=$PractitionerActorID]/a:Actor"/>
620 <xsl:if test="$CCRActor/a:Address">
621 <addr>
622 <streetAddressLine>
623 <xsl:value-of select="$CCRActor/a:Address[0]/a:Line1"/>
624 </streetAddressLine>
625 <city>
626 <xsl:value-of select="$CCRActor/a:Address[0]/a:City"/>
627 </city>
628 <state>
629 <xsl:value-of select="$CCRActor/a:Address[0]/a:State"/>
630 </state>
631 <postalcode>
632 <xsl:value-of select="$CCRActor/a:Address[0]/a:PostalCode"/>
633 </postalcode>
634 </addr>
635 </xsl:if>
636 <xsl:if test="$CCRActor/a:Telephone">
637 <telecom>
638 <xsl:attribute name="extension">
639 <xsl:value-of select="$CCRActor/a:Telephone[0]/a:Value"/>
640 </xsl:attribute>
641 </telecom>
642 </xsl:if>
643 <assignedPerson>
644 <name>
645 <xsl:call-template name="actorName">
646 <xsl:with-param name="objID" select="$PractitionerActorID"/>
647 </xsl:call-template>
648 </name>
649 </assignedPerson>
650 </assignedEntity>
651 </performer>
652 </xsl:if>
653 </procedure>
654 </entry>
655 </xsl:for-each>
656 </xsl:if>
657 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Medications">
658 <component>
659 <section>
660 <templateId root="2.16.840.1.113883.3.88.11.83.112" assigningAuthorityName="HITSP/C83"/>
661 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.19" assigningAuthorityName="IHE PCC"/>
662 <templateId root="2.16.840.1.113883.10.20.1.8" assigningAuthorityName="HL7 CCD"/>
663 <!--Medications section template-->
664 <code code="10160-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="History of medication use"/>
665 <title>Medications</title>
666 <text>
667 <table>
668 <tbody>
669 <tr>
670 <th>Medication</th>
671 <th>Date</th>
672 <th>Status</th>
673 <th>Form</th>
674 <th>Strength</th>
675 <th>Quantity</th>
676 <th>SIG</th>
677 <th>Indications</th>
678 <th>Instruction</th>
679 <th>Refills</th>
680 <th>Source</th>
681 </tr>
682 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Medications/a:Medication">
683 <tr>
684 <td>
685 <xsl:value-of select="a:Product/a:ProductName/a:Text"/>
686 <xsl:if test="a:Product/a:BrandName">
687 <xsl:text xml:space="preserve"> </xsl:text>(<xsl:value-of select="a:Product/a:BrandName/a:Text"/>)
688 </xsl:if>
689
690 </td>
691 <td>
692 <xsl:call-template name="date:format-date">
693 <xsl:with-param name="date-time">
694 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
695 </xsl:with-param>
696 </xsl:call-template>
697 </td>
698 <td>
699 <xsl:value-of select="a:Status/a:Text"/>
700 </td>
701 <td>
702 <xsl:value-of select="a:Product/a:Form/a:Text"/>
703 </td>
704 <td>
705 <xsl:for-each select="a:Product/a:Strength">
706 <xsl:if test="position() > 1">
707 <xsl:text>/</xsl:text>
708 </xsl:if>
709 <xsl:value-of select="a:Value"/>
710 <xsl:text xml:space="preserve"> </xsl:text>
711 <xsl:value-of select="a:Units/a:Unit"/>
712 </xsl:for-each>
713 </td>
714 <td>
715 <xsl:value-of select="a:Quantity/a:Value"/>
716 <xsl:text xml:space="preserve"> </xsl:text>
717 <xsl:value-of select="a:Quantity/a:Units/a:Unit"/>
718 </td>
719 <td>
720 <xsl:for-each select="a:Directions/a:Direction">
721 <xsl:choose>
722 <xsl:when test="a:Description/a:Text">
723 <xsl:value-of select="a:Description/a:Text"/>
724 </xsl:when>
725 <xsl:otherwise>
726 <xsl:value-of select="a:Dose/a:Value"/>
727 <xsl:text xml:space="preserve"> </xsl:text>
728 <xsl:value-of select="a:Dose/a:Units/a:Unit"/>
729 <xsl:text xml:space="preserve"> </xsl:text>
730 <xsl:value-of select="a:Route/a:Text"/>
731 <xsl:text xml:space="preserve"> </xsl:text>
732 <xsl:value-of select="a:Frequency/a:Value"/>
733 <xsl:if test="a:Duration">
734 <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>
735 </xsl:if>
736 <xsl:if test="a:MultipleDirectionModifier/a:ObjectAttribute">
737 <xsl:for-each select="a:MultipleDirectionModifier/a:ObjectAttribute">
738 <xsl:value-of select="a:Attribute"/>
739 <br/>
740 <xsl:value-of select="a:AttributeValue/a:Value"/>
741 </xsl:for-each>
742 </xsl:if>
743 </xsl:otherwise>
744 </xsl:choose>
745 </xsl:for-each>
746 </td>
747 <td>
748 <xsl:for-each select="a:Directions/a:Direction[1]/a:Indication">
749 <xsl:call-template name="problemDescription">
750 <xsl:with-param name="objID" select="a:InternalCCRLink/a:LinkID"/>
751 </xsl:call-template>
752 <br/>
753 </xsl:for-each>
754 </td>
755 <td>
756 <xsl:for-each select="a:PatientInstructions/a:Instruction">
757 <xsl:value-of select="a:Text"/>
758 <br/>
759 </xsl:for-each>
760 </td>
761 <td>
762 <xsl:for-each select="a:Refills/a:Refill">
763 <xsl:value-of select="a:Number"/>
764 <xsl:text xml:space="preserve"> </xsl:text>
765 </xsl:for-each>
766 </td>
767 <td>
768 <xsl:call-template name="actorName">
769 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
770 </xsl:call-template>
771 </td>
772 </tr>
773 </xsl:for-each>
774 </tbody>
775 </table>
776 </text>
777 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Medications/a:Medication">
778 <entry typeCode="DRIV">
779 <substanceAdministration classCode="SBADM" moodCode="EVN">
780 <templateId root="2.16.840.1.113883.10.20.1.24" assigningAuthorityName="CCD"/>
781 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.7.1" assigningAuthorityName="IHE PCC"/>
782 <!--Medication activity template -->
783 <id>
784 <xsl:attribute name="root">
785 <xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
786 </xsl:attribute>
787 </id>
788 <statusCode>
789 <xsl:attribute name="value">
790 <xsl:value-of select="a:Status/a:Text"/>
791 </xsl:attribute>
792 </statusCode>
793 <xsl:call-template name="ccdDateTime">
794 <xsl:with-param name="dt" select="a:DateTime"/>
795 <xsl:with-param name="type" select="'IVL_TS'"/>
796 </xsl:call-template>
797 <xsl:call-template name="ccdMedicationFrequency">
798 <xsl:with-param name="frequency" select="a:Directions/a:Direction/a:Frequency"/>
799 </xsl:call-template>
800 <xsl:if test="a:Directions/a:Direction/a:Route">
801 <routeCode>
802 <xsl:attribute name="code">
803 <xsl:value-of select="a:Directions/a:Direction/a:Route/a:Code/a:Value"></xsl:value-of>
804 </xsl:attribute>
805 <xsl:attribute name="codeSystem">
806 <xsl:call-template name="HL7OIDLookup">
807 <xsl:with-param name="name" select="a:Directions/a:Direction/a:Route/a:Code/a:CodingSystem"/>
808 </xsl:call-template>
809 </xsl:attribute>
810 <xsl:attribute name="displayName">
811 <xsl:value-of select="a:Directions/a:Direction/a:Route/a:Text"></xsl:value-of>
812 </xsl:attribute>
813 </routeCode>
814 </xsl:if>
815 <xsl:if test="a:Directions/a:Direction/a:Dose">
816 <doseQuantity>
817 <low>
818 <xsl:attribute name="value">
819 <xsl:value-of select="a:Directions/a:Direction/a:Dose/a:Value"></xsl:value-of>
820 </xsl:attribute>
821 <xsl:attribute name="unit">
822 <xsl:value-of select="a:Directions/a:Direction/a:Dose/a:Unit"></xsl:value-of>
823 </xsl:attribute>
824 </low>
825 <high>
826 <xsl:attribute name="value">
827 <xsl:value-of select="a:Directions/a:Direction/a:Dose/a:Value"></xsl:value-of>
828 </xsl:attribute>
829 <xsl:attribute name="unit">
830 <xsl:value-of select="a:Directions/a:Direction/a:Dose/a:Unit"></xsl:value-of>
831 </xsl:attribute>
832 </high>
833 </doseQuantity>
834 </xsl:if>
835 <consumable>
836 <manufacturedProduct>
837 <templateId root="2.16.840.1.113883.3.88.11.83.8.2" assigningAuthorityName="HITSP C83"/>
838 <templateId root="2.16.840.1.113883.10.20.1.53" assigningAuthorityName="CCD"/>
839 <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.7.2" assigningAuthorityName="IHE PCC"/>
840 <!-- Product template -->
841 <manufacturedMaterial>
842 <code>
843 <xsl:attribute name="code">
844 <xsl:value-of select="a:Product/a:ProductName/a:Code/a:Value"></xsl:value-of>
845 </xsl:attribute>
846 <xsl:attribute name="codeSystem">
847 <xsl:call-template name="HL7OIDLookup">
848 <xsl:with-param name="name" select="a:Product/a:ProductName/a:Code/a:CodingSystem"/>
849 </xsl:call-template>
850 </xsl:attribute>
851 <xsl:attribute name="displayName">
852 <xsl:value-of select="a:Product/a:ProductName/a:Text"></xsl:value-of>
853 </xsl:attribute>
854 </code>
855 <name>
856 <xsl:value-of select="a:Product/a:BrandName/a:Text"></xsl:value-of>
857 </name>
858 </manufacturedMaterial>
859 </manufacturedProduct>
860 </consumable>
861 </substanceAdministration>
862 </entry>
863 </xsl:for-each>
864 </section>
865 </component>
866 </xsl:if>
867 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Immunizations">
868 <component>
869 <section>
870 <templateId root="2.16.840.1.113883.10.20.1.6"/>
871 <code code="11369-6" codeSystem="2.16.840.1.113883.6.1"/>
872 <title>Immunizations</title>
873 <text>
874 <table>
875 <tbody>
876 <tr>
877 <th>Code</th>
878 <th>Vaccine</th>
879 <th>Date</th>
880 <th>Route</th>
881 <th>Site</th>
882 <th>Source</th>
883 </tr>
884 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Immunizations/a:Immunization">
885 <tr>
886 <td>
887 <xsl:apply-templates select="a:Product/a:ProductName/a:Code"/>
888 </td>
889 <td>
890
891 <xsl:value-of select="a:Product/a:ProductName/a:Text"/>
892 <xsl:if test="a:Product/a:Form">
893 <xsl:text xml:space="preserve"> </xsl:text>(<xsl:value-of select="a:Product/a:Form/a:Text"/>)
894 </xsl:if>
895 </td>
896 <td>
897 <xsl:call-template name="date:format-date">
898 <xsl:with-param name="date-time">
899 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
900 </xsl:with-param>
901 </xsl:call-template>
902 </td>
903 <td>
904 <xsl:value-of select="a:Directions/a:Direction/a:Route/a:Text"/>
905 </td>
906 <td>
907 <xsl:value-of select="a:Directions/a:Direction/a:Site/a:Text"/>
908 </td>
909 <td>
910 <xsl:call-template name="actorName">
911 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
912 </xsl:call-template>
913 </td>
914 </tr>
915 </xsl:for-each>
916 </tbody>
917 </table>
918 </text>
919 </section>
920 </component>
921 </xsl:if>
922 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:VitalSigns">
923 <component>
924 <section>
925 <templateId root="2.16.840.1.113883.10.20.1.16"/>
926 <code code="8716-3" codeSystem="2.16.840.1.113883.6.1"/>
927 <title>Vital Signs</title>
928 <text>
929 <table>
930 <tbody>
931 <tr>
932 <th>Vital Sign</th>
933 <th>Date</th>
934 <th>Result</th>
935 <th>Source</th>
936 </tr>
937 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:VitalSigns/a:Result">
938 <tr>
939 <td>
940 <xsl:value-of select="a:Description/a:Text"/>
941 </td>
942 <td>
943 <xsl:call-template name="date:format-date">
944 <xsl:with-param name="date-time">
945 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
946 </xsl:with-param>
947 </xsl:call-template>
948 </td>
949 <td>
950 <xsl:for-each select="a:Test">
951 <xsl:value-of select="a:Description/a:Text"/>
952 <xsl:text xml:space="preserve"> </xsl:text>
953 <xsl:value-of select="a:TestResult/a:Value"/>
954 <xsl:text xml:space="preserve"> </xsl:text>
955 <xsl:value-of select="a:TestResult/a:Units/a:Unit"/>
956 <xsl:text xml:space="preserve"> </xsl:text>
957 <xsl:value-of select="a:Flag/a:Text"/>
958 <br/>
959 </xsl:for-each>
960 </td>
961 <td>
962 <xsl:call-template name="actorName">
963 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
964 </xsl:call-template>
965 </td>
966 </tr>
967 </xsl:for-each>
968 </tbody>
969 </table>
970 </text>
971 </section>
972 </component>
973 </xsl:if>
974 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Encounters">
975 <component>
976 <section>
977 <templateId root="2.16.840.1.113883.10.20.1.3"/>
978 <code code="46240-8" codeSystem="2.16.840.1.113883.6.1"/>
979 <title>Encounters</title>
980 <text>
981 <table>
982 <tbody>
983 <tr>
984 <th>Type</th>
985 <th>Date</th>
986 <th>Location</th>
987 <th>Status</th>
988 <th>Practitioner</th>
989 <th>Description</th>
990 <th>Indications</th>
991 <th>Source</th>
992 </tr>
993 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Encounters/a:Encounter">
994 <tr>
995 <td>
996 <xsl:value-of select="a:Type/a:Text"/>
997 </td>
998 <td>
999 <xsl:call-template name="date:format-date">
1000 <xsl:with-param name="date-time">
1001 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
1002 </xsl:with-param>
1003 </xsl:call-template>
1004 </td>
1005 <td>
1006 <xsl:for-each select="a:Locations/a:Location">
1007 <xsl:value-of select="a:Description/a:Text"/>
1008 <xsl:call-template name="actorName">
1009 <xsl:with-param name="objID" select="a:Actor/a:ActorID"/>
1010 </xsl:call-template>
1011 <br/>
1012 </xsl:for-each>
1013 </td>
1014 <td>
1015 <xsl:value-of select="a:Status/a:Text"/>
1016 </td>
1017 <td>
1018 <xsl:for-each select="a:Practitioners/a:Practitioner">
1019 <xsl:call-template name="actorName">
1020 <xsl:with-param name="objID" select="a:ActorID"/>
1021 </xsl:call-template>
1022 <br/>
1023 </xsl:for-each>
1024 </td>
1025 <td>
1026 <xsl:value-of select="a:Description/a:Text"/>
1027 </td>
1028 <td>
1029 <xsl:for-each select="a:Indications/a:Indication">
1030 <xsl:call-template name="problemDescription">
1031 <xsl:with-param name="objID" select="a:InternalCCRLink/a:LinkID"/>
1032 </xsl:call-template>
1033 <br/>
1034 </xsl:for-each>
1035 </td>
1036 <td>
1037 <xsl:call-template name="actorName">
1038 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1039 </xsl:call-template>
1040 </td>
1041 </tr>
1042 </xsl:for-each>
1043 </tbody>
1044 </table>
1045 </text>
1046 </section>
1047 </component>
1048 </xsl:if>
1049 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:SocialHistory">
1050 <component>
1051 <section>
1052 <templateId root="2.16.840.1.113883.10.20.1.15"/>
1053 <code code="29762-2" codeSystem="2.16.840.1.113883.6.1"/>
1054 <title>Social History</title>
1055 <text>
1056 <table>
1057 <tbody>
1058 <tr>
1059 <th>Type</th>
1060 <th>Date</th>
1061 <th>Code</th>
1062 <th>Description</th>
1063 <th>Status</th>
1064 <th>Source</th>
1065 </tr>
1066 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:SocialHistory/a:SocialHistoryElement">
1067 <tr>
1068 <td>
1069 <xsl:value-of select="a:Type/a:Text"/>
1070 </td>
1071 <td>
1072 <xsl:call-template name="date:format-date">
1073 <xsl:with-param name="date-time">
1074 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
1075 </xsl:with-param>
1076 </xsl:call-template>
1077 </td>
1078 <td>
1079 <xsl:apply-templates select="a:Description/a:Code"/>
1080 </td>
1081 <td>
1082 <xsl:value-of select="a:Description/a:Text" disable-output-escaping="yes"/>
1083 </td>
1084 <td>
1085 <xsl:value-of select="a:Status/a:Text"/>
1086 </td>
1087 <td>
1088 <xsl:call-template name="actorName">
1089 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1090 </xsl:call-template>
1091 </td>
1092 </tr>
1093 </xsl:for-each>
1094 </tbody>
1095 </table>
1096 </text>
1097 </section>
1098 </component>
1099 </xsl:if>
1100 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:FamilyHistory">
1101 <component>
1102 <section>
1103 <templateId root="2.16.840.1.113883.10.20.1.4"/>
1104 <code code="10157-6" codeSystem="2.16.840.1.113883.6.1"/>
1105 <title>Family History</title>
1106 <text>
1107 <table>
1108 <tbody>
1109 <tr>
1110 <th>Type</th>
1111 <th>Date</th>
1112 <th>Code</th>
1113 <th>Description</th>
1114 <th>Relationship(s)</th>
1115 <th>Status</th>
1116 <th>Source</th>
1117 </tr>
1118 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:FamilyHistory/a:FamilyProblemHistory">
1119 <tr>
1120 <td>
1121 <xsl:value-of select="a:Type/a:Text"/>
1122 </td>
1123 <td>
1124 <xsl:call-template name="date:format-date">
1125 <xsl:with-param name="date-time">
1126 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
1127 </xsl:with-param>
1128 </xsl:call-template>
1129 </td>
1130 <td>
1131 <xsl:apply-templates select="a:Problem/a:Description/a:Code"/>
1132 </td>
1133 <td>
1134 <xsl:for-each select="a:Problem">
1135 <xsl:value-of select="a:Description/a:Text"/>
1136 <br/>
1137 </xsl:for-each>
1138 </td>
1139 <td>
1140 <xsl:value-of select="a:FamilyMember/a:ActorRole/a:Text"/>
1141 </td>
1142 <td>
1143 <xsl:value-of select="a:Status/a:Text"/>
1144 </td>
1145 <td>
1146 <xsl:call-template name="actorName">
1147 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1148 </xsl:call-template>
1149 </td>
1150 </tr>
1151 </xsl:for-each>
1152 </tbody>
1153 </table>
1154 </text>
1155 </section>
1156 </component>
1157 </xsl:if>
1158 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Results/a:Result">
1159 <component>
1160 <section>
1161 <templateId root="2.16.840.1.113883.10.20.1.14"/>
1162 <code code="30954-2" codeSystem="2.16.840.1.113883.6.1"/>
1163 <title>Results</title>
1164 <text>
1165 <table>
1166 <tbody>
1167 <tr>
1168 <th>Test</th>
1169 <th>Date</th>
1170 <th>Result</th>
1171 <th>Source</th>
1172 </tr>
1173 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Results/a:Result[a:Test/a:TestResult/a:Value!='']">
1174 <tr>
1175 <td>
1176 <xsl:value-of select="a:Description/a:Text"/>
1177 </td>
1178 <td>
1179 <xsl:call-template name="date:format-date">
1180 <xsl:with-param name="date-time">
1181 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
1182 </xsl:with-param>
1183 </xsl:call-template>
1184 </td>
1185 <td>
1186 <xsl:for-each select="a:Test[a:TestResult/a:Value!='']">
1187 <xsl:value-of select="a:Description/a:Text"/>
1188 <xsl:text xml:space="preserve"> </xsl:text>
1189 <xsl:value-of select="a:TestResult/a:Value"/>
1190 <xsl:text xml:space="preserve"> </xsl:text>
1191 <xsl:value-of select="a:TestResult/a:Units/a:Unit"/>
1192 <xsl:text xml:space="preserve"> </xsl:text>
1193 <xsl:value-of select="a:Flag/a:Text"/>
1194 <br/>
1195 </xsl:for-each>
1196 <xsl:for-each select="a:Test[a:TestResult/a:Description/a:Text!='']">
1197 <xsl:value-of select="a:Description/a:Text"/>
1198 <xsl:text xml:space="preserve"> </xsl:text>
1199 <xsl:value-of select="a:TestResult/a:Description/a:Text" disable-output-escaping="yes"/>
1200 <xsl:text xml:space="preserve"> </xsl:text>
1201 <xsl:value-of select="a:Flag/a:Text"/>
1202 <br/>
1203 </xsl:for-each>
1204 </td>
1205 <td>
1206 <xsl:call-template name="actorName">
1207 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1208 </xsl:call-template>
1209 </td>
1210 </tr>
1211 </xsl:for-each>
1212 </tbody>
1213 </table>
1214 </text>
1215 </section>
1216 </component>
1217 </xsl:if>
1218 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Payers">
1219 <component>
1220 <section>
1221 <templateId root="2.16.840.1.113883.10.20.1.9"/>
1222 <code code="48768-6" codeSystem="2.16.840.1.113883.6.1"/>
1223 <title>Insurance</title>
1224 <text>
1225 <table>
1226 <tbody>
1227 <tr>
1228 <th>Type</th>
1229 <th>Date</th>
1230 <th>Identification Numbers</th>
1231 <th>Payment Provider</th>
1232 <th>Subscriber</th>
1233 <th>Source</th>
1234 </tr>
1235 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Payers/a:Payer">
1236 <tr>
1237 <td>
1238 <xsl:value-of select="a:Type/a:Text"/>
1239 </td>
1240 <td>
1241 <xsl:call-template name="date:format-date">
1242 <xsl:with-param name="date-time">
1243 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
1244 </xsl:with-param>
1245 </xsl:call-template>
1246 </td>
1247 <td>
1248 <xsl:for-each select="a:IDs">
1249 <xsl:value-of select="a:Type/a:Text"/>:<xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="a:ID"/><br/>
1250 </xsl:for-each>
1251 </td>
1252 <td>
1253 <xsl:call-template name="actorName">
1254 <xsl:with-param name="objID" select="a:PaymentProvider/a:ActorID"/>
1255 </xsl:call-template>
1256 </td>
1257 <td>
1258 <xsl:call-template name="actorName">
1259 <xsl:with-param name="objID" select="a:Subscriber/a:ActorID"/>
1260 </xsl:call-template>
1261 </td>
1262 <td>
1263 <xsl:call-template name="actorName">
1264 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1265 </xsl:call-template>
1266 </td>
1267 </tr>
1268 </xsl:for-each>
1269 </tbody>
1270 </table>
1271 </text>
1272 </section>
1273 </component>
1274 </xsl:if>
1275 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:PlanOfCare">
1276 <component>
1277 <section>
1278 <templateId root="2.16.840.1.113883.10.20.1.10"/>
1279 <code code="18776-5" codeSystem="2.16.840.1.113883.6.1"/>
1280 <title>Plan Of Care</title>
1281 <text>
1282 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:PlanOfCare/a:Plan[a:Type/a:Text='Treatment Recommendation']">
1283 <xsl:text>Plan Of Care Recommendations</xsl:text>
1284 <br/>
1285 <table>
1286 <tbody>
1287 <tr>
1288 <th>Description</th>
1289 <th>Recommendation</th>
1290 <th>Goal</th>
1291 <th>Status</th>
1292 <th>Source</th>
1293 </tr>
1294 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:PlanOfCare/a:Plan[a:Type/a:Text='Treatment Recommendation']">
1295 <tr>
1296 <td>
1297 <xsl:value-of select="a:Description/a:Text"/>
1298 </td>
1299 <td>
1300 <xsl:value-of select="a:OrderRequest/a:Description/a:Text" disable-output-escaping="yes"/>
1301 </td>
1302 <td>
1303 <xsl:value-of select="a:OrderRequest/a:Goals/a:Goal/a:Description/a:Text" disable-output-escaping="yes"/>
1304 </td>
1305 <td>
1306 <xsl:value-of select="a:Status/a:Text"/>
1307 </td>
1308 <td>
1309 <xsl:call-template name="actorName">
1310 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1311 </xsl:call-template>
1312 </td>
1313 </tr>
1314 </xsl:for-each>
1315 </tbody>
1316 </table>
1317 </xsl:if>
1318 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:PlanOfCare/a:Plan[a:Type/a:Text='Order']">
1319 <xsl:text>Plan Of Care Orders</xsl:text>
1320 <br/>
1321 <table>
1322 <tbody>
1323 <tr>
1324 <th>Descripion</th>
1325 <th>Plan Status</th>
1326 <th>Type</th>
1327 <th>Date</th>
1328 <th>Procedure</th>
1329 <th>Schedule</th>
1330 <th>Location</th>
1331 <th>Substance</th>
1332 <th>Method</th>
1333 <th>Position</th>
1334 <th>Site</th>
1335 <th>Status</th>
1336 <th>Source</th>
1337 </tr>
1338 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:PlanOfCare/a:Plan[a:Type/a:Text='Order']">
1339 <tr>
1340 <td>
1341 <xsl:apply-templates select="a:Description/a:Text"/>
1342 </td>
1343 <td>
1344 <xsl:value-of select="a:Status/a:Text"/>
1345 </td>
1346 <td>
1347 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Type/a:Text"/>
1348 </td>
1349 <td>
1350 <xsl:call-template name="date:format-date">
1351 <xsl:with-param name="date-time">
1352 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:DateTime/a:ExactDateTime"/>
1353 </xsl:with-param>
1354 </xsl:call-template>
1355 </td>
1356 <td>
1357 <xsl:apply-templates select="a:OrderRequest/a:Procedures/a:Procedure/a:Description/a:Text"/>
1358 </td>
1359 <td>
1360 <xsl:text xml:space="preserve">Every </xsl:text>
1361 <xsl:apply-templates select="a:OrderRequest/a:Procedures/a:Procedure/a:Interval/a:Value"/>
1362 <xsl:text xml:space="preserve"> </xsl:text>
1363 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Interval/a:Units/a:Unit"/>
1364 <xsl:text xml:space="preserve"> for </xsl:text>
1365 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Duration/a:Value"/>
1366 <xsl:text xml:space="preserve"> </xsl:text>
1367 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Duration/a:Units/a:Unit"/>
1368 </td>
1369 <td>
1370 <xsl:for-each select="a:OrderRequest/a:Procedures/a:Procedure/a:Locations">
1371 <xsl:value-of select="a:Location/a:Description/a:Text"/>
1372 <xsl:if test="position() != last()">
1373 <br/>
1374 </xsl:if>
1375 </xsl:for-each>
1376 </td>
1377 <td>
1378 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Substance/a:Text"/>
1379 </td>
1380 <td>
1381 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Method/a:Text"/>
1382 </td>
1383 <td>
1384 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Position/a:Text"/>
1385 </td>
1386 <td>
1387 <xsl:value-of select="a:OrderRequest/a:Procedures/a:Procedure/a:Site/a:Text"/>
1388 </td>
1389 <td/>
1390 <td>
1391 <xsl:call-template name="actorName">
1392 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1393 </xsl:call-template>
1394 </td>
1395 </tr>
1396 </xsl:for-each>
1397 </tbody>
1398 </table>
1399 </xsl:if>
1400 </text>
1401 </section>
1402 </component>
1403 </xsl:if>
1404 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:HealthCareProviders">
1405 <component>
1406 <section>
1407 <title>Health Care Providers</title>
1408 <text>
1409 <table>
1410 <tbody>
1411 <tr>
1412 <th>Role</th>
1413 <th>Name</th>
1414 </tr>
1415 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:HealthCareProviders/a:Provider">
1416 <tr>
1417 <td>
1418 <xsl:value-of select="a:ActorRole/a:Text"/>
1419 </td>
1420 <td>
1421 <xsl:call-template name="actorName">
1422 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1423 </xsl:call-template>
1424 </td>
1425 </tr>
1426 </xsl:for-each>
1427 </tbody>
1428 </table>
1429 </text>
1430 </section>
1431 </component>
1432 </xsl:if>
1433 <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:SupportProviders">
1434 <component>
1435 <section>
1436 <title>Support Providers</title>
1437 <text>
1438 <table>
1439 <tbody>
1440 <tr>
1441 <th>Role</th>
1442 <th>Name</th>
1443 </tr>
1444 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Support/a:SupportProvider">
1445 <tr>
1446 <td>
1447 <xsl:value-of select="a:ActorRole/a:Text"/>
1448 </td>
1449 <td>
1450 <xsl:call-template name="actorName">
1451 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1452 </xsl:call-template>
1453 </td>
1454 </tr>
1455 </xsl:for-each>
1456 </tbody>
1457 </table>
1458 </text>
1459 </section>
1460 </component>
1461 </xsl:if>
1462 <xsl:if test="a:ContinuityOfCareRecord/a:References">
1463 <component>
1464 <section>
1465 <title>References</title>
1466 <text>
1467 <table>
1468 <tbody>
1469 <tr>
1470 <th>Type</th>
1471 <th>Date</th>
1472 <th>Description</th>
1473 <th>Location</th>
1474 <th>Source</th>
1475 </tr>
1476 <xsl:for-each select="/a:ContinuityOfCareRecord/a:References/a:Reference">
1477 <tr>
1478 <td>
1479 <xsl:value-of select="a:Type/a:Text"/>
1480 </td>
1481 <td>
1482 <xsl:call-template name="date:format-date">
1483 <xsl:with-param name="date-time">
1484 <xsl:value-of select="a:DateTime/a:ExactDateTime"/>
1485 </xsl:with-param>
1486 </xsl:call-template>
1487 </td>
1488 <td>
1489 <strong class="clinical">
1490 <xsl:value-of select="a:Description/a:Text"/>
1491 </strong>
1492 </td>
1493 <td>
1494 <xsl:value-of select="a:Locations/a:Location/a:Description/a:Text"/>
1495 </td>
1496 <td>
1497 <xsl:call-template name="actorName">
1498 <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
1499 </xsl:call-template>
1500 </td>
1501 </tr>
1502 </xsl:for-each>
1503 </tbody>
1504 </table>
1505 </text>
1506 </section>
1507 </component>
1508 </xsl:if>
1509 <component>
1510 <section>
1511 <title>Additional Information About People &amp; Organizations</title>
1512 <text>
1513 <xsl:if test="a:ContinuityOfCareRecord/a:Actors/a:Actor[a:Person]">
1514 <table>
1515 <tbody>
1516 <tr>
1517 <th>Name</th>
1518 <th>Specialty</th>
1519 <th>Relation</th>
1520 <th>Identification Numbers</th>
1521 <th>Phone</th>
1522 <th>Address/ E-mail</th>
1523 </tr>
1524 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor">
1525 <xsl:sort select="a:Person/a:Name/a:DisplayName|a:Person/a:Name/a:CurrentName/a:Family" data-type="text" order="ascending"/>
1526 <xsl:if test="a:Person">
1527 <tr>
1528 <td>
1529 <xsl:call-template name="actorName">
1530 <xsl:with-param name="objID" select="a:ActorObjectID"/>
1531 </xsl:call-template>
1532 </td>
1533 <td>
1534 <xsl:value-of select="a:Specialty/a:Text"/>
1535 </td>
1536 <td>
1537 <xsl:value-of select="a:Relation/a:Text"/>
1538 </td>
1539 <td>
1540 <xsl:for-each select="a:IDs">
1541 <xsl:value-of select="a:Type/a:Text"/>
1542 <xsl:text>: </xsl:text>
1543 <xsl:value-of select="a:ID"/>
1544 </xsl:for-each>
1545 </td>
1546 <td>
1547 <xsl:for-each select="a:Telephone">
1548 <xsl:value-of select="a:Type/a:Text"/>
1549 <xsl:text>: </xsl:text>
1550 <xsl:value-of select="a:Value"/>
1551 </xsl:for-each>
1552 </td>
1553 <td>
1554 <xsl:for-each select="a:Address">
1555 <xsl:if test="a:Type">
1556 <xsl:value-of select="a:Type/a:Text"/>
1557 <xsl:text>:</xsl:text>
1558 <br/>
1559 </xsl:if>
1560 <xsl:if test="a:Line1">
1561 <xsl:value-of select="a:Line1"/>
1562 <br/>
1563 </xsl:if>
1564 <xsl:if test="a:Line2">
1565 <xsl:value-of select="a:Line2"/>
1566 <br/>
1567 </xsl:if>
1568 <xsl:if test="a:City">
1569 <xsl:value-of select="a:City"/>
1570 <xsl:text>, </xsl:text>
1571 </xsl:if>
1572 <xsl:value-of select="a:State"/>
1573 <xsl:value-of select="a:PostalCode"/>
1574 <br/>
1575 </xsl:for-each>
1576 <xsl:for-each select="a:EMail">
1577 <br/>
1578 <xsl:value-of select="a:Value"/>
1579 </xsl:for-each>
1580 </td>
1581 </tr>
1582 </xsl:if>
1583 </xsl:for-each>
1584 </tbody>
1585 </table>
1586 </xsl:if>
1587 <xsl:if test="a:ContinuityOfCareRecord/a:Actors/a:Actor[a:Organization]">
1588 <table>
1589 <tbody>
1590 <tr>
1591 <th>Name</th>
1592 <th>Specialty</th>
1593 <th>Relation</th>
1594 <th>Identification Numbers</th>
1595 <th>Phone</th>
1596 <th>Address/ E-mail</th>
1597 </tr>
1598 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor">
1599 <xsl:sort select="a:Organization/a:Name" data-type="text" order="ascending"/>
1600 <xsl:if test="a:Organization">
1601 <tr>
1602 <td>
1603 <xsl:value-of select="a:Organization/a:Name"/>
1604 </td>
1605 <td>
1606 <xsl:value-of select="a:Specialty/a:Text"/>
1607 </td>
1608 <td>
1609 <xsl:value-of select="a:Relation/a:Text"/>
1610 </td>
1611 <td>
1612 <xsl:for-each select="a:IDs">
1613 <xsl:value-of select="a:Type/a:Text"/>
1614 <xsl:text>: </xsl:text>
1615 <xsl:value-of select="a:ID"/>
1616 </xsl:for-each>
1617 </td>
1618 <td>
1619 <xsl:for-each select="a:Telephone">
1620 <xsl:value-of select="a:Type/a:Text"/>
1621 <xsl:text>: </xsl:text>
1622 <xsl:value-of select="a:Value"/>
1623 </xsl:for-each>
1624 </td>
1625 <td>
1626 <xsl:for-each select="a:Address">
1627 <xsl:if test="a:Type">
1628 <xsl:value-of select="a:Type/a:Text"/>
1629 <xsl:text>:</xsl:text>
1630 <br/>
1631 </xsl:if>
1632 <xsl:if test="a:Line1">
1633 <xsl:value-of select="a:Line1"/>
1634 <br/>
1635 </xsl:if>
1636 <xsl:if test="a:Line2">
1637 <xsl:value-of select="a:Line2"/>
1638 <br/>
1639 </xsl:if>
1640 <xsl:if test="a:City">
1641 <xsl:value-of select="a:City"/>
1642 <xsl:text>, </xsl:text>
1643 </xsl:if>
1644 <xsl:value-of select="a:State"/>
1645 <xsl:value-of select="a:PostalCode"/>
1646 <br/>
1647 </xsl:for-each>
1648 <xsl:for-each select="a:EMail">
1649 <br/>
1650 <xsl:value-of select="a:Value"/>
1651 </xsl:for-each>
1652 </td>
1653 </tr>
1654 </xsl:if>
1655 </xsl:for-each>
1656 </tbody>
1657 </table>
1658 </xsl:if>
1659 <xsl:if test="a:ContinuityOfCareRecord/a:Actors/a:Actor[a:InformationSystem]">
1660 <table>
1661 <tbody>
1662 <tr>
1663 <th>Name</th>
1664 <th>Type</th>
1665 <th>Version</th>
1666 <th>Identification Numbers</th>
1667 <th>Phone</th>
1668 <th>Address/ E-mail</th>
1669 </tr>
1670 <xsl:for-each select="/a:ContinuityOfCareRecord/a:Actors/a:Actor">
1671 <xsl:sort select="a:InformationSystem/a:Name" data-type="text" order="ascending"/>
1672 <xsl:if test="a:InformationSystem">
1673 <tr>
1674 <td>
1675 <xsl:value-of select="a:InformationSystem/a:Name"/>
1676 </td>
1677 <td>
1678 <xsl:value-of select="a:InformationSystem/a:Type"/>
1679 </td>
1680 <td>
1681 <xsl:value-of select="a:InformationSystem/a:Version"/>
1682 </td>
1683 <td>
1684 <xsl:for-each select="a:IDs">
1685 <xsl:value-of select="a:Type/a:Text"/>
1686 <xsl:text>: </xsl:text>
1687 <xsl:value-of select="a:ID"/>
1688 </xsl:for-each>
1689 </td>
1690 <td>
1691 <xsl:for-each select="a:Telephone">
1692 <xsl:value-of select="a:Type/a:Text"/>
1693 <xsl:text>: </xsl:text>
1694 <xsl:value-of select="a:Value"/>
1695 </xsl:for-each>
1696 </td>
1697 <td>
1698 <xsl:for-each select="a:Address">
1699 <xsl:if test="Type">
1700 <xsl:value-of select="a:Type/a:Text"/>
1701 <xsl:text>:</xsl:text>
1702 <br/>
1703 </xsl:if>
1704 <xsl:if test="a:Line1">
1705 <xsl:value-of select="a:Line1"/>
1706 <br/>
1707 </xsl:if>
1708 <xsl:if test="a:Line2">
1709 <xsl:value-of select="a:Line2"/>
1710 <br/>
1711 </xsl:if>
1712 <xsl:if test="a:City">
1713 <xsl:value-of select="a:City"/>
1714 <xsl:text>, </xsl:text>
1715 </xsl:if>
1716 <xsl:value-of select="a:State"/>
1717 <xsl:value-of select="a:PostalCode"/>
1718 <br/>
1719 </xsl:for-each>
1720 <xsl:for-each select="a:EMail">
1721 <br/>
1722 <xsl:value-of select="a:Value"/>
1723 </xsl:for-each>
1724 </td>
1725 </tr>
1726 </xsl:if>
1727 </xsl:for-each>
1728 </tbody>
1729 </table>
1730 </xsl:if>
1731 </text>
1732 </section>
1733 </component>
1734 </structuredBody>
1735 </component>
1736 </ClinicalDocument>
1737 </xsl:template>
1738</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.