SRODIS0 ;BIR/ADM - LIST OF OPERATIONS BY DISPOSITION ; [ 07/27/98 2:33 PM ]
;;3.0;Surgery;**48,50,182**;24 Jun 93;Build 49
U IO S (SRHDR,SRQ)=0,PAGE=1,SRINST=SRSITE("SITE") K ^TMP("SRLIST",$J),^TMP("SRSS",$J)
N SRFRTO S Y=DT X ^DD("DD") S SRPRINT="DATE PRINTED: "_Y,Y=SRSD X ^DD("DD") S SRFRTO="FROM: "_Y_" TO: ",Y=SRED X ^DD("DD") S SRFRTO=SRFRTO_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
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^SRODIS Q:SRQ D ALL
I 'SRSP,'$D(^TMP("SRLIST",$J)) S SRP=$S(SRDISP'="ALL":SRDISP,1:"") D HDR^SRODIS 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 SRIO,SRTN
Q
UTIL ; set ^TMP("SRLIST",$J
Q:$P($G(^SRF(SRTN,.2)),"^",12)=""
S SRP=$P($G(^SRF(SRTN,.4)),"^",6) S:SRP="" SRP="ZZ" I SRDISP'="ALL",SRP'=SRDISP Q
S S(0)=^SRF(SRTN,0),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^SRODIS 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^SRODIS I SRQ Q
W !!!,"TOTAL ",SRSPEC,": ",TOTAL
Q
NONE S SRSPEC=$P(^SRO(137.45,SRSS,0),"^") D HDR^SRODIS 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^SRODIS I SRQ Q
W !!!,"TOTAL "_$S(SRP:$P(^SRO(131.6,SRP,0),"^"),1:"DISPOSITION NOT ENTERED")_": ",TOTAL
Q
CASE ; print individual case
I $Y+7>IOSL D HDR^SRODIS 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)=""
S Y=$P(S(0),"^",12),C=$P(^DD(130,.011,0),"^",2) D Y^DIQ S SRIO=$S(Y="":"NOT ENTERED",Y="SAME DAY":"OUTPATIENT",Y="OUTPATIENT":"OUTPATIENT",1:"INPATIENT")
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,SRIO,!,SRABORT
W:'SRORD ?13,"(",$P(SRSS,"("),")" W:$D(SROPS(3)) ?38,SROPS(3) W ?90,$E(SRTWO,1,23),?114,SROT," MIN."
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[HSRODIS0 4332 printed Nov 22, 2024@17:53:06 Page 2
SRODIS0 ;BIR/ADM - LIST OF OPERATIONS BY DISPOSITION ; [ 07/27/98 2:33 PM ]
+1 ;;3.0;Surgery;**48,50,182**;24 Jun 93;Build 49
+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=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
+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 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
+6 IF SRORD
IF SRSP
SET SRSS=""
FOR
SET SRSS=$ORDER(SRSP(SRSS))
if SRSS=""!SRQ
QUIT
IF '$DATA(^TMP("SRSS",$JOB,SRSS))
DO NONE
+7 IF 'SRORD
FOR
SET SRP=$ORDER(^TMP("SRLIST",$JOB,SRP))
if SRP=""!(SRQ)
QUIT
DO HDR^SRODIS
if SRQ
QUIT
DO ALL
+8 IF 'SRSP
IF '$DATA(^TMP("SRLIST",$JOB))
SET SRP=$SELECT(SRDISP'="ALL":SRDISP,1:"")
DO HDR^SRODIS
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 SRIO,SRTN
+3 QUIT
UTIL ; set ^TMP("SRLIST",$J
+1 if $PIECE($GET(^SRF(SRTN,.2)),"^",12)=""
QUIT
+2 SET SRP=$PIECE($GET(^SRF(SRTN,.4)),"^",6)
if SRP=""
SET SRP="ZZ"
IF SRDISP'="ALL"
IF SRP'=SRDISP
QUIT
+3 SET S(0)=^SRF(SRTN,0)
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^SRODIS
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^SRODIS
IF SRQ
QUIT
+3 WRITE !!!,"TOTAL ",SRSPEC,": ",TOTAL
+4 QUIT
NONE SET SRSPEC=$PIECE(^SRO(137.45,SRSS,0),"^")
DO HDR^SRODIS
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^SRODIS
IF SRQ
QUIT
+2 WRITE !!!,"TOTAL "_$SELECT(SRP:$PIECE(^SRO(131.6,SRP,0),"^"),1:"DISPOSITION NOT ENTERED")_": ",TOTAL
+3 QUIT
CASE ; print individual case
+1 IF $Y+7>IOSL
DO HDR^SRODIS
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 SET Y=$PIECE(S(0),"^",12)
SET C=$PIECE(^DD(130,.011,0),"^",2)
DO Y^DIQ
SET SRIO=$SELECT(Y="":"NOT ENTERED",Y="SAME DAY":"OUTPATIENT",Y="OUTPATIENT":"OUTPATIENT",1:"INPATIENT")
+4 IF 'SRORD
SET SRSS=$PIECE(S(0),"^",4)
SET SRSS=$SELECT(SRSS:$PIECE(^SRO(137.45,SRSS,0),"^"),1:"NO SPECIALTY ENTERED")
+5 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),"^")
+6 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,SRIO,!,SRABORT
+3 if 'SRORD
WRITE ?13,"(",$PIECE(SRSS,"("),")"
if $DATA(SROPS(3))
WRITE ?38,SROPS(3)
WRITE ?90,$EXTRACT(SRTWO,1,23),?114,SROT," MIN."
+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