Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/action/JasperreportsAction.java =================================================================== diff -u -r34165 -r34184 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/action/JasperreportsAction.java (.../JasperreportsAction.java) (revision 34165) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/action/JasperreportsAction.java (.../JasperreportsAction.java) (revision 34184) @@ -609,7 +609,7 @@ return jasperReportManager.getSterilizerQualiyDataSource(params); } else if (reportName.equals("departSatisfyReport")) {// 满意度调查汇总报表 - return jasperReportManager.getSatisfyDataSource(); + return jasperReportManager.getSatisfyDataSource(parametMap); }else if("qualityControlOfClinic".equals(reportName)){ //临床护理质量管理与控制指标 String queryYear = StrutsParamUtils.getPraramValue("queryYear", ""); String departCoding = StrutsParamUtils.getPraramValue("departCoding", ""); @@ -1461,10 +1461,12 @@ String month = StrutsParamUtils.getPraramValue("month", ""); String year = StrutsParamUtils.getPraramValue("year", ""); String querySupplyRoom = StrutsParamUtils.getPraramValue("querySupplyRoom", ""); + String instrumentSetTypes = StrutsParamUtils.getPraramValue("instrumentSetTypes", ""); + Set instrumentSetTypesSet = SqlUtils.splitStringToSet(instrumentSetTypes, ","); if(StringUtils.isNotBlank(year)){ - return jasperReportManager.findMaterialTypeWorkloadReportListByYear(year, querySupplyRoom); + return jasperReportManager.findMaterialTypeWorkloadReportListByYear(instrumentSetTypesSet,year, querySupplyRoom); }else if(StringUtils.isNotBlank(month)){ - return jasperReportManager.findMaterialTypeWorkloadReportList(month,querySupplyRoom); + return jasperReportManager.findMaterialTypeWorkloadReportList(instrumentSetTypesSet,month,querySupplyRoom); } }else if(reportName.equals("godownEntryDetailStatistic")){ // 入(退)库物品明细统计报表 Index: ssts-web/src/main/webapp/jasperRtp/departSatisfyReport.jrxml =================================================================== diff -u -r26805 -r34184 --- ssts-web/src/main/webapp/jasperRtp/departSatisfyReport.jrxml (.../departSatisfyReport.jrxml) (revision 26805) +++ ssts-web/src/main/webapp/jasperRtp/departSatisfyReport.jrxml (.../departSatisfyReport.jrxml) (revision 34184) @@ -47,6 +47,7 @@ + @@ -87,9 +88,6 @@ - - - @@ -295,7 +293,7 @@ - + Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r34180 -r34184 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 34180) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 34184) @@ -1239,10 +1239,14 @@ public List getSatisfyDetailDataSource(String startDay, String endDay, String formDefinitionName, String departCoding) throws SQLException, ParseException { List departSatisfyDetailReportBeans = new ArrayList(); - Map map = getAllSuveryDepart(); - if (map != null && map.size() != 0 && StringUtils.isNotBlank(startDay) && StringUtils.isNotBlank(endDay)) { + + out:if (StringUtils.isNotBlank(startDay) && StringUtils.isNotBlank(endDay)) { startDay = startDay + " 00:00:00"; endDay = endDay + " 23:59:59"; + Map map = getAllSuveryDepart(startDay,endDay); + if(MapUtils.isEmpty(map)){ + break out; + } String sql = "where po.satisfactionSurveyTemplateId in " + "(select ti.id from SatisfactionSurveyTemplate ti where ti.name = '" + formDefinitionName @@ -15704,7 +15708,7 @@ } // 清洗区材料类型工作量统计报表 @Override - public List findMaterialTypeWorkloadReportList(String month,String querySupplyRoom){ + public List findMaterialTypeWorkloadReportList(Set instrumentSetTypesSet, String month,String querySupplyRoom){ month = month + "-01"; @@ -15728,7 +15732,7 @@ calendar.add(Calendar.DAY_OF_MONTH, 1); statDate = calendar.getTime(); String endDateStr = sdf.format(statDate); - materialTypeWorkloadReportList(undefinedType, materialTypeSecquenceMap, startDateStr, startDateStr,endDateStr,querySupplyRoom,list); + materialTypeWorkloadReportList(instrumentSetTypesSet, undefinedType, materialTypeSecquenceMap, startDateStr, startDateStr,endDateStr,querySupplyRoom,list); } return list; } @@ -15757,7 +15761,7 @@ return materialTypeSecquenceMap; } @Override - public List findMaterialTypeWorkloadReportListByYear(String queryYear,String querySupplyRoom){ + public List findMaterialTypeWorkloadReportListByYear(Set instrumentSetTypesSet, String queryYear,String querySupplyRoom){ String startYear = queryYear + "-01-01 00:00:00"; String nextYear = DataIndex.getNextYear(queryYear) + " 00:00:00"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -15782,24 +15786,25 @@ calendar.add(Calendar.MONTH, 1); statDate = calendar.getTime(); String endDateStr = sdf.format(statDate); - materialTypeWorkloadReportList(undefinedType, materialTypeSecquenceMap, showStartDateStr,startDateStr,endDateStr,querySupplyRoom,list); + materialTypeWorkloadReportList(instrumentSetTypesSet, undefinedType, materialTypeSecquenceMap, showStartDateStr,startDateStr,endDateStr,querySupplyRoom,list); } return list; } /** * 获取每日清洗数据 + * @param instrumentSetTypesSet 器械包种类id * @param statDate * @param endDate * @return */ - private void materialTypeWorkloadReportList(String UNDEFINED_TYPE, Map materialTypeSecquenceMap, String showStatDate, String statDate,String endDate,String querySupplyRoom,List list){ + private void materialTypeWorkloadReportList(Set instrumentSetTypesSet, String UNDEFINED_TYPE, Map materialTypeSecquenceMap, String showStatDate, String statDate,String endDate,String querySupplyRoom,List list){ ReportQueryParams params = new ReportQueryParams(); params.betweenSql = String.format(" between %s and %s ", dateQueryAdapter.dateConverAdapter2(statDate, "yyyy-mm-dd HH24:MI:SS"), dateQueryAdapter.dateConverAdapter2(endDate, "yyyy-mm-dd HH24:MI:SS")); params.querySupplyRoom = querySupplyRoom; - + String getInstrumentSetTypeSql = CollectionUtils.isEmpty(instrumentSetTypesSet)?"":getInstrumentSetTypeSql(instrumentSetTypesSet); // 按材料类型分类,统计数量 String sql = "select t1.type,sum(t1.amount) from ("; @@ -15810,34 +15815,39 @@ sql += "where wr.id = cw.washanddisinfectrecord_id and cw.classifybasket_id = cb.id "; sql += "and cb.id = ci.classifybasket_id and ci.toussedefinition_id = td.id and td.id = mi.tousse_id and mi.materialdefinition_id = md.id "; sql += "and ci.itemType <> '材料' and wr.washMaterialAmount <> 0 "; - sql += "and wr.enddate " + params.betweenSql ; + sql += "and wr.enddate " + params.betweenSql + getInstrumentSetTypeSql; sql += SqlUtils.get_InSql_Extra("wr.orgUnitCoding", params.querySupplyRoom) + " group by md.type"; sql += " union all "; // 统计拆包清洗的材料件数(主要包括拆包清洗的器械包以及外来器械) sql += "select md.type as type,sum(ci.amount-case when numOfUnwashedStops is null then 0 else numOfUnwashedStops end) as amount from "; - sql += "washanddisinfectrecord wr ,ClassifyBasket_WashRecord cw ,ClassifyBasket cb, ClassifiedItem ci,MaterialDefinition md "; + sql += "washanddisinfectrecord wr ,ClassifyBasket_WashRecord cw ,ClassifyBasket cb, ClassifiedItem ci,TousseDefinition td,MaterialDefinition md "; sql += "where wr.id = cw.washanddisinfectrecord_id and cw.classifybasket_id = cb.id and cb.id = ci.classifybasket_id "; - sql += "and ci.materialdefinition_id = md.id and ci.itemType = '材料' and wr.washMaterialAmount <> 0 and wr.enddate " + params.betweenSql; + sql += "and ci.materialdefinition_id = md.id and ci.itemType = '材料' and ci.toussedefinition_id = td.id and wr.washMaterialAmount <> 0 and wr.enddate " + params.betweenSql + getInstrumentSetTypeSql; sql += SqlUtils.get_InSql_Extra("wr.orgUnitCoding", params.querySupplyRoom) + " group by md.type"; - - // 统计单独登记清洗的材料数量 - sql += " union all "; - sql += String - .format("select md.type type,sum(wrm.amount) amount " - + DataIndex.getWashMaterialAmountSqlFromTousseTypeIsMaterial("") - + "and wr.endDate %s %s group by md.type ", - params.betweenSql, - SqlUtils.get_InSql_Extra("wr.orgUnitCoding", params.querySupplyRoom) - ); + if(CollectionUtils.isEmpty(instrumentSetTypesSet)){ + // 统计单独登记清洗的材料数量 + sql += " union all "; + sql += String + .format("select md.type type,sum(wrm.amount) amount " + + DataIndex.getWashMaterialAmountSqlFromTousseTypeIsMaterial("") + + "and wr.endDate %s %s group by md.type ", + params.betweenSql, + SqlUtils.get_InSql_Extra("wr.orgUnitCoding", params.querySupplyRoom) + ); + } sql += ") t1 group by t1.type"; String likeSql = ""; if (StringUtils.isNotBlank(querySupplyRoom)){ likeSql = SqlUtils.get_LikeSql("fd.departcodes", querySupplyRoom.split(",")); } + if(CollectionUtils.isNotEmpty(instrumentSetTypesSet)){ + likeSql += getInstrumentSetTypeSql; + params.extraJoinCondition = " join TousseDefinition td on td.id=qmd.TousseDefinitionId "; + } params.extraSelectColumns = ",qmd.material"; @@ -26233,11 +26243,13 @@ String month = StrutsParamUtils.getPraramValue("month", ""); String year = StrutsParamUtils.getPraramValue("year", ""); String querySupplyRoom = StrutsParamUtils.getPraramValue("querySupplyRoom", ""); + String instrumentSetTypes = StrutsParamUtils.getPraramValue("instrumentSetTypes", ""); + Set instrumentSetTypesSet = SqlUtils.splitStringToSet(instrumentSetTypes, ","); List list = null; if(StringUtils.isNotBlank(year)){ - list = findMaterialTypeWorkloadReportListByYear(year, querySupplyRoom); + list = findMaterialTypeWorkloadReportListByYear(instrumentSetTypesSet,year, querySupplyRoom); }else if(StringUtils.isNotBlank(month)){ - list = findMaterialTypeWorkloadReportList(month,querySupplyRoom); + list = findMaterialTypeWorkloadReportList(instrumentSetTypesSet,month,querySupplyRoom); }else{ throw new RuntimeException("参数异常,查询时间不能为空"); } @@ -26488,45 +26500,78 @@ return firstColumnVos; } @Override - public List getSatisfyDataSource() throws SQLException, ParseException { + public List getSatisfyDataSource(Map parametMap) throws SQLException, ParseException { List supplyRoomConfigs = supplyRoomConfigManager .getSupplyRoomList(SupplyRoomConfig.SUPPLYROOM_TYPE_APPLY); String startDay = StrutsParamUtils.getPraramValue("startTime", ""); String endDay = StrutsParamUtils.getPraramValue("endTime", ""); + Long satisfactionSurveyTemplateId = StrutsParamUtils.getPraramLongValue("satisfactionSurveyTemplateId", 0L); + String summaryType = StrutsParamUtils.getPraramValue("summaryType", ""); List infos = new ArrayList(); + String summaryOfHospital = "全院汇总"; + String hospitalName = "全院"; Set satisfactionSurveyTemplateIds = new HashSet(); - Map map = getAllSuveryDepart(); - if (map != null && map.size() != 0 && StringUtils.isNotBlank(startDay) && StringUtils.isNotBlank(endDay)) { + out:if (StringUtils.isNotBlank(startDay) && StringUtils.isNotBlank(endDay)) { startDay = startDay + "-01 00:00:00"; endDay = getMonthEndDate(endDay); + Map map = getAllSuveryDepart(startDay,endDay); + if(MapUtils.isEmpty(map)){ + break out; + } Set orgCodeSet = map.keySet(); + int departCount = 0; + if(summaryOfHospital.equals(summaryType)){ + orgCodeSet = new HashSet(); + orgCodeSet.add(summaryOfHospital); + String countSql = "select count(distinct departCoding) from " + SatisfactionSurveyTable.class.getSimpleName() + + " po where po.satisfactionSurveyTemplateId in " + + "(select ti.id from SatisfactionSurveyTemplate ti where ti.entryDate >= " + + dateQueryAdapter.dateAdapter(startDay) + + " and ti.entryDate <= " + + dateQueryAdapter.dateAdapter(endDay) + ")"; + if(DatabaseUtil.isPoIdValid(satisfactionSurveyTemplateId)){ + countSql += " and po.satisfactionSurveyTemplateId=" + satisfactionSurveyTemplateId; + } + departCount = objectDao.countBySql(countSql); + } Map totalScores = new HashMap(); for (String orgCoding : orgCodeSet) { - String sql = "where po.departCoding='" - + orgCoding - + "' and po.satisfactionSurveyTemplateId in " + String sql = "where po.satisfactionSurveyTemplateId in " + "(select ti.id from SatisfactionSurveyTemplate ti where ti.entryDate >= " + dateQueryAdapter.dateAdapter(startDay) + " and ti.entryDate <= " + dateQueryAdapter.dateAdapter(endDay) + ")"; + if(DatabaseUtil.isPoIdValid(satisfactionSurveyTemplateId)){ + sql += " and po.satisfactionSurveyTemplateId=" + satisfactionSurveyTemplateId; + } + if(!summaryOfHospital.equals(summaryType)){ + sql += " and po.departCoding='"+ orgCoding +"'"; + } @SuppressWarnings("unchecked") List list = objectDao.findBySql( SatisfactionSurveyTable.class.getName(), sql); if (!list.isEmpty() && list.size() != 0) { SatisfyInfo info = new SatisfyInfo(); - info.setDepartName(map.get(orgCoding)); - for (SupplyRoomConfig config : supplyRoomConfigs) { - if (StringUtils.equals(orgCoding, - config.getOrgUnitCoding())) { - info.setSequenceNum(config.getSequence()); - break; + if(summaryOfHospital.equals(summaryType)){ + info.setDepartName(hospitalName); + }else{ + for (SupplyRoomConfig config : supplyRoomConfigs) { + if (StringUtils.equals(orgCoding, + config.getOrgUnitCoding())) { + info.setSequenceNum(config.getSequence()); + break; + } } + info.setDepartName(map.get(orgCoding)); + departCount++; } + info.setOrgCoding(orgCoding); generateSatisfyItems(info, list, totalScores, satisfactionSurveyTemplateIds); infos.add(info); } } + parametMap.put("departCount", departCount); Double absSatisfyTotal = null; Double ratherSatisfyTotal = null; Double basicSatisfyTotal = null; @@ -26653,9 +26698,16 @@ * @throws SQLException * 2014-5-28 */ - private Map getAllSuveryDepart() throws SQLException { + private Map getAllSuveryDepart(String startDay, String endDay) throws SQLException { Map map = new HashMap(); - String sql = " select distinct departcoding,DEPART from satisfactionsurveytable order by departCoding"; + String daySql = " where satisfactionSurveyTemplateId in " + + "(select ti.id from SatisfactionSurveyTemplate ti where ti.entryDate >= " + + dateQueryAdapter.dateAdapter(startDay) + + " and ti.entryDate <= " + + dateQueryAdapter.dateAdapter(endDay) + ")"; + String sql = " select distinct departcoding,DEPART from satisfactionsurveytable" + + daySql + + " order by departCoding"; ResultSet rs = objectDao.executeSql(sql); try { while (rs.next()) { Index: ssts-web/src/main/webapp/jasperRtp/departSatisfyReport.jasper =================================================================== diff -u -r26805 -r34184 Binary files differ Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManager.java =================================================================== diff -u -r34155 -r34184 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManager.java (.../JasperReportManager.java) (revision 34155) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManager.java (.../JasperReportManager.java) (revision 34184) @@ -629,15 +629,22 @@ * @return */ public List getMaterialStockReport(String startDate,String endDate,Long materialId,Long warehouseId,String summaryType); - - public List findMaterialTypeWorkloadReportList(String month,String querySupplyRoom); /** + * + * @param instrumentSetTypesSet 器械包种类id + * @param month + * @param querySupplyRoom + * @return + */ + public List findMaterialTypeWorkloadReportList(Set instrumentSetTypesSet, String month,String querySupplyRoom); + /** * 获取清洗区材料类型工作量统计报表年份数据 + * @param instrumentSetTypesSet 器械包种类id * @param queryYear 查询年份 * @param querySupplyRoom 供应室编码 * @return */ - public List findMaterialTypeWorkloadReportListByYear(String queryYear,String querySupplyRoom); + public List findMaterialTypeWorkloadReportListByYear(Set instrumentSetTypesSet, String queryYear,String querySupplyRoom); /** * 获取"外来器械包的植入物和植入型器械灭菌监测及发放报表"的javabean * @param startTime 开始时间 @@ -1204,11 +1211,12 @@ public List packingRecordReportDate(JSONObject paramObj); /** * 获取满意度调查汇总报表数据 + * @param parametMap 参数map * @return * @throws SQLException * @throws ParseException */ - public List getSatisfyDataSource() throws SQLException, ParseException; + public List getSatisfyDataSource(Map parametMap) throws SQLException, ParseException; /** * 外来器械包供应商统计报表 * @param startDate