SRSWL15 ;B'HAM ISC/MAM - WAITING LIST, EXTENDED-ONE ; 17 OCT 1989 7:35 AM
;;3.0; Surgery ;**34**;24 Jun 93
W ! K %ZIS,POP,IOP,IO("Q") S %ZIS("A")="Print the Waiting List on which Device: ",%ZIS="Q" D ^%ZIS Q:POP
I $D(IO("Q")) K IO("Q") S ZTDESC="SURGERY WAITING LIST",ZTRTN="BEG^SRSWL15" D ^%ZTLOAD G END
BEG ; entry when queued
K ^TMP("SR",$J)
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)
;
; The AP cross reference is used to get the Patient Number, the record
; number and sub-record number associated with that Patient.
; SRPNM is set to Patient Number; SRSS=the record #; SROFN =
; sub-record; SRSNM is set to the Surgical Specialty. The TMP
; global is set to contain the Surgical Specialty, Tentative Date
; of Operation, and corresponding record and sub-record numbers.
;
S SRPNM="" F S SRPNM=$O(^SRO(133.8,"AP",SRPNM)) Q:SRPNM="" S SROFN="" F S SROFN=$O(^SRO(133.8,"AP",SRPNM,SRSS,SROFN)) Q:SROFN="" D MORE
;
; Below, extract information from TMP in order of Surgical
; Specialty and within Surgical Specialty in order by Tentative Date
; of Operation.
;
D HDR S SROPDT="" F S SROPDT=$O(^TMP("SR",$J,SRSNM,SROPDT)) Q:SROPDT=""!(SRSOUT) S SRSS="" F S SRSS=$O(^TMP("SR",$J,SRSNM,SROPDT,SRSS)) Q:'SRSS!(SRSOUT) D ANOTHER
END I $E(IOST)="P" W ! 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
MORE S SRTEMP=^SRO(133.8,SRSS,1,SROFN,0),SROPDT=$P($G(SRTEMP),"^",5),SROPDT=$S(SROPDT'="":SROPDT,1:"None Specified") S ^TMP("SR",$J,SRSNM,SROPDT,SRSS,SROFN)=""
Q
ANOTHER S SROFN="" F S SROFN=$O(^TMP("SR",$J,SRSNM,SROPDT,SRSS,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=$P(SRW,"^",3) D D^DIQ S SRDT=$E(Y,1,12)_" "_$E(Y,14,18)
D OUT^SRSWL3
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
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
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
AGAIN ; reprint patient name, date entered, and procedure when referring
; physician will not fit on first page
Q:$Y+6<IOSL
D PAGE Q:SRSOUT
W !,"Patient:",?14,SRSDPT,?65,"(continued)",!,"Date Entered:",?14,SRDT,!,"Procedure:",?14,SROPS(1) I $D(SROPS(2)) W !,?14,SROPS(2)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRSWL15 2876 printed Dec 13, 2024@02:48 Page 2
SRSWL15 ;B'HAM ISC/MAM - WAITING LIST, EXTENDED-ONE ; 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 the Waiting List on which 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^SRSWL15"
DO ^%ZTLOAD
GOTO END
BEG ; entry when queued
+1 KILL ^TMP("SR",$JOB)
+2 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)
+3 ;
+4 ; The AP cross reference is used to get the Patient Number, the record
+5 ; number and sub-record number associated with that Patient.
+6 ; SRPNM is set to Patient Number; SRSS=the record #; SROFN =
+7 ; sub-record; SRSNM is set to the Surgical Specialty. The TMP
+8 ; global is set to contain the Surgical Specialty, Tentative Date
+9 ; of Operation, and corresponding record and sub-record numbers.
+10 ;
+11 SET SRPNM=""
FOR
SET SRPNM=$ORDER(^SRO(133.8,"AP",SRPNM))
if SRPNM=""
QUIT
SET SROFN=""
FOR
SET SROFN=$ORDER(^SRO(133.8,"AP",SRPNM,SRSS,SROFN))
if SROFN=""
QUIT
DO MORE
+12 ;
+13 ; Below, extract information from TMP in order of Surgical
+14 ; Specialty and within Surgical Specialty in order by Tentative Date
+15 ; of Operation.
+16 ;
+17 DO HDR
SET SROPDT=""
FOR
SET SROPDT=$ORDER(^TMP("SR",$JOB,SRSNM,SROPDT))
if SROPDT=""!(SRSOUT)
QUIT
SET SRSS=""
FOR
SET SRSS=$ORDER(^TMP("SR",$JOB,SRSNM,SROPDT,SRSS))
if 'SRSS!(SRSOUT)
QUIT
DO ANOTHER
END IF $EXTRACT(IOST)="P"
WRITE !
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
MORE SET SRTEMP=^SRO(133.8,SRSS,1,SROFN,0)
SET SROPDT=$PIECE($GET(SRTEMP),"^",5)
SET SROPDT=$SELECT(SROPDT'="":SROPDT,1:"None Specified")
SET ^TMP("SR",$JOB,SRSNM,SROPDT,SRSS,SROFN)=""
+1 QUIT
ANOTHER SET SROFN=""
FOR
SET SROFN=$ORDER(^TMP("SR",$JOB,SRSNM,SROPDT,SRSS,SROFN))
if 'SROFN!(SRSOUT)
QUIT
DO PRINT
+1 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=$PIECE(SRW,"^",3)
DO D^DIQ
SET SRDT=$EXTRACT(Y,1,12)_" "_$EXTRACT(Y,14,18)
+3 DO OUT^SRSWL3
+4 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
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
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
AGAIN ; reprint patient name, date entered, and procedure when referring
+1 ; physician will not fit on first page
+2 if $Y+6<IOSL
QUIT
+3 DO PAGE
if SRSOUT
QUIT
+4 WRITE !,"Patient:",?14,SRSDPT,?65,"(continued)",!,"Date Entered:",?14,SRDT,!,"Procedure:",?14,SROPS(1)
IF $DATA(SROPS(2))
WRITE !,?14,SROPS(2)
+5 QUIT