SROPLIST ;B'HAM ISC/MAM - LIST OF OPERATIONS ; [ 09/22/98 11:42 AM ]
;;3.0; Surgery ;**38,53,50**;24 Jun 93
U IO S SRED1=SRED+.9999,(SRQ,TOTAL)=0,PAGE=1,SRINST=SRSITE("SITE")
N SRFRTO S Y=DT X ^DD("DD") S SRPRINT="DATE PRINTED: "_Y S Y=SRSD X ^DD("DD") S SRFRTO="FROM: "_Y_" TO: ",Y=SRED X ^DD("DD") S SRFRTO=SRFRTO_Y D HDR^SROPLIS
F S SRD=$O(^SRF("AC",SRD)) Q:SRD=""!(SRD>SRED1)!SRQ S K=0 F S K=$O(^SRF("AC",SRD,K)) Q:K=""!SRQ I $D(^SRF(K,0)),$$DIV^SROUTL0(K) D SET
I 'SRQ,$Y+5>IOSL D HDR^SROPLIS
W:'SRQ !!!,"TOTAL CASES: ",TOTAL
G END
SET ; set variables
I '$D(^SRF(K,.2)) Q
I $P(^SRF(K,.2),"^",12)="" Q
S (SRSUR,SRATT,SRFST,SRTWO)="",SRABORT=$S($P($G(^SRF(K,30)),"^"):"*ABORTED*",1:"")
K SROP S SRTN=K,S(0)=^SRF(SRTN,0),DFN=$P(S(0),"^",1) D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID")
S SRDT=$P(S(0),"^",9),SRTS=$S($P(S(0),"^",4)]"":$P(^SRO(137.45,$P(S(0),"^",4),0),"^"),1:"SPECIALTY NOT ENTERED"),SROD=$P(S(0),"^",9)
S:$D(^SRF(SRTN,.1)) S(.1)=^(.1),SRSUR=$P(S(.1),"^",4),SRATT=$P(S(.1),"^",13),SRFST=$P(S(.1),"^",5),SRTWO=$P(S(.1),"^",6) S:SRSUR'="" SRSUR=$P(^VA(200,SRSUR,0),"^") S:SRATT'="" SRATT=$P(^VA(200,SRATT,0),"^")
S:SRFST'="" SRFST=$P(^VA(200,SRFST,0),"^") S:SRTWO'="" SRTWO=$P(^VA(200,SRTWO,0),"^")
OPS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F I=0:0 S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
K SROPS,MM,MMM S:$L(SROPER)<50 SROPS(1)=SROPER I $L(SROPER)>49 S SROPER=SROPER_" " S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
S SROT=0 I $D(^SRF(SRTN,.2)),$P(^(.2),"^",2)]"",$P(^(.2),"^",3)]"" S X=$P(^SRF(SRTN,.2),"^",2),X1=$P(^(.2),"^",3) D MINS^SRSUTL2 S SROT=X
D TECH^SROPRIN S SRANES=$S($D(SRTECH):SRTECH,1:"")
S A=$P(S(0),"^",10),SRTYPE=$S(A="EL":"ELECTIVE",A="EM":"EMERGENCY",A="A":"ADD ON, NONEMERGENT",A="S":"STANDBY",A="U":"URGENT, ADD TODAY",1:"")
PRINT ;
S Z=0 D:$Y+8>IOSL ASK Q:SRQ W !!,$E(SROD,4,5)_"/"_$E(SROD,6,7)_"/"_$E(SROD,2,3),?13,$E(SRNM,1,24),?38,SRTS
W ?90,$E(SRSUR,1,23),?114,$E(SRANES,1,14),!,SRTN,?13,VA("PID"),?38,SROPS(1),?90,$E(SRFST,1,23),?114,"OP TIME: "_SROT_" MIN.",!,SRABORT,?13,SRTYPE W:$D(SROPS(2)) ?38,SROPS(2) W ?90,$E(SRTWO,1,23)
W:$D(SROPS(3)) !,?38,SROPS(3) I $D(SROPS(4)) W !,?38,SROPS(4) I $D(SROPS(5)) W !,?38,SROPS(5) I $D(SROPS(6)) W !,?38,SROPS(6)
S TOTAL=TOTAL+1
Q
ASK I $E(IOST,1)'="P" W !!,"Press RETURN to continue or '^' to quit. " R X:DTIME I '$T!(X="^") S SRQ=1 Q
D HDR^SROPLIS Q
END W:$E(IOST)="P" @IOF I $D(ZTQUEUED) Q:$G(ZTSTOP) S ZTREQ="@" Q
I 'SRQ,($E(IOST)'="P") W !!,"Press RETURN to continue " R X:DTIME
D ^SRSKILL K SRTN D ^%ZISC W @IOF
Q
OTHER ; other operations
S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>240 S SRLONG=0,OPER=999,SROPERS=" ..."
I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
Q
LOOP ; break procedure if greater than 50 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)'<50 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q
SROPLIST ;B'HAM ISC/MAM - LIST OF OPERATIONS ; [ 09/22/98 11:42 AM ]
+1 ;;3.0; Surgery ;**38,53,50**;24 Jun 93
+2 USE IO
SET SRED1=SRED+.9999
SET (SRQ,TOTAL)=0
SET PAGE=1
SET SRINST=SRSITE("SITE")
+3 NEW SRFRTO
SET Y=DT
XECUTE ^DD("DD")
SET SRPRINT="DATE PRINTED: "_Y
SET Y=SRSD
XECUTE ^DD("DD")
SET SRFRTO="FROM: "_Y_" TO: "
SET Y=SRED
XECUTE ^DD("DD")
SET SRFRTO=SRFRTO_Y
DO HDR^SROPLIS
+4 FOR
SET SRD=$ORDER(^SRF("AC",SRD))
IF SRD=""!(SRD>SRED1)!SRQ
QUIT
SET K=0
FOR
SET K=$ORDER(^SRF("AC",SRD,K))
IF K=""!SRQ
QUIT
IF $DATA(^SRF(K,0))
IF $$DIV^SROUTL0(K)
DO SET
+5 IF 'SRQ
IF $Y+5>IOSL
DO HDR^SROPLIS
+6 IF 'SRQ
WRITE !!!,"TOTAL CASES: ",TOTAL
+7 GOTO END
SET ; set variables
+1 IF '$DATA(^SRF(K,.2))
QUIT
+2 IF $PIECE(^SRF(K,.2),"^",12)=""
QUIT
+3 SET (SRSUR,SRATT,SRFST,SRTWO)=""
SET SRABORT=$SELECT($PIECE($GET(^SRF(K,30)),"^"):"*ABORTED*",1:"")
+4 KILL SROP
SET SRTN=K
SET S(0)=^SRF(SRTN,0)
SET DFN=$PIECE(S(0),"^",1)
DO DEM^VADPT
SET SRNM=VADM(1)
SET SRSSN=VA("PID")
+5 SET SRDT=$PIECE(S(0),"^",9)
SET SRTS=$SELECT($PIECE(S(0),"^",4)]"":$PIECE(^SRO(137.45,$PIECE(S(0),"^",4),0),"^"),1:"SPECIALTY NOT ENTERED")
SET SROD=$PIECE(S(0),"^",9)
+6 IF $DATA(^SRF(SRTN,.1))
SET S(.1)=^(.1)
SET SRSUR=$PIECE(S(.1),"^",4)
SET SRATT=$PIECE(S(.1),"^",13)
SET SRFST=$PIECE(S(.1),"^",5)
SET SRTWO=$PIECE(S(.1),"^",6)
IF SRSUR'=""
SET SRSUR=$PIECE(^VA(200,SRSUR,0),"^")
IF SRATT'=""
SET SRATT=$PIECE(^VA(200,SRATT,0),"^")
+7 IF SRFST'=""
SET SRFST=$PIECE(^VA(200,SRFST,0),"^")
IF SRTWO'=""
SET SRTWO=$PIECE(^VA(200,SRTWO,0),"^")
OPS SET SROPER=$PIECE(^SRF(SRTN,"OP"),"^")
SET OPER=0
FOR I=0:0
SET OPER=$ORDER(^SRF(SRTN,13,OPER))
IF OPER=""
QUIT
DO OTHER
+1 KILL SROPS,MM,MMM
IF $LENGTH(SROPER)<50
SET SROPS(1)=SROPER
IF $LENGTH(SROPER)>49
SET SROPER=SROPER_" "
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
IF MMM=""
QUIT
+2 SET SROT=0
IF $DATA(^SRF(SRTN,.2))
IF $PIECE(^(.2),"^",2)]""
IF $PIECE(^(.2),"^",3)]""
SET X=$PIECE(^SRF(SRTN,.2),"^",2)
SET X1=$PIECE(^(.2),"^",3)
DO MINS^SRSUTL2
SET SROT=X
+3 DO TECH^SROPRIN
SET SRANES=$SELECT($DATA(SRTECH):SRTECH,1:"")
+4 SET A=$PIECE(S(0),"^",10)
SET SRTYPE=$SELECT(A="EL":"ELECTIVE",A="EM":"EMERGENCY",A="A":"ADD ON, NONEMERGENT",A="S":"STANDBY",A="U":"URGENT, ADD TODAY",1:"")
PRINT ;
+1 SET Z=0
IF $Y+8>IOSL
DO ASK
IF SRQ
QUIT
WRITE !!,$EXTRACT(SROD,4,5)_"/"_$EXTRACT(SROD,6,7)_"/"_$EXTRACT(SROD,2,3),?13,$EXTRACT(SRNM,1,24),?38,SRTS
+2 WRITE ?90,$EXTRACT(SRSUR,1,23),?114,$EXTRACT(SRANES,1,14),!,SRTN,?13,VA("PID"),?38,SROPS(1),?90,$EXTRACT(SRFST,1,23),?114,"OP TIME: "_SROT_" MIN.",!,SRABORT,?13,SRTYPE
IF $DATA(SROPS(2))
WRITE ?38,SROPS(2)
WRITE ?90,$EXTRACT(SRTWO,1,23)
+3 IF $DATA(SROPS(3))
WRITE !,?38,SROPS(3)
IF $DATA(SROPS(4))
WRITE !,?38,SROPS(4)
IF $DATA(SROPS(5))
WRITE !,?38,SROPS(5)
IF $DATA(SROPS(6))
WRITE !,?38,SROPS(6)
+4 SET TOTAL=TOTAL+1
+5 QUIT
ASK IF $EXTRACT(IOST,1)'="P"
WRITE !!,"Press RETURN to continue or '^' to quit. "
READ X:DTIME
IF '$TEST!(X="^")
SET SRQ=1
QUIT
+1 DO HDR^SROPLIS
QUIT
END IF $EXTRACT(IOST)="P"
WRITE @IOF
IF $DATA(ZTQUEUED)
IF $GET(ZTSTOP)
QUIT
SET ZTREQ="@"
QUIT
+1 IF 'SRQ
IF ($EXTRACT(IOST)'="P")
WRITE !!,"Press RETURN to continue "
READ X:DTIME
+2 DO ^SRSKILL
KILL SRTN
DO ^%ZISC
WRITE @IOF
+3 QUIT
OTHER ; other operations
+1 SET SRLONG=1
IF $LENGTH(SROPER)+$LENGTH($PIECE(^SRF(SRTN,13,OPER,0),"^"))>240
SET SRLONG=0
SET OPER=999
SET SROPERS=" ..."
+2 IF SRLONG
SET SROPERS=$PIECE(^SRF(SRTN,13,OPER,0),"^")
+3 SET SROPER=SROPER_$SELECT(SROPERS=" ...":SROPERS,1:", "_SROPERS)
+4 QUIT
LOOP ; break procedure if greater than 50 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)'<50
QUIT
SET SROPS(M)=SROPS(M)_MM_" "
SET SROPER=MMM
+2 QUIT