PSIVORV1 ;BIR/MLM-VIEW AN ORDER, EDIT OR DETAILED (OE/RR) ;07 OCT 97 / 9:42 AM
;;5.0; INPATIENT MEDICATIONS ;**58,81**;16 DEC 97
;
; Reference to ^PS(52.7 is supported by DBIA 2173.
;
ENED ; Display order entered by MD.
;
S PSIVLN=0,TAB=16,UL80="",$P(UL80,"-",80)=""
W:$Y @IOF W !!,?5,"Patient: ",$P($G(^DPT(+ORVP,0)),U),?48,"Status: ",$P("DISCONTINUED^COMPLETE^HOLD^FLAGGED^PENDING^ACTIVE^EXPIRED^SCHEDULED^INCOMPLETE^^UNRELEASED",U,+ORSTS)
W !,?4,"Entry By: ",$P(P("CLRK"),U,2),?49,"Login: ",$$WDTE^PSIVUTL(P("LOG")),!,UL80,!!!
F DRGT="AD","SOL" D GTDRG
W:'$O(DRG("SOL",0)) ! S X=59 D CKNUM W "Inf Rate:",?TAB,P(8)
W ! S X=1 D CKNUM W "Provider: ",?TAB,$P(P(6),U,2) K TAB
;
PC ; Display Provider's comments.
W ! S X=66 D CKNUM W "Provider Comments: "
;F PSIVX=0:0 S PSIVX=$O(^PS(53.45,+$G(PSIVUP),4,PSIVX)) Q:'PSIVX D
I +$G(ON) F PSIVX=0:0 S PSIVX=$O(^PS(53.1,+ON,12,PSIVX)) Q:'PSIVX D
.S Y=$G(^PS(53.1,+ON,12,PSIVX,0)) W !?5,Y I $Y>23 K DIR S DIR(0)="E" D ^DIR K DIR Q:$D(DIRUT) W:$Y @IOF
W !,UL80
Q
;
GTDRG ; Get and print each additive and solution in the order.
S DRGTN=$S(DRGT="AD":"Additive",1:"Solution")_$S($G(DRG(DRGT,0))>1:"s",1:"")
W:DRGT="AD" ! S X=$S(DRGT="AD":57,1:58) D CKNUM W DRGTN,": "
W:+$G(DRG(DRGT,0))=0 ! F I=0:0 S I=$O(DRG(DRGT,I)) Q:'I W ?TAB,$P(DRG(DRGT,I),U,2)," ",$P(DRG(DRGT,I),U,3),$S($P(DRG(DRGT,I),U,4):"("_$P(DRG(DRGT,I),U,4)_")",1:""),!
Q
CKNUM ; Display number next to field if necessary.
I $G(PSIVAC)="OE",(U_EDIT_U[(U_X_U)) S PSIVLN=PSIVLN+1 W "*(",PSIVLN,")"
W:$G(PSIVAC)="OE" ?4
Q
;
WRTDRG ; Print drugs for "backdoor" view.
S DRGTN=$S(DRGT="AD":"(1) Additive",1:"(2) Solution")_$S($G(DRG(DRGT,0))>1:"s",1:"")_": " I '$D(PSIVNUM)!('P("DTYP")) S DRGTN=" "_$P(DRGTN,") ",2) G WRTDRG1
I $G(PSIVAC)="PN" S DRGTN=" "_DRGTN G WRTDRG1
I DRGT="AD" S DRGTN=$S(P(17)'="P":"*"_DRGTN,$E(P("OT"))="F":"*"_DRGTN,1:" "_DRGTN)
I DRGT="SOL" S DRGTN=$S(P(17)'="P"&(P("DTYP")'=1):"*"_DRGTN,$E(P("OT"))="F":"*"_DRGTN,1:" "_DRGTN)
WRTDRG1 ;
W " ",DRGTN D RC^PSIVORV2 F DRG=0:0 S DRG=$O(DRG(DRGT,DRG)) Q:'DRG D
.S X=$G(DRG(DRGT,DRG)) I DRGT="SOL",$P($G(^PS(52.7,+X,0)),U,4)]"" S $P(X,U,2)=$P(X,U,2)_" "_$P(^(0),U,4)
.W ?6,$$LONG^PSIVORV2($S($P(X,U,2)]"":$P(X,U,2)_" "_$P(X,U,3)_" "_$P(X,U,4),1:"*** Undefined ***")) D RC^PSIVORV2
K DRGT,DRGTN
Q
;
PD ; Print primary drug, dosage ordered (backdoor view).
I $D(PSIVNUM),P("DTYP") W $S(PSIVAC="PN":" ",1:" *"),$S(P("DTYP")=1:"(9)",1:"(7)")
W ?7,"Primary Drug: ",$P(P("PD"),U,2) D RC^PSIVORV2
I $D(PSIVNUM),P("DTYP") W:P("DTYP")'=1 " " W $S(PSIVAC="PN":" ",1:"*"),$S(P("DTYP")=1:"(10)",1:"(8)")
W ?13,"Dosage: ",P("DO") D RC^PSIVORV2
Q
;
ONCALL ; Display msg. for orders placed ONCALL by Pharmacy.
W $C(7),!,"This order has been placed ""ON-CALL"" by pharmacy. No action may be taken on",!,"it until it has been removed from on-call status by pharmacy."
Q
;
ALLREN ; Display msg. for orders that have been renewed.
W $C(7),!,"This order has been renewed and may not be edited or renewed again."
Q
;
ALLED ; Display msg. for orders that have been edited.
W $C(7),!,"This order has been edited and may not be edited or renewed again."
Q
;
ENDT ; Display order entered by MD. (OE/RR detailed order view.)
S TAB=23,UL80="",$P(UL80,"-",80)="" W:$Y @IOF W !!,"IV Room: ",?23,$P(P("IVRM"),U,2),!,"Type:"
S X=$$CODES^PSIVUTL(P(4),53.1,53) W ?23,$S($E(X)="C":"CHEMO",1:X),$S(P(23)'="":" ("_P(23)_")",1:""),$S(P(5)=1:" (I)",P(5)=0:"(C)",1:""),!,"Syr. Size:",?23,$E(P("SYRS"),1,13) W:$L(P("SYRS"))>13 "..."
F DRGT="AD","SOL" D GTDRG
W !,"Infusion Rate:",?23,P(8),!,"Schedule:",?23,P(9),!,"Administration Times:",?23,P(11),!,"Med Route:",?23,$P(P("MR"),U,2),!,"Remarks:",?23,P("REM"),!,"Other Print Info:",?23,$P(P("OPI"),"^"),!,"Last Fill:"
S Y=$$WDTE^PSIVUTL(P("LF")) W ?23,$S(Y="******":"",1:Y),!,"Quantity: " W:P("LFA") ?23,P("LFA") W !,"Cumulative Doses: " W:P("CUM") ?23,P("CUM") D PC
W:P("RES")="R" !,$C(7),"This order is a renewal." D:P(17)="O" ONCALL D:P("FRES")="R" ALLREN
Q
PSIVORV1 ;BIR/MLM-VIEW AN ORDER, EDIT OR DETAILED (OE/RR) ;07 OCT 97 / 9:42 AM
+1 ;;5.0; INPATIENT MEDICATIONS ;**58,81**;16 DEC 97
+2 ;
+3 ; Reference to ^PS(52.7 is supported by DBIA 2173.
+4 ;
ENED ; Display order entered by MD.
+1 ;
+2 SET PSIVLN=0
SET TAB=16
SET UL80=""
SET $PIECE(UL80,"-",80)=""
+3 IF $Y
WRITE @IOF
WRITE !!,?5,"Patient: ",$PIECE($GET(^DPT(+ORVP,0)),U),?48,"Status: ",$PIECE("DISCONTINUED^COMPLETE^HOLD^FLAGGED^PENDING^ACTIVE^EXPIRED^SCHEDULED^INCOMPLETE^^UNRELEASED",U,+ORSTS)
+4 WRITE !,?4,"Entry By: ",$PIECE(P("CLRK"),U,2),?49,"Login: ",$$WDTE^PSIVUTL(P("LOG")),!,UL80,!!!
+5 FOR DRGT="AD","SOL"
DO GTDRG
+6 IF '$ORDER(DRG("SOL",0))
WRITE !
SET X=59
DO CKNUM
WRITE "Inf Rate:",?TAB,P(8)
+7 WRITE !
SET X=1
DO CKNUM
WRITE "Provider: ",?TAB,$PIECE(P(6),U,2)
KILL TAB
+8 ;
PC ; Display Provider's comments.
+1 WRITE !
SET X=66
DO CKNUM
WRITE "Provider Comments: "
+2 ;F PSIVX=0:0 S PSIVX=$O(^PS(53.45,+$G(PSIVUP),4,PSIVX)) Q:'PSIVX D
+3 IF +$GET(ON)
FOR PSIVX=0:0
SET PSIVX=$ORDER(^PS(53.1,+ON,12,PSIVX))
IF 'PSIVX
QUIT
Begin DoDot:1
+4 SET Y=$GET(^PS(53.1,+ON,12,PSIVX,0))
WRITE !?5,Y
IF $Y>23
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF $DATA(DIRUT)
QUIT
IF $Y
WRITE @IOF
End DoDot:1
+5 WRITE !,UL80
+6 QUIT
+7 ;
GTDRG ; Get and print each additive and solution in the order.
+1 SET DRGTN=$SELECT(DRGT="AD":"Additive",1:"Solution")_$SELECT($GET(DRG(DRGT,0))>1:"s",1:"")
+2 IF DRGT="AD"
WRITE !
SET X=$SELECT(DRGT="AD":57,1:58)
DO CKNUM
WRITE DRGTN,": "
+3 IF +$GET(DRG(DRGT,0))=0
WRITE !
FOR I=0:0
SET I=$ORDER(DRG(DRGT,I))
IF 'I
QUIT
WRITE ?TAB,$PIECE(DRG(DRGT,I),U,2)," ",$PIECE(DRG(DRGT,I),U,3),$SELECT($PIECE(DRG(DRGT,I),U,4):"("_$PIECE(DRG(DRGT,I),U,4)_")",1:""),!
+4 QUIT
CKNUM ; Display number next to field if necessary.
+1 IF $GET(PSIVAC)="OE"
IF (U_EDIT_U[(U_X_U))
SET PSIVLN=PSIVLN+1
WRITE "*(",PSIVLN,")"
+2 IF $GET(PSIVAC)="OE"
WRITE ?4
+3 QUIT
+4 ;
WRTDRG ; Print drugs for "backdoor" view.
+1 SET DRGTN=$SELECT(DRGT="AD":"(1) Additive",1:"(2) Solution")_$SELECT($GET(DRG(DRGT,0))>1:"s",1:"")_": "
IF '$DATA(PSIVNUM)!('P("DTYP"))
SET DRGTN=" "_$PIECE(DRGTN,") ",2)
GOTO WRTDRG1
+2 IF $GET(PSIVAC)="PN"
SET DRGTN=" "_DRGTN
GOTO WRTDRG1
+3 IF DRGT="AD"
SET DRGTN=$SELECT(P(17)'="P":"*"_DRGTN,$EXTRACT(P("OT"))="F":"*"_DRGTN,1:" "_DRGTN)
+4 IF DRGT="SOL"
SET DRGTN=$SELECT(P(17)'="P"&(P("DTYP")'=1):"*"_DRGTN,$EXTRACT(P("OT"))="F":"*"_DRGTN,1:" "_DRGTN)
WRTDRG1 ;
+1 WRITE " ",DRGTN
DO RC^PSIVORV2
FOR DRG=0:0
SET DRG=$ORDER(DRG(DRGT,DRG))
IF 'DRG
QUIT
Begin DoDot:1
+2 SET X=$GET(DRG(DRGT,DRG))
IF DRGT="SOL"
IF $PIECE($GET(^PS(52.7,+X,0)),U,4)]""
SET $PIECE(X,U,2)=$PIECE(X,U,2)_" "_$PIECE(^(0),U,4)
+3 WRITE ?6,$$LONG^PSIVORV2($SELECT($PIECE(X,U,2)]"":$PIECE(X,U,2)_" "_$PIECE(X,U,3)_" "_$PIECE(X,U,4),1:"*** Undefined ***"))
DO RC^PSIVORV2
End DoDot:1
+4 KILL DRGT,DRGTN
+5 QUIT
+6 ;
PD ; Print primary drug, dosage ordered (backdoor view).
+1 IF $DATA(PSIVNUM)
IF P("DTYP")
WRITE $SELECT(PSIVAC="PN":" ",1:" *"),$SELECT(P("DTYP")=1:"(9)",1:"(7)")
+2 WRITE ?7,"Primary Drug: ",$PIECE(P("PD"),U,2)
DO RC^PSIVORV2
+3 IF $DATA(PSIVNUM)
IF P("DTYP")
IF P("DTYP")'=1
WRITE " "
WRITE $SELECT(PSIVAC="PN":" ",1:"*"),$SELECT(P("DTYP")=1:"(10)",1:"(8)")
+4 WRITE ?13,"Dosage: ",P("DO")
DO RC^PSIVORV2
+5 QUIT
+6 ;
ONCALL ; Display msg. for orders placed ONCALL by Pharmacy.
+1 WRITE $CHAR(7),!,"This order has been placed ""ON-CALL"" by pharmacy. No action may be taken on",!,"it until it has been removed from on-call status by pharmacy."
+2 QUIT
+3 ;
ALLREN ; Display msg. for orders that have been renewed.
+1 WRITE $CHAR(7),!,"This order has been renewed and may not be edited or renewed again."
+2 QUIT
+3 ;
ALLED ; Display msg. for orders that have been edited.
+1 WRITE $CHAR(7),!,"This order has been edited and may not be edited or renewed again."
+2 QUIT
+3 ;
ENDT ; Display order entered by MD. (OE/RR detailed order view.)
+1 SET TAB=23
SET UL80=""
SET $PIECE(UL80,"-",80)=""
IF $Y
WRITE @IOF
WRITE !!,"IV Room: ",?23,$PIECE(P("IVRM"),U,2),!,"Type:"
+2 SET X=$$CODES^PSIVUTL(P(4),53.1,53)
WRITE ?23,$SELECT($EXTRACT(X)="C":"CHEMO",1:X),$SELECT(P(23)'="":" ("_P(23)_")",1:""),$SELECT(P(5)=1:" (I)",P(5)=0:"(C)",1:""),!,"Syr. Size:",?23,$EXTRACT(P("SYRS"),1,13)
IF $LENGTH(P("SYRS"))>13
WRITE "..."
+3 FOR DRGT="AD","SOL"
DO GTDRG
+4 WRITE !,"Infusion Rate:",?23,P(8),!,"Schedule:",?23,P(9),!,"Administration Times:",?23,P(11),!,"Med Route:",?23,$PIECE(P("MR"),U,2),!,"Remarks:",?23,P("REM"),!,"Other Print Info:",?23,$PIECE(P("OPI"),"^"),!,"Last Fill:"
+5 SET Y=$$WDTE^PSIVUTL(P("LF"))
WRITE ?23,$SELECT(Y="******":"",1:Y),!,"Quantity: "
IF P("LFA")
WRITE ?23,P("LFA")
WRITE !,"Cumulative Doses: "
IF P("CUM")
WRITE ?23,P("CUM")
DO PC
+6 IF P("RES")="R"
WRITE !,$CHAR(7),"This order is a renewal."
IF P(17)="O"
DO ONCALL
IF P("FRES")="R"
DO ALLREN
+7 QUIT