PSOARCF3 ;BHAM ISC/LGH,LC - RX RETRIEVE ; 07/07/92
;;7.0;OUTPATIENT PHARMACY;;DEC 1997
U PSOAT D PSOAT
S PSOAPF=0
R R X:DTIME G END:X="" G:X'="!" R
PAR R X:DTIME G:'$T END G:$P(X,"^")=NM&($G(SS)=$P(X,"^",2)) PR G PAR
END ;I $D(PSOAT) U IO(0) S IOP=PSOAT D ^%ZIS D ^%ZISC K IOP
Q ;I $D(PSOAP) U IO(0) S IOP=PSOAP D ^%ZIS D ^%ZISC K IOP
K PSOACPM,PSOACPL,PSOACPF,NM,T,RX,PSOAP,PSOAT,^TMP($J,"ZRX"),RA,RR,FFX,I,GD,DG,D,A
Q
PR ;PATIENT READ
S T(1)=X R X:DTIME G:'$T END S T(2)=X,D=$P(T(2),"^",2),A=$P(T(2),"^",3),DG=$P(T(2),"^",4),GD=$P(T(2),"^",5)
I D>0 F I=1:1:D R X:DTIME G:'$T END S T(2,I)=X
I A>0 F I=1:1:A R X:DTIME G:'$T END S T(3,I)=X
I DG>0 F I=1:1:DG R X:DTIME G:'$T END S T(4,I)=X
I GD>0 F I=1:1:GD R X:DTIME G:'$T END S T(5,I)=X
D:'PSOAPF DPR,HD1^PSOARCF4 S PSOAPF=1 ;DISPLAY DEMO INFO
RXR R X:DTIME G:'$T END G END:X="" I X="!" R X:DTIME G:'$T END G:$P(X,"^")'=NM END G PR
S T(6)=X R X:DTIME G:'$T END S T(10)=X R X:DTIME G:'$T END S T(7)=X S RR=$P(T(7),"^",14),RA=$P(T(7),"^",15)
I RR>0 F I=1:1:RR R X:DTIME G:'$T END S T(8,I)=X
I RA>0 F I=1:1:RA R X:DTIME G:'$T END S T(9,I)=X
D RXP W:$Y>(PSOACPL-15) @PSOACPF G RXR
DPR U PSOAP W @PSOACPF,!!,NM,?55,"ID#: ",$P(T(1),"^",2),?75,"ELIG: ",$P(T(1),"^",3),!,$P(T(1),"^",4),?55,"DOB: ",$P(T(1),"^",5),?75,"PHONE: ",$P(T(1),"^",6)
W !,$P(T(1),"^",7),!,$P(T(1),"^",8)," ",$P(T(1),"^",9)
I +$P(T(1),"^",10) W !,"CANNOT USE SAFETY CAPS." I +$P(T(1),"^",11) W ?40,"DIALYSIS PATIENT"
I $P(T(2),"^")'="" W !,$P(T(2),"^")
W !,"DISABILITIES: " G MA:D'>0
F I=1:1:D W:($Y+$L(T(2,I))+1)>PSOACPM !?15 W T(2,I),","
MA W !!,"REACTIONS: ",$S(((A'>0)&(DG'>0)&(GD'>0)):"UNKNOWN",1:"")
I A>0 F I=1:1:A W:($Y+$L(T(3,I))+1)>PSOACPM !?15 W T(3,I),","
I DG>0 F I=1:1:DG W:($Y+$L(T(4,I))+1)>PSOACPM !?15 W T(4,I),","
I GD>0 F I=1:1:GD W:($Y+$L(T(5,I))+1)>PSOACPM !?15 W T(5,I),","
Q
RXP U PSOAP W !!,"RX: ",$P(T(6),"^"),?20,$P(T(6),"^",2),?65,"TRADE NAME: ",$P(T(6),"^",3),?96,"QTY: ",$P(T(6),"^",4)," ",$P(T(6),"^",5)," DAY SUPPLY"
W !?7,"SIG: ",T(10),!?4,"LATEST: ",$P(T(6),"^",7),?37,"# OF REFILLS: ",$P(T(6),"^",8)," REMAINING: ",$P(T(6),"^",9),?70,"PROVIDER:",$P(T(6),"^",10)
W !?4,"ISSUED: ",$P(T(6),"^",11),?43,"CLINIC: ",$P(T(7),"^"),?71,"DIVISION: ",$P(T(7),"^",2),!?4,"LOGGED: ",$P(T(7),"^",3),?42,"ROUTING: ",$P(T(7),"^",4),?69,"CLERK CODE: ",$P(T(7),"^",5)
W !?3,"EXPIRES: ",$P(T(7),"^",6),?46,"CAP: ",$P(T(7),"^",7),?73,"STATUS: ",$P(T(7),"^",8),!,?4,"FILLED: ",$P(T(7),"^",9),?24,"PHARMACIST: ",$P(T(7),"^",10),?56,"LOT #: ",$P(T(7),"^",11),?74,"QTY: ",$P(T(7),"^",12)
I $P(T(7),"^",13)]"" W !?3,"REMARKS: ",$P(T(7),"^",13)
G:RR'>0 ACT D HEAD
F I=1:1:RR W !,I,?3,$P(T(8,I),"^"),?14,$P(T(8,I),"^",2),?27,$P(T(8,I),"^",3),?32,$P(T(8,I),"^",4),?40,$P(T(8,I),"^",5),?52,$P(T(8,I),"^",6),?70,$P(T(8,I),"^",7) W:$P(T(8,I),"^",8)'="" !?5,"REMARKS: ",$P(T(8,I),"^",8)
W !
ACT Q:RA'>0 D H1 F I=1:2:RA D ACT1
K T(9) Q
ACT1 W !,I,?3,$P(T(9,I),"^"),?14,$P(T(9,I),"^",2),?25,$P(T(9,I),"^",3),?35,$P(T(9,I),"^",4) G:'$D(T(9,I+1)) REM
W ?60,I+1,?63,$P(T(9,I+1),"^"),?74,$P(T(9,I+1),"^",2),?85,$P(T(9,I+1),"^",3),?95,$P(T(9,I+1),"^",4)
REM W ! I $P(T(9,I),"^",5)]"" W ?5,"COMMENT: ",$P(T(9,I),"^",5)
I $D(T(9,I+1)) W:$P(T(9,I+1),"^",5)]"" ?65,"COMMENT: ",$P(T(9,I+1),"^",5)
Q
PSOAT ;CHECK FOR EOF
U PSOAT S:$$STATUS^%ZISH PSORWND=$$REWIND^%ZIS(PSOAIO,PSOAIOT,PSOAPAR) I $G(PSORWND) U IO(0) W !!,"HFS file failed to rewind" G END
U PSOAT
Q
HEAD D:$Y>(PSOACPL-20) HD1^PSOARCF4
W !,"#",?3,"LOG DATE",?14,"REFILL DATE",?27,"QTY",?32,"ROUTING",?40,"LOT #",?52,"PHARMACIST",?70,"DIVISION",! F I=1:1:79 W "="
S FFX=0 Q
H1 D:$Y>(PSOACPL-20) HD1^PSOARCF4
W !!,"ACTIVITY LOG:",!,"#",?3,"DATE",?14,"REASON",?25,"RX REF",?35,"SECURITY",?60,"#",?63,"DATE",?74,"REASON",?85,"RX REF",?95,"SECURITY",! F I=1:1:55 W "="
W ?60 F I=1:1:60 W "="
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOARCF3 3866 printed Nov 22, 2024@17:34:13 Page 2
PSOARCF3 ;BHAM ISC/LGH,LC - RX RETRIEVE ; 07/07/92
+1 ;;7.0;OUTPATIENT PHARMACY;;DEC 1997
+2 USE PSOAT
DO PSOAT
+3 SET PSOAPF=0
R READ X:DTIME
if X=""
GOTO END
if X'="!"
GOTO R
PAR READ X:DTIME
if '$TEST
GOTO END
if $PIECE(X,"^")=NM&($GET(SS)=$PIECE(X,"^",2))
GOTO PR
GOTO PAR
END ;I $D(PSOAT) U IO(0) S IOP=PSOAT D ^%ZIS D ^%ZISC K IOP
Q ;I $D(PSOAP) U IO(0) S IOP=PSOAP D ^%ZIS D ^%ZISC K IOP
+1 KILL PSOACPM,PSOACPL,PSOACPF,NM,T,RX,PSOAP,PSOAT,^TMP($JOB,"ZRX"),RA,RR,FFX,I,GD,DG,D,A
+2 QUIT
PR ;PATIENT READ
+1 SET T(1)=X
READ X:DTIME
if '$TEST
GOTO END
SET T(2)=X
SET D=$PIECE(T(2),"^",2)
SET A=$PIECE(T(2),"^",3)
SET DG=$PIECE(T(2),"^",4)
SET GD=$PIECE(T(2),"^",5)
+2 IF D>0
FOR I=1:1:D
READ X:DTIME
if '$TEST
GOTO END
SET T(2,I)=X
+3 IF A>0
FOR I=1:1:A
READ X:DTIME
if '$TEST
GOTO END
SET T(3,I)=X
+4 IF DG>0
FOR I=1:1:DG
READ X:DTIME
if '$TEST
GOTO END
SET T(4,I)=X
+5 IF GD>0
FOR I=1:1:GD
READ X:DTIME
if '$TEST
GOTO END
SET T(5,I)=X
+6 ;DISPLAY DEMO INFO
if 'PSOAPF
DO DPR
DO HD1^PSOARCF4
SET PSOAPF=1
RXR READ X:DTIME
if '$TEST
GOTO END
if X=""
GOTO END
IF X="!"
READ X:DTIME
if '$TEST
GOTO END
if $PIECE(X,"^")'=NM
GOTO END
GOTO PR
+1 SET T(6)=X
READ X:DTIME
if '$TEST
GOTO END
SET T(10)=X
READ X:DTIME
if '$TEST
GOTO END
SET T(7)=X
SET RR=$PIECE(T(7),"^",14)
SET RA=$PIECE(T(7),"^",15)
+2 IF RR>0
FOR I=1:1:RR
READ X:DTIME
if '$TEST
GOTO END
SET T(8,I)=X
+3 IF RA>0
FOR I=1:1:RA
READ X:DTIME
if '$TEST
GOTO END
SET T(9,I)=X
+4 DO RXP
if $Y>(PSOACPL-15)
WRITE @PSOACPF
GOTO RXR
DPR USE PSOAP
WRITE @PSOACPF,!!,NM,?55,"ID#: ",$PIECE(T(1),"^",2),?75,"ELIG: ",$PIECE(T(1),"^",3),!,$PIECE(T(1),"^",4),?55,"DOB: ",$PIECE(T(1),"^",5),?75,"PHONE: ",$PIECE(T(1),"^",6)
+1 WRITE !,$PIECE(T(1),"^",7),!,$PIECE(T(1),"^",8)," ",$PIECE(T(1),"^",9)
+2 IF +$PIECE(T(1),"^",10)
WRITE !,"CANNOT USE SAFETY CAPS."
IF +$PIECE(T(1),"^",11)
WRITE ?40,"DIALYSIS PATIENT"
+3 IF $PIECE(T(2),"^")'=""
WRITE !,$PIECE(T(2),"^")
+4 WRITE !,"DISABILITIES: "
if D'>0
GOTO MA
+5 FOR I=1:1:D
if ($Y+$LENGTH(T(2,I))+1)>PSOACPM
WRITE !?15
WRITE T(2,I),","
MA WRITE !!,"REACTIONS: ",$SELECT(((A'>0)&(DG'>0)&(GD'>0)):"UNKNOWN",1:"")
+1 IF A>0
FOR I=1:1:A
if ($Y+$LENGTH(T(3,I))+1)>PSOACPM
WRITE !?15
WRITE T(3,I),","
+2 IF DG>0
FOR I=1:1:DG
if ($Y+$LENGTH(T(4,I))+1)>PSOACPM
WRITE !?15
WRITE T(4,I),","
+3 IF GD>0
FOR I=1:1:GD
if ($Y+$LENGTH(T(5,I))+1)>PSOACPM
WRITE !?15
WRITE T(5,I),","
+4 QUIT
RXP USE PSOAP
WRITE !!,"RX: ",$PIECE(T(6),"^"),?20,$PIECE(T(6),"^",2),?65,"TRADE NAME: ",$PIECE(T(6),"^",3),?96,"QTY: ",$PIECE(T(6),"^",4)," ",$PIECE(T(6),"^",5)," DAY SUPPLY"
+1 WRITE !?7,"SIG: ",T(10),!?4,"LATEST: ",$PIECE(T(6),"^",7),?37,"# OF REFILLS: ",$PIECE(T(6),"^",8)," REMAINING: ",$PIECE(T(6),"^",9),?70,"PROVIDER:",$PIECE(T(6),"^",10)
+2 WRITE !?4,"ISSUED: ",$PIECE(T(6),"^",11),?43,"CLINIC: ",$PIECE(T(7),"^"),?71,"DIVISION: ",$PIECE(T(7),"^",2),!?4,"LOGGED: ",$PIECE(T(7),"^",3),?42,"ROUTING: ",$PIECE(T(7),"^",4),?69,"CLERK CODE: ",$PIECE(T(7),"^",5)
+3 WRITE !?3,"EXPIRES: ",$PIECE(T(7),"^",6),?46,"CAP: ",$PIECE(T(7),"^",7),?73,"STATUS: ",$PIECE(T(7),"^",8),!,?4,"FILLED: ",$PIECE(T(7),"^",9),?24,"PHARMACIST: ",$PIECE(T(7),"^",10),?56,"LOT #: ",$PIECE(T(7),"^",11),?74,"QTY: ",$PIECE(T(7),"^",12
)
+4 IF $PIECE(T(7),"^",13)]""
WRITE !?3,"REMARKS: ",$PIECE(T(7),"^",13)
+5 if RR'>0
GOTO ACT
DO HEAD
+6 FOR I=1:1:RR
WRITE !,I,?3,$PIECE(T(8,I),"^"),?14,$PIECE(T(8,I),"^",2),?27,$PIECE(T(8,I),"^",3),?32,$PIECE(T(8,I),"^",4),?40,$PIECE(T(8,I),"^",5),?52,$PIECE(T(8,I),"^",6),?70,$PIECE(T(8,I),"^",7)
if $PIECE(T(8,I),"^",8)'=""
WRITE !?5,"REMARKS: ",$PIECE(T(8,I),"^",8)
+7 WRITE !
ACT if RA'>0
QUIT
DO H1
FOR I=1:2:RA
DO ACT1
+1 KILL T(9)
QUIT
ACT1 WRITE !,I,?3,$PIECE(T(9,I),"^"),?14,$PIECE(T(9,I),"^",2),?25,$PIECE(T(9,I),"^",3),?35,$PIECE(T(9,I),"^",4)
if '$DATA(T(9,I+1))
GOTO REM
+1 WRITE ?60,I+1,?63,$PIECE(T(9,I+1),"^"),?74,$PIECE(T(9,I+1),"^",2),?85,$PIECE(T(9,I+1),"^",3),?95,$PIECE(T(9,I+1),"^",4)
REM WRITE !
IF $PIECE(T(9,I),"^",5)]""
WRITE ?5,"COMMENT: ",$PIECE(T(9,I),"^",5)
+1 IF $DATA(T(9,I+1))
if $PIECE(T(9,I+1),"^",5)]""
WRITE ?65,"COMMENT: ",$PIECE(T(9,I+1),"^",5)
+2 QUIT
PSOAT ;CHECK FOR EOF
+1 USE PSOAT
if $$STATUS^%ZISH
SET PSORWND=$$REWIND^%ZIS(PSOAIO,PSOAIOT,PSOAPAR)
IF $GET(PSORWND)
USE IO(0)
WRITE !!,"HFS file failed to rewind"
GOTO END
+2 USE PSOAT
+3 QUIT
HEAD if $Y>(PSOACPL-20)
DO HD1^PSOARCF4
+1 WRITE !,"#",?3,"LOG DATE",?14,"REFILL DATE",?27,"QTY",?32,"ROUTING",?40,"LOT #",?52,"PHARMACIST",?70,"DIVISION",!
FOR I=1:1:79
WRITE "="
+2 SET FFX=0
QUIT
H1 if $Y>(PSOACPL-20)
DO HD1^PSOARCF4
+1 WRITE !!,"ACTIVITY LOG:",!,"#",?3,"DATE",?14,"REASON",?25,"RX REF",?35,"SECURITY",?60,"#",?63,"DATE",?74,"REASON",?85,"RX REF",?95,"SECURITY",!
FOR I=1:1:55
WRITE "="
+2 WRITE ?60
FOR I=1:1:60
WRITE "="
+3 QUIT