85 lines
5.0 KiB
Mathematica
85 lines
5.0 KiB
Mathematica
GPLVITALS ; CCDCCR/CJE - CCR/CCD PROCESSING FOR VITALS ; 07/03/08
|
|
;;0.1;CCDCCR;;JUL 3,2008;
|
|
EXTRACT(VITXML,DFN,VITOUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
|
|
;
|
|
; VITXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
|
; IVITXML WILL CONTAIN ONLY THE VITALS SECTION OF THE OVERALL TEMPLATE
|
|
;
|
|
N VITRSLT,J,K,VITPTMP,X,VITVMAP,TBUF
|
|
D VITALS^ORQQVI(.VITRSLT,DFN,"","")
|
|
I '$D(VITRSLT(1)) W "ERROR RUNNINIG VITALS RPC",! Q
|
|
; ZWR RPCRSLT
|
|
S VITTVMAP=$NA(^TMP("GPLCCR",$J,"VITALS"))
|
|
S VITTARYTMP=$NA(^TMP("GPLCCR",$J,"VITALARYTMP"))
|
|
F J=1:1:VITRSLT(1) D ; FOR EACH VITAL IN THE LIST
|
|
. I $D(VITRSLT(J)) D
|
|
. . S VITVMAP=$NA(@VITTVMAP@(J))
|
|
. . K @VITVMAP
|
|
. . I DEBUG W "VMAP= ",VMAP,!
|
|
. . S VITPTMP=VITRSLT(J) ; PULL OUT VITAL FROM RPC RETURN ARRAY
|
|
. . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID FOR VITAL
|
|
. . I $P(VITPTMP,U,2)="HT" D
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="in"
|
|
. . . ;S @VITVMAP@("HEIGHTWEIGHTSOURCE")=$P(VITPTMP,U,7)
|
|
. . E I $P(VITPTMP,U,2)="WT" D
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="lbs"
|
|
. . E D
|
|
. . . ;W "IN VITAL: OTHER",!
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER VITAL"
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER"
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="UNKNOWN"
|
|
. . . ;S @VITVMAP@("HEIGHTWEIGHTSOURCE")=$P(VITPTMP,U,7)
|
|
. . S VITARYTMP=$NA(@VITTARYTMP@(J))
|
|
. . K @VITARYTMP
|
|
. . D MAP^GPLXPATH(VITXML,VITVMAP,VITARYTMP)
|
|
. . I J=1 D ; FIRST ONE IS JUST A COPY
|
|
. . . ; W "FIRST ONE",!
|
|
. . . D CP^GPLXPATH(VITARYTMP,VITOUTXML)
|
|
. . . ; W "OUTXML ",OUTXML,!
|
|
. . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
|
|
. . . D INSINNER^GPLXPATH(VITOUTXML,VITARYTMP)
|
|
; ZWR ^TMP($J,"VITALS",*)
|
|
; ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
|
|
; ZWR @OUTXML
|
|
N VITTMP,I
|
|
D MISSING^GPLXPATH(VITOUTXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
|
|
I VITTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
|
|
. W "VITALS MISSING ",!
|
|
. F I=1:1:VITTMP(0) W VITTMP(I),!
|
|
Q
|
|
;
|