Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r15111 -r15136 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 15111) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 15136) @@ -6036,7 +6036,7 @@ } } }else if(TousseDefinition.PACKAGE_TYPE_CUSTOM.equals(tousseTypeName)&& !showCustonTousseAmount){ - tousseAmount = Double.valueOf(getDisinfectGoodsStatisticAmount(tousseName,"" + invoicePlanId)); + tousseAmount = tousseAmount*getDisinfectGoodsStatisticAmount(tousseName,"" + invoicePlanId); } if(tousseAmount > 0){ newMonthReport(code, dept,"2","数量统计", "器械包数量",tousseAmount,list); @@ -6173,6 +6173,7 @@ departCoding = AcegiHelper.getCurrentOrgUnitCode(); } List datas = new ArrayList(); + List allTousseType = getTousseTypes(typeSearch); startTime += " 00:00:00"; endTime += " 23:59:59"; @@ -6288,54 +6289,74 @@ if (StringUtils.isNotBlank(typeSearch)) { if ("全部器械包".equals(typeSearch)) { - typeFilterSql = " and ii.tousseType != '一次性物品'"; + typeFilterSql = " and ii.diposable = '否'"; returnGoodsFilterSql += " and rr.type = '器械包'"; supplyRoomDiposableGoodsFilterSql += " and 1=2"; outEntryFilterSql += " and 1=2"; + lostMaterialFilterSql += " and 1=2 "; + damageFilterSql += " and 1=2 "; + returnGoodsItemPredicate = String.format(" ri.tousseDefinition_id in (select id from TousseDefinition where %s) ", SqlUtils.getStringFieldInCollectionsPredicate("tousseType", allTousseType)); }else if("器械包".equals(typeSearch)) { typeFilterSql = " and ii.tousseType = '" + TousseDefinition.PACKAGE_TYPE_INSIDE + "'"; returnGoodsFilterSql += " and rr.type = '器械包'"; supplyRoomDiposableGoodsFilterSql += " and 1=2"; outEntryFilterSql += " and 1=2"; + lostMaterialFilterSql += " and 1=2 "; + damageFilterSql += " and 1=2 "; + returnGoodsItemPredicate = String.format(" ri.tousseDefinition_id in (select id from TousseDefinition where %s) ", SqlUtils.getStringFieldInCollectionsPredicate("tousseType", allTousseType)); }else if("敷料包".equals(typeSearch)){ typeFilterSql = " and ii.tousseType = '" + TousseDefinition.PACKAGE_TYPE_DRESSING + "'"; - returnGoodsFilterSql += " and rr.type = '敷料包'"; + returnGoodsFilterSql += " and rr.type = '器械包'"; supplyRoomDiposableGoodsFilterSql += " and 1=2"; outEntryFilterSql += " and 1=2"; + lostMaterialFilterSql += " and 1=2 "; + damageFilterSql += " and 1=2 "; + returnGoodsItemPredicate = String.format(" ri.tousseDefinition_id in (select id from TousseDefinition where %s) ", SqlUtils.getStringFieldInCollectionsPredicate("tousseType", allTousseType)); } else if ("消毒物品".equals(typeSearch)) { typeFilterSql = " and ii.tousseType = '" + TousseDefinition.PACKAGE_TYPE_DISINFECTION + "'"; - returnGoodsFilterSql += " and rr.type = '消毒物品'"; + returnGoodsFilterSql += " and rr.type = '器械包'"; supplyRoomDiposableGoodsFilterSql += " and 1=2"; outEntryFilterSql += " and 1=2"; + lostMaterialFilterSql += " and 1=2 "; + damageFilterSql += " and 1=2 "; + returnGoodsItemPredicate = String.format(" ri.tousseDefinition_id in (select id from TousseDefinition where %s) ", SqlUtils.getStringFieldInCollectionsPredicate("tousseType", allTousseType)); } else if ("外来器械包".equals(typeSearch)) { typeFilterSql = " and (ii.tousseType = '" + TousseDefinition.PACKAGE_TYPE_FOREIGN + "' or ii.tousseType = '" + TousseDefinition.PACKAGE_TYPE_SPLIT + "') "; - returnGoodsFilterSql += " and rr.type = '外来器械包'"; + returnGoodsFilterSql += " and rr.type = '器械包'"; supplyRoomDiposableGoodsFilterSql += " and 1=2"; outEntryFilterSql += " and 1=2"; + lostMaterialFilterSql += " and 1=2 "; + damageFilterSql += " and 1=2 "; + returnGoodsItemPredicate = String.format(" ri.tousseDefinition_id in (select id from TousseDefinition where %s) ", SqlUtils.getStringFieldInCollectionsPredicate("tousseType", allTousseType)); } else if ("自定义器械包".equals(typeSearch)) { typeFilterSql = " and ii.tousseType = '" + TousseDefinition.PACKAGE_TYPE_CUSTOM + "'"; - returnGoodsFilterSql += " and rr.type = '自定义器械包'"; + returnGoodsFilterSql += " and rr.type = '器械包'"; supplyRoomDiposableGoodsFilterSql += " and 1=2"; outEntryFilterSql += " and 1=2"; + lostMaterialFilterSql += " and 1=2 "; + damageFilterSql += " and 1=2 "; + returnGoodsItemPredicate = String.format(" ri.tousseDefinition_id in (select id from TousseDefinition where %s) ", SqlUtils.getStringFieldInCollectionsPredicate("tousseType", allTousseType)); } else if ("外部代理灭菌包".equals(typeSearch)) { typeFilterSql = " and ii.tousseType = '" + TousseDefinition.PACKAGE_TYPE_FOREIGNPROXY + "'"; - returnGoodsFilterSql += " and rr.type = '外部器械包'"; + returnGoodsFilterSql += " and rr.type = '器械包'"; lostMaterialFilterSql += " and 1=2 "; damageFilterSql += " and 1=2 "; + damageFilterSql += " and 1=2 "; supplyRoomDiposableGoodsFilterSql += " and 1=2"; outEntryFilterSql += " and 1=2"; + returnGoodsItemPredicate = String.format(" ri.tousseDefinition_id in (select id from TousseDefinition where %s) ", SqlUtils.getStringFieldInCollectionsPredicate("tousseType", allTousseType)); } else if ("一次性物品".equals(typeSearch)) { typeFilterSql = " and ii.tousseType = '一次性物品'"; returnGoodsFilterSql += " and rr.type = '一次性物品'"; @@ -6444,6 +6465,7 @@ } String caseSql = " CASE ii.tousseType WHEN '消毒物品' THEN (ii.tousseName + '_' + cast(ii.invoicePlanID as varchar)) WHEN '自定义器械包' THEN (ii.tousseName + '_' + cast(ii.invoicePlanID as varchar)) ELSE ii.tousseName END "; + String returnGoodsTousseType = " CASE rr.type WHEN '一次性物品' THEN (rr.type) WHEN '器械包' THEN (td.toussetype) ELSE rr.type END "; String dbName = dbConnection.getDatabase(); if (dbConnection.isOracle()) { caseSql = " CASE ii.tousseType WHEN '消毒物品' THEN (ii.tousseName || '_' || ii.invoicePlanID) WHEN '自定义器械包' THEN (ii.tousseName || '_' || ii.invoicePlanID) ELSE ii.tousseName END "; @@ -6512,11 +6534,14 @@ //退货 String returnGoodsSql = " union all (select rr.depart as settleaccountsdepart,ri.toussename as name," - + "-sum(ri.amount) as amount,-sum(ri.settlementPrice) as settlementprice,rr.type as type" - + ",ri.batchNumber from returngoodsrecord rr,returngoodsitem ri where rr.id = ri.returngoodsrecord_id and "+getHandleDeptCodeSql("rr.handleDepartCode")+" " + + "-sum(ri.amount) as amount,-sum(ri.settlementPrice) as settlementprice,"+returnGoodsTousseType+" as type" + + ",ri.batchNumber from " + ReturnGoodsRecord.class.getSimpleName() + " rr inner join " + + ReturnGoodsItem.class.getSimpleName()+ " ri on rr.id = ri.returngoodsrecord_id " + + " left join " + TousseDefinition.class.getSimpleName() + " td on td.id = ri.tousseDefinition_id" + + " where " + getHandleDeptCodeSql("rr.handleDepartCode")+" " + returnGoodsFilterSql +" and "+returnGoodsItemPredicate - + " group by rr.depart,ri.toussename,rr.type,ri.batchNumber) "; + + " group by rr.depart,ri.toussename,"+returnGoodsTousseType+",ri.batchNumber) "; String lostMaterial = " union all (select r.depart,r.materialName,sum(r.additionalAmount),sum(r.additionalAmount * r.materialCost),'材料' as type,'' " + " from RecyclingError r,materialDefinition m where r.materialDefinitionId = m.id and r.errorType = '缺失' and r.materialName != '器械包标识牌' and r.additionalAmount > 0 and "+getHandleDeptCodeSql("r.handleDepartCode")+" " @@ -6554,7 +6579,7 @@ - if ("器械包".equals(typeSearch) || "全部".equals(typeSearch) || typeSearch == null || "全部器械包".equals(typeSearch) || "高值耗材".equals(typeSearch)) { + if ("器械包".equals(typeSearch) || "器械材料".equals(typeSearch) || "全部".equals(typeSearch) || typeSearch == null || "全部器械包".equals(typeSearch) || "高值耗材".equals(typeSearch)) { sql += lostMaterial; sql += damageMaterial; }