Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationFormForApproval.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationFormForApproval.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationFormForApproval.jsp (revision 21813) @@ -0,0 +1,24 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ include file="/common/taglibs.jsp"%> +<%@ include file="/common/includeExtJs4_2.jsp"%> +<% + request.setAttribute("expensiveGoodsApplicationId", 125086); +%> + + + + + + + + + + 高值耗材申请单审批 + + + + + \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationFormForApproval.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationFormForApproval.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationFormForApproval.js (revision 21813) @@ -0,0 +1,648 @@ +var windowObj = null; +var formObj = null; +//高值耗材的store +var expensiveGoodsStore = null; +//高值耗材申请项top.Ext4.tree.Panel的数据仓库 +var treePanelStore = null; + + +/** + * 审批高值耗材申请单时对申请单的修改. + * @param id 高值耗材申请单id + */ +function eidtExpensiveGoodsApplicationForApproval (id) { + if (!id) { + showResult('高值耗材申请单id不能为空!'); + return false; + } + + /** + * 申请的物品模型 + */ + top.Ext4.define('ExpensiveGoodsModel', { + extend : 'top.Ext4.data.Model', + idProperty: 'expensiveGoodsId', //指定id属性 + fields: [ + {name : 'id'}, //申请项的id + {name : 'amount'}, //申请项的数量 + {name : 'expensiveGoodsId'}, //高值耗材id + {name : 'showName'}, //高值耗材的显示名称(即:名称[规格]) + {name : 'name'}, //高值耗材的名称 + {name : 'specification'}, //高值耗材的规格 + {name : 'supplierName'}, //高值耗材的生产厂家 + {name : 'referencePrice'} //高值耗材的参考价 + ]}); + + expensiveGoodsStore = new top.Ext4.data.Store({ + pageSize: 100, + fields: [ + {name : 'id'}, //高值耗材id + {name : 'showName'}, //高值耗材的显示名称(即:名称[规格]) + {name : 'name'}, //高值耗材的名称 + {name : 'specification'}, //高值耗材的规格 + {name : 'referencePrice'} //高值耗材的参考价 + ], + proxy : { + type : 'ajax', + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!searchExpensiveGoods.do', + reader : { + type : 'json', + totalProperty : 'totalCount', + root : 'data' + } + }, + listeners: { + beforeload : function(store, operation, eOpts){ + var rawValue = top.Ext4.getCmp('expensiveGoodsSupplier').getRawValue(); + var value = top.Ext4.getCmp('expensiveGoodsSupplier').getValue(); + if (rawValue && value) { + store.proxy.extraParams.supplierId = value; + } else { + showResult('请先选择生产厂家!'); + return false; + } + } + } + }); + + //高值耗材生产厂家的store + var expensiveGoodsSupplierStore = new top.Ext4.data.Store({ + fields: [ + {name : 'id'}, //高值耗材生产厂家的id + {name : 'name'} //高值耗材生产厂家的名称 + ], + proxy : { + extraParams : {supplierType : '生产厂家'}, + type : 'ajax', + url : WWWROOT + '/disinfectSystem/baseData/expensiveGoodsSupplierAction!getSupplierData.do', + reader : { + type : 'json', + totalProperty : 'totalCount', + root : 'data' + } + } + }); + + treePanelStore = top.Ext4.create('top.Ext4.data.TreeStore', { + autoLoad : true, + clearOnLoad : true, + model : 'ExpensiveGoodsModel', + proxy : { + type : 'memory', + reader : { + type : 'json', + root : 'children' + } + } + }); + + /** + * 高值耗材申请项top.Ext4.tree.Panel + */ + top.Ext4.define('expensiveGoodsApplicationTreeGrid', { + extend: 'top.Ext4.tree.Panel', + xtype: 'tree-grid', + useArrows: true, + rootVisible: false, + multiSelect: false, + columnLines: true, + rowLines: true, + cls: 'no-leaf-icons', + columns : [{ + dataIndex: 'id', hidden: true + },{ + dataIndex: 'expensiveGoodsId', hidden: true + },{ + dataIndex: 'name', hidden: true + },{ + dataIndex: 'specification', hidden: true + },{ + header: '生产厂家',dataIndex: 'supplierName', width: 200 + },{ + header: '名称', dataIndex: 'showName', width: 250 + },{ + header: '申请数量', dataIndex : 'amount', width: 100, align: 'center', sortable: false, + editor: { + xtype: 'numberfield', + allowBlank: true, + allowDecimals :false, + minValue: 0, + maxValue: 9999, + listeners: { + specialkey: function(field, event, eOpts) { + if (event.getKey() === event.TAB) { + //阻止按Tab,因为这里的CellEditing按了tab会有bug + event.stopEvent(); + } + } + } + } + },{ + header: '价格',dataIndex: 'referencePrice', width: 70 + }], + viewConfig : { + toggleOnDblClick: false, + markDirty:false + }, + initComponent: function() { + this.cellEditing = new top.Ext4.grid.plugin.CellEditing({ + clicksToEdit: 2, + listeners: { + beforeedit: function(editor, context, eOpts){ + var record = context.record; + + }, + edit:function(editor, context, eOpts){ + + } + } + }); + top.Ext4.apply(this, { + plugins: [this.cellEditing] + }); + this.superclass.initComponent.call(this); + } + }); + + formObj = new top.Ext4.form.Panel({ + frame : true, + border : 0, + labelSeparator : ':', + bodyPadding : '5 5 0', + autoScroll : true, + buttonAlign : 'center', + fieldDefaults : { + labelAlign : 'right' + }, + layout : { + type : 'vbox' + }, + items : [ + {xtype: 'hidden', name: 'id', id : 'id', value: id}, + {xtype: 'hidden', name: 'tousseItems', id : 'tousseItems'}, + + { + xtype: 'fieldset', + title: '基本信息', + layout: 'column', + height : 200, + width: '100%', + items: [{ //流水号、申请人、时间 + xtype : 'container', + layout : {type : 'hbox'}, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '流水号', + maxLength : '41', + flex : 1, + id : 'serialNumber', + name : 'serialNumber', + allowBlank : true, + readOnly : true, + fieldCls : 'fieldReadOnlyNoRemoveAndTop' + },{ + xtype : 'textfield', + fieldLabel : '申请人', + maxLength : '255', + flex : 1, + id : 'applicant', + name : 'applicant', + allowBlank : false, + readOnly : true, + fieldCls : 'fieldReadOnlyNoRemoveAndTop' + },{ + xtype : 'textfield', + fieldLabel : '时间', + flex : 1, + id : 'applicationTimeStr', + name : 'applicationTimeStr', + allowBlank : false, + readOnly : true, + fieldCls : 'fieldReadOnlyNoRemoveAndTop' + }] + },{ //申请科室、结算科室、处理科室 + xtype : 'container', + layout : {type : 'hbox'}, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '申请科室', + flex : 1, + id : 'depart', + name : 'depart', + allowBlank : false, + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '结算科室', + flex : 1, + id : 'settleAccountsDepart', + name : 'settleAccountsDepart', + allowBlank : false, + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '处理科室', + flex : 1, + id : 'handleDepart', + name : 'handleDepart', + allowBlank : false, + readOnly : true + }] + },{ //住院号、诊疗号、病人姓名 + xtype : 'container', + layout : {type : 'hbox'}, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '住院号', + flex : 1, + id : 'hospitalNumber', + name : 'hospitalNumber', + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '诊疗号', + flex : 1, + id : 'clinicNumber', + name : 'clinicNumber', + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '病人姓名', + flex : 1, + id : 'patient', + name : 'patient', + readOnly : true + }] + },{ //病区、病室、床位 + xtype : 'container', + layout : {type : 'hbox'}, + height: 25, + hidden : sstsConfig.hidePatientArea, + flex : 1, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '病区', + maxLength : '50', + id : 'patientArea', + name : 'patientArea', + flex : 1, + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '病室', + maxLength : '50', + id : 'roomNumber', + name : 'roomNumber', + hidden : sstsConfig.hideRoomNumber, + flex : 1, + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '床位', + maxLength : '50', + id : 'bedNumber', + name : 'bedNumber', + hidden : sstsConfig.hideRoomNumber, + flex : 1, + readOnly : true + }] + },{ //年龄、性别、病人所属科室 + xtype : 'container', + layout : {type : 'hbox'}, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '年龄', + id : 'patientAge', + name : 'patientAge', + flex : 1, + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '性别', + id : 'patientSex', + name : 'patientSex', + flex : 1, + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '病人所属科室', + maxLength : '16', + id : 'ascriptionDepartment', + name : 'ascriptionDepartment', + flex : 1, + readOnly : true + }] + },{ //手术名称、手术时间、医生 + xtype : 'container', + layout : {type : 'hbox'}, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '手术名称', + id : 'surgery', + name : 'surgery', + flex : 1, + readOnly : true + },{ + xtype : 'datefield', + fieldLabel : '手术时间', + id : 'operationTime', + name : 'operationTime', + selectOnFocus :true, + format : 'Y-m-d H:i', + flex : 1, + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '医生', + id : 'doctor', + name : 'doctor', + flex : 1, + readOnly : true + }] + },{ //手术间、备注 + xtype : 'container', + layout : {type : 'hbox'}, + width:790, + height: 25, + items : [{ + xtype : 'textfield', + fieldLabel : '手术间', + id : 'operationRoom', + name : 'operationRoom', + flex : 1.3, + readOnly : true + },{ + xtype : 'textfield', + fieldLabel : '备注', + id : 'remark', + name : 'remark', + flex : 3 + }] + }] + },{ + xtype: 'container', + width: '100%', + height: 350, + layout: 'fit', + items: { + xtype : 'tree-grid', + store : treePanelStore, + tbar:[{ + text: "生产厂家:" + },{ + xtype: 'combo', + id : 'expensiveGoodsSupplier', + name : 'expensiveGoodsSupplier', + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + matchFieldWidth: false, + width : 200, + listConfig: {width : 200}, + store : expensiveGoodsSupplierStore, + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + listeners: { + select: function(combo, records, index) { + expensiveGoodsStore.load(); + top.Ext4.getCmp('expensiveGoods').setValue('') + } + } + },{ + text: "物品名称:" + },{ + xtype: 'combo', + id : 'expensiveGoods', + name : 'expensiveGoods', + queryParam : 'spell', + minChars : 0, + valueField : 'id', + displayField : 'showName', + matchFieldWidth: false, + width : 300, + listConfig: {width : 300}, + store : expensiveGoodsStore, + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + pageSize:100, + listeners: { + focus: function(thiz, the, eOpts) { + var rawValue = top.Ext4.getCmp('expensiveGoodsSupplier').getRawValue(); + if (!rawValue) { + showResult('请先选择生产厂家!'); + top.Ext4.getCmp('expensiveGoodsSupplier').focus(); + } + } + } + },{ + text:"数量:" + },{ + xtype : 'numberfield', + id : 'amount', + name : 'amount', + style : 'text-align: left', + width : 60, + maxValue: 9999, + minValue: 1, + allowNegative : false, + allowDecimals : false, + listeners : { + specialkey : function(field, ee) { + if (ee.getKey() == top.Ext4.EventObject.ENTER) { + addExpensiveGoods(); + } + } + } + },{ + xtype:'button', + id : 'addTousseBt', + iconCls : 'btn_ext_add', + handler : function() { + addExpensiveGoods(); + } + }] + } + }], + buttons : [{ + id : 'saveBtn', + text : '提交', + handler : function() { + submitSaveExpensiveGoodsApplication(); + } + },{ + text : '取消', + handler : function() { + windowObj.close(); + } + }] + }); + + windowObj = new top.Ext4.window.Window({ + layout : 'fit', + title : '申请高值耗材', + width : 900, + height : 600, + resizable :false, + modal : true, + border : false, + plain : true, + items : [formObj] + }); + windowObj.show(); + + if (id) { + formObj.form.load({ + url : WWWROOT + '/disinfectSystem/expensivegoodsapplication/expensiveGoodsApplicationAction!loadExpensiveGoodsApplication.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + var data = action.result.data; + + //1、“手术时间” + var operationTime = data.operationTime; + if(operationTime){ + top.Ext4.getCmp("operationTime").setValue(operationTime); + } + + //2、设置申请项 + treePanelStore.proxy.data = {children: data.tousseItems}; + treePanelStore.load(); + }, + failure : function(form, action) { + }, + params : { + id : id + } + }); + } + +} + +/** + * 添加高值耗材到申请物品列表. + * @returns {Boolean} + */ +function addExpensiveGoods() { + var amount = top.Ext4.getCmp('amount').getValue(); + var id = top.Ext4.getCmp('expensiveGoods').getValue(); + var showName = top.Ext4.getCmp('expensiveGoods').getRawValue(); + var expensiveGoodsSupplier = top.Ext4.getCmp('expensiveGoodsSupplier').getRawValue(); + + //1、先校验物品和数量 + if (!id || !showName) { + showResult('请选择要添加的物品!'); + return false; + } + if (!expensiveGoodsSupplier) { + showResult('物品的生产厂家不能为空!'); + return false; + } + + if (isNaN(amount) || amount <= 0) { + showResult('申请数量必须大于0!'); + return false; + } + + //2、如果申请列表已经存在此物则提示“此物已经存在!”(即:同一种物品并且数量大于0) + var findNode = treePanelStore.getNodeById(id); + if (findNode && findNode.get('amount')) { + showResult('此物已经存在!'); + return false; + } else { + if (findNode) { + findNode.set('amount', amount); + } else { + var selectRecord = expensiveGoodsStore.findRecord('id', id); + var node = top.Ext4.create('ExpensiveGoodsModel', { + id : 0, + amount: amount, + expensiveGoodsId : selectRecord.get('id'), + showName : selectRecord.get('showName'), + name : selectRecord.get('name'), + specification : selectRecord.get('specification'), + supplierName : expensiveGoodsSupplier, + referencePrice : selectRecord.get('referencePrice') + }); + treePanelStore.getRootNode().appendChild(node); + } + top.Ext4.getCmp('expensiveGoodsSupplier').setValue(); + top.Ext4.getCmp('expensiveGoods').setValue(); + top.Ext4.getCmp('amount').setValue(); + } +} + + +/** + * 提交或者暂存高值耗材申请单. + * @param commit 是否提交操作(为true则为提交操作,否则为暂存操作) + */ +function submitSaveExpensiveGoodsApplication() { + //设置申请项信息 + if (setApplyItems()) { + formObj.form.submit({ + url : WWWROOT + '/disinfectSystem/expensivegoodsapplication/expensiveGoodsApplicationAction!updateExpensiveGoodsApplicationForApproval.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + windowObj.close(); + showResult(action.result.message); + }, + failure : function(form, action) { + showResult(action.result.message); + } + }); + } else { + showResult("请填写申请的物品!"); + return; + } +} + +/** + * 设置申请项信息. + * @param treeStore + * @returns {Boolean} 申请项为空则返回false,否则返回true + */ +function setApplyItems(){ + var nodes = treePanelStore.getRootNode().childNodes; + + var items = []; + for (var i=0; i 0) { + var item = { + id: node.get('id'), + amount: node.get('amount'), + expensiveGoodsId: node.get('expensiveGoodsId'), + showName: node.get('showName'), + name: node.get('name'), + specification: node.get('specification'), + supplierName : node.get('supplierName'), + referencePrice : node.get('referencePrice') + }; + items.push(item); + } + } + + if (items.length > 0) { + top.Ext4.getCmp('tousseItems').setValue(JSON.stringify(items)); + return true; + } else { + return false; + } +} Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationForm.js =================================================================== diff -u -r21800 -r21813 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationForm.js (.../expensiveGoodsApplicationForm.js) (revision 21800) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationForm.js (.../expensiveGoodsApplicationForm.js) (revision 21813) @@ -740,16 +740,11 @@ treePanelStore.proxy.data = {children: data.tousseItems}; treePanelStore.load(); - //3、状态等于待发货才允许修改 - if (data.deliverStatus != '待发货') { - top.Ext4.getCmp('saveBtn').hide(); - } - - //4、已经提交则把隐藏暂存按钮 + //3、已经提交则把隐藏“暂存”和“提交”两个按钮 if (committedStatus) { top.Ext4.getCmp('temporarySave').hide(); + top.Ext4.getCmp('saveBtn').hide(); } - }, failure : function(form, action) { }, Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManagerImpl.java =================================================================== diff -u -r21801 -r21813 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManagerImpl.java (.../ExpensiveGoodsApplicationManagerImpl.java) (revision 21801) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManagerImpl.java (.../ExpensiveGoodsApplicationManagerImpl.java) (revision 21813) @@ -7,6 +7,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.BooleanUtils; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -52,17 +53,22 @@ @Override public void saveOrUpdate(ExpensiveGoodsApplication expensiveGoodsApplication, boolean commit, JSONArray items) { String deliverStatus = expensiveGoodsApplication.getDeliverStatus(); + boolean originalCommittedStatus = Boolean.valueOf(BooleanUtils.toBoolean(expensiveGoodsApplication.getCommittedStatus())); //提交状态 + if (StringTools.isNotBlank(deliverStatus) && !InvoicePlan.DELIVERSTATUS_AWAITDELIVER.equals(deliverStatus)) { throw new RuntimeException("发货状态必须为待发货才能修改!"); } + if (originalCommittedStatus) { + throw new RuntimeException("此单已经提交不能修改!"); + } if (items != null && items.size() > 0) { //1、设置申请项 setTousseItem(expensiveGoodsApplication, items); //2、设置时间(申请时间的赋值,两种操作需要赋值: 1、“第一次提交” 2、“暂存后的提交” 最好修改时间:无论提交或者暂存都要赋值) Date currentDateTime = new Date(); - if(expensiveGoodsApplication.getApplicationTime() == null || (commit && !expensiveGoodsApplication.getCommittedStatus())){ + if(expensiveGoodsApplication.getApplicationTime() == null || (commit && !originalCommittedStatus)){ expensiveGoodsApplication.setApplicationTime(currentDateTime); } expensiveGoodsApplication.setSubmitTime(currentDateTime); @@ -135,6 +141,7 @@ public void updateExpensiveGoodsApplicationForApproval( ExpensiveGoodsApplication expensiveGoodsApplication, JSONArray items) { setTousseItem(expensiveGoodsApplication, items); + objectDao.saveOrUpdate(expensiveGoodsApplication); } @Override @@ -146,7 +153,7 @@ if (approval) { } else { - boolean committedStatus = Boolean.valueOf(expensiveGoodsApplication.getCommittedStatus()); + boolean committedStatus = Boolean.valueOf(BooleanUtils.toBoolean(expensiveGoodsApplication.getCommittedStatus())); //提交状态 if (committedStatus) { expensiveGoodsApplication.setProcessStatus(ExpensiveGoodsApplication.PROCESSSTATUS_NOT_STARTED); expensiveGoodsApplication.setCurrentNodeDefinitionId(null);