Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManagerImpl.java =================================================================== diff -u -r15997 -r16027 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManagerImpl.java (.../InvoiceManagerImpl.java) (revision 15997) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManagerImpl.java (.../InvoiceManagerImpl.java) (revision 16027) @@ -6243,6 +6243,8 @@ mergeTousseRuleForInvoiceBatchPrint = supplyRoomConfig.getMergeTousseRuleForInvoiceBatchPrint(); } + Map recycleAmountMap = getTousseRecyclingAmount(invoices); + for (Invoice invoice : invoices) { List tousseList = invoiceTousseInstances.get(invoice.getId());//invoice.getTousseInstances(objectDao); if(CollectionUtils.isNotEmpty(tousseList)){ @@ -6297,6 +6299,7 @@ tempVo = new InvoicePrintVo(); tempVo.setAmount(1); + tempVo.setRecyclingAmount(recycleAmountMap.get(tousseDefinition.getAncestorID())); tempVo.setFrequency(frequency); tempVo.setName(tousseInstance.getTousseName()); tempVo.setUnit(tousseDefinition.getUnit()); @@ -6316,6 +6319,94 @@ } return tousseGroupIdPrintVoMap; } + /** + * 获取发货单中器械包(包括消毒物品)对应的回收数量。如果是不回收的,则获取申请数量 + * @param invoices + * @return + */ + private Map getTousseRecyclingAmount(Collection invoices){ + Map map = new HashMap(); + if(CollectionUtils.isNotEmpty(invoices)){ + List invoiceIds = invoices.stream().map(i->i.getId()).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(invoiceIds)){ + String idpredicate = SqlUtils.getNonStringFieldInCollectionsPredicate("i.id", invoiceIds); + String sql = "select m.ancestorID,m.isRecycling,m.tousseType,sum(m.recyclingAmount) as recyclingAmount,sum(m.amount) as amount from ( " + + " select td.ancestorID,td.isRecycling,td.tousseType,ti.recyclingAmount,ti.amount,ti.recyclingApplication_ID from " + TousseItem.class.getSimpleName() + + " ti inner join " + TousseDefinition.class.getSimpleName() + " td on td.id = ti.tousseDefinitionId" + + " ) m where m.recyclingApplication_ID in (select i.invoicePlan_ID from " + Invoice.class.getSimpleName() + + " i where "+idpredicate+") group by m.ancestorID,m.isRecycling,m.tousseType"; + ResultSet rs = objectDao.executeSql(sql); + if(rs != null){ + try { + while(rs.next()){ + Long tousseDefinitionId = rs.getLong("ancestorID"); + int recyclingAmount = rs.getInt("recyclingAmount"); + int amount = rs.getInt("amount"); + String tousseType = rs.getString("tousseType"); + String isRecycling = rs.getString("isRecycling"); + if(TousseDefinition.PACKAGE_TYPE_DRESSING.equals(tousseType) + || TousseDefinition.STR_NO.equals(isRecycling)){ + //敷料包或者是不回收的器械包,回收数量为申请数量 + recyclingAmount = amount; + } + map.put(tousseDefinitionId, MathTools.add(map.get(tousseDefinitionId), recyclingAmount).intValue()); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + DatabaseUtil.closeResultSetAndStatement(rs); + } + } + } + } + return map; + } + + /** + * 获取发货单中一次性物品对应的申领数量。 + * @param invoices + * @return + */ + private Map getDisposableApplyAmount(Collection invoices){ + Map map = new HashMap(); + if(CollectionUtils.isNotEmpty(invoices)){ + List invoiceIds = invoices.stream().map(i->i.getId()).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(invoiceIds)){ + String idpredicate = SqlUtils.getNonStringFieldInCollectionsPredicate("i.id", invoiceIds); + String sql = "select m.id,m.middlePackageUnit,m.transferScale,m.applicationSpecification,sum(m.middlePackageAmount) as middlePackageAmount,sum(m.amount) as amount from ( " + + " select dg.id,dg.middlePackageUnit,dg.transferScale,dg.applicationSpecification,ti.amount,ti.middlePackageAmount,ti.recyclingApplication_ID from " + TousseItem.class.getSimpleName() + + " ti inner join " + DisposableGoods.class.getSimpleName() + " dg on dg.id = ti.disposableGoodsId" + + " ) m where m.recyclingApplication_ID in (select i.invoicePlan_ID from " + Invoice.class.getSimpleName() + + " i where "+idpredicate+") group by m.id,m.middlePackageUnit,m.transferScale,m.applicationSpecification"; + ResultSet rs = objectDao.executeSql(sql); + if(rs != null){ + try { + while(rs.next()){ + Long id = rs.getLong("id"); + int middlePackageAmount = rs.getInt("middlePackageAmount"); + int amount = rs.getInt("amount"); + String middlePackageUnit = rs.getString("middlePackageUnit"); + String applicationSpecification = rs.getString("applicationSpecification"); + int transferScale = rs.getInt("transferScale"); + + if(StringTools.isNotEmpty(applicationSpecification) + && StringTools.isNotBlank(middlePackageUnit)&& + transferScale > 0){ + //如果申领规格和申领单位及转换系数有效,则为申领数量 + amount = middlePackageAmount; + } + map.put(id, MathTools.add(map.get(id), amount).intValue()); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + DatabaseUtil.closeResultSetAndStatement(rs); + } + } + } + } + return map; + } // 找出已经存在项 private Collection loadToussePrintData(Collection invoices){ if(CollectionUtils.isEmpty(invoices)) @@ -6326,6 +6417,7 @@ if(supplyRoomConfig != null){ mergeTousseRuleForInvoiceBatchPrint = supplyRoomConfig.getMergeTousseRuleForInvoiceBatchPrint(); } + Map recycleAmountMap = getTousseRecyclingAmount(invoices); List voList = new ArrayList(); for (Invoice invoice : invoices) { List tousseList = invoice.getTousseInstances(objectDao); @@ -6351,6 +6443,7 @@ tempVo = new InvoicePrintVo(); tempVo.setAmount(1); + tempVo.setRecyclingAmount(recycleAmountMap.get(tousseDefinition.getAncestorID())); tempVo.setFrequency(frequency); tempVo.setName(tousseInstance.getTousseName()); tempVo.setUnit(tousseDefinition.getUnit()); @@ -6477,6 +6570,7 @@ if(CollectionUtils.isEmpty(invoices) || invoiceTousseInstances == null || invoiceTousseInstances.size() <=0) return CollectionUtils.emptyCollection(); + Map recycleAmountMap = getTousseRecyclingAmount(invoices); Map map = new HashMap(); for (Invoice invoice : invoices) { List tousseList = invoiceTousseInstances.get(invoice.getId()); @@ -6528,6 +6622,7 @@ invoicePrintVo.setSpecification(materialJson.getString("materialStr")); invoicePrintVo.setSterilizerName(tousseInstance.getSterilizerName()); invoicePrintVo.setFrequency(tousseInstance.getSterileFrequency()); + invoicePrintVo.setRecyclingAmount(recycleAmountMap.get(tousseDefinition.getAncestorID())); if(tousseDefinition.applyEntireTousse()){ invoicePrintVo.setPrice(materialJson.getDouble("totalPrice")); }else{ @@ -6711,6 +6806,7 @@ if(CollectionUtils.isEmpty(invoices)) return CollectionUtils.emptyCollection(); + Map applyAmountMap = getDisposableApplyAmount(invoices); Map> map = new HashMap>(); for (Invoice invoice : invoices) { List diposableGoodsList = invoice @@ -6786,6 +6882,7 @@ if(dg != null){ tempVo.setName(dg.getName()); tempVo.setSpecification(dg.showSpecification()); + tempVo.setRecyclingAmount(applyAmountMap.get(dg.getId())); } } Index: ssts-web/src/main/webapp/disinfectsystem/config/dgszyy/print/printConfig.js =================================================================== diff -u -r15989 -r16027 --- ssts-web/src/main/webapp/disinfectsystem/config/dgszyy/print/printConfig.js (.../printConfig.js) (revision 15989) +++ ssts-web/src/main/webapp/disinfectsystem/config/dgszyy/print/printConfig.js (.../printConfig.js) (revision 16027) @@ -258,13 +258,13 @@ //{label : "东莞市中医院", dataIndex : '', fontSize : 10, position : ["5","1%","90%",5]}, // 标题 {label : "东莞市中医院供应室材料出库单", dataIndex : '', bold:1, fontSize : 15, position : ["5","40%","99%",5]}, - {label : "出库单号:", dataIndex : 'serialNumber2', fontSize : 9, position : ["30","0.25cm","90%",5]}, + {label : "发货单编号:", dataIndex : 'serialNumber2', fontSize : 9, position : ["30","0.25cm","90%",5]}, {label : "仓库:", dataIndex : 'sourceWarehouseName', fontSize : 9, position : ["30","45%","90%",5]}, - {label : "领料科室:", dataIndex : 'depart', fontSize : 9, position : ["30","80%","90%",5]}, + {label : "领用科室:", dataIndex : 'depart', fontSize : 9, position : ["30","80%","90%",5]}, {label : "业务类型:科室领用", dataIndex : '', fontSize : 9, position : ["50","0.25cm","90%",5]}, - {label : "摘要:", dataIndex : 'remark2', fontSize : 9, position : ["50","30%","90%",5]}, - {label : "领料人:", dataIndex : 'applicant', fontSize : 9, position : ["50","60%","90%",5]}, - {label : "编制日期:", dataIndex : 'sendTime', fontSize : 9, position : ["50","80%","90%",5]}, +// {label : "摘要:", dataIndex : 'remark2', fontSize : 9, position : ["50","30%","90%",5]}, + {label : "领物人:", dataIndex : 'applicant', fontSize : 9, position : ["50","45%","90%",5]}, + {label : "打印日期:", dataIndex : 'printDate', fontSize : 9, position : ["50","80%","90%",5]}, // {label : "住院号:", dataIndex : 'hospitalNumber', fontSize : 11, position : ["50","2%","90%",5]}, //页脚 @@ -280,19 +280,21 @@ position : ["70","0.25cm","26cm","10cm"], headRepeat : true, columns : [ - //{header : "序号", dataIndex : 'serialNumber', width : '5%', align : 'center', fontSize : 11}, - {header : "材料编码", dataIndex : 'externalCode', width : 100, align : 'left', fontSize : 9}, - {header : "材料名称", dataIndex : 'name', width : 300, align : 'center', fontSize : 9}, - {header : "规格型号", dataIndex : 'specification', width : 120, align : 'center', fontSize : 9}, - {header : "产地", dataIndex : 'supplierName', width : 200, align : 'center', fontSize : 9}, - {header : "批号", dataIndex : 'batchNumber', width : 100, align : 'center', fontSize : 9}, + {header : "序号", dataIndex : 'serialNumber', width : '100', align : 'center', fontSize : 9}, +// {header : "材料编码", dataIndex : 'externalCode', width : 100, align : 'left', fontSize : 9}, + {header : "物品名称", dataIndex : 'name', width : 400, align : 'center', fontSize : 9}, +// {header : "规格型号", dataIndex : 'specification', width : 120, align : 'center', fontSize : 9}, +// {header : "产地", dataIndex : 'supplierName', width : 200, align : 'center', fontSize : 9}, +// {header : "批号", dataIndex : 'batchNumber', width : 100, align : 'center', fontSize : 9}, // {header : "包装规格", dataIndex : 'packageSpec', width : '15%', align : 'center', fontSize : 11}, - {header : "单位", dataIndex : 'unit', width : 80, align : 'center', fontSize : 9}, - {header : "数量", dataIndex : 'amount', width : 80, align : 'right', fontSize : 9}, - {header : "单价", dataIndex : 'price', width : 80, align : 'right', fontSize : 9}, +// {header : "单位", dataIndex : 'unit', width : 80, align : 'center', fontSize : 9}, + {header : "单价", dataIndex : 'price', width : 100, align : 'right', fontSize : 9}, + {header : "实收数", dataIndex : 'recyclingAmount', width : 100, align : 'right', fontSize : 9}, + {header : "实发数", dataIndex : 'amount', width : 100, align : 'right', fontSize : 9}, {header : "金额", dataIndex : 'totalPrice', width : 100, align : 'right', fontSize : 9}, + {header : "发货日期", dataIndex : 'expireDate', width : 110, align : 'center', fontSize : 9}, {header : "有效期", dataIndex : 'expireDate', width : 110, align : 'center', fontSize : 9}, - {header : "备注", dataIndex : '', width : 50, align : 'center', fontSize : 9} + {header : "备注", dataIndex : '', width : 190, align : 'center', fontSize : 9} ] } Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePrint.js =================================================================== diff -u -r14510 -r16027 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePrint.js (.../invoicePrint.js) (revision 14510) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePrint.js (.../invoicePrint.js) (revision 16027) @@ -501,8 +501,16 @@ } totalAmount += invoicesInfo.goods[i].amount; } + var totalRecyclingAmount = 0; + for( var i = 0; i < invoicesInfo.goods.length; i++){ + if(invoicesInfo.goods[i].name == '合计'){ + continue; + } + totalRecyclingAmount += invoicesInfo.goods[i].recyclingAmount; + } invoicesInfo.totalPrice = totalPrice; invoicesInfo.totalGoodsAmount = totalAmount; + invoicesInfo.totalRecyclingAmount = totalRecyclingAmount; // var totalInfo = {'name': '合计','数量': totalAmount,'金额': totalPrice}; // invoicesInfo.goods.push(totalInfo); Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/vo/InvoicePrintVo.java =================================================================== diff -u -r15920 -r16027 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/vo/InvoicePrintVo.java (.../InvoicePrintVo.java) (revision 15920) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/vo/InvoicePrintVo.java (.../InvoicePrintVo.java) (revision 16027) @@ -31,6 +31,7 @@ private String operationTime = ""; private String validUntil = ""; private Double materialTotalPrice = 0.0; + private Integer recyclingAmount; //一次性物品 private String diposableGoodsName = ""; @@ -266,6 +267,14 @@ this.supplierName = StringTools.defaultString(supplierName); } + public Integer getRecyclingAmount() { + return recyclingAmount == null?0:recyclingAmount; + } + + public void setRecyclingAmount(Integer recyclingAmount) { + this.recyclingAmount = recyclingAmount==null?0:recyclingAmount; + } + public String nameWithSpecification(){ if(StringTools.isBlank(specification)){ return name;