| 1 | HLEMST ;ALB/CJM -ListManager Screen for displaying an Event Statistics;12 JUN 1997 10:00 am
|
---|
| 2 | ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13,1995
|
---|
| 3 | ;
|
---|
| 4 | EN ;Entry point to viewing a Event Statistics
|
---|
| 5 | ;Input: EVENT is the ien of an event
|
---|
| 6 | ;Output: none
|
---|
| 7 | ;
|
---|
| 8 | N IDX,BEGIN
|
---|
| 9 | I $G(PROFILE),$D(PROFILE("SITES")),$D(PROFILE("TYPES"))
|
---|
| 10 | E N PROFILE S PROFILE=$$PROFILE^HLEMSL() Q:'PROFILE S PROFILE=$$GET^HLEMP(PROFILE,.PROFILE)
|
---|
| 11 | S BEGIN=$$ASKBEGIN()
|
---|
| 12 | Q:'BEGIN
|
---|
| 13 | ;
|
---|
| 14 | S IDX="^TMP(""HLEM"",$J,""STATISTICS"")"
|
---|
| 15 | K @IDX
|
---|
| 16 | D WAIT^DICD
|
---|
| 17 | D EN^VALM("HLEM DISPLAY STATISTICS")
|
---|
| 18 | ;
|
---|
| 19 | K @IDX
|
---|
| 20 | Q
|
---|
| 21 | ;
|
---|
| 22 | ;
|
---|
| 23 | HDR ;Header code
|
---|
| 24 | S VALMHDR(1)="Year Month Day Hour Event Count"
|
---|
| 25 | Q
|
---|
| 26 | ;
|
---|
| 27 | INIT ;Init variables and list array
|
---|
| 28 | N ARY
|
---|
| 29 | S ARY="^TMP($J,""HLSTATS"")"
|
---|
| 30 | S VALMSG="USER PROFILE: "_$G(PROFILE("NAME"))_" STARTING: "_$$FMTE^XLFDT(BEGIN)
|
---|
| 31 | D SETUP(BEGIN,ARY,.PROFILE)
|
---|
| 32 | D DISPLAY(ARY,IDX)
|
---|
| 33 | K @ARY
|
---|
| 34 | D HDR
|
---|
| 35 | S VALMBCK="R"
|
---|
| 36 | Q
|
---|
| 37 | ;
|
---|
| 38 | SETUP(START,ARY,PROFILE) ;
|
---|
| 39 | ;sets up a work array with the required statistics
|
---|
| 40 | ;START is the starting date
|
---|
| 41 | ;
|
---|
| 42 | N SITE,TYPE,IDX
|
---|
| 43 | K @ARY
|
---|
| 44 | S SITE=0
|
---|
| 45 | S START("YEAR")=1700+(+$E(START,1,3)),START("MONTH")=+$E(START,4,5),START("DAY")=+$E(START,6,7),START("HOUR")=$E($P(START,".",2),1,2)
|
---|
| 46 | S IDX="^HLEV(776.4,""AF"")"
|
---|
| 47 | F S SITE=$O(@IDX@(SITE)) Q:'SITE D:$G(PROFILE("ALL SITES"))!$D(PROFILE("SITES",SITE))
|
---|
| 48 | .S SITE("NAME")=$$STATION^HLEMSU(SITE)
|
---|
| 49 | .Q:'$L(SITE("NAME"))
|
---|
| 50 | .S $P(SITE("NAME"),"^",3)=SITE
|
---|
| 51 | .S TYPE=0
|
---|
| 52 | .F S TYPE=$O(@IDX@(SITE,TYPE)) Q:'TYPE D:PROFILE("ALL TYPES")!$D(PROFILE("TYPES",TYPE))
|
---|
| 53 | ..S TYPE("NAME")=$$CODE^HLEMT(TYPE)
|
---|
| 54 | ..S:(+TYPE("NAME")=TYPE("NAME")) TYPE("NAME")=$E($P($G(^HLEV(776.3,TYPE,4)),"^"),1,40)
|
---|
| 55 | ..Q:'$L(TYPE("NAME"))
|
---|
| 56 | ..N IDX S IDX="^HLEV(776.4,""AF"",SITE,TYPE,""RECEIVED"")"
|
---|
| 57 | ..D YEAR(.SITE,.TYPE,.START)
|
---|
| 58 | Q
|
---|
| 59 | ;
|
---|
| 60 | YEAR(SITE,TYPE,START) ;
|
---|
| 61 | N YEAR
|
---|
| 62 | S YEAR=START("YEAR")-1
|
---|
| 63 | F S YEAR=$O(@IDX@("YEAR",YEAR)) Q:'YEAR D:(YEAR'<START("YEAR"))
|
---|
| 64 | .D:(YEAR>START("YEAR"))
|
---|
| 65 | ..S @ARY@(SITE("NAME"),YEAR)=$G(@ARY@(SITE("NAME"),YEAR))+$G(@IDX@("YEAR",YEAR))
|
---|
| 66 | ..S @ARY@(SITE("NAME"),YEAR,"TYPE",TYPE("NAME"))=$G(@ARY@(SITE("NAME"),YEAR,"TYPE",TYPE("NAME")))+$G(@IDX@("YEAR",YEAR))
|
---|
| 67 | .D MONTH(.SITE,.TYPE,.START,YEAR)
|
---|
| 68 | Q
|
---|
| 69 | ;
|
---|
| 70 | MONTH(SITE,TYPE,START,YEAR) ;
|
---|
| 71 | N MONTH
|
---|
| 72 | S MONTH=START("MONTH")-1
|
---|
| 73 | F S MONTH=$O(@IDX@("YEAR",YEAR,"MONTH",MONTH)) Q:'MONTH D:(YEAR>START("YEAR"))!(YEAR=START("YEAR")&(MONTH'<START("MONTH")))
|
---|
| 74 | .D:(MONTH>START("MONTH"))!(YEAR>START("YEAR"))
|
---|
| 75 | ..S @ARY@(SITE("NAME"),YEAR,MONTH)=$G(@ARY@(SITE("NAME"),YEAR,MONTH))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH))
|
---|
| 76 | ..S @ARY@(SITE("NAME"),YEAR,MONTH,"TYPE",TYPE("NAME"))=$G(@ARY@(SITE("NAME"),YEAR,MONTH,"TYPE",TYPE("NAME")))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH))
|
---|
| 77 | .D DAY(.SITE,.TYPE,.START,YEAR,MONTH)
|
---|
| 78 | Q
|
---|
| 79 | ;
|
---|
| 80 | DAY(SITE,TYPE,START,YEAR,MONTH) ;
|
---|
| 81 | N DAY
|
---|
| 82 | S DAY=0
|
---|
| 83 | F S DAY=$O(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY)) Q:'DAY Q:START>((YEAR-1700)_$$RJ^XLFSTR(MONTH,2,"0")_$$RJ^XLFSTR(DAY,2,"0")) D
|
---|
| 84 | .S @ARY@(SITE("NAME"),YEAR,MONTH,DAY)=$G(@ARY@(SITE("NAME"),YEAR,MONTH,DAY))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY))
|
---|
| 85 | .S @ARY@(SITE("NAME"),YEAR,MONTH,DAY,"TYPE",TYPE("NAME"))=$G(@ARY@(SITE("NAME"),YEAR,MONTH,DAY,"TYPE",TYPE("NAME")))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY))
|
---|
| 86 | .D HOUR(.SITE,.TYPE,.START,YEAR,MONTH,DAY)
|
---|
| 87 | Q
|
---|
| 88 | ;
|
---|
| 89 | HOUR(SITE,TYPE,START,YEAR,MONTH,DAY) ;
|
---|
| 90 | N HOUR
|
---|
| 91 | S HOUR=""
|
---|
| 92 | F S HOUR=$O(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY,"HOUR",HOUR)) Q:(HOUR="") D:(HOUR'<START("HOUR"))
|
---|
| 93 | .S @ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR)=$G(@ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY,"HOUR",HOUR))
|
---|
| 94 | .S @ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR,"TYPE",TYPE("NAME"))=$G(@ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR,"TYPE",TYPE("NAME")))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY,"HOUR",HOUR))
|
---|
| 95 | Q
|
---|
| 96 | ;
|
---|
| 97 | DISPLAY(ARY,IDX) ;Build event statistics screen
|
---|
| 98 | N YEAR,SITE
|
---|
| 99 | D CLEAN^VALM10
|
---|
| 100 | K @IDX,VALMHDR
|
---|
| 101 | S VALMBG=1,VALMCNT=0
|
---|
| 102 | ;
|
---|
| 103 | S SITE=""
|
---|
| 104 | I '$O(@ARY@(SITE)),$$SET^HLEMSU(1,"There are no statistics for this profile and date range!",10,"H")
|
---|
| 105 | E F S SITE=$O(@ARY@(SITE)) Q:(SITE="") D
|
---|
| 106 | .I VALMCNT,$$SET^HLEMSU(VALMCNT,$G(@IDX@(VALMCNT,0)),1,"U")
|
---|
| 107 | .S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($P(SITE,"^"),30)_$$LJ^XLFSTR("Station #: "_$P(SITE,"^",2),50),1,"H")
|
---|
| 108 | .S @IDX@("SITE",$P(SITE,"^"))=VALMCNT
|
---|
| 109 | .S @IDX@("SITE",$P(SITE,"^",3))=VALMCNT
|
---|
| 110 | .S YEAR=";"
|
---|
| 111 | .F S YEAR=$O(@ARY@(SITE,YEAR),-1) Q:'YEAR D DYEAR(ARY,IDX,SITE,YEAR)
|
---|
| 112 | ;Build header
|
---|
| 113 | D HDR
|
---|
| 114 | Q
|
---|
| 115 | ;
|
---|
| 116 | DYEAR(ARY,IDX,SITE,YEAR) ;
|
---|
| 117 | N EVENT,MONTH
|
---|
| 118 | S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(YEAR,71)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR)),20),1)
|
---|
| 119 | S EVENT=""
|
---|
| 120 | F S EVENT=$O(@ARY@(SITE,YEAR,"TYPE",EVENT)) Q:EVENT="" D
|
---|
| 121 | .S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,"TYPE",EVENT)),20),32)
|
---|
| 122 | S MONTH=";"
|
---|
| 123 | F S MONTH=$O(@ARY@(SITE,YEAR,MONTH),-1) Q:(MONTH="") D
|
---|
| 124 | .D DMONTH(ARY,IDX,SITE,YEAR,MONTH)
|
---|
| 125 | Q
|
---|
| 126 | ;
|
---|
| 127 | DMONTH(ARY,IDX,SITE,YEAR,MONTH) ;
|
---|
| 128 | N EVENT,DAY
|
---|
| 129 | S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($$MONTHTXT(MONTH),64)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH)),20),8)
|
---|
| 130 | S EVENT=""
|
---|
| 131 | F S EVENT=$O(@ARY@(SITE,YEAR,MONTH,"TYPE",EVENT)) Q:EVENT="" D
|
---|
| 132 | .S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,"TYPE",EVENT)),20),32)
|
---|
| 133 | S DAY=";"
|
---|
| 134 | F S DAY=$O(@ARY@(SITE,YEAR,MONTH,DAY),-1) D Q:'DAY
|
---|
| 135 | .D:DAY DDAY(ARY,IDX,SITE,YEAR,MONTH,DAY)
|
---|
| 136 | Q
|
---|
| 137 | ;
|
---|
| 138 | DDAY(ARY,IDX,SITE,YEAR,MONTH,DAY) ;
|
---|
| 139 | N EVENT,HOUR
|
---|
| 140 | S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($$DAYTXT(DAY),54)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,DAY)),20),18)
|
---|
| 141 | S EVENT=""
|
---|
| 142 | F S EVENT=$O(@ARY@(SITE,YEAR,MONTH,DAY,"TYPE",EVENT)) Q:EVENT="" D
|
---|
| 143 | .S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,DAY,"TYPE",EVENT)),20),32)
|
---|
| 144 | S HOUR=";"
|
---|
| 145 | F S HOUR=$O(@ARY@(SITE,YEAR,MONTH,DAY,HOUR),-1) Q:'HOUR D DHOUR(ARY,IDX,SITE,YEAR,MONTH,DAY,HOUR)
|
---|
| 146 | Q
|
---|
| 147 | ;
|
---|
| 148 | DHOUR(ARY,IDX,SITE,YEAR,MONTH,DAY,HOUR) ;
|
---|
| 149 | N EVENT
|
---|
| 150 | S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($$HOURTXT(HOUR),48)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,DAY,HOUR)),20),24)
|
---|
| 151 | S EVENT=""
|
---|
| 152 | F S EVENT=$O(@ARY@(SITE,YEAR,MONTH,DAY,HOUR,"TYPE",EVENT)) Q:EVENT="" D
|
---|
| 153 | .S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,DAY,HOUR,"TYPE",EVENT)),20),32)
|
---|
| 154 | Q
|
---|
| 155 | ;
|
---|
| 156 | HELP ;Help code
|
---|
| 157 | S X="?" D DISP^XQORM1 W !!
|
---|
| 158 | Q
|
---|
| 159 | ;
|
---|
| 160 | EXIT ;Exit code
|
---|
| 161 | D CLEAN^VALM10
|
---|
| 162 | D CLEAR^VALM1
|
---|
| 163 | K @IDX
|
---|
| 164 | Q
|
---|
| 165 | ;
|
---|
| 166 | EXPND ;Expand code
|
---|
| 167 | Q
|
---|
| 168 | ;
|
---|
| 169 | X(FIELD,VALUE) ;
|
---|
| 170 | ;changes a field value in file 774.4 to external form
|
---|
| 171 | Q $$EXTERNAL^DILFD(776.4,FIELD,"F",VALUE)
|
---|
| 172 | ;
|
---|
| 173 | ASKBEGIN(DEFAULT) ;
|
---|
| 174 | ;Description: Asks the user to enter a beginning date.
|
---|
| 175 | ;Input: DEFAULT - the suggested default dt/time (optional)
|
---|
| 176 | ;Output: Returns the date as the function value, or 0 if the user does n to select a date
|
---|
| 177 | ;
|
---|
| 178 | N DIR,X,Y
|
---|
| 179 | S DIR(0)="D^::TX"
|
---|
| 180 | S DIR("A")="Enter the begining date"
|
---|
| 181 | S DIR("B")=$$FMTE^XLFDT($S($G(DEFAULT):DEFAULT,1:$$FMADD^XLFDT(DT,-1)))
|
---|
| 182 | S DIR("?")="Please enter the earliest date for which you would like to see Event Logging Statistics."
|
---|
| 183 | D ^DIR
|
---|
| 184 | Q:$D(DIRUT) 0
|
---|
| 185 | Q Y
|
---|
| 186 | ;
|
---|
| 187 | MONTHTXT(M) ;
|
---|
| 188 | ;Given the month as a number 1-12, returns the name
|
---|
| 189 | Q $S(M=1:"January",M=2:"February",M=3:"March",M=4:"April",M=5:"May",M=6:"June",M=7:"July",M=8:"August",M=9:"September",M=10:"October",M=11:"November",M=12:"December",1:"Unknown")
|
---|
| 190 | ;
|
---|
| 191 | DAYTXT(D) ;
|
---|
| 192 | ;Given the day as a number, returns the day also as a number, but with
|
---|
| 193 | ;a suffix of either "st","nd","rd","th"
|
---|
| 194 | I D>9,D<20 Q D_"th"
|
---|
| 195 | N DIGIT
|
---|
| 196 | S DIGIT=$E(D,$L(D))
|
---|
| 197 | Q D_$S(DIGIT=1:"st",DIGIT=2:"nd",DIGIT=3:"rd",1:"th")
|
---|
| 198 | ;
|
---|
| 199 | HOURTXT(H) ;
|
---|
| 200 | I H<12 Q H_"am"
|
---|
| 201 | I H=12 Q "12N"
|
---|
| 202 | I H>12 Q (H-12)_"pm"
|
---|
| 203 | Q
|
---|
| 204 | ;
|
---|
| 205 | SELECT ;Allows the user to change profiles, then rebuilds the Event Log Statistics screen
|
---|
| 206 | N PROF,ASKBEGIN
|
---|
| 207 | D FULL^VALM1
|
---|
| 208 | S PROF=$$SELECT^HLEMP1($G(DUZ),20)
|
---|
| 209 | I PROF,PROF'=$G(PROFILE) D
|
---|
| 210 | .S ASKBEGIN=$$ASKBEGIN($G(BEGIN))
|
---|
| 211 | .S:ASKBEGIN BEGIN=ASKBEGIN
|
---|
| 212 | .S PROFILE=$$GET^HLEMP(PROF,.PROFILE)
|
---|
| 213 | .D INIT^HLEMST
|
---|
| 214 | S VALMBCK="R"
|
---|
| 215 | Q
|
---|
| 216 | ;
|
---|
| 217 | CHNGDATE ;Allows the user to change the starting date, then rebuilds the Event Log Statistics screen
|
---|
| 218 | N ASKBEGIN
|
---|
| 219 | S ASKBEGIN=$$ASKBEGIN($G(BEGIN))
|
---|
| 220 | I ASKBEGIN D
|
---|
| 221 | .S BEGIN=ASKBEGIN
|
---|
| 222 | .D INIT^HLEMST
|
---|
| 223 | S VALMBCK="R"
|
---|
| 224 | Q
|
---|