SROPRI ;B'HAM ISC/MAM - LIST OF OPERATIONS BY PRIORITY ; [ 09/22/98 11:42 AM ]
;;3.0; Surgery ;**38,53,50**;24 Jun 93
U IO S (SRHDR,SRQ)=0,PAGE=1,SRINST=SRSITE("SITE") K ^TMP("SRLIST",$J),^TMP("SRSS",$J)
N SRFRTO S Y=SRSD X ^DD("DD") S SRFRTO="FROM: "_Y_" TO: ",Y=SRED X ^DD("DD") S SRFRTO=SRFRTO_Y,Y=DT X ^DD("DD") S SRPRINT="DATE PRINTED: "_Y
S SRD=SRSD-.0001,SRED1=SRED+.9999,SRSOUT=0 F S SRD=$O(^SRF("AC",SRD)) Q:SRD=""!(SRD>SRED1) S SRTN=0 F S SRTN=$O(^SRF("AC",SRD,SRTN)) Q:SRTN="" I $D(^SRF(SRTN,0)),$$DIV^SROUTL0(SRTN) D UTIL
D PRIORITY^SROPRIO
S SRP="" I SRORD F S SRP=$O(^TMP("SRLIST",$J,SRP)) Q:SRP=""!(SRQ) S SRSS="" F S SRSS=$O(^TMP("SRLIST",$J,SRP,SRSS)) Q:SRSS=""!(SRQ) D SPEC
I SRORD,SRSP S SRSS="" F S SRSS=$O(SRSP(SRSS)) Q:SRSS=""!SRQ I '$D(^TMP("SRSS",$J,SRSS)) D NONE
I 'SRORD F S SRP=$O(^TMP("SRLIST",$J,SRP)) Q:SRP=""!(SRQ) D HDR^SROPRIO Q:SRQ D ALL
I 'SRSP,'$D(^TMP("SRLIST",$J)) D HDR^SROPRIO W $$NODATA^SROUTL0()
END I 'SRQ,$E(IOST)'="P" W !!,"Press RETURN to continue or '^' to quit. " R X:DTIME
W:$E(IOST)="P" @IOF K ^TMP("SRLIST",$J) I $D(ZTQUEUED) Q:$G(ZTSTOP) S ZTREQ="@" Q
D ^%ZISC W @IOF D ^SRSKILL K SRTN
Q
UTIL ; set ^TMP("SRLIST",$J
Q:$P($G(^SRF(SRTN,.2)),"^",12)=""
S S(0)=^SRF(SRTN,0) S SRP=$P(S(0),"^",10) S:SRP="" SRP="ZZ" I SRPRIO'="ALL",SRP'=SRPRIO Q
S SRSS=$P(S(0),"^",4) S:SRSS="" SRSS="ZZ" I SRSP,'$D(SRSP(SRSS)) Q
S ^TMP("SRSS",$J,SRSS)="" I SRORD S ^TMP("SRLIST",$J,SRP,SRSS,SRD,SRTN)="" Q
S ^TMP("SRLIST",$J,SRP,SRD,SRTN)=""
Q
SPEC S SRSPEC=$S(SRSS:$P(^SRO(137.45,SRSS,0),"^"),1:"NO SPECIALTY ENTERED") D HDR^SROPRIO Q:SRQ
S (TOTAL,SRD)=0 F S SRD=$O(^TMP("SRLIST",$J,SRP,SRSS,SRD)) Q:'SRD!(SRQ) S SRTN=0 F S SRTN=$O(^TMP("SRLIST",$J,SRP,SRSS,SRD,SRTN)) Q:'SRTN!(SRQ) S TOTAL=TOTAL+1 D CASE
Q:SRQ I $Y+5>IOSL D HDR^SROPRIO I SRQ Q
W !!!,"TOTAL ",SRSPEC,": ",TOTAL
Q
NONE S SRSPEC=$P(^SRO(137.45,SRSS,0),"^") D HDR^SROPRIO Q:SRQ
W !!,"TOTAL ",SRSPEC,": 0"
Q
ALL S (SRD,TOTAL)=0 F S SRD=$O(^TMP("SRLIST",$J,SRP,SRD)) Q:'SRD!(SRQ) S SRTN=0 F S SRTN=$O(^TMP("SRLIST",$J,SRP,SRD,SRTN)) Q:'SRTN!(SRQ) D CASE S TOTAL=TOTAL+1
Q:SRQ I $Y+5>IOSL D HDR^SROPRIO I SRQ Q
W !!!,"TOTAL ",SRCODE(SRP),": ",TOTAL
Q
CASE ; print individual case
I $Y+7>IOSL D HDR^SROPRIO I SRQ Q
S S(0)=^SRF(SRTN,0),DFN=$P(S(0),"^") D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID"),SROD=$P(S(0),"^",9),(SRSUR,SRFST,SRTWO)=""
I 'SRORD S SRSS=$P(S(0),"^",4),SRSS=$S(SRSS:$P(^SRO(137.45,SRSS,0),"^"),1:"NO SPECIALTY ENTERED")
S S(.1)=$G(^SRF(SRTN,.1)) S SRSUR=$P(S(.1),"^",4),SRFST=$P(S(.1),"^",5),SRTWO=$P(S(.1),"^",6) S:SRSUR'="" SRSUR=$P(^VA(200,SRSUR,0),"^")
S:SRFST'="" SRFST=$P(^VA(200,SRFST,0),"^") S:SRTWO'="" SRTWO=$P(^VA(200,SRTWO,0),"^")
OPS K SROPERS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F 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:""),SRABORT=$S($P($G(^SRF(SRTN,30)),"^"):"*ABORTED*",1:"")
PRINT ;
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
W:'SRORD ?13,"(",$P(SRSS,"("),")" 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
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
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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSROPRI 4099 printed Oct 16, 2024@18:45:51 Page 2
SROPRI ;B'HAM ISC/MAM - LIST OF OPERATIONS BY PRIORITY ; [ 09/22/98 11:42 AM ]
+1 ;;3.0; Surgery ;**38,53,50**;24 Jun 93
+2 USE IO
SET (SRHDR,SRQ)=0
SET PAGE=1
SET SRINST=SRSITE("SITE")
KILL ^TMP("SRLIST",$JOB),^TMP("SRSS",$JOB)
+3 NEW SRFRTO
SET Y=SRSD
XECUTE ^DD("DD")
SET SRFRTO="FROM: "_Y_" TO: "
SET Y=SRED
XECUTE ^DD("DD")
SET SRFRTO=SRFRTO_Y
SET Y=DT
XECUTE ^DD("DD")
SET SRPRINT="DATE PRINTED: "_Y
+4 SET SRD=SRSD-.0001
SET SRED1=SRED+.9999
SET SRSOUT=0
FOR
SET SRD=$ORDER(^SRF("AC",SRD))
if SRD=""!(SRD>SRED1)
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^SRF("AC",SRD,SRTN))
if SRTN=""
QUIT
IF $DATA(^SRF(SRTN,0))
IF $$DIV^SROUTL0(SRTN)
DO UTIL
+5 DO PRIORITY^SROPRIO
+6 SET SRP=""
IF SRORD
FOR
SET SRP=$ORDER(^TMP("SRLIST",$JOB,SRP))
if SRP=""!(SRQ)
QUIT
SET SRSS=""
FOR
SET SRSS=$ORDER(^TMP("SRLIST",$JOB,SRP,SRSS))
if SRSS=""!(SRQ)
QUIT
DO SPEC
+7 IF SRORD
IF SRSP
SET SRSS=""
FOR
SET SRSS=$ORDER(SRSP(SRSS))
if SRSS=""!SRQ
QUIT
IF '$DATA(^TMP("SRSS",$JOB,SRSS))
DO NONE
+8 IF 'SRORD
FOR
SET SRP=$ORDER(^TMP("SRLIST",$JOB,SRP))
if SRP=""!(SRQ)
QUIT
DO HDR^SROPRIO
if SRQ
QUIT
DO ALL
+9 IF 'SRSP
IF '$DATA(^TMP("SRLIST",$JOB))
DO HDR^SROPRIO
WRITE $$NODATA^SROUTL0()
END IF 'SRQ
IF $EXTRACT(IOST)'="P"
WRITE !!,"Press RETURN to continue or '^' to quit. "
READ X:DTIME
+1 if $EXTRACT(IOST)="P"
WRITE @IOF
KILL ^TMP("SRLIST",$JOB)
IF $DATA(ZTQUEUED)
if $GET(ZTSTOP)
QUIT
SET ZTREQ="@"
QUIT
+2 DO ^%ZISC
WRITE @IOF
DO ^SRSKILL
KILL SRTN
+3 QUIT
UTIL ; set ^TMP("SRLIST",$J
+1 if $PIECE($GET(^SRF(SRTN,.2)),"^",12)=""
QUIT
+2 SET S(0)=^SRF(SRTN,0)
SET SRP=$PIECE(S(0),"^",10)
if SRP=""
SET SRP="ZZ"
IF SRPRIO'="ALL"
IF SRP'=SRPRIO
QUIT
+3 SET SRSS=$PIECE(S(0),"^",4)
if SRSS=""
SET SRSS="ZZ"
IF SRSP
IF '$DATA(SRSP(SRSS))
QUIT
+4 SET ^TMP("SRSS",$JOB,SRSS)=""
IF SRORD
SET ^TMP("SRLIST",$JOB,SRP,SRSS,SRD,SRTN)=""
QUIT
+5 SET ^TMP("SRLIST",$JOB,SRP,SRD,SRTN)=""
+6 QUIT
SPEC SET SRSPEC=$SELECT(SRSS:$PIECE(^SRO(137.45,SRSS,0),"^"),1:"NO SPECIALTY ENTERED")
DO HDR^SROPRIO
if SRQ
QUIT
+1 SET (TOTAL,SRD)=0
FOR
SET SRD=$ORDER(^TMP("SRLIST",$JOB,SRP,SRSS,SRD))
if 'SRD!(SRQ)
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^TMP("SRLIST",$JOB,SRP,SRSS,SRD,SRTN))
if 'SRTN!(SRQ)
QUIT
SET TOTAL=TOTAL+1
DO CASE
+2 if SRQ
QUIT
IF $Y+5>IOSL
DO HDR^SROPRIO
IF SRQ
QUIT
+3 WRITE !!!,"TOTAL ",SRSPEC,": ",TOTAL
+4 QUIT
NONE SET SRSPEC=$PIECE(^SRO(137.45,SRSS,0),"^")
DO HDR^SROPRIO
if SRQ
QUIT
+1 WRITE !!,"TOTAL ",SRSPEC,": 0"
+2 QUIT
ALL SET (SRD,TOTAL)=0
FOR
SET SRD=$ORDER(^TMP("SRLIST",$JOB,SRP,SRD))
if 'SRD!(SRQ)
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^TMP("SRLIST",$JOB,SRP,SRD,SRTN))
if 'SRTN!(SRQ)
QUIT
DO CASE
SET TOTAL=TOTAL+1
+1 if SRQ
QUIT
IF $Y+5>IOSL
DO HDR^SROPRIO
IF SRQ
QUIT
+2 WRITE !!!,"TOTAL ",SRCODE(SRP),": ",TOTAL
+3 QUIT
CASE ; print individual case
+1 IF $Y+7>IOSL
DO HDR^SROPRIO
IF SRQ
QUIT
+2 SET S(0)=^SRF(SRTN,0)
SET DFN=$PIECE(S(0),"^")
DO DEM^VADPT
SET SRNM=VADM(1)
SET SRSSN=VA("PID")
SET SROD=$PIECE(S(0),"^",9)
SET (SRSUR,SRFST,SRTWO)=""
+3 IF 'SRORD
SET SRSS=$PIECE(S(0),"^",4)
SET SRSS=$SELECT(SRSS:$PIECE(^SRO(137.45,SRSS,0),"^"),1:"NO SPECIALTY ENTERED")
+4 SET S(.1)=$GET(^SRF(SRTN,.1))
SET SRSUR=$PIECE(S(.1),"^",4)
SET SRFST=$PIECE(S(.1),"^",5)
SET SRTWO=$PIECE(S(.1),"^",6)
if SRSUR'=""
SET SRSUR=$PIECE(^VA(200,SRSUR,0),"^")
+5 if SRFST'=""
SET SRFST=$PIECE(^VA(200,SRFST,0),"^")
if SRTWO'=""
SET SRTWO=$PIECE(^VA(200,SRTWO,0),"^")
OPS KILL SROPERS
SET SROPER=$PIECE(^SRF(SRTN,"OP"),"^")
SET OPER=0
FOR
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
+4 SET SRANES=$SELECT($DATA(SRTECH):SRTECH,1:"")
SET SRABORT=$SELECT($PIECE($GET(^SRF(SRTN,30)),"^"):"*ABORTED*",1:"")
PRINT ;
+1 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
+3 if 'SRORD
WRITE ?13,"(",$PIECE(SRSS,"("),")"
if $DATA(SROPS(3))
WRITE ?38,SROPS(3)
WRITE ?90,$EXTRACT(SRTWO,1,23)
+4 IF $DATA(SROPS(4))
WRITE !,?38,SROPS(4)
IF $DATA(SROPS(5))
WRITE !,?38,SROPS(5)
IF $DATA(SROPS(6))
WRITE !,?38,SROPS(6)
+5 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
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