-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEST CASE CREATOR.xsl
704 lines (696 loc) · 34.8 KB
/
TEST CASE CREATOR.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:cda="urn:hl7-org:v3" xmlns:sdtc="urn:hl7-org:sdtc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<ClinicalDocument xmlns:sdtc="urn:hl7-org:sdtc" xmlns:cda="urn:hl7-org:v3" xmlns="urn:hl7-org:v3" xmlns:voc="http://www.lantanagroup.com/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<realmCode code="US"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040">
<!--[C-CDA R1.1] US Realm Header-->
</typeId>
<templateId root="2.16.840.1.113883.10.20.22.1.1">
<!-- [C-CDA R2.1] US Realm Header (V3) -->
</templateId>
<templateId root="2.16.840.1.113883.10.20.22.1.1" extension="2015-08-01">
<!--[eICR R2 STU1.1] Initial Public Health Case Report Document (eICR) (V2) -->
</templateId>
<templateId root="2.16.840.1.113883.10.20.15.2" extension="2016-12-01"/>
<id root="e32f8595-0cc0-402f-913d-ebb8190f5731">
<!--Globally unique document ID (extension) is scoped by vendor/software-->
</id>
<code code="55751-2" displayName="Public Health Case Report" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC">
<!--Document Code-->
</code>
<title>Initial Public Health Case Report</title>
<effectiveTime value="{/data/effectiveTime/effectiveTimeWithTime/@value}"/>
<confidentialityCode code="N" displayName="Normal" codeSystem="2.16.840.1.113883.5.25"/>
<languageCode code="en-US"/>
<recordTarget>
<!--******************************************************** recordTarget: The patient ********************************************************-->
<patientRole>
<id extension="PT-471325" root="2.16.840.1.113883.19.5">
<!--Patient ID-->
</id>
<!--
********************************************************
TO CUSTOMIZE eICR FOR YOUR JURISDICTION, EDIT PATIENT ADDRESS FIELDS BELOW
Fields currently populated with example address information from HL7 eICR 1.1 samples.
********************************************************
-->
<addr use="H">
<streetAddressLine>
<xsl:value-of select="/data/patient/streetAddressLine/@value"/>
</streetAddressLine>
<city>
<xsl:value-of select="/data/patient/city/@value"/>
</city>
<state>
<xsl:value-of select="/data/patient/state/@value"/>
</state>
<postalCode>
<xsl:value-of select="/data/patient/postalCode/@value"/>
</postalCode>
<county>
<xsl:value-of select="/data/patient/county/@value"/>
</county>
<country>
<xsl:value-of select="/data/patient/country/@value"/>
</country>
</addr>
<!--
********************************************************
TO CUSTOMIZE eICR FOR YOUR JURISDICTION, EDIT PATIENT ADDRESS FIELDS ABOVE
Fields currently populated with example address information from HL7 eICR 1.1 samples.
********************************************************
-->
<telecom use="HP" value="{/data/patient/telecomHP/@value}"/>
<telecom use="HP" value="{/data/patient/telecomMail/@value}"/>
<patient>
<name use="L">
<given>
<xsl:value-of select="/data/patient/given/@value"/>
</given>
<family>
<xsl:value-of select="/data/patient/family/@value"/>
</family>
</name>
<administrativeGenderCode code="{/data/patient/adminGenderCode/@code}" codeSystem="2.16.840.1.113883.5.1" displayName="{/data/patient/adminGenderCode/@displayName}"/>
<birthTime value="{/data/patient/DOB/@value}"/>
<sdtc:deceasedInd value="{/data/patient/deceasedInd/@value}"/>
<xsl:if test="/data/patient/deceasedInd/@value = 'true'">
<sdtc:deceasedTime value="{/data/patient/deceasedTime/@value}"/>
</xsl:if>
<raceCode code="{/data/patient/raceCode/@code}" displayName="{/data/patient/raceCode/@displayName}" codeSystem="2.16.840.1.113883.6.238" codeSystemName="Race & Ethnicity - CDC"/>
<xsl:if test="not(/data/patient/sdtcRaceCode/@code = '')">
<sdtc:raceCode code="{/data/patient/sdtcRaceCode/@code}" displayName="{/data/patient/sdtcRaceCode/@displayName}" codeSystem="2.16.840.1.113883.6.238" codeSystemName="Race & Ethnicity - CDC"/>
</xsl:if>
<ethnicGroupCode code="{/data/patient/ethnicGroupCode/@code}" displayName="{/data/patient/ethnicGroupCode/@displayName}" codeSystem="2.16.840.1.113883.6.238" codeSystemName="Race & Ethnicity - CDC"/>
<xsl:if test="not(/data/patient/sdtcEthnicGroupCode/@code = '')">
<sdtc:ethnicGroupCode code="{/data/patient/sdtcEthnicGroupCode/@code}" displayName="{/data/patient/sdtcEthnicGroupCode/@displayName}" codeSystem="2.16.840.1.113883.6.238" codeSystemName="Race & Ethnicity - CDC"/>
</xsl:if>
<languageCommunication>
<languageCode code="en"/>
<preferenceInd value="true"/>
</languageCommunication>
</patient>
</patientRole>
</recordTarget>
<author>
<!--Author/authenticator may be software or may be a provider such as "infection control professional"-->
<time value="{/data/effectiveTime/effectiveTimeWithTime/@value}"/>
<assignedAuthor>
<id root="2.16.840.1.113883.3.72.5.20"/>
<!--Example address from HL7 eICR 1.1 samples - not used by RCKMS -->
<addr use="WP">
<streetAddressLine>
<xsl:value-of select="/data/author/streetAddressLine/@value"/>
</streetAddressLine>
<city>
<xsl:value-of select="/data/author/city/@value"/>
</city>
<state>
<xsl:value-of select="/data/author/state/@value"/>
</state>
<postalCode>
<xsl:value-of select="/data/author/postalCode/@value"/>
</postalCode>
<county>
<xsl:value-of select="/data/author/county/@value"/>
</county>
<country>
<xsl:value-of select="/data/author/country/@value"/>
</country>
</addr>
<telecom use="WP" value="{/data/author/telecomHP/@value}"/>
<telecom use="WP" value="{/data/author/telecomFax/@value}"/>
<assignedAuthoringDevice>
<manufacturerModelName displayName="TBD Device"/>
<softwareName/>
</assignedAuthoringDevice>
</assignedAuthor>
</author>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id extension="TBDFacility#" root="2.16.840.1.113883.4.6">
<!--Custodian ID-->
</id>
<name>
<xsl:value-of select="/data/custodian/name/@value"/>
</name>
<telecom use="WP" value="{/data/custodian/telecomHP/@value}"/>
<!--Example address from HL7 eICR 1.1 samples - not used by RCKMS -->
<addr>
<streetAddressLine>
<xsl:value-of select="/data/custodian/streetAddressLine/@value"/>
</streetAddressLine>
<city>
<xsl:value-of select="/data/custodian/city/@value"/>
</city>
<state>
<xsl:value-of select="/data/custodian/state/@value"/>
</state>
<postalCode>
<xsl:value-of select="/data/custodian/postalCode/@value"/>
</postalCode>
<country>
<xsl:value-of select="/data/custodian/country/@value"/>
</country>
</addr>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<!--******************************************************** componentOf: contains the encompassingEncouter and the provider and facility infomation for the case ********************************************************-->
<componentOf>
<encompassingEncounter>
<id extension="9937012" root="2.16.840.1.113883.19">
<!--encounter ID-->
</id>
<code code="{/data/encounter/code/@value}" displayName="{/data/encounter/code/@displayName}" codeSystem="{/data/encounter/code/@codeSystem}"/>
<effectiveTime>
<low value="{/data/encounter/effectiveTimeLow/@value}"/>
<xsl:if test="not(/data/encounter/effectiveTimeHigh/@value = '')">
<high value="{/data/encounter/effectiveTimeHigh/@value}"/>
</xsl:if>
</effectiveTime>
<responsibleParty>
<assignedEntity>
<id root="2.16.840.1.113883.4.6" extension="66666666666">
<!--Provider ID-->
</id>
<!--Example address from HL7 eICR 1.1 samples - not used by RCKMS -->
<addr>
<streetAddressLine>
<xsl:value-of select="/data/encounter/streetAddressLine/@value"/>
</streetAddressLine>
<city>
<xsl:value-of select="/data/encounter/city/@value"/>
</city>
<state>
<xsl:value-of select="/data/encounter/state/@value"/>
</state>
<postalCode>
<xsl:value-of select="/data/encounter/postalCode/@value"/>
</postalCode>
<country>
<xsl:value-of select="/data/encounter/country/@value"/>
</country>
</addr>
<telecom use="WP" value="{/data/encounter/telecomHP/@value}"/>
<telecom use="WP" value="{/data/encounter/telecomFax/@value}"/>
<assignedPerson>
<name>
<given>Assigned</given>
<family>Amanda</family>
<suffix/>
</name>
</assignedPerson>
<representedOrganization>
<id extension="TBDFacility#" root="2.16.840.1.113883.4.6">
<!--Represented Organization-->
</id>
<name>
<xsl:value-of select="/data/encounter/name/@value"/>
</name>
<!--Example address from HL7 eICR 1.1 samples - not used by RCKMS -->
<addr>
<streetAddressLine>
<xsl:value-of select="/data/encounter/streetAddressLine/@value"/>
</streetAddressLine>
<city>
<xsl:value-of select="/data/encounter/city/@value"/>
</city>
<state>
<xsl:value-of select="/data/encounter/state/@value"/>
</state>
<postalCode>
<xsl:value-of select="/data/encounter/postalCode/@value"/>
</postalCode>
<country>
<xsl:value-of select="/data/encounter/country/@value"/>
</country>
</addr>
</representedOrganization>
</assignedEntity>
</responsibleParty>
<location>
<healthCareFacility>
<id extension="2783" root="2.16.840.1.113883.4.6">
<!--Facility ID-->
</id>
<code code="{/data/encounter/codeHCF/@value}" codeSystem="{/data/encounter/codeHCF/@codeSystem}" displayName="{/data/encounter/codeHCF/@displayName}"/>
<!--
********************************************************
TO CUSTOMIZE eICR FOR YOUR JURISDICTION, EDIT FACILITY ADDRESS FIELDS BELOW
Fields currently populated with example address information from HL7 eICR 1.1 samples.
********************************************************
-->
<location>
<addr use="WP">
<streetAddressLine>
<xsl:value-of select="/data/encounter/streetAddressLineHCF/@value"/>
</streetAddressLine>
<city>
<xsl:value-of select="/data/encounter/cityHCF/@value"/>
</city>
<state>
<xsl:value-of select="/data/encounter/stateHCF/@value"/>
</state>
<postalCode>
<xsl:value-of select="/data/encounter/postalCodeHCF/@value"/>
</postalCode>
<country>
<xsl:value-of select="/data/encounter/countryHCF/@value"/>
</country>
</addr>
</location>
<!--
********************************************************
TO CUSTOMIZE eICR FOR YOUR JURISDICTION, EDIT FACILITY ADDRESS FIELDS ABOVE
Fields currently populated with example address information from HL7 eICR 1.1 samples.
********************************************************
-->
<serviceProviderOrganization>
<name>
<xsl:value-of select="/data/encounter/nameHCF/@value"/>
</name>
<telecom use="WP" value="{/data/encounter/telecomHPHCF/@value}"/>
<telecom use="WP" value="{/data/encounter/telecomFaxHCF/@value}"/>
<!--Example address from HL7 eICR 1.1 samples - not used by RCKMS -->
<addr>
<streetAddressLine>
<xsl:value-of select="/data/encounter/streetAddressLineHCF/@value"/>
</streetAddressLine>
<city>
<xsl:value-of select="/data/encounter/cityHCF/@value"/>
</city>
<state>
<xsl:value-of select="/data/encounter/stateHCF/@value"/>
</state>
<postalCode>
<xsl:value-of select="/data/encounter/postalCodeHCF/@value"/>
</postalCode>
<country>
<xsl:value-of select="/data/encounter/countryHCF/@value"/>
</country>
</addr>
</serviceProviderOrganization>
</healthCareFacility>
</location>
</encompassingEncounter>
</componentOf>
<component>
<structuredBody>
<!--******************************************************** Encounters Section ********************************************************-->
<component>
<section>
<!--[C-CDA R1.1] Encounters Section (entries optional)-->
<templateId root="2.16.840.1.113883.10.20.22.2.22"/>
<!--[C-CDA R2.1] Encounters Section (entries optional) (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.2.22" extension="2015-08-01"/>
<templateId root="2.16.840.1.113883.10.20.22.2.22.1"/>
<!-- [C-CDA R2.1] Encounters Section (entries required) (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.2.22.1" extension="2015-08-01"/>
<code code="46240-8" displayName="History of encounters" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Encounters</title>
<text>
</text>
<entry typeCode="DRIV">
<!---->
<encounter moodCode="EVN" classCode="ENC">
<!--[C-CDA R1.1] Encounter Activities-->
<templateId root="2.16.840.1.113883.10.20.22.4.49"/>
<!--[C-CDA R2.1] Encounter Activities (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.4.49" extension="2015-08-01"/>
<id root="12be0090-6859-4e58-a536-00b5b77b75ba"/>
<code code="{/data/encounterSection/code/@value}" displayName="{/data/encounterSection/code/@displayName}" codeSystem="{/data/encounterSection/code/@codeSystem}"/>
<effectiveTime value="{/data/effectiveTime/effectiveTimes/@value}"/>
<xsl:for-each select="/data/EncounterActivity/EncounterDiagnosis">
<xsl:if test="not(value/@code = '')">
<entryRelationship typeCode="SUBJ">
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.80"/>
<templateId extension="2015-08-01" root="2.16.840.1.113883.10.20.22.4.80"/>
<id extension="299999999-311111-concern" root="1.2.840.114350.1.13.000.2.7.1.1000.1"/>
<code code="29308-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Diagnosis"/>
<statusCode code="active"/>
<entryRelationship inversionInd="false" typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
<templateId extension="2015-08-01" root="2.16.840.1.113883.10.20.22.4.4"/>
<id extension="299999999-311111" root="1.2.840.114350.1.13.000.2.7.1.1000.1"/>
<code code="282291009" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT">
<translation code="29308-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Diagnosis"/>
</code>
<statusCode code="completed"/>
<effectiveTime>
<low value="{/data/effectiveTime/effectiveTimes/@value}"/>
</effectiveTime>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" code="{value/@code}" codeSystem="{value/@codeSystem}" displayName="{value/@displayName}" xsi:type="CD">
<originalText>
<xsl:value-of select="value/@displayName"/>
</originalText>
<translation code="{translation/@code}" codeSystem="{translation/@codeSystem}" displayName="{translation/@displayName}"/>
</value>
</observation>
</entryRelationship>
</act>
</entryRelationship>
</xsl:if>
</xsl:for-each>
</encounter>
</entry>
</section>
</component>
<!--******************************************************** History of Present Illness Section ********************************************************-->
<component>
<section nullFlavor="NI">
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.4"/>
<code code="10164-2" displayName="History of Present Illness" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>History of Present Illness</title>
<text>No history of present illness</text>
</section>
</component>
<!--******************************************************** Medications Administered Section ********************************************************-->
<component>
<section nullFlavor="NI">
<!--[C-CDA R1.1] Medications Administered Section-->
<templateId root="2.16.840.1.113883.10.20.22.2.38"/>
<!--[C-CDA R2.0] Medications Administered Section (V2) -->
<templateId root="2.16.840.1.113883.10.20.22.2.38" extension="2014-06-09"/>
<code code="29549-3" displayName="Medications Administered" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Medications Administered</title>
<text/>
<xsl:for-each select="/data/Medication/AdministeredMeds">
<xsl:if test="not(code/@code = '')">
<entry>
<substanceAdministration classCode="SBADM" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.16"/>
<templateId extension="2014-06-09" root="2.16.840.1.113883.10.20.22.4.16"/>
<id extension="831293486" root="1.2.840.114350.1.13.000.2.7.2.777777"/>
<text>
<xsl:value-of select="medtext/@value"/>
</text>
<statusCode code="completed"/>
<effectiveTime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="IVL_TS">
<low value="{/data/effectiveTime/effectiveTimeWithTime/@value}"/>
</effectiveTime>
<effectiveTime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" institutionSpecified="false" operator="A" xsi:type="PIVL_TS">
<period unit="h" value="6"/>
</effectiveTime>
<routeCode code="{routeCode/@code}" codeSystem="{routeCode/@codeSystem}" codeSystemName="NCI Thesaurus" displayName="{routeCode/@displayName}"/>
<doseQuantity unit="{doseQuantity/@unit}" value="{doseQuantity/@value}"/>
<consumable typeCode="CSM">
<manufacturedProduct classCode="MANU">
<templateId root="2.16.840.1.113883.10.20.22.4.23"/>
<templateId extension="2014-06-09" root="2.16.840.1.113883.10.20.22.4.23"/>
<manufacturedMaterial>
<code code="{code/@code}" codeSystem="{code/@codeSystem}">
<originalText>
<xsl:value-of select="medtext/@value"/>
</originalText>
</code>
</manufacturedMaterial>
</manufacturedProduct>
</consumable>
</substanceAdministration>
</entry>
</xsl:if>
</xsl:for-each>
</section>
</component>
<!--******************************************************** Problems Section ********************************************************-->
<component>
<section nullFlavor="NI">
<!--[C-CDA R1.1] Problem Section (entries optional)-->
<templateId root="2.16.840.1.113883.10.20.22.2.5"/>
<!--[C-CDA R2.1] Problem Section (entries optional) (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.2.5" extension="2015-08-01"/>
<!--[C-CDA R1.1] Problem Section (entries required)-->
<templateId root="2.16.840.1.113883.10.20.22.2.5.1"/>
<!-- [C-CDA R2.1] Problem Section (entries required) (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.2.5.1" extension="2015-08-01"/>
<code code="11450-4" displayName="Problem List" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Problem List</title>
<text/>
<xsl:for-each select="/data/ProblemConcernAct/ProblemObservation">
<xsl:if test="not(value/@code = '')">
<entry>
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.3"/>
<templateId extension="2015-08-01" root="2.16.840.1.113883.10.20.22.4.3"/>
<id extension="20516347-concern" root="1.2.840.114350.1.13.000.2.7.2.777777"/>
<code code="CONC" codeSystem="2.16.840.1.113883.5.6" codeSystemName="HL7ActClass" displayName="Concern"/>
<statusCode code="active"/>
<effectiveTime>
<low value="{/data/effectiveTime/effectiveTimes/@value}"/>
</effectiveTime>
<entryRelationship inversionInd="false" typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
<templateId extension="2015-08-01" root="2.16.840.1.113883.10.20.22.4.4"/>
<id extension="20516347" root="1.2.840.114350.1.13.000.2.7.2.777777"/>
<code code="64572001" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT">
<translation code="75323-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
</code>
<statusCode code="completed"/>
<effectiveTime>
<low value="{/data/effectiveTime/effectiveTimes/@value}"/>
</effectiveTime>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" code="{value/@code}" codeSystem="{value/@codeSystem}" displayName="{value/@displayName}" xsi:type="CD">
<originalText>
<xsl:value-of select="value/@displayName"/>
</originalText>
<translation code="{translation/@code}" codeSystem="{translation/@codeSystem}" displayName="{translation/@displayName}"/>
</value>
</observation>
</entryRelationship>
</act>
</entry>
</xsl:if>
</xsl:for-each>
</section>
</component>
<!--******************************************************** Reason for visit Section ********************************************************-->
<component>
<section nullFlavor="NI">
<templateId root="2.16.840.1.113883.10.20.22.2.12"/>
<code code="29299-5" displayName="Reason for visit" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Reason for visit</title>
<text>
<paragraph/>
</text>
</section>
</component>
<!--******************************************************** Results Section ********************************************************-->
<component>
<section>
<!--[C-CDA R1.1] Results Section (entries optional)-->
<templateId root="2.16.840.1.113883.10.20.22.2.3"/>
<!--[C-CDA R2.1] Results Section (entries optional) (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.2.3" extension="2015-08-01"/>
<!--[C-CDA R1.1] Results Section (entries required)-->
<templateId root="2.16.840.1.113883.10.20.22.2.3.1"/>
<!-- [C-CDA R2.1] Results Section (entries required) (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.2.3.1" extension="2015-08-01"/>
<code code="30954-2" displayName="Relevant diagnostic tests and/or laboratory data" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Results</title>
<text>
</text>
<xsl:for-each select="/data/Results/ResultOrganizer">
<xsl:if test="not(code/@code = '')">
<entry typeCode="DRIV">
<!---->
<organizer moodCode="EVN" classCode="BATTERY">
<!--[C-CDA R1.1] Result Organizer -->
<templateId root="2.16.840.1.113883.10.20.22.4.1"/>
<!--[C-CDA R2.1] Result Organizer (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.4.1" extension="2015-08-01"/>
<id root="f58d10ce-f31f-4d44-83f6-fd96ffdceb3f"/>
<code code="{code/@code}" displayName="{code/@displayName}" codeSystem="{code/@codeSystem}"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="{/data/effectiveTime/effectiveTimeResult/@value}"/>
<high value="{/data/effectiveTime/effectiveTimeResult/@value}"/>
</effectiveTime>
<xsl:if test="not(specimen/@code = '')">
<component>
<procedure classCode="PROC" moodCode="EVN">
<code code="17636008" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Specimen collection (procedure)"/>
<effectiveTime value="{/data/effectiveTime/effectiveTimeResult/@value}"/>
<participant typeCode="PRD">
<participantRole classCode="SPEC">
<id extension="830830830830" root="111111111111111"/>
<playingEntity>
<code code="{specimen/@code}" codeSystem="{specimen/@codeSystem}" displayName="{specimen/@displayName}"/>
</playingEntity>
</participantRole>
</participant>
</procedure>
</component>
</xsl:if>
<component>
<observation moodCode="EVN" classCode="OBS">
<!--[C-CDA R1.1] Result Observation -->
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<!--[C-CDA R2.1] Result Observation (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.4.2" extension="2015-08-01"/>
<templateId root="2.16.840.1.113883.10.20.15.2.3.2" extension="2016-12-01"/>
<id root="a7b2f0fb-d100-4f63-a7e0-12c8ebf49aab"/>
<code code="{code/@code}" displayName="{code/@displayName}" codeSystem="{code/@codeSystem}"/>
<statusCode code="completed"/>
<effectiveTime value="{/data/effectiveTime/effectiveTimeResult/@value}"/>
<xsl:choose>
<xsl:when test="value/@code = ''">
<value xsi:type="PQ" unit="{value/@unit}" value="{value/@value}"/>
</xsl:when>
<xsl:otherwise>
<value xsi:type="CD" code="{value/@code}" displayName="{value/@displayName}" codeSystem="{value/@codeSystem}"/>
</xsl:otherwise>
</xsl:choose>
<interpretationCode code="{interpretationCode/@code}" displayName="{interpretationCode/@displayName}" codeSystem="{interpretationCode/@codeSystem}"/>
</observation>
</component>
</organizer>
</entry>
</xsl:if>
</xsl:for-each>
</section>
</component>
<!--******************************************************** Plan of Care/Treatment Section ********************************************************-->
<component>
<section>
<!--[C-CDA R1.1] Plan of Care Section new-->
<templateId root="2.16.840.1.113883.10.20.22.2.10"/>
<templateId root="2.16.840.1.113883.10.20.22.2.10" extension="2014-06-09"/>
<code code="18776-5" displayName="Plan of Treatment" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Plan of Treatment</title>
<text>
</text>
<xsl:for-each select="/data/PlanOfTreatment/PlannedObservation">
<xsl:if test="not(code/@code = '')">
<entry>
<!--This is a request for a test to be performed (a lab test order)-->
<observation classCode="OBS" moodCode="INT">
<!--[C-CDA R1.1] Plan of Care Activity Observation-->
<templateId root="2.16.840.1.113883.10.20.22.4.44"/>
<!--[C-CDA R2.0] Planned Observation (V2)-->
<templateId root="2.16.840.1.113883.10.20.22.4.44" extension="2014-06-09"/>
<id root="68949b41-860b-41a4-b145-49c713e207e2"/>
<code code="{code/@code}" displayName="{code/@displayName}" codeSystem="{code/@codeSystem}"/>
<statusCode code="active"/>
<effectiveTime value="{/data/effectiveTime/effectiveTimes/@value}"/>
</observation>
</entry>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="/data/PlanOfTreatment/PlannedProcedure">
<xsl:if test="not(code/@code = '')">
<entry>
<!--This is a request for a procedure to be performed (a procedure order)-->
<procedure moodCode="INT" classCode="PROC">
<!--[C-CDA R1.1] Planned Procedure-->
<templateId root="2.16.840.1.113883.10.20.22.4.41"/>
<!--[C-CDA R2.0] Planned Procedure (V2)-->
<templateId root="2.16.840.1.113883.10.20.22.4.41" extension="2014-06-09"/>
<id root="68949b41-860b-41a4-b145-49c713e207e2"/>
<code code="{code/@code}" displayName="{code/@displayName}" codeSystem="{code/@codeSystem}"/>
<statusCode code="active"/>
<effectiveTime value="{/data/effectiveTime/effectiveTimes/@value}"/>
</procedure>
</entry>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="/data/PlanOfTreatment/PlannedMedication">
<xsl:if test="not(code/@code = '')">
<entry>
<!--This is a Planned Medication Activity Medication Activity (V2)-->
<substanceAdministration classCode="SBADM" moodCode="INT">
<templateId root="2.16.840.1.113883.10.20.22.4.42"/>
<templateId extension="2014-06-09" root="2.16.840.1.113883.10.20.22.4.42"/>
<id root="831293486"/>
<statusCode code="active"/>
<effectiveTime value="{/data/PlanOfTreatment/PlannedMedication/effectiveTime/@value}"/>
<consumable>
<manufacturedProduct classCode="MANU">
<templateId root="2.16.840.1.113883.10.20.22.4.23"/>
<templateId extension="2014-06-09" root="2.16.840.1.113883.10.20.22.4.23"/>
<manufacturedMaterial>
<code code="{code/@code}" codeSystem="{code/@codeSystem}" displayName="{/data/PlanOfTreatment/PlannedMedication/code/@displayName}"/>
</manufacturedMaterial>
</manufacturedProduct>
</consumable>
</substanceAdministration>
</entry>
</xsl:if>
</xsl:for-each>
</section>
</component>
<!--******************************************************** Social History Section ********************************************************-->
<component>
<section>
<!-- [C-CDA 1.1] Social History Section-->
<templateId root="2.16.840.1.113883.10.20.22.2.17"/>
<!--[C-CDA 2.1] Social History Section (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.2.17" extension="2015-08-01"/>
<code code="29762-2" displayName="Social History" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Social History</title>
<text>
</text>
<entry typeCode="DRIV">
<observation moodCode="EVN" classCode="OBS">
<!--[C-CDA R2.1 Companion Guide] Birth Sex Observation -->
<templateId root="2.16.840.1.113883.10.20.22.4.200"/>
<templateId root="2.16.840.1.113883.10.20.22.4.200" extension="2016-06-01"/>
<code code="76689-9" displayName="Sex Assigned At Birth" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<statusCode code="completed"/>
<effectiveTime value="20151225">
<!--effectiveTime if present should match birthTime-->
</effectiveTime>
<value code="F" displayName="Female" codeSystem="2.16.840.1.113883.5.1" codeSystemName="AdministrativeGender" xsi:type="CD"/>
</observation>
</entry>
<entry typeCode="DRIV">
<!--Occupation-->
<observation moodCode="EVN" classCode="OBS">
<!--[C-CDA R1.1] Social History Observation-->
<templateId root="2.16.840.1.113883.10.20.22.4.38"/>
<!--[C-CDA R2.1] Social History Observation (V3)-->
<templateId root="2.16.840.1.113883.10.20.22.4.38" extension="2015-08-01"/>
<id root="aa1d3dd0-5eff-447e-9e05-19736ee44b98"/>
<code code="364703007" displayName="Employment detail" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT">
<translation code="11295-3" displayName="Current employment - Reported" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
</code>
<statusCode code="completed"/>
<effectiveTime/>
<value code="159606005" displayName="Sales" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" xsi:type="CD"/>
</observation>
</entry>
<xsl:if test="not(/data/pregnancy/effectiveTime/@value = '')">
<entry>
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.15.3.8"/>
<id extension="Z4735487^66910^77386006" root="1.2.840.114350.1.13.301.2.7.1.1040.6"/>
<code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="{/data/pregnancy/effectiveTime/@value}"/>
</effectiveTime>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" code="77386006" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Pregnancy" xsi:type="CD"/>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.15.3.1"/>
<code code="11778-8" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Estimated date of delivery"/>
<statusCode code="completed"/>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" value="{/data/pregnancy/EDD/@value}" xsi:type="TS"/>
</observation>
</entryRelationship>
</observation>
</entry>
</xsl:if>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>
</xsl:template>
</xsl:stylesheet>