GMRVPS11 ;HIRMFO/NCA - Convert Oximetry Supplemental Data ;7/18/96
;;4.0;Vitals/Measurements;**11**;Apr 25, 1997
EN1 ; Convert if data is stored #% # l/min
Q:$$PATCH^XPDUTL("GMRV*4.0*11*")
N GMRVL,GMRX,GMRX1,GMRX2,GMRX3,GMRVOK,GMRVPO S GMRVOK=0
F GMRVL=0:0 S GMRVL=$O(^GMR(120.5,GMRVL)) Q:GMRVL<1 S GMRVPO=$P($G(^(GMRVL,0)),"^",10) D CONV S:GMRVOK $P(^GMR(120.5,GMRVL,0),"^",10)=GMRVPO
Q
CONV ; Process Data Convert
S GMRVOK=0
Q:GMRVPO=""
I GMRVPO'["l/min" D Q
.I GMRVPO["%" S GMRX=+GMRVPO,GMRX1=$P(GMRVPO,GMRX,2) S:$E(GMRX1,1)=" " GMRX1=$TR(GMRX1," ",""),GMRVPO=GMRX_GMRX1,GMRVOK=1
.Q
I GMRVPO["l/min" D
.S GMRX=$F(GMRVPO,"%") I 'GMRX S:$E(GMRVPO,$L(GMRVPO))=" " GMRVOK=1,GMRVPO=$E(GMRVPO,1,$L(GMRVPO)-1) Q
.S GMRX1=$F(GMRVPO,"l/min") Q:'GMRX1
.I GMRX<GMRX1 D
..S GMRVOK=1
..S GMRX2=$E(GMRVPO,1,GMRX-1),GMRX3=$E(GMRVPO,GMRX+1,GMRX1-1)
..S:GMRX2[" " GMRX2=$TR(GMRX2," ","")
..S GMRVPO=GMRX3_" "_GMRX2
..Q
.I GMRX>GMRX1 D
..S GMRX2=$P(GMRVPO,"l/min ",2) Q:'GMRX2
..I GMRX2[" " S GMRVOK=1,GMRX2=$TR(GMRX2," ",""),$P(GMRVPO,"l/min ",2)=GMRX2
..Q
.Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRVPS11 1103 printed Oct 16, 2024@17:58:08 Page 2
GMRVPS11 ;HIRMFO/NCA - Convert Oximetry Supplemental Data ;7/18/96
+1 ;;4.0;Vitals/Measurements;**11**;Apr 25, 1997
EN1 ; Convert if data is stored #% # l/min
+1 if $$PATCH^XPDUTL("GMRV*4.0*11*")
QUIT
+2 NEW GMRVL,GMRX,GMRX1,GMRX2,GMRX3,GMRVOK,GMRVPO
SET GMRVOK=0
+3 FOR GMRVL=0:0
SET GMRVL=$ORDER(^GMR(120.5,GMRVL))
if GMRVL<1
QUIT
SET GMRVPO=$PIECE($GET(^(GMRVL,0)),"^",10)
DO CONV
if GMRVOK
SET $PIECE(^GMR(120.5,GMRVL,0),"^",10)=GMRVPO
+4 QUIT
CONV ; Process Data Convert
+1 SET GMRVOK=0
+2 if GMRVPO=""
QUIT
+3 IF GMRVPO'["l/min"
Begin DoDot:1
+4 IF GMRVPO["%"
SET GMRX=+GMRVPO
SET GMRX1=$PIECE(GMRVPO,GMRX,2)
if $EXTRACT(GMRX1,1)=" "
SET GMRX1=$TRANSLATE(GMRX1," ","")
SET GMRVPO=GMRX_GMRX1
SET GMRVOK=1
+5 QUIT
End DoDot:1
QUIT
+6 IF GMRVPO["l/min"
Begin DoDot:1
+7 SET GMRX=$FIND(GMRVPO,"%")
IF 'GMRX
if $EXTRACT(GMRVPO,$LENGTH(GMRVPO))=" "
SET GMRVOK=1
SET GMRVPO=$EXTRACT(GMRVPO,1,$LENGTH(GMRVPO)-1)
QUIT
+8 SET GMRX1=$FIND(GMRVPO,"l/min")
if 'GMRX1
QUIT
+9 IF GMRX<GMRX1
Begin DoDot:2
+10 SET GMRVOK=1
+11 SET GMRX2=$EXTRACT(GMRVPO,1,GMRX-1)
SET GMRX3=$EXTRACT(GMRVPO,GMRX+1,GMRX1-1)
+12 if GMRX2[" "
SET GMRX2=$TRANSLATE(GMRX2," ","")
+13 SET GMRVPO=GMRX3_" "_GMRX2
+14 QUIT
End DoDot:2
+15 IF GMRX>GMRX1
Begin DoDot:2
+16 SET GMRX2=$PIECE(GMRVPO,"l/min ",2)
if 'GMRX2
QUIT
+17 IF GMRX2[" "
SET GMRVOK=1
SET GMRX2=$TRANSLATE(GMRX2," ","")
SET $PIECE(GMRVPO,"l/min ",2)=GMRX2
+18 QUIT
End DoDot:2
+19 QUIT
End DoDot:1
+20 QUIT