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

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

support for incoming CCDs

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