Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/util/ForeignTousseApplicationReportHelper.java =================================================================== diff -u -r37219 -r37400 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/util/ForeignTousseApplicationReportHelper.java (.../ForeignTousseApplicationReportHelper.java) (revision 37219) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/util/ForeignTousseApplicationReportHelper.java (.../ForeignTousseApplicationReportHelper.java) (revision 37400) @@ -5,11 +5,13 @@ import java.text.DateFormat; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import com.forgon.tools.date.DateTools; @@ -29,6 +31,7 @@ import com.forgon.disinfectsystem.jasperreports.javabeansource.ForeignTousseApplicationVO; import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseItemVO; import com.forgon.tools.MathTools; +import com.forgon.tools.StrutsParamUtils; import com.forgon.tools.db.DatabaseUtil; import com.forgon.tools.string.StringTools; import com.forgon.tools.util.SqlUtils; @@ -238,6 +241,25 @@ }else{ usedSql = ""; } + //GDSZYY-235 加急物品是否加急 如果查询的是包实例 则查询是否加急的TousseInstance 如果未装配,查询是否加急的TousseItem + String urgent = StrutsParamUtils.getPraramValue("urgent", ""); + String tousseInstanceUrgentLevelSql = null; + String tousseItemUrgentLevelSql = null; + if("否".equals(urgent)){ + //初始需求(暂不删除此代码 后面如果需求要改回来 直接使用):GDSZYY-235 申请单是否包含加急物品 如果查询的是包实例 则查询是否包含加急的TousseInstance 如果未装配,查询是否包含加急的TousseItem + //urgentLevelSql = " and not exists (select 1 from "+ TousseInstance.class.getSimpleName() +" titin where titin.foreignTousseApp_id=f.id and titin.urgentLevel_id is not null) "; + //tiUrgentLevelSql = " and not exists (select 1 from "+ TousseItem.class.getSimpleName() +" tin where tin.recyclingApplication_ID=f.id and tin.urgentLevel_id is not null) "; + tousseInstanceUrgentLevelSql = " and tit.urgentLevel_id is null"; + tousseItemUrgentLevelSql = " and ti.urgentLevel_id is null"; + }else if("是".equals(urgent)){ + //urgentLevelSql = " and exists (select 1 from "+ TousseInstance.class.getSimpleName() +" tit where tit.foreignTousseApp_id=f.id and tit.urgentLevel_id is not null) "; + //tiUrgentLevelSql = " and exists (select 1 from "+ TousseItem.class.getSimpleName() +" tin where tin.recyclingApplication_ID=f.id and tin.urgentLevel_id is not null) "; + tousseInstanceUrgentLevelSql = " and tit.urgentLevel_id is not null"; + tousseItemUrgentLevelSql = " and ti.urgentLevel_id is not null"; + }else{ + tousseInstanceUrgentLevelSql = ""; + tousseItemUrgentLevelSql = ""; + } String timeSql = null; startDay = dateQueryAdapter.dateAdapter(startDay); endDay = dateQueryAdapter.dateAdapter(endDay); @@ -316,7 +338,7 @@ + "from %s f join %s i on f.id=i.id join %s ti on ti.recyclingApplication_ID=i.id " + "join %s tit on tit.foreignTousseApp_id=f.id " + "join TousseDefinition td on td.id = tit.tousseDefinition_id left join RecyclingRecord rr on rr.recyclingApplication_id=f.id and rr.recyclingTimes is null " - + " %s where (tit.id is null or td.parentID is null and ti.tousseDefinitionId=tit.tousseDefinition_id or ti.tousseDefinitionId=td.parentID) %s %s %s %s %s ", + + " %s where (tit.id is null or td.parentID is null and ti.tousseDefinitionId=tit.tousseDefinition_id or ti.tousseDefinitionId=td.parentID) %s %s %s %s %s %s ", queryExtendedColumnSQL, customColumnName1Sql, queryMaterialNameSql, @@ -331,7 +353,7 @@ showNoInvoieSql, tousseSql, timeSql, - usedSql); + usedSql,tousseInstanceUrgentLevelSql); sqlBuilder.append(sql); String goodsNameSql = ""; if (StringUtils.isNotBlank(goodsName)) { @@ -409,6 +431,7 @@ + customTimePeriodSql + filterConpanyNameSql + noDisplayTerminatedIPSql + + tousseItemUrgentLevelSql + " group by ti.supplierName"+ extendedGroupSQL2 +",td.name,td.price,f.id " + " ,i.applicant,i.remark,f.patient,f.surgery,f.hospitalNumber,i.depart,i.deliverStatus,f.bedNumber,i.applicationtime,f.id " + customColumnName1Sql @@ -430,8 +453,10 @@ Map materialCountMap = new HashMap(); Map tousseItemVOMap = new HashMap(); StringBuffer totalMaterialDetailsSbf = new StringBuffer(); + Set foreignTousseApplicationIds = new HashSet(); while (rs.next()) { Long id = rs.getLong("id"); + foreignTousseApplicationIds.add(id); ForeignTousseApplicationVO vo = null; if(voMap.containsKey(id)){ vo = voMap.get(id); @@ -573,6 +598,7 @@ tousseItems.add(tousseItemVO); } } + parametMap.put("invociePlanCount", foreignTousseApplicationIds.size()); // 如果是空的列表,要添加一个空的对象,避免单元格的线不显示。 for (Entry entry : voMap.entrySet()) { List tousseItems = entry.getValue().getTousseItems();