SROPRIO ;B'HAM ISC/MAM - LIST OF OPERATIONS (BY PRIORITY) ; [ 09/22/98 11:36 AM ]
;;3.0; Surgery ;**77,50**;24 Jun 93
BEG S (SRSP,SRQ)=0,SRORD=1 W @IOF,!,"List of Operations by Surgical Priority:",!!
DATE D DATE^SROUTL(.SRSD,.SRED,.SRQ) G:SRQ END
PRIO W @IOF,! K DIR S DIR("A")="Print List of Operations for all priorities ",DIR("B")="Y",DIR(0)="Y"
S DIR("?",1)="Enter RETURN to print the report for all priorities,or 'N' to print the",DIR("?")="report for a specific specialty."
D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S SRQ=1 Q
I Y S SRPRIO="ALL" G SORT
D PRIORITY S X="",Z=1 F S X=$O(SRCODE(X)) Q:X="" S SRL(Z)=X,Z=Z+1
W ! K DIR S DIR("A",1)="Print report for which Priority ?",DIR("A",2)="",X="",Z=0 F S X=$O(SRCODE(X)) Q:X="" S Z=Z+1,DIR("A",Z+2)=Z_". "_SRCODE(X)
S DIR("A",Z+3)="",DIR("A")="Select Number: ",DIR("B")=1,DIR("?")="Enter a number between 1 and "_Z_".",DIR(0)="NA^1:"_Z_":0" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S SRQ=1 G END
S SRPRIO=SRL(Y)
SORT W !!,"Do you want the report sorted by surgical specialty ? Y// " R SRYN:DTIME I '$T!(SRYN["^") S SRQ=1 G END
S:SRYN="" SRYN="Y" S SRYN=$E(SRYN)
I "YyNn"'[SRYN W !!,"Enter RETURN to sort the report by surgical specialty, or 'N' to not sort",!,"by surgical specialty." G SORT
I "Nn"[SRYN S SRORD=0 G DEVICE
SER W !!,"Print for all surgical specialties ? Y// " R SRYN:DTIME I '$T!(SRYN["^") S SRQ=1 G END
S:SRYN="" SRYN="Y" S SRYN=$E(SRYN)
I "YyNn"'[SRYN W !!,"Enter RETURN to print the report for all surgical specialties, or 'N' to print",!,"the report for a specific specialty." G SER
I "Nn"[SRYN D SP I SRQ G END
DEVICE K IOP,%ZIS,POP,IO("Q") S %ZIS("A")="Print the Report on which Device: ",%ZIS="QM" W !!,"This report is designed to use a 132 column format.",! D ^%ZIS G:POP END
I $D(IO("Q")) K IO("Q") S ZTDESC="LIST OF OPERATIONS",ZTRTN="^SROPRI",(ZTSAVE("SRORD"),ZTSAVE("SRSP*"),ZTSAVE("SRED"),ZTSAVE("SRPRIO"),ZTSAVE("SRSD"),ZTSAVE("SRSITE*"))="",%ZIS="QM" D ^%ZTLOAD G END
D ^SROPRI
Q
PRIORITY ; get list of priorities
N SRLIST,SRC,SRP,I,J,X,Y D HELP^DIE(130,"",.035,"S","SRLIST")
F I=2:1:SRLIST("DIHELP") S X=SRLIST("DIHELP",I),Y=$F(X," "),SRC=$E(X,1,Y-2) F J=Y:1 I $E(X,J)'=" " S SRP=$E(X,J,99),SRCODE(SRC)=SRP Q
S SRCODE("ZZ")="PRIORITY NOT ENTERED"
Q
SP W ! S SRSP=1 K DIC S DIC("S")="I '$P(^(0),""^"",3)",DIC=137.45,DIC(0)="QEAMZ",DIC("A")="Print the report for which Specialty ? " D ^DIC I Y<0 S SRQ=1 Q
S SRSP(+Y)=+Y
MORE ; more specialties?
K DIC S DIC("S")="I '$P(^(0),""^"",3)",DIC=137.45,DIC(0)="QEAMZ",DIC("A")="Select An Additional Specialty: " D ^DIC I Y>0 S SRSP(+Y)=+Y G MORE
Q
END I 'SRQ,($E(IOST,1)'="P") W !!,"Press RETURN to continue " R X:DTIME
W ! D ^SRSKILL K SRTN D ^%ZISC W @IOF
Q
RET W !!," Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRQ=1 Q
I X["?" W !!,"Press RETURN to continue with the List of Surgical Cases sorted by Surgical",!,"Priority, or '^' if you do not want to review any additional information." G RET
Q
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRQ=1 Q
I SRHDR,$E(IOST)'="P" D RET Q:SRQ
W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?125,"PAGE:",!,?58,"SURGICAL SERVICE",?127,PAGE
W !,?47,"LIST OF OPERATIONS BY SURGICAL PRIORITY",?100,SRPRINT
W !,?(132-$L(SRFRTO)\2),SRFRTO,?100,"REVIEWED BY:"
I SRPRIO'="ALL" S SRP=SRPRIO
I SRP'="" S SRTP="SURGICAL PRIORITY: "_SRCODE(SRP) W !,?(132-$L(SRTP)\2),SRTP,?100,"DATE REVIEWED:"
I SRP="" W !,?100,"DATE REVIEWED:"
W !!,"DATE",?13,"PATIENT",?38,"OPERATION(S)",?90,"SURGEON",?114,"ANESTHESIA TECH",!,"CASE #",?15,"ID#",?90,"1ST ASST",!,?90,"2ND ASST" W ! F I=1:1:132 W "-"
I $D(SRSPEC) W !,?(132-$L(">> "_SRSPEC_" <<")\2),">> "_SRSPEC_" <<",!
S SRHDR=1,PAGE=PAGE+1
Q
SROPRIO ;B'HAM ISC/MAM - LIST OF OPERATIONS (BY PRIORITY) ; [ 09/22/98 11:36 AM ]
+1 ;;3.0; Surgery ;**77,50**;24 Jun 93
BEG SET (SRSP,SRQ)=0
SET SRORD=1
WRITE @IOF,!,"List of Operations by Surgical Priority:",!!
DATE DO DATE^SROUTL(.SRSD,.SRED,.SRQ)
IF SRQ
GOTO END
PRIO WRITE @IOF,!
KILL DIR
SET DIR("A")="Print List of Operations for all priorities "
SET DIR("B")="Y"
SET DIR(0)="Y"
+1 SET DIR("?",1)="Enter RETURN to print the report for all priorities,or 'N' to print the"
SET DIR("?")="report for a specific specialty."
+2 DO ^DIR
KILL DIR
IF $DATA(DTOUT)!$DATA(DUOUT)
SET SRQ=1
QUIT
+3 IF Y
SET SRPRIO="ALL"
GOTO SORT
+4 DO PRIORITY
SET X=""
SET Z=1
FOR
SET X=$ORDER(SRCODE(X))
IF X=""
QUIT
SET SRL(Z)=X
SET Z=Z+1
+5 WRITE !
KILL DIR
SET DIR("A",1)="Print report for which Priority ?"
SET DIR("A",2)=""
SET X=""
SET Z=0
FOR
SET X=$ORDER(SRCODE(X))
IF X=""
QUIT
SET Z=Z+1
SET DIR("A",Z+2)=Z_". "_SRCODE(X)
+6 SET DIR("A",Z+3)=""
SET DIR("A")="Select Number: "
SET DIR("B")=1
SET DIR("?")="Enter a number between 1 and "_Z_"."
SET DIR(0)="NA^1:"_Z_":0"
DO ^DIR
KILL DIR
IF $DATA(DTOUT)!$DATA(DUOUT)
SET SRQ=1
GOTO END
+7 SET SRPRIO=SRL(Y)
SORT WRITE !!,"Do you want the report sorted by surgical specialty ? Y// "
READ SRYN:DTIME
IF '$TEST!(SRYN["^")
SET SRQ=1
GOTO END
+1 IF SRYN=""
SET SRYN="Y"
SET SRYN=$EXTRACT(SRYN)
+2 IF "YyNn"'[SRYN
WRITE !!,"Enter RETURN to sort the report by surgical specialty, or 'N' to not sort",!,"by surgical specialty."
GOTO SORT
+3 IF "Nn"[SRYN
SET SRORD=0
GOTO DEVICE
SER WRITE !!,"Print for all surgical specialties ? Y// "
READ SRYN:DTIME
IF '$TEST!(SRYN["^")
SET SRQ=1
GOTO END
+1 IF SRYN=""
SET SRYN="Y"
SET SRYN=$EXTRACT(SRYN)
+2 IF "YyNn"'[SRYN
WRITE !!,"Enter RETURN to print the report for all surgical specialties, or 'N' to print",!,"the report for a specific specialty."
GOTO SER
+3 IF "Nn"[SRYN
DO SP
IF SRQ
GOTO END
DEVICE KILL IOP,%ZIS,POP,IO("Q")
SET %ZIS("A")="Print the Report on which Device: "
SET %ZIS="QM"
WRITE !!,"This report is designed to use a 132 column format.",!
DO ^%ZIS
IF POP
GOTO END
+1 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTDESC="LIST OF OPERATIONS"
SET ZTRTN="^SROPRI"
SET (ZTSAVE("SRORD"),ZTSAVE("SRSP*"),ZTSAVE("SRED"),ZTSAVE("SRPRIO"),ZTSAVE("SRSD"),ZTSAVE("SRSITE*"))=""
SET %ZIS="QM"
DO ^%ZTLOAD
GOTO END
+2 DO ^SROPRI
+3 QUIT
PRIORITY ; get list of priorities
+1 NEW SRLIST,SRC,SRP,I,J,X,Y
DO HELP^DIE(130,"",.035,"S","SRLIST")
+2 FOR I=2:1:SRLIST("DIHELP")
SET X=SRLIST("DIHELP",I)
SET Y=$FIND(X," ")
SET SRC=$EXTRACT(X,1,Y-2)
FOR J=Y:1
IF $EXTRACT(X,J)'=" "
SET SRP=$EXTRACT(X,J,99)
SET SRCODE(SRC)=SRP
QUIT
+3 SET SRCODE("ZZ")="PRIORITY NOT ENTERED"
+4 QUIT
SP WRITE !
SET SRSP=1
KILL DIC
SET DIC("S")="I '$P(^(0),""^"",3)"
SET DIC=137.45
SET DIC(0)="QEAMZ"
SET DIC("A")="Print the report for which Specialty ? "
DO ^DIC
IF Y<0
SET SRQ=1
QUIT
+1 SET SRSP(+Y)=+Y
MORE ; more specialties?
+1 KILL DIC
SET DIC("S")="I '$P(^(0),""^"",3)"
SET DIC=137.45
SET DIC(0)="QEAMZ"
SET DIC("A")="Select An Additional Specialty: "
DO ^DIC
IF Y>0
SET SRSP(+Y)=+Y
GOTO MORE
+2 QUIT
END IF 'SRQ
IF ($EXTRACT(IOST,1)'="P")
WRITE !!,"Press RETURN to continue "
READ X:DTIME
+1 WRITE !
DO ^SRSKILL
KILL SRTN
DO ^%ZISC
WRITE @IOF
+2 QUIT
RET WRITE !!," Press RETURN to continue, or '^' to quit: "
READ X:DTIME
IF '$TEST!(X["^")
SET SRQ=1
QUIT
+1 IF X["?"
WRITE !!,"Press RETURN to continue with the List of Surgical Cases sorted by Surgical",!,"Priority, or '^' if you do not want to review any additional information."
GOTO RET
+2 QUIT
HDR ; print heading
+1 IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRQ=1
QUIT
+2 IF SRHDR
IF $EXTRACT(IOST)'="P"
DO RET
IF SRQ
QUIT
+3 IF $Y
WRITE @IOF
WRITE !,?(132-$LENGTH(SRINST)\2),SRINST,?125,"PAGE:",!,?58,"SURGICAL SERVICE",?127,PAGE
+4 WRITE !,?47,"LIST OF OPERATIONS BY SURGICAL PRIORITY",?100,SRPRINT
+5 WRITE !,?(132-$LENGTH(SRFRTO)\2),SRFRTO,?100,"REVIEWED BY:"
+6 IF SRPRIO'="ALL"
SET SRP=SRPRIO
+7 IF SRP'=""
SET SRTP="SURGICAL PRIORITY: "_SRCODE(SRP)
WRITE !,?(132-$LENGTH(SRTP)\2),SRTP,?100,"DATE REVIEWED:"
+8 IF SRP=""
WRITE !,?100,"DATE REVIEWED:"
+9 WRITE !!,"DATE",?13,"PATIENT",?38,"OPERATION(S)",?90,"SURGEON",?114,"ANESTHESIA TECH",!,"CASE #",?15,"ID#",?90,"1ST ASST",!,?90,"2ND ASST"
WRITE !
FOR I=1:1:132
WRITE "-"
+10 IF $DATA(SRSPEC)
WRITE !,?(132-$LENGTH(">> "_SRSPEC_" <<")\2),">> "_SRSPEC_" <<",!
+11 SET SRHDR=1
SET PAGE=PAGE+1
+12 QUIT