2
<%@ page import="java.sql.*,java.util.*" %>
3
<%@ page import="com.opensymphony.xwork.util.OgnlValueStack" %>
6
<%@ page session="true"%>
12
// For finding organisationunit name of selected Orgunit based on Orgunit id
16
// For finding start date of selected period based on period id
21
// For finding datavalues
26
String userName = "dhis";
28
String urlForConnection = "jdbc:mysql://localhost/mp_dhis2";
30
OgnlValueStack stack = (OgnlValueStack)request.getAttribute("webwork.valueStack");
32
String selectedId = (String) stack.findValue( "orgUnitId" );
33
int selectedOrgUnitID = Integer.parseInt( selectedId );
35
// int selectedOrgUnitID = 243;
38
// String selectedPeriodId = (String) stack.findValue( "periodSelect" );
39
// int selectedDataPeriodID = Integer.parseInt( selectedPeriodId );
41
String startingDate = (String) stack.findValue( "startingPeriod" );
42
String endingDate = (String) stack.findValue( "endingPeriod" );
44
// String startingDate = "2006-06-01";
45
// String endingDate = "2006-06-01";
48
// String monthlyPeriodId = (String) stack.findValue( "monthlyPeriodTypeId" );
49
// int periodTypeID = Integer.parseInt( monthlyPeriodId );
52
String selectedOrgUnitName = "";
53
String selectedDataPeriodStartDate = "";
55
String monthNames[] = { "", "January", "February", "March", "April", "May", "June", "July", "August", "September","October", "November", "December" };
57
String monthlyDataElements[] = {
58
// Acute Diarrhoeal Diseases - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
59
"CD_DE1","CD_DE2","CD_DE37","CD_DE38","CD_DE73","CD_DE74",
61
// Diphtheria - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
62
"CD_DE3","CD_DE4","CD_DE39","CD_DE40","CD_DE75","CD_DE76",
64
// Acute Poliomyelitis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
65
"CD_DE5","CD_DE6","CD_DE41","CD_DE42","CD_DE77","CD_DE78",
67
// Tetanus other than Neonatal - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
68
"CD_DE7","CD_DE8","CD_DE43","CD_DE44","CD_DE79","CD_DE80",
70
// Neo natal Tetanus - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
71
"CD_DE9","CD_DE10","CD_DE45","CD_DE46","CD_DE81","CD_DE82",
73
// Whooping Cough - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
74
"CD_DE11","CD_DE12","CD_DE47","CD_DE48","CD_DE83","CD_DE84",
76
// Measles - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
77
"CD_DE13","CD_DE14","CD_DE49","CD_DE50","CD_DE85","CD_DE86",
79
// Acute Respiratory Infection - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
80
"CD_DE15","CD_DE16","CD_DE51","CD_DE52","CD_DE87","CD_DE88",
82
// Pneumonia - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
83
"CD_DE17","CD_DE18","CD_DE53","CD_DE54","CD_DE89","CD_DE90",
85
// Enteric Fever - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
86
"CD_DE19","CD_DE20","CD_DE55","CD_DE56","CD_DE91","CD_DE92",
88
// Viral Hepatitis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
89
"CD_DE21","CD_DE22","CD_DE57","CD_DE58","CD_DE93","CD_DE94",
91
// Meningococcaol Meningitis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
92
"CD_DE23","CD_DE24","CD_DE59","CD_DE60","CD_DE95","CD_DE96",
94
// Japanese Encephalitis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
95
"CD_DE25","CD_DE26","CD_DE61","CD_DE62","CD_DE97","CD_DE98",
97
// Robies - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
98
"CD_DE27","CD_DE28","CD_DE63","CD_DE64","CD_DE99","CD_DE100",
100
// Syphilis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
101
"CD_DE29","CD_DE30","CD_DE65","CD_DE66","CD_DE101","CD_DE102",
103
// Gonococcal Infection - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
104
"CD_DE31","CD_DE32","CD_DE67","CD_DE68","CD_DE103","CD_DE104",
106
// Pulmonary Tuberculosis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
107
"CD_DE33","CD_DE34","CD_DE69","CD_DE70","CD_DE105","CD_DE106",
109
// All other diseases - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
110
"CD_DE35","CD_DE36","CD_DE71","CD_DE72","CD_DE107","CD_DE108"
115
String nonCommDisNames[] = {
116
"Acute Diarrhoeal Diseases <br><font face='arial' size='1'>(Including Gastro Entritis and Cholera)</font>",
118
"Acute Poliomyelitis",
119
"Tetanus other than Neonatal",
123
"Acute Respiratory Infection<br><font face='arial' size='1'>(including Influenza and excluding Pneumonia)</font>",
127
"Meningococcaol Meningitis",
128
"Japanese Encephalitis",
131
"Gonococcal Infection",
132
"Pulmonary Tuberculosis",
133
"All other diseases treated in Institution excluding above mentioned diseases"
138
String nonCommDisNo[] = {
160
List childOrgUnitIDs = new ArrayList();
161
List childOrgUnitNames = new ArrayList();
163
int childOrgUnitCount = 0;
166
int totPopulation = 0;
168
int tempval[] = new int[16];
169
int total[] = new int[16];
175
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
176
con = DriverManager.getConnection (urlForConnection, userName, password);
178
st1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
179
st2=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
180
st3=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
183
//rs1 = st1.executeQuery("SELECT organisationunit.shortname FROM organisationunit where organisationunit.id = "+selectedOrgUnitID);
184
rs1 = st1.executeQuery("SELECT organisationunit.shortname FROM organisationunit where organisationunit.organisationunitid = "+selectedOrgUnitID);
185
if(rs1.next()) { selectedOrgUnitName = rs1.getString(1); }
186
else { selectedOrgUnitName = ""; }
188
// rs2 = st2.executeQuery("select startDate from period where id = "+selectedDataPeriodID);
189
// if(rs2.next()) { selectedDataPeriodStartDate = rs2.getDate(1).toString(); }
191
selectedDataPeriodStartDate = startingDate;
194
catch(Exception e) { out.println(e.getMessage()); }
196
String partsOfDataPeriodStartDate[] = selectedDataPeriodStartDate.split("-");
201
<title>MONTHLY STATEMENT SHOWING INSTITUTIONAL CASES AND DEATHS DUE TO PRINCIPAL COMMUNICABLE DISEASES</title>
205
<font face="arial" size="3"><b>
206
<u>MONTHLY STATEMENT SHOWING INSTITUTIONAL CASES AND DEATHS DUE TO PRINCIPAL COMMUNICABLE DISEASES</u>
210
<table cellpadding="0" cellspacing="0" bgcolor="ffffff" align="center" style="border-style:solid; border-width:0; border-collapse: collapse; padding: 0; position:relative; top:10" bordercolor="#ffffff" width="100%" border="0">
211
<tr style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding: 0" bordercolor="#111111" width="100%">
212
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25">
213
<font face="Arial" size="2">1. Name of the
214
CHC : </font>
216
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25">
217
<font face="Arial" size="2"><%=selectedOrgUnitName%></font>
221
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25">
222
<font face="Arial" size="2">2. Month</font>
224
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25">
225
<font face="Arial" size="2"><%=monthNames[Integer.parseInt(partsOfDataPeriodStartDate[1])]%></font>
228
<tr style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding: 0" bordercolor="#111111" width="100%">
229
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25">
230
<font face="Arial" size="2">3. Year</font>
232
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25">
233
<font face="Arial" size="2"><%=partsOfDataPeriodStartDate[0]%></font>
236
<tr style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding: 0" bordercolor="#111111" width="100%">
237
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25">
238
<font face="Arial" size="2">4. Total No. of existing Institutions in the District</font>
240
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25"> </td>
242
<tr style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding: 0" bordercolor="#111111" width="100%">
243
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25">
244
<font face="Arial" size="2">5. Total No. of Reporting Institutions For the month in the District :</font>
246
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25"> </td>
249
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25">
250
<font face="Arial" size="2">6. Total No. of defaulting Institutions For the month in the District:</font>
252
<td width="50%" style="border-collapse: collapse; border-left-style: solid; border-left-width: 0; border-right-style: solid; border-right-width: 0; padding-left:15; padding-right:0; padding-top:0; padding-bottom:0" bordercolor="#111111" height="25"> </td>
256
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
258
<td width="3%" align="center" rowspan="3"><font face="arial" size="2"><b>क्रम सं.</b></font></td>
259
<td width="40%" align="center" rowspan="3"><b><font face="arial" size="2">Name of Disease</font></b></td>
260
<td width="38%" align="center" colspan="6"><b><font face="arial" size="2">Patients Treated</font></b></td>
261
<td width="19%" align="center" colspan="3"><b><font face="arial" size="2">Deaths</font></b></td>
264
<td width="12%" align="center" colspan="2"><b><font face="arial" size="2">OPD</font></b></td>
265
<td width="12%" align="center" colspan="2"><b><font face="arial" size="2">IPD</font></b></td>
266
<td width="14%" align="center" colspan="2"><b><font face="arial" size="2">TOTAL</font></b></td>
267
<td width="19%" align="center" colspan="3"><b><font face="arial" size="2">(IPD Only)</font></b></td>
270
<td width="6%" align="center"><b><font face="arial" size="2">M</font></b></td>
271
<td width="6%" align="center"><b><font face="arial" size="2">F</font></b></td>
272
<td width="6%" align="center"><b><font face="arial" size="2">M</font></b></td>
273
<td width="6%" align="center"><b><font face="arial" size="2">F</font></b></td>
274
<td width="7%" align="center"><b><font face="arial" size="2">M</font></b></td>
275
<td width="7%" align="center"><b><font face="arial" size="2">F</font></b></td>
276
<td width="6%" align="center"><b><font face="arial" size="2">M</font></b></td>
277
<td width="6%" align="center"><b><font face="arial" size="2">F</font></b></td>
278
<td width="7%" align="center"><b><font face="arial" size="2">T</font></b></td>
292
//rs3 = st3.executeQuery("SELECT sum(datavalue.value) FROM datavalue INNER JOIN dataelement ON datavalue.dataElement = dataelement.id WHERE datavalue.period in (select id from period where startdate between '"+startingDate+"' and '"+startingDate+"') AND datavalue.source ="+selectedOrgUnitID+" AND dataelement.code like '"+monthlyDataElements[k]+"'");
293
rs3 = st3.executeQuery("SELECT sum(datavalue.value) FROM datavalue INNER JOIN dataelement ON datavalue.dataelementid = dataelement.dataelementid WHERE datavalue.periodid in (select periodid from period where startdate between '"+startingDate+"' and '"+startingDate+"') AND datavalue.sourceid in (select organisationunitid from organisationunit where organisationunitid in ( select organisationunitid from organisationunit where parentid = "+selectedOrgUnitID+") or organisationunitid = "+selectedOrgUnitID+") AND dataelement.code like '"+monthlyDataElements[k]+"'");
294
if(!rs3.next()) { tempval[i] = 0; }
295
else { tempval[i] = rs3.getInt(1); }
296
total[i] += tempval[i];
303
<td width="3%" align="center"><font face="arial" size="2"><%=nonCommDisNo[count]%></font> </td>
304
<td width="40%" align="center"><font face="arial" size="2"><%=nonCommDisNames[count]%></font> </td>
305
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[0]%></font> </td>
306
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[1]%></font> </td>
307
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[2]%></font> </td>
308
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[3]%></font> </td>
309
<td width="7%" align="center"><font face="arial" size="2"><%=(tempval[0]+tempval[2])%></font> </td>
310
<td width="7%" align="center"><font face="arial" size="2"><%=(tempval[1]+tempval[3])%></font> </td>
311
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[4]%></font> </td>
312
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[5]%></font> </td>
313
<td width="7%" align="center"><font face="arial" size="2"><%=(tempval[4]+tempval[5])%></font> </td>
321
catch(Exception e) { out.println(e.getMessage()); }
326
if(rs1!=null) rs1.close(); if(st1!=null) st1.close();
327
if(rs2!=null) rs2.close(); if(st2!=null) st2.close();
328
if(rs3!=null) rs3.close(); if(st3!=null) st3.close();
330
if(con!=null) con.close();
332
catch(Exception e) { out.println(e.getMessage()); }
333
} // finally block end
337
<td width="43%" align="center" colspan="2"><font face="arial" size="2">Total</font></td>
338
<td width="6%" align="center" ><font face="arial" size="2"><%=total[0]%></font> </td>
339
<td width="6%" align="center" ><font face="arial" size="2"><%=total[1]%></font> </td>
340
<td width="6%" align="center" ><font face="arial" size="2"><%=total[2]%></font> </td>
341
<td width="6%" align="center" ><font face="arial" size="2"><%=total[3]%></font> </td>
342
<td width="7%" align="center" ><font face="arial" size="2"><%=(total[0]+total[2])%></font> </td>
343
<td width="7%" align="center" ><font face="arial" size="2"><%=(total[1]+total[3])%></font> </td>
344
<td width="6%" align="center" ><font face="arial" size="2"><%=total[4]%></font> </td>
345
<td width="6%" align="center" ><font face="arial" size="2"><%=total[5]%></font> </td>
346
<td width="7%" align="center" ><font face="arial" size="2"><%=(total[4]+total[5])%></font> </td>
b'\\ No newline at end of file'