SRSPUT1 ;B'HAM ISC/MAM - SPECIALTY UTILIZATION (CONT) ; 22 MAY 1990 9:45 PM
;;3.0; Surgery ;;24 Jun 93
S Y=SRSD D D^DIQ S SRSDT=Y,Y=SRED D D^DIQ S SREDT=Y
S X=$P(SRSDT," ") D MON S SRSDT=X_" "_$P(SRSDT," ",2,5)
S X=$P(SREDT," ") D MON S SREDT=X_" "_$P(SREDT," ",2,5)
I SRFLG D HDR Q:SRSOUT D PRINT Q
D HDR Q:SRSOUT S SRSP=0 F S SRSP=$O(^TMP("SR",$J,"SP",SRSP)) Q:SRSP=""!SRSOUT D PRINT
Q:SRSOUT D ^SRSPUT2
Q
PRINT ; print or info
I $Y+10>IOSL D HDR Q:SRSOUT
S SRUTL=^TMP("SR",$J,"SP",SRSP),CASES=$P(SRUTL,"^")
S SROPT=$P(SRUTL,"^",2),SRPOSS=$P(SRUTL,"^",3),SROT=$P(SRUTL,"^",4),SRUTT=SROPT-SROT
S SRPERC=$S(SRPOSS:SRUTT/SRPOSS*100,1:"-") S:SRPERC SRPERC=SRPERC+.5\1*1,SRPERC=SRPERC_"%"
S HOUR=SROPT\60,MIN=SROPT#60 S HOUR=$S(HOUR>1:HOUR_" hrs",HOUR=1:HOUR_" hr",1:"") S MIN=$S(MIN>1:MIN_" mins",MIN=1:MIN_" min",1:"")
D TIMES S SROPTIME=TIME
S SROT=$P(SRUTL,"^",4),HOUR=SROT\60,MIN=SROT#60 S HOUR=$S(HOUR>1:HOUR_" hrs",HOUR=1:HOUR_" hr",1:"") S MIN=$S(MIN>1:MIN_" mins",MIN=1:MIN_" min",1:"")
D TIMES S SROT=TIME
W !!,$P(SRSP,"("),?28,SRPERC,?54,CASES,?72,SROPTIME,?104,SROT,!! F LINE=1:1:132 W "-"
Q
TIMES ; put hrs and mins in readable format
I +HOUR,'+MIN S TIME=" "_HOUR Q
I +HOUR S TIME=HOUR_" and "_MIN Q
I +MIN S TIME=" "_MIN Q
S TIME=" -"
Q
MON S X=$S(X["JAN":"January",X["FEB":"February",X["MAR":"March",X["APR":"April",X["MAY":"May",X["JUN":"June",X["JUL":"July",X["AUG":"August",X["SEP":"September",X["OCT":"October",X["NOV":"November",1:"December")
Q
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
S PAGE=PAGE+1 W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?122,"PAGE "_PAGE,!,?56,"SURGICAL SERVICE",!,?50,"SURGICAL SPECIALTY UTILIZATION REPORT"
I SRFLG W !,?(132-$L(SRSP)\2),SRSP
W !,?(132-$L(SRHDR)\2),SRHDR,!! F LINE=1:1:132 W "="
W !!,"SURGICAL SPECIALTY",?21,"PERCENT UTILIZATION",?48,"NUMBER OF CASES",?71,"TOTAL OPERATION TIME",?100,"TIME WORKED OUTSIDE NORMAL HRS",!! F LINE=1:1:132 W "="
Q
SRSPUT1 ;B'HAM ISC/MAM - SPECIALTY UTILIZATION (CONT) ; 22 MAY 1990 9:45 PM
+1 ;;3.0; Surgery ;;24 Jun 93
+2 SET Y=SRSD
DO D^DIQ
SET SRSDT=Y
SET Y=SRED
DO D^DIQ
SET SREDT=Y
+3 SET X=$PIECE(SRSDT," ")
DO MON
SET SRSDT=X_" "_$PIECE(SRSDT," ",2,5)
+4 SET X=$PIECE(SREDT," ")
DO MON
SET SREDT=X_" "_$PIECE(SREDT," ",2,5)
+5 IF SRFLG
DO HDR
IF SRSOUT
QUIT
DO PRINT
QUIT
+6 DO HDR
IF SRSOUT
QUIT
SET SRSP=0
FOR
SET SRSP=$ORDER(^TMP("SR",$JOB,"SP",SRSP))
IF SRSP=""!SRSOUT
QUIT
DO PRINT
+7 IF SRSOUT
QUIT
DO ^SRSPUT2
+8 QUIT
PRINT ; print or info
+1 IF $Y+10>IOSL
DO HDR
IF SRSOUT
QUIT
+2 SET SRUTL=^TMP("SR",$JOB,"SP",SRSP)
SET CASES=$PIECE(SRUTL,"^")
+3 SET SROPT=$PIECE(SRUTL,"^",2)
SET SRPOSS=$PIECE(SRUTL,"^",3)
SET SROT=$PIECE(SRUTL,"^",4)
SET SRUTT=SROPT-SROT
+4 SET SRPERC=$SELECT(SRPOSS:SRUTT/SRPOSS*100,1:"-")
IF SRPERC
SET SRPERC=SRPERC+.5\1*1
SET SRPERC=SRPERC_"%"
+5 SET HOUR=SROPT\60
SET MIN=SROPT#60
SET HOUR=$SELECT(HOUR>1:HOUR_" hrs",HOUR=1:HOUR_" hr",1:"")
SET MIN=$SELECT(MIN>1:MIN_" mins",MIN=1:MIN_" min",1:"")
+6 DO TIMES
SET SROPTIME=TIME
+7 SET SROT=$PIECE(SRUTL,"^",4)
SET HOUR=SROT\60
SET MIN=SROT#60
SET HOUR=$SELECT(HOUR>1:HOUR_" hrs",HOUR=1:HOUR_" hr",1:"")
SET MIN=$SELECT(MIN>1:MIN_" mins",MIN=1:MIN_" min",1:"")
+8 DO TIMES
SET SROT=TIME
+9 WRITE !!,$PIECE(SRSP,"("),?28,SRPERC,?54,CASES,?72,SROPTIME,?104,SROT,!!
FOR LINE=1:1:132
WRITE "-"
+10 QUIT
TIMES ; put hrs and mins in readable format
+1 IF +HOUR
IF '+MIN
SET TIME=" "_HOUR
QUIT
+2 IF +HOUR
SET TIME=HOUR_" and "_MIN
QUIT
+3 IF +MIN
SET TIME=" "_MIN
QUIT
+4 SET TIME=" -"
+5 QUIT
MON SET X=$SELECT(X["JAN":"January",X["FEB":"February",X["MAR":"March",X["APR":"April",X["MAY":"May",X["JUN":"June",X["JUL":"July",X["AUG":"August",X["SEP":"September",X["OCT":"October",X["NOV":"November",1:"December")
+1 QUIT
HDR ; print heading
+1 IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRSOUT=1
QUIT
+2 SET PAGE=PAGE+1
IF $Y
WRITE @IOF
WRITE !,?(132-$LENGTH(SRINST)\2),SRINST,?122,"PAGE "_PAGE,!,?56,"SURGICAL SERVICE",!,?50,"SURGICAL SPECIALTY UTILIZATION REPORT"
+3 IF SRFLG
WRITE !,?(132-$LENGTH(SRSP)\2),SRSP
+4 WRITE !,?(132-$LENGTH(SRHDR)\2),SRHDR,!!
FOR LINE=1:1:132
WRITE "="
+5 WRITE !!,"SURGICAL SPECIALTY",?21,"PERCENT UTILIZATION",?48,"NUMBER OF CASES",?71,"TOTAL OPERATION TIME",?100,"TIME WORKED OUTSIDE NORMAL HRS",!!
FOR LINE=1:1:132
WRITE "="
+6 QUIT