PSIVHLD ;BIR/PR-ORDERS ON/OFF HOLD, ON/OFF CALL ;16 DEC 97 / 1:39 PM
;;5.0; INPATIENT MEDICATIONS ;;16 DEC 97
;Needs DFN,PSIVNST (O or H)
;
STOP ;Put all orders on hold or on call
N DA,DIE,DR,PSIVACT
F ON1=0:0 S ON1=$O(^PS(55,DFN,"IV",ON1)) Q:'ON1 I "AR"[$P($G(^(ON1,0)),U,17) D
.K DA,DIE,DR S PSIVACT=1,DA=ON1,DA(1)=DFN,DIE="^PS(55,"_DFN_",""IV"",",DR="100///"_PSIVNST,PSIVREA=PSIVNST D ^DIE,LOG
Q
;
START ;Set all orders put on hold or oncall back to active if not expired.
N DA,DIE,DR,ON1,PSIVACT,PSIVALT,PSIVHNW,PSIVREA
D NOW^%DTC S PSIVHNW=%
F ON1=0:0 S ON1=$O(^PS(55,DFN,"IV",ON1)) Q:'ON1 I $D(^(ON1,0)) S Y=^(0) I PSIVNST[$P(Y,U,17) D
.K DA,DR,DIE S PSIVACT=1,DA=ON1,DA(1)=DFN,DIE="^PS(55,"_DFN_",""IV"",",P(17)=$S($P(Y,U,3)<PSIVHNW:"E",1:"A"),DR="100///"_P(17) D ^DIE
.I P(17)'="E" S PSIVREA=$S(PSIVNST="H":"U",1:"C") D LOG
Q
LOG ;Auto entry to log
K PSIVALT S PSIVAL=$P($G(^PS(53.3,+PSGALO,0)),U),(ON,ON55)=ON1_"V"
D LOG^PSIVORAL D:PSIVNST="H" HOLD^PSIVOE
Q
PSIVHLD ;BIR/PR-ORDERS ON/OFF HOLD, ON/OFF CALL ;16 DEC 97 / 1:39 PM
+1 ;;5.0; INPATIENT MEDICATIONS ;;16 DEC 97
+2 ;Needs DFN,PSIVNST (O or H)
+3 ;
STOP ;Put all orders on hold or on call
+1 NEW DA,DIE,DR,PSIVACT
+2 FOR ON1=0:0
SET ON1=$ORDER(^PS(55,DFN,"IV",ON1))
IF 'ON1
QUIT
IF "AR"[$PIECE($GET(^(ON1,0)),U,17)
Begin DoDot:1
+3 KILL DA,DIE,DR
SET PSIVACT=1
SET DA=ON1
SET DA(1)=DFN
SET DIE="^PS(55,"_DFN_",""IV"","
SET DR="100///"_PSIVNST
SET PSIVREA=PSIVNST
DO ^DIE
DO LOG
End DoDot:1
+4 QUIT
+5 ;
START ;Set all orders put on hold or oncall back to active if not expired.
+1 NEW DA,DIE,DR,ON1,PSIVACT,PSIVALT,PSIVHNW,PSIVREA
+2 DO NOW^%DTC
SET PSIVHNW=%
+3 FOR ON1=0:0
SET ON1=$ORDER(^PS(55,DFN,"IV",ON1))
IF 'ON1
QUIT
IF $DATA(^(ON1,0))
SET Y=^(0)
IF PSIVNST[$PIECE(Y,U,17)
Begin DoDot:1
+4 KILL DA,DR,DIE
SET PSIVACT=1
SET DA=ON1
SET DA(1)=DFN
SET DIE="^PS(55,"_DFN_",""IV"","
SET P(17)=$SELECT($PIECE(Y,U,3)<PSIVHNW:"E",1:"A")
SET DR="100///"_P(17)
DO ^DIE
+5 IF P(17)'="E"
SET PSIVREA=$SELECT(PSIVNST="H":"U",1:"C")
DO LOG
End DoDot:1
+6 QUIT
LOG ;Auto entry to log
+1 KILL PSIVALT
SET PSIVAL=$PIECE($GET(^PS(53.3,+PSGALO,0)),U)
SET (ON,ON55)=ON1_"V"
+2 DO LOG^PSIVORAL
IF PSIVNST="H"
DO HOLD^PSIVOE
+3 QUIT