Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java =================================================================== diff -u -r32069 -r32082 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 32069) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 32082) @@ -60,12 +60,14 @@ import com.forgon.disinfectsystem.entity.basedatamanager.container.Container; import com.forgon.disinfectsystem.entity.basedatamanager.departmentapplicationtemplate.DepartmentAppTemplate; import com.forgon.disinfectsystem.entity.basedatamanager.departmentapplicationtemplate.TousseDefinitionTemplateItem; +import com.forgon.disinfectsystem.entity.basedatamanager.imagefilemanager.ImageFile; import com.forgon.disinfectsystem.entity.basedatamanager.materialdefinition.MaterialDefinition; import com.forgon.disinfectsystem.entity.basedatamanager.materialinstance.MaterialInstance; import com.forgon.disinfectsystem.entity.basedatamanager.reportoption.GoodsOption; import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig; import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition; import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseInstance; +import com.forgon.disinfectsystem.entity.basedatamanager.videomanager.VideoFile; import com.forgon.disinfectsystem.entity.becleanitem.ClassifiedItem; import com.forgon.disinfectsystem.entity.becleanitem.ClassifyBasket; import com.forgon.disinfectsystem.entity.foreigntousseapplication.ForeignTousseApplication; @@ -1438,9 +1440,51 @@ fromTime = dateQueryAdapter.dateAdapter(fromTime); toTime = dateQueryAdapter.dateAdapter(toTime); - + String taskGroups = StrutsParamUtils.getPraramValue("taskGroups",""); + String tousseGroupIds = StrutsParamUtils.getPraramValue("tousseGroupIds",""); + String recyDepartmentGroupDepartCodes = StrutsParamUtils.getPraramValue("recyDepartmentGroupDepartCodes",""); + String taskGroupsSql = null; + if(StringUtils.isNotBlank(taskGroups) && !taskGroups.contains("全部")){ + taskGroupsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.taskGroup", taskGroups, ","); + }else{ + taskGroupsSql = ""; + } + String tousseGroupIdsSql = null; + if(StringUtils.isNotBlank(tousseGroupIds) && !tousseGroupIds.contains("-1")){ + tousseGroupIdsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.tousseGroupID", tousseGroupIds, ","); + }else{ + tousseGroupIdsSql = ""; + } + String tdSql = taskGroupsSql + tousseGroupIdsSql; + String orgUnitCodingSql = ""; + if(StringUtils.isNotBlank(recyDepartmentGroupDepartCodes)){ + if(recyDepartmentGroupDepartCodes.contains("all") || recyDepartmentGroupDepartCodes.contains("全部")){ + List departmentGroups = objectDao.findAllObjects(DepartmentGroup.class.getSimpleName()); + if(CollectionUtils.isNotEmpty(departmentGroups)){ + Set departCodes = new HashSet(); + for (DepartmentGroup departmentGroup : departmentGroups) { + String depart = departmentGroup.getDepartCodes(); + if(StringUtils.isNotBlank(depart)){ + if(depart.contains(";")){ + String[] departArr = depart.split(";"); + for (int i = 0; i < departArr.length; i++) { + departCodes.add(departArr[i]); + } + }else{ + departCodes.add(depart); + } + } + } + if(departCodes.size() > 0){ + orgUnitCodingSql = " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("orgUnitCoding", departCodes, " 1=1 "); + } + } + }else{ + orgUnitCodingSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("orgUnitCoding", recyDepartmentGroupDepartCodes, ";"); + } + } String sql = "where po.recyclingTime between " + fromTime - + " and " + toTime + ""; + + " and " + toTime + "" + orgUnitCodingSql; List recyclingRecords = recyclingRecordManager .getRecyclingRecordBySql(sql); @@ -1449,7 +1493,7 @@ // 调用长沙中心医院的打印处理代码 resultAmount = changshaZhongxingHospitalProcess(departType, voList, disinfectionGoodsList, recyclingRecords, - departTousseMap); + departTousseMap, taskGroups, tousseGroupIds); // 设置每一张表显示多少行 int tableCount = 3; @@ -1464,9 +1508,9 @@ obj.put("tableRowSize", rowSize); obj.put("data", voList); obj.put("disinfectionGoods", disinfectionGoodsList); - + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + obj.put("printDate", sdf.format(new Date())); StrutsResponseUtils.output(obj); - } } catch (Exception e) { e.printStackTrace(); @@ -1506,6 +1550,49 @@ fromTime = dateQueryAdapter.dateAdapter(fromTime); toTime = dateQueryAdapter.dateAdapter(toTime); List departGroups = departmentGroupManager.getAll(); + String taskGroups = StrutsParamUtils.getPraramValue("taskGroups",""); + String tousseGroupIds = StrutsParamUtils.getPraramValue("tousseGroupIds",""); + String recyDepartmentGroupDepartCodes = StrutsParamUtils.getPraramValue("recyDepartmentGroupDepartCodes",""); + String taskGroupsSql = null; + if(StringUtils.isNotBlank(taskGroups) && !taskGroups.contains("全部")){ + taskGroupsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.taskGroup", taskGroups, ","); + }else{ + taskGroupsSql = ""; + } + String tousseGroupIdsSql = null; + if(StringUtils.isNotBlank(tousseGroupIds) && !tousseGroupIds.contains("-1")){ + tousseGroupIdsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.tousseGroupID", tousseGroupIds, ","); + }else{ + tousseGroupIdsSql = ""; + } + String tdSql = taskGroupsSql + tousseGroupIdsSql; + String orgUnitCodingSql = ""; + if(StringUtils.isNotBlank(recyDepartmentGroupDepartCodes)){ + if(recyDepartmentGroupDepartCodes.contains("all") || recyDepartmentGroupDepartCodes.contains("全部")){ + List departmentGroups = objectDao.findAllObjects(DepartmentGroup.class.getSimpleName()); + if(CollectionUtils.isNotEmpty(departmentGroups)){ + Set departCodes = new HashSet(); + for (DepartmentGroup departmentGroup : departmentGroups) { + String depart = departmentGroup.getDepartCodes(); + if(StringUtils.isNotBlank(depart)){ + if(depart.contains(";")){ + String[] departArr = depart.split(";"); + for (int i = 0; i < departArr.length; i++) { + departCodes.add(departArr[i]); + } + }else{ + departCodes.add(depart); + } + } + } + if(departCodes.size() > 0){ + orgUnitCodingSql = " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("po.orgUnitCoding", departCodes, " 1=1 "); + } + } + }else{ + orgUnitCodingSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("po.orgUnitCoding", recyDepartmentGroupDepartCodes, ";"); + } + } if(CollectionUtils.isNotEmpty(departGroups)){ List departAllCodes = new ArrayList<>(); for(DepartmentGroup dg : departGroups){ @@ -1519,9 +1606,9 @@ String sql = String .format("select min(po.depart) departName,po.departCode,td.ancestorID,min(bo.tousseName) tousseName,sum(bo.amount) amount,td.id tousseDefId from %s po " + "join %s bo on po.id = bo.recyclingRecord_id join %s td on td.id = bo.tousseDefinitionId " - + "where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' and %s group by po.departCode,td.ancestorID,td.id", + + "where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' and %s %s %s group by po.departCode,td.ancestorID,td.id", RecyclingRecord.class.getSimpleName(), RecyclingItem.class.getSimpleName(), - TousseDefinition.class.getSimpleName(),fromTime, toTime, handlerDepartCoding,orOrgUnitNameSQL); + TousseDefinition.class.getSimpleName(),fromTime, toTime, handlerDepartCoding,orOrgUnitNameSQL,tdSql, orgUnitCodingSql); ResultSet rs = objectDao.executeSql(sql); Map>> departGroupDetail = new HashMap<>(); @@ -1557,6 +1644,8 @@ } data.put("printUser", AcegiHelper.getLoginUserFullName()); data.put("departmentGroupNames", departGroupDetail.keySet()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + data.put("printDate", sdf.format(new Date())); StrutsResponseUtils.output(data); }else{ StrutsResponseUtils.output(false,"未设置科室分组"); @@ -1583,13 +1672,55 @@ orOrgUnitNameSQL = " and po.depart not in ('" + goodsOption.getValue().replace(";", "','") + "')"; } } - + String taskGroups = StrutsParamUtils.getPraramValue("taskGroups",""); + String tousseGroupIds = StrutsParamUtils.getPraramValue("tousseGroupIds",""); + String recyDepartmentGroupDepartCodes = StrutsParamUtils.getPraramValue("recyDepartmentGroupDepartCodes",""); + String taskGroupsSql = null; + if(StringUtils.isNotBlank(taskGroups) && !taskGroups.contains("全部")){ + taskGroupsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.taskGroup", taskGroups, ","); + }else{ + taskGroupsSql = ""; + } + String tousseGroupIdsSql = null; + if(StringUtils.isNotBlank(tousseGroupIds) && !tousseGroupIds.contains("-1")){ + tousseGroupIdsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.tousseGroupID", tousseGroupIds, ","); + }else{ + tousseGroupIdsSql = ""; + } + String tdSql = taskGroupsSql + tousseGroupIdsSql; + String orgUnitCodingSql = ""; + if(StringUtils.isNotBlank(recyDepartmentGroupDepartCodes)){ + if(recyDepartmentGroupDepartCodes.contains("all") || recyDepartmentGroupDepartCodes.contains("全部")){ + List departmentGroups = objectDao.findAllObjects(DepartmentGroup.class.getSimpleName()); + if(CollectionUtils.isNotEmpty(departmentGroups)){ + Set departCodes = new HashSet(); + for (DepartmentGroup departmentGroup : departmentGroups) { + String depart = departmentGroup.getDepartCodes(); + if(StringUtils.isNotBlank(depart)){ + if(depart.contains(";")){ + String[] departArr = depart.split(";"); + for (int i = 0; i < departArr.length; i++) { + departCodes.add(departArr[i]); + } + }else{ + departCodes.add(depart); + } + } + } + if(departCodes.size() > 0){ + orgUnitCodingSql = " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("po.orgUnitCoding", departCodes, " 1=1 "); + } + } + }else{ + orgUnitCodingSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("po.orgUnitCoding", recyDepartmentGroupDepartCodes, ";"); + } + } String sql = String .format("select min(po.depart) departName,po.departCode,td.ancestorID,min(bo.tousseName) tousseName,sum(bo.amount) amount,td.id from %s po " + "join %s bo on po.id = bo.recyclingRecord_id join %s td on td.id = bo.tousseDefinitionId " - + "where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' %s group by po.departCode,td.ancestorID,td.id", + + "where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' %s %s %s group by po.departCode,td.ancestorID,td.id", RecyclingRecord.class.getSimpleName(), RecyclingItem.class.getSimpleName(), - TousseDefinition.class.getSimpleName(),fromTime, toTime, handlerDepartCoding,orOrgUnitNameSQL); + TousseDefinition.class.getSimpleName(),fromTime, toTime, handlerDepartCoding,orOrgUnitNameSQL,tdSql, orgUnitCodingSql); ResultSet rs = objectDao.executeSql(sql); @@ -1645,8 +1776,8 @@ data.put("配置文件", printConfig); data.put("printUser", AcegiHelper.getLoginUserFullName()); - String invoicePlanHql = String.format("id in(select recyclingApplication.id from %s po where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' %s) and %s order by depart,recyclingTime", - RecyclingRecord.class.getSimpleName(),fromTime,toTime,handlerDepartCoding,orOrgUnitNameSQL,sqlFunctionsAdapter.strNotBlank("remark")); + String invoicePlanHql = String.format("id in(select recyclingApplication.id from %s po where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' %s %s ) and %s order by depart,recyclingTime", + RecyclingRecord.class.getSimpleName(),fromTime,toTime,handlerDepartCoding,orOrgUnitNameSQL,orgUnitCodingSql,sqlFunctionsAdapter.strNotBlank("remark")); List invoicePlans = invoicePlanManager.getByHql(invoicePlanHql); Map> maps = invoicePlanManager.groupByDepartCoding(invoicePlans); JsonConfig jsonConfig = new JsonConfig(); @@ -1657,6 +1788,8 @@ list.add("remark"); jsonConfig.setJsonPropertyFilter(new JsonIncludePropertyFilter(list.toArray(new String[0]))); data.put("remarks", JSONObject.fromObject(maps, jsonConfig)); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + data.put("printDate", sdf.format(new Date())); StrutsResponseUtils.output(data); } } @@ -1690,11 +1823,54 @@ String specializedTousseKey = "specializedTousse"; fromTime = dateQueryAdapter.dateAdapter(fromTime); toTime = dateQueryAdapter.dateAdapter(toTime); + String taskGroups = StrutsParamUtils.getPraramValue("taskGroups",""); + String tousseGroupIds = StrutsParamUtils.getPraramValue("tousseGroupIds",""); + String recyDepartmentGroupDepartCodes = StrutsParamUtils.getPraramValue("recyDepartmentGroupDepartCodes",""); + String taskGroupsSql = null; + if(StringUtils.isNotBlank(taskGroups) && !taskGroups.contains("全部")){ + taskGroupsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.taskGroup", taskGroups, ","); + }else{ + taskGroupsSql = ""; + } + String tousseGroupIdsSql = null; + if(StringUtils.isNotBlank(tousseGroupIds) && !tousseGroupIds.contains("-1")){ + tousseGroupIdsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.tousseGroupID", tousseGroupIds, ","); + }else{ + tousseGroupIdsSql = ""; + } + String tdSql = taskGroupsSql + tousseGroupIdsSql; + String orgUnitCodingSql = ""; + if(StringUtils.isNotBlank(recyDepartmentGroupDepartCodes)){ + if(recyDepartmentGroupDepartCodes.contains("all") || recyDepartmentGroupDepartCodes.contains("全部")){ + List departmentGroups = objectDao.findAllObjects(DepartmentGroup.class.getSimpleName()); + if(CollectionUtils.isNotEmpty(departmentGroups)){ + Set departCodes = new HashSet(); + for (DepartmentGroup departmentGroup : departmentGroups) { + String depart = departmentGroup.getDepartCodes(); + if(StringUtils.isNotBlank(depart)){ + if(depart.contains(";")){ + String[] departArr = depart.split(";"); + for (int i = 0; i < departArr.length; i++) { + departCodes.add(departArr[i]); + } + }else{ + departCodes.add(depart); + } + } + } + if(departCodes.size() > 0){ + orgUnitCodingSql = " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("rr.orgUnitCoding", departCodes, " 1=1 "); + } + } + }else{ + orgUnitCodingSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("rr.orgUnitCoding", recyDepartmentGroupDepartCodes, ";"); + } + } //1.按条件查询符合条件的内容 String queryCondition = " and rr.orgUnitCoding='"+ handlerDepartCoding +"' " + "and rr.recyclingTime between "+ fromTime +" and "+ toTime +" " - + "and rr.depart not like '%手术%' "; + + "and rr.depart not like '%手术%' " + orgUnitCodingSql + tdSql; ResultSet rs = null; try{ String querySql = "select rr.depart,ti.tousseName,ti.amount,ti.recyclingAmount,td.taskGroup " @@ -1832,6 +2008,8 @@ }else{ JSONUtil.addMessage(json, "查询参数不能为空"); } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + json.put("printDate", sdf.format(new Date())); StrutsResponseUtils.output(json); } @@ -1857,11 +2035,53 @@ if (StringUtils.isNotBlank(fromTime) && StringUtils.isNotBlank(toTime) && StringUtils.isNotBlank(handlerDepartCoding)) { fromTime = dateQueryAdapter.dateAdapter(fromTime); toTime = dateQueryAdapter.dateAdapter(toTime); - + String taskGroups = StrutsParamUtils.getPraramValue("taskGroups",""); + String tousseGroupIds = StrutsParamUtils.getPraramValue("tousseGroupIds",""); + String recyDepartmentGroupDepartCodes = StrutsParamUtils.getPraramValue("recyDepartmentGroupDepartCodes",""); + String taskGroupsSql = null; + if(StringUtils.isNotBlank(taskGroups) && !taskGroups.contains("全部")){ + taskGroupsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.taskGroup", taskGroups, ","); + }else{ + taskGroupsSql = ""; + } + String tousseGroupIdsSql = null; + if(StringUtils.isNotBlank(tousseGroupIds) && !tousseGroupIds.contains("-1")){ + tousseGroupIdsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.tousseGroupID", tousseGroupIds, ","); + }else{ + tousseGroupIdsSql = ""; + } + String tdSql = taskGroupsSql + tousseGroupIdsSql; + String orgUnitCodingSql = ""; + if(StringUtils.isNotBlank(recyDepartmentGroupDepartCodes)){ + if(recyDepartmentGroupDepartCodes.contains("all") || recyDepartmentGroupDepartCodes.contains("全部")){ + List departmentGroups = objectDao.findAllObjects(DepartmentGroup.class.getSimpleName()); + if(CollectionUtils.isNotEmpty(departmentGroups)){ + Set departCodes = new HashSet(); + for (DepartmentGroup departmentGroup : departmentGroups) { + String depart = departmentGroup.getDepartCodes(); + if(StringUtils.isNotBlank(depart)){ + if(depart.contains(";")){ + String[] departArr = depart.split(";"); + for (int i = 0; i < departArr.length; i++) { + departCodes.add(departArr[i]); + } + }else{ + departCodes.add(depart); + } + } + } + if(departCodes.size() > 0){ + orgUnitCodingSql = " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("rr.orgUnitCoding", departCodes, " 1=1 "); + } + } + }else{ + orgUnitCodingSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("rr.orgUnitCoding", recyDepartmentGroupDepartCodes, ";"); + } + } //1.按条件查询符合条件的内容 String queryCondition = " and rr.orgUnitCoding='"+ handlerDepartCoding +"' " + "and rr.recyclingTime between "+ fromTime +" and "+ toTime +" " - + "and rr.depart not like '%手术%' "; + + "and rr.depart not like '%手术%' " + orgUnitCodingSql + tdSql; String querySql = "select rr.depart,ri.tousseName,ri.amount " + " from RecyclingRecord rr join RecyclingItem ri on rr.id=ri.recyclingRecord_id " + " join TousseDefinition td on td.id=ri.tousseDefinitionId " @@ -1940,6 +2160,8 @@ }else{ JSONUtil.addMessage(json, "查询参数不能为空"); } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + json.put("printDate", sdf.format(new Date())); StrutsResponseUtils.output(json); } @@ -1951,6 +2173,53 @@ String toTime = StrutsParamUtils.getPraramValue("endDateTime", ""); String handlerDepartCoding = StrutsParamUtils.getPraramValue("handlerDepartCoding",""); if (StringUtils.isNotBlank(fromTime) && StringUtils.isNotBlank(toTime) && StringUtils.isNotBlank(handlerDepartCoding)) { + String taskGroups = StrutsParamUtils.getPraramValue("taskGroups",""); + String tousseGroupIds = StrutsParamUtils.getPraramValue("tousseGroupIds",""); + String recyDepartmentGroupDepartCodes = StrutsParamUtils.getPraramValue("recyDepartmentGroupDepartCodes",""); + String taskGroupsSql = null; + if(StringUtils.isNotBlank(taskGroups) && !taskGroups.contains("全部")){ + taskGroupsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.taskGroup", taskGroups, ","); + }else{ + taskGroupsSql = ""; + } + String tousseGroupIdsSql = null; + if(StringUtils.isNotBlank(tousseGroupIds) && !tousseGroupIds.contains("-1")){ + tousseGroupIdsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("td.tousseGroupID", tousseGroupIds, ","); + }else{ + tousseGroupIdsSql = ""; + } + String tdSql = taskGroupsSql + tousseGroupIdsSql; + String orgUnitCodingSql = ""; + String handleDepartCoding = ""; + if(StringUtils.isNotBlank(recyDepartmentGroupDepartCodes)){ + if(recyDepartmentGroupDepartCodes.contains("all") || recyDepartmentGroupDepartCodes.contains("全部")){ + List departmentGroups = objectDao.findAllObjects(DepartmentGroup.class.getSimpleName()); + if(CollectionUtils.isNotEmpty(departmentGroups)){ + Set departCodes = new HashSet(); + for (DepartmentGroup departmentGroup : departmentGroups) { + String depart = departmentGroup.getDepartCodes(); + if(StringUtils.isNotBlank(depart)){ + if(depart.contains(";")){ + String[] departArr = depart.split(";"); + for (int i = 0; i < departArr.length; i++) { + departCodes.add(departArr[i]); + } + }else{ + departCodes.add(depart); + } + } + } + if(departCodes.size() > 0){ + orgUnitCodingSql = " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("po.orgUnitCoding", departCodes, " 1=1 "); + handleDepartCoding = " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("po.handleDepartCoding", departCodes, " 1=1 "); + } + } + }else{ + orgUnitCodingSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("po.orgUnitCoding", recyDepartmentGroupDepartCodes, ";"); + handleDepartCoding = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("po.handleDepartCoding", recyDepartmentGroupDepartCodes, ";"); + } + } + fromTime = dateQueryAdapter.dateAdapter(fromTime); toTime = dateQueryAdapter.dateAdapter(toTime); //手术室不用统计 @@ -1965,23 +2234,23 @@ String sql = String .format("select min(po.depart),po.departCode,td.ancestorID,min(bo.tousseName),sum(bo.amount),td.id from %s po " + "join %s bo on po.id = bo.recyclingRecord_id join %s td on td.id = bo.tousseDefinitionId " - + "where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' %s group by po.departCode,td.ancestorID,td.id " + + "where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' %s %s %s group by po.departCode,td.ancestorID,td.id " + "union all " // 装配管理打印回收清单要增加敷料包的统计(DGZYY-162) + "select min(po.depart),po.departCoding,td.ancestorID,min(bo.tousseName),sum(bo.amount),td.id from %s po " + "join %s bo on po.id = bo.recyclingApplication_ID join %s td on td.id = bo.tousseDefinitionId " - + "where po.submitTime between %s and %s and po.handleDepartCoding = '%s' %s and td.tousseType = '%s' " + + "where po.submitTime between %s and %s and po.handleDepartCoding = '%s' %s %s %s and td.tousseType = '%s' " + "group by po.departCoding, td.ancestorID,td.id", RecyclingRecord.class.getSimpleName(), RecyclingItem.class.getSimpleName(), - TousseDefinition.class.getSimpleName(),fromTime, toTime, handlerDepartCoding,orOrgUnitNameSQL, + TousseDefinition.class.getSimpleName(),fromTime, toTime, handlerDepartCoding,orOrgUnitNameSQL,tdSql,orgUnitCodingSql, InvoicePlan.class.getSimpleName(), TousseItem.class.getSimpleName(), - TousseDefinition.class.getSimpleName(),fromTime, toTime, handlerDepartCoding,orOrgUnitNameSQL, + TousseDefinition.class.getSimpleName(),fromTime, toTime, handlerDepartCoding,orOrgUnitNameSQL,tdSql,handleDepartCoding, TousseDefinition.PACKAGE_TYPE_DRESSING); ResultSet rs = objectDao.executeSql(sql); JSONObject json = tousseItemClassification(rs); - String invoicePlanHql = String.format("id in(select recyclingApplication.id from %s po where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' %s) and %s order by depart,recyclingTime", - RecyclingRecord.class.getSimpleName(),fromTime,toTime,handlerDepartCoding,orOrgUnitNameSQL,sqlFunctionsAdapter.strNotBlank("remark")); + String invoicePlanHql = String.format("id in(select recyclingApplication.id from %s po where po.recyclingTime between %s and %s and po.orgUnitCoding = '%s' %s %s) and %s order by depart,recyclingTime", + RecyclingRecord.class.getSimpleName(),fromTime,toTime,handlerDepartCoding,orOrgUnitNameSQL,orgUnitCodingSql,sqlFunctionsAdapter.strNotBlank("remark")); List invoicePlans = invoicePlanManager.getByHql(invoicePlanHql); Map> maps = invoicePlanManager.groupByDepartCoding(invoicePlans); JsonConfig jsonConfig = new JsonConfig(); @@ -1992,6 +2261,8 @@ list.add("remark"); jsonConfig.setJsonPropertyFilter(new JsonIncludePropertyFilter(list.toArray(new String[0]))); json.put("remarks", JSONObject.fromObject(maps, jsonConfig)); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + json.put("printDate", sdf.format(new Date())); StrutsResponseUtils.output(json); } } @@ -2802,7 +3073,7 @@ List voList, List disinfectionGoodsList, List recyclingRecords, - Map> departTousseMap) { + Map> departTousseMap, String taskGroups, String tousseGroupIds) { int resultAmount = 0; // key:物品名称 key2:科室名称 Map>> disinfectionMap = new HashedMap>>(); @@ -2829,6 +3100,17 @@ } } } + Set taskGroupSet = SqlUtils.splitStringToSet(taskGroups, ","); + + Set tousseGroupIdSet = new HashSet(); + if(StringUtils.isNotBlank(tousseGroupIds) && !tousseGroupIds.contains("全部")){ + String[] tousseGroupIdArr = tousseGroupIds.split(","); + for (int i = 0; i < tousseGroupIdArr.length; i++) { + if(DatabaseUtil.isPoIdValid(tousseGroupIdArr[i])){ + tousseGroupIdSet.add(Long.valueOf(tousseGroupIdArr[i])); + } + } + } for (RecyclingRecord record : recyclingRecords) { List itemList = record.getItems(); for (RecyclingItem tousseItem : itemList) { @@ -2838,6 +3120,16 @@ boolean isQueryPackage = false; if (td != null){ + if(CollectionUtils.isNotEmpty(taskGroupSet)){ + if(StringUtils.isBlank(td.getTaskGroup()) || !taskGroupSet.contains(td.getTaskGroup())){ + continue; + } + } + if(CollectionUtils.isNotEmpty(tousseGroupIdSet)){ + if(td.getTousseGroupID() == null || !tousseGroupIdSet.contains(td.getTousseGroupID())){ + continue; + } + } // 资产归属 String assetsBelong = td.getAssetsBelong(objectDao); if(gys.equals(departType)){ Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManager.java =================================================================== diff -u -r31865 -r32082 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManager.java (.../RecyclingApplicationManager.java) (revision 31865) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManager.java (.../RecyclingApplicationManager.java) (revision 32082) @@ -189,7 +189,7 @@ String tousseItemIds, String printUser, List summaryList); public JSONObject getPrintObjectByTimePeriod(JSONObject printScope, - String fromTime, String toTime, String printUser); + String fromTime, String toTime, String printUser, String taskGroups, String tousseGroupIds, String recyDepartmentGroupDepartCodes); /** * 提交申请单,用于pc端及pda端的科室申领的申请单的提交 Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/dwr/table/RecyclingApplicationTableManager.java =================================================================== diff -u -r31399 -r32082 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/dwr/table/RecyclingApplicationTableManager.java (.../RecyclingApplicationTableManager.java) (revision 31399) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/dwr/table/RecyclingApplicationTableManager.java (.../RecyclingApplicationTableManager.java) (revision 32082) @@ -1033,13 +1033,16 @@ String fromTime = jsonObject.optString("fromTime",""); String toTime = jsonObject.optString("toTime",""); + String taskGroups = jsonObject.optString("taskGroups",""); + String tousseGroupIds = jsonObject.optString("tousseGroupIds",""); + String recyDepartmentGroupDepartCodes = jsonObject.optString("recyDepartmentGroupDepartCodes",""); JSONObject printScope = jsonObject.optJSONObject("printScope"); String printUser = AcegiHelper.getLoginUserFullName(); // 采用在客户端分页技术,简化服务器端的代码,避免因为一行的打印内容过多换行造成分页不准确的问题 JSONObject printSummaryObj = recyclingApplicationManager.getPrintObjectByTimePeriod( - printScope, fromTime, toTime, printUser); + printScope, fromTime, toTime, printUser, taskGroups, tousseGroupIds, recyDepartmentGroupDepartCodes); return printSummaryObj.toString(); }else if("tousseGroupPrint".equals(action)){ //器械包分组打印 Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java =================================================================== diff -u -r32044 -r32082 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 32044) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 32082) @@ -2409,7 +2409,7 @@ // 按时间段获取打印对象,主要指针对回收的物品清单 @Override public JSONObject getPrintObjectByTimePeriod(JSONObject printScope, - String fromTime, String toTime, String printUser) { + String fromTime, String toTime, String printUser, String taskGroups, String tousseGroupIds, String recyDepartmentGroupDepartCodes) { boolean printTousse = printScope.optBoolean("printTousse"); boolean printDisinfectGoods = printScope .optBoolean("printDisinfectGoods"); @@ -2440,19 +2440,19 @@ List disinfcetionItems = new ArrayList(); List diposableItems = new ArrayList(); - populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printTousse, TousseDefinition.PACKAGE_TYPE_INSIDE, tousseItems); + populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printTousse, TousseDefinition.PACKAGE_TYPE_INSIDE, tousseItems, taskGroups, tousseGroupIds, recyDepartmentGroupDepartCodes); // 自定义器械包,在打印器械包时一起打印出来 - populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printTousse, TousseDefinition.PACKAGE_TYPE_CUSTOM, customTousseItems); + populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printTousse, TousseDefinition.PACKAGE_TYPE_CUSTOM, customTousseItems, taskGroups, tousseGroupIds, recyDepartmentGroupDepartCodes); // 敷料包,在打印器械包时一起打印出来 - populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printTousse, TousseDefinition.PACKAGE_TYPE_DRESSING, tousseItems); + populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printTousse, TousseDefinition.PACKAGE_TYPE_DRESSING, tousseItems, taskGroups, tousseGroupIds, recyDepartmentGroupDepartCodes); - populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printDisinfectGoods, TousseDefinition.PACKAGE_TYPE_DISINFECTION, disinfcetionItems); + populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printDisinfectGoods, TousseDefinition.PACKAGE_TYPE_DISINFECTION, disinfcetionItems, taskGroups, tousseGroupIds, recyDepartmentGroupDepartCodes); - populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printForeignTousse, TousseDefinition.PACKAGE_TYPE_FOREIGN, tousseItems); + populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printForeignTousse, TousseDefinition.PACKAGE_TYPE_FOREIGN, tousseItems, taskGroups, tousseGroupIds, recyDepartmentGroupDepartCodes); - populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printDisposable, TousseItem.TYPE_DIPOSABLE_GOODS, diposableItems); + populateTousseItemListByTimePeriod(fromTime, toTime, handlerDepartCoding, departmentGroup, printDisposable, TousseItem.TYPE_DIPOSABLE_GOODS, diposableItems, taskGroups, tousseGroupIds, recyDepartmentGroupDepartCodes); List printRowVos = recyclingItems2PrintRowVos(disinfcetionItems,printByOriginalApplications); @@ -2498,7 +2498,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String printTime = sdf.format(new Date()); printSummaryObj.put("printTime", printTime); - + printSummaryObj.put("printDate", printTime); // 为printSummary增加属性,增加查询的起止时间 printSummaryObj.put("fromTime", fromTime); printSummaryObj.put("toTime", toTime); @@ -3175,10 +3175,10 @@ } private void populateTousseItemListByTimePeriod(String fromTime, String toTime, String handlerDepartCoding,String departmentGroup, - boolean isPrintThisType, String tousseType, List tousseItemList) { + boolean isPrintThisType, String tousseType, List tousseItemList, String taskGroups, String tousseGroupIds, String recyDepartmentGroupDepartCodes) { if (isPrintThisType) { List foundItems = getRecyclingItemsByTimePeriod( - tousseType, fromTime, toTime, handlerDepartCoding , departmentGroup); + tousseType, fromTime, toTime, handlerDepartCoding , departmentGroup, taskGroups, tousseGroupIds, recyDepartmentGroupDepartCodes); if (foundItems != null && foundItems.size() > 0) { tousseItemList.addAll(foundItems); } @@ -4264,14 +4264,57 @@ return tousseItemManager.getByHqlForUpdate(sql); } - private List getRecyclingItemsByTimePeriod(String tousseType, String fromTime,String toTime, String handlerDepartCoding , String departmentGroup) { + private List getRecyclingItemsByTimePeriod(String tousseType, String fromTime,String toTime, String handlerDepartCoding , String departmentGroup, String taskGroups, String tousseGroupIds, String recyDepartmentGroupDepartCodes) { fromTime = dateQueryAdapter.dateAdapter(fromTime); toTime = dateQueryAdapter.dateAdapter(toTime); - + String taskGroupsSql = null; + if(StringUtils.isNotBlank(taskGroups) && !taskGroups.contains("全部")){ + taskGroupsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("taskGroup", taskGroups, ","); + }else{ + taskGroupsSql = ""; + } + String tousseGroupIdsSql = null; + if(StringUtils.isNotBlank(tousseGroupIds) && !tousseGroupIds.contains("-1")){ + tousseGroupIdsSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("tousseGroupID", tousseGroupIds, ","); + }else{ + tousseGroupIdsSql = ""; + } + String tdSql = taskGroupsSql + tousseGroupIdsSql; + if(StringUtils.isNotBlank(tdSql)){ + tdSql = " po.tousseDefinitionId in(select id from TousseDefinition where 1=1 "+ tdSql +")"; + } + String orgUnitCodingSql = ""; + String handleDepartCoding = ""; + if(StringUtils.isNotBlank(recyDepartmentGroupDepartCodes)){ + if(recyDepartmentGroupDepartCodes.contains("all") || recyDepartmentGroupDepartCodes.contains("全部")){ + List departmentGroups = objectDao.findAllObjects(DepartmentGroup.class.getSimpleName()); + if(CollectionUtils.isNotEmpty(departmentGroups)){ + Set departCodes = new HashSet(); + for (DepartmentGroup thisdepartmentGroup : departmentGroups) { + String depart = thisdepartmentGroup.getDepartCodes(); + if(StringUtils.isNotBlank(depart)){ + if(depart.contains(";")){ + String[] departArr = depart.split(";"); + for (int i = 0; i < departArr.length; i++) { + departCodes.add(departArr[i]); + } + }else{ + departCodes.add(depart); + } + } + } + if(departCodes.size() > 0){ + orgUnitCodingSql = " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("po.recyclingRecord.orgUnitCoding", departCodes, " 1=1 "); + } + } + }else{ + orgUnitCodingSql = SqlUtils.getWhereSqlByfilterFieldAndStringValueAndSeparator("po.recyclingRecord.orgUnitCoding", recyDepartmentGroupDepartCodes, ";"); + } + } String sql = String.format(" where po.tousseType = '%s'" - + " and po.recyclingRecord.recyclingTime between %s and %s and po.recyclingRecord.orgUnitCoding = '%s'", tousseType, - fromTime, toTime, handlerDepartCoding); + + " and po.recyclingRecord.recyclingTime between %s and %s and po.recyclingRecord.orgUnitCoding = '%s' %s %s", tousseType, + fromTime, toTime, handlerDepartCoding,orgUnitCodingSql, tdSql); //如果回收科室分组 if(StringUtils.isNotBlank(departmentGroup)){