source: ccr/trunk/p/C0CCCD1.m

Last change on this file was 1586, checked in by Sam Habiel, 12 years ago

Changed license to AGPL. Some clean-up for XINDEX

  • Property svn:mergeinfo set to (toggle deleted branches)
    /ccr/branches/ohum/o-old/p/C0CCCD1.m1290
    /ccr/branches/ohum/p/C0CCCD1.m1291-1543
    /ccr/branches/ohum/p/p/C0CCCD1.m1287-1289
File size: 8.6 KB
Line 
1C0CCCD1 ; CCDCCR/GPL - CCD TEMPLATE AND ACCESS ROUTINES; 6/7/08
2 ;;1.2;CCD/CCR GENERATION UTILITIES;;Oct 30, 2012;Build 50
3 ;Copyright 2008,2009 George Lilly, University of Minnesota.
4 ;
5 ; This program is free software: you can redistribute it and/or modify
6 ; it under the terms of the GNU Affero General Public License as
7 ; published by the Free Software Foundation, either version 3 of the
8 ; License, or (at your option) any later version.
9 ;
10 ; This program is distributed in the hope that it will be useful,
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; GNU Affero General Public License for more details.
14 ;
15 ; You should have received a copy of the GNU Affero General Public License
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
17 ;
18 ;
19 W "This is a CCD TEMPLATE with processing routines",!
20 W !
21 Q
22 ;
23ZT(ZARY,BAT,LINE) ; private routine to add a line to the ZARY array
24 ; ZARY IS PASSED BY NAME
25 ; BAT is a string identifying the section
26 ; LINE is a test which will evaluate to true or false
27 ; I '$G(@ZARY) D ; IF ZARY DOES NOT EXIST '
28 ; . S @ZARY@(0)=0 ; initially there are no elements
29 ; . W "GOT HERE LOADING "_LINE,!
30 N CNT ; count of array elements
31 S CNT=@ZARY@(0) ; contains array count
32 S CNT=CNT+1 ; increment count
33 S @ZARY@(CNT)=LINE ; put the line in the array
34 ; S @ZARY@(BAT,CNT)="" ; index the test by battery
35 S @ZARY@(0)=CNT ; update the array counter
36 Q
37 ;
38ZLOAD(ZARY,ROUTINE) ; load tests into ZARY which is passed by reference
39 ; ZARY IS PASSED BY NAME
40 ; ZARY = name of the root, closed array format (e.g., "^TMP($J)")
41 ; ROUTINE = NAME OF THE ROUTINE - PASSED BY VALUE
42 K @ZARY S @ZARY=""
43 S @ZARY@(0)=0 ; initialize array count
44 N LINE,LABEL,BODY
45 N INTEST S INTEST=0 ; switch for in the TEMPLATE section
46 N SECTION S SECTION="[anonymous]" ; NO section LABEL
47 ;
48 N NUM F NUM=1:1 S LINE=$T(+NUM^@ROUTINE) Q:LINE="" D
49 . I LINE?." "1";<TEMPLATE>".E S INTEST=1 ; entering section
50 . I LINE?." "1";</TEMPLATE>".E S INTEST=0 ; leaving section
51 . I INTEST D ; within the section
52 . . I LINE?." "1";><".E D ; sub-section name found
53 . . . S SECTION=$P($P(LINE,";><",2),">",1) ; pull out name
54 . . I LINE?." "1";;".E D ; line found
55 . . . D ZT(ZARY,SECTION,$P(LINE,";;",2)) ; put the line in the array
56 Q
57 ;
58LOAD(ARY) ; LOAD A CCR TEMPLATE INTO ARY PASSED BY NAME
59 D ZLOAD(ARY,"C0CCCD1")
60 ; ZWR @ARY
61 Q
62 ;
63TRMCCD ; ROUTINE TO BE WRITTEN TO REMOVE CCR MARKUP FROM CCD
64 Q
65MARKUP ;<MARKUP>
66 ;;<Body>
67 ;;<Problems>
68 ;;</Problems>
69 ;;<FamilyHistory>
70 ;;</FamilyHistory>
71 ;;<SocialHistory>
72 ;;</SocialHistory>
73 ;;<Alerts>
74 ;;</Alerts>
75 ;;<Medications>
76 ;;</Medications>
77 ;;<VitalSigns>
78 ;;</VitalSigns>
79 ;;<Results>
80 ;;</Results>
81 ;;</Body>
82 ;;</ContinuityOfCareRecord>
83 ;</MARKUP>
84 ;;<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">
85 ;;</ClinicalDocument>
86 Q
87 ;
88 ;<TEMPLATE>
89 ;;<?xml version="1.0"?>
90 ;;<?xml-stylesheet type="text/xsl" href="CCD.xsl"?>
91 ;;<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">
92 ;;<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
93 ;;<templateId root="2.16.840.1.113883.10.20.1"/>
94 ;;<id root="db734647-fc99-424c-a864-7e3cda82e703"/>
95 ;;<code code="34133-9" codeSystem="2.16.840.1.113883.6.1" displayName="Summarization of episode note"/>
96 ;;<title>Continuity of Care Document</title>
97 ;;<effectiveTime value="20000407130000+0500"/>
98 ;;<confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
99 ;;<languageCode code="en-US"/>
100 ;;<recordTarget>
101 ;;<patientRole>
102 ;;<id extension="@@ACTORIEN@@" root="2.16.840.1.113883.19.5"/>
103 ;;<patient>
104 ;;<name>
105 ;;<given>@@ACTORGIVENNAME@@</given>
106 ;;<family>@@ACTORFAMILYNAME@@</family>
107 ;;<suffix>@@ACTORSUFFIXNAME@@</suffix>
108 ;;</name>
109 ;;<administrativeGenderCode code="@@ACTORGENDER@@" codeSystem="2.16.840.1.113883.5.1"/>
110 ;;<birthTime value="@@ACTORDATEOFBIRTH@@"/>
111 ;;</patient>
112 ;;<providerOrganization>
113 ;;<id root="2.16.840.1.113883.19.5"/>
114 ;;<name>@@ORGANIZATIONNAME@@</name>
115 ;;</providerOrganization>
116 ;;</patientRole>
117 ;;</recordTarget>
118 ;;<author>
119 ;;<time value="20000407130000+0500"/>
120 ;;<assignedAuthor>
121 ;;<id root="20cf14fb-b65c-4c8c-a54d-b0cca834c18c"/>
122 ;;<assignedPerson>
123 ;;<name>
124 ;;<prefix>@@ACTORNAMEPREFIX@@</prefix>
125 ;;<given>@@ACTORGIVENNAME@@</given>
126 ;;<family>@@ACTORFAMILYNAME@@</family>
127 ;;</name>
128 ;;</assignedPerson>
129 ;;<representedOrganization>
130 ;;<id root="2.16.840.1.113883.19.5"/>
131 ;;<name>@@ORGANIZATIONNAME@@</name>
132 ;;</representedOrganization>
133 ;;</assignedAuthor>
134 ;;</author>
135 ;;<informant>
136 ;;<assignedEntity>
137 ;;<id nullFlavor="NI"/>
138 ;;<representedOrganization>
139 ;;<id root="2.16.840.1.113883.19.5"/>
140 ;;<name>@@ORGANIZATIONNAME@@</name>
141 ;;</representedOrganization>
142 ;;</assignedEntity>
143 ;;</informant>
144 ;;<custodian>
145 ;;<assignedCustodian>
146 ;;<representedCustodianOrganization>
147 ;;<id root="2.16.840.1.113883.19.5"/>
148 ;;<name>@@ORGANIZATIONNAME@@</name>
149 ;;</representedCustodianOrganization>
150 ;;</assignedCustodian>
151 ;;</custodian>
152 ;;<legalAuthenticator>
153 ;;<time value="20000407130000+0500"/>
154 ;;<signatureCode code="S"/>
155 ;;<assignedEntity>
156 ;;<id nullFlavor="NI"/>
157 ;;<representedOrganization>
158 ;;<id root="2.16.840.1.113883.19.5"/>
159 ;;<name>@@ORGANIZATIONNAME@@</name>
160 ;;</representedOrganization>
161 ;;</assignedEntity>
162 ;;</legalAuthenticator>
163 ;;<Actors>
164 ;;<ACTOR-NOK>
165 ;;<participant typeCode="IND">
166 ;;<associatedEntity classCode="NOK">
167 ;;<id root="4ac71514-6a10-4164-9715-f8d96af48e6d"/>
168 ;;<code code="65656005" codeSystem="2.16.840.1.113883.6.96" displayName="Biiological mother"/>
169 ;;<telecom value="tel:(999)555-1212"/>
170 ;;<associatedPerson>
171 ;;<name>
172 ;;<given>Henrietta</given>
173 ;;<family>Levin</family>
174 ;;</name>
175 ;;</associatedPerson>
176 ;;</associatedEntity>
177 ;;</participant>
178 ;;</ACTOR-NOK>
179 ;;</Actors>
180 ;;<documentationOf>
181 ;;<serviceEvent classCode="PCPR">
182 ;;<effectiveTime>
183 ;;<high value="@@DATETIME@@"/>
184 ;;</effectiveTime>
185 ;;<performer typeCode="PRF">
186 ;;<functionCode code="PCP" codeSystem="2.16.840.1.113883.5.88"/>
187 ;;<time>
188 ;;<low value="1990"/>
189 ;;<high value='20000407'/>
190 ;;</time>
191 ;;<assignedEntity>
192 ;;<id root="20cf14fb-b65c-4c8c-a54d-b0cca834c18c"/>
193 ;;<assignedPerson>
194 ;;<name>
195 ;;<prefix>@@ACTORPREFIXNAME@@</prefix>
196 ;;<given>@@ACTORGIVENNAME@@</given>
197 ;;<family>@@ACTORFAMILYNAME@@</family>
198 ;;</name>
199 ;;</assignedPerson>
200 ;;<representedOrganization>
201 ;;<id root="2.16.840.1.113883.19.5"/>
202 ;;<name>@@ORGANIZATIONNAME@@</name>
203 ;;</representedOrganization>
204 ;;</assignedEntity>
205 ;;</performer>
206 ;;</serviceEvent>
207 ;;</documentationOf>
208 ;;<Body>
209 ;;<PROBLEMS-HTML>
210 ;;<text><table border="1" width="100%"><thead><tr><th>Condition</th><th>Effective Dates</th><th>Condition Status</th></tr></thead><tbody>
211 ;;<tr><td>@@PROBLEMDESCRIPTION@@</td>
212 ;;<td>@@PROBLEMDATEOFONSET@@</td>
213 ;;<td>Active</td></tr>
214 ;;</tbody></table></text>
215 ;;</PROBLEMS-HTML>
216 ;;<Problems>
217 ;;<component>
218 ;;<section>
219 ;;<templateId root='2.16.840.1.113883.10.20.1.11'/>
220 ;;<code code="11450-4" codeSystem="2.16.840.1.113883.6.1"/>
221 ;;<title>Problems</title>
222 ;;<entry typeCode="DRIV">
223 ;;<act classCode="ACT" moodCode="EVN">
224 ;;<templateId root='2.16.840.1.113883.10.20.1.27'/>
225 ;;<id root="6a2fa88d-4174-4909-aece-db44b60a3abb"/>
226 ;;<code nullFlavor="NA"/>
227 ;;<entryRelationship typeCode="SUBJ">
228 ;;<observation classCode="OBS" moodCode="EVN">
229 ;;<templateId root='2.16.840.1.113883.10.20.1.28'/>
230 ;;<id root="d11275e7-67ae-11db-bd13-0800200c9a66"/>
231 ;;<code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
232 ;;<statusCode code="completed"/>
233 ;;<effectiveTime>
234 ;;<low value="@@PROBLEMDATEOFONSET@@"/>
235 ;;</effectiveTime>
236 ;;<value xsi:type="CD" code="@@PROBLEMCODEVALUE@@" codeSystem="2.16.840.1.113883.6.96" displayName="@@PROBLEMDESCRIPTION@@"/>
237 ;;<entryRelationship typeCode="REFR">
238 ;;<observation classCode="OBS" moodCode="EVN">
239 ;;<templateId root='2.16.840.1.113883.10.20.1.50'/>
240 ;;<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" displayName="Status"/>
241 ;;<statusCode code="completed"/>
242 ;;<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active"/>
243 ;;</observation>
244 ;;</entryRelationship>
245 ;;</observation>
246 ;;</entryRelationship>
247 ;;</act>
248 ;;</entry>
249 ;;</section>
250 ;;</component>
251 ;;</Problems>
252 ;;<FamilyHistory>
253 ;;</FamilyHistory>
254 ;;<SocialHistory>
255 ;;</SocialHistory>
256 ;;<Alerts>
257 ;;</Alerts>
258 ;;<Medications>
259 ;;</Medications>
260 ;;<VitalSigns>
261 ;;</VitalSigns>
262 ;;<Results>
263 ;;</Results>
264 ;;</Body>
265 ;;</ClinicalDocument>
266 ;</TEMPLATE>
Note: See TracBrowser for help on using the repository browser.