Changeset 560


Ignore:
Timestamp:
Sep 15, 2009, 12:27:19 PM (15 years ago)
Author:
Christopher Edwards
Message:

Added initial support for pulling RPMS vitalsigns

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/p/C0CVITAL.m

    r508 r560  
    3333 D DT^DILF(,C0CVSTRT,.C0CSDT) ;
    3434 W "VITALS START: ",C0CVSTRT," LIMIT: ",C0CVLMT,!
     35 I $$SYSNAME^C0CSYS()="RPMS" D VITRPMS E  D VITVISTA
     36 Q
     37 ;
     38VITVISTA        ; EXTRACT VITALS FROM VISTA INTO PROVIDED XML TEMPLATE
    3539 D VITALS^ORQQVI(.VITRSLT,DFN,C0CSDT,C0CEDT)
    3640 I '$D(VITRSLT(1)) S @VITOUTXML@(0)=0 Q  ; RETURN NOT FOUND AND QUIT
     
    4448 K @VITTVMAP,@VITTARYTMP ; KILL OLD ARRAY VALUES
    4549 N VSORT,VDATES,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
    46  D VITDATES(.VDATES) ; PULL OUT THE DATES INTO AN ARRAY
     50 D VITDVISTA(.VDATES) ; PULL OUT THE DATES INTO AN ARRAY
    4751 ; I DEBUG ZWR VDATES ;DEBUG
    4852 S VCNT=$$SORTDT^C0CUTIL(.VSORT,.VDATES,-1) ; PUT VITALS IN REVERSE
     
    191195 Q
    192196 ;
    193 VITDATES(VDT)   ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
     197VITRPMS ; EXTRACT VITALS FROM RPMS INTO PROVIDED XML TEMPLATE
     198 ; RPMS VITAL RPC ONLY RETURNS LATEST VITAL IN SPECIFIED DATE RANGE NOT ALL VITALS IN DATE RANGE
     199 ; WE NEED TO SETUP THE VARIABLES THE INTERNAL CALL NEEDS TO BYPASS A HARD CODE OF ONE VITAL
     200 N END,START,DATA
     201 S END=C0CVLMT,START=C0CVSTRT
     202 ; RPC OUTPUT FORMAT:
     203 ; vfile ien^vital name^vital abbr^date/time taken(FM FORMAT)^value+units (US & metric)
     204 D QUERY^BEHOVM("LISTX") ; RUN QUERY VITALS CALL
     205 I '$D(^TMP("CIAVMRPC",$J)) S @VITOUTXML@(0)=0 Q  ; RETURN NOT FOUND AND QUIT
     206 ZW ^TMP("CIAVMRPC",$J)
     207 S VITTVMAP=$NA(^TMP("C0CCCR",$J,"VITALS"))
     208 S VITTARYTMP=$NA(^TMP("C0CCCR",$J,"VITALARYTMP"))
     209 K @VITTVMAP,@VITTARYTMP ; KILL OLD ARRAY VALUES
     210 N VSORT,VDATES,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
     211 D VITDRPMS(.VDATES) ; PULL OUT THE DATES INTO AN ARRAY
     212 S VCNT=$$SORTDT^C0CUTIL(.VSORT,.VDATES,-1) ; PUT VITALS IN REVERSE
     213 ; DATE ORDER AND COUNT THEM. VSORT CONTAINS INDIRECT INDEXES ONLY
     214 S @VITTVMAP@(0)=VCNT ; SAVE NUMBER OF VITALS
     215 F J=1:1:VCNT  D  ; FOR EACH VITAL IN THE LIST
     216 . I $D(^TMP("CIAVMRPC",$J,0,(VSORT(J)))) D
     217 . . S VITVMAP=$NA(@VITTVMAP@(J))
     218 . . K @VITVMAP
     219 . . I DEBUG W "VMAP= ",VITVMAP,!
     220 . . S VITPTMP=^TMP("CIAVMRPC",$J,0,(VSORT(J))) ; DATE SORTED VITAL FROM RETURN ARRAY
     221 . . I DEBUG W "VITAL ",VSORT(J),!
     222 . . I DEBUG W ^TMP("CIAVMRPC",$J,0,(VSORT(J)))," ",$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT"),!
     223 . . I DEBUG W $P(VITPTMP,U,4),!
     224 . . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID
     225 . . I $P(VITPTMP,U,3)="HT" D
     226 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     227 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
     228 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
     229 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
     230 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     231 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     232 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
     233 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="248327008"
     234 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
     235 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
     236 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^AUPNVMSR($P(VITPTMP,U,1),12),U,4)
     237 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
     238 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="in"
     239 . . E  I $P(VITPTMP,U,3)="WT" D
     240 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     241 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
     242 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
     243 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
     244 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     245 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     246 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
     247 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="107647005"
     248 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
     249 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
     250 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^AUPNVMSR($P(VITPTMP,U,1),12),U,4)
     251 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
     252 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="lbs"
     253 . . E  I $P(VITPTMP,U,3)="BP" D
     254 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     255 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
     256 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
     257 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
     258 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     259 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     260 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
     261 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="392570002"
     262 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
     263 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
     264 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^AUPNVMSR($P(VITPTMP,U,1),12),U,4)
     265 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
     266 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
     267 . . E  I $P(VITPTMP,U,3)="TMP" D
     268 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     269 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
     270 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
     271 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
     272 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     273 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     274 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
     275 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="309646008"
     276 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
     277 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
     278 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^AUPNVMSR($P(VITPTMP,U,1),12),U,4)
     279 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
     280 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="F"
     281 . . E  I $P(VITPTMP,U,3)="RS" D
     282 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     283 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
     284 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
     285 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
     286 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     287 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     288 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
     289 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="366147009"
     290 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
     291 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
     292 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^AUPNVMSR($P(VITPTMP,U,1),12),U,4)
     293 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
     294 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
     295 . . E  I $P(VITPTMP,U,3)="PU" D
     296 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     297 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
     298 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
     299 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
     300 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     301 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     302 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
     303 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="366199006"
     304 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
     305 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
     306 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^AUPNVMSR($P(VITPTMP,U,1),12),U,4)
     307 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
     308 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
     309 . . E  I $P(VITPTMP,U,3)="PA" D
     310 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     311 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
     312 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
     313 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
     314 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     315 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     316 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
     317 . . . S @VITVMAP@("VITALSIGNSDESCCODEVALUE")="22253000"
     318 . . . S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")="SNOMED"
     319 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
     320 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^AUPNVMSR($P(VITPTMP,U,1),12),U,4)
     321 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
     322 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
     323 . . E  D
     324 . . . ;W "IN VITAL:  OTHER",!
     325 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
     326 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^C0CUTIL($P(VITPTMP,U,4),"DT")
     327 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")=$P(VITPTMP,U,2)
     328 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
     329 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
     330 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
     331 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")=$P(VITPTMP,U,2)
     332 . . . ;S @VITVMAP@("VITALSIGNSDESCCODEVALUE")=""
     333 . . . ;S @VITVMAP@("VITALSIGNSDESCCODINGSYSTEM")=""
     334 . . . ;S @VITVMAP@("VITALSIGNSCODEVERSION")=""
     335 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^AUPNVMSR($P(VITPTMP,U,1),12),U,4)
     336 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P($P(VITPTMP,U,5)," ",1)
     337 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=$P($P(VITPTMP,U,5)," ",2)
     338 . . S VITARYTMP=$NA(@VITTARYTMP@(J))
     339 . . K @VITARYTMP
     340 . . D MAP^C0CXPATH(VITXML,VITVMAP,VITARYTMP)
     341 . . I J=1 D  ; FIRST ONE IS JUST A COPY
     342 . . . ; W "FIRST ONE",!
     343 . . . D CP^C0CXPATH(VITARYTMP,VITOUTXML)
     344 . . . I DEBUG W "VITOUTXML ",VITOUTXML,!
     345 . . I J>1 D  ; AFTER THE FIRST, INSERT INNER XML
     346 . . . D INSINNER^C0CXPATH(VITOUTXML,VITARYTMP)
     347 ; ZWR ^TMP($J,"VITALS",*)
     348 ; ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
     349 I DEBUG D PARY^C0CXPATH(VITOUTXML)
     350 N VITTMP,I
     351 D MISSING^C0CXPATH(VITOUTXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
     352 I VITTMP(0)>0 D  ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
     353 . W "VITALS MISSING ",!
     354 . F I=1:1:VITTMP(0) W VITTMP(I),!
     355 Q
     356 ;
     357 ;VITDATES(VDT) ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
     358 ; OF DATES IN THE VITALS RESULTS
     359 ;N VDTI,VDTJ,VTDCNT
     360 ;S VTDCNT=0 ; COUNT TO BUILD ARRAY
     361 ;S VDTJ="" ; USED TO VISIT THE RESULTS
     362 ;I $$SYSNAME^C0CSYS()="RPMS" D VITDRPMS E  D VITDVISTA
     363 ;
     364VITDRPMS(VDT)   ; RUN DATE SORTING ALGORITHM FOR RPMS
     365 ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
     366 ; OF DATES IN THE VITALS RESULTS
     367 N VDTI,VDTJ,VTDCNT
     368 S VTDCNT=0 ; COUNT TO BUILD ARRAY
     369 S VDTJ="" ; USED TO VISIT THE RESULTS
     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 ;
     377VITDVISTA(VDT)  ; RUN DATE SORTING ALGORITHM FOR VISTA
     378 ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
    194379 ; OF DATES IN THE VITALS RESULTS
    195380 N VDTI,VDTJ,VTDCNT
Note: See TracChangeset for help on using the changeset viewer.