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