VistA-WorldVistAEHR/r/GEN_MED_OTHER-GMV/GMVLPO1.m

31 lines
1.4 KiB
Mathematica

GMVLPO1 ;HIOFO/YH,FT-DOT MATRIX PULSE OXIMETRY AND RESPIRATION GRAPH ;11/6/01 15:44
;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
;
; This routine uses the following IAs:
; <None>
;
SETHD ;
;GMRPO2 - PO2 VALUE WHEN $Y=1 GMRPO2(1) - LABEL
;GMRY - $Y FOR LABEL
;GMRESP - RESPIRATION VALUE WHEN $Y=1 GMRESP(1) - LABEL
S GMR3=(($Y/3)=($Y\3)),GMRPHI=GMRPO2-(($Y-1)*0.666),GMRPLO=GMRPHI-0.666
S GMRRHI=GMRESP-(($Y-1)*0.666),GMRRLO=GMRRHI-0.666
S GMRHDR10=$S($Y=GMRY&(GMRPO2(1)>62)&($Y>5)&($Y<66):$E(GMRPO2(1)_" ",1,4)_GMRESP(1),1:"")
I $Y=GMRY S GMRY=GMRY+3,GMRPO2(1)=GMRPO2(1)-2,GMRESP(1)=GMRESP(1)-2
Q
DATAPRT ;
S GMRLINE=GMRX1
S GMRNM=0 F GMRDT=0:0 S GMRDT=$O(^TMP($J,"GMRDT",GMRDT)) Q:GMRDT'>0 D SETLINE Q:GMRNM=10
W GMRLINE
Q
SETLINE ;
S GMRNM=GMRNM+1,GMROLD=$P(GMRLINE,"|",GMRNM)
S (GP,GMRP)=$O(^TMP($J,"GMRVG","PO2",GMRDT,"")) S:GMRP="0" GP=.1
S (GR,GMRR)=$O(^TMP($J,"GMRVG","R",GMRDT,""))
;S:GMRR="0" GR=.1
S GMRPOFF=($Y=6&(+GP>101))!($Y=62&(+GP<65)),GMRROFF=($Y=6&(+GR>41))!($Y=62&(+GR<5))
S GMROLD=$S(+GP>0&(+GP'<GMRPLO&(+GP'>GMRPHI)!GMRPOFF):"POx"_$S('$P(^TMP($J,"GMRVG","PO2",GMRDT,GMRP),"^",2):" ",1:"*")_$S('GMRPOFF:" ",1:"*")_$E(GMROLD,4,10),1:GMROLD)
S GMROLD=$E(GMROLD,1,5)_$S(GR>0&(+GR'<GMRRLO&(+GR'>GMRRHI)!GMRROFF):"R"_$S('$P(^TMP($J,"GMRVG","R",GMRDT,GMRR),"^",2):" ",1:"*")_$S('GMRROFF:" ",1:"*")_$E(GMROLD,9,10),1:$E(GMROLD,6,10))
S $P(GMRLINE,"|",GMRNM)=GMROLD
Q