SRODLA1 ;B'HAM ISC/MAM - DELAYS, ONE SPECIALTY ; [ 04/04/00 11:23 AM ]
;;3.0; Surgery ;**75,94**;24 Jun 93
S SPEC=$P(^SRO(137.45,SRSS,0),"^"),(PAGE,SRSOUT,SRHDR)=0 K ^TMP("SR",$J),^TMP("SRT",$J),^TMP("SRF",$J) S ^TMP("SR",$J)=0
S SRSDATE=SRSD-.0001,SREDT=SRED+.9999,SRPRINT=$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3) D HDR^SRODLAY Q:SRSOUT
F S SRSDATE=$O(^SRF("AC",SRSDATE)) Q:'SRSDATE!(SRSDATE>SREDT) S SRTN=0 F S SRTN=$O(^SRF("AC",SRSDATE,SRTN)) Q:'SRTN I $D(^SRF(SRTN,0)),$$MANDIV^SROUTL0(SRINSTP,SRTN) D UTIL
S CAUSE=0 F S CAUSE=$O(^TMP("SRF",$J,CAUSE)) Q:CAUSE=""!(SRSOUT) D CAUSE Q:SRSOUT S SRSDATE=0 D MORE
I ^TMP("SR",$J)=0 W !!,"No data for selected date range."
Q
MORE F S SRSDATE=$O(^TMP("SRF",$J,CAUSE,SRSDATE)) Q:'SRSDATE!(SRSOUT) S SRTN=0 F S SRTN=$O(^TMP("SRF",$J,CAUSE,SRSDATE,SRTN)) W:'SRTN ! Q:'SRTN!(SRSOUT) S SRD=^(SRTN) D PRINT
Q
PRINT ; print case information
I $Y+5>IOSL D PAGE^SRODLAY Q:SRSOUT D CAUSE
S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT S SRNM=VADM(1)
S SRATT=$P($G(^SRF(SRTN,.1)),"^",13) S:SRATT SRATT=$P(^VA(200,SRATT,0),"^") S SRDEL=$P(SRD,"^"),SRDC=$P(SRD,"^",2)
OPS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
K SROP,MM,MMM S:$L(SROPER)<39 SROP(1)=SROPER I $L(SROPER)>38 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
K SRX,SRCOM I $O(^SRF(SRTN,17,SRDC,1,0)) S SRL=0,SRCNT=1 F S SRL=$O(^SRF(SRTN,17,SRDC,1,SRL)) Q:'SRL D COM
W !!,$E(SRSDATE,4,5)_"/"_$E(SRSDATE,6,7)_"/"_$E(SRSDATE,2,3),?12,SRNM,?44,SRATT W:$D(SRCOM(1)) ?84,SRCOM(1)
W !,SRDEL_" MINS.",?14,VA("PID"),?44,SROP(1) I $D(SRCOM(2)) W ?84,SRCOM(2)
F J=2:1 Q:'$D(SROP(J))&('$D(SRCOM(J+1))) W ! W:$D(SROP(J)) ?44,SROP(J) W:$D(SRCOM(J+1)) ?84,SRCOM(J+1)
Q
UTIL Q:'$P($G(^SRF(SRTN,.2)),"^",12) Q:'$O(^SRF(SRTN,17,0))
S SRSS1=$P(^SRF(SRTN,0),"^",4) I SRSS'=SRSS1 Q
S SRDC=0 F S SRDC=$O(^SRF(SRTN,17,SRDC)) Q:'SRDC S CAUSE=$P(^SRF(SRTN,17,SRDC,0),"^"),SRDEL=$P(^(0),"^",2) D SETUT
Q
SETUT I '$D(^TMP("SR",$J,CAUSE)) S ^TMP("SR",$J,CAUSE)=0
S ^TMP("SR",$J)=^TMP("SR",$J)+1,^TMP("SR",$J,CAUSE)=^TMP("SR",$J,CAUSE)+1
S ^TMP("SRF",$J,CAUSE,SRSDATE,SRTN)=SRDEL_"^"_SRDC
Q
CAUSE I $Y+12>IOSL D PAGE^SRODLAY Q:SRSOUT
S SRCAUS=$P(^SRO(132.4,CAUSE,0),"^"),SRCOL=132-$L(SRCAUS)\2,SRUL="" F LINE=1:1:$L(SRCAUS) S SRUL=SRUL_"-"
W !!,?SRCOL,SRCAUS,!,?SRCOL,SRUL
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 38 characters
S SROP(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROP(M))+$L(MM)'<38 S SROP(M)=SROP(M)_MM_" ",SROPER=MMM
Q
COM S SRX=^SRF(SRTN,17,SRDC,1,SRL,0) I $L(SRX)<48 S SRCOM(SRCNT)=SRX,SRCNT=SRCNT+1 Q
S SRX=SRX_" " F M=1:1 Q:SRX=" " S SRX(M)="" F L=1:1 S MM=$P(SRX," "),SRZ=$P(SRX," ",2,250) Q:SRZ="" D Q:SRQ
.S SRQ=0 I $L(MM)'<48 D S SRX=SRZ Q
..S SRQ=1 F K=0:1 Q:MM="" S MMM=$E(MM,1,47),SRX(M+K)=MMM,MM=$E(MM,48,$L(MM))
..S M=M+K-1
.I $L(SRX(M))+$L(MM)'<48 S SRQ=1 Q
.S SRX(M)=SRX(M)_MM_" ",SRX=SRZ
F I=1:1:M-1 S SRCOM(SRCNT)=SRX(I) S SRCNT=SRCNT+1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRODLA1 3259 printed Nov 22, 2024@17:53:07 Page 2
SRODLA1 ;B'HAM ISC/MAM - DELAYS, ONE SPECIALTY ; [ 04/04/00 11:23 AM ]
+1 ;;3.0; Surgery ;**75,94**;24 Jun 93
+2 SET SPEC=$PIECE(^SRO(137.45,SRSS,0),"^")
SET (PAGE,SRSOUT,SRHDR)=0
KILL ^TMP("SR",$JOB),^TMP("SRT",$JOB),^TMP("SRF",$JOB)
SET ^TMP("SR",$JOB)=0
+3 SET SRSDATE=SRSD-.0001
SET SREDT=SRED+.9999
SET SRPRINT=$EXTRACT(DT,4,5)_"/"_$EXTRACT(DT,6,7)_"/"_$EXTRACT(DT,2,3)
DO HDR^SRODLAY
if SRSOUT
QUIT
+4 FOR
SET SRSDATE=$ORDER(^SRF("AC",SRSDATE))
if 'SRSDATE!(SRSDATE>SREDT)
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^SRF("AC",SRSDATE,SRTN))
if 'SRTN
QUIT
IF $DATA(^SRF(SRTN,0))
IF $$MANDIV^SROUTL0(SRINSTP,SRTN)
DO UTIL
+5 SET CAUSE=0
FOR
SET CAUSE=$ORDER(^TMP("SRF",$JOB,CAUSE))
if CAUSE=""!(SRSOUT)
QUIT
DO CAUSE
if SRSOUT
QUIT
SET SRSDATE=0
DO MORE
+6 IF ^TMP("SR",$JOB)=0
WRITE !!,"No data for selected date range."
+7 QUIT
MORE FOR
SET SRSDATE=$ORDER(^TMP("SRF",$JOB,CAUSE,SRSDATE))
if 'SRSDATE!(SRSOUT)
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^TMP("SRF",$JOB,CAUSE,SRSDATE,SRTN))
if 'SRTN
WRITE !
if 'SRTN!(SRSOUT)
QUIT
SET SRD=^(SRTN)
DO PRINT
+1 QUIT
PRINT ; print case information
+1 IF $Y+5>IOSL
DO PAGE^SRODLAY
if SRSOUT
QUIT
DO CAUSE
+2 SET DFN=$PIECE(^SRF(SRTN,0),"^")
DO DEM^VADPT
SET SRNM=VADM(1)
+3 SET SRATT=$PIECE($GET(^SRF(SRTN,.1)),"^",13)
if SRATT
SET SRATT=$PIECE(^VA(200,SRATT,0),"^")
SET SRDEL=$PIECE(SRD,"^")
SET SRDC=$PIECE(SRD,"^",2)
OPS SET SROPER=$PIECE(^SRF(SRTN,"OP"),"^")
SET OPER=0
FOR
SET OPER=$ORDER(^SRF(SRTN,13,OPER))
if OPER=""
QUIT
DO OTHER
+1 KILL SROP,MM,MMM
if $LENGTH(SROPER)<39
SET SROP(1)=SROPER
IF $LENGTH(SROPER)>38
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
if MMM=""
QUIT
+2 KILL SRX,SRCOM
IF $ORDER(^SRF(SRTN,17,SRDC,1,0))
SET SRL=0
SET SRCNT=1
FOR
SET SRL=$ORDER(^SRF(SRTN,17,SRDC,1,SRL))
if 'SRL
QUIT
DO COM
+3 WRITE !!,$EXTRACT(SRSDATE,4,5)_"/"_$EXTRACT(SRSDATE,6,7)_"/"_$EXTRACT(SRSDATE,2,3),?12,SRNM,?44,SRATT
if $DATA(SRCOM(1))
WRITE ?84,SRCOM(1)
+4 WRITE !,SRDEL_" MINS.",?14,VA("PID"),?44,SROP(1)
IF $DATA(SRCOM(2))
WRITE ?84,SRCOM(2)
+5 FOR J=2:1
if '$DATA(SROP(J))&('$DATA(SRCOM(J+1)))
QUIT
WRITE !
if $DATA(SROP(J))
WRITE ?44,SROP(J)
if $DATA(SRCOM(J+1))
WRITE ?84,SRCOM(J+1)
+6 QUIT
UTIL if '$PIECE($GET(^SRF(SRTN,.2)),"^",12)
QUIT
if '$ORDER(^SRF(SRTN,17,0))
QUIT
+1 SET SRSS1=$PIECE(^SRF(SRTN,0),"^",4)
IF SRSS'=SRSS1
QUIT
+2 SET SRDC=0
FOR
SET SRDC=$ORDER(^SRF(SRTN,17,SRDC))
if 'SRDC
QUIT
SET CAUSE=$PIECE(^SRF(SRTN,17,SRDC,0),"^")
SET SRDEL=$PIECE(^(0),"^",2)
DO SETUT
+3 QUIT
SETUT IF '$DATA(^TMP("SR",$JOB,CAUSE))
SET ^TMP("SR",$JOB,CAUSE)=0
+1 SET ^TMP("SR",$JOB)=^TMP("SR",$JOB)+1
SET ^TMP("SR",$JOB,CAUSE)=^TMP("SR",$JOB,CAUSE)+1
+2 SET ^TMP("SRF",$JOB,CAUSE,SRSDATE,SRTN)=SRDEL_"^"_SRDC
+3 QUIT
CAUSE IF $Y+12>IOSL
DO PAGE^SRODLAY
if SRSOUT
QUIT
+1 SET SRCAUS=$PIECE(^SRO(132.4,CAUSE,0),"^")
SET SRCOL=132-$LENGTH(SRCAUS)\2
SET SRUL=""
FOR LINE=1:1:$LENGTH(SRCAUS)
SET SRUL=SRUL_"-"
+2 WRITE !!,?SRCOL,SRCAUS,!,?SRCOL,SRUL
+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 38 characters
+1 SET SROP(M)=""
FOR LOOP=1:1
SET MM=$PIECE(SROPER," ")
SET MMM=$PIECE(SROPER," ",2,200)
if MMM=""
QUIT
if $LENGTH(SROP(M))+$LENGTH(MM)'<38
QUIT
SET SROP(M)=SROP(M)_MM_" "
SET SROPER=MMM
+2 QUIT
COM SET SRX=^SRF(SRTN,17,SRDC,1,SRL,0)
IF $LENGTH(SRX)<48
SET SRCOM(SRCNT)=SRX
SET SRCNT=SRCNT+1
QUIT
+1 SET SRX=SRX_" "
FOR M=1:1
if SRX=" "
QUIT
SET SRX(M)=""
FOR L=1:1
SET MM=$PIECE(SRX," ")
SET SRZ=$PIECE(SRX," ",2,250)
if SRZ=""
QUIT
Begin DoDot:1
+2 SET SRQ=0
IF $LENGTH(MM)'<48
Begin DoDot:2
+3 SET SRQ=1
FOR K=0:1
if MM=""
QUIT
SET MMM=$EXTRACT(MM,1,47)
SET SRX(M+K)=MMM
SET MM=$EXTRACT(MM,48,$LENGTH(MM))
+4 SET M=M+K-1
End DoDot:2
SET SRX=SRZ
QUIT
+5 IF $LENGTH(SRX(M))+$LENGTH(MM)'<48
SET SRQ=1
QUIT
+6 SET SRX(M)=SRX(M)_MM_" "
SET SRX=SRZ
End DoDot:1
if SRQ
QUIT
+7 FOR I=1:1:M-1
SET SRCOM(SRCNT)=SRX(I)
SET SRCNT=SRCNT+1
+8 QUIT