PSGOE82 ;BIR/CML3-NON-VERIFIED ORDER EDIT (CONT.) ;27 Jan 98 / 9:32 AM
;;5.0; INPATIENT MEDICATIONS ;**2,35,50,67,58,81,127,168**;16 DEC 97
;
; Reference to ^DD(53.1 is supported by DBIA #2256.
; Reference to ^VA(200 is supported by DBIA #10060.
; Reference to ^DIE is supported by DBIA #10018.
; Reference to ^DIC is supported by DBIA #10006.
; Reference to ^DICN is supported by DBIA #10009.
;
1 ; provider
S MSG=0,PSGF2=1 S:PSGOEEF(PSGF2) BACK="1^PSGOE82"
A1 I $G(PSGORD)["P",$G(PSGP) I $$LASTREN^PSJLMPRI(PSGP,PSGORD) D Q
. W !?5,"This order has been renewed. Provider may not be edited at this point. " D PAUSE^VALM1
W !,"PROVIDER: ",$S(PSGPR:PSGPRN_"// ",1:"") R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOEE=0 G DONE
I $S(X="":'PSGPR,1:X="@") W $C(7)," (Required)" S X="?" D ENHLP^PSGOEM(53.1,1) G A1
I X="",PSGPR S X=PSGPRN I PSGPR'=PSGPRN,$D(^VA(200,PSGPR,"PS")) W:0 " "_$P(^("PS"),"^",2)_" "_$P(^("PS"),"^",3) G DONE
I X?1."?" D ENHLP^PSGOEM(53.1,1)
I $E(X)="^" D ENFF G:Y>0 @Y G A1
K DIC S DIC="^VA(200,",DIC(0)="EMQZ",DIC("S")="I $D(^(""PS"")),^(""PS""),$S('$P(^(""PS""),""^"",4):1,1:$P(^(""PS""),""^"",4)>DT)" D ^DIC K DIC I Y'>0 G A1
S PSGPR=+Y,PSGPRN=Y(0,0) G DONE
;
5 ; self med
S MSG=0,PSGF2=5 S:PSGOEEF(PSGF2) BACK="5^PSGOE82" K PSGOEEF(6) S:PSGSM PSGOEEF(6)=1
A5 W !,"SELF MED: " W $P("NO^YES","^",PSGSM+1),"// " R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOEE=0 G DONE
;I "01"[X,$L(X)<2 S:PSGSM=""&(X]"") PSGSM=X W:PSGSM]"" " (",$P("NO^YES","^",PSGSM+1),")" G:'PSGSM DONE S PSGOEEF(6)=1 G 6
I "01"[X,$L(X)<2 S:X]"" PSGSM=+X W:PSGSM]"" " (",$P("NO^YES","^",PSGSM+1),")" G:'PSGSM DONE S PSGOEEF(6)=1 G 6
I X="@" W $C(7)," (Required)" G A5
I X?1"^".E D ENFF G:Y>0 @Y G A5
I X?1."?" D ENHLP^PSGOEM(53.1,5) G A5
D YN I S PSGSM=$E(X)="Y" K PSGOEEF(6) G:'PSGSM DONE S PSGOEEF(6)=1 G 6
W $C(7) D ENHLP^PSGOEM(53.1,5) G A5
;
6 ; hospital supplied self med
S MSG=0,PSGF2=6 S:PSGOEEF(PSGF2) BACK="6^PSGOE82"
A6 W !,"HOSPITAL SUPPLIED SELF MED: " W:PSGHSM]"" $P("NO^YES","^",PSGHSM+1),"// " R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOEE=0 G DONE
I "01"[X,$L(X)=1 S:X]"" PSGHSM=+X W " (",$P("NO^YES","^",PSGHSM+1),")" S MSG=0,PSGF2=5 G DONE
I X="@" W $C(7)," (Required)" G A6
I X?1"^".E D ENFF G:Y>0 @Y G A6
I X?1."?" D ENHLP^PSGOEM(53.1,6) G A6
D YN I S PSGHSM=$E(X)="Y" S MSG=0,PSGF2=5 G DONE
W $C(7) D ENHLP^PSGOEM(53.1,6) G A6
;
2 ; dispense drug multiple
S MSG=0,PSGF2=2,BACK="2^PSGOE82" K PSGOEEND
N PSGX,PSGXX F PSGXX=0:0 S PSGX=PSGXX,PSGXX=$O(^PS(53.45,PSJSYSP,2,PSGXX)) Q:'PSGXX
N PSJPNDRN I $G(PSGORD) I $E(PSGORD,$L(PSGORD))="P",$P($G(^PS(53.1,+PSGORD,0)),"^",24)="R" S PSJPNDRN=1 D
.S $P(PSJPNDRN,"^",2)="Dispense drugs for renewal orders cannot be deleted, but can be given an INACTIVE DATE. "
N DA,DIC,DIE,DR,DIR S DIE="^PS(53.45,",DA=PSJSYSP,DR=2,DR(2,53.4502)=".01;.02"_$S($G(PSJPNDRN):";.03",1:"") D ^DIE
I '$O(^PS(53.45,PSJSYSP,2,0)) W $C(7),!!,"WARNING: This order must have at least one dispense drug before pharmacy can",!?9,"verify it!",! S MSG=1
D DDOC(PSGX)
NEW PSJDOSE
D DOSECHK^PSJDOSE
I +$G(PSJDSFLG) D DSPWARN^PSJDOSE S PSGOEEF(109)=1
G DONE
;
40 ; comments
S MSG=0,PSGF2=40,BACK="40^PSGOE82",DA=PSJSYSP,DR=1,DIE="^PS(53.45," D ^DIE W ! G DONE
;
66 ; provider comments
;S MSG=0,PSGF2=66,BACK="66^PSGOE82",DA=PSJSYSP,DR=4,DIE="^PS(53.45," D ^DIE W ! G DONE
;
DONE ;
I PSGOEE G:'PSGOEEF(PSGF2) @BACK S PSGOEE=PSGOEEF(PSGF2)
K F,F0,PSGF2,F3,PSG,SDT Q
;
ENFF ; up-arrow to another field
S Y=-1 I '$D(PSGOEEF)!(X?1"^"1.9N) W $C(7)," ??" Q
S X=$E(X,2,99) I X=+X S Y=$S($D(PSGOEEF(X)):X,1:-1) W " " W:Y>0 $$CODES2^PSIVUTL(53.1,X) W:Y'>0 $C(7),"??" Q
K DIC S DIC="^DD(53.1,",DIC(0)="QEM",DIC("S")="I $D(PSGOEEF(+Y))" D ^DIC K DIC S Y=+Y S:Y>0 Y=$P($T(@("F"_Y)),";",3) Q
;
DEL ; delete entry
W !?3,"SURE YOU WANT TO DELETE" S %=0 D YN^DICN I %'=1 W $C(7)," <NOTHING DELETED>"
Q
;
YN ; yes/no as a set of codes
I X'?.U F Y=1:1:$L(X) I $E(X,Y)?1L S X=$E(X,1,Y-1)_$C($A(X,Y)-32)_$E(X,Y+1,$L(X))
F Y="NO","YES" I $P(Y,X)="" W $P(Y,X,2) Q
Q
DDOC(PSGX) ; Order check on additional dispens drug for allergy and adv. reactions.
N PSGY,PSGND1,PSGND3 S PSGY=0 F S PSGX=$O(^PS(53.45,PSJSYSP,2,PSGX)) Q:'PSGX S PSGY=$P($G(^PS(53.45,PSJSYSP,2,PSGX,0)),"^") Q:PSGY="" D
. N INTERVEN,PSJDDI,PSJIREQ,PSJRXREQ,PSJDD,PSGORQF,PSJPDRG S PSJDD=PSGY
. S Y=1,(PSJIREQ,PSJRXREQ,INTERVEN,X)=""
. D IVSOL^PSGSICHK
. I ($D(PSGORQF)) D
.. K ^PS(53.45,PSJSYSP,2,PSGX),^PS(53.45,PSJSYSP,2,"B",PSGY)
Q
;
F101 ;;101^PSGOE8
F109 ;;109^PSGOE8
F3 ;;3^PSGOE8
F7 ;;7^PSGOE8
PSGF26 ;;26^PSGOE8
F39 ;;39^PSGOE81
F8 ;;8^PSGOE81
F10 ;;10^PSGOE81
PSGF25 ;;25^PSGOE81
F1 ;;1^PSGOE82
F5 ;;5^PSGOE82
PSGF2 ;;2^PSGOE82
PSGOE82 ;BIR/CML3-NON-VERIFIED ORDER EDIT (CONT.) ;27 Jan 98 / 9:32 AM
+1 ;;5.0; INPATIENT MEDICATIONS ;**2,35,50,67,58,81,127,168**;16 DEC 97
+2 ;
+3 ; Reference to ^DD(53.1 is supported by DBIA #2256.
+4 ; Reference to ^VA(200 is supported by DBIA #10060.
+5 ; Reference to ^DIE is supported by DBIA #10018.
+6 ; Reference to ^DIC is supported by DBIA #10006.
+7 ; Reference to ^DICN is supported by DBIA #10009.
+8 ;
1 ; provider
+1 SET MSG=0
SET PSGF2=1
IF PSGOEEF(PSGF2)
SET BACK="1^PSGOE82"
A1 IF $GET(PSGORD)["P"
IF $GET(PSGP)
IF $$LASTREN^PSJLMPRI(PSGP,PSGORD)
Begin DoDot:1
+1 WRITE !?5,"This order has been renewed. Provider may not be edited at this point. "
DO PAUSE^VALM1
End DoDot:1
QUIT
+2 WRITE !,"PROVIDER: ",$SELECT(PSGPR:PSGPRN_"// ",1:"")
READ X:DTIME
IF X="^"!'$TEST
IF '$TEST
WRITE $CHAR(7)
SET PSGOEE=0
GOTO DONE
+3 IF $SELECT(X="":'PSGPR,1:X="@")
WRITE $CHAR(7)," (Required)"
SET X="?"
DO ENHLP^PSGOEM(53.1,1)
GOTO A1
+4 IF X=""
IF PSGPR
SET X=PSGPRN
IF PSGPR'=PSGPRN
IF $DATA(^VA(200,PSGPR,"PS"))
IF 0
WRITE " "_$PIECE(^("PS"),"^",2)_" "_$PIECE(^("PS"),"^",3)
GOTO DONE
+5 IF X?1."?"
DO ENHLP^PSGOEM(53.1,1)
+6 IF $EXTRACT(X)="^"
DO ENFF
IF Y>0
GOTO @Y
GOTO A1
+7 KILL DIC
SET DIC="^VA(200,"
SET DIC(0)="EMQZ"
SET DIC("S")="I $D(^(""PS"")),^(""PS""),$S('$P(^(""PS""),""^"",4):1,1:$P(^(""PS""),""^"",4)>DT)"
DO ^DIC
KILL DIC
IF Y'>0
GOTO A1
+8 SET PSGPR=+Y
SET PSGPRN=Y(0,0)
GOTO DONE
+9 ;
5 ; self med
+1 SET MSG=0
SET PSGF2=5
IF PSGOEEF(PSGF2)
SET BACK="5^PSGOE82"
KILL PSGOEEF(6)
IF PSGSM
SET PSGOEEF(6)=1
A5 WRITE !,"SELF MED: "
WRITE $PIECE("NO^YES","^",PSGSM+1),"// "
READ X:DTIME
IF X="^"!'$TEST
IF '$TEST
WRITE $CHAR(7)
SET PSGOEE=0
GOTO DONE
+1 ;I "01"[X,$L(X)<2 S:PSGSM=""&(X]"") PSGSM=X W:PSGSM]"" " (",$P("NO^YES","^",PSGSM+1),")" G:'PSGSM DONE S PSGOEEF(6)=1 G 6
+2 IF "01"[X
IF $LENGTH(X)<2
IF X]""
SET PSGSM=+X
IF PSGSM]""
WRITE " (",$PIECE("NO^YES","^",PSGSM+1),")"
IF 'PSGSM
GOTO DONE
SET PSGOEEF(6)=1
GOTO 6
+3 IF X="@"
WRITE $CHAR(7)," (Required)"
GOTO A5
+4 IF X?1"^".E
DO ENFF
IF Y>0
GOTO @Y
GOTO A5
+5 IF X?1."?"
DO ENHLP^PSGOEM(53.1,5)
GOTO A5
+6 DO YN
IF $TEST
SET PSGSM=$EXTRACT(X)="Y"
KILL PSGOEEF(6)
IF 'PSGSM
GOTO DONE
SET PSGOEEF(6)=1
GOTO 6
+7 WRITE $CHAR(7)
DO ENHLP^PSGOEM(53.1,5)
GOTO A5
+8 ;
6 ; hospital supplied self med
+1 SET MSG=0
SET PSGF2=6
IF PSGOEEF(PSGF2)
SET BACK="6^PSGOE82"
A6 WRITE !,"HOSPITAL SUPPLIED SELF MED: "
IF PSGHSM]""
WRITE $PIECE("NO^YES","^",PSGHSM+1),"// "
READ X:DTIME
IF X="^"!'$TEST
IF '$TEST
WRITE $CHAR(7)
SET PSGOEE=0
GOTO DONE
+1 IF "01"[X
IF $LENGTH(X)=1
IF X]""
SET PSGHSM=+X
WRITE " (",$PIECE("NO^YES","^",PSGHSM+1),")"
SET MSG=0
SET PSGF2=5
GOTO DONE
+2 IF X="@"
WRITE $CHAR(7)," (Required)"
GOTO A6
+3 IF X?1"^".E
DO ENFF
IF Y>0
GOTO @Y
GOTO A6
+4 IF X?1."?"
DO ENHLP^PSGOEM(53.1,6)
GOTO A6
+5 DO YN
IF $TEST
SET PSGHSM=$EXTRACT(X)="Y"
SET MSG=0
SET PSGF2=5
GOTO DONE
+6 WRITE $CHAR(7)
DO ENHLP^PSGOEM(53.1,6)
GOTO A6
+7 ;
2 ; dispense drug multiple
+1 SET MSG=0
SET PSGF2=2
SET BACK="2^PSGOE82"
KILL PSGOEEND
+2 NEW PSGX,PSGXX
FOR PSGXX=0:0
SET PSGX=PSGXX
SET PSGXX=$ORDER(^PS(53.45,PSJSYSP,2,PSGXX))
IF 'PSGXX
QUIT
+3 NEW PSJPNDRN
IF $GET(PSGORD)
IF $EXTRACT(PSGORD,$LENGTH(PSGORD))="P"
IF $PIECE($GET(^PS(53.1,+PSGORD,0)),"^",24)="R"
SET PSJPNDRN=1
Begin DoDot:1
+4 SET $PIECE(PSJPNDRN,"^",2)="Dispense drugs for renewal orders cannot be deleted, but can be given an INACTIVE DATE. "
End DoDot:1
+5 NEW DA,DIC,DIE,DR,DIR
SET DIE="^PS(53.45,"
SET DA=PSJSYSP
SET DR=2
SET DR(2,53.4502)=".01;.02"_$SELECT($GET(PSJPNDRN):";.03",1:"")
DO ^DIE
+6 IF '$ORDER(^PS(53.45,PSJSYSP,2,0))
WRITE $CHAR(7),!!,"WARNING: This order must have at least one dispense drug before pharmacy can",!?9,"verify it!",!
SET MSG=1
+7 DO DDOC(PSGX)
+8 NEW PSJDOSE
+9 DO DOSECHK^PSJDOSE
+10 IF +$GET(PSJDSFLG)
DO DSPWARN^PSJDOSE
SET PSGOEEF(109)=1
+11 GOTO DONE
+12 ;
40 ; comments
+1 SET MSG=0
SET PSGF2=40
SET BACK="40^PSGOE82"
SET DA=PSJSYSP
SET DR=1
SET DIE="^PS(53.45,"
DO ^DIE
WRITE !
GOTO DONE
+2 ;
66 ; provider comments
+1 ;S MSG=0,PSGF2=66,BACK="66^PSGOE82",DA=PSJSYSP,DR=4,DIE="^PS(53.45," D ^DIE W ! G DONE
+2 ;
DONE ;
+1 IF PSGOEE
IF 'PSGOEEF(PSGF2)
GOTO @BACK
SET PSGOEE=PSGOEEF(PSGF2)
+2 KILL F,F0,PSGF2,F3,PSG,SDT
QUIT
+3 ;
ENFF ; up-arrow to another field
+1 SET Y=-1
IF '$DATA(PSGOEEF)!(X?1"^"1.9N)
WRITE $CHAR(7)," ??"
QUIT
+2 SET X=$EXTRACT(X,2,99)
IF X=+X
SET Y=$SELECT($DATA(PSGOEEF(X)):X,1:-1)
WRITE " "
IF Y>0
WRITE $$CODES2^PSIVUTL(53.1,X)
IF Y'>0
WRITE $CHAR(7),"??"
QUIT
+3 KILL DIC
SET DIC="^DD(53.1,"
SET DIC(0)="QEM"
SET DIC("S")="I $D(PSGOEEF(+Y))"
DO ^DIC
KILL DIC
SET Y=+Y
IF Y>0
SET Y=$PIECE($TEXT(@("F"_Y)),";",3)
QUIT
+4 ;
DEL ; delete entry
+1 WRITE !?3,"SURE YOU WANT TO DELETE"
SET %=0
DO YN^DICN
IF %'=1
WRITE $CHAR(7)," <NOTHING DELETED>"
+2 QUIT
+3 ;
YN ; yes/no as a set of codes
+1 IF X'?.U
FOR Y=1:1:$LENGTH(X)
IF $EXTRACT(X,Y)?1L
SET X=$EXTRACT(X,1,Y-1)_$CHAR($ASCII(X,Y)-32)_$EXTRACT(X,Y+1,$LENGTH(X))
+2 FOR Y="NO","YES"
IF $PIECE(Y,X)=""
WRITE $PIECE(Y,X,2)
QUIT
+3 QUIT
DDOC(PSGX) ; Order check on additional dispens drug for allergy and adv. reactions.
+1 NEW PSGY,PSGND1,PSGND3
SET PSGY=0
FOR
SET PSGX=$ORDER(^PS(53.45,PSJSYSP,2,PSGX))
IF 'PSGX
QUIT
SET PSGY=$PIECE($GET(^PS(53.45,PSJSYSP,2,PSGX,0)),"^")
IF PSGY=""
QUIT
Begin DoDot:1
+2 NEW INTERVEN,PSJDDI,PSJIREQ,PSJRXREQ,PSJDD,PSGORQF,PSJPDRG
SET PSJDD=PSGY
+3 SET Y=1
SET (PSJIREQ,PSJRXREQ,INTERVEN,X)=""
+4 DO IVSOL^PSGSICHK
+5 IF ($DATA(PSGORQF))
Begin DoDot:2
+6 KILL ^PS(53.45,PSJSYSP,2,PSGX),^PS(53.45,PSJSYSP,2,"B",PSGY)
End DoDot:2
End DoDot:1
+7 QUIT
+8 ;
F101 ;;101^PSGOE8
F109 ;;109^PSGOE8
F3 ;;3^PSGOE8
F7 ;;7^PSGOE8
PSGF26 ;;26^PSGOE8
F39 ;;39^PSGOE81
F8 ;;8^PSGOE81
F10 ;;10^PSGOE81
PSGF25 ;;25^PSGOE81
F1 ;;1^PSGOE82
F5 ;;5^PSGOE82
PSGF2 ;;2^PSGOE82