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

Last change on this file since 577 was 569, checked in by George Lilly, 15 years ago

fix for Vitals on VistA

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