PSIVSP ;BIR/RGY,PR,CML3-DOSE PROCESSOR ;14-Aug-2014 10:08;DU
;;5.0; INPATIENT MEDICATIONS ;**30,37,41,50,56,74,83,111,133,138,134,213,1018**;16 DEC 97;Build 21
;
; Reference to ^PS(51.1 is supported by DBIA #2177
;Modified - IHS/MSC/MGH - 08/14/2014 - Line ENI+3 do not allow control characters
;
EN ;
Q:'$D(X)
S ATZERO=0 I X["@",$P(X,"@",2)=0 S ATZERO=1,X=$P(X,"@")
D EN^PSGS0 S (P(9),PSIVSC1)=$S($G(X)]"":X,1:$G(P(9))),P(11)=$S($G(PSGS0Y):PSGS0Y,1:$G(P(11))),(XT,P(15))=$S(($G(PSGS0XT)!($G(PSGS0XT)="O")!($G(PSGS0XT)="D")):$G(PSGS0XT),1:$G(P(15)))
I $G(ATZERO) S P(7)=1
K ATZERO Q
EN1 ;
S (PSIVAT,PSIVWAT,Y)="",XT=-1,X0=X,X=$S(X="ON CALL":X,X="ONCALL":X,X="ON-CALL":X,X="ONETIME":X,X="ONE-TIME":X,X="ONE TIME":X,X="1TIME":X,X="1 TIME":X,X="1-TIME":X,$L(X," ")<3:$P(X," "),1:$P(X," ",1,2))
S:$E(X)="^" X=$E(X,2,999) G:X="" Q S:X["@0" ATZERO=1 S X=$S(X["@0":$P(X,"@"),1:X),P(7)=$S($D(ATZERO):1,1:"") K ATZERO
I $S($D(^PS(51.1,"AC","PSJ",X)):1,1:$E($O(^(X)),1,$L(X))=X) D DIC I Y'<0 G SH
NS0 S Y=""
I $E(X,1,2)="AD" S XT=-1 Q
I $E(X,1,3)="BID"!($E(X,1,3)="TID")!($E(X,1,3)="QID") S XT=1440\$F("BTQ",$E(X))
E S:$E(X)="Q" X=$E(X,2,99) S:'X X=$E(X)["O"+1_X S I=+X,X=$P(X,I,2),XT=I*$S(X["'":1,(X["D"&(X'["AD"))!(X["AM")!(X["PM")!(X["HS"&(X'["THS")):1440,X["H"&(X'["TH"):60,X["AC"!(X["PC"):480,X["W":10080,X["M":40320,1:0),X=X0 D
. I 'XT,X'="NOW",X'="STAT",X'="ONCE",X'="ONE-TIME",X'="ONE TIME",X'="ONETIME",X'="1-TIME",X'="1 TIME",X'="1TIME",Y="" S XT=-1
SH ;
I +Y<1,$E(X0)'="^" W:$G(ON)'["P" " ",$S(XT=0&($S("^NOW^STAT^ONCE^ONE-TIME^ONETIME^1TIME^1-TIME^"[(U_$P(X," ")_U):1,X["1 TIME":1,1:X["ONE TIME")):"(ONCE ONLY)",XT>0:"Nonstandard schedule",XT<0:"",1:"(??)") W:XT>0 " (",XT," MINUTES)"
Q Q:X="ONE TIME"
N I S X0=$P(X," ")_$S($L(X0," ")-1:" ",1:"")_$P(X0," ",2,99) K:XT<0!($L(X0)>22) X S:$D(X) X=X0 K X0 S:$G(P(7)) XT="" Q
NEWQ ;N I S X0=$P(X," ")_$S($L(X0," ")-1:" ",1:"")_$P(X0," ",2,99) K:XT<0!($L(X0)>22) X S:$D(X) X=X0 S:P(7) X=X0 K X0 K:XT>0&('P(7)) X Q
Q
;
ENDL W " Dose limit .... " S PSIVMIN=P(15)*X,PSIVSD=+P(2)
I PSIVMIN<0 W !!," --- There is something wrong with this order !!",!," Call inpatient supervisor ....." S Y=-1 K PSIVMIN Q
I P(4)="P"!(P(5))!(P(23)="P"),PSIVMIN=0,"^NOW^STAT^ONCE^ONE-TIME^ONE TIME^ON CALL^ONETIME^1TIME^1 TIME^1-TIME^"'[(U_P(9)_U) D DLP G QDL
D ENT^PSIVWL
QDL I $D(X) S X=Y X ^DD("DD") W $P(Y,"@")," ",$P(Y,"@",2) S Y=X
Q
DLP ;
S X=X+1,$P(PSIVSD,".",2)=$P(PSIVSD,".",2)_$E("0000",1,4-$L($P(PSIVSD,".",2))) D CHK S X2=0,Y=1 I X<2 S Y=+PSIVSD G QDLP
I $P(PSIVSD,".",2)>$P(P(11),"-",$L(P(11),"-")) S X2=1 G OV
G:$P(P(11),"-")>$P(PSIVSD,".",2) OV
F Y=1:1 S X1=$P(P(11),"-",Y) I X1=$P(PSIVSD,".",2)!($P(PSIVSD,".",2)<X1) Q
OV I P(11)="" W $C(7)," ???",!?15,"*** You have not defined any administration times !!" K X Q
F Y=Y:1 S:$P(P(11),"-",Y)="" X2=X2+1,Y=0,X=X+1 S X=X-1 Q:X<1
S X=PSIVSD\1 I X2>0 S X1=PSIVSD D C^%DTC S X=$P(X,".") ; install with version 17.3 of fileman
S Y=+(X_"."_$P(P(11),"-",Y))
QDLP K X1,X2 Q
;
ENI ;
;IHS/MSC/MGH Validate infusion rate
;K:$L(X)<1!($L(X)>30)!(X["""")!($A(X)=45) X I '$D(X)!'$D(P(4)) Q
K:X'?1.30ANP!(X["""")!($A(X)=45) X I '$D(X)!'$D(P(4)) Q ;IHS/MSC/MGH DO NOT ALLOW CONTROL CHARACTERS
I P(4)="P"!(P(5))!(P(23)="P") Q:'X S X="INFUSE OVER "_X_" MINUTE"_$S(X>1:"S",1:"") W " ",X Q
I $E(X)="." K X Q ;Enforce leading zero.
I X'=+X!(X'=0_+X),X["@",($P(X,"@",2,999)'=+$P(X,"@",2,999)!(+$P(X,"@",2,999)<0)) K X Q
S SPSOL=$O(DRG("SOL",0)) I 'SPSOL K SPSOL,X W " You must define at least one solution !!" Q
I X=+X!(X=0_+X),X'["@" S X=X_" ml/hr" W " ml/hr" D SPSOL S P(15)=$S('X:0,1:SPSOL\X*60+(SPSOL#X/X*60+.5)\1) K SPSOL Q
S SPSOL=$P(X,"@",2) S:$P(X,"@")=+X!($P(X,"@")=0_+X) $P(X,"@")=$P(X,"@")_" ml/hr" W " ",+SPSOL," Label",$S(SPSOL'=1:"s",1:"")," per day",!?15,"at an infusion rate of: ",$P(X,"@") S P(15)=$S('SPSOL:0,1:1440/SPSOL\1) K SPSOL
I X["@",$P(X,"@",2)=0 S P(7)=1 ; Set ATZERO flag
Q
SPSOL S SPSOL=0 F XXX=0:0 S XXX=$O(DRG("SOL",XXX)) Q:'XXX S SPSOL=SPSOL+$P(DRG("SOL",XXX),U,3)
K XXX Q
CHK F Y=1:1 Q:$L(P(11))>240!($P(P(11),"-",Y)="") S $P(P(11),"-",Y)=$P(P(11),"-",Y)_$E("0000",1,4-$L($P(P(11),"-",Y)))
Q
;
DIC ; 51.1 look-up
N PSJSCH S PSJSCH=X I '$D(WSCHADM) N VAIP D IN5^VADPT S WSCHADM=VAIP(5),X=PSJSCH
K DIC S DIC="^PS(51.1,",DIC(0)=$E("E",'$D(NOECH))_"ISZ"
S DIC("W")="W "" "","_$S('$D(WSCHADM):"$P(^(0),""^"",2)",'+WSCHADM:"$P(^(0),""^"",2)",1:"$S($D(^PS(51.1,+Y,1,+WSCHADM,0)):$P(^(0),""^"",2),1:$P(^PS(51.1,+Y,0),""^"",2))"),D="APPSJ" S:$D(PSIVSPQF) DIC(0)=DIC(0)_"O"
D IX^DIC K DIC
S:$D(DIE)#2 DIC=DIE Q:Y<0
S X=Y(0,0),ZZY=Y,(XT,Y)="" I $D(WSCHADM),$D(^PS(51.1,+ZZY,1,+WSCHADM,0)),$P(^(0),"^",2)]"" S (PSIVWAT,Y)=$P(^(0),"^",2)
K ZZY,WSCHADM S:Y="" (X,PSIVSC1)=$P(Y(0),U),(PSIVAT,Y)=$P(Y(0),"^",2) S XT=$P(Y(0),"^",3) Q
;
ORINF ; OERR input transform for Infusion Rate
; X=data
N INFUSE
K:$L(X)<1!($L(X)>30)!(X["""")!($A(X)=45) X I '$D(X) Q
I X?.E1L.E S INFUSE=$$ENLU^PSGMI(X) Q:(INFUSE="TITRATE")!(INFUSE="BOLUS")!($P(INFUSE," ")="INFUSE")!($P(INFUSE," ")="Infuse")
Q:(X="TITRATE")!(X="BOLUS")!($P(X," ")="INFUSE")!($P(X," ")="Infuse")
I X["=" D Q ; NOIS LOU-0501-42191
.N X2,X1 S X1=$P(X,"="),X2=$P(X,"=",2)
.I X1["ML/HR",(+X1=$P(X1,"ML/HR"))!(+X1=$P(X1," ML/HR")) D
..S X1=$TR(X1,"ML/HR","ml/hr")
.I X2["ML/HR",(+X2=$P(X2,"ML/HR"))!(+X2=$P(X2," ML/HR")) D
..S X2=$TR(X2,"ML/HR","ml/hr")
.I X1[" ml/hr",(+X1=$P(X1," ml/hr")) D
..S X1=$P(X1," ml/hr")_$P(X1," ml/hr",2,9999)
.I X2[" ml/hr",(+X2=$P(X2," ml/hr")) D
..S X2=$P(X2," ml/hr")_$P(X2," ml/hr",2,9999)
.I X1["ml/hr",(+X1=$P(X1,"ml/hr")) D
..S X1=$P(X1,"ml/hr")_$P(X1,"ml/hr",2,9999)
.I X2["ml/hr",(+X2=$P(X2,"ml/hr")) D
..S X2=$P(X2,"ml/hr")_$P(X2,"ml/hr",2,9999)
.I X2'=+X2 D
..I X2>0&(X2<1) Q
..I ($P(X2,"@",2,999)'=+$P(X2,"@",2,999)!(+$P(X2,"@",2,999)<0)) K X Q
.I X1>0&(X1<1) I +X1="."_$P(X1,".",2) S X1=X1_" ml/hr"
.I X2>0&(X2<1) I +X2="."_$P(X2,".",2) S X2=X2_" ml/hr"
.I X1=+X1 S X1=X1_" ml/hr"
.I X2=+X2 S X2=X2_" ml/hr"
.S:$P(X2,"@")=+X2 $P(X2,"@")=$P(X2,"@")_" ml/hr"
.S X=X1_"="_X2
I X["ML/HR",(+X=$P(X,"ML/HR"))!(+X=$P(X," ML/HR")) S X=$TR(X,"ML/HR","ml/hr")
I X[" ml/hr",+X=$P(X," ml/hr") S X=$P(X," ml/hr")_$P(X," ml/hr",2,9999)
I X["ml/hr",+X=$P(X,"ml/hr") S X=$P(X,"ml/hr")_$P(X,"ml/hr",2,9999)
I X>0,X<1 D Q
.I X["ML/HR",(+X=$P($P(X,"ML/HR"),".",2))!(+X=$P($P(X," ML/HR"),".",2)) S X=$TR(X,"ML/HR","ml/hr")
.I X[" ml/hr",(+X=$P($P(X," ml/hr"),".",2)) S X=$P(X," ml/hr")_$P(X," ml/hr",2,9999)
.I X["ml/hr",+X=$P(X,"ml/hr") S X=$P(X,"ml/hr")_$P(X,"ml/hr",2,9999)
.I +X=X S X=X_" ml/hr"
.I $P(X,0,2)=+X S X=X_" ml/hr"
.S X=0_+X_$P(X,+X,2)
I '(X>0&X<1) I X'=+X,($P(X,"@",2,999)'=+$P(X,"@",2,999)!(+$P(X,"@",2,999)<0)) K X Q
I X=+X S X=X_" ml/hr" Q
S:$P(X,"@")=+X $P(X,"@")=$P(X,"@")_" ml/hr"
Q
PSIVSP ;BIR/RGY,PR,CML3-DOSE PROCESSOR ;14-Aug-2014 10:08;DU
+1 ;;5.0; INPATIENT MEDICATIONS ;**30,37,41,50,56,74,83,111,133,138,134,213,1018**;16 DEC 97;Build 21
+2 ;
+3 ; Reference to ^PS(51.1 is supported by DBIA #2177
+4 ;Modified - IHS/MSC/MGH - 08/14/2014 - Line ENI+3 do not allow control characters
+5 ;
EN ;
+1 IF '$DATA(X)
QUIT
+2 SET ATZERO=0
IF X["@"
IF $PIECE(X,"@",2)=0
SET ATZERO=1
SET X=$PIECE(X,"@")
+3 DO EN^PSGS0
SET (P(9),PSIVSC1)=$SELECT($GET(X)]"":X,1:$GET(P(9)))
SET P(11)=$SELECT($GET(PSGS0Y):PSGS0Y,1:$GET(P(11)))
SET (XT,P(15))=$SELECT(($GET(PSGS0XT)!($GET(PSGS0XT)="O")!($GET(PSGS0XT)="D")):$GET(PSGS0XT),1:$GET(P(15)))
+4 IF $GET(ATZERO)
SET P(7)=1
+5 KILL ATZERO
QUIT
EN1 ;
+1 SET (PSIVAT,PSIVWAT,Y)=""
SET XT=-1
SET X0=X
SET X=$SELECT(X="ON CALL":X,X="ONCALL":X,X="ON-CALL":X,X="ONETIME":X,X="ONE-TIME":X,X="ONE TIME":X,X="1TIME":X,X="1 TIME":X,X="1-TIME":X,$LENGTH(X," ")<3:$PIECE(X," "),1:$PIECE(X," ",1,2))
+2 IF $EXTRACT(X)="^"
SET X=$EXTRACT(X,2,999)
IF X=""
GOTO Q
IF X["@0"
SET ATZERO=1
SET X=$SELECT(X["@0":$PIECE(X,"@"),1:X)
SET P(7)=$SELECT($DATA(ATZERO):1,1:"")
KILL ATZERO
+3 IF $SELECT($DATA(^PS(51.1,"AC","PSJ",X)):1,1:$EXTRACT($ORDER(^(X)),1,$LENGTH(X))=X)
DO DIC
IF Y'<0
GOTO SH
NS0 SET Y=""
+1 IF $EXTRACT(X,1,2)="AD"
SET XT=-1
QUIT
+2 IF $EXTRACT(X,1,3)="BID"!($EXTRACT(X,1,3)="TID")!($EXTRACT(X,1,3)="QID")
SET XT=1440\$FIND("BTQ",$EXTRACT(X))
+3 IF '$TEST
IF $EXTRACT(X)="Q"
SET X=$EXTRACT(X,2,99)
IF 'X
SET X=$EXTRACT(X)["O"+1_X
SET I=+X
SET X=$PIECE(X,I,2)
SET XT=I*$SELECT(X["'":1,(X["D"&(X'["AD"))!(X["AM")!(X["PM")!(X["HS"&(X'["THS")):1440,X["H"&(X'["TH"):60,X["AC"!(X["PC"):480,X["W":10080,X["M":40320,1:0)
SET X=X0
Begin DoDot:1
+4 IF 'XT
IF X'="NOW"
IF X'="STAT"
IF X'="ONCE"
IF X'="ONE-TIME"
IF X'="ONE TIME"
IF X'="ONETIME"
IF X'="1-TIME"
IF X'="1 TIME"
IF X'="1TIME"
IF Y=""
SET XT=-1
End DoDot:1
SH ;
+1 IF +Y<1
IF $EXTRACT(X0)'="^"
IF $GET(ON)'["P"
WRITE " ",$SELECT(XT=0&($SELECT("^NOW^STAT^ONCE^ONE-TIME^ONETIME^1TIME^1-TIME^"[(U_$PIECE(X," ")_U):1,X["1 TIME":1,1:X["ONE TIME")):"(ONCE ONLY)",XT>0:"Nonstandard schedule",XT<0:"",1:"(??)")
IF XT>0
WRITE " (",XT," MINUTES)"
Q IF X="ONE TIME"
QUIT
+1 NEW I
SET X0=$PIECE(X," ")_$SELECT($LENGTH(X0," ")-1:" ",1:"")_$PIECE(X0," ",2,99)
IF XT<0!($LENGTH(X0)>22)
KILL X
IF $DATA(X)
SET X=X0
KILL X0
IF $GET(P(7))
SET XT=""
QUIT
NEWQ ;N I S X0=$P(X," ")_$S($L(X0," ")-1:" ",1:"")_$P(X0," ",2,99) K:XT<0!($L(X0)>22) X S:$D(X) X=X0 S:P(7) X=X0 K X0 K:XT>0&('P(7)) X Q
+1 QUIT
+2 ;
ENDL WRITE " Dose limit .... "
SET PSIVMIN=P(15)*X
SET PSIVSD=+P(2)
+1 IF PSIVMIN<0
WRITE !!," --- There is something wrong with this order !!",!," Call inpatient supervisor ....."
SET Y=-1
KILL PSIVMIN
QUIT
+2 IF P(4)="P"!(P(5))!(P(23)="P")
IF PSIVMIN=0
IF "^NOW^STAT^ONCE^ONE-TIME^ONE TIME^ON CALL^ONETIME^1TIME^1 TIME^1-TIME^"'[(U_P(9)_U)
DO DLP
GOTO QDL
+3 DO ENT^PSIVWL
QDL IF $DATA(X)
SET X=Y
XECUTE ^DD("DD")
WRITE $PIECE(Y,"@")," ",$PIECE(Y,"@",2)
SET Y=X
+1 QUIT
DLP ;
+1 SET X=X+1
SET $PIECE(PSIVSD,".",2)=$PIECE(PSIVSD,".",2)_$EXTRACT("0000",1,4-$LENGTH($PIECE(PSIVSD,".",2)))
DO CHK
SET X2=0
SET Y=1
IF X<2
SET Y=+PSIVSD
GOTO QDLP
+2 IF $PIECE(PSIVSD,".",2)>$PIECE(P(11),"-",$LENGTH(P(11),"-"))
SET X2=1
GOTO OV
+3 IF $PIECE(P(11),"-")>$PIECE(PSIVSD,".",2)
GOTO OV
+4 FOR Y=1:1
SET X1=$PIECE(P(11),"-",Y)
IF X1=$PIECE(PSIVSD,".",2)!($PIECE(PSIVSD,".",2)<X1)
QUIT
OV IF P(11)=""
WRITE $CHAR(7)," ???",!?15,"*** You have not defined any administration times !!"
KILL X
QUIT
+1 FOR Y=Y:1
IF $PIECE(P(11),"-",Y)=""
SET X2=X2+1
SET Y=0
SET X=X+1
SET X=X-1
IF X<1
QUIT
+2 ; install with version 17.3 of fileman
SET X=PSIVSD\1
IF X2>0
SET X1=PSIVSD
DO C^%DTC
SET X=$PIECE(X,".")
+3 SET Y=+(X_"."_$PIECE(P(11),"-",Y))
QDLP KILL X1,X2
QUIT
+1 ;
ENI ;
+1 ;IHS/MSC/MGH Validate infusion rate
+2 ;K:$L(X)<1!($L(X)>30)!(X["""")!($A(X)=45) X I '$D(X)!'$D(P(4)) Q
+3 ;IHS/MSC/MGH DO NOT ALLOW CONTROL CHARACTERS
IF X'?1.30ANP!(X["""")!($ASCII(X)=45)
KILL X
IF '$DATA(X)!'$DATA(P(4))
QUIT
+4 IF P(4)="P"!(P(5))!(P(23)="P")
IF 'X
QUIT
SET X="INFUSE OVER "_X_" MINUTE"_$SELECT(X>1:"S",1:"")
WRITE " ",X
QUIT
+5 ;Enforce leading zero.
IF $EXTRACT(X)="."
KILL X
QUIT
+6 IF X'=+X!(X'=0_+X)
IF X["@"
IF ($PIECE(X,"@",2,999)'=+$PIECE(X,"@",2,999)!(+$PIECE(X,"@",2,999)<0))
KILL X
QUIT
+7 SET SPSOL=$ORDER(DRG("SOL",0))
IF 'SPSOL
KILL SPSOL,X
WRITE " You must define at least one solution !!"
QUIT
+8 IF X=+X!(X=0_+X)
IF X'["@"
SET X=X_" ml/hr"
WRITE " ml/hr"
DO SPSOL
SET P(15)=$SELECT('X:0,1:SPSOL\X*60+(SPSOL#X/X*60+.5)\1)
KILL SPSOL
QUIT
+9 SET SPSOL=$PIECE(X,"@",2)
IF $PIECE(X,"@")=+X!($PIECE(X,"@")=0_+X)
SET $PIECE(X,"@")=$PIECE(X,"@")_" ml/hr"
WRITE " ",+SPSOL," Label",$SELECT(SPSOL'=1:"s",1:"")," per day",!?15,"at an infusion rate of: ",$PIECE(X,"@")
SET P(15)=$SELECT('SPSOL:0,1:1440/SPSOL\1)
KILL SPSOL
+10 ; Set ATZERO flag
IF X["@"
IF $PIECE(X,"@",2)=0
SET P(7)=1
+11 QUIT
SPSOL SET SPSOL=0
FOR XXX=0:0
SET XXX=$ORDER(DRG("SOL",XXX))
IF 'XXX
QUIT
SET SPSOL=SPSOL+$PIECE(DRG("SOL",XXX),U,3)
+1 KILL XXX
QUIT
CHK FOR Y=1:1
IF $LENGTH(P(11))>240!($PIECE(P(11),"-",Y)="")
QUIT
SET $PIECE(P(11),"-",Y)=$PIECE(P(11),"-",Y)_$EXTRACT("0000",1,4-$LENGTH($PIECE(P(11),"-",Y)))
+1 QUIT
+2 ;
DIC ; 51.1 look-up
+1 NEW PSJSCH
SET PSJSCH=X
IF '$DATA(WSCHADM)
NEW VAIP
DO IN5^VADPT
SET WSCHADM=VAIP(5)
SET X=PSJSCH
+2 KILL DIC
SET DIC="^PS(51.1,"
SET DIC(0)=$EXTRACT("E",'$DATA(NOECH))_"ISZ"
+3 SET DIC("W")="W "" "","_$SELECT('$DATA(WSCHADM):"$P(^(0),""^"",2)",'+WSCHADM:"$P(^(0),""^"",2)",1:"$S($D(^PS(51.1,+Y,1,+WSCHADM,0)):$P(^(0),""^"",2),1:$P(^PS(51.1,+Y,0),""^"",2))")
SET D="APPSJ"
IF $DATA(PSIVSPQF)
SET DIC(0)=DIC(0)_"O"
+4 DO IX^DIC
KILL DIC
+5 IF $DATA(DIE)#2
SET DIC=DIE
IF Y<0
QUIT
+6 SET X=Y(0,0)
SET ZZY=Y
SET (XT,Y)=""
IF $DATA(WSCHADM)
IF $DATA(^PS(51.1,+ZZY,1,+WSCHADM,0))
IF $PIECE(^(0),"^",2)]""
SET (PSIVWAT,Y)=$PIECE(^(0),"^",2)
+7 KILL ZZY,WSCHADM
IF Y=""
SET (X,PSIVSC1)=$PIECE(Y(0),U)
SET (PSIVAT,Y)=$PIECE(Y(0),"^",2)
SET XT=$PIECE(Y(0),"^",3)
QUIT
+8 ;
ORINF ; OERR input transform for Infusion Rate
+1 ; X=data
+2 NEW INFUSE
+3 IF $LENGTH(X)<1!($LENGTH(X)>30)!(X["""")!($ASCII(X)=45)
KILL X
IF '$DATA(X)
QUIT
+4 IF X?.E1L.E
SET INFUSE=$$ENLU^PSGMI(X)
IF (INFUSE="TITRATE")!(INFUSE="BOLUS")!($PIECE(INFUSE," ")="INFUSE")!($PIECE(INFUSE," ")="Infuse")
QUIT
+5 IF (X="TITRATE")!(X="BOLUS")!($PIECE(X," ")="INFUSE")!($PIECE(X," ")="Infuse")
QUIT
+6 ; NOIS LOU-0501-42191
IF X["="
Begin DoDot:1
+7 NEW X2,X1
SET X1=$PIECE(X,"=")
SET X2=$PIECE(X,"=",2)
+8 IF X1["ML/HR"
IF (+X1=$PIECE(X1,"ML/HR"))!(+X1=$PIECE(X1," ML/HR"))
Begin DoDot:2
+9 SET X1=$TRANSLATE(X1,"ML/HR","ml/hr")
End DoDot:2
+10 IF X2["ML/HR"
IF (+X2=$PIECE(X2,"ML/HR"))!(+X2=$PIECE(X2," ML/HR"))
Begin DoDot:2
+11 SET X2=$TRANSLATE(X2,"ML/HR","ml/hr")
End DoDot:2
+12 IF X1[" ml/hr"
IF (+X1=$PIECE(X1," ml/hr"))
Begin DoDot:2
+13 SET X1=$PIECE(X1," ml/hr")_$PIECE(X1," ml/hr",2,9999)
End DoDot:2
+14 IF X2[" ml/hr"
IF (+X2=$PIECE(X2," ml/hr"))
Begin DoDot:2
+15 SET X2=$PIECE(X2," ml/hr")_$PIECE(X2," ml/hr",2,9999)
End DoDot:2
+16 IF X1["ml/hr"
IF (+X1=$PIECE(X1,"ml/hr"))
Begin DoDot:2
+17 SET X1=$PIECE(X1,"ml/hr")_$PIECE(X1,"ml/hr",2,9999)
End DoDot:2
+18 IF X2["ml/hr"
IF (+X2=$PIECE(X2,"ml/hr"))
Begin DoDot:2
+19 SET X2=$PIECE(X2,"ml/hr")_$PIECE(X2,"ml/hr",2,9999)
End DoDot:2
+20 IF X2'=+X2
Begin DoDot:2
+21 IF X2>0&(X2<1)
QUIT
+22 IF ($PIECE(X2,"@",2,999)'=+$PIECE(X2,"@",2,999)!(+$PIECE(X2,"@",2,999)<0))
KILL X
QUIT
End DoDot:2
+23 IF X1>0&(X1<1)
IF +X1="."_$PIECE(X1,".",2)
SET X1=X1_" ml/hr"
+24 IF X2>0&(X2<1)
IF +X2="."_$PIECE(X2,".",2)
SET X2=X2_" ml/hr"
+25 IF X1=+X1
SET X1=X1_" ml/hr"
+26 IF X2=+X2
SET X2=X2_" ml/hr"
+27 IF $PIECE(X2,"@")=+X2
SET $PIECE(X2,"@")=$PIECE(X2,"@")_" ml/hr"
+28 SET X=X1_"="_X2
End DoDot:1
QUIT
+29 IF X["ML/HR"
IF (+X=$PIECE(X,"ML/HR"))!(+X=$PIECE(X," ML/HR"))
SET X=$TRANSLATE(X,"ML/HR","ml/hr")
+30 IF X[" ml/hr"
IF +X=$PIECE(X," ml/hr")
SET X=$PIECE(X," ml/hr")_$PIECE(X," ml/hr",2,9999)
+31 IF X["ml/hr"
IF +X=$PIECE(X,"ml/hr")
SET X=$PIECE(X,"ml/hr")_$PIECE(X,"ml/hr",2,9999)
+32 IF X>0
IF X<1
Begin DoDot:1
+33 IF X["ML/HR"
IF (+X=$PIECE($PIECE(X,"ML/HR"),".",2))!(+X=$PIECE($PIECE(X," ML/HR"),".",2))
SET X=$TRANSLATE(X,"ML/HR","ml/hr")
+34 IF X[" ml/hr"
IF (+X=$PIECE($PIECE(X," ml/hr"),".",2))
SET X=$PIECE(X," ml/hr")_$PIECE(X," ml/hr",2,9999)
+35 IF X["ml/hr"
IF +X=$PIECE(X,"ml/hr")
SET X=$PIECE(X,"ml/hr")_$PIECE(X,"ml/hr",2,9999)
+36 IF +X=X
SET X=X_" ml/hr"
+37 IF $PIECE(X,0,2)=+X
SET X=X_" ml/hr"
+38 SET X=0_+X_$PIECE(X,+X,2)
End DoDot:1
QUIT
+39 IF '(X>0&X<1)
IF X'=+X
IF ($PIECE(X,"@",2,999)'=+$PIECE(X,"@",2,999)!(+$PIECE(X,"@",2,999)<0))
KILL X
QUIT
+40 IF X=+X
SET X=X_" ml/hr"
QUIT
+41 IF $PIECE(X,"@")=+X
SET $PIECE(X,"@")=$PIECE(X,"@")_" ml/hr"
+42 QUIT