source: WorldVistAEHR/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCSTU1.m@ 1608

Last change on this file since 1608 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 6.6 KB
RevLine 
[613]1GMRCSTU1 ;SLC/DCM,dee - Statistic Utilities for C/RT ;9/26/02 10:15
2 ;;3.0;CONSULT/REQUEST TRACKING;**7,29,43**;DEC 27, 1997
3 Q
4 ;
5SQRT(X) ;calculate the square root of number X
6 Q X**.5
7 ;
8PARENTS(ND,PARENT) ;Add totals for service to itself as a parent and to its parent service
9 ; ND This service in GMRCSVC
10 ; PARENT This services grouper in GMRCSVC
11 N ND2
12 F ND2="T","I","O","U" D
13 .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)
14 .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)
15 .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)
16 .I PARENT D
17 ..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)
18 ..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)
19 ..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)
20 Q
21 ;
22DOSTAT(GEN,ND) ;Do the number crunching for the statistics
23 ; GEN 1 if service
24 ; 2 if grouper
25 ; ND This service in GMRCSVC
26 N VAR,SUMX
27 S VAR=$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",2)
28 S $P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",4)=$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",1)/VAR
29 I VAR>1 D
30 .S SUMX=$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",1)
31 .S SUMX=SUMX*SUMX/VAR
32 .S SUMX=($P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",3)-SUMX)/(VAR-1)
33 .S $P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",5)=$$SQRT(SUMX)
34 E S $P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",5)="N<2"
35 S VAR=$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",2)
36 I VAR>0 D
37 .S $P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",4)=$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",1)/VAR
38 .I VAR>1 D
39 ..S SUMX=$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",1)
40 ..S SUMX=SUMX*SUMX/VAR
41 ..S SUMX=($P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",3)-SUMX)/(VAR-1)
42 ..S $P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",5)=$$SQRT(SUMX)
43 .E S $P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",5)="N<2"
44 S VAR=$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",2)
45 I VAR>0 D
46 .S $P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",4)=$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",1)/VAR
47 .I VAR>1 D
48 ..S SUMX=$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",1)
49 ..S SUMX=SUMX*SUMX/VAR
50 ..S SUMX=($P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",3)-SUMX)/(VAR-1)
51 ..S $P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",5)=$$SQRT(SUMX)
52 .E S $P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",5)="N<2"
53 S VAR=$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",2)
54 I VAR>0 D
55 .S $P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",4)=$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",1)/VAR
56 .I VAR>1 D
57 ..S SUMX=$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",1)
58 ..S SUMX=SUMX*SUMX/VAR
59 ..S SUMX=($P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",3)-SUMX)/(VAR-1)
60 ..S $P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",5)=$$SQRT(SUMX)
61 .E S $P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",5)="N<2"
62 Q
63 ;
64LISTDATE(GMRCDT1,GMRCDT2,GMRCEDT1,GMRCEDT2) ;Change dates to display format
65 ; Input:
66 ; GMRCDT1 Start date in FM format, can be "ALL" for all dates
67 ; GMRCDT2 End date in FM format, can be null if GMRCDT1 is "ALL"
68 ; Output:
69 ; GMRCEDT1 Start date in external format
70 ; GMRCEDT2 End date in extenal format
71 ;
72 S GMRCEDT1=$$FMTE^XLFDT(GMRCDT1)
73 S GMRCEDT2=$$FMTE^XLFDT(GMRCDT2)
74 I GMRCEDT1'="ALL" D
75 .S Y=GMRCEDT1
76 .X ^DD("DD")
77 .S GMRCEDT1=$P(Y,"@",1)
78 .K %,%DT,%H,%I
79 I GMRCEDT2=0 D
80 .S X="NOW"
81 .D NOW^%DTC
82 .S Y=%
83 .K %,%DT,%H,%I
84 .X ^DD("DD")
85 .S GMRCEDT2=$P(Y,"@",1)
86 Q
87 ;
88SERVSTAT(COUNT,GEN,ND,GRP) ;Build list for a service or a grouper
89 ; COUNT subscript in to the array ^TMP("GMRCR"
90 ; GEN 1 if service
91 ; 2 if grouper
92 ; ND Pointer to this this service in GMRCSVC
93 ; GRP Pointer to grouper that this service is in ^GMR(123.5
94 ; (If this is not a grouper i.e. GEN=2)
95 ;
96 N TEMP,NUMBER
97 S COUNT=COUNT+1
98 I GEN=1 D
99 .S TEMP="SERVICE: "_$P(^GMR(123.5,ND,0),"^",1)
100 .S:GRP>0 TEMP=TEMP_" in Group: "_$P(^GMR(123.5,GRP,0),"^",1)
101 .S ^TMP("GMRCR",$J,"PRL",GMRCCT,0)=TEMP
102 E D
103 .S TEMP="GROUPER: "_$P(^GMR(123.5,ND,0),"^",1)_" Totals:"
104 .S ^TMP("GMRCR",$J,"PRL",GMRCCT,0)=$E(TAB,1,10)_TEMP
105 S NUMBER=$P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",2)
106 S COUNT=COUNT+1
107 S ^TMP("GMRCR",$J,"PRL",COUNT,0)="Total Number Of Consults Completed: "_NUMBER
108 S COUNT=COUNT+1
109 S TEMP="Mean Days To Complete: "
110 S:NUMBER>0 TEMP=TEMP_$J($P(^TMP("GMRCSVC",$J,GEN,ND,"T"),"^",4),4,2)
111 S TEMP=TEMP_$E(TAB,1,50-$L(TEMP))_"Standard Deviation: "
112 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))
113 E S ^TMP("GMRCR",$J,"PRL",COUNT,0)=TEMP
114 S NUMBER=$P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",2)
115 S COUNT=COUNT+1
116 S ^TMP("GMRCR",$J,"PRL",COUNT,0)="Total INPATIENT Consults: "_NUMBER
117 S COUNT=COUNT+1
118 S TEMP="Mean Days To Complete: "
119 S:NUMBER>0 TEMP=TEMP_$J($P(^TMP("GMRCSVC",$J,GEN,ND,"I"),"^",4),4,2)
120 S TEMP=TEMP_$E(TAB,1,50-$L(TEMP))_"Standard Deviation: "
121 I NUMBER>0 D
122 . 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))
123 S ^TMP("GMRCR",$J,"PRL",COUNT,0)=TEMP
124 S NUMBER=$P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",2)
125 S COUNT=COUNT+1
126 S ^TMP("GMRCR",$J,"PRL",COUNT,0)="Total OUTPATIENT Consults: "_NUMBER
127 S COUNT=COUNT+1
128 S TEMP="Mean Days To Complete: "
129 S:NUMBER>0 TEMP=TEMP_$J($P(^TMP("GMRCSVC",$J,GEN,ND,"O"),"^",4),4,2)
130 S TEMP=TEMP_$E(TAB,1,50-$L(TEMP))_"Standard Deviation: "
131 I NUMBER>0 D
132 . 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))
133 S ^TMP("GMRCR",$J,"PRL",COUNT,0)=TEMP
134 I $P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",2)>0 D
135 .S NUMBER=$P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",2)
136 .S COUNT=COUNT+1
137 .S ^TMP("GMRCR",$J,"PRL",COUNT,0)="Total Unclassified Consults: "_NUMBER
138 .S COUNT=COUNT+1
139 .S TEMP="Mean Days To Complete: "
140 .S:NUMBER>0 TEMP=TEMP_$J($P(^TMP("GMRCSVC",$J,GEN,ND,"U"),"^",4),4,2)
141 .S TEMP=TEMP_$E(TAB,1,50-$L(TEMP))_"Standard Deviation: "
142 .I NUMBER>0 D
143 .. 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))
144 .S ^TMP("GMRCR",$J,"PRL",COUNT,0)=TEMP
145 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)"
146 S COUNT=COUNT+1
147 S ^TMP("GMRCR",$J,"PRL",COUNT,0)=""
148 Q
Note: See TracBrowser for help on using the repository browser.