1
<%@ page import="java.sql.*" %>
2
<%@ page import="com.opensymphony.xwork.util.OgnlValueStack" %>
4
<%@ page session="true"%>
9
// For finding organisationunit name of selected Orgunit based on Orgunit id
13
// For finding start date of selected period based on period id
17
//For finding monthly values
21
//For finding cumulative values
25
//For finding blockphc name and id
29
//For finding taluk name and id
33
//For finding district name and id
37
//For finding state name and id
41
String userName = "dhis";
43
String urlForConnection = "jdbc:mysql://localhost/kl_dhis2";
46
OgnlValueStack stack = (OgnlValueStack)request.getAttribute("webwork.valueStack");
48
String selectedId = (String) stack.findValue( "orgUnitId" );
49
int selectedOrgUnitID = Integer.parseInt( selectedId );
52
String startingDate = (String) stack.findValue( "startingPeriod" );
53
String endingDate = (String) stack.findValue( "endingPeriod" );
56
String monthlyPeriodId = (String) stack.findValue( "monthlyPeriodTypeId" );
57
int periodTypeID = Integer.parseInt( monthlyPeriodId );
60
String selectedOrgUnitName = "";
61
String selectedDataPeriodStartDate = "";
63
String monthlyDataElements[] = {
64
// No of Leprosy Cases at the begining of the reporting month
66
// No of PB new Leprosy Cases detected
68
// No of MB new Leprosy Cases detected
70
// No of new Leprosy Cases detected in children
72
// No of new Leprosy Cases detected in Female
74
// No of new Leprosy Cases detected - Visible Deformity
76
// No of new Leprosy Cases detected - SC
78
// No of new Leprosy Cases detected - ST
80
//No of RFT Cases deleted
82
//No of Other Cases deleted
84
//No of Sub-Centres providing MDT services
100
//BLISTER PACK PB(A)2
102
//BLISTER PACK PB(A)3
104
//BLISTER PACK PB(C)1
106
//BLISTER PACK PB(C)2
108
//BLISTER PACK PB(C)3
112
int monthlyValues[] = new int[monthlyDataElements.length+5];
113
int cumulativeValues[] = new int[monthlyDataElements.length+5];
121
String TalukName = "";
122
String DistrictName = "";
123
String StateName = "";
132
String monthNames[] = { "", "January", "February", "March", "April", "May", "June", "July", "August", "September",
133
"October", "November", "December" };
140
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
141
con = DriverManager.getConnection (urlForConnection, userName, password);
143
st1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
144
st2=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
145
st3=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
146
st4=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
147
st5=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
148
st6=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
149
st7=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
150
st8=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
152
//rs1 = st1.executeQuery("select name from organisationunit where id = "+selectedOrgUnitID);
153
rs1 = st1.executeQuery("select name from organisationunit where organisationunitid = "+selectedOrgUnitID);
154
if(rs1.next()) { selectedOrgUnitName = rs1.getString(1); }
156
// rs2 = st2.executeQuery("select startDate from period where id = "+selectedDataPeriodID);
157
// if(rs2.next()) { selectedDataPeriodStartDate = rs2.getDate(1).toString(); }
159
selectedDataPeriodStartDate = startingDate;
162
//rs5=st5.executeQuery("select organisationunit.id, organisationunit.name FROM organisationunit WHERE organisationunit.id in ( select organisationunit.parent from organisationunit where organisationunit.id = "+selectedOrgUnitID+")");
163
rs5=st5.executeQuery("select organisationunit.organisationunitid, organisationunit.name FROM organisationunit WHERE organisationunit.organisationunitid in ( select organisationunit.parentid from organisationunit where organisationunit.organisationunitid = "+selectedOrgUnitID+")");
164
if(rs5.next()) { CHCID = rs5.getInt(1);CHCName = rs5.getString(2); }
165
else { CHCID = 0; CHCName = ""; }
167
//rs6=st6.executeQuery("select organisationunit.id, organisationunit.name FROM organisationunit WHERE organisationunit.id in ( select organisationunit.parent from organisationunit where organisationunit.id = "+CHCID+")");
168
rs6=st6.executeQuery("select organisationunit.organisationunitid, organisationunit.name FROM organisationunit WHERE organisationunit.organisationunitid in ( select organisationunit.parentid from organisationunit where organisationunit.organisationunitid = "+CHCID+")");
169
if(rs6.next()) { TalukID = rs6.getInt(1);TalukName = rs6.getString(2); }
170
else { TalukID = 0; TalukName = ""; }
172
//rs7=st7.executeQuery("select organisationunit.id, organisationunit.name FROM organisationunit WHERE organisationunit.id in ( select organisationunit.parent from organisationunit where organisationunit.id = "+TalukID+")");
173
rs7=st7.executeQuery("select organisationunit.organisationunitid, organisationunit.name FROM organisationunit WHERE organisationunit.organisationunitid in ( select organisationunit.parentid from organisationunit where organisationunit.organisationunitid = "+TalukID+")");
174
if(rs7.next()) { DistrictID = rs7.getInt(1);DistrictName = rs7.getString(2); }
175
else { DistrictID = 0; DistrictName = ""; }
177
//rs8=st8.executeQuery("select organisationunit.id, organisationunit.name FROM organisationunit WHERE organisationunit.id in ( select organisationunit.parent from organisationunit where organisationunit.id = "+DistrictID+")");
178
rs8=st8.executeQuery("select organisationunit.organisationunitid, organisationunit.name FROM organisationunit WHERE organisationunit.organisationunitid in ( select organisationunit.parentid from organisationunit where organisationunit.organisationunitid = "+DistrictID+")");
179
if(rs8.next()) { StateID = rs8.getInt(1);StateName = rs8.getString(2); }
180
else { StateID = 0; StateName = ""; }
183
catch(Exception e) { out.println(e.getMessage()); }
185
String partsOfDataPeriodStartDate[] = selectedDataPeriodStartDate.split("-");
186
int lastYear = Integer.parseInt(partsOfDataPeriodStartDate[0]) - 1;
187
int tempForMonth1 = Integer.parseInt(partsOfDataPeriodStartDate[1]);
189
if(tempForMonth1 < 4){ tempForYear = lastYear; }
190
else { tempForYear = lastYear + 1; }
191
String curYearStart=tempForYear+"-04-01";
195
for(i=0;i<monthlyDataElements.length;i++)
197
//rs3 = st3.executeQuery("SELECT sum(datavalue.value) FROM datavalue INNER JOIN dataelement ON datavalue.dataElement = dataelement.id INNER JOIN period ON datavalue.period = period.id INNER JOIN organisationunit ON datavalue.source = organisationunit.parent WHERE dataelement.name like '"+monthlyDataElements[i]+"' AND organisationunit.parent="+selectedOrgUnitID+" AND period.id in (select id from period where startdate between '"+startingDate+"' and '"+startingDate+"') ");
198
rs3 = st3.executeQuery("SELECT sum(datavalue.value) FROM datavalue INNER JOIN dataelement ON datavalue.dataelementid = dataelement.dataelementid INNER JOIN period ON datavalue.periodid = period.periodid INNER JOIN organisationunit ON datavalue.sourceid = organisationunit.parentid WHERE dataelement.name like '"+monthlyDataElements[i]+"' AND organisationunit.parentid="+selectedOrgUnitID+" AND period.periodid in (select periodid from period where startdate between '"+startingDate+"' and '"+startingDate+"') ");
199
if(rs3.next()) { monthlyValues[i] = rs3.getInt(1); }
201
//rs4 = st4.executeQuery("select sum(value) from datavalue where dataElement in (select id from dataelement where code like '"+monthlyDataElements[i]+"') and source in (select id from organisationunit where parent ="+selectedOrgUnitID+") and period in (select id from period where startdate between '"+curYearStart+"' and '"+selectedDataPeriodStartDate+"' and periodType = "+periodTypeID+")");
202
rs4 = st4.executeQuery("select sum(value) from datavalue where dataelementid in (select dataelementid from dataelement where code like '"+monthlyDataElements[i]+"') and sourceid in (select organisationunitid from organisationunit where parentid ="+selectedOrgUnitID+") and periodid in (select periodid from period where startdate between '"+curYearStart+"' and '"+selectedDataPeriodStartDate+"' and periodtypeid = "+periodTypeID+")");
203
if(rs4.next()) { cumulativeValues[i] = rs4.getInt(1); }
206
catch(Exception e) { out.println(e.getMessage()); }
211
if(rs1!=null) rs1.close(); if(st1!=null) st1.close();
212
if(rs2!=null) rs2.close(); if(st2!=null) st2.close();
213
if(rs3!=null) rs3.close(); if(st3!=null) st3.close();
214
if(rs4!=null) rs4.close(); if(st4!=null) st4.close();
215
if(rs5!=null) rs5.close(); if(st5!=null) st5.close();
216
if(rs6!=null) rs6.close(); if(st6!=null) st6.close();
217
if(rs7!=null) rs7.close(); if(st7!=null) st7.close();
218
if(rs8!=null) rs8.close(); if(st8!=null) st8.close();
220
if(con!=null) con.close();
222
catch(Exception e) { out.println(e.getMessage()); }
223
} // finally block end
229
<title>NLEP Monthly Reporting Form</title>
232
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
233
<tr><td width="100%" colspan="8" align="center"><font face="Arial" size="3"><b>NLEP Monthly Reporting Form</b></font></td></tr>
234
<tr><td width="100%" colspan="8" align="center"><font face="Arial" size="3"><b>PHC/Block PHC Report</b></font></td></tr>
236
<td width="50%" height="25" colspan="3"><font face="Arial" size="2">PHC <%=selectedOrgUnitName%></font></td>
237
<td width="50%" height="25" colspan="5"><font face="Arial" size="2">Block <%=CHCName%></font></td>
240
<td width="50%" height="25" colspan="3"><font face="Arial" size="2">District <%=DistrictName%></font></td>
241
<td width="50%" height="25" colspan="5"><font face="Arial" size="2">State <%=StateName%></font></td>
244
<td width="50%" height="25" colspan="3"><font face="Arial" size="2">Reporting Month <%=monthNames[Integer.parseInt(partsOfDataPeriodStartDate[1])]%></font></td>
245
<td width="50%" height="25" colspan="5"><font face="Arial" size="2">Year <%=partsOfDataPeriodStartDate[0]%></font></td>
248
<td width="5%" height="25" ><font face="Arial" size="3">1</font></td>
249
<td width="55%" height="25" colspan="4"><font face="Arial" size="2">No. of cases at the beginning of the reporting month</font></td>
250
<td width="25%" height="25" colspan="2"> </td>
251
<td width="15%" height="25" align="center"><font face="Arial" size="2"><%=monthlyValues[0]%></font></td>
254
<td width="5%" rowspan="3" height="25" ><font face="Arial" size="2">2</font></td>
255
<td width="55%" rowspan="3" colspan="4" height="25" ><font face="Arial" size="2">Total New Leprosy Cases detected in the reporting month</font></td>
256
<td width="15%" height="25" > </td>
257
<td width="10%" height="25" align="center" ><font face="Arial" size="2">During Reporting Month</font></td>
258
<td width="15%" height="25" ><font face="Arial" size="2">Cumulative from 1st April</font></td>
261
<td width="15%" height="25" ><font face="Arial" size="2">PB-</font></td>
262
<td width="10%" height="25" align="center" ><font face="Arial" size="2"><%=monthlyValues[1]%></font></td>
263
<td width="15%" height="25" align="center" ><font face="Arial" size="2"><%=cumulativeValues[1]%></font></td>
266
<td width="15%" height="25" ><font face="Arial" size="2">MB-</font></td>
267
<td width="10%" height="25" align="center" ><font face="Arial" size="2"><%=monthlyValues[2]%></font></td>
268
<td width="15%" height="25" align="center" ><font face="Arial" size="2"><%=cumulativeValues[2]%></font></td>
271
<td width="5%" height="25" rowspan="5" ><font face="Arial" size="2">3</font></td>
272
<td width="55%" height="25" rowspan="5" colspan="4"><font face="Arial" size="2">Among the new leprosy cases detected during the reporting month, number of-</font></td>
273
<td width="15%" height="25" ><font face="Arial" size="2">Children</font></td>
274
<td width="10%" height="25" align="center" ><font face="Arial" size="2"><%=monthlyValues[3]%></font></td>
275
<td width="15%" height="25" align="center" ><font face="Arial" size="2"><%=cumulativeValues[3]%></font></td>
278
<td width="15%" height="25" ><font face="Arial" size="2">Female</font></td>
279
<td width="10%" height="25" align="center" ><font face="Arial" size="2"><%=monthlyValues[4]%></font></td>
280
<td width="15%" height="25" align="center" ><font face="Arial" size="2"><%=cumulativeValues[4]%></font></td>
283
<td width="15%" height="25" ><font face="Arial" size="2">Visible Deformity</font></td>
284
<td width="10%" height="25" align="center" ><font face="Arial" size="2"><%=monthlyValues[5]%></font></td>
285
<td width="15%" height="25" align="center" ><font face="Arial" size="2"><%=cumulativeValues[5]%></font></td>
288
<td width="15%" height="25" ><font face="Arial" size="2">SC</font></td>
289
<td width="10%" height="25" align="center" ><font face="Arial" size="2"><%=monthlyValues[6]%></font></td>
290
<td width="15%" height="25" align="center" ><font face="Arial" size="2"><%=cumulativeValues[6]%></font></td>
293
<td width="15%" height="25" ><font face="Arial" size="2">ST</font></td>
294
<td width="10%" height="25" align="center" ><font face="Arial" size="2"><%=monthlyValues[7]%></font></td>
295
<td width="15%" height="25" align="center" ><font face="Arial" size="2"><%=cumulativeValues[7]%></font></td>
298
<td width="5%" rowspan="2" height="25" ><font face="Arial" size="2">4</font></td>
299
<td width="55%" height="25" rowspan="2" colspan="4"><font face="Arial" size="2">Number of Cases deleted in the reporting month</font></td>
300
<td width="15%" height="25" ><font face="Arial" size="2">RFT-</font></td>
301
<td width="10%" height="25" align="center" ><font face="Arial" size="2"><%=monthlyValues[8]%></font></td>
302
<td width="15%" height="25" align="center" ><font face="Arial" size="2"><%=cumulativeValues[8]%></font></td>
305
<td width="15%" height="25" ><font face="Arial" size="2">Others-</font></td>
306
<td width="10%" height="25" align="center" ><font face="Arial" size="2"><%=monthlyValues[9]%></font></td>
307
<td width="15%" height="25" align="center" ><font face="Arial" size="2"><%=cumulativeValues[9]%></font></td>
310
<td width="5%" height="25" ><font face="Arial" size="2">5</font></td>
311
<td width="55%" height="25" colspan="4"><font face="Arial" size="2">Number of Cases at the end of the reporting month (1+2-4)</font></td>
312
<td width="25%" height="25" colspan="2" align="center"><font face="Arial" size="2"><%=(monthlyValues[1] + monthlyValues[2] - monthlyValues[4])%> </font></td>
313
<td width="15%" height="25" align="center"><font face="Arial" size="2"><%=(cumulativeValues[1] + cumulativeValues[2]- cumulativeValues[4])%></font></td>
316
<td width="5%" height="25" ><font face="Arial" size="2">6</font></td>
317
<td width="55%" height="25" colspan="4"><font face="Arial" size="2">Number of Sub-Centres providing MDT services</font></td>
318
<td width="25%" height="25" colspan="2" align="center"><%=monthlyValues[11]%> </td>
319
<td width="15%" height="25" align="center"><font face="Arial" size="2"><%=cumulativeValues[11]%></font></td>
322
<td width="5%" height="25" ><font face="Arial" size="2">7</font></td>
323
<td width="95%" height="25" colspan="7"><font face="Arial" size="2">Leprosy Drug Stock at the end of the reporting month</font></td>
326
<td width="5%" height="25" > </td>
327
<td width="20%" height="25" align="center"><font face="Arial" size="2">Blister Pack</font></td>
328
<td width="25%" height="25" align="center"><font face="Arial" size="2">Quantity</font></td>
329
<td width="25" height="25" align="center" colspan="3"><font face="Arial" size="2">Expiry Date</font></td>
330
<td width="25%" height="25" align="center" colspan="2"><font face="Arial" size="2">Total Stock</font></td>
333
<td width="5%" height="25" rowspan="3" > </td>
334
<td width="20%" height="25" align="center" rowspan="3" ><font face="Arial" size="2">MB(A)</font></td>
335
<td width="25%" height="25" align="center"><%=monthlyValues[12]%></td>
336
<td width="25" height="25" colspan="3"></td>
337
<td width="25%" height="25" colspan="2" rowspan="3"align="center"><%=monthlyValues[12] + monthlyValues[13] + monthlyValues[14]%></td>
340
<td width="25%" height="25" align="center"><%=monthlyValues[13]%></td>
341
<td width="25" height="25" colspan="3"></td>
344
<td width="25%" height="25" align="center"><%=monthlyValues[14]%></td>
345
<td width="25" height="25" colspan="3"></td>
348
<td width="5%" height="25" rowspan="3" > </td>
349
<td width="20%" height="25" align="center" rowspan="3" ><font face="Arial" size="2">MB(C)</font></td>
350
<td width="25%" height="25" align="center"><%=monthlyValues[15]%></td>
351
<td width="25" height="25" colspan="3"></td>
352
<td width="25%" height="25" colspan="2" rowspan="3"align="center"><%=(monthlyValues[15] + monthlyValues[16] + monthlyValues[17])%></td>
355
<td width="25%" height="25" align="center"><%=monthlyValues[16]%></td>
356
<td width="25" height="25" colspan="3"></td>
359
<td width="25%" height="25" align="center"><%=monthlyValues[17]%></td>
360
<td width="25" height="25" colspan="3"></td>
363
<td width="5%" height="25" rowspan="3" > </td>
364
<td width="20%" height="25" align="center" rowspan="3" ><font face="Arial" size="2">PB(A)</font></td>
365
<td width="25%" height="25" align="center"><%=monthlyValues[18]%></td>
366
<td width="25" height="25" colspan="3"></td>
367
<td width="25%" height="25" colspan="2" rowspan="3"align="center"><%=(monthlyValues[18] + monthlyValues[19] + monthlyValues[20])%></td>
370
<td width="25%" height="25" align="center"><%=monthlyValues[19]%></td>
371
<td width="25" height="25" colspan="3"></td>
374
<td width="25%" height="25" align="center"><%=monthlyValues[20]%></td>
375
<td width="25" height="25" colspan="3"></td>
378
<td width="5%" height="25" rowspan="3" > </td>
379
<td width="20%" height="25" align="center" rowspan="3" ><font face="Arial" size="2">PB(C)</font></td>
380
<td width="25%" height="25" align="center"><%=monthlyValues[21]%></td>
381
<td width="25" height="25" colspan="3"></td>
382
<td width="25%" height="25" colspan="2" rowspan="3" align="center"><%=(monthlyValues[21] + monthlyValues[22] + monthlyValues[23])%></td>
385
<td width="25%" height="25" align="center"><%=monthlyValues[22]%></td>
386
<td width="25" height="25" colspan="3"></td>
389
<td width="25%" height="25" align="center"><%=monthlyValues[23]%></td>
390
<td width="25" height="25" colspan="3" align="center"></td>
393
<td width="100%" height="25" colspan="8"><font face="Arial" size="2">NB: Please calculate Patient-Month Blister
394
Packs for MB(A), MB(C), PB(A) and PB(C) Quarterly in the months of March, June, Sept and Dec and indicate the same in that respective Monthly Report.</font></td>
397
<td width="5%" height="50" ><font face="Arial" size="2">Date</font></td>
398
<td width="45%" height="50" colspan="3"> </td>
399
<td width="50%" height="50" colspan="4"><font face="Arial" size="2">Name and Signature of Medical Officer</font></td>
b'\\ No newline at end of file'