Index: ssts-web/src/main/webapp/systemmanage/operationNameView.js =================================================================== diff -u -r17643 -r18224 --- ssts-web/src/main/webapp/systemmanage/operationNameView.js (.../operationNameView.js) (revision 17643) +++ ssts-web/src/main/webapp/systemmanage/operationNameView.js (.../operationNameView.js) (revision 18224) @@ -1,4 +1,5 @@ var useTousseStore; +var useTousseStoreOfAppendTousse; var tousseAndDiposableGoodsStore; var formWindow; function submitForm(form,window,callMethodAction,callBack){ @@ -21,11 +22,12 @@ {name : 'itemId'}, {name : 'tousseDefinitionId'}, {name : 'name'}, - {name : 'amount'} + {name : 'amount'}, + {name : 'type'} ]); function addUseTousseItem(){ - var goodsName = top.Ext.getCmp('goodsSearch').getValue(); + var goodsName = top.Ext.getCmp('goodsSearch').getRawValue(); var amount = top.Ext.getCmp('amount').getValue(); if(goodsName == ""){ showResult("请选择物品!"); @@ -51,7 +53,8 @@ itemId : "", tousseDefinitionId : id, name : goodsName, - amount : amount + amount : amount, + type : commonGoods }); useTousseStore.add(record); top.Ext.getCmp('goodsSearch').setValue(); @@ -62,6 +65,45 @@ } } +function addUseTousseItemOfAppendTousse() { + var goodsName = top.Ext.getCmp('goodsSearchOfAppendTousse').getRawValue(); + var amount = top.Ext.getCmp('amountOfAppendTousse').getValue(); + if(goodsName == ""){ + showResult("请选择物品!"); + return ; + } + if(amount == ""){ + showResult("请输入数量!"); + return ; + } + var isExist = false; + var count = useTousseStoreOfAppendTousse.getCount(); + for(var i = 0 ; i < count ; i++){ + var record = useTousseStoreOfAppendTousse.getAt(i); + if(record.get("name") == goodsName){ + isExist = true; + break; + } + } + if(!isExist){ + var index = tousseAndDiposableGoodsStore.find("name",goodsName); + var id = tousseAndDiposableGoodsStore.getAt(index).data['id']; + var record = new goodsRecord({ + itemId : "", + tousseDefinitionId : id, + name : goodsName, + amount : amount, + type : appendGoods + }); + useTousseStoreOfAppendTousse.add(record); + top.Ext.getCmp('goodsSearchOfAppendTousse').setValue(); + top.Ext.getCmp('amountOfAppendTousse').setValue(); + top.Ext.getCmp('goodsSearchOfAppendTousse').focus(); + }else{ + showResult(goodsName + ",已添加!"); + } +} + function deleteGoodsItem(tousseDefinitionId){ for(var i = 0;i < useTousseStore.getCount();i++){ var record = useTousseStore.getAt(i); @@ -71,17 +113,28 @@ } } } +function deleteGoodsItemOfAppendTousse(tousseDefinitionId){ + for(var i = 0;i < useTousseStoreOfAppendTousse.getCount();i++){ + var record = useTousseStoreOfAppendTousse.getAt(i); + if(record.data.tousseDefinitionId == tousseDefinitionId){ + useTousseStoreOfAppendTousse.remove(record); + break; + } + } +} function setOperationUseTousse(id){ var rd = new Ext.data.JsonReader({ fields : [{ id : 'itemId', tousseDefinitionId : 'tousseDefinitionId', name : 'name', - amount : 'amount' + amount : 'amount', + type : 'type' }] }); useTousseStore = new top.Ext.data.Store({reader : rd}); + useTousseStoreOfAppendTousse = new top.Ext.data.Store({reader : rd}); var cm = new top.Ext.grid.ColumnModel([new top.Ext.grid.RowNumberer({header:"序号",width:40}),{ id:'id', @@ -108,6 +161,31 @@ return ""; } }]); + var cmOfAppendTousse = new top.Ext.grid.ColumnModel([new top.Ext.grid.RowNumberer({header:"序号",width:40}),{ + id:'id', + name:'id', + hidden :true, + dataIndex : 'id' + },{ + id : 'name', + header : "物品名称", + width:240, + dataIndex : 'name' + },{ + id : 'amount', + header : "数量", + width:100, + dataIndex : 'amount' + },{ + id : 'deleteItem', + header:'删除', + width :80, + menuDisabled: true, + dataIndex:'button', + renderer: function(v,p,record,rowIndex){ + return ""; + } + }]); tousseAndDiposableGoodsStore = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ @@ -136,31 +214,66 @@ fieldLabel : '物品名称', minChars : 0, valueField : 'id', - displayField : 'displayName', + displayField : 'name', anchor : '100%', width:300, store : tousseAndDiposableGoodsStore, lazyInit : true, triggerAction : 'all', hideTrigger : true, typeAhead : false, - allowBlank : true, + allowBlank : true + },{ + text : '数量' + },{ + xtype : 'textfield', + id : 'amount', + name : 'amount', + allowBlank:true, + width : 80, + regex: /^\d+$/, + regexText:'只能输入数字', + anchor : '95%', + tabIndex : 2, listeners : { - select : function(combo, record, index) { - top.Ext.getCmp('goodsSearch').setValue(record.data.name); - }/*, specialkey : function(field, e) { if (e.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('amount').focus(); + addUseTousseItem(); } - }*/ + } } },{ + text : '添加', + handler:function(){ + addUseTousseItem(); + } + }]; + + var tbarOfAppendTousse = [ { + text : '选择物品' + },{ + xtype : 'combo', + id : 'goodsSearchOfAppendTousse', + name : 'goodsSearchOfAppendTousse', + queryParam : 'spell', + fieldLabel : '物品名称', + minChars : 0, + valueField : 'id', + displayField : 'name', + anchor : '100%', + width:300, + store : tousseAndDiposableGoodsStore, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true + },{ text : '数量' },{ xtype : 'textfield', - id : 'amount', - name : 'amount', + id : 'amountOfAppendTousse', + name : 'amountOfAppendTousse', allowBlank:true, width : 80, regex: /^\d+$/, @@ -170,14 +283,14 @@ listeners : { specialkey : function(field, e) { if (e.getKey() == Ext.EventObject.ENTER) { - addUseTousseItem(); + addUseTousseItemOfAppendTousse(); } } } },{ text : '添加', handler:function(){ - addUseTousseItem(); + addUseTousseItemOfAppendTousse(); } }]; @@ -250,12 +363,13 @@ layout: 'form', items : [ new top.Ext.grid.GridPanel({ + title : '手术使用的器械包', id : 'configGrid', store : useTousseStore, tbar : tbar, cm : cm, width : 350, - height: 350, + height: 250, isCheckboxSelectionModel : true, frame : false, viewConfig: { @@ -268,6 +382,30 @@ }) }) ] + },{ + columnWidth : 1, + layout: 'form', + items : [ + new top.Ext.grid.GridPanel({ + title : '追加的器械包', + id : 'appendConfigGrid', + store : useTousseStoreOfAppendTousse, + tbar : tbarOfAppendTousse, + cm : cmOfAppendTousse, + width : 350, + height: 250, + isCheckboxSelectionModel : true, + frame : false, + viewConfig: { + forceFit:true + }, + bodyStyle : 'border:1px solid #afd7af', + anchor : '100%', + selModel : new top.Ext.grid.RowSelectionModel({ + singleSelect : false + }) + }) + ] }] }], buttons : [{ @@ -279,7 +417,6 @@ showResult("手术名称不能为空!"); return false; } - var count = useTousseStore.getCount(); var items = new Array(); var count = useTousseStore.getCount(); for(var i = 0 ; i < count ; i++){ @@ -288,9 +425,21 @@ itemId : record.get("itemId"), tousseDefinitionId : record.get("tousseDefinitionId"), name : record.get("name"), - amount : record.get("amount") + amount : record.get("amount"), + type : record.get("type") }); } + count = useTousseStoreOfAppendTousse.getCount(); + for(var i = 0 ; i < count ; i++){ + var record = useTousseStoreOfAppendTousse.getAt(i); + items.push({ + itemId : record.get("itemId"), + tousseDefinitionId : record.get("tousseDefinitionId"), + name : record.get("name"), + amount : record.get("amount"), + type : record.get("type") + }); + } var data = { orgUnitCoding : currentClickNode.attributes.keyId, @@ -357,13 +506,19 @@ } var tousseItems = operationNameJson.tousseItems; for(var i = 0 ;i < tousseItems.length ; i++){ + var type = tousseItems[i].type; var record = new goodsRecord({ itemId : tousseItems[i].itemId, tousseDefinitionId : tousseItems[i].tousseDefinitionId, name : tousseItems[i].name, - amount : tousseItems[i].amount + amount : tousseItems[i].amount, + type : type }); - useTousseStore.add(record); + if (type == appendGoods) { + useTousseStoreOfAppendTousse.add(record); + } else { + useTousseStore.add(record); + } } } }, Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/operationNameManager/action/OperationNameAction.java =================================================================== diff -u -r17643 -r18224 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/operationNameManager/action/OperationNameAction.java (.../OperationNameAction.java) (revision 17643) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/operationNameManager/action/OperationNameAction.java (.../OperationNameAction.java) (revision 18224) @@ -199,6 +199,7 @@ itemJson.put("tousseDefinitionId", item.getTousseDefinitionId()); itemJson.put("name", item.getName()); itemJson.put("amount", item.getAmount()); + itemJson.put("type", item.getType()); items.add(itemJson); } } Index: ssts-web/src/main/webapp/dataUpdater/sqls/4.8.2_4.8.3.sql =================================================================== diff -u --- ssts-web/src/main/webapp/dataUpdater/sqls/4.8.2_4.8.3.sql (revision 0) +++ ssts-web/src/main/webapp/dataUpdater/sqls/4.8.2_4.8.3.sql (revision 18224) @@ -0,0 +1 @@ +update OperationUseTousseItem set type='常用物品'; \ No newline at end of file Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/operationNameManager/service/OperationNameManagerImpl.java =================================================================== diff -u -r17643 -r18224 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/operationNameManager/service/OperationNameManagerImpl.java (.../OperationNameManagerImpl.java) (revision 17643) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/operationNameManager/service/OperationNameManagerImpl.java (.../OperationNameManagerImpl.java) (revision 18224) @@ -199,6 +199,7 @@ } String name = jsonItem.optString("name"); Integer amount = jsonItem.optInt("amount"); + String type = jsonItem.optString("type"); if(amount <= 0){ throw new RuntimeException(name + ",数量必须大于0!"); } @@ -213,6 +214,7 @@ useItem.setName(name); useItem.setOperationNameId(operationPo.getId()); useItem.setTousseDefinitionId(tousseDefinitionId); + useItem.setType(type); useTosseItems.add(useItem); } operationPo.setTousseItems(useTosseItems); Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/operationNameManager/OperationName.java =================================================================== diff -u -r18223 -r18224 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/operationNameManager/OperationName.java (.../OperationName.java) (revision 18223) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/operationNameManager/OperationName.java (.../OperationName.java) (revision 18224) @@ -1,7 +1,9 @@ package com.forgon.disinfectsystem.entity.basedatamanager.operationNameManager; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.persistence.CascadeType; import javax.persistence.Entity; @@ -208,5 +210,27 @@ this.appendTousseItems = appendTousseItems; } - + /** + * + * @return + */ + @Transient + public List getAllTousseItemsMergeByTousseDefinition() { + List allTousseItemsMergeByTousseDefinition = new ArrayList(); + if(CollectionUtils.isNotEmpty(tousseItems)){ + Map map = new HashMap(); + for (OperationUseTousseItem tousseItem : tousseItems) { + OperationUseTousseItem item = map.get(tousseItem.getTousseDefinitionId()); + if(item == null){ + allTousseItemsMergeByTousseDefinition.add(tousseItem); + map.put(tousseItem.getTousseDefinitionId() , tousseItem); + }else{ + allTousseItemsMergeByTousseDefinition.remove(item); + item.setAmount(item.getAmount() + tousseItem.getAmount()); + allTousseItemsMergeByTousseDefinition.add(item); + } + } + } + return allTousseItemsMergeByTousseDefinition; + } } Index: ssts-web/src/main/webapp/systemmanage/operationNameView.jsp =================================================================== diff -u -r15387 -r18224 --- ssts-web/src/main/webapp/systemmanage/operationNameView.jsp (.../operationNameView.jsp) (revision 15387) +++ ssts-web/src/main/webapp/systemmanage/operationNameView.jsp (.../operationNameView.jsp) (revision 18224) @@ -1,7 +1,7 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ include file="/common/taglibs.jsp"%> <%@page import="com.forgon.treenode.model.THTreeNode"%> - +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.operationNameManager.OperationUseTousseItem"%> @@ -20,6 +20,8 @@ Index: forgon-core/src/main/java/com/forgon/Constants.java =================================================================== diff -u -r17941 -r18224 --- forgon-core/src/main/java/com/forgon/Constants.java (.../Constants.java) (revision 17941) +++ forgon-core/src/main/java/com/forgon/Constants.java (.../Constants.java) (revision 18224) @@ -21,7 +21,7 @@ "4.2.3","4.2.4","4.2.5","4.2.6","4.2.7","4.2.8","4.2.9","4.3.0","4.3.1","4.3.2","4.3.3","4.3.4","4.3.5","4.3.6","4.3.7","4.3.8","4.3.9", "4.4.0","4.4.1","4.4.2","4.4.3","4.4.4","4.4.5","4.4.6","4.4.7","4.4.8","4.4.9","4.5.0","4.5.1","4.5.2","4.5.3","4.5.4","4.5.5","4.5.6","4.5.7","4.5.8", "4.5.9","4.6.0","4.6.1","4.6.2","4.6.3","4.6.4","4.6.5","4.6.6","4.6.7","4.6.8","4.6.9","4.7.0","4.7.1","4.7.2","4.7.3","4.7.4","4.7.5","4.7.6","4.7.7", - "4.7.8","4.7.9","4.8.0","4.8.1","4.8.2"};// 版本列表 + "4.7.8","4.7.9","4.8.0","4.8.1","4.8.2","4.8.3"};// 版本列表 public final static List SOFTWARE_VERSION_LIST = Arrays .asList(SOFTWARE_VERSION_ARRAY); public final static String SOFTWARE_VERSION = SOFTWARE_VERSION_ARRAY[SOFTWARE_VERSION_ARRAY.length - 1];// 软件最新版本