1 | HLOESTAT ;ALB/CJM- HLO ERROR STATISTICS- 10/4/94 1pm ;03/12/2007
|
---|
2 | ;;1.6;HEALTH LEVEL SEVEN;**134**;Oct 13, 1995;Build 30
|
---|
3 | ;Per VHA Directive 2004-038, this routine should not be modified.
|
---|
4 | ;
|
---|
5 | ;
|
---|
6 | COUNT(DIR,RAP,SAP,MSGTYPE,EVENT) ;
|
---|
7 | ;DIR="IN" or "OUT", the "E" appended to diferentiate error stats
|
---|
8 | N TYPE
|
---|
9 | S:RAP="" RAP="UNKNOWN"
|
---|
10 | S:SAP="" SAP="UNKNOWN"
|
---|
11 | S TYPE=$G(MSGTYPE)
|
---|
12 | I $L($G(EVENT)) S TYPE=TYPE_"~"_$G(EVENT)
|
---|
13 | S:$L(TYPE)<2 TYPE="UNKNOWN"
|
---|
14 | I $$INC^HLOSITE($NA(^HLSTATS("E"_DIR,"HOURLY",+$E($$NOW^XLFDT,1,10),SAP,RAP,TYPE)))
|
---|
15 | Q
|
---|
16 | ;
|
---|
17 | REPORT ;Interactive option for printing the message error statistics report
|
---|
18 | N DIR,TYPE,START,END
|
---|
19 | W !,"Hourly, daily, and monthly error statistics are maintained."
|
---|
20 | W !,"Hourly statistics are available for approximately the last 24 hours."
|
---|
21 | W !,"Daily statistics are available for approximately the last 30 days."
|
---|
22 | W !,"Monthly statistics are kept indefinitely"
|
---|
23 | S DIR(0)="S^h:HOURLY;d:DAILY;m:MONTHLY"
|
---|
24 | S DIR("A")="Which type of error statistics should be reported"
|
---|
25 | S DIR("B")="MONTHLY"
|
---|
26 | D ^DIR
|
---|
27 | Q:$D(DIRUT)
|
---|
28 | I Y'="h",Y'="d",Y'="m" Q
|
---|
29 | S TYPE=$S(Y="h":"HOURLY",Y="d":"DAILY",1:"MONTHLY")
|
---|
30 | S START=$S(TYPE="HOURLY":$E($$FMADD^XLFDT($$NOW^XLFDT,,-24),1,10),TYPE="DAILY":$$FMADD^XLFDT(DT,-7),1:$E($$FMADD^XLFDT(DT,-30),1,5)_"01")
|
---|
31 | S START=$$ASKBEGIN^HLOUSR2(START)
|
---|
32 | Q:'START
|
---|
33 | S END=$$ASKEND^HLOUSR2(START)
|
---|
34 | Q:'END
|
---|
35 | S:TYPE="MONTHLY" START=$E(START,1,5)_"00"
|
---|
36 | S:TYPE="DAILY" START=$E(START,1,7)
|
---|
37 | S:TYPE="HOURLY" START=$E(START,1,10)
|
---|
38 | D:$$DEVICE() PRINT(TYPE,START,END)
|
---|
39 | Q
|
---|
40 | ;
|
---|
41 | QUE ;entry point for queuing the message statistics report
|
---|
42 | D PRINT($G(HLOPARMS("STATISTICS TYPE")),$G(HLOPARMS("START DT/TM")),$G(HLOPARMS("END DT/TM")))
|
---|
43 | Q
|
---|
44 | ;
|
---|
45 | PRINT(STATTYPE,START,END) ;
|
---|
46 | ;
|
---|
47 | N RAP,SAP,TIME,DIR,COUNT,PAGE,CRT,QUIT
|
---|
48 | S QUIT=0
|
---|
49 | S CRT=$S($E(IOST,1,2)="C-":1,1:0)
|
---|
50 | ;
|
---|
51 | U IO
|
---|
52 | W:CRT @IOF
|
---|
53 | W "HLO MESSAGE ERROR STATISTICS REPORT ",$$FMTE^XLFDT($$NOW^XLFDT),?70,"Page 1"
|
---|
54 | D LINE($$LJ("Type:",15)_STATTYPE)
|
---|
55 | D LINE($$LJ("Beginning:",15)_$S(STATTYPE="MONTHLY":$$FMTE^XLFDT(START),1:$$FMTE^XLFDT(START)))
|
---|
56 | D LINE($$LJ("Ending:",15)_$$FMTE^XLFDT(END))
|
---|
57 | S PAGE=1
|
---|
58 | ;
|
---|
59 | ;
|
---|
60 | F DIR="EIN","EOUT" D Q:QUIT
|
---|
61 | .N TOTAL
|
---|
62 | .S TOTAL=0
|
---|
63 | .D LINE(" ")
|
---|
64 | .S TIME=START
|
---|
65 | .S:STATTYPE="MONTHLY" TIME=$E(TIME,1,5)
|
---|
66 | .S TIME=TIME-.0001
|
---|
67 | .D LINE($S(DIR="EIN":"INCOMING MESSAGES:",1:"OUTGOING MESSAGES:"))
|
---|
68 | .Q:QUIT
|
---|
69 | .F S TIME=$O(^HLSTATS(DIR,STATTYPE,TIME)) Q:((TIME>$G(END))&$G(END)) Q:'TIME D Q:QUIT
|
---|
70 | ..N SUBTOTAL
|
---|
71 | ..S SUBTOTAL=0
|
---|
72 | ..D LINE(" ")
|
---|
73 | ..Q:QUIT
|
---|
74 | ..D LINE(" Time Period: "_$S(STATTYPE="MONTHLY":$$FMTE^XLFDT(TIME_"00"),1:$$FMTE^XLFDT(TIME)))
|
---|
75 | ..Q:QUIT
|
---|
76 | ..S SAP=""
|
---|
77 | ..F S SAP=$O(^HLSTATS(DIR,STATTYPE,TIME,SAP)) Q:SAP="" D Q:QUIT
|
---|
78 | ...D LINE(" Sending Application: "_SAP)
|
---|
79 | ...Q:QUIT
|
---|
80 | ...S RAP=""
|
---|
81 | ...F S RAP=$O(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP)) Q:RAP="" D Q:QUIT
|
---|
82 | ....D LINE(" Receiving Application: "_RAP)
|
---|
83 | ....Q:QUIT
|
---|
84 | ....S TYPE=""
|
---|
85 | ....F S TYPE=$O(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP,TYPE)) Q:TYPE="" D Q:QUIT
|
---|
86 | .....S COUNT=$G(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP,TYPE))
|
---|
87 | .....S SUBTOTAL=SUBTOTAL+COUNT
|
---|
88 | .....D LINE(" Message Type: "_$$LJ(TYPE,25)_" Count:"_$$RJ(COUNT,10))
|
---|
89 | .....Q:QUIT
|
---|
90 | ..I 'QUIT D
|
---|
91 | ...S TOTAL=TOTAL+SUBTOTAL
|
---|
92 | ...D LINE(" "),LINE($$RJ("**"_STATTYPE_" SUBTOTAL: ",68)_$$RJ(SUBTOTAL,10))
|
---|
93 | .D:'QUIT LINE(" "),LINE($$RJ("** TOTAL "_$S(DIR="EIN":"INCOMING",1:"OUTGOING")_" MESSAGE ERRORS: ",68)_$$RJ(TOTAL,10))
|
---|
94 | I CRT,'QUIT D PAUSE2
|
---|
95 | I $D(ZTQUEUED) S ZTREQ="@"
|
---|
96 | D ^%ZISC
|
---|
97 | Q
|
---|
98 | ;
|
---|
99 | DEVICE() ;
|
---|
100 | ;Description: allows the user to select a device.
|
---|
101 | ;Input: none
|
---|
102 | ;
|
---|
103 | ;Output:
|
---|
104 | ; Function Value - Returns 0 if the user decides not to print or to
|
---|
105 | ; queue the report, 1 otherwise.
|
---|
106 | ;
|
---|
107 | N OK,HLOPARMS
|
---|
108 | S OK=1
|
---|
109 | S %ZIS="MQ"
|
---|
110 | D ^%ZIS
|
---|
111 | S:POP OK=0
|
---|
112 | D:OK&$D(IO("Q"))
|
---|
113 | .S HLOPARMS("STATISTICS TYPE")=TYPE,HLOPARMS("START DT/TM")=START,HLOPARMS("END DT/TM")=END
|
---|
114 | .S ZTRTN="QUE^HLOESTAT",ZTDESC="HLO ERROR STATISTICS REPORT",ZTSAVE("HLOPARMS(")=""
|
---|
115 | .D ^%ZTLOAD
|
---|
116 | .W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
|
---|
117 | .D HOME^%ZIS
|
---|
118 | .S OK=0
|
---|
119 | Q OK
|
---|
120 | ;
|
---|
121 | PAUSE ;
|
---|
122 | ;First scrolls to the bottome of the page, then does a screen pause. Sets QUIT=1 if user decides to quit.
|
---|
123 | ;
|
---|
124 | N DIR,X,Y
|
---|
125 | F Q:$Y>(IOSL-3) W !
|
---|
126 | S DIR(0)="E"
|
---|
127 | D ^DIR
|
---|
128 | I ('(+Y))!$D(DIRUT) S QUIT=1
|
---|
129 | Q
|
---|
130 | PAUSE2 ;
|
---|
131 | ;Screen pause without scrolling. Sets QUIT=1 if user decides to quit.
|
---|
132 | ;
|
---|
133 | N DIR,X,Y
|
---|
134 | S DIR(0)="E"
|
---|
135 | D ^DIR
|
---|
136 | I ('(+Y))!$D(DIRUT) S QUIT=1
|
---|
137 | Q
|
---|
138 | ;
|
---|
139 | LINE(LINE) ;Prints a line.
|
---|
140 | ;
|
---|
141 | I CRT,($Y>(IOSL-4)) D
|
---|
142 | .D PAUSE
|
---|
143 | .Q:QUIT
|
---|
144 | .W @IOF
|
---|
145 | .W LINE
|
---|
146 | ;
|
---|
147 | E I ('CRT),($Y>(IOSL-2)) D
|
---|
148 | .W @IOF
|
---|
149 | .W ?70,"Page: ",PAGE
|
---|
150 | .S PAGE=PAGE+1
|
---|
151 | .W LINE
|
---|
152 | ;
|
---|
153 | E W !,LINE
|
---|
154 | Q
|
---|
155 | ;
|
---|
156 | LJ(STRING,LEN) ;
|
---|
157 | Q $$LJ^XLFSTR($E(STRING,1,LEN),LEN)
|
---|
158 | RJ(STRING,LEN) ;
|
---|
159 | Q $$RJ^XLFSTR($E(STRING,1,LEN),LEN)
|
---|