source: ccr/trunk/p/C0CVIT2.m@ 1724

Last change on this file since 1724 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/C0CVIT2.m1290
    /ccr/branches/ohum/p/C0CVIT2.m1291-1543
    /ccr/branches/ohum/p/p/C0CVIT2.m1287-1289
File size: 20.4 KB
Line 
1C0CVIT2 ; CCDCCR/CJE/GPL - CCR/CCD PROCESSING FOR VITALS ; 07/16/08
2 ;;1.2;CCD/CCR GENERATION UTILITIES;;Oct 30, 2012;Build 50
3 ;Copyright 2008,2009 George Lilly, University of Minnesota and others.
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 W "NO ENTRY FROM TOP",!
19 Q
20 ;
21EXTRACT(VITXML,DFN,VITOUT) ; EXTRACT VITAL SIGNS INTO XML TEMPLATE
22 ; VITXML AND VITOUT ARE PASSED BY NAME SO GLOBALS CAN BE USED
23 ;
24 ; USE THE FOLLOWING TEMPLATE FOR THE RNF2 ARRAYS
25 ; THAT GET PASSED TO *GET ROUTINES
26 ;C0C[NAME]=$NA(^TMP("C0CCCR",$J,DFN,"C0C(NAME))
27 N C0CVIT
28 S C0CVIT=$NA(^TMP("C0CCCR",$J,DFN,"C0CVIT"))
29 ; USE THE FOLLOWING TEMPLATE FOR GETTING/GENERATING THE RNF2 ARRAYS
30 ; THAT GET INSERTED INTO THE XML TEMPLATE
31 ; D GET[VISTA/RPMS](DFN,C0CIMM) ; GET VARS
32 I $$RPMS^C0CUTIL() D GETRPMS(DFN,C0CVIT) ; GET VARS
33 I ($$VISTA^C0CUTIL())!($$WV^C0CUTIL())!($$OV^C0CUTIL()) D GETVISTA(DFN,C0CVIT)
34 ; USE THE FOLLOWING TEMPATE FOR MAPPING RNF2 ARRAYS TO XML TEMPLATE
35 ; D MAP([NAME]XML,C0C[NAME],[NAME]OUT) ;MAP RESULTS FOR PROCEDURES
36 D MAP(VITXML,C0CVIT,VITOUT) ;MAP RESULTS FOR PROCEDURES
37 Q
38 ;
39GETVISTA(DFN,C0CVIT) ; CALLS VITALS^ORQQVI TO GET VITAL SIGNS.
40 ; ERETURNS THEM IN RNF2 ARRAYS PASSED BY NAME
41 ; C0CVIT: VITAL SIGNS
42 ; READY TO BE MAPPED TO XML BY MAP^C0CVIT2
43 ; THESE RETURN ARRAYS ARE NOT INITIALIZED, BUT ARE ADDED TO IF THEY
44 ; EXIST.
45 ;
46 ; KILL OF ARRAYS IS TAKEN CARE OF IN ^C0CCCR (K ^TMP("C0CCCR",$J))
47 ;
48 ; SETUP RPC/API CALL HERE
49 ; USE START AND END DATES FROM PARAMETERS IF REQUIRED
50 ;
51 N VIT,DATA,START,END
52 ; RPC REQUIRES FM DATES NOT T-* DATES
53 D DT^DILF(,$$GET^C0CPARMS("VITLIMIT"),.END) ; GET THE LIMIT PARM
54 D DT^DILF(,$$GET^C0CPARMS("VITSTART"),.START) ; GET START PARM
55 ; RPC CALL (ORY,DFN,ORSDT,OREDT):
56 ;ORY: return variable
57 ;DFN: patient identifier from Patient File [#2]
58 ;ORSDT: start date/time in Fileman format
59 ;OREDT: end date/time in Fileman format
60 ; OUTPUT FORMAT:
61 ;vital measurement ien^vital type^rate^date/time taken
62 D VITALS^ORQQVI(.VIT,DFN,START,END) ; RUN QUERY VITALS CALL
63 I '$D(VIT) S @VITOUT@(0)=0 K VIT Q ; RETURN NOT FOUND, KILL ARRAY AND QUIT
64 I $P(VIT(1),U,2)="No vitals found." D Q ; signal no vitals and quit
65 . I $D(VITOUT) S @VITOUT@(0)=0
66 . K VIT
67 ;
68 ; PREFORM SORT HERE IF NEEDED
69 ;
70 ; SORT IS REQUIRED FOR VITAL SIGNS - LATEST VITALS NEED TO BE LISTED FIRST
71 ; COPIED SORT LOGIC:
72 N VSORT,VDATES,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
73 D VITSORT(.VDATES) ; PULL OUT THE DATES INTO AN ARRAY
74 S VCNT=$$SORTDT^C0CUTIL(.VSORT,.VDATES,-1) ; PUT VITALS IN REVERSE
75 ; VSORT IS VITALS IN REVERSE ORDER
76 ;
77 ; MAP EACH ROW OF RPC/API TO RNF1 ARRAY
78 ; RNF1 ARRAY FORMAT:
79 ; VAR("NAME_OF_RIM_VARIABLE")=VALUE
80 ;
81 ; VITAL SIGNS ARE DONE DIFFERENTLY DUE TO THE DIFFERENT TYPES OF VITAL SIGNS
82 ; THIS LOOP WILL GET EACH ROW, DETERMINE THE TYPE, AND CALL THE RESPECTIVE PROCESSING METHOD
83 ; THAT WILL DO THE MAPPING TO RNF1 STYLE ARRAYS
84 N C0CVI,C0CC,ZRNF
85 ;S C0CVI="" ; INITIALIZE FOR $O
86 F C0CC=1:1:VSORT(0) S C0CVI=VSORT(C0CC) D ; FOR EACH VITAL SIGN IN THE LIST
87 . I DEBUG W VIT(C0CVI),!
88 . ; FIGURE OUT WHICH TYPE OF VITAL SIGN IT IS (HEIGHT, WEIGHT, BLOOD PRESSURE, TEMPERATURE, RESPIRATION, PULSE, PAIN, OTHER)
89 . D:$P(VIT(C0CVI),U,3)="HT" HEIGHT1($$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT"),$P(^GMR(120.5,$P(VIT(C0CVI),U,1),0),U,6),$P(VIT(C0CVI),U,3),"in")
90 . D:$P(VIT(C0CVI),U,3)="WT" WEIGHT1($$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT"),$P(^GMR(120.5,$P(VIT(C0CVI),U,1),0),U,6),$P(VIT(C0CVI),U,3),"lbs")
91 . D:$P(VIT(C0CVI),U,3)="BP" BP1($$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT"),$P(^GMR(120.5,$P(VIT(C0CVI),U,1),0),U,6),$P(VIT(C0CVI),U,3),"")
92 . D:$P(VIT(C0CVI),U,3)="T" TMP1($$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT"),$P(^GMR(120.5,$P(VIT(C0CVI),U,1),0),U,6),$P(VIT(C0CVI),U,3),"F")
93 . D:$P(VIT(C0CVI),U,3)="R" RESP1($$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT"),$P(^GMR(120.5,$P(VIT(C0CVI),U,1),0),U,6),$P(VIT(C0CVI),U,3),"")
94 . D:$P(VIT(C0CVI),U,3)="P" PULSE1($$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT"),$P(^GMR(120.5,$P(VIT(C0CVI),U,1),0),U,6),$P(VIT(C0CVI),U,3),"")
95 . D:$P(VIT(C0CVI),U,3)="PN" PAIN1($$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT"),$P(^GMR(120.5,$P(VIT(C0CVI),U,1),0),U,6),$P(VIT(C0CVI),U,3),"")
96 . D:'$D(ZRNF) OTHER1($$FMDTOUTC^C0CUTIL($P(C0CVI,U,4),"DT"),"OTHER VITAL",$P(^GMR(120.5,$P(VIT(C0CVI),U,1),0),U,6),$P(VIT(C0CVI),U,3),"UNKNOWN") ;IF THE VITAL ISN'T DEFINED IT IS OTHER
97 . D RNF1TO2^C0CRNF(C0CVIT,"ZRNF") ;ADD THIS ROW TO THE ARRAY
98 . K ZRNF
99 ; SAVE RIM VARIABLES SEE C0CRIMA
100 N ZRIM S ZRIM=$NA(^TMP("C0CRIM","VARS",DFN,"VITALS"))
101 M @ZRIM=@C0CVIT@("V")
102 Q
103 ;
104GETRPMS(DFN,C0CVIT) ; CALLS QUERY^BEHOVM TO GET VITAL SIGNS.
105 ; ERETURNS THEM IN RNF2 ARRAYS PASSED BY NAME
106 ; C0CVIT: VITAL SIGNS
107 ; READY TO BE MAPPED TO XML BY MAP^C0CVIT2
108 ; THESE RETURN ARRAYS ARE NOT INITIALIZED, BUT ARE ADDED TO IF THEY
109 ; EXIST.
110 ;
111 ; KILL OF ARRAYS IS TAKEN CARE OF IN ^C0CCCR (K ^TMP("C0CCCR",$J))
112 ;
113 ; SETUP RPC/API CALL HERE
114 ; USE START AND END DATES FROM PARAMETERS IF REQUIRED
115 ;
116 ; RPMS VITAL RPC ONLY RETURNS LATEST VITAL IN SPECIFIED DATE RANGE NOT ALL VITALS IN DATE RANGE
117 ; WE NEED TO SETUP THE VARIABLES THE INTERNAL CALL NEEDS TO BYPASS A HARD CODE OF ONE VITAL FOR DATE RANGE
118 N C0CEDT,C0CSDT,VIT,DATA,START,END
119 ; RPC REQUIRES FM DATES NOT T-* DATES
120 D DT^DILF(,$$GET^C0CPARMS("VITLIMIT"),.END) ; GET THE LIMIT PARM
121 D DT^DILF(,$$GET^C0CPARMS("VITSTART"),.START) ; GET START PARM
122 ; RPC OUTPUT FORMAT:
123 ; vfile ien^vital name^vital abbr^date/time taken(FM FORMAT)^value+units (US & metric)
124 D QUERY^BEHOVM("LISTX") ; RUN QUERY VITALS CALL
125 I '$D(^TMP("CIAVMRPC",$J)) S @VITOUT@(0)=0 K ^TMP("CIAVMRPC",$J) Q ; RETURN NOT FOUND, KILL ARRAY AND QUIT
126 ; MOVE THE ARRAY TO LOCAL VARIABLE
127 M VIT=^TMP("CIAVMRPC",$J,0)
128 ; RPC CLEANUP
129 K ^TMP("CIAVMRPC",$J),VITS,RMAX,START,END,DATA,METRIC,VSTR,VUNT
130 ;
131 ; PREFORM SORT HERE IF NEEDED
132 ;
133 ; SORT IS REQUIRED FOR VITAL SIGNS - LATEST VITALS NEED TO BE LISTED FIRST
134 ; COPIED SORT LOGIC:
135 N VSORT,VDATES,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
136 D VITSORT(.VDATES) ; PULL OUT THE DATES INTO AN ARRAY
137 S VCNT=$$SORTDT^C0CUTIL(.VSORT,.VDATES,-1) ; PUT VITALS IN REVERSE
138 ; VSORT IS VITALS IN REVERSE ORDER
139 ;
140 ; MAP EACH ROW OF RPC/API TO RNF1 ARRAY
141 ; RNF1 ARRAY FORMAT:
142 ; VAR("NAME_OF_RIM_VARIABLE")=VALUE
143 ;
144 ; VITAL SIGNS ARE DONE DIFFERENTLY DUE TO THE DIFFERENT TYPES OF VITAL SIGNS
145 ; THIS LOOP WILL GET EACH ROW, DETERMINE THE TYPE, AND CALL THE RESPECTIVE PROCESSING METHOD
146 ; THAT WILL DO THE MAPPING TO RNF1 STYLE ARRAYS
147 N C0CVI,C0CC,ZRNF
148 ;S C0CVI="" ; INITIALIZE FOR $O
149 F C0CC=1:1:VSORT(0) S C0CVI=VSORT(C0CC) D ; FOR EACH VITAL SIGN IN THE LIST
150 . I DEBUG W VIT(C0CVI),!
151 . ; FIGURE OUT WHICH TYPE OF VITAL SIGN IT IS (HEIGHT, WEIGHT, BLOOD PRESSURE, TEMPERATURE, RESPIRATION, PULSE, PAIN, OTHER)
152 . D:$P(VIT(C0CVI),U,3)="HT" HEIGHT
153 . D:$P(VIT(C0CVI),U,3)="WT" WEIGHT
154 . D:$P(VIT(C0CVI),U,3)="BP" BP
155 . D:$P(VIT(C0CVI),U,3)="TMP" TMP
156 . D:$P(VIT(C0CVI),U,3)="RS" RESP
157 . D:$P(VIT(C0CVI),U,3)="PU" PULSE
158 . D:$P(VIT(C0CVI),U,3)="PA" PAIN
159 . D:'$D(ZRNF) OTHER ;IF THE VITAL ISN'T DEFINED IT IS OTHER
160 . D RNF1TO2^C0CRNF(C0CVIT,"ZRNF") ;ADD THIS ROW TO THE ARRAY
161 . K ZRNF
162 ; SAVE RIM VARIABLES SEE C0CRIMA
163 N ZRIM S ZRIM=$NA(^TMP("C0CRIM","VARS",DFN,"VITALS"))
164 M @ZRIM=@C0CVIT@("V")
165 Q
166 ;
167HEIGHT ;
168 I DEBUG W "IN VITAL: HEIGHT",!
169 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC ; UNIQUE OBJID
170 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
171 S ZRNF("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT")
172 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
173 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
174 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
175 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
176 S ZRNF("VITALSIGNSDESCCODEVALUE")="248327008"
177 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
178 S ZRNF("VITALSIGNSCODEVERSION")=""
179 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VIT(C0CVI),U,1),12)),U,4)
180 S ZRNF("VITALSIGNSTESTRESULTVALUE")=$P($P(VIT(C0CVI),U,5)," ",1)
181 S ZRNF("VITALSIGNSTESTRESULTUNIT")=$P($P(VIT(C0CVI),U,5)," ",2)
182 Q
183 ;
184WEIGHT ;
185 I DEBUG W "IN VITAL: WEIGHT",!
186 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
187 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
188 S ZRNF("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT")
189 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
190 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
191 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
192 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
193 S ZRNF("VITALSIGNSDESCCODEVALUE")="107647005"
194 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
195 S ZRNF("VITALSIGNSCODEVERSION")=""
196 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VIT(C0CVI),U,1),12)),U,4)
197 S ZRNF("VITALSIGNSTESTRESULTVALUE")=$P($P(VIT(C0CVI),U,5)," ",1)
198 S ZRNF("VITALSIGNSTESTRESULTUNIT")=$P($P(VIT(C0CVI),U,5)," ",2)
199 Q
200 ;
201BP ;
202 I DEBUG W "IN VITAL: BLOOD PRESSURE",!
203 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
204 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
205 S ZRNF("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT")
206 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
207 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
208 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
209 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
210 S ZRNF("VITALSIGNSDESCCODEVALUE")="392570002"
211 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
212 S ZRNF("VITALSIGNSCODEVERSION")=""
213 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VIT(C0CVI),U,1),12)),U,4)
214 S ZRNF("VITALSIGNSTESTRESULTVALUE")=$P($P(VIT(C0CVI),U,5)," ",1)
215 S ZRNF("VITALSIGNSTESTRESULTUNIT")=$P($P(VIT(C0CVI),U,5)," ",2)
216 Q
217 ;
218TMP ;
219 I DEBUG W "IN VITAL: TEMPERATURE",!
220 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
221 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
222 S ZRNF("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT")
223 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
224 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
225 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
226 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
227 S ZRNF("VITALSIGNSDESCCODEVALUE")="309646008"
228 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
229 S ZRNF("VITALSIGNSCODEVERSION")=""
230 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VIT(C0CVI),U,1),12)),U,4)
231 S ZRNF("VITALSIGNSTESTRESULTVALUE")=$P($P(VIT(C0CVI),U,5)," ",1)
232 S ZRNF("VITALSIGNSTESTRESULTUNIT")=$P($P(VIT(C0CVI),U,5)," ",2)
233 Q
234 ;
235RESP ;
236 I DEBUG W "IN VITAL: RESPIRATION",!
237 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
238 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
239 S ZRNF("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT")
240 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
241 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
242 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
243 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
244 S ZRNF("VITALSIGNSDESCCODEVALUE")="366147009"
245 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
246 S ZRNF("VITALSIGNSCODEVERSION")=""
247 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VIT(C0CVI),U,1),12)),U,4)
248 S ZRNF("VITALSIGNSTESTRESULTVALUE")=$P($P(VIT(C0CVI),U,5)," ",1)
249 S ZRNF("VITALSIGNSTESTRESULTUNIT")=$P($P(VIT(C0CVI),U,5)," ",2)
250 Q
251 ;
252PULSE ;
253 I DEBUG W "IN VITAL: PULSE",!
254 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
255 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
256 S ZRNF("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT")
257 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
258 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
259 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
260 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
261 S ZRNF("VITALSIGNSDESCCODEVALUE")="366199006"
262 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
263 S ZRNF("VITALSIGNSCODEVERSION")=""
264 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VIT(C0CVI),U,1),12)),U,4)
265 S ZRNF("VITALSIGNSTESTRESULTVALUE")=$P($P(VIT(C0CVI),U,5)," ",1)
266 S ZRNF("VITALSIGNSTESTRESULTUNIT")=$P($P(VIT(C0CVI),U,5)," ",2)
267 Q
268 ;
269PAIN ;
270 I DEBUG W "IN VITAL: PAIN",!
271 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
272 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
273 S ZRNF("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT")
274 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
275 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
276 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
277 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
278 S ZRNF("VITALSIGNSDESCCODEVALUE")="22253000"
279 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
280 S ZRNF("VITALSIGNSCODEVERSION")=""
281 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VIT(C0CVI),U,1),12)),U,4)
282 S ZRNF("VITALSIGNSTESTRESULTVALUE")=$P($P(VIT(C0CVI),U,5)," ",1)
283 S ZRNF("VITALSIGNSTESTRESULTUNIT")=$P($P(VIT(C0CVI),U,5)," ",2)
284 Q
285 ;
286OTHER ;
287 I DEBUG W "IN VITAL: OTHER",!
288 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
289 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
290 S ZRNF("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VIT(C0CVI),U,4),"DT")
291 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")=$P(VIT(C0CVI),U,2)
292 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
293 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
294 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
295 S ZRNF("VITALSIGNSDESCCODEVALUE")=""
296 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")=""
297 S ZRNF("VITALSIGNSCODEVERSION")=""
298 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VIT(C0CVI),U,1),12)),U,4)
299 S ZRNF("VITALSIGNSTESTRESULTVALUE")=$P($P(VIT(C0CVI),U,5)," ",1)
300 S ZRNF("VITALSIGNSTESTRESULTUNIT")=$P($P(VIT(C0CVI),U,5)," ",2)
301 Q
302 ;
303 ;TEMPORARY, THINKING ON HOW TO REFACTOR (CJE)
304HEIGHT1(DT,ACTOR,VALUE,UNIT) ;
305 I DEBUG W "IN VITAL: HEIGHT",!
306 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC ; UNIQUE OBJID
307 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
308 S ZRNF("VITALSIGNSEXACTDATETIME")=DT
309 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
310 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
311 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
312 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
313 S ZRNF("VITALSIGNSDESCCODEVALUE")="248327008"
314 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
315 S ZRNF("VITALSIGNSCODEVERSION")=""
316 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_ACTOR
317 S ZRNF("VITALSIGNSTESTRESULTVALUE")=VALUE
318 S ZRNF("VITALSIGNSTESTRESULTUNIT")=UNIT
319 Q
320 ;
321WEIGHT1(DT,ACTOR,VALUE,UNIT) ;
322 I DEBUG W "IN VITAL: WEIGHT",!
323 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
324 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
325 S ZRNF("VITALSIGNSEXACTDATETIME")=DT
326 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
327 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
328 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
329 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
330 S ZRNF("VITALSIGNSDESCCODEVALUE")="107647005"
331 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
332 S ZRNF("VITALSIGNSCODEVERSION")=""
333 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_ACTOR
334 S ZRNF("VITALSIGNSTESTRESULTVALUE")=VALUE
335 S ZRNF("VITALSIGNSTESTRESULTUNIT")=UNIT
336 Q
337 ;
338BP1(DT,ACTOR,VALUE,UNIT) ;
339 I DEBUG W "IN VITAL: BLOOD PRESSURE",!
340 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
341 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
342 S ZRNF("VITALSIGNSEXACTDATETIME")=DT
343 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
344 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
345 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
346 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
347 S ZRNF("VITALSIGNSDESCCODEVALUE")="392570002"
348 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
349 S ZRNF("VITALSIGNSCODEVERSION")=""
350 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_ACTOR
351 S ZRNF("VITALSIGNSTESTRESULTVALUE")=VALUE
352 S ZRNF("VITALSIGNSTESTRESULTUNIT")=UNIT
353 Q
354 ;
355TMP1(DT,ACTOR,VALUE,UNIT) ;
356 I DEBUG W "IN VITAL: TEMPERATURE",!
357 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
358 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
359 S ZRNF("VITALSIGNSEXACTDATETIME")=DT
360 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
361 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
362 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
363 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
364 S ZRNF("VITALSIGNSDESCCODEVALUE")="309646008"
365 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
366 S ZRNF("VITALSIGNSCODEVERSION")=""
367 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_ACTOR
368 S ZRNF("VITALSIGNSTESTRESULTVALUE")=VALUE
369 S ZRNF("VITALSIGNSTESTRESULTUNIT")=UNIT
370 Q
371 ;
372RESP1(DT,ACTOR,VALUE,UNIT) ;
373 I DEBUG W "IN VITAL: RESPIRATION",!
374 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
375 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
376 S ZRNF("VITALSIGNSEXACTDATETIME")=DT
377 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
378 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
379 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
380 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
381 S ZRNF("VITALSIGNSDESCCODEVALUE")="366147009"
382 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
383 S ZRNF("VITALSIGNSCODEVERSION")=""
384 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_ACTOR
385 S ZRNF("VITALSIGNSTESTRESULTVALUE")=VALUE
386 S ZRNF("VITALSIGNSTESTRESULTUNIT")=UNIT
387 Q
388 ;
389PULSE1(DT,ACTOR,VALUE,UNIT) ;
390 I DEBUG W "IN VITAL: PULSE",!
391 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
392 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
393 S ZRNF("VITALSIGNSEXACTDATETIME")=DT
394 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
395 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
396 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
397 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
398 S ZRNF("VITALSIGNSDESCCODEVALUE")="366199006"
399 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
400 S ZRNF("VITALSIGNSCODEVERSION")=""
401 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_ACTOR
402 S ZRNF("VITALSIGNSTESTRESULTVALUE")=VALUE
403 S ZRNF("VITALSIGNSTESTRESULTUNIT")=UNIT
404 Q
405 ;
406PAIN1(DT,ACTOR,VALUE,UNIT) ;
407 I DEBUG W "IN VITAL: PAIN",!
408 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
409 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
410 S ZRNF("VITALSIGNSEXACTDATETIME")=DT
411 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
412 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
413 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
414 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
415 S ZRNF("VITALSIGNSDESCCODEVALUE")="22253000"
416 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
417 S ZRNF("VITALSIGNSCODEVERSION")=""
418 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_ACTOR
419 S ZRNF("VITALSIGNSTESTRESULTVALUE")=VALUE
420 S ZRNF("VITALSIGNSTESTRESULTUNIT")=UNIT
421 Q
422 ;
423OTHER1(DT,TEXT,ACTOR,VALUE,UNIT) ;
424 I DEBUG W "IN VITAL: OTHER",!
425 S ZRNF("VITALSIGNSDATAOBJECTID")="VITAL"_C0CC
426 S ZRNF("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
427 S ZRNF("VITALSIGNSEXACTDATETIME")=DT
428 S ZRNF("VITALSIGNSDESCRIPTIONTEXT")=TEXT
429 S ZRNF("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
430 S ZRNF("VITALSIGNSTESTOBJECTID")="VITALTEST"_C0CC
431 S ZRNF("VITALSIGNSTESTTYPETEXT")="OBSERVED"
432 S ZRNF("VITALSIGNSDESCCODEVALUE")=""
433 S ZRNF("VITALSIGNSDESCCODINGSYSTEM")=""
434 S ZRNF("VITALSIGNSCODEVERSION")=""
435 S ZRNF("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_ACTOR
436 S ZRNF("VITALSIGNSTESTRESULTVALUE")=VALUE
437 S ZRNF("VITALSIGNSTESTRESULTUNIT")=UNIT
438 Q
439 ;
440VITSORT(VDT) ; RUN DATE SORTING ALGORITHM
441 ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
442 ; OF DATES IN THE VITALS RESULTS
443 N VDTI,VDTJ,VTDCNT
444 S VTDCNT=0 ; COUNT TO BUILD ARRAY
445 S VDTJ="" ; USED TO VISIT THE RESULTS
446 F VDTI=0:0 D Q:$O(VIT(VDTJ))="" ; VISIT ALL RESULTS
447 . S VDTJ=$O(VIT(VDTJ)) ; NEXT RESULT
448 . S VTDCNT=VTDCNT+1 ; INCREMENT COUNTER
449 . S VDT(VTDCNT)=$P(VIT(VDTJ),U,4) ; PULL OUT THE DATE
450 S VDT(0)=VTDCNT
451 Q
452 ;
453MAP(VITXML,C0CVIT,VITOUT) ; MAP VITAL SIGNS XML
454 ;
455 N ZTEMP S ZTEMP=$NA(^TMP("C0CCCR",$J,DFN,"VITTEMP")) ;WORK AREA FOR TEMPLATE
456 K @ZTEMP
457 N ZBLD
458 S ZBLD=$NA(^TMP("C0CCCR",$J,DFN,"VITBLD")) ; BUILD LIST AREA
459 D QUEUE^C0CXPATH(ZBLD,VITXML,1,1) ; FIRST LINE
460 N ZINNER
461 ; XPATH NEEDS TO MATCH YOUR SECTION
462 D QUERY^C0CXPATH(VITXML,"//VitalSigns/Result","ZINNER") ;ONE VITAL SIGN
463 N ZTMP,ZVAR,ZI
464 S ZI=""
465 F S ZI=$O(@C0CVIT@("V",ZI)) Q:ZI="" D ;FOR EACH VITAL SIGN
466 . S ZTMP=$NA(@ZTEMP@(ZI)) ;THIS VITAL SIGN XML
467 . S ZVAR=$NA(@C0CVIT@("V",ZI)) ;THIS VITAL SIGN VARIABLES
468 . D MAP^C0CXPATH("ZINNER",ZVAR,ZTMP) ; MAP THE VITAL SIGN
469 . D QUEUE^C0CXPATH(ZBLD,ZTMP,1,@ZTMP@(0)) ;QUEUE FOR BUILD
470 D QUEUE^C0CXPATH(ZBLD,VITXML,@VITXML@(0),@VITXML@(0))
471 N ZZTMP ; IS THIS NEEDED?
472 D BUILD^C0CXPATH(ZBLD,VITOUT) ;BUILD FINAL XML
473 K @ZTEMP,@ZBLD
474 Q
475 ;
Note: See TracBrowser for help on using the repository browser.