SROPLSTS ;B'HAM ISC/MAM - LIST OF OPERATIONS BY SERVICE ;09/30/04
;;3.0;Surgery;**38,53,50,134,182**;24 Jun 93;Build 49
S1 Q:SRQ S C=0,SRTS=$P(^SRO(137.45,K,0),"^") I SRUL W ! F LINE=1:1:IOM W "-"
W !,?1,"*",SRTS,"*" S SRUL=1 Q
SET ; set variables
K SROP S S(0)=^SRF(SRTN,0),DFN=$P(S(0),"^") D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID"),SRDT=$P(S(0),"^",9),SROD=$P(S(0),"^",9),(SRSUR,SRATT,SRFST,SRTWO)=""
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),"^")
S SRABORT=$S($P($G(^SRF(SRTN,30)),"^"):"*ABORTED*",1:"")
OPS K SROPERS 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_" " 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 !!,?1,$E(SROD,4,5)_"/"_$E(SROD,6,7)_"/"_$E(SROD,2,3),?13,$E(SRNM,1,26),?38,SROPS(1)
W ?90,$E(SRSUR,1,23),?114,$E(SRANES,1,14),!,?1,SRTN,?13,VA("PID") W:$D(SROPS(2)) ?38,SROPS(2) W ?90,$E(SRFST,1,23),?114,"OP TIME: ",SROT," MIN.",!,SRABORT,?13,SRTYPE W:$D(SROPS(3)) ?38,SROPS(3) W ?90,$E(SRTWO,1,23)
I $D(SROPS(4)) W !,?38,SROPS(4) I $D(SROPS(5)) W !,?38,SROPS(5) I $D(SROPS(6)) W !,?38,SROPS(6)
Q
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRQ=1 Q
W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?120,"PAGE ",PAGE,!,?58,"SURGICAL SERVICE",?100,"DATE REVIEWED:",!,?52,"LIST OF OPERATIONS BY SERVICE"
W ?100,"REVIEWED BY:",!,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
W !!,?1,"DATE",?13,"PATIENT",?38,"OPERATION(S)",?90,"PRIMARY SURGEON",?116,"ANESTHESIA",!,"CASE #",?15,"ID#",?90,"FIRST ASSISTANT",?116,"TECHNIQUE",!,?13,"PRIORITY",?90,"SECOND ASSISTANT" W ! F I=1:1:132 W "="
S PAGE=PAGE+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 Q:SRQ W:$D(SRTS) !!,?1,"*",SRTS,"*" 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),"^"))>250 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
1 ; entry when queued
G:$D(SRZZ) 2 U IO N SRFRTO S (C,K,TC,SRUL)=0 K ^TMP("SR",$J) D HDDT,HDR G:SRQ END
F S K=$O(^SRF("ASP",K)) Q:'K!SRQ S N=SRD F S N=$O(^SRF("ASP",K,N)) Q:SRQ!'N!(N>SRED) S SR=0 F S SR=$O(^SRF("ASP",K,N,SR)) Q:'SR!SRQ I $P($G(^SRF(SR,.2)),"^",12),$$DIV^SROUTL0(SR) S ^TMP("SR",$J,K,SR)=""
S K=0 F S K=$O(^TMP("SR",$J,K)) Q:'K!SRQ D S1 S SR=0 F S SR=$O(^TMP("SR",$J,K,SR)) D:'SR STOT Q:'SR!SRQ S C=C+1,TC=TC+1,SRTN=SR D SET
I 'SRQ D:$Y+8>IOSL ASK G:SRQ END W !!!,"TOTAL OPERATIONS FOR ALL SERVICES: ",TC
G END
2 ; entry when queued
U IO N SRFRTO D HDDT,HDR G:SRQ END
S K=SRT1,(C,SR)=0,N=SRD W !!,?30,"*",SRTS,"*"
F S N=$O(^SRF("ASP",K,N)) D:'N!(N>SRED) STOT Q:'N!(N>SRED)!SRQ F S SR=$O(^SRF("ASP",K,N,SR)) Q:'SR!SRQ I $P($G(^SRF(SR,.2)),"^",12),$$DIV^SROUTL0(SR) S SRTN=SR,(C,TC)=C+1 D SET
G END
STOT ; print specialty total
D:$Y+8>IOSL ASK Q:SRQ W !!,?1,"TOTAL ",SRTS,": ",C
Q
HDDT ; set up variables common to both reports
S PAGE=1,SRQ=0,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,SRINST=SRSITE("SITE")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSROPLSTS 4220 printed Nov 22, 2024@17:55:05 Page 2
SROPLSTS ;B'HAM ISC/MAM - LIST OF OPERATIONS BY SERVICE ;09/30/04
+1 ;;3.0;Surgery;**38,53,50,134,182**;24 Jun 93;Build 49
S1 if SRQ
QUIT
SET C=0
SET SRTS=$PIECE(^SRO(137.45,K,0),"^")
IF SRUL
WRITE !
FOR LINE=1:1:IOM
WRITE "-"
+1 WRITE !,?1,"*",SRTS,"*"
SET SRUL=1
QUIT
SET ; set variables
+1 KILL SROP
SET S(0)=^SRF(SRTN,0)
SET DFN=$PIECE(S(0),"^")
DO DEM^VADPT
SET SRNM=VADM(1)
SET SRSSN=VA("PID")
SET SRDT=$PIECE(S(0),"^",9)
SET SROD=$PIECE(S(0),"^",9)
SET (SRSUR,SRATT,SRFST,SRTWO)=""
+2 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),"^")
+3 if SRFST'=""
SET SRFST=$PIECE(^VA(200,SRFST,0),"^")
if SRTWO'=""
SET SRTWO=$PIECE(^VA(200,SRTWO,0),"^")
+4 SET SRABORT=$SELECT($PIECE($GET(^SRF(SRTN,30)),"^"):"*ABORTED*",1:"")
OPS KILL SROPERS
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_" "
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 !!,?1,$EXTRACT(SROD,4,5)_"/"_$EXTRACT(SROD,6,7)_"/"_$EXTRACT(SROD,2,3),?13,$EXTRACT(SRNM,1,26),?38,SROPS(1)
+2 WRITE ?90,$EXTRACT(SRSUR,1,23),?114,$EXTRACT(SRANES,1,14),!,?1,SRTN,?13,VA("PID")
if $DATA(SROPS(2))
WRITE ?38,SROPS(2)
WRITE ?90,$EXTRACT(SRFST,1,23),?114,"OP TIME: ",SROT," MIN.",!,SRABORT,?13,SRTYPE
if $DATA(SROPS(3))
WRITE ?38,SROPS(3)
WRITE ?90,$EXTRACT(SRTWO,1,23)
+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 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,?120,"PAGE ",PAGE,!,?58,"SURGICAL SERVICE",?100,"DATE REVIEWED:",!,?52,"LIST OF OPERATIONS BY SERVICE"
+3 WRITE ?100,"REVIEWED BY:",!,?(132-$LENGTH(SRFRTO)\2),SRFRTO,?100,SRPRINT
+4 WRITE !!,?1,"DATE",?13,"PATIENT",?38,"OPERATION(S)",?90,"PRIMARY SURGEON",?116,"ANESTHESIA",!,"CASE #",?15,"ID#",?90,"FIRST ASSISTANT",?116,"TECHNIQUE",!,?13,"PRIORITY",?90,"SECOND ASSISTANT"
WRITE !
FOR I=1:1:132
WRITE "="
+5 SET PAGE=PAGE+1
+6 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
if SRQ
QUIT
if $DATA(SRTS)
WRITE !!,?1,"*",SRTS,"*"
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),"^"))>250
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
1 ; entry when queued
+1 if $DATA(SRZZ)
GOTO 2
USE IO
NEW SRFRTO
SET (C,K,TC,SRUL)=0
KILL ^TMP("SR",$JOB)
DO HDDT
DO HDR
if SRQ
GOTO END
+2 FOR
SET K=$ORDER(^SRF("ASP",K))
if 'K!SRQ
QUIT
SET N=SRD
FOR
SET N=$ORDER(^SRF("ASP",K,N))
if SRQ!'N!(N>SRED)
QUIT
SET SR=0
FOR
SET SR=$ORDER(^SRF("ASP",K,N,SR))
if 'SR!SRQ
QUIT
IF $PIECE($GET(^SRF(SR,.2)),"^",12)
IF $$DIV^SROUTL0(SR)
SET ^TMP("SR",$JOB,K,SR)=""
+3 SET K=0
FOR
SET K=$ORDER(^TMP("SR",$JOB,K))
if 'K!SRQ
QUIT
DO S1
SET SR=0
FOR
SET SR=$ORDER(^TMP("SR",$JOB,K,SR))
if 'SR
DO STOT
if 'SR!SRQ
QUIT
SET C=C+1
SET TC=TC+1
SET SRTN=SR
DO SET
+4 IF 'SRQ
if $Y+8>IOSL
DO ASK
if SRQ
GOTO END
WRITE !!!,"TOTAL OPERATIONS FOR ALL SERVICES: ",TC
+5 GOTO END
2 ; entry when queued
+1 USE IO
NEW SRFRTO
DO HDDT
DO HDR
if SRQ
GOTO END
+2 SET K=SRT1
SET (C,SR)=0
SET N=SRD
WRITE !!,?30,"*",SRTS,"*"
+3 FOR
SET N=$ORDER(^SRF("ASP",K,N))
if 'N!(N>SRED)
DO STOT
if 'N!(N>SRED)!SRQ
QUIT
FOR
SET SR=$ORDER(^SRF("ASP",K,N,SR))
if 'SR!SRQ
QUIT
IF $PIECE($GET(^SRF(SR,.2)),"^",12)
IF $$DIV^SROUTL0(SR)
SET SRTN=SR
SET (C,TC)=C+1
DO SET
+4 GOTO END
STOT ; print specialty total
+1 if $Y+8>IOSL
DO ASK
if SRQ
QUIT
WRITE !!,?1,"TOTAL ",SRTS,": ",C
+2 QUIT
HDDT ; set up variables common to both reports
+1 SET PAGE=1
SET SRQ=0
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
SET SRINST=SRSITE("SITE")
+2 QUIT