Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/dataindex/WorkQualityCollectionDataIndex.java =================================================================== diff -u -r33141 -r33190 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/dataindex/WorkQualityCollectionDataIndex.java (.../WorkQualityCollectionDataIndex.java) (revision 33141) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/dataindex/WorkQualityCollectionDataIndex.java (.../WorkQualityCollectionDataIndex.java) (revision 33190) @@ -11,6 +11,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + +import net.sf.json.JSONObject; + import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -345,6 +348,14 @@ WorkQualityCollection bean = new WorkQualityCollection(); int dataSoureOfMaterialsCountOfToussesInReports = CssdUtils.getSystemSetConfigByNameInt("dataSoureOfMaterialsCountOfToussesInReports", 3); + String statisticTousseWorkLoadIncludeDisposableGoodsAmountStr = CssdUtils.getSystemSetConfigByName("statisticTousseWorkLoadIncludeDisposableGoodsAmount"); + boolean includeDisposableGoodsInTousse = true; + if(StringUtils.isNotBlank(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr)){ + JSONObject statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = JSONObject.fromObject(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr); + if(statisticTousseWorkLoadIncludeDisposableGoodsAmountObj != null){ + includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("装配", true); + } + } for (String key : startAndEndDays.keySet()) { String startDay = null; String endDay = null; @@ -364,7 +375,7 @@ params.tousseTypeAndPackageSizeSql = DataIndex .getTousseTypesAndPackageSizesFilterSQL( TousseDefinition.PACKAGE_TYPE_DRESSING, null); - + params.includeDisposableGoodsInTousse = includeDisposableGoodsInTousse; String sql = String.format("select sum(tl.amount) amount from (" +dataIndex.getWorkAmountByMaterialSQL("配包数量", params, dataSoureOfMaterialsCountOfToussesInReports) + ") tl "); @@ -401,6 +412,14 @@ reportParams.includeDisposableGoods = true; reportParams.isQueryCom = true; int dataSoureOfMaterialsCountOfToussesInReports = CssdUtils.getSystemSetConfigByNameInt("dataSoureOfMaterialsCountOfToussesInReports", 3); + + String statisticTousseWorkLoadIncludeDisposableGoodsAmountStr = CssdUtils.getSystemSetConfigByName("statisticTousseWorkLoadIncludeDisposableGoodsAmount"); + if(StringUtils.isNotBlank(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr)){ + JSONObject statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = JSONObject.fromObject(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr); + if(statisticTousseWorkLoadIncludeDisposableGoodsAmountObj != null){ + reportParams.includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("装配", true); + } + } String sql = "select monthstr,sum(tl.amount) from (" + dataIndex.getWorkAmountByMaterialSQL("年度报表中的配包数量(按材料)", reportParams,dataSoureOfMaterialsCountOfToussesInReports) + ") tl group by monthstr "; @@ -724,6 +743,13 @@ WorkQualityCollection bean = new WorkQualityCollection(); int dataSoureOfMaterialsCountOfToussesInReports = CssdUtils.getSystemSetConfigByNameInt("dataSoureOfMaterialsCountOfToussesInReports", 3); + String statisticTousseWorkLoadIncludeDisposableGoodsAmountStr = CssdUtils.getSystemSetConfigByName("statisticTousseWorkLoadIncludeDisposableGoodsAmount"); + JSONObject statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = null; + boolean includeDisposableGoodsInTousse = true; + if(StringUtils.isNotBlank(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr)){ + statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = JSONObject.fromObject(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr); + includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("装配", true); + } for (String key : startAndEndDays.keySet()) { String startDay = null; String endDay = null; @@ -738,7 +764,7 @@ dateQueryAdapter.dateAdapter(endDay)); params.querySupplyRoom = querySupplyRoom; params.sqlLengthFunctionName = DatabaseUtil.getSqlLengthFunctionName(dbConnection); - + params.includeDisposableGoodsInTousse = includeDisposableGoodsInTousse; String sql = String.format("select sum(tl.amount) amount from (" +dataIndex.getWorkAmountByMaterialSQL("配包数量", params,dataSoureOfMaterialsCountOfToussesInReports) + ") tl "); @@ -773,6 +799,15 @@ reportParams.includeDisposableGoods = true; reportParams.isQueryCom = true; int dataSoureOfMaterialsCountOfToussesInReports = CssdUtils.getSystemSetConfigByNameInt("dataSoureOfMaterialsCountOfToussesInReports", 3); + String statisticTousseWorkLoadIncludeDisposableGoodsAmountStr = CssdUtils.getSystemSetConfigByName("statisticTousseWorkLoadIncludeDisposableGoodsAmount"); + boolean includeDisposableGoodsInTousse = true; + if(StringUtils.isNotBlank(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr)){ + JSONObject statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = JSONObject.fromObject(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr); + if(statisticTousseWorkLoadIncludeDisposableGoodsAmountObj != null){ + includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("装配", true); + } + } + reportParams.includeDisposableGoodsInTousse = includeDisposableGoodsInTousse; String sql = "select monthstr,sum(tl.amount) from (" + dataIndex.getWorkAmountByMaterialSQL("年度报表中的配包数量(按材料)", reportParams,dataSoureOfMaterialsCountOfToussesInReports) + ") tl group by monthstr "; Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/reportforms/vo/ReportQueryParams.java =================================================================== diff -u -r32583 -r33190 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/reportforms/vo/ReportQueryParams.java (.../ReportQueryParams.java) (revision 32583) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/reportforms/vo/ReportQueryParams.java (.../ReportQueryParams.java) (revision 33190) @@ -90,6 +90,10 @@ public boolean includeDisposableGoods = false; /** + * 是否包含包内的一次性物品,默认为false + */ + public boolean includeDisposableGoodsInTousse = false; + /** * 是否统计值为NULL的用户,默认不统计 */ public boolean includeNullUser = false; Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r33150 -r33190 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 33150) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 33190) @@ -898,6 +898,11 @@ reportParams.includeDisposableGoods = true; reportParams.isQueryCom = true; reportParams.monthlyStr = dateQueryAdapter.dateConverAdapter3("ti.operationTime","mm"); + String statisticTousseWorkLoadIncludeDisposableGoodsAmountStr = CssdUtils.getSystemSetConfigByName("statisticTousseWorkLoadIncludeDisposableGoodsAmount"); + if(StringUtils.isNotBlank(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr)){ + JSONObject statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = JSONObject.fromObject(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr); + reportParams.includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("装配", true); + } int dataSoureOfMaterialsCountOfToussesInReports = CssdUtils.getSystemSetConfigByNameInt("dataSoureOfMaterialsCountOfToussesInReports", 3); String sql = dataIndex.getWorkAmountByMaterialSQL("年度报表中的配包数量(按材料)", reportParams,dataSoureOfMaterialsCountOfToussesInReports); @@ -8604,8 +8609,11 @@ params.selectUserName = true; params.taskGroupSqlWithAliasOfTousseDefinitionIsTd = SqlUtils.get_InSql_Extra("td.taskGroup", taskGroup); params.isGroup = true; - - + String statisticTousseWorkLoadIncludeDisposableGoodsAmountStr = CssdUtils.getSystemSetConfigByName("statisticTousseWorkLoadIncludeDisposableGoodsAmount"); + JSONObject statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = null; + if(StringUtils.isNotBlank(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr)){ + statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = JSONObject.fromObject(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr); + } //按包数量统计的SQL //回收记录 String tousseAmountSql = String.format("select '预回收数量' type,tl.userName,sum(tl.amount) amount from (" @@ -8775,7 +8783,9 @@ materialAmountSql += s; materialAmountSql += "union all "; - + if(statisticTousseWorkLoadIncludeDisposableGoodsAmountObj !=null){ + params.includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("装配", true); + } //装配记录(配包数量) materialAmountSql += String.format("select '配包数量' type,tl.userName,sum(tl.amount) amount from (" +dataIndex.getWorkAmountByMaterialSQL("配包数量", params, dataSoureOfMaterialsCountOfToussesInReports) @@ -8800,15 +8810,19 @@ } materialAmountSql += "union all "; - + if(statisticTousseWorkLoadIncludeDisposableGoodsAmountObj !=null){ + params.includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("审核", true); + } //审核记录 String reviewAmountByMaterialSql = String.format("select '审核数量' type,tl.userName,sum(tl.amount) amount from (" +dataIndex.getWorkAmountByMaterialSQL("审核数量", params, dataSoureOfMaterialsCountOfToussesInReports) + ") tl group by tl.userName "); materialAmountSql += reviewAmountByMaterialSql; - + if(statisticTousseWorkLoadIncludeDisposableGoodsAmountObj !=null){ + params.includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("灭菌", true); + } materialAmountSql += " union all "; materialAmountSql += String.format("select '灭菌数量' type,tl.userName,sum(tl.amount) amount from (" @@ -8818,6 +8832,9 @@ // 包含一次性物品的发货统计 params.includeDisposableGoods = false; + if(statisticTousseWorkLoadIncludeDisposableGoodsAmountObj !=null){ + params.includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("发货", false); + } params.extraSelectColumns = ",i.sender userName"; params.groupBySql = " group by i.sender " ; materialAmountSql += String.format("select '发货数量' type,tl.userName,sum(tl.amount) amount from (" @@ -12150,6 +12167,11 @@ params.showAsTousseSplitAmount = showAsTousseSplitAmount; params.isGroup = true; params.applicationDepart = applicationDepart; + String statisticTousseWorkLoadIncludeDisposableGoodsAmountStr = CssdUtils.getSystemSetConfigByName("statisticTousseWorkLoadIncludeDisposableGoodsAmount"); + JSONObject statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = null; + if(StringUtils.isNotBlank(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr)){ + statisticTousseWorkLoadIncludeDisposableGoodsAmountObj = JSONObject.fromObject(statisticTousseWorkLoadIncludeDisposableGoodsAmountStr); + } //如果科室分组id不为空时,按科室分组进行过滤 if(StringUtils.isNotBlank(groupIds)){ Collection deptCodes = null; @@ -12224,7 +12246,9 @@ + ") tl group by tl.tousseType,tl.tousseName "); sql += packingSql; querySqlList.add(packingSql); - + if(statisticTousseWorkLoadIncludeDisposableGoodsAmountObj !=null){ + params.includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("装配", true); + } //装配数量(按材料统计) sql += " union all "; String packingMaterialSql = String.format("select 'packing-material' type,tl.tousseName,sum(tl.amount) amount ,tl.tousseType from (" @@ -12267,6 +12291,9 @@ //发货数量(按材料数量统计) sql += " union all "; + if(statisticTousseWorkLoadIncludeDisposableGoodsAmountObj !=null){ + params.includeDisposableGoodsInTousse = statisticTousseWorkLoadIncludeDisposableGoodsAmountObj.optBoolean("发货", false); + } params.extraSelectColumns = " ,td.name tousseName,td.tousseType"; params.groupBySql = " group by td.name,td.tousseType"; String invoiceMaterialSql = String.format("select 'invoice-material' type,tl.tousseName,sum(tl.amount) amount,tl.tousseType from (" Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/dataindex/DataIndex.java =================================================================== diff -u -r33091 -r33190 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/dataindex/DataIndex.java (.../DataIndex.java) (revision 33091) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/dataindex/DataIndex.java (.../DataIndex.java) (revision 33190) @@ -618,10 +618,14 @@ break; case "配包数量": if(dataSoureOfMaterialsCountOfToussesInReports == 3){ + String queryDisposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + queryDisposableGoodAmountSql = " + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + } if(obj.showAsTousseSplitAmount){ - amountColumnSql = "case when ti.materialSplitAmount is null then 0 else ti.materialSplitAmount end + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end"; + amountColumnSql = "case when ti.materialSplitAmount is null then 0 else ti.materialSplitAmount end " + queryDisposableGoodAmountSql; }else{ - amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end"; + amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end " + queryDisposableGoodAmountSql; } joinMaterialInstanceSql = ""; }else{ @@ -735,10 +739,14 @@ case "年度报表中的配包数量(按材料)": if(dataSoureOfMaterialsCountOfToussesInReports == 3){ + String disposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + disposableGoodAmountSql = " + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + } if(obj.showAsTousseSplitAmount){ - amountColumnSql = "case when ti.materialSplitAmount is null then 0 else ti.materialSplitAmount end + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end"; + amountColumnSql = "case when ti.materialSplitAmount is null then 0 else ti.materialSplitAmount end " + disposableGoodAmountSql; }else{ - amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end"; + amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end " + disposableGoodAmountSql; } joinMaterialInstanceSql = ""; }else{ @@ -813,7 +821,11 @@ break; case "检查数量": if(dataSoureOfMaterialsCountOfToussesInReports == 3){ - amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end"; + String queryDisposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + queryDisposableGoodAmountSql = " + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + } + amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end " + queryDisposableGoodAmountSql; joinMaterialInstanceSql = ""; }else{ amountColumnSql = "mi.count"; @@ -884,7 +896,11 @@ case "包装数量": if(dataSoureOfMaterialsCountOfToussesInReports == 3){ - amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end"; + String queryDisposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + queryDisposableGoodAmountSql = " + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + } + amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end " + queryDisposableGoodAmountSql; joinMaterialInstanceSql = ""; }else{ amountColumnSql = "mi.count"; @@ -923,7 +939,11 @@ case "审核数量": if(dataSoureOfMaterialsCountOfToussesInReports == 3){ - amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end"; + String queryDisposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + queryDisposableGoodAmountSql = " + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + } + amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end " + queryDisposableGoodAmountSql; joinMaterialInstanceSql = ""; }else{ amountColumnSql = "mi.count"; @@ -968,7 +988,11 @@ break; case "灭菌数量": if(dataSoureOfMaterialsCountOfToussesInReports == 3){ - amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end"; + String queryDisposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + queryDisposableGoodAmountSql = " + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + } + amountColumnSql = "case when ti.materialAmount is null then 0 else ti.materialAmount end " + queryDisposableGoodAmountSql; joinMaterialInstanceSql = ""; }else{ amountColumnSql = "mi.count"; @@ -1041,13 +1065,40 @@ obj.tousseGroupSqlWithAliasOfTousseDefinitionIsTd, obj.tousseTypeAndPackageSizeSql, obj.groupBySql); + String queryDisposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + queryDisposableGoodAmountSql = " case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + amountSql += String + .format(" union all select sum(%s) amount %s " + + "from Invoice i inner join TousseInstance ti on ti.invoice_id = i.id inner join TousseDefinition td on ti.tousseDefinition_id = td.id " + + " %s where ti.comboTousseInstanceId is null and ti.comboTousseDefinitionId is null and i.sendTime %s %s %s and %s %s %s " + + "and i.sender is not null and %s(i.sender)<>0 %s %s %s %s", + queryDisposableGoodAmountSql, + obj.extraSelectColumns, + joinMaterialInstanceSql, + obj.betweenSql, + SqlUtils.get_InSql_Extra("i.orgUnitCoding", obj.querySupplyRoom), + SqlUtils.get_InSql_Extra("i.depart", obj.applicationDepart), + SqlUtils.getStringFieldInLargeCollectionsPredicate("i.depart", obj.recyDepartGroup, " 1=1 "), + obj.sterilizationModeSqlWithAliasOfTousseDefinitionIsTd, + obj.packageTypeSqlWithAliasOfTousseDefinitionIsTd, + obj.sqlLengthFunctionName, + obj.isDisableIDCardSqlWithAliasOfTousseDefinitionIsTd, + obj.taskGroupSqlWithAliasOfTousseDefinitionIsTd.replaceAll("td", "ti"), + obj.tousseGroupSqlWithAliasOfTousseDefinitionIsTd, + obj.groupBySql); + } } if(obj.getIsQueryCom()){ if(!obj.getIsOnlyQueryComboTousse()){ amountSql += " union all "; } + String queryDisposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + queryDisposableGoodAmountSql = " + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + } if(dataSoureOfMaterialsCountOfToussesInReports == 3){ - miCountSql = "ti.materialAmount"; + miCountSql = "ti.materialAmount" + queryDisposableGoodAmountSql; joinMaterialInstanceSql = ""; }else{ miCountSql = "mi.count"; @@ -1139,7 +1190,11 @@ case "核对数量": if(dataSoureOfMaterialsCountOfToussesInReports == 3){ - amountColumnSql = "ti.materialAmount"; + String queryDisposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + queryDisposableGoodAmountSql = " + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + } + amountColumnSql = "ti.materialAmount" + queryDisposableGoodAmountSql; joinMaterialInstanceSql = ""; }else{ amountColumnSql = "mi.count"; @@ -1164,7 +1219,7 @@ // 一次性物品的发货核对统计 if (obj.includeDisposableGoods){ amountSql += " union all "; - amountSql = String + amountSql += String .format("select sum(ii.amount) amount ,i.assistantSender userName " + "from Invoice i inner join InvoiceItem ii on ii.invoice_id = i.id " + "where ii.tousseType = '一次性物品' and i.sendTime %s %s " @@ -1198,7 +1253,11 @@ case "下送数量": if(dataSoureOfMaterialsCountOfToussesInReports == 3){ - amountColumnSql = "ti.materialAmount"; + String queryDisposableGoodAmountSql = ""; + if(obj.includeDisposableGoodsInTousse){ + queryDisposableGoodAmountSql = " + case when ti.disposableGoodAmount is null then 0 else ti.disposableGoodAmount end "; + } + amountColumnSql = "ti.materialAmount" + queryDisposableGoodAmountSql; joinMaterialInstanceSql = ""; }else{ amountColumnSql = "mi.count"; @@ -1224,7 +1283,7 @@ // 一次性物品的发货下送数量统计 if (obj.includeDisposableGoods){ amountSql += " union all "; - amountSql = String + amountSql += String .format("select sum(ii.amount) amount ,i.personInCharge userName " + "from Invoice i inner join InvoiceItem ii on ii.invoice_id = i.id " + "where ii.tousseType = '一次性物品' and i.sendTime %s %s "