Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/toussedefinition/TousseDefinition.java =================================================================== diff -u -r36445 -r36681 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/toussedefinition/TousseDefinition.java (.../TousseDefinition.java) (revision 36445) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/toussedefinition/TousseDefinition.java (.../TousseDefinition.java) (revision 36681) @@ -77,6 +77,7 @@ ,@Index(columnList = "recyclingApplicationID", name = "td_raid_index") ,@Index(columnList = "tousseGroupID", name = "td_tgid_index") ,@Index(columnList = "parentID", name = "td_pid_index") +,@Index(columnList = "warningType", name = "td_wnt_index") }) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class TousseDefinition implements IDAble{ Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/signRecord/service/SignRecordManagerImpl.java =================================================================== diff -u -r36423 -r36681 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/signRecord/service/SignRecordManagerImpl.java (.../SignRecordManagerImpl.java) (revision 36423) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/signRecord/service/SignRecordManagerImpl.java (.../SignRecordManagerImpl.java) (revision 36681) @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Collection; +import java.util.Comparator; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; @@ -405,7 +406,7 @@ if (StringUtils.isNotBlank(beginDate) && StringUtils.isNotBlank(endDate)) { beginDate = beginDate + " 00:00:00"; endDate = endDate + " 23:59:59"; - timeSql = " and " + dateQueryAdapter.dateAreaSql("invoiceSendTime", beginDate, endDate); + timeSql = " and " + dateQueryAdapter.dateAreaSql("sendTime", beginDate, endDate); } //是否启用加急 @@ -467,7 +468,7 @@ List> list = new ArrayList>(); List waitSignTousseInstanceList = new ArrayList(); - String sql = String.format("select ti.id tiId, ti.tousseName" + /*String sql = String.format("select ti.id tiId, ti.tousseName" + ", case when ti.invoice2_id is not null then i2.sendTime else i1.sendTime end invoiceSendTime" + ", ul.id urgentLevelId, ul.name urgentLevelname, ul.colorCode, ul.colorName, ul.grade " + "from %s ti " @@ -484,6 +485,36 @@ UrgentLevel.class.getSimpleName(), departCoding, departCoding, + TousseInstance.STATUS_SHIPPED);*/ + String sql = String.format("select * from (" + + "select ti.tousseName, i1.sendTime as invoiceSendTime " + + ", ul.id urgentLevelId, ul.name urgentLevelname, ul.colorCode, ul.colorName, ul.grade " + + "from %s ti " + + "left join %s i1 on ti.invoice_id = i1.id " + + "left join %s ul on ul.id = ti.urgentLevel_id " + + "where ti.location='%s' " + + "and ti.status='%s' " + + timeSql + + "and ti.invoice2_id is null " + + "union all " + + "select ti.tousseName, i1.sendTime as invoiceSendTime " + + ", ul.id urgentLevelId, ul.name urgentLevelname, ul.colorCode, ul.colorName, ul.grade " + + "from %s ti " + + "join %s i1 on ti.invoice2_id = i1.id " + + "left join %s ul on ul.id = ti.urgentLevel_id " + + "where ti.location='%s' " + + "and ti.status='%s' " + + timeSql + + ") rs ", + TousseInstance.class.getSimpleName(), + Invoice.class.getSimpleName(), + UrgentLevel.class.getSimpleName(), + departCoding, + TousseInstance.STATUS_SHIPPED, + TousseInstance.class.getSimpleName(), + Invoice.class.getSimpleName(), + UrgentLevel.class.getSimpleName(), + departCoding, TousseInstance.STATUS_SHIPPED); ResultSet result = null; try { @@ -524,6 +555,15 @@ //待签收物品最早发货时间map Map tousseInvoiceSendTimeMap = new HashMap(); if(CollectionUtils.isNotEmpty(waitSignTousseInstanceList)){ + + //按照包名称排序 + waitSignTousseInstanceList.sort(new Comparator() { + @Override + public int compare(TousseInstance o1, TousseInstance o2) { + return StringUtils.compare(o1.getTousseName(), o2.getTousseName()); + } + }); + for (TousseInstance tousseInstance : waitSignTousseInstanceList) { String tousseName = tousseInstance.getTousseName(); Integer amount = tousseAmountMap.get(tousseName); @@ -601,13 +641,39 @@ private List> getWaitSignTousseInstanceWithoutUrgentInfo(String departCoding, String timeSql) { List> list = new ArrayList>(); // 汇总 - String sql = "select ti.tousseName, count(0) amount, min(case when ti.invoice2_id is not null then i2.sendTime else i1.sendTime end) as invoiceSendTime from " + TousseInstance.class.getSimpleName() + " ti " + /*String sql = "select ti.tousseName, count(0) amount, min(case when ti.invoice2_id is not null then i2.sendTime else i1.sendTime end) as invoiceSendTime from " + TousseInstance.class.getSimpleName() + " ti " + "left join " + Invoice.class.getSimpleName() + " i1 on ti.invoice_id = i1.id " + "left join " + Invoice.class.getSimpleName() + " i2 on ti.invoice2_id = i2.id " + "where ((ti.location='" + departCoding + "' and ti.location_2 is null) or (ti.location_2 = '" + departCoding + "')) and ti.status='" + TousseInstance.STATUS_SHIPPED + "'" + timeSql + " group by ti.tousseName" - + " order by ti.tousseName"; + + " order by ti.tousseName";*/ + String sql = String.format("select * from (" + + "select ti.tousseName, count(0) amount, min(i1.sendTime) as invoiceSendTime " + + "from %s ti " + + "left join %s i1 on ti.invoice_id = i1.id " + + "where ti.location='%s' " + + "and ti.status='%s' " + + timeSql + + "and ti.invoice2_id is null " + + "group by ti.tousseName " + + "union all " + + "select ti.tousseName, count(0) amount, min(i1.sendTime) as invoiceSendTime " + + "from %s ti " + + "join %s i1 on ti.invoice2_id = i1.id " + + "where ti.location='%s' " + + "and ti.status='%s' " + + timeSql + + "group by ti.tousseName " + + ") rs", + TousseInstance.class.getSimpleName(), + Invoice.class.getSimpleName(), + departCoding, + TousseInstance.STATUS_SHIPPED, + TousseInstance.class.getSimpleName(), + Invoice.class.getSimpleName(), + departCoding, + TousseInstance.STATUS_SHIPPED); ResultSet result = null; try { result = objectDao.executeSql(sql); @@ -623,6 +689,18 @@ } finally { DatabaseUtil.closeResultSetAndStatement(result); } + + if(CollectionUtils.isNotEmpty(list)){ + list.sort(new Comparator>() { + @Override + public int compare(Map o1, Map o2) { + String tousseName1 = o1.get("tousseName") == null ? "" : (String)o1.get("tousseName"); + String tousseName2 = o2.get("tousseName") == null ? "" : (String)o2.get("tousseName"); + return StringUtils.compare(tousseName1, tousseName2); + } + }); + } + return list; } Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/recall/RecallRecord.java =================================================================== diff -u -r23492 -r36681 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/recall/RecallRecord.java (.../RecallRecord.java) (revision 23492) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/recall/RecallRecord.java (.../RecallRecord.java) (revision 36681) @@ -36,6 +36,7 @@ ,@Index(columnList = "endDate", name = "rcr_ed_index") ,@Index(columnList = "sterilizingFrequency_start", name = "rcr_sfs_index") ,@Index(columnList = "sterilizingFrequency_end", name = "rcr_sfe_index") +,@Index(columnList = "status", name = "rcr_status_index") }) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class RecallRecord { Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/toussedefinition/TousseInstance.java =================================================================== diff -u -r36639 -r36681 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/toussedefinition/TousseInstance.java (.../TousseInstance.java) (revision 36639) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/toussedefinition/TousseInstance.java (.../TousseInstance.java) (revision 36681) @@ -101,6 +101,8 @@ ,@Index(columnList = "departmentStock_id", name = "tis_dsid_index") ,@Index(columnList = "returnGoodsItem_ID", name = "tis_returnGoodsItem_ID_index") ,@Index(columnList = "invoice2_id", name = "tis_invoice2_id_index") +,@Index(columnList = "location_2", name = "tis_location_2_index") +,@Index(columnList = "validUntil", name = "tis_validUntil_index") ,@Index(columnList = "lastStorageLocationId", name = "tis_lastStorage_id_index") ,@Index(columnList = "settleAccountsDepartCode", name = "tis_settleAccoDeptCode_index") //效果包含但不限于加速器械包工作量报表查询(提升很大 效果不是很大 以20NFYKDXFSDSYY数据库为例子 查询器械包工作量报表中装配工作量21年到23年8月的数据 从26秒变为1s) Index: ssts-web/src/main/java/com/forgon/disinfectsystem/systemwarning/service/SystemWarningManagerImpl.java =================================================================== diff -u -r36259 -r36681 --- ssts-web/src/main/java/com/forgon/disinfectsystem/systemwarning/service/SystemWarningManagerImpl.java (.../SystemWarningManagerImpl.java) (revision 36259) +++ ssts-web/src/main/java/com/forgon/disinfectsystem/systemwarning/service/SystemWarningManagerImpl.java (.../SystemWarningManagerImpl.java) (revision 36681) @@ -29,7 +29,6 @@ import com.forgon.directory.vo.LoginUserData; import com.forgon.disinfectsystem.basedatamanager.reportoption.GoodsOptionManager; import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; -import com.forgon.disinfectsystem.basedatamanager.warehouse.service.WareHouseManager; import com.forgon.disinfectsystem.common.CssdUtils; import com.forgon.disinfectsystem.entity.assestmanagement.Contract; import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoods; @@ -76,7 +75,6 @@ import com.forgon.log.service.LogManager; import com.forgon.security.model.UserAttribute; import com.forgon.security.service.OperationManager; -import com.forgon.security.service.UserManager; import com.forgon.timeout.service.TimeoutManager; import com.forgon.tools.MathTools; import com.forgon.tools.SqlBuilder; @@ -120,10 +118,6 @@ private SupplyRoomConfigManager supplyRoomConfigManager; - private WareHouseManager wareHouseManager; - - private UserManager userManager; - private LogManager appLogManager; private KeyValueManager keyValueManager; @@ -154,14 +148,6 @@ this.appLogManager = appLogManager; } - public void setWareHouseManager(WareHouseManager wareHouseManager) { - this.wareHouseManager = wareHouseManager; - } - - public void setUserManager(UserManager userManager) { - this.userManager = userManager; - } - public void setSupplyRoomConfigManager( SupplyRoomConfigManager supplyRoomConfigManager) { this.supplyRoomConfigManager = supplyRoomConfigManager; @@ -242,7 +228,7 @@ * @param orgUnitCoding 科室编码 * @return */ - private String getWarningTousseGoodsSQL(int supplyRoomType, String orgUnitCoding) { + private String getWarningTousseGoodsSQL(boolean isFirstOrSecondSupplyRoom, String orgUnitCoding, boolean isFirstInvoice) { //已过失效期的时间(即当前时间(含时分秒)) String nowDateForValidUtil = ForgonDateUtils.SIMPLEDATEFORMAT_YYYYMMDDHHMMSS.format(new Date()); //已过预警期但未过失效期的时间(即当前时间(含时分秒)) @@ -252,19 +238,35 @@ nowDateForWarningUtil = ForgonDateUtils.SIMPLEDATEFORMAT_YYYYMMDD.format(new Date()); } + //根据当前登录科室是否供应室,查询不同状态的包实例 + String tousseStatusSql = ""; + if(isFirstOrSecondSupplyRoom){ + //当前登录科室为供应室时,查询供应室已经灭菌但是没有发货的即将过期器械包 + tousseStatusSql = " and (po.orgUnitCoding = '" + orgUnitCoding + "' and po.status='" + TousseInstance.STATUS_STERILED + "') "; + }else{ + + //发货位置的查询语句,区分一次和二次发货 + String invoiceLocationSql = ""; + if(isFirstInvoice){ + invoiceLocationSql = " and po.location ='" + orgUnitCoding + "' and po.invoice2_id is null "; + }else{ + invoiceLocationSql = " and po.location_2 ='" + orgUnitCoding + "' "; + } + + //当前登录科室为临床科室时,查询临床科室已发货、已签收的即将过期器械包 + tousseStatusSql = invoiceLocationSql + " and " + SqlBuilder.build_IN_Statement("po.status", SqlBuilder.IN, + TousseInstance.STATUS_SHIPPED, TousseInstance.STATUS_SIGNED) + " "; + } + String sql = null; - sql = "select count(*) A from " + TousseInstance.class.getSimpleName() + " po join " + TousseDefinition.class.getSimpleName() + " td on po.tousseDefinition_id = td.id " - + " join " + TousseDefinition.class.getSimpleName() + " tdAcestor on tdAcestor.id=td.ancestorID " + sql = "select count(1) A from " + TousseInstance.class.getSimpleName() + " po join " + TousseDefinition.class.getSimpleName() + " td on po.tousseDefinition_id = td.id " + " where po.validUntil > " + dateQueryAdapter.dateAdapter(nowDateForValidUtil) + " and po.warningUntil < " + dateQueryAdapter.dateAdapter(nowDateForWarningUtil) - + " and ((case when po.location_2 is not null then po.location_2 else po.location end = '" + orgUnitCoding + "' " - + " and " + SqlBuilder.build_IN_Statement("po.status", SqlBuilder.IN, - TousseInstance.STATUS_SHIPPED, TousseInstance.STATUS_SIGNED) + ")" - +" or (po.orgUnitCoding = '" + orgUnitCoding + "'" - + " and po.status='" + TousseInstance.STATUS_STERILED + "'))" - + " and (tdAcestor.warningType is null or tdAcestor.warningType not in ('" + TousseDefinition.WARNING_TYPE_NEVERWARN + "','" + TousseDefinition.WARNING_TYPE_DISABLED_TOUSSE + "'))" + + tousseStatusSql + + "and not exists (select 1 from " + TousseDefinition.class.getSimpleName() + + " tdAcestor where tdAcestor.ancestorID = td.ancestorID and tdAcestor.warningType in ('" + TousseDefinition.WARNING_TYPE_NEVERWARN + "','" + TousseDefinition.WARNING_TYPE_DISABLED_TOUSSE + "'))" //聚合包内的普通包实例不显示出来 + " and po.comboTousseInstanceId is null " ; @@ -277,20 +279,34 @@ * @param orgUnitCoding 科室编码 * @return */ - private String getExpiredToussesCount(int roomType, - String orgUnitCoding) { + private String getExpiredToussesCount(boolean isFirstOrSecondSupplyRoom, + String orgUnitCoding, boolean isFirstInvoice) { String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); String sql = ""; - sql = "select count(*) B from " + TousseInstance.class.getSimpleName() + " po join " + TousseDefinition.class.getSimpleName() + " td on po.tousseDefinition_id = td.id " + String tousseStatusSql = ""; + if(isFirstOrSecondSupplyRoom){ + //当前登录科室为供应室时,查询供应室已经灭菌但是没有发货的即将过期器械包 + tousseStatusSql = " and (po.orgUnitCoding = '" + orgUnitCoding + "' and po.status='" + TousseInstance.STATUS_STERILED + "') "; + }else{ + + //发货位置的查询语句,区分一次和二次发货 + String invoiceLocationSql = ""; + if(isFirstInvoice){ + invoiceLocationSql = " and po.location ='" + orgUnitCoding + "' and po.invoice2_id is null "; + }else{ + invoiceLocationSql = " and po.location_2 ='" + orgUnitCoding + "' "; + } + + //当前登录科室为临床科室时,查询临床科室已发货、已签收的即将过期器械包 + tousseStatusSql = invoiceLocationSql + " and " + SqlBuilder.build_IN_Statement("po.status", SqlBuilder.IN, + TousseInstance.STATUS_SHIPPED, TousseInstance.STATUS_SIGNED) + " "; + } + sql = "select count(1) B from " + TousseInstance.class.getSimpleName() + " po join " + TousseDefinition.class.getSimpleName() + " td on po.tousseDefinition_id = td.id " + " where po.validUntil < " + dateQueryAdapter.dateAdapter(date) - + " and ((case when po.location_2 is not null then po.location_2 else po.location end = '" + orgUnitCoding + "' " - + " and " + SqlBuilder.build_IN_Statement("po.status", SqlBuilder.IN, - TousseInstance.STATUS_SHIPPED, TousseInstance.STATUS_SIGNED) + ")" - +" or (po.orgUnitCoding = '" + orgUnitCoding + "'" - + " and po.status='" + TousseInstance.STATUS_STERILED + "'))" - + " and td.ancestorID not in (select ancestorID from " + TousseDefinition.class.getSimpleName() - + " where (warningType in ('" + TousseDefinition.WARNING_TYPE_NEVERWARN + "','" + TousseDefinition.WARNING_TYPE_TOUSSE + "'))) " + + tousseStatusSql + + " and not exists (select ancestorID from " + TousseDefinition.class.getSimpleName() + + " where td.ancestorID = ancestorID and warningType in ('" + TousseDefinition.WARNING_TYPE_NEVERWARN + "','" + TousseDefinition.WARNING_TYPE_TOUSSE + "')) " // 聚合包内的普通包实例不显示出来 + " and po.comboTousseInstanceId is null "; return sql; @@ -300,24 +316,26 @@ /** * 召回信息 */ - @SuppressWarnings("unchecked") private int getRecallRecord(int roomType, String orgunitCoding) { - String sql = ""; - //一级供应室能看到所有 + String departCodeSql = ""; if (roomType == SupplyRoomConfig.SUPPLYROOM_TYPE_FIRST_SUPPLYROOM) { - sql = " where po.recallRecord.status = '" + RecallRecord.STATUS_UNFINISHED + "'"; + departCodeSql = ""; }else{//其它科室查看自己的待召回的物品 - sql = " where po.recallRecord.status = '" + RecallRecord.STATUS_UNFINISHED + "' and po.departCode = '"+orgunitCoding+"'"; + departCodeSql = " and rri.departCode = '"+orgunitCoding+"'"; } - List recallRecordItemList = objectDao.findBySql(RecallRecordItem.class.getSimpleName(), sql); - int goodsAmount = 0; - if(recallRecordItemList != null){ - for (RecallRecordItem recallRecordItem : recallRecordItemList) { - goodsAmount += recallRecordItem.getTousseInstances().size(); - } - } - return goodsAmount; + String sql = String.format("select count(1) from %s rr " + + "join %s rri on rri.recallRecord_id = rr.id " + + "join %s ti on rri.id = ti.recallRecordItem_id " + + "where rr.status = '%s' %s ", + RecallRecord.class.getSimpleName(), + RecallRecordItem.class.getSimpleName(), + TousseInstance.class.getSimpleName(), + RecallRecord.STATUS_UNFINISHED, + departCodeSql); + + return objectDao.countBySql(sql); + } /** @@ -388,37 +406,45 @@ && (CollectionUtils.isEmpty(warningTypeList) || CollectionUtils.isNotEmpty(warningTypeList) && warningTypeList.contains(SystemWarningItemVO.WARNING_TYPE_TOUSSE))){ - // 即将过期的器械包物品 - String warningSql = getWarningTousseGoodsSQL(roomType, - orgUnitCoding); - String expiredSql = getExpiredToussesCount(roomType, - orgUnitCoding); - - String comboCountSql = "select A,B from (" + warningSql - + ") a cross join (" + expiredSql + ") b"; - ResultSet rs = objectDao.executeSql(comboCountSql); int warningToussesAmount = 0; - int expiredToussesAmount = 0; + // 查询供应室灭菌的即将过期和已经过期的器械包数量 + String warningToussesAmountSql = loadWarningTousseAmountSql(orgUnitCoding, roomType); + + ResultSet rs = null; try { + rs = objectDao.executeSql(warningToussesAmountSql); while(rs.next()){ - warningToussesAmount = rs.getInt(1); - expiredToussesAmount = rs.getInt(2); + warningToussesAmount += rs.getInt(1); } } catch (SQLException e) { e.printStackTrace(); }finally { DatabaseUtil.closeResultSetAndStatement(rs); } + // 即将过期的器械包物品 if (warningToussesAmount > 0) { SystemWarningItemVO vo = new SystemWarningItemVO(); vo.setWarningItemType(SystemWarningItemVO.WARNING_TYPE_TOUSSE); vo.setWarningAmount(warningToussesAmount); warningList.add(vo); } - + int expiredToussesAmount = 0; + String expiredToussesAmountSql = loadExpiredTousseAmountSql(orgUnitCoding, roomType); + + ResultSet rs1 = null; + try { + rs1 = objectDao.executeSql(expiredToussesAmountSql); + while(rs1.next()){ + expiredToussesAmount += rs1.getInt(1); + } + } catch (SQLException e) { + e.printStackTrace(); + }finally { + DatabaseUtil.closeResultSetAndStatement(rs1); + } + // 已过期的器械包物品 - if (expiredToussesAmount > 0) { SystemWarningItemVO vo = new SystemWarningItemVO(); vo.setWarningItemType(SystemWarningItemVO.WARNING_TYPE_DISABLED_TOUSSE); @@ -661,6 +687,58 @@ } /** + * 返回查询已经过期的器械包数量的语句 + * @param orgUnitCoding + * @param roomType + * @return + */ + private String loadExpiredTousseAmountSql(String orgUnitCoding, int roomType) { + String expiredTousseAmountSql = ""; + if(roomType == 1 || roomType == 2){ + //供应室处理的已灭菌的已经过期器械包实例数量 + String sql1 = getExpiredToussesCount(true, orgUnitCoding, true); + //发货到供应室的已发货已签收的已经过期包实例数量(一次发货) + String sql2 = getExpiredToussesCount(false, orgUnitCoding, true); + //发货到供应室的已发货已签收的已经过期包实例数量(二次发货) + String sql3 = getExpiredToussesCount(false, orgUnitCoding, false); + expiredTousseAmountSql = String.format("select sum(valid.B) from (%s union all %s union all %s ) valid ", sql1, sql2, sql3); + }else{ + //临床科室的已发货已签收的已经过期包实例数量(一次发货) + String sql1 = getExpiredToussesCount(false, orgUnitCoding, true); + //临床科室的已发货已签收的已经过期包实例数量(二次发货) + String sql2 = getExpiredToussesCount(false, orgUnitCoding, false); + expiredTousseAmountSql = String.format("select sum(valid.B) from (%s union all %s ) valid ", sql1, sql2); + } + return expiredTousseAmountSql; + } + + /** + * 返回查询即将过期的器械包数量的语句 + * @param orgUnitCoding + * @param roomType + * @return + */ + private String loadWarningTousseAmountSql(String orgUnitCoding, int roomType) { + String warningTousseAmountSql = ""; + if(roomType == 1 || roomType == 2){ + //供应室处理的已灭菌的即将过期器械包实例数量 + String sql1 = getWarningTousseGoodsSQL(true, orgUnitCoding, true); + //发货到供应室的已发货已签收的即将过期包实例数量(一次发货) + String sql2 = getWarningTousseGoodsSQL(false, orgUnitCoding, true); + //发货到供应室的已发货已签收的即将过期包实例数量(二次发货) + String sql3 = getWarningTousseGoodsSQL(false, orgUnitCoding, false); + warningTousseAmountSql = String.format("select sum(warn.A) from (%s union all %s union all %s ) warn ", sql1, sql2, sql3); + }else{ + //临床科室的已发货已签收的即将过期包实例数量(一次发货) + String sql2 = getWarningTousseGoodsSQL(false, orgUnitCoding, true); + //临床科室的已发货已签收的即将过期包实例数量(二次发货) + String sql3 = getWarningTousseGoodsSQL(false, orgUnitCoding, false); + warningTousseAmountSql = String.format("select sum(warn.A) from (%s union all %s ) warn ", sql2, sql3); + } + return warningTousseAmountSql; + } + + /** * 小于最小库存的一次性物品 * @param orgUnitCode * @return