VistA-ccr/p/GPLVITALS.m

50 lines
2.0 KiB
Mathematica

GPLVITALS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR VITALS ; 6/6/08
;;0.1;CCDCCR;nopatch;noreleasedate
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($J,"VITALS"))
S VITTARYTMP=$NA(^TMP($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@("DATAOBJECTID")="VITAL"_J ; UNIQUE OBJID FOR VITAL
. . I $P(VITPTMP,U,2)="HT" D
. . . S @VITVMAP@("HEIGHTWEIGHTDATATIME")=$P(VITPTMP,U,4)
. . . S @VITVMAP@("HEIGHTWEIGHTSOURCE")=$P(VITPTMP,U,7)
. . . S @VITVMAP@("HEIGHTSOURCEID")=$P(VITPTMP,U,1)
. . . S @VITVMAP@("HEIGHTINCHES")=$P(VITPTMP,U,3)
. . I $P(VITPTMP,U,2)="WT" D
. . . S @VITVMAP@("WEIGHTSOURCEID")=$P(VITPTMP,U,1)
. . . S @VITVMAP@("WEIGHTLBS")=$P(VITPTMP,U,3)
. . 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
; W "OUT OF FOR LOOP.",!
;ZWR
; ZWR @OUTXML
; $$HTML^DILF(
N VITTMP,I
D MISSING^GPLXPATH(VITXML,"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