source: ccr/trunk/p/C0CVITAL.m@ 927

Last change on this file since 927 was 910, checked in by George Lilly, 14 years ago

update to get BMI and other new vitals

File size: 20.7 KB
Line 
1C0CVITAL ; CCDCCR/CJE/GPL - CCR/CCD PROCESSING FOR VITALS ; 07/16/08
2 ;;1.0;C0C;;May 19, 2009;
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,VITOUTXML) ; EXTRACT VITALS INTO PROVIDED XML TEMPLATE
25 ;
26 ; VITXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
27 ; IVITXML CONTAINS ONLY THE VITALS SECTION OF THE OVERALL TEMPLATE
28 ;
29 N VITRSLT,J,K,VITPTMP,X,VITVMAP,TBUF,VORDR
30 S C0CVLMT=$$GET^C0CPARMS("VITLIMIT") ; GET THE LIMIT PARM
31 S C0CVSTRT=$$GET^C0CPARMS("VITSTART") ; GET START PARM
32 D DT^DILF(,C0CVLMT,.C0CEDT) ;
33 D DT^DILF(,C0CVSTRT,.C0CSDT) ;
34 ;D DT^DILF(,C0CVLMT,.C0CSDT) ; GPL TESTING
35 ;D DT^DILF(,C0CVSTRT,.C0CEDT) ;
36 W "VITALS START: ",C0CVSTRT," LIMIT: ",C0CVLMT,!
37 I $$RPMS^C0CUTIL() D VITRPMS QUIT
38 I ($$VISTA^C0CUTIL())!($$WV^C0CUTIL())!($$OV^C0CUTIL()) D VITVISTA QUIT
39 ;I $$SYSNAME^C0CSYS()="RPMS" D VITRPMS
40 ;E D VITVISTA
41 Q
42 ;
43VITVISTA ; EXTRACT VITALS FROM VISTA INTO PROVIDED XML TEMPLATE
44 D FASTVIT^ORQQVI(.VITRSLT,DFN,C0CEDT,C0CSDT) ; GPL THIS ONE WORKS FOR AT
45 ; LEAST ONE SET OF VITALS - TO DO, CALL IT REPETIVELY TO GET EARLIER VITALS
46 ;D VITALS^ORQQVI(.VITRSLT,DFN,C0CEDT,C0CSDT)
47 ;D VITALS^ORQQVI(.VITRSLT,DFN,C0CSDT,C0CEDT)
48 ;D VITALS^ORQQVI(.VITRSLT,DFN,C0CVSTRT,C0CVLMT) ; GPL LET GMR HANDLE THE DATES
49 I '$D(VITRSLT(1)) S @VITOUTXML@(0)=0 Q ; RETURN NOT FOUND AND QUIT
50 I $P(VITRSLT(1),U,2)="No vitals found." D Q ; NULL RESULT FROM RPC
51 . I DEBUG W "NO VITALS FOUND FROM VITALS RPC",!
52 . S @VITOUTXML@(0)=0
53 I $P(VITRSLT(1),U,2)="No vitals found." Q ; QUIT
54 ; ZWR RPCRSLT
55 S VITTVMAP=$NA(^TMP("C0CCCR",$J,"VITALS"))
56 S VITTARYTMP=$NA(^TMP("C0CCCR",$J,"VITALARYTMP"))
57 K @VITTVMAP,@VITTARYTMP ; KILL OLD ARRAY VALUES
58 N VSORT,VDATES,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
59 D VITDVISTA(.VDATES) ; PULL OUT THE DATES INTO AN ARRAY
60 ; I DEBUG ZWR VDATES ;DEBUG
61 S VCNT=$$SORTDT^C0CUTIL(.VSORT,.VDATES,-1) ; PUT VITALS IN REVERSE
62 ; DATE ORDER AND COUNT THEM. VSORT CONTAINS INDIRECT INDEXES ONLY
63 S @VITTVMAP@(0)=VCNT ; SAVE NUMBER OF VITALS
64 F J=1:1:VCNT D ; FOR EACH VITAL IN THE LIST
65 . I $D(VITRSLT(VSORT(J))) D
66 . . S VITVMAP=$NA(@VITTVMAP@(J))
67 . . K @VITVMAP
68 . . I DEBUG W "VMAP= ",VITVMAP,!
69 . . S VITPTMP=VITRSLT(VSORT(J)) ; DATE SORTED VITAL FROM RETURN ARRAY
70 . . I DEBUG W "VITAL ",VSORT(J),!
71 . . I DEBUG W VITRSLT(VSORT(J))," ",$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT"),!
72 . . I DEBUG W $P(VITPTMP,U,4),!
73 . . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID
74 . . I $P(VITPTMP,U,2)="HT" D
75 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
76 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
77 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
78 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
79 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
80 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
81 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
82 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="248327008"
83 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
84 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
85 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
86 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
87 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="in"
88 . . E I $P(VITPTMP,U,2)="WT" D
89 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
90 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
91 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
92 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
93 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
94 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
95 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
96 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="107647005"
97 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
98 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
99 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
100 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
101 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="lbs"
102 . . E I $P(VITPTMP,U,2)="BP" D
103 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
104 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
105 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
106 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
107 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
108 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
109 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
110 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="392570002"
111 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
112 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
113 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
114 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
115 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
116 . . E I $P(VITPTMP,U,2)="T" D
117 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
118 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
119 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
120 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
121 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
122 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
123 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
124 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="309646008"
125 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
126 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
127 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
128 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
129 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="F"
130 . . E I $P(VITPTMP,U,2)="R" D
131 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
132 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
133 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
134 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
135 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
136 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
137 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
138 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="366147009"
139 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
140 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
141 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
142 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
143 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
144 . . E I $P(VITPTMP,U,2)="P" D
145 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
146 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
147 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
148 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
149 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
150 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
151 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
152 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="366199006"
153 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
154 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
155 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
156 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
157 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
158 . . E I $P(VITPTMP,U,2)="PN" D
159 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
160 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
161 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
162 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
163 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
164 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
165 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
166 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="22253000"
167 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
168 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
169 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
170 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
171 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
172 . . E D
173 . . . ;W "IN VITAL: OTHER",!
174 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
175 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
176 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER VITAL"
177 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
178 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
179 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="UNKNOWN"
180 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER"
181 . . . ;S @VITVMAP@("VITALSIGNSDESCCODEVALUE")=""
182 . . . ;S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")=""
183 . . . ;S @VITVMAP@("VITALSIGNSCODEVERSION")=""
184 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
185 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
186 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="UNKNOWN"
187 . . S VITARYTMP=$NA(@VITTARYTMP@(J))
188 . . K @VITARYTMP
189 . . D MAP^C0CXPATH(VITXML,VITVMAP,VITARYTMP)
190 . . I J=1 D ; FIRST ONE IS JUST A COPY
191 . . . ; W "FIRST ONE",!
192 . . . D CP^C0CXPATH(VITARYTMP,VITOUTXML)
193 . . . I DEBUG W "VITOUTXML ",VITOUTXML,!
194 . . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
195 . . . D INSINNER^C0CXPATH(VITOUTXML,VITARYTMP)
196 ; ZWR ^TMP($J,"VITALS",*)
197 ; ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
198 I DEBUG D PARY^C0CXPATH(VITOUTXML)
199 N VITTMP,I
200 D MISSING^C0CXPATH(VITOUTXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
201 I VITTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
202 . W "VITALS MISSING ",!
203 . F I=1:1:VITTMP(0) W VITTMP(I),!
204 Q
205 ;
206VITRPMS ; EXTRACT VITALS FROM RPMS INTO PROVIDED XML TEMPLATE
207 ; RPMS VITAL RPC ONLY RETURNS LATEST VITAL IN SPECIFIED DATE RANGE NOT ALL VITALS IN DATE RANGE
208 ; WE NEED TO SETUP THE VARIABLES THE INTERNAL CALL NEEDS TO BYPASS A HARD CODE OF ONE VITAL FOR DATE RANGE
209 N END,START,DATA
210 D DT^DILF("",C0CVLMT,.END)
211 D DT^DILF("",C0CVSTRT,.START)
212 ; RPC OUTPUT FORMAT:
213 ; vfile ien^vital name^vital abbr^date/time taken(FM FORMAT)^value+units (US & metric)
214 D QUERY^BEHOVM("LISTX") ; RUN QUERY VITALS CALL
215 I '$D(^TMP("CIAVMRPC",$J)) S @VITOUTXML@(0)=0 Q ; RETURN NOT FOUND AND QUIT
216 ;ZW ^TMP("CIAVMRPC",$J)
217 S VITTVMAP=$NA(^TMP("C0CCCR",$J,"VITALS"))
218 S VITTARYTMP=$NA(^TMP("C0CCCR",$J,"VITALARYTMP"))
219 K @VITTVMAP,@VITTARYTMP ; KILL OLD ARRAY VALUES
220 N VSORT,VDATES,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
221 D VITDRPMS(.VDATES) ; PULL OUT THE DATES INTO AN ARRAY
222 S VCNT=$$SORTDT^C0CUTIL(.VSORT,.VDATES,-1) ; PUT VITALS IN REVERSE
223 ; DATE ORDER AND COUNT THEM. VSORT CONTAINS INDIRECT INDEXES ONLY
224 S @VITTVMAP@(0)=VCNT ; SAVE NUMBER OF VITALS
225 F J=1:1:VCNT D ; FOR EACH VITAL IN THE LIST
226 . I $D(^TMP("CIAVMRPC",$J,0,(VSORT(J)))) D
227 . . S VITVMAP=$NA(@VITTVMAP@(J))
228 . . K @VITVMAP
229 . . I DEBUG W "VMAP= ",VITVMAP,!
230 . . S VITPTMP=^TMP("CIAVMRPC",$J,0,(VSORT(J))) ; DATE SORTED VITAL FROM RETURN ARRAY
231 . . I DEBUG W "VITAL ",VSORT(J),!
232 . . I DEBUG W ^TMP("CIAVMRPC",$J,0,(VSORT(J)))," ",$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT"),!
233 . . I DEBUG W $P(VITPTMP,U,4),!
234 . . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID
235 . . I $P(VITPTMP,U,3)="HT" D
236 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
237 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
238 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
239 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
240 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
241 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
242 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
243 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="248327008"
244 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
245 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
246 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VITPTMP,U,1),12)),U,4)
247 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
248 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=$P($P(VITPTMP,U,5)," ",2)
249 . . E I $P(VITPTMP,U,3)="WT" D
250 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
251 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
252 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
253 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
254 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
255 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
256 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
257 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="107647005"
258 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
259 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
260 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VITPTMP,U,1),12)),U,4)
261 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
262 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=$P($P(VITPTMP,U,5)," ",2)
263 . . E I $P(VITPTMP,U,3)="BP" D
264 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
265 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
266 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
267 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
268 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
269 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
270 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
271 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="392570002"
272 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
273 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
274 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VITPTMP,U,1),12)),U,4)
275 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
276 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=$P($P(VITPTMP,U,5)," ",2)
277 . . E I $P(VITPTMP,U,3)="TMP" D
278 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
279 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
280 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
281 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
282 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
283 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
284 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
285 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="309646008"
286 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
287 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
288 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VITPTMP,U,1),12)),U,4)
289 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
290 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=$P($P(VITPTMP,U,5)," ",2)
291 . . E I $P(VITPTMP,U,3)="RS" D
292 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
293 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
294 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
295 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
296 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
297 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
298 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
299 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="366147009"
300 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
301 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
302 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VITPTMP,U,1),12)),U,4)
303 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
304 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=$P($P(VITPTMP,U,5)," ",2)
305 . . E I $P(VITPTMP,U,3)="PU" D
306 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
307 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
308 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
309 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
310 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
311 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
312 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
313 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="366199006"
314 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
315 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
316 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VITPTMP,U,1),12)),U,4)
317 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
318 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=$P($P(VITPTMP,U,5)," ",2)
319 . . E I $P(VITPTMP,U,3)="PA" D
320 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
321 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
322 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
323 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
324 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
325 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
326 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
327 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="22253000"
328 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
329 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
330 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VITPTMP,U,1),12)),U,4)
331 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
332 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=$P($P(VITPTMP,U,5)," ",2)
333 . . E D
334 . . . ;W "IN VITAL: OTHER",!
335 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
336 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
337 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")=$P(VITPTMP,U,2)
338 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
339 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
340 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
341 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")=$P(VITPTMP,U,2)
342 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")=""
343 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")=""
344 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
345 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P($G(^AUPNVMSR($P(VITPTMP,U,1),12)),U,4)
346 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
347 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=$P($P(VITPTMP,U,5)," ",2)
348 . . S VITARYTMP=$NA(@VITTARYTMP@(J))
349 . . K @VITARYTMP
350 . . D MAP^C0CXPATH(VITXML,VITVMAP,VITARYTMP)
351 . . I J=1 D ; FIRST ONE IS JUST A COPY
352 . . . ; W "FIRST ONE",!
353 . . . D CP^C0CXPATH(VITARYTMP,VITOUTXML)
354 . . . I DEBUG W "VITOUTXML ",VITOUTXML,!
355 . . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
356 . . . D INSINNER^C0CXPATH(VITOUTXML,VITARYTMP)
357 ; ZWR ^TMP($J,"VITALS",*)
358 ; ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
359 I DEBUG D PARY^C0CXPATH(VITOUTXML)
360 N VITTMP,I
361 D MISSING^C0CXPATH(VITOUTXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
362 I VITTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
363 . W "VITALS MISSING ",!
364 . F I=1:1:VITTMP(0) W VITTMP(I),!
365 K ^TMP("CIAVMRPC",$J)
366 Q
367 ;
368VITDRPMS(VDT) ; RUN DATE SORTING ALGORITHM FOR RPMS
369 ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
370 ; OF DATES IN THE VITALS RESULTS
371 N VDTI,VDTJ,VTDCNT
372 S VTDCNT=0 ; COUNT TO BUILD ARRAY
373 S VDTJ="" ; USED TO VISIT THE RESULTS
374 F VDTI=0:0 D Q:$O(^TMP("CIAVMRPC",$J,0,VDTJ))="" ; VISIT ALL RESULTS
375 . S VDTJ=$O(^TMP("CIAVMRPC",$J,0,VDTJ)) ; NEXT RESULT
376 . S VTDCNT=VTDCNT+1 ; INCREMENT COUNTER
377 . S VDT(VTDCNT)=$P(^TMP("CIAVMRPC",$J,0,VDTJ),U,4) ; PULL OUT THE DATE
378 S VDT(0)=VTDCNT
379 Q
380 ;
381VITDVISTA(VDT) ; RUN DATE SORTING ALGORITHM FOR VISTA
382 ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
383 ; OF DATES IN THE VITALS RESULTS
384 N VDTI,VDTJ,VTDCNT
385 S VTDCNT=0 ; COUNT TO BUILD ARRAY
386 S VDTJ="" ; USED TO VISIT THE RESULTS
387 F VDTI=0:0 D Q:$O(VITRSLT(VDTJ))="" ; VISIT ALL RESULTS
388 . S VDTJ=$O(VITRSLT(VDTJ)) ; NEXT RESULT
389 . S VTDCNT=VTDCNT+1 ; INCREMENT COUNTER
390 . S VDT(VTDCNT)=$P(VITRSLT(VDTJ),U,4) ; PULL OUT THE DATE
391 S VDT(0)=VTDCNT
392 Q
393 ;
Note: See TracBrowser for help on using the repository browser.