SRODLT0 ;B'HAM ISC/ADM - REPORT OF DELAY TIME (CONT) ; [ 04/05/00 2:37 PM ]
;;3.0; Surgery ;**94**;24 Jun 93
U IO K ^TMP("SR",$J),REASON S (SRHDR,SRSOUT,SRREA)=0,PAGE=1
S SRSDT=$E(SRSD,4,5)_"/"_$E(SRSD,6,7)_"/"_$E(SRSD,2,3),SRSD=SRSD-.0001
S SREDT=$E(SRED,4,5)_"/"_$E(SRED,6,7)_"/"_$E(SRED,2,3),SRED=SRED+.9999
S SRPRINT=$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3)
I SRDL F S SRREA=$O(SRDL(SRREA)) Q:'SRREA S ^TMP("SR",$J,SRREA)="0^0" I SRSP S SRSS=0 F S SRSS=$O(SRSP(SRSS)) Q:'SRSS S ^TMP("SR",$J,SRREA,SRSS)="0^0"
AC F S SRSD=$O(^SRF("AC",SRSD)) Q:'SRSD!(SRSD>SRED) S SRCASE=0 F S SRCASE=$O(^SRF("AC",SRSD,SRCASE)) Q:'SRCASE I $D(^SRF(SRCASE,0)),$$MANDIV^SROUTL0(SRINSTP,SRCASE) D UTIL
D HDR I '$D(^TMP("SR",$J)) W !!,"No data for selected date range."
S SRREA=0 F S SRREA=$O(^TMP("SR",$J,SRREA)) Q:'SRREA!(SRSOUT) S REASON=">> Delay Reason: "_$P(^SRO(132.4,SRREA,0),"^")_" <<" D SUB,SPEC I SRCT'=1 D:'SRSOUT TOTAL
I 'SRSOUT,'SRDL,'SRSP D ^SRODLT1
I 'SRSOUT,'SRDL,SRSP D ^SRODLT2
D END Q
SPEC S SRSS="",SRCT=0 F S SRSS=$O(^TMP("SR",$J,SRREA,SRSS)) Q:SRSS=""!(SRSOUT) S SRSPEC=$S(SRSS:$P(^SRO(137.45,SRSS,0),"^"),1:"NO SPECIALTY ENTERED"),SRCT=SRCT+1 D PRINT
Q
PRINT ; print specialty data
I $Y+5>IOSL D HDR I SRSOUT Q
S Y=^TMP("SR",$J,SRREA,SRSS),SRDLAY=$P(Y,"^"),SRDLT=$P(Y,"^",2)
W !,$E(SRSPEC,1,30),?33,$J(SRDLAY,5),?46,$J(SRDLT,5)
Q
TOTAL ; print delay reason totals
I $Y+5>IOSL D HDR I SRSOUT Q
S Y=^TMP("SR",$J,SRREA),SRDLAY=$P(Y,"^"),SRDLT=$P(Y,"^",2)
W !!,?24,"TOTAL",?32,$J(SRDLAY,6),?45,$J(SRDLT,6)
Q
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
I SRHDR,$E(IOST)'="P" W !!,"Press RETURN to continue, or '^' to quit. " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
W:$Y @IOF W !,?(80-$L(SRINST)\2),SRINST,?72,"PAGE ",PAGE,!,?29,"Report of Delay Times"
W !,?27,"From "_SRSDT_" To "_SREDT,! I $E(IOST)="P" W "Printed: "_SRPRINT,!,?21,"Reviewed by:",?45,"Date Reviewed:",!
W !,?34,"# OF",?45,"MINUTES",!,"SURGICAL SPECIALTY",?33,"DELAYS",?45,"DELAYED",! F LINE=1:1:80 W "="
S (SRPAGE,SRHDR)=1,PAGE=PAGE+1 D:$D(REASON) SUB1
Q
SUB ; print delay reason sub-heading
I $Y+7>IOSL D HDR I SRSOUT!('SRPAGE) Q
I 'SRPAGE W !! F LINE=1:1:80 W "-"
SUB1 W !,?(80-$L(REASON)\2),REASON,! S SRPAGE=0
Q
UTIL ; set ^TMP
Q:'$O(^SRF(SRCASE,17,0))
Q:$P($G(^SRF(SRCASE,.2)),"^",12)=""
S SRSS=$P(^SRF(SRCASE,0),"^",4) S:SRSS="" SRSS="ZZ" I SRSP,'$D(SRSP(SRSS)) Q
S SRDLAY=0 F S SRDLAY=$O(^SRF(SRCASE,17,SRDLAY)) Q:'SRDLAY S SRREA=$P(^SRF(SRCASE,17,SRDLAY,0),"^") D SET
Q
SET I SRDL,'$D(SRDL(SRREA)) Q
I '$D(^TMP("SR",$J,SRREA)) S ^TMP("SR",$J,SRREA)="0^0"
I '$D(^TMP("SR",$J,SRREA,SRSS)) S ^TMP("SR",$J,SRREA,SRSS)="0^0"
S SRDLT=$P(^SRF(SRCASE,17,SRDLAY,0),"^",2) S:SRDLT="" SRDLT=0
S $P(^TMP("SR",$J,SRREA),"^",2)=$P(^TMP("SR",$J,SRREA),"^",2)+SRDLT
S $P(^TMP("SR",$J,SRREA),"^")=$P(^TMP("SR",$J,SRREA),"^")+1
S $P(^TMP("SR",$J,SRREA,SRSS),"^",2)=$P(^TMP("SR",$J,SRREA,SRSS),"^",2)+SRDLT
S $P(^TMP("SR",$J,SRREA,SRSS),"^")=$P(^TMP("SR",$J,SRREA,SRSS),"^")+1
Q
END I 'SRSOUT,$E(IOST)'="P" W !!,"Press RETURN to continue " R X:DTIME
W:$E(IOST)="P" @IOF I $D(ZTQUEUED) K ^TMP("SR",$J) Q:$G(ZTSTOP) S ZTREQ="@" Q
D ^%ZISC,^SRSKILL W @IOF
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRODLT0 3255 printed Oct 16, 2024@18:43:52 Page 2
SRODLT0 ;B'HAM ISC/ADM - REPORT OF DELAY TIME (CONT) ; [ 04/05/00 2:37 PM ]
+1 ;;3.0; Surgery ;**94**;24 Jun 93
+2 USE IO
KILL ^TMP("SR",$JOB),REASON
SET (SRHDR,SRSOUT,SRREA)=0
SET PAGE=1
+3 SET SRSDT=$EXTRACT(SRSD,4,5)_"/"_$EXTRACT(SRSD,6,7)_"/"_$EXTRACT(SRSD,2,3)
SET SRSD=SRSD-.0001
+4 SET SREDT=$EXTRACT(SRED,4,5)_"/"_$EXTRACT(SRED,6,7)_"/"_$EXTRACT(SRED,2,3)
SET SRED=SRED+.9999
+5 SET SRPRINT=$EXTRACT(DT,4,5)_"/"_$EXTRACT(DT,6,7)_"/"_$EXTRACT(DT,2,3)
+6 IF SRDL
FOR
SET SRREA=$ORDER(SRDL(SRREA))
if 'SRREA
QUIT
SET ^TMP("SR",$JOB,SRREA)="0^0"
IF SRSP
SET SRSS=0
FOR
SET SRSS=$ORDER(SRSP(SRSS))
if 'SRSS
QUIT
SET ^TMP("SR",$JOB,SRREA,SRSS)="0^0"
AC FOR
SET SRSD=$ORDER(^SRF("AC",SRSD))
if 'SRSD!(SRSD>SRED)
QUIT
SET SRCASE=0
FOR
SET SRCASE=$ORDER(^SRF("AC",SRSD,SRCASE))
if 'SRCASE
QUIT
IF $DATA(^SRF(SRCASE,0))
IF $$MANDIV^SROUTL0(SRINSTP,SRCASE)
DO UTIL
+1 DO HDR
IF '$DATA(^TMP("SR",$JOB))
WRITE !!,"No data for selected date range."
+2 SET SRREA=0
FOR
SET SRREA=$ORDER(^TMP("SR",$JOB,SRREA))
if 'SRREA!(SRSOUT)
QUIT
SET REASON=">> Delay Reason: "_$PIECE(^SRO(132.4,SRREA,0),"^")_" <<"
DO SUB
DO SPEC
IF SRCT'=1
if 'SRSOUT
DO TOTAL
+3 IF 'SRSOUT
IF 'SRDL
IF 'SRSP
DO ^SRODLT1
+4 IF 'SRSOUT
IF 'SRDL
IF SRSP
DO ^SRODLT2
+5 DO END
QUIT
SPEC SET SRSS=""
SET SRCT=0
FOR
SET SRSS=$ORDER(^TMP("SR",$JOB,SRREA,SRSS))
if SRSS=""!(SRSOUT)
QUIT
SET SRSPEC=$SELECT(SRSS:$PIECE(^SRO(137.45,SRSS,0),"^"),1:"NO SPECIALTY ENTERED")
SET SRCT=SRCT+1
DO PRINT
+1 QUIT
PRINT ; print specialty data
+1 IF $Y+5>IOSL
DO HDR
IF SRSOUT
QUIT
+2 SET Y=^TMP("SR",$JOB,SRREA,SRSS)
SET SRDLAY=$PIECE(Y,"^")
SET SRDLT=$PIECE(Y,"^",2)
+3 WRITE !,$EXTRACT(SRSPEC,1,30),?33,$JUSTIFY(SRDLAY,5),?46,$JUSTIFY(SRDLT,5)
+4 QUIT
TOTAL ; print delay reason totals
+1 IF $Y+5>IOSL
DO HDR
IF SRSOUT
QUIT
+2 SET Y=^TMP("SR",$JOB,SRREA)
SET SRDLAY=$PIECE(Y,"^")
SET SRDLT=$PIECE(Y,"^",2)
+3 WRITE !!,?24,"TOTAL",?32,$JUSTIFY(SRDLAY,6),?45,$JUSTIFY(SRDLT,6)
+4 QUIT
HDR ; print heading
+1 IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRSOUT=1
QUIT
+2 IF SRHDR
IF $EXTRACT(IOST)'="P"
WRITE !!,"Press RETURN to continue, or '^' to quit. "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+3 if $Y
WRITE @IOF
WRITE !,?(80-$LENGTH(SRINST)\2),SRINST,?72,"PAGE ",PAGE,!,?29,"Report of Delay Times"
+4 WRITE !,?27,"From "_SRSDT_" To "_SREDT,!
IF $EXTRACT(IOST)="P"
WRITE "Printed: "_SRPRINT,!,?21,"Reviewed by:",?45,"Date Reviewed:",!
+5 WRITE !,?34,"# OF",?45,"MINUTES",!,"SURGICAL SPECIALTY",?33,"DELAYS",?45,"DELAYED",!
FOR LINE=1:1:80
WRITE "="
+6 SET (SRPAGE,SRHDR)=1
SET PAGE=PAGE+1
if $DATA(REASON)
DO SUB1
+7 QUIT
SUB ; print delay reason sub-heading
+1 IF $Y+7>IOSL
DO HDR
IF SRSOUT!('SRPAGE)
QUIT
+2 IF 'SRPAGE
WRITE !!
FOR LINE=1:1:80
WRITE "-"
SUB1 WRITE !,?(80-$LENGTH(REASON)\2),REASON,!
SET SRPAGE=0
+1 QUIT
UTIL ; set ^TMP
+1 if '$ORDER(^SRF(SRCASE,17,0))
QUIT
+2 if $PIECE($GET(^SRF(SRCASE,.2)),"^",12)=""
QUIT
+3 SET SRSS=$PIECE(^SRF(SRCASE,0),"^",4)
if SRSS=""
SET SRSS="ZZ"
IF SRSP
IF '$DATA(SRSP(SRSS))
QUIT
+4 SET SRDLAY=0
FOR
SET SRDLAY=$ORDER(^SRF(SRCASE,17,SRDLAY))
if 'SRDLAY
QUIT
SET SRREA=$PIECE(^SRF(SRCASE,17,SRDLAY,0),"^")
DO SET
+5 QUIT
SET IF SRDL
IF '$DATA(SRDL(SRREA))
QUIT
+1 IF '$DATA(^TMP("SR",$JOB,SRREA))
SET ^TMP("SR",$JOB,SRREA)="0^0"
+2 IF '$DATA(^TMP("SR",$JOB,SRREA,SRSS))
SET ^TMP("SR",$JOB,SRREA,SRSS)="0^0"
+3 SET SRDLT=$PIECE(^SRF(SRCASE,17,SRDLAY,0),"^",2)
if SRDLT=""
SET SRDLT=0
+4 SET $PIECE(^TMP("SR",$JOB,SRREA),"^",2)=$PIECE(^TMP("SR",$JOB,SRREA),"^",2)+SRDLT
+5 SET $PIECE(^TMP("SR",$JOB,SRREA),"^")=$PIECE(^TMP("SR",$JOB,SRREA),"^")+1
+6 SET $PIECE(^TMP("SR",$JOB,SRREA,SRSS),"^",2)=$PIECE(^TMP("SR",$JOB,SRREA,SRSS),"^",2)+SRDLT
+7 SET $PIECE(^TMP("SR",$JOB,SRREA,SRSS),"^")=$PIECE(^TMP("SR",$JOB,SRREA,SRSS),"^")+1
+8 QUIT
END IF 'SRSOUT
IF $EXTRACT(IOST)'="P"
WRITE !!,"Press RETURN to continue "
READ X:DTIME
+1 if $EXTRACT(IOST)="P"
WRITE @IOF
IF $DATA(ZTQUEUED)
KILL ^TMP("SR",$JOB)
if $GET(ZTSTOP)
QUIT
SET ZTREQ="@"
QUIT
+2 DO ^%ZISC
DO ^SRSKILL
WRITE @IOF
+3 QUIT