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