SRSWL3 ;B'HAM ISC/MAM - WAITING LIST, EXTENDED-ALL ; 17 OCT 1989 7:35 AM
;;3.0; Surgery ;**34**;24 Jun 93
W ! K %ZIS,POP,IOP,IO("Q") S %ZIS("A")="Print to Device: ",%ZIS="Q" D ^%ZIS Q:POP
I $D(IO("Q")) K IO("Q") S ZTDESC="SURGERY WAITING LIST",ZTRTN="BEG^SRSWL3" D ^%ZTLOAD G END
BEG ; entry when queued
U IO S (SRSOUT,SRHDR)=0 D NOW^%DTC S Y=% D D^DIQ S SRTIME=$E(Y,1,12)_" at "_$E(Y,14,18)
S SRSS=0 F S SRSS=$O(^SRO(133.8,"AWL",SRSS)) Q:'SRSS!(SRSOUT) S SRSNM=$P(^SRO(133.8,SRSS,0),"^"),SRSNM=$P(^SRO(137.45,SRSNM,0),"^") D PAGE S SRSDT=0 F S SRSDT=$O(^SRO(133.8,"AWL",SRSS,SRSDT)) Q:'SRSDT!(SRSOUT) D MORE
END I $E(IOST)="P" S SRSOUT=1 W @IOF
I $D(ZTQUEUED) K ^TMP("SR",$J) Q:$G(ZTSTOP) S ZTREQ="@" Q
I 'SRSOUT W !!,"Press RETURN to continue " R X:DTIME W @IOF
D ^%ZISC,^SRSKILL K SRTN
Q
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
S SRHDR=1 W:$Y @IOF W !,"Surgery Waiting List for "_SRSNM,!,"Printed "_SRTIME,! F LINE=1:1:80 W "="
Q
MORE ; continue looping on 'WL' x-ref
S SROFN=0 F S SROFN=$O(^SRO(133.8,"AWL",SRSS,SRSDT,SROFN)) Q:'SROFN!(SRSOUT) D PRINT
Q
PRINT ; print information
I $Y+20>IOSL D PAGE Q:SRSOUT
S SRW=^SRO(133.8,SRSS,1,SROFN,0),DFN=$P(SRW,"^") D DEM^VADPT S SRSDPT=VADM(1)_" ("_VA("PID")_")",SROPER=$P(SRW,"^",2),(Y,SRDT)=SRSDT D D^DIQ S SRDT=$E(Y,1,12)_" "_$E(Y,14,18)
OUT S (Y,SRADT)=$P(SRW,"^",4) I Y D D^DIQ S SRADT=$E(Y,1,12)
S (Y,TEMPDT)=$P(SRW,"^",5) I Y D D^DIQ S TEMPDT=Y
D ADD^VADPT
S SRSPH1=VAPA(8)
S SRSDPT(.13)=$S($D(^DPT(DFN,.13)):^(.13),1:"") S SRSPH2=$P(SRSDPT(.13),"^",2) S:SRSPH1="" SRSPH1="NOT ENTERED" S:SRSPH2="" SRSPH2="NOT ENTERED"
K SROPS,MM,MMM S:$L(SROPER)<60 SROPS(1)=SROPER I $L(SROPER)>59 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
W !,"Patient:",?14,SRSDPT,!,"Date Entered: ",?12,SRDT,!,"Procedure: ",?14,SROPS(1) I $D(SROPS(2)) W !,?14,SROPS(2)
W !!,"Tentative Admission Date: "_$S(SRADT="":"None Specified",1:SRADT)
W !,"Tentative Date of Operation: "_$S(TEMPDT="":"None Specified",1:TEMPDT)
D ^SRSWL5
K ^UTILITY($J,"W") I $O(^SRO(133.8,SRSS,1,SROFN,2,0)) W !!,"Comments: " S SRCOM=0 F I=0:0 S SRCOM=$O(^SRO(133.8,SRSS,1,SROFN,2,SRCOM)) Q:'SRCOM S X=^SRO(133.8,SRSS,1,SROFN,2,SRCOM,0),DIWL=3,DIWR=78 D ^DIWP
I $D(^UTILITY($J,"W")) F X=1:1:^UTILITY($J,"W",3) W !,?3,^UTILITY($J,"W",3,X,0)
W !!," Home Phone: "_SRSPH1,?40,"Work Phone: "_SRSPH2
; VAPA contents are (1)-street add 1 (2)-street add 2 (3)-street add 3
; (4)-city (5)-state (6)-zip (8)-home phone
W !," Address: ",?14,VAPA(1) W:VAPA(2)'="" !,?14,VAPA(2) W:VAPA(3)'="" !,?14,VAPA(3) W:VAPA(4)'="" !,?14,VAPA(4) W:$P(VAPA(5),U,2)'="" ", "_$P(VAPA(5),U,2)_" "_VAPA(6)
I $O(^SRO(133.8,SRSS,1,SROFN,1,0)) W !!,"Referring Physician/Institution: "
S SREFER=0 F K SRPHY S SREFER=$O(^SRO(133.8,SRSS,1,SROFN,1,SREFER)) Q:'SREFER D
.S X=^SRO(133.8,SRSS,1,SROFN,1,SREFER,0),SRPHY("NAME")=$P(X,"^"),SRPHY("ADD")=$P(X,"^",2),SRPHY("CITY")=$P(X,"^",3)
.S Y=$P(X,"^",4),SRPHY("STATE")=$S(Y:$P(^DIC(5,Y,0),"^"),1:""),SRPHY("ZIP")=$P(X,"^",5),SRPHY("PH")=$P(X,"^",6)
.W !,?5,SRPHY("NAME"),?40,"Phone: "_SRPHY("PH"),!,?8,SRPHY("ADD") W:SRPHY("CITY")'="" !,?8,SRPHY("CITY")_", "_SRPHY("STATE")_" "_SRPHY("ZIP")
W ! F LINE=1:1:80 W "-"
Q
LOOP ; break operation if greater than 59 characters
S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<59 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q
PAGE ; end of page
I 'SRHDR S SRHDR=1 D HDR Q
I $E(IOST)'="P" W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
D HDR
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRSWL3 3630 printed Oct 16, 2024@18:48:41 Page 2
SRSWL3 ;B'HAM ISC/MAM - WAITING LIST, EXTENDED-ALL ; 17 OCT 1989 7:35 AM
+1 ;;3.0; Surgery ;**34**;24 Jun 93
+2 WRITE !
KILL %ZIS,POP,IOP,IO("Q")
SET %ZIS("A")="Print to Device: "
SET %ZIS="Q"
DO ^%ZIS
if POP
QUIT
+3 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTDESC="SURGERY WAITING LIST"
SET ZTRTN="BEG^SRSWL3"
DO ^%ZTLOAD
GOTO END
BEG ; entry when queued
+1 USE IO
SET (SRSOUT,SRHDR)=0
DO NOW^%DTC
SET Y=%
DO D^DIQ
SET SRTIME=$EXTRACT(Y,1,12)_" at "_$EXTRACT(Y,14,18)
+2 SET SRSS=0
FOR
SET SRSS=$ORDER(^SRO(133.8,"AWL",SRSS))
if 'SRSS!(SRSOUT)
QUIT
SET SRSNM=$PIECE(^SRO(133.8,SRSS,0),"^")
SET SRSNM=$PIECE(^SRO(137.45,SRSNM,0),"^")
DO PAGE
SET SRSDT=0
FOR
SET SRSDT=$ORDER(^SRO(133.8,"AWL",SRSS,SRSDT))
if 'SRSDT!(SRSOUT)
QUIT
DO MORE
END IF $EXTRACT(IOST)="P"
SET SRSOUT=1
WRITE @IOF
+1 IF $DATA(ZTQUEUED)
KILL ^TMP("SR",$JOB)
if $GET(ZTSTOP)
QUIT
SET ZTREQ="@"
QUIT
+2 IF 'SRSOUT
WRITE !!,"Press RETURN to continue "
READ X:DTIME
WRITE @IOF
+3 DO ^%ZISC
DO ^SRSKILL
KILL SRTN
+4 QUIT
HDR ; print heading
+1 IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRSOUT=1
QUIT
+2 SET SRHDR=1
if $Y
WRITE @IOF
WRITE !,"Surgery Waiting List for "_SRSNM,!,"Printed "_SRTIME,!
FOR LINE=1:1:80
WRITE "="
+3 QUIT
MORE ; continue looping on 'WL' x-ref
+1 SET SROFN=0
FOR
SET SROFN=$ORDER(^SRO(133.8,"AWL",SRSS,SRSDT,SROFN))
if 'SROFN!(SRSOUT)
QUIT
DO PRINT
+2 QUIT
PRINT ; print information
+1 IF $Y+20>IOSL
DO PAGE
if SRSOUT
QUIT
+2 SET SRW=^SRO(133.8,SRSS,1,SROFN,0)
SET DFN=$PIECE(SRW,"^")
DO DEM^VADPT
SET SRSDPT=VADM(1)_" ("_VA("PID")_")"
SET SROPER=$PIECE(SRW,"^",2)
SET (Y,SRDT)=SRSDT
DO D^DIQ
SET SRDT=$EXTRACT(Y,1,12)_" "_$EXTRACT(Y,14,18)
OUT SET (Y,SRADT)=$PIECE(SRW,"^",4)
IF Y
DO D^DIQ
SET SRADT=$EXTRACT(Y,1,12)
+1 SET (Y,TEMPDT)=$PIECE(SRW,"^",5)
IF Y
DO D^DIQ
SET TEMPDT=Y
+2 DO ADD^VADPT
+3 SET SRSPH1=VAPA(8)
+4 SET SRSDPT(.13)=$SELECT($DATA(^DPT(DFN,.13)):^(.13),1:"")
SET SRSPH2=$PIECE(SRSDPT(.13),"^",2)
if SRSPH1=""
SET SRSPH1="NOT ENTERED"
if SRSPH2=""
SET SRSPH2="NOT ENTERED"
+5 KILL SROPS,MM,MMM
if $LENGTH(SROPER)<60
SET SROPS(1)=SROPER
IF $LENGTH(SROPER)>59
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
if MMM=""
QUIT
+6 WRITE !,"Patient:",?14,SRSDPT,!,"Date Entered: ",?12,SRDT,!,"Procedure: ",?14,SROPS(1)
IF $DATA(SROPS(2))
WRITE !,?14,SROPS(2)
+7 WRITE !!,"Tentative Admission Date: "_$SELECT(SRADT="":"None Specified",1:SRADT)
+8 WRITE !,"Tentative Date of Operation: "_$SELECT(TEMPDT="":"None Specified",1:TEMPDT)
+9 DO ^SRSWL5
+10 KILL ^UTILITY($JOB,"W")
IF $ORDER(^SRO(133.8,SRSS,1,SROFN,2,0))
WRITE !!,"Comments: "
SET SRCOM=0
FOR I=0:0
SET SRCOM=$ORDER(^SRO(133.8,SRSS,1,SROFN,2,SRCOM))
if 'SRCOM
QUIT
SET X=^SRO(133.8,SRSS,1,SROFN,2,SRCOM,0)
SET DIWL=3
SET DIWR=78
DO ^DIWP
+11 IF $DATA(^UTILITY($JOB,"W"))
FOR X=1:1:^UTILITY($JOB,"W",3)
WRITE !,?3,^UTILITY($JOB,"W",3,X,0)
+12 WRITE !!," Home Phone: "_SRSPH1,?40,"Work Phone: "_SRSPH2
+13 ; VAPA contents are (1)-street add 1 (2)-street add 2 (3)-street add 3
+14 ; (4)-city (5)-state (6)-zip (8)-home phone
+15 WRITE !," Address: ",?14,VAPA(1)
if VAPA(2)'=""
WRITE !,?14,VAPA(2)
if VAPA(3)'=""
WRITE !,?14,VAPA(3)
if VAPA(4)'=""
WRITE !,?14,VAPA(4)
if $PIECE(VAPA(5),U,2)'=""
WRITE ", "_$PIECE(VAPA(5),U,2)_" "_VAPA(6)
+16 IF $ORDER(^SRO(133.8,SRSS,1,SROFN,1,0))
WRITE !!,"Referring Physician/Institution: "
+17 SET SREFER=0
FOR
KILL SRPHY
SET SREFER=$ORDER(^SRO(133.8,SRSS,1,SROFN,1,SREFER))
if 'SREFER
QUIT
Begin DoDot:1
+18 SET X=^SRO(133.8,SRSS,1,SROFN,1,SREFER,0)
SET SRPHY("NAME")=$PIECE(X,"^")
SET SRPHY("ADD")=$PIECE(X,"^",2)
SET SRPHY("CITY")=$PIECE(X,"^",3)
+19 SET Y=$PIECE(X,"^",4)
SET SRPHY("STATE")=$SELECT(Y:$PIECE(^DIC(5,Y,0),"^"),1:"")
SET SRPHY("ZIP")=$PIECE(X,"^",5)
SET SRPHY("PH")=$PIECE(X,"^",6)
+20 WRITE !,?5,SRPHY("NAME"),?40,"Phone: "_SRPHY("PH"),!,?8,SRPHY("ADD")
if SRPHY("CITY")'=""
WRITE !,?8,SRPHY("CITY")_", "_SRPHY("STATE")_" "_SRPHY("ZIP")
End DoDot:1
+21 WRITE !
FOR LINE=1:1:80
WRITE "-"
+22 QUIT
LOOP ; break operation if greater than 59 characters
+1 SET SROPS(M)=""
FOR LOOP=1:1
SET MM=$PIECE(SROPER," ")
SET MMM=$PIECE(SROPER," ",2,200)
if MMM=""
QUIT
if $LENGTH(SROPS(M))+$LENGTH(MM)'<59
QUIT
SET SROPS(M)=SROPS(M)_MM_" "
SET SROPER=MMM
+2 QUIT
PAGE ; end of page
+1 IF 'SRHDR
SET SRHDR=1
DO HDR
QUIT
+2 IF $EXTRACT(IOST)'="P"
WRITE !!,"Press RETURN to continue, or '^' to quit: "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+3 DO HDR
+4 QUIT