GMRCSTU1 ;SLC/DCM,dee - Statistic Utilities for C/RT ;9/26/02 10:15
;;3.0;CONSULT/REQUEST TRACKING;**7,29,43**;DEC 27, 1997
Q
;
SQRT(X) ;calculate the square root of number X
Q X**.5
;
PARENTS(ND,PARENT) ;Add totals for service to itself as a parent and to its parent service
; ND This service in GMRCSVC
; PARENT This services grouper in GMRCSVC
N ND2
F ND2="T","I","O","U" D
.S $P(^TMP("GMRCSVC",$J,2,ND,ND2),"^",1)=$P(^TMP("GMRCSVC",$J,2,ND,ND2),"^",1)+$P(^TMP("GMRCSVC",$J,1,ND,ND2),"^",1)
.S $P(^TMP("GMRCSVC",$J,2,ND,ND2),"^",2)=$P(^TMP("GMRCSVC",$J,2,ND,ND2),"^",2)+$P(^TMP("GMRCSVC",$J,1,ND,ND2),"^",2)
.S $P(^TMP("GMRCSVC",$J,2,ND,ND2),"^",3)=$P(^TMP("GMRCSVC",$J,2,ND,ND2),"^",3)+$P(^TMP("GMRCSVC",$J,1,ND,ND2),"^",3)
.I PARENT D
..S $P(^TMP("GMRCSVC",$J,2,PARENT,ND2),"^",1)=$P($G(^TMP("GMRCSVC",$J,2,PARENT,ND2)),"^",1)+$P(^TMP("GMRCSVC",$J,2,ND,ND2),"^",1)
..S $P(^TMP("GMRCSVC",$J,2,PARENT,ND2),"^",2)=$P($G(^TMP("GMRCSVC",$J,2,PARENT,ND2)),"^",2)+$P(^TMP("GMRCSVC",$J,2,ND,ND2),"^",2)
..S $P(^TMP("GMRCSVC",$J,2,PARENT,ND2),"^",3)=$P($G(^TMP("GMRCSVC",$J,2,PARENT,ND2)),"^",3)+$P(^TMP("GMRCSVC",$J,2,ND,ND2),"^",3)
Q
;
DOSTAT(GEN,ND) ;Do the number crunching for the statistics
; GEN 1 if service
; 2 if grouper
; ND This service in GMRCSVC
N VAR,SUMX
S VAR=$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",2)
S $P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",4)=$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",1)/VAR
I VAR>1 D
.S SUMX=$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",1)
.S SUMX=SUMX*SUMX/VAR
.S SUMX=($P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",3)-SUMX)/(VAR-1)
.S $P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",5)=$$SQRT(SUMX)
E S $P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",5)="N<2"
S VAR=$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",2)
I VAR>0 D
.S $P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",4)=$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",1)/VAR
.I VAR>1 D
..S SUMX=$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",1)
..S SUMX=SUMX*SUMX/VAR
..S SUMX=($P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",3)-SUMX)/(VAR-1)
..S $P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",5)=$$SQRT(SUMX)
.E S $P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",5)="N<2"
S VAR=$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",2)
I VAR>0 D
.S $P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",4)=$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",1)/VAR
.I VAR>1 D
..S SUMX=$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",1)
..S SUMX=SUMX*SUMX/VAR
..S SUMX=($P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",3)-SUMX)/(VAR-1)
..S $P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",5)=$$SQRT(SUMX)
.E S $P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",5)="N<2"
S VAR=$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",2)
I VAR>0 D
.S $P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",4)=$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",1)/VAR
.I VAR>1 D
..S SUMX=$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",1)
..S SUMX=SUMX*SUMX/VAR
..S SUMX=($P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",3)-SUMX)/(VAR-1)
..S $P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",5)=$$SQRT(SUMX)
.E S $P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",5)="N<2"
Q
;
LISTDATE(GMRCDT1,GMRCDT2,GMRCEDT1,GMRCEDT2) ;Change dates to display format
; Input:
; GMRCDT1 Start date in FM format, can be "ALL" for all dates
; GMRCDT2 End date in FM format, can be null if GMRCDT1 is "ALL"
; Output:
; GMRCEDT1 Start date in external format
; GMRCEDT2 End date in extenal format
;
S GMRCEDT1=$$FMTE^XLFDT(GMRCDT1)
S GMRCEDT2=$$FMTE^XLFDT(GMRCDT2)
I GMRCEDT1'="ALL" D
.S Y=GMRCEDT1
.X ^DD("DD")
.S GMRCEDT1=$P(Y,"@",1)
.K %,%DT,%H,%I
I GMRCEDT2=0 D
.S X="NOW"
.D NOW^%DTC
.S Y=%
.K %,%DT,%H,%I
.X ^DD("DD")
.S GMRCEDT2=$P(Y,"@",1)
Q
;
SERVSTAT(COUNT,GEN,ND,GRP) ;Build list for a service or a grouper
; COUNT subscript in to the array ^TMP("GMRCR"
; GEN 1 if service
; 2 if grouper
; ND Pointer to this this service in GMRCSVC
; GRP Pointer to grouper that this service is in ^GMR(123.5
; (If this is not a grouper i.e. GEN=2)
;
N TEMP,NUMBER
S COUNT=COUNT+1
I GEN=1 D
.S TEMP="SERVICE: "_$P(^GMR(123.5,ND,0),"^",1)
.S:GRP>0 TEMP=TEMP_" in Group: "_$P(^GMR(123.5,GRP,0),"^",1)
.S ^TMP("GMRCR",$J,"PRL",GMRCCT,0)=TEMP
E D
.S TEMP="GROUPER: "_$P(^GMR(123.5,ND,0),"^",1)_" Totals:"
.S ^TMP("GMRCR",$J,"PRL",GMRCCT,0)=$E(TAB,1,10)_TEMP
S NUMBER=$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",2)
S COUNT=COUNT+1
S ^TMP("GMRCR",$J,"PRL",COUNT,0)="Total Number Of Consults Completed: "_NUMBER
S COUNT=COUNT+1
S TEMP="Mean Days To Complete: "
S:NUMBER>0 TEMP=TEMP_$J($P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",4),4,2)
S TEMP=TEMP_$E(TAB,1,50-$L(TEMP))_"Standard Deviation: "
I NUMBER>0 S ^TMP("GMRCR",$J,"PRL",COUNT,0)=TEMP_$S($P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",5)=+$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",5):$J($P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",5),4,1),1:$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",5))
E S ^TMP("GMRCR",$J,"PRL",COUNT,0)=TEMP
S NUMBER=$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",2)
S COUNT=COUNT+1
S ^TMP("GMRCR",$J,"PRL",COUNT,0)="Total INPATIENT Consults: "_NUMBER
S COUNT=COUNT+1
S TEMP="Mean Days To Complete: "
S:NUMBER>0 TEMP=TEMP_$J($P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",4),4,2)
S TEMP=TEMP_$E(TAB,1,50-$L(TEMP))_"Standard Deviation: "
I NUMBER>0 D
. S TEMP=TEMP_$S($P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",5)=+$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",5):$J($P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",5),4,1),1:$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",5))
S ^TMP("GMRCR",$J,"PRL",COUNT,0)=TEMP
S NUMBER=$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",2)
S COUNT=COUNT+1
S ^TMP("GMRCR",$J,"PRL",COUNT,0)="Total OUTPATIENT Consults: "_NUMBER
S COUNT=COUNT+1
S TEMP="Mean Days To Complete: "
S:NUMBER>0 TEMP=TEMP_$J($P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",4),4,2)
S TEMP=TEMP_$E(TAB,1,50-$L(TEMP))_"Standard Deviation: "
I NUMBER>0 D
. S TEMP=TEMP_$S($P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",5)=+$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",5):$J($P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",5),4,1),1:$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",5))
S ^TMP("GMRCR",$J,"PRL",COUNT,0)=TEMP
I $P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",2)>0 D
.S NUMBER=$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",2)
.S COUNT=COUNT+1
.S ^TMP("GMRCR",$J,"PRL",COUNT,0)="Total Unclassified Consults: "_NUMBER
.S COUNT=COUNT+1
.S TEMP="Mean Days To Complete: "
.S:NUMBER>0 TEMP=TEMP_$J($P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",4),4,2)
.S TEMP=TEMP_$E(TAB,1,50-$L(TEMP))_"Standard Deviation: "
.I NUMBER>0 D
.. S TEMP=TEMP_$S($P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",5)=+$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",5):$J($P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",5),4,1),1:$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",5))
.S ^TMP("GMRCR",$J,"PRL",COUNT,0)=TEMP
I +$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",6)>0 S COUNT=COUNT+1,^TMP("GMRCR",$J,"PRL",COUNT,0)="No. With Unresolved Accepted in Service Times: "_$J($P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",6),3)_" (Not Included In Statistics)"
S COUNT=COUNT+1
S ^TMP("GMRCR",$J,"PRL",COUNT,0)=""
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRCSTU1 6913 printed Dec 13, 2024@01:47:31 Page 2
GMRCSTU1 ;SLC/DCM,dee - Statistic Utilities for C/RT ;9/26/02 10:15
+1 ;;3.0;CONSULT/REQUEST TRACKING;**7,29,43**;DEC 27, 1997
+2 QUIT
+3 ;
SQRT(X) ;calculate the square root of number X
+1 QUIT X**.5
+2 ;
PARENTS(ND,PARENT) ;Add totals for service to itself as a parent and to its parent service
+1 ; ND This service in GMRCSVC
+2 ; PARENT This services grouper in GMRCSVC
+3 NEW ND2
+4 FOR ND2="T","I","O","U"
Begin DoDot:1
+5 SET $PIECE(^TMP("GMRCSVC",$JOB,2,ND,ND2),"^",1)=$PIECE(^TMP("GMRCSVC",$JOB,2,ND,ND2),"^",1)+$PIECE(^TMP("GMRCSVC",$JOB,1,ND,ND2),"^",1)
+6 SET $PIECE(^TMP("GMRCSVC",$JOB,2,ND,ND2),"^",2)=$PIECE(^TMP("GMRCSVC",$JOB,2,ND,ND2),"^",2)+$PIECE(^TMP("GMRCSVC",$JOB,1,ND,ND2),"^",2)
+7 SET $PIECE(^TMP("GMRCSVC",$JOB,2,ND,ND2),"^",3)=$PIECE(^TMP("GMRCSVC",$JOB,2,ND,ND2),"^",3)+$PIECE(^TMP("GMRCSVC",$JOB,1,ND,ND2),"^",3)
+8 IF PARENT
Begin DoDot:2
+9 SET $PIECE(^TMP("GMRCSVC",$JOB,2,PARENT,ND2),"^",1)=$PIECE($GET(^TMP("GMRCSVC",$JOB,2,PARENT,ND2)),"^",1)+$PIECE(^TMP("GMRCSVC",$JOB,2,ND,ND2),"^",1)
+10 SET $PIECE(^TMP("GMRCSVC",$JOB,2,PARENT,ND2),"^",2)=$PIECE($GET(^TMP("GMRCSVC",$JOB,2,PARENT,ND2)),"^",2)+$PIECE(^TMP("GMRCSVC",$JOB,2,ND,ND2),"^",2)
+11 SET $PIECE(^TMP("GMRCSVC",$JOB,2,PARENT,ND2),"^",3)=$PIECE($GET(^TMP("GMRCSVC",$JOB,2,PARENT,ND2)),"^",3)+$PIECE(^TMP("GMRCSVC",$JOB,2,ND,ND2),"^",3)
End DoDot:2
End DoDot:1
+12 QUIT
+13 ;
DOSTAT(GEN,ND) ;Do the number crunching for the statistics
+1 ; GEN 1 if service
+2 ; 2 if grouper
+3 ; ND This service in GMRCSVC
+4 NEW VAR,SUMX
+5 SET VAR=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",2)
+6 SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",4)=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",1)/VAR
+7 IF VAR>1
Begin DoDot:1
+8 SET SUMX=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",1)
+9 SET SUMX=SUMX*SUMX/VAR
+10 SET SUMX=($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",3)-SUMX)/(VAR-1)
+11 SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",5)=$$SQRT(SUMX)
End DoDot:1
+12 IF '$TEST
SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",5)="N<2"
+13 SET VAR=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",2)
+14 IF VAR>0
Begin DoDot:1
+15 SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",4)=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",1)/VAR
+16 IF VAR>1
Begin DoDot:2
+17 SET SUMX=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",1)
+18 SET SUMX=SUMX*SUMX/VAR
+19 SET SUMX=($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",3)-SUMX)/(VAR-1)
+20 SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",5)=$$SQRT(SUMX)
End DoDot:2
+21 IF '$TEST
SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",5)="N<2"
End DoDot:1
+22 SET VAR=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",2)
+23 IF VAR>0
Begin DoDot:1
+24 SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",4)=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",1)/VAR
+25 IF VAR>1
Begin DoDot:2
+26 SET SUMX=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",1)
+27 SET SUMX=SUMX*SUMX/VAR
+28 SET SUMX=($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",3)-SUMX)/(VAR-1)
+29 SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",5)=$$SQRT(SUMX)
End DoDot:2
+30 IF '$TEST
SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",5)="N<2"
End DoDot:1
+31 SET VAR=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",2)
+32 IF VAR>0
Begin DoDot:1
+33 SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",4)=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",1)/VAR
+34 IF VAR>1
Begin DoDot:2
+35 SET SUMX=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",1)
+36 SET SUMX=SUMX*SUMX/VAR
+37 SET SUMX=($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",3)-SUMX)/(VAR-1)
+38 SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",5)=$$SQRT(SUMX)
End DoDot:2
+39 IF '$TEST
SET $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",5)="N<2"
End DoDot:1
+40 QUIT
+41 ;
LISTDATE(GMRCDT1,GMRCDT2,GMRCEDT1,GMRCEDT2) ;Change dates to display format
+1 ; Input:
+2 ; GMRCDT1 Start date in FM format, can be "ALL" for all dates
+3 ; GMRCDT2 End date in FM format, can be null if GMRCDT1 is "ALL"
+4 ; Output:
+5 ; GMRCEDT1 Start date in external format
+6 ; GMRCEDT2 End date in extenal format
+7 ;
+8 SET GMRCEDT1=$$FMTE^XLFDT(GMRCDT1)
+9 SET GMRCEDT2=$$FMTE^XLFDT(GMRCDT2)
+10 IF GMRCEDT1'="ALL"
Begin DoDot:1
+11 SET Y=GMRCEDT1
+12 XECUTE ^DD("DD")
+13 SET GMRCEDT1=$PIECE(Y,"@",1)
+14 KILL %,%DT,%H,%I
End DoDot:1
+15 IF GMRCEDT2=0
Begin DoDot:1
+16 SET X="NOW"
+17 DO NOW^%DTC
+18 SET Y=%
+19 KILL %,%DT,%H,%I
+20 XECUTE ^DD("DD")
+21 SET GMRCEDT2=$PIECE(Y,"@",1)
End DoDot:1
+22 QUIT
+23 ;
SERVSTAT(COUNT,GEN,ND,GRP) ;Build list for a service or a grouper
+1 ; COUNT subscript in to the array ^TMP("GMRCR"
+2 ; GEN 1 if service
+3 ; 2 if grouper
+4 ; ND Pointer to this this service in GMRCSVC
+5 ; GRP Pointer to grouper that this service is in ^GMR(123.5
+6 ; (If this is not a grouper i.e. GEN=2)
+7 ;
+8 NEW TEMP,NUMBER
+9 SET COUNT=COUNT+1
+10 IF GEN=1
Begin DoDot:1
+11 SET TEMP="SERVICE: "_$PIECE(^GMR(123.5,ND,0),"^",1)
+12 if GRP>0
SET TEMP=TEMP_" in Group: "_$PIECE(^GMR(123.5,GRP,0),"^",1)
+13 SET ^TMP("GMRCR",$JOB,"PRL",GMRCCT,0)=TEMP
End DoDot:1
+14 IF '$TEST
Begin DoDot:1
+15 SET TEMP="GROUPER: "_$PIECE(^GMR(123.5,ND,0),"^",1)_" Totals:"
+16 SET ^TMP("GMRCR",$JOB,"PRL",GMRCCT,0)=$EXTRACT(TAB,1,10)_TEMP
End DoDot:1
+17 SET NUMBER=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",2)
+18 SET COUNT=COUNT+1
+19 SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)="Total Number Of Consults Completed: "_NUMBER
+20 SET COUNT=COUNT+1
+21 SET TEMP="Mean Days To Complete: "
+22 if NUMBER>0
SET TEMP=TEMP_$JUSTIFY($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",4),4,2)
+23 SET TEMP=TEMP_$EXTRACT(TAB,1,50-$LENGTH(TEMP))_"Standard Deviation: "
+24 IF NUMBER>0
SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)=TEMP_$SELECT($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",5)=+$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",5):$JUSTIFY($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",5),4,1),1:$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"
T"),"^",5))
+25 IF '$TEST
SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)=TEMP
+26 SET NUMBER=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",2)
+27 SET COUNT=COUNT+1
+28 SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)="Total INPATIENT Consults: "_NUMBER
+29 SET COUNT=COUNT+1
+30 SET TEMP="Mean Days To Complete: "
+31 if NUMBER>0
SET TEMP=TEMP_$JUSTIFY($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",4),4,2)
+32 SET TEMP=TEMP_$EXTRACT(TAB,1,50-$LENGTH(TEMP))_"Standard Deviation: "
+33 IF NUMBER>0
Begin DoDot:1
+34 SET TEMP=TEMP_$SELECT($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",5)=+$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",5):$JUSTIFY($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",5),4,1),1:$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"I"),"^",5))
End DoDot:1
+35 SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)=TEMP
+36 SET NUMBER=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",2)
+37 SET COUNT=COUNT+1
+38 SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)="Total OUTPATIENT Consults: "_NUMBER
+39 SET COUNT=COUNT+1
+40 SET TEMP="Mean Days To Complete: "
+41 if NUMBER>0
SET TEMP=TEMP_$JUSTIFY($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",4),4,2)
+42 SET TEMP=TEMP_$EXTRACT(TAB,1,50-$LENGTH(TEMP))_"Standard Deviation: "
+43 IF NUMBER>0
Begin DoDot:1
+44 SET TEMP=TEMP_$SELECT($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",5)=+$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",5):$JUSTIFY($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",5),4,1),1:$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"O"),"^",5))
End DoDot:1
+45 SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)=TEMP
+46 IF $PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",2)>0
Begin DoDot:1
+47 SET NUMBER=$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",2)
+48 SET COUNT=COUNT+1
+49 SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)="Total Unclassified Consults: "_NUMBER
+50 SET COUNT=COUNT+1
+51 SET TEMP="Mean Days To Complete: "
+52 if NUMBER>0
SET TEMP=TEMP_$JUSTIFY($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",4),4,2)
+53 SET TEMP=TEMP_$EXTRACT(TAB,1,50-$LENGTH(TEMP))_"Standard Deviation: "
+54 IF NUMBER>0
Begin DoDot:2
+55 SET TEMP=TEMP_$SELECT($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",5)=+$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",5):$JUSTIFY($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",5),4,1),1:$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"U"),"^",5))
End DoDot:2
+56 SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)=TEMP
End DoDot:1
+57 IF +$PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",6)>0
SET COUNT=COUNT+1
SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)="No. With Unresolved Accepted in Service Times: "_$JUSTIFY($PIECE(^TMP("GMRCSVC",$JOB,GEN,ND,"T"),"^",6),3)_" (Not Included In Statistics)"
+58 SET COUNT=COUNT+1
+59 SET ^TMP("GMRCR",$JOB,"PRL",COUNT,0)=""
+60 QUIT