Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r34645 -r34650 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 34645) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 34650) @@ -27863,6 +27863,7 @@ String startTime, String endTime) { startTime += " 00:00:00"; endTime += " 23:59:59"; + OrgUnit orgUnit = orgUnitManager.getByName("大院供应室"); List resultList = new ArrayList(); String sql1 = "SELECT inn.bhName,inn.id FROM " + " (SELECT t.id, t.bhName, ROW_NUMBER() OVER(PARTITION BY t.id ORDER BY t.id ) num " @@ -27875,14 +27876,20 @@ + " from (select ip.depart, sr.id from SterilizationRecord sr " + " join TousseInstance ti on ti.sterilizationRecord_id = sr.id " + " join invoicePlan ip on ip.id = ti.invoicePlanID " - + " where ti.foreignProxyItem_id is not null and ti.combotousseinstanceid is null and ti.combotoussedefinitionid is null" + + " where sr.orgUnitCoding='"+ + orgUnit.getOrgUnitCoding() + +"' and ti.foreignProxyItem_id is not null and ti.combotousseinstanceid is null and ti.combotoussedefinitionid is null" + " union all select ip.depart, sr.id " + " from SterilizationRecord sr join TousseInstance ti on ti.sterilizationRecord_id = sr.id " + " join invoicePlan ip on ip.id = ti.proxyDisinfection_id " - + " where ti.proxyDisinfection_id is not null and ti.combotousseinstanceid is null and ti.combotoussedefinitionid is null" + + " where sr.orgUnitCoding='"+ + orgUnit.getOrgUnitCoding() + +"' and ti.proxyDisinfection_id is not null and ti.combotousseinstanceid is null and ti.combotoussedefinitionid is null" + " union all select ti.depart, sr.id from SterilizationRecord sr " + " join TousseInstance ti on ti.sterilizationRecord_id = sr.id " - + " where ti.proxyDisinfection_id is null and ti.foreignProxyItem_id is null and ti.combotousseinstanceid is null and ti.combotoussedefinitionid is null" + + " where sr.orgUnitCoding='"+ + orgUnit.getOrgUnitCoding() + +"' and ti.proxyDisinfection_id is null and ti.foreignProxyItem_id is null and ti.combotousseinstanceid is null and ti.combotoussedefinitionid is null" + " union all select ti.depart, sr.id from SterilizationRecord sr " + " join TousseInstance ti on ti.sterilizationRecord_id = sr.id join toussedefinition td on td.id=ti.toussedefinition_id where " + " td.tousseType='"+ TousseDefinition.PACKAGE_TYPE_COMBO +"' " @@ -27892,7 +27899,9 @@ String sql = " select sql1Table.bhName,sout.owngroup,count(*) amount from SterilizationRecord srout " + " join sterilizer sout on sout.id = srout.sterilizer_id " + " join ("+ sql1 +") sql1Table on sql1Table.id=srout.id " - + " where sout.owngroup in('高温灭菌炉','低温灭菌炉') and srout.endDate between " + + " where srout.orgUnitCoding='"+ + orgUnit.getOrgUnitCoding() + +"' and sout.owngroup in('高温灭菌炉','低温灭菌炉') and srout.endDate between " + dateQueryAdapter.dateAdapter(startTime) + " and " + dateQueryAdapter.dateAdapter(endTime) + " group by sql1Table.bhName,sout.owngroup "; @@ -27930,7 +27939,7 @@ } ResultSet rs2 = null; try { - rs = objectDao.executeSql(getSteAmountEachBranchReportDataSql(startTime, endTime)); + rs = objectDao.executeSql(getSteAmountEachBranchReportDataSql(startTime, endTime,orgUnit)); while(rs.next()){ String bhname = rs.getString("bhName"); Long totalAmount = rs.getLong("totalAmount"); @@ -27968,8 +27977,7 @@ * @param endDate 结束时间 * @return */ - private String getSteAmountEachBranchReportDataSql(String startDate, String endDate){ - OrgUnit orgUnit = orgUnitManager.getByName("大院供应室"); + private String getSteAmountEachBranchReportDataSql(String startDate, String endDate, OrgUnit orgUnit){ String orgUnitCoding = orgUnit.getOrgUnitCoding(); String betweenSql = String.format(" between %s and %s ", dateQueryAdapter.dateAdapter(startDate),dateQueryAdapter.dateAdapter(endDate));; String sql = "select bhName,sum(amount) totalAmount from ( select (select bh.name from brancheOfHospital bh "