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

Last change on this file since 707 was 707, checked in by Christopher Edwards, 15 years ago

Fixed variable reference for VistA vitals

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