2
<%@ page import="java.sql.*,java.util.*" %>
3
<%@ page import="com.opensymphony.xwork.util.OgnlValueStack" %>
5
<%@ page session="true"%>
11
// For finding organisationunit name of selected Orgunit based on Orgunit id
15
// For finding start date of selected period based on period id
20
// For finding datavalues
25
String userName = "dhis";
27
String urlForConnection = "jdbc:mysql://localhost/mp_dhis2";
29
OgnlValueStack stack = (OgnlValueStack)request.getAttribute("webwork.valueStack");
31
String selectedId = (String) stack.findValue( "orgUnitId" );
32
int selectedOrgUnitID = Integer.parseInt( selectedId );
34
// int selectedOrgUnitID = 239;
37
// String selectedPeriodId = (String) stack.findValue( "periodSelect" );
38
// int selectedDataPeriodID = Integer.parseInt( selectedPeriodId );
40
String startingDate = (String) stack.findValue( "startingPeriod" );
41
String endingDate = (String) stack.findValue( "endingPeriod" );
43
// String startingDate = "2006-06-01";
44
// String endingDate = "2006-06-01";
47
// String monthlyPeriodId = (String) stack.findValue( "monthlyPeriodTypeId" );
48
// int periodTypeID = Integer.parseInt( monthlyPeriodId );
51
String selectedOrgUnitName = "";
52
String selectedDataPeriodStartDate = "";
54
String monthNames[] = { "", "January", "February", "March", "April", "May", "June", "July", "August", "September","October", "November", "December" };
56
String monthlyDataElements[] = {
57
// Acute Diarrhoeal Diseases - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
58
"CD_DE1","CD_DE2","CD_DE37","CD_DE38","CD_DE73","CD_DE74",
60
// Diphtheria - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
61
"CD_DE3","CD_DE4","CD_DE39","CD_DE40","CD_DE75","CD_DE76",
63
// Acute Poliomyelitis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
64
"CD_DE5","CD_DE6","CD_DE41","CD_DE42","CD_DE77","CD_DE78",
66
// Tetanus other than Neonatal - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
67
"CD_DE7","CD_DE8","CD_DE43","CD_DE44","CD_DE79","CD_DE80",
69
// Neo natal Tetanus - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
70
"CD_DE9","CD_DE10","CD_DE45","CD_DE46","CD_DE81","CD_DE82",
72
// Whooping Cough - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
73
"CD_DE11","CD_DE12","CD_DE47","CD_DE48","CD_DE83","CD_DE84",
75
// Measles - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
76
"CD_DE13","CD_DE14","CD_DE49","CD_DE50","CD_DE85","CD_DE86",
78
// Acute Respiratory Infection - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
79
"CD_DE15","CD_DE16","CD_DE51","CD_DE52","CD_DE87","CD_DE88",
81
// Pneumonia - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
82
"CD_DE17","CD_DE18","CD_DE53","CD_DE54","CD_DE89","CD_DE90",
84
// Enteric Fever - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
85
"CD_DE19","CD_DE20","CD_DE55","CD_DE56","CD_DE91","CD_DE92",
87
// Viral Hepatitis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
88
"CD_DE21","CD_DE22","CD_DE57","CD_DE58","CD_DE93","CD_DE94",
90
// Meningococcaol Meningitis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
91
"CD_DE23","CD_DE24","CD_DE59","CD_DE60","CD_DE95","CD_DE96",
93
// Japanese Encephalitis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
94
"CD_DE25","CD_DE26","CD_DE61","CD_DE62","CD_DE97","CD_DE98",
96
// Robies - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
97
"CD_DE27","CD_DE28","CD_DE63","CD_DE64","CD_DE99","CD_DE100",
99
// Syphilis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
100
"CD_DE29","CD_DE30","CD_DE65","CD_DE66","CD_DE101","CD_DE102",
102
// Gonococcal Infection - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
103
"CD_DE31","CD_DE32","CD_DE67","CD_DE68","CD_DE103","CD_DE104",
105
// Pulmonary Tuberculosis - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
106
"CD_DE33","CD_DE34","CD_DE69","CD_DE70","CD_DE105","CD_DE106",
108
// All other diseases - OPD Male, OPD Female, IPD Male, IPD Female, IPD Deaths Male, IPD Deaths Female
109
"CD_DE35","CD_DE36","CD_DE71","CD_DE72","CD_DE107","CD_DE108"
114
String nonCommDisNames[] = {
115
"Acute Diarrhoeal Diseases <br><font face='arial' size='1'>(Including Gastro Entritis and Cholera)</font>",
117
"Acute Poliomyelitis",
118
"Tetanus other than Neonatal",
122
"Acute Respiratory Infection<br><font face='arial' size='1'>(including Influenza and excluding Pneumonia)</font>",
126
"Meningococcaol Meningitis",
127
"Japanese Encephalitis",
130
"Gonococcal Infection",
131
"Pulmonary Tuberculosis",
132
"All other diseases treated in Institution excluding above mentioned diseases"
137
String nonCommDisNo[] = {
159
List childOrgUnitIDs = new ArrayList();
160
List childOrgUnitNames = new ArrayList();
162
int childOrgUnitCount = 0;
165
int totPopulation = 0;
167
int tempval[] = new int[16];
168
int total[] = new int[16];
174
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
175
con = DriverManager.getConnection (urlForConnection, userName, password);
177
st1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
178
st2=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
179
st3=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
182
//rs1 = st1.executeQuery("SELECT organisationunit.shortname FROM organisationunit where organisationunit.id = "+selectedOrgUnitID);
183
rs1 = st1.executeQuery("SELECT organisationunit.shortname FROM organisationunit where organisationunit.organisationunitid = "+selectedOrgUnitID);
184
if(rs1.next()) { selectedOrgUnitName = rs1.getString(1); }
185
else { selectedOrgUnitName = ""; }
187
// rs2 = st2.executeQuery("select startDate from period where id = "+selectedDataPeriodID);
188
// if(rs2.next()) { selectedDataPeriodStartDate = rs2.getDate(1).toString(); }
190
selectedDataPeriodStartDate = startingDate;
193
catch(Exception e) { out.println(e.getMessage()); }
195
String partsOfDataPeriodStartDate[] = selectedDataPeriodStartDate.split("-");
200
<title>MONTHLY STATEMENT SHOWING INSTITUTIONAL CASES AND DEATHS DUE TO PRINCIPAL COMMUNICABLE DISEASES</title>
204
<font face="arial" size="3"><b>
205
<u>MONTHLY STATEMENT SHOWING INSTITUTIONAL CASES AND DEATHS DUE TO PRINCIPAL COMMUNICABLE DISEASES</u>
209
<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">
210
<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%">
211
<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">
212
<font face="Arial" size="2">1. Name of the
213
District : </font>
215
<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">
216
<font face="Arial" size="2"><%=selectedOrgUnitName%></font>
220
<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">
221
<font face="Arial" size="2">2. Month</font>
223
<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">
224
<font face="Arial" size="2"><%=monthNames[Integer.parseInt(partsOfDataPeriodStartDate[1])]%></font>
227
<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%">
228
<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">
229
<font face="Arial" size="2">3. Year</font>
231
<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">
232
<font face="Arial" size="2"><%=partsOfDataPeriodStartDate[0]%></font>
235
<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%">
236
<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">
237
<font face="Arial" size="2">4. Total No. of existing Institutions in the District</font>
239
<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>
241
<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%">
242
<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">
243
<font face="Arial" size="2">5. Total No. of Reporting Institutions For the month in the District :</font>
245
<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>
248
<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">
249
<font face="Arial" size="2">6. Total No. of defaulting Institutions For the month in the District:</font>
251
<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>
255
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
257
<td width="3%" align="center" rowspan="3"><font face="arial" size="2"><b>क्रम सं.</b></font></td>
258
<td width="40%" align="center" rowspan="3"><b><font face="arial" size="2">Name of Disease</font></b></td>
259
<td width="38%" align="center" colspan="6"><b><font face="arial" size="2">Patients Treated</font></b></td>
260
<td width="19%" align="center" colspan="3"><b><font face="arial" size="2">Deaths</font></b></td>
263
<td width="12%" align="center" colspan="2"><b><font face="arial" size="2">OPD</font></b></td>
264
<td width="12%" align="center" colspan="2"><b><font face="arial" size="2">IPD</font></b></td>
265
<td width="14%" align="center" colspan="2"><b><font face="arial" size="2">TOTAL</font></b></td>
266
<td width="19%" align="center" colspan="3"><b><font face="arial" size="2">(IPD Only)</font></b></td>
269
<td width="6%" align="center"><b><font face="arial" size="2">M</font></b></td>
270
<td width="6%" align="center"><b><font face="arial" size="2">F</font></b></td>
271
<td width="6%" align="center"><b><font face="arial" size="2">M</font></b></td>
272
<td width="6%" align="center"><b><font face="arial" size="2">F</font></b></td>
273
<td width="7%" align="center"><b><font face="arial" size="2">M</font></b></td>
274
<td width="7%" align="center"><b><font face="arial" size="2">F</font></b></td>
275
<td width="6%" align="center"><b><font face="arial" size="2">M</font></b></td>
276
<td width="6%" align="center"><b><font face="arial" size="2">F</font></b></td>
277
<td width="7%" align="center"><b><font face="arial" size="2">T</font></b></td>
291
//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]+"'");
292
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 parentid in ( select organisationunitid from organisationunit where parentid = "+selectedOrgUnitID+") or organisationunitid in (select organisationunitid from organisationunit where parentid = "+selectedOrgUnitID+") or organisationunitid = "+selectedOrgUnitID+") AND dataelement.code like '"+monthlyDataElements[k]+"'");
293
if(!rs3.next()) { tempval[i] = 0; }
294
else { tempval[i] = rs3.getInt(1); }
295
total[i] += tempval[i];
302
<td width="3%" align="center"><font face="arial" size="2"><%=nonCommDisNo[count]%></font> </td>
303
<td width="40%" align="center"><font face="arial" size="2"><%=nonCommDisNames[count]%></font> </td>
304
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[0]%></font> </td>
305
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[1]%></font> </td>
306
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[2]%></font> </td>
307
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[3]%></font> </td>
308
<td width="7%" align="center"><font face="arial" size="2"><%=(tempval[0]+tempval[2])%></font> </td>
309
<td width="7%" align="center"><font face="arial" size="2"><%=(tempval[1]+tempval[3])%></font> </td>
310
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[4]%></font> </td>
311
<td width="6%" align="center"><font face="arial" size="2"><%=tempval[5]%></font> </td>
312
<td width="7%" align="center"><font face="arial" size="2"><%=(tempval[4]+tempval[5])%></font> </td>
320
catch(Exception e) { out.println(e.getMessage()); }
325
if(rs1!=null) rs1.close(); if(st1!=null) st1.close();
326
if(rs2!=null) rs2.close(); if(st2!=null) st2.close();
327
if(rs3!=null) rs3.close(); if(st3!=null) st3.close();
329
if(con!=null) con.close();
331
catch(Exception e) { out.println(e.getMessage()); }
332
} // finally block end
336
<td width="43%" align="center" colspan="2"><font face="arial" size="2">Total</font></td>
337
<td width="6%" align="center" ><font face="arial" size="2"><%=total[0]%></font> </td>
338
<td width="6%" align="center" ><font face="arial" size="2"><%=total[1]%></font> </td>
339
<td width="6%" align="center" ><font face="arial" size="2"><%=total[2]%></font> </td>
340
<td width="6%" align="center" ><font face="arial" size="2"><%=total[3]%></font> </td>
341
<td width="7%" align="center" ><font face="arial" size="2"><%=(total[0]+total[2])%></font> </td>
342
<td width="7%" align="center" ><font face="arial" size="2"><%=(total[1]+total[3])%></font> </td>
343
<td width="6%" align="center" ><font face="arial" size="2"><%=total[4]%></font> </td>
344
<td width="6%" align="center" ><font face="arial" size="2"><%=total[5]%></font> </td>
345
<td width="7%" align="center" ><font face="arial" size="2"><%=(total[4]+total[5])%></font> </td>
b'\\ No newline at end of file'