Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r35929 -r35930 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 35929) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 35930) @@ -2302,178 +2302,6 @@ return washReportHelper.findMaterialTypeWorkloadReportListByYear(instrumentSetTypesSet, queryYear, querySupplyRoom); } /** - * 获取器械包处理总件数map - * @param year - * @param departCoding - * @return - */ - public Map getGeneralMaterialMap(String year,String departCoding){ - if (StringUtils.isNotBlank(year)){ - try{ - Map rsMap = new HashMap(); - String startTime = year+ "-01-01 00:00:00"; - String endTime = DataIndex.getNextYear(year) + " 00:00:00"; - String sql = "select distinct po from " + ClassifyBasket.class.getSimpleName() - + " po inner join fetch po.classfiedItems ci inner join fetch ci.tousseDefinition citd inner join fetch citd.materialInstances left join po.washAndDisinfectRecords wr where wr is not null" - + " and po.containerName in (select containerName from Container where departCode = '" + departCoding + "' )" - + " and po.recyclingTime between " + dateQueryAdapter.dateAdapter(startTime) - + " and " + dateQueryAdapter.dateAdapter(endTime) ; - List baskets = objectDao.findByHql(sql); - String washRecordSql = "select distinct po from " + WashAndDisinfectRecord.class.getSimpleName() - + " po inner join fetch po.washAndDisinfectMaterials where po.orgUnitCoding = '" + departCoding + "'" - + " and po.endDate between " + dateQueryAdapter.dateAdapter(startTime) - + " and " + dateQueryAdapter.dateAdapter(endTime) ; - List washRecords = objectDao.findByHql(washRecordSql); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - for (int i = 1; i <= 12; i++) { - String mm = ""; - if (i > 9) { - mm = "" + i; - } else { - mm = "0" + i; - } - startTime = year + "-" + mm + "-01 00:00:00"; - endTime = DateTools.getNextMonth(year,mm) + " 00:00:00"; - Date starDate = sdf.parse(startTime); - Date endDate = sdf.parse(endTime); - int totalAmount = 0; - int basketMaterialAmount = 0; - if(baskets != null && baskets.size()>0){ - for(ClassifyBasket cb : baskets){ - Date dt = cb.getRecyclingTime(); - if(dt != null){ - if(starDate.before(dt) && endDate.after(dt)){ - basketMaterialAmount += getMaterialsAmount(cb); - } - } - } - } - // 不入框清洗的材料 - int washMaterialAmount = 0; - if(washRecords != null && washRecords.size()>0){ - for(WashAndDisinfectRecord wr : washRecords){ - Date dt = wr.getEndDate(); - if(dt != null){ - if(starDate.before(dt) && endDate.after(dt)){ - washMaterialAmount += getMaterialsAmount(wr); - } - } - } - } - totalAmount = basketMaterialAmount + washMaterialAmount; - // 插入一个月的统计数量 - rsMap.put(mm, totalAmount); - } - return rsMap; - }catch(Exception e){ - e.printStackTrace(); - } - } - return null; - } - // 获取未入框清洗的材料 - public int getMaterialsAmount(WashAndDisinfectRecord wr){ - if(wr == null) - return 0; - int amount = 0; - for(WashAndDisinfectRecordMaterial wm : wr.getWashAndDisinfectMaterials()){ - amount += wm.getAmount(); - } - return amount; - } - public int getMaterialsAmount(ClassifyBasket cb){ - if( cb == null) - return 0; - int amount = 0; - for(ClassifiedItem item : cb.getClassfiedItems()){ - if(ClassifiedItem.TYPE_FOREIGN_TOUSSE.equals(item.getItemType())){ - // 外来器械包不统计 - continue; - } - if(item.itemTypeMaterial()) - { - amount += item.getAmount(); - }else{ - // 器械包里面材料数量 - int materialAmount = 0; - TousseDefinition td = item.getTousseDefinition(); - List mis = new ArrayList(); - // 辅料包不统计 - if(td != null && !TousseDefinition.PACKAGE_TYPE_DRESSING.equals(td.getPackageType()) ){ - mis = td.getMaterialInstances(); - } - for(MaterialInstance mi : mis){ - materialAmount += mi.getCount(); - } - amount += item.getAmount() * materialAmount; - } - } - return amount; - } - public Map getForeignMaterialMap(String year,String departCoding){ - if (StringUtils.isNotBlank(year)){ - Map rsMap = new HashMap(); - for (int i = 1; i <= 12; i++) { - String mm = ""; - if (i > 9) { - mm = "" + i; - } else { - mm = "0" + i; - } - String startTime = year + "-" + mm + "-01 00:00:00"; - String endTime = DateTools.getNextMonth(year,mm) + " 00:00:00"; - String sql = "select distinct po from " + ClassifyBasket.class.getSimpleName() - + " po inner join fetch po.classfiedItems ci inner join fetch ci.materialDefinition cimd inner join fetch ci.tousseDefinition citd inner join fetch citd.materialInstances " - + " left join po.washAndDisinfectRecords wr where wr is not null" - + " and po.containerName in (select containerName from Container where departCode = '" + departCoding + "' )" - + " and po.recyclingTime between " + dateQueryAdapter.dateAdapter(startTime) - + " and " + dateQueryAdapter.dateAdapter(endTime) ; - List baskets = objectDao.findByHql(sql); - int basketMaterialAmount = 0; - if(baskets != null && baskets.size()>0){ - for(ClassifyBasket cb : baskets){ - basketMaterialAmount += getForeignMaterialsAmount(cb); - } - } - // 插入一个月的统计数量 - rsMap.put(mm, basketMaterialAmount); - } - return rsMap; - } - return null; - } - - public int getForeignMaterialsAmount(ClassifyBasket cb){ - if( cb == null) - return 0; - int amount = 0; - for(ClassifiedItem item : cb.getClassfiedItems()){ - if(ClassifiedItem.TYPE_FOREIGN_TOUSSE.equals(item.getItemType())){ - int materialAmount = 0; - TousseDefinition td = item.getTousseDefinition(); - List mis = new ArrayList(); - if(td != null){ - mis = td.getMaterialInstances(); - } - for(MaterialInstance mi : mis){ - materialAmount += mi.getCount(); - } - amount += item.getAmount() * materialAmount; - }else if(item.itemTypeMaterial()) - { - MaterialDefinition materialDefinition = item.getMaterialDefinition(); - if( materialDefinition != null){ - String isForeignMaterial = materialDefinition.getIsForeignMaterial(); - if(isForeignMaterial != null && isForeignMaterial.equals("是")){ - // 是外来器械材料,需要统计 - amount += item.getAmount(); - } - } - } - } - return amount; - } - /** * 获取"外来器械包的植入物和植入型器械灭菌监测及发放报表"的javabean * @param startTime 开始时间 * @param endTime 结束时间