Index trunk oms_sk src _qresult 4gl --- trunk oms_sk src _qresult 4gl

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
Index: /trunk/oms_sk/src/_qresult.4gl
===================================================================
--- /trunk/oms_sk/src/_qresult.4gl (revision 546)
+++ /trunk/oms_sk/src/_qresult.4gl (revision 547)
@@ -5782,2 +5782,275 @@
+---------------------------------------------------+-----------------+-----------------+-----------------+-----------------+
}
+
+#
+# ReportReestrPG - Отчет "Результаты медико-экономического контроля" по правам граждан
+#
+FUNCTION ReportReestrPG()
+DEFINE i,j INTEGER
+ ,tmp_str CHAR(300)
+ ,sss CHAR(1000)
+ ,doc_count INTEGER
+ ,p__exit SMALLINT
+ ,rp_file CHAR(500)
+ ,cnt INTEGER
+ ,row_code INTEGER
+ ,col_code INTEGER
+ ,prev_row INTEGER
+ ,s_acc_cnt INTEGER
+ ,p_acc_cnt INTEGER
+ ,d_acc_cnt INTEGER
+ ,s_cnts ARRAY [10] OF INTEGER
+ ,p_cnts ARRAY [10] OF INTEGER
+ ,d_cnts ARRAY [10] OF INTEGER
+
+
+ LET doc_count = InputAnyPeriodDate("Результаты МЭ-контроля")
+ IF doc_count > 0 THEN
+ ELSE
+ RETURN
+ END IF
+
+ LET rp_file = SetReportFName()
+ START REPORT RptReestrPG TO rp_file
+ CALL InitProgressBar("Получение результатов медико-экономического контроля", doc_count*10)
+ LET i = 0
+ LET p__exit = FALSE
+
+ # Считаем количество предъявленных к оплате счетов.
+ # Если бы не было разбивки по поликл/стац/дневн.стац,
+ # то можно было бы просто сделать count(*).
+ # Так что поступаем так: если в поданном счете есть,
+ # скажем, услуги и стационара, и поликлиники, а дневного нет,
+ # то этот акт считаем "один в поликлинику" и "один в стационар".
+ # Т.е. один и тот же акт фигурирует в разных колонках
+
+ LET p_acc_cnt = 0
+ LET s_acc_cnt = 0
+ LET d_acc_cnt = 0
+
+ # пункт 1
+ LET sss = "SELECT COUNT(h.aitog_id), r.code_out ",
+ " FROM aitog_header AS h",
+ " JOIN aitog_data AS d ON d.aitog_id = h.aitog_id ",
+ " JOIN recode_all AS r ON (r.na_me = 'pfroms_mp' AND ",
+ " r.code_in = d.mprofil_cod) ",
+ " WHERE h.pay_date BETWEEN '", date_begin, "' AND '", date_end, "' ",
+ ### DEBUG
+ # " AND h.lpu_id = 303 ",
+ " GROUP BY 2 "
+
+ PREPARE d_1028a FROM sss
+ DECLARE d_1028b CURSOR FOR d_1028a
+
+ FOREACH d_1028b INTO cnt, col_code
+ LET i = i + 1
+ IF col_code = 1 THEN
+ # поликлиника
+ LET p_acc_cnt = cnt
+ ELSE
+ IF col_code = 2 THEN
+ # стационар
+ LET s_acc_cnt = cnt
+ ELSE
+ IF col_code = 3 THEN
+ # дневной стационар
+ LET d_acc_cnt = cnt
+ ELSE
+ # неизвестно что
+ ERROR "Неизвестный код столбца ", col_code USING "<<<"
+ END IF
+ END IF
+ END IF
+ CALL SetProgressBar(i)
+ END FOREACH
+
+
+ # пункт 2
+ LET sss = "SELECT rd.code_out, rt.code_out, count(*) ",
+ " FROM diags AS d ",
+ " JOIN service AS s ON s.serv_id = d.serv_id ",
+ " JOIN rheader AS r ON r.ree_id = s.ree_id ",
+ " JOIN aitog_header AS a ON a.aitog_id = r.aitog_id ",
+ " JOIN recode_all AS rt ON (rt.na_me = 'pfroms_mp' AND rt.code_in = d.mprofil_cod) ",
+ " JOIN recode_all AS rd ON (rd.na_me = 'pg_rows' AND rd.code_in = s.dsc_cod) ",
+ " WHERE ",
+ " a.pay_date BETWEEN '", date_begin, "' AND '", date_end, "' ",
+ ##### DEBUG
+ # " AND a.lpu_id = 303 ",
+ " GROUP BY 1,2 ORDER BY 1,2"
+
+ PREPARE d_1028c FROM sss
+ DECLARE d_1028d CURSOR FOR d_1028c
+
+ FOR j = 0 TO 9
+ LET p_cnts[j] = 0
+ LET s_cnts[j] = 0
+ LET d_cnts[j] = 0
+ END FOR
+
+ FOREACH d_1028d INTO row_code, col_code, cnt
+ LET i = i + 1
+ LET j = row_code - 21 # индекс строки в массиве -- код строки - 21
+ IF col_code = 1 THEN
+ # поликлиника
+ LET p_cnts[j] = cnt
+ ELSE
+ IF col_code = 2 THEN
+ # стационар
+ LET s_cnts[j] = cnt
+ ELSE
+ IF col_code = 3 THEN
+ # дневной стационар
+ LET d_cnts[j] = cnt
+ ELSE
+ # неизвестно что
+ ERROR "Неизвестный код столбца ", col_code USING "<<<"
+ END IF
+ END IF
+ END IF
+ CALL SetProgressBar(i)
+ END FOREACH
+ OUTPUT TO REPORT RptReestrPG(p_acc_cnt, s_acc_cnt, d_acc_cnt,
+ p_cnts[0], p_cnts[1], p_cnts[2], p_cnts[3], p_cnts[4], p_cnts[5], p_cnts[6], p_cnts[7], p_cnts[8], p_cnts[9],
+ s_cnts[0], s_cnts[1], s_cnts[2], s_cnts[3], s_cnts[4], s_cnts[5], s_cnts[6], s_cnts[7], s_cnts[8], s_cnts[9],
+ d_cnts[0], d_cnts[1], d_cnts[2], d_cnts[3], d_cnts[4], d_cnts[5], d_cnts[6], d_cnts[7], d_cnts[8], d_cnts[9]
+ )
+ FINISH REPORT RptReestrPG
+ CALL DoneProgressBar()
+ IF NOT p__exit THEN
+ LET tmp_str = "Результаты МЭ-контроля"
+ CALL AddReportInfo(tmp_str, DatePeriodStr(), rp_file)
+ CALL OutReport(tmp_str, rp_file)
+ END IF
+
+END FUNCTION
+
+#
+# RptReestrPG - Отчет-печаталка отчета по правам граждан
+#
+REPORT RptReestrPG(p_acc_cnt, s_acc_cnt, d_acc_cnt,
+ p_cnt1, p_cnt2, p_cnt3, p_cnt4, p_cnt5, p_cnt6, p_cnt7, p_cnt8, p_cnt9, p_cnt10,
+ s_cnt1, s_cnt2, s_cnt3, s_cnt4, s_cnt5, s_cnt6, s_cnt7, s_cnt8, s_cnt9, s_cnt10,
+ d_cnt1, d_cnt2, d_cnt3, d_cnt4, d_cnt5, d_cnt6, d_cnt7, d_cnt8, d_cnt9, d_cnt10)
+
+DEFINE i,j INTEGER
+ ,end_flag SMALLINT
+ ,n_pp INTEGER
+ ,p_acc_cnt INTEGER
+ ,s_acc_cnt INTEGER
+ ,d_acc_cnt INTEGER
+ ,tmp_str CHAR(100)
+ ,p_cnt1, p_cnt2, p_cnt3, p_cnt4, p_cnt5, p_cnt6, p_cnt7, p_cnt8, p_cnt9, p_cnt10
+ ,s_cnt1, s_cnt2, s_cnt3, s_cnt4, s_cnt5, s_cnt6, s_cnt7, s_cnt8, s_cnt9, s_cnt10
+ ,d_cnt1, d_cnt2, d_cnt3, d_cnt4, d_cnt5, d_cnt6, d_cnt7, d_cnt8, d_cnt9, d_cnt10 INTEGER
+ ,p_cnt_sum INTEGER
+ ,s_cnt_sum INTEGER
+ ,d_cnt_sum INTEGER
+
+ OUTPUT
+ LEFT MARGIN 0
+ TOP MARGIN 0
+ BOTTOM MARGIN 0
+ PAGE LENGTH 75
+
+ FORMAT
+ FIRST PAGE HEADER
+ LET end_flag = FALSE
+ PRINT InitPrinter17(), InitPrinter8Lines()
+ PRINT "Результаты медико-экономического контроля за ", DatePeriodStr(), " (", sux.ree_type CLIPPED, ")"
+ PRINT
+ PRINT "+--------------------------------------------------------------------------------+"
+ PRINT "| № | Поликлиника | Стационар | Дн. стац. | Всего |"
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 1. Количество актов ",
+ " | ", p_acc_cnt USING "############",
+ " | ", s_acc_cnt USING "############",
+ " | ", d_acc_cnt USING "###########",
+ " | ", p_acc_cnt + s_acc_cnt + d_acc_cnt USING "###########",
+ " |"
+
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2. Всего нарушений ",
+ " | ", p_cnt1+p_cnt2+p_cnt3+p_cnt4+p_cnt5+p_cnt6+p_cnt7+p_cnt8+p_cnt9+p_cnt10 USING "###########&",
+ " | ", s_cnt1+s_cnt2+s_cnt3+s_cnt4+s_cnt5+s_cnt6+s_cnt7+s_cnt8+s_cnt9+s_cnt10 USING "############",
+ " | ", d_cnt1+d_cnt2+d_cnt3+d_cnt4+d_cnt5+d_cnt6+d_cnt7+d_cnt8+d_cnt9+d_cnt10 USING "###########",
+ " | ", p_cnt1+p_cnt2+p_cnt3+p_cnt4+p_cnt5+p_cnt6+p_cnt7+p_cnt8+p_cnt9+p_cnt10+
+ s_cnt1+s_cnt2+s_cnt3+s_cnt4+s_cnt5+s_cnt6+s_cnt7+s_cnt8+s_cnt9+s_cnt10+
+ d_cnt1+d_cnt2+d_cnt3+d_cnt4+d_cnt5+d_cnt6+d_cnt7+d_cnt8+d_cnt9+d_cnt10 USING "###########",
+ " | "
+
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2.1 ",
+ " | ", p_cnt1 USING "###########&",
+ " | ", s_cnt1 USING "############",
+ " | ", d_cnt1 USING "###########",
+ " | ", p_cnt1 + s_cnt1 + d_cnt1 USING "###########",
+ " | "
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2.2 ",
+ " | ", p_cnt2 USING "###########&",
+ " | ", s_cnt2 USING "############",
+ " | ", d_cnt2 USING "###########",
+ " | ", p_cnt2 + s_cnt2 + d_cnt2 USING "###########",
+ " | "
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2.3 ",
+ " | ", p_cnt3 USING "###########&",
+ " | ", s_cnt3 USING "############",
+ " | ", d_cnt3 USING "###########",
+ " | ", p_cnt3 + s_cnt3 + d_cnt3 USING "###########",
+ " | "
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2.4 ",
+ " | ", p_cnt4 USING "###########&",
+ " | ", s_cnt4 USING "############",
+ " | ", d_cnt4 USING "###########",
+ " | ", p_cnt4 + s_cnt4 + d_cnt4 USING "###########",
+ " | "
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2.5 ",
+ " | ", p_cnt5 USING "###########&",
+ " | ", s_cnt5 USING "############",
+ " | ", d_cnt5 USING "###########",
+ " | ", p_cnt5 + s_cnt5 + d_cnt5 USING "###########",
+ " | "
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2.6 ",
+ " | ", p_cnt6 USING "###########&",
+ " | ", s_cnt6 USING "############",
+ " | ", d_cnt6 USING "###########",
+ " | ", p_cnt6 + s_cnt6 + d_cnt6 USING "###########",
+ " | "
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2.7 ",
+ " | ", p_cnt7 USING "###########&",
+ " | ", s_cnt7 USING "############",
+ " | ", d_cnt7 USING "###########",
+ " | ", p_cnt7 + s_cnt7 + d_cnt7 USING "###########",
+ " | "
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2.8 ",
+ " | ", p_cnt8 USING "###########&",
+ " | ", s_cnt8 USING "############",
+ " | ", d_cnt8 USING "###########",
+ " | ", p_cnt8 + s_cnt8 + d_cnt8 USING "###########",
+ " | "
+ PRINT "|----------------------|--------------|--------------|-------------|-------------|"
+ PRINT "| 2.9 ",
+ " | ", p_cnt9 USING "###########&",
+ " | ", s_cnt9 USING "############",
+ " | ", d_cnt9 USING "###########",
+ " | ", p_cnt9 + s_cnt9 + d_cnt9 USING "###########",
+ " | "
+ PRINT "+---------------------------------------------------------------------------------+"
+
+{
+"+--------------------------------------------------------------------------------+"
+"| № | Поликлиника | Стационар | Дн. стац. | Всего |"
+"+----------------------+--------------+--------------+-------------+-------------+"
+"| 1. Количество актов | ############ | ############ | ########### | ########### |",
+"+--------------------------------------------------------------------------------+
+}
+
+END REPORT
+
Index: /trunk/oms_sk/src/_main.4gl
===================================================================
--- /trunk/oms_sk/src/_main.4gl (revision 540)
+++ /trunk/oms_sk/src/_main.4gl (revision 547)
@@ -50,5 +50,5 @@
# v3.22 - (10.02.2007) загрузка и проверка dbf.
# --- С 11.03.2007 версия нумеруется по дате.
- LET release_num = "ОМС-СК v.081017"
+ LET release_num = "ОМС-СК v.081029"
LET global_auto = FALSE
Index: /trunk/oms_sk/src/_reports.4gl
===================================================================
--- /trunk/oms_sk/src/_reports.4gl (revision 435)
+++ /trunk/oms_sk/src/_reports.4gl (revision 547)
@@ -190,4 +190,6 @@
WHEN r_num = 38
CALL ReportReestrGUZOLPUItogo()
+ WHEN r_num = 39
+ CALL ReportReestrPG()
OTHERWISE
ERROR "Чаго ?"
@@ -361,5 +363,5 @@
LET rpt_names[37].rpt_descr = "Отчет по РАБОТАЮЩИМ (в разрезе ЛПУ/специалист) | вертикал"
LET rpt_names[38].rpt_descr = "Сведения по ЭЭ для ЛПУ (УБ/специалист) | горизонт"
- LET rpt_names[39].rpt_descr = " | "
+ LET rpt_names[39].rpt_descr = "Отчет по правам граждан | вертикал"
LET rpt_names[40].rpt_descr = " | "
LET rpt_names[41].rpt_descr = " | "
Index: /trunk/oms_sk/src/run_y.sh
===================================================================
--- /trunk/oms_sk/src/run_y.sh (revision 176)
+++ /trunk/oms_sk/src/run_y.sh (revision 547)
@@ -2,4 +2,4 @@
export A4GL_SQLUID=yurevich
export A4GL_SQLPWD=aef7iaoo
-cd ../../bin
+cd ../bin
./_oms_sk