SROSCH1 ;B'HAM ISC/MAM - OR SCHEDULE ; [ 09/22/98 11:49 AM ]
;;3.0;Surgery;**63,77,50,182,184**;24 Jun 93;Build 35
EN I '$D(SRSITE) W @IOF D ^SROVAR I '$D(SRSITE) Q
W @IOF S %DT="AEFX",%DT("A")="Print Schedule of Operations for which date ? " D ^%DT K %DT Q:Y<1 S SRDT=Y D D^DIQ S SRDT1=Y
D ALL G:SRYN["^" END
D FORM G:SRFORM["^" END I "Yy"[SRYN W !!,"Schedule will be queued to print at all locations defined in the SURGERY",!,"SITE PARAMETERS file...." D ^SROSCH2 W !!,"Press RETURN to continue " R X:DTIME G END
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="SCHEDULE OF OPERATIONS",ZTRTN="SROSCH",(ZTSAVE("SRDT"),ZTSAVE("SRDT1"),ZTSAVE("SRSITE*"),ZTSAVE("SRFORM"))="" D ^%ZTLOAD G END
G ^SROSCH
END D ^SRSKILL,^%ZISC W @IOF
Q
ASK I $E(IOST)'="P" W !!,"Press RETURN to continue, or '^' to quit: " R Z:DTIME I '$T!(Z="^") S SRQ=1 Q
D HDR I SX'=1 W !!,?1,"OPERATING ROOM: "_SROOM,!
Q
LOOP ; break procedure if greater than 70 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)'<70 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRQ=1 Q
W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?123,$J("PAGE "_SRPAGE,8)
W !,?58,"SURGICAL SERVICE",!,?55,"SCHEDULE OF OPERATIONS",?90,"SIGNATURE OF CHIEF: ",SRCHF,!
D NOW^%DTC S Y=% D DD^%DT W "PRINTED: ",$P(Y,"@")_" "_$E($P(Y,"@",2),1,5),?58,"FOR: ",SRDT1,?110,"____________________"
W !!!,"PATIENT",?23,"DISPOSITION",?40,"PREOPERATIVE DIAGNOSIS",?92,"REQ ANESTHESIA"
W ?116,"PRIMARY SURGEON",!,"ID#",?15,"AGE",?23,"START TIME",?40,"OPERATION(S)",?92,"ANESTHESIOLOGIST",?115,"FIRST ASST.",!,"WARD",?24,"END TIME",?92,"PRIN. ANESTHETIST",?115,"ATT SURGEON",! F LINE=1:1:132 W "="
S SRPAGE=SRPAGE+1
Q
CON ; print concurrent procedure
K SROPS,MM,MMM S SROPER=$P(^SRF(SRCON,"OP"),"^") S:$L(SROPER)<70 SROPS(1)=SROPER I $L(SROPER)>69 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
W !,?26,"** Concurrent Case #"_SRCON,?53,SROPS(1) I $D(SROPS(2)) W !,?53,SROPS(2) I $D(SROPS(3)) W !,?53,SROPS(3)
Q
DIQ ; extract time from date
S Y=SRST D D^DIQ S SRFIND=$F(Y,":") S SRST=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
S Y=SRET D D^DIQ S SRFIND=$F(Y,":") S SRET=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
Q
TIME ; start and finish times
S S(31)=^SRF(SRTN,31),Y=$P(S(31),"^",4) D D^DIQ S SRFIND=$F(Y,":"),SRSST=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"00:00")
S Y=$P(S(31),"^",5) D D^DIQ S SRFIND=$F(Y,":"),SRSET=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
Q
ALL ; print to all locations ?
I '$O(^SRO(133,SRSITE,1,0)) S SRYN="N" Q
W @IOF,!,"Do you want to print the schedule at all locations ? NO// " R SRYN:DTIME I '$T!(SRYN["^") Q
S SRYN=$E(SRYN) S:SRYN="" SRYN="N"
I "YyNn"'[SRYN W !!,"Enter RETURN to select a specific printer, or 'YES' to print the Schedule of",!,"Operations on all of the printers specified in your SURGERY SITE",!,"PARAMETERS file."
I "YyNn"'[SRYN W !!,"Press RETURN to continue " R X:DTIME G ALL
Q
OUT ; outpatient ?
I $P(^SRF(SRTN,0),"^",12)="I" S SRSLOC="TO BE ADMITTED" Q
I $D(^SRF(SRTN,.4)),$P(^(.4),"^",3)'="O" S SRSLOC="TO BE ADMITTED"
Q
FORM ; short/long report
W ! K DIR S DIR("A")="Print the long form or the short form ? ",DIR("B")="SHORT",DIR(0)="SAM^L:LONG;S:SHORT" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S SRFORM="^" Q
S SRFORM=Y Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSROSCH1 3532 printed Nov 22, 2024@17:55:58 Page 2
SROSCH1 ;B'HAM ISC/MAM - OR SCHEDULE ; [ 09/22/98 11:49 AM ]
+1 ;;3.0;Surgery;**63,77,50,182,184**;24 Jun 93;Build 35
EN IF '$DATA(SRSITE)
WRITE @IOF
DO ^SROVAR
IF '$DATA(SRSITE)
QUIT
+1 WRITE @IOF
SET %DT="AEFX"
SET %DT("A")="Print Schedule of Operations for which date ? "
DO ^%DT
KILL %DT
if Y<1
QUIT
SET SRDT=Y
DO D^DIQ
SET SRDT1=Y
+2 DO ALL
if SRYN["^"
GOTO END
+3 DO FORM
if SRFORM["^"
GOTO END
IF "Yy"[SRYN
WRITE !!,"Schedule will be queued to print at all locations defined in the SURGERY",!,"SITE PARAMETERS file...."
DO ^SROSCH2
WRITE !!,"Press RETURN to continue "
READ X:DTIME
GOTO END
+4 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
+5 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTDESC="SCHEDULE OF OPERATIONS"
SET ZTRTN="SROSCH"
SET (ZTSAVE("SRDT"),ZTSAVE("SRDT1"),ZTSAVE("SRSITE*"),ZTSAVE("SRFORM"))=""
DO ^%ZTLOAD
GOTO END
+6 GOTO ^SROSCH
END DO ^SRSKILL
DO ^%ZISC
WRITE @IOF
+1 QUIT
ASK IF $EXTRACT(IOST)'="P"
WRITE !!,"Press RETURN to continue, or '^' to quit: "
READ Z:DTIME
IF '$TEST!(Z="^")
SET SRQ=1
QUIT
+1 DO HDR
IF SX'=1
WRITE !!,?1,"OPERATING ROOM: "_SROOM,!
+2 QUIT
LOOP ; break procedure if greater than 70 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)'<70
QUIT
SET SROPS(M)=SROPS(M)_MM_" "
SET SROPER=MMM
+2 QUIT
HDR ; print heading
+1 IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRQ=1
QUIT
+2 if $Y
WRITE @IOF
WRITE !,?(132-$LENGTH(SRINST)\2),SRINST,?123,$JUSTIFY("PAGE "_SRPAGE,8)
+3 WRITE !,?58,"SURGICAL SERVICE",!,?55,"SCHEDULE OF OPERATIONS",?90,"SIGNATURE OF CHIEF: ",SRCHF,!
+4 DO NOW^%DTC
SET Y=%
DO DD^%DT
WRITE "PRINTED: ",$PIECE(Y,"@")_" "_$EXTRACT($PIECE(Y,"@",2),1,5),?58,"FOR: ",SRDT1,?110,"____________________"
+5 WRITE !!!,"PATIENT",?23,"DISPOSITION",?40,"PREOPERATIVE DIAGNOSIS",?92,"REQ ANESTHESIA"
+6 WRITE ?116,"PRIMARY SURGEON",!,"ID#",?15,"AGE",?23,"START TIME",?40,"OPERATION(S)",?92,"ANESTHESIOLOGIST",?115,"FIRST ASST.",!,"WARD",?24,"END TIME",?92,"PRIN. ANESTHETIST",?115,"ATT SURGEON",!
FOR LINE=1:1:132
WRITE "="
+7 SET SRPAGE=SRPAGE+1
+8 QUIT
CON ; print concurrent procedure
+1 KILL SROPS,MM,MMM
SET SROPER=$PIECE(^SRF(SRCON,"OP"),"^")
if $LENGTH(SROPER)<70
SET SROPS(1)=SROPER
IF $LENGTH(SROPER)>69
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
if MMM=""
QUIT
+2 WRITE !,?26,"** Concurrent Case #"_SRCON,?53,SROPS(1)
IF $DATA(SROPS(2))
WRITE !,?53,SROPS(2)
IF $DATA(SROPS(3))
WRITE !,?53,SROPS(3)
+3 QUIT
DIQ ; extract time from date
+1 SET Y=SRST
DO D^DIQ
SET SRFIND=$FIND(Y,":")
SET SRST=$SELECT(SRFIND:$EXTRACT(Y,SRFIND-3,SRFIND+1),1:"")
+2 SET Y=SRET
DO D^DIQ
SET SRFIND=$FIND(Y,":")
SET SRET=$SELECT(SRFIND:$EXTRACT(Y,SRFIND-3,SRFIND+1),1:"")
+3 QUIT
TIME ; start and finish times
+1 SET S(31)=^SRF(SRTN,31)
SET Y=$PIECE(S(31),"^",4)
DO D^DIQ
SET SRFIND=$FIND(Y,":")
SET SRSST=$SELECT(SRFIND:$EXTRACT(Y,SRFIND-3,SRFIND+1),1:"00:00")
+2 SET Y=$PIECE(S(31),"^",5)
DO D^DIQ
SET SRFIND=$FIND(Y,":")
SET SRSET=$SELECT(SRFIND:$EXTRACT(Y,SRFIND-3,SRFIND+1),1:"")
+3 QUIT
ALL ; print to all locations ?
+1 IF '$ORDER(^SRO(133,SRSITE,1,0))
SET SRYN="N"
QUIT
+2 WRITE @IOF,!,"Do you want to print the schedule at all locations ? NO// "
READ SRYN:DTIME
IF '$TEST!(SRYN["^")
QUIT
+3 SET SRYN=$EXTRACT(SRYN)
if SRYN=""
SET SRYN="N"
+4 IF "YyNn"'[SRYN
WRITE !!,"Enter RETURN to select a specific printer, or 'YES' to print the Schedule of",!,"Operations on all of the printers specified in your SURGERY SITE",!,"PARAMETERS file."
+5 IF "YyNn"'[SRYN
WRITE !!,"Press RETURN to continue "
READ X:DTIME
GOTO ALL
+6 QUIT
OUT ; outpatient ?
+1 IF $PIECE(^SRF(SRTN,0),"^",12)="I"
SET SRSLOC="TO BE ADMITTED"
QUIT
+2 IF $DATA(^SRF(SRTN,.4))
IF $PIECE(^(.4),"^",3)'="O"
SET SRSLOC="TO BE ADMITTED"
+3 QUIT
FORM ; short/long report
+1 WRITE !
KILL DIR
SET DIR("A")="Print the long form or the short form ? "
SET DIR("B")="SHORT"
SET DIR(0)="SAM^L:LONG;S:SHORT"
DO ^DIR
KILL DIR
IF $DATA(DTOUT)!$DATA(DUOUT)
SET SRFORM="^"
QUIT
+2 SET SRFORM=Y
QUIT