Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/action/ExpensiveGoodsApplicationAction.java =================================================================== diff -u -r22307 -r22314 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/action/ExpensiveGoodsApplicationAction.java (.../ExpensiveGoodsApplicationAction.java) (revision 22307) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/action/ExpensiveGoodsApplicationAction.java (.../ExpensiveGoodsApplicationAction.java) (revision 22314) @@ -11,8 +11,9 @@ import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; +import com.forgon.directory.acegi.tools.AcegiHelper; +import com.forgon.directory.vo.LoginUserData; import com.forgon.disinfectsystem.entity.expensivegoodsapplication.ExpensiveGoodsApplication; -import com.forgon.disinfectsystem.entity.invoicemanager.InvoicePlan; import com.forgon.disinfectsystem.entity.tousseitem.TousseItem; import com.forgon.disinfectsystem.expensivegoodsapplication.service.ExpensiveGoodsApplicationManager; import com.forgon.entity.ExtJsEntity; @@ -24,7 +25,6 @@ import com.forgon.tools.util.ExtJsUtil; import com.forgon.tools.util.ForgonDateUtils; import com.forgon.util.ExtGridUtils; -import com.forgon.workflow.model.NodeDefinition; import com.forgon.workflow.model.WorkFlowApprovalTask; import com.forgon.workflow.vo.WorkFlowApprovalTaskVO; import com.opensymphony.xwork2.ModelDriven; @@ -72,8 +72,17 @@ * 加载高值耗材申请单 */ public void loadExpensiveGoodsApplicationList() { - String select = "select ip.id,ip.serialNumber,ip.depart,ip.settleAccountsDepart,ip.applicant,ip.applicationTime,ip.committedStatus,ip.deliverStatus,ip.remark "; - String where = String.format("from ExpensiveGoodsApplication ega join InvoicePlan ip on ip.id=ega.id where 1=1"); + + //1、当前登录用户的过滤(即:1、处理科室用户能看到已经提交的单 2、申请科室用户只能看到本科室申请的单 3、自己填的单) + LoginUserData loginUserData = AcegiHelper.getLoginUser(); + String currentOrgUnitCode = loginUserData.getCurrentOrgUnitCode(); + String userFullName = loginUserData.getUserFullName(); + String loginUserSql = String.format(" and ((ip.handleDepartCoding = '%s' and ip.committedStatus = 1) or ip.departCoding = '%s' or ip.applicant='%s') ", currentOrgUnitCode, currentOrgUnitCode, userFullName); + + + String select = "select ip.id,ip.serialNumber,ip.depart,ip.settleAccountsDepart,ip.handleDepart,ip.applicant,ip.applicationTime," + + "ip.submitTime,ip.committedStatus,ip.deliverStatus,ip.remark "; + String where = String.format("from ExpensiveGoodsApplication ega join InvoicePlan ip on ip.id=ega.id where 1=1 %s", loginUserSql); ExtJsEntity entity = ExtJsUtil.buildSQLEntity(select, where, ""); JSONObject result = extGridUtils.getPagedResult(entity); StrutsResponseUtils.output(result); Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationView.js =================================================================== diff -u -r22307 -r22314 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationView.js (.../expensiveGoodsApplicationView.js) (revision 22307) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationView.js (.../expensiveGoodsApplicationView.js) (revision 22314) @@ -14,12 +14,67 @@ */ function rendererTime(value, metaData, record, rowIndex, colIndex, store, view) { if (value) { - return Ext4.Date.format(new Date(value.time), 'Y-m-d H:i:s'); + return Ext4.Date.format(new Date(value.time), 'Y-m-d H:i'); } else { return ''; } } +/** + * 删除高值耗材申请单. + * @param grid + * @returns {Boolean} + */ +function deleteExpensiveGoodsApplication(grid) { + var records = grid.getSelectRecords(); + if (records.length == 0) { + showResult('请选择要删除的申请单!'); + return false; + } + + var ids = null; + for (var i = 0, len = records.length; i < len; i++) { + var data = records[i]; + + var id = data['id']; + var deliverStatus = data['deliverStatus']; + var serialNum = data['serialNumber']; + + if(deliverStatus=='已终止'){ + showResult('流水号为【'+serialNum+"】的申请单已终止,不能删除!"); + return false; + } + + if(deliverStatus =='已发货' || deliverStatus =='部分发货'){ + showResult('流水号为【'+serialNum+"】的申请单已发货或部分发货,不能删除!"); + return false; + } + + if (ids == null) { + ids = id; + } else { + ids = ids + ';' + id; + } + } + + Ext4.MessageBox.confirm("请确认","是否确定要删除选中的申请单?", + function(button, text) { + if ("yes" == button){ + Ext4.Ajax.request({ + url : WWWROOT + '/disinfectSystem/recyclingApplicationAction!deleteRecyclingApplication.do', + params : {ids : ids}, + success : function(response, options) { + showResult(response.responseText); + grid.reloadData(); + }, + failure : function(response, options) { + showResult(response.responseText); + } + }); + } + } + ); +} Ext4.onReady(function() { @@ -34,10 +89,14 @@ },{ header: '结算科室', dataIndex: 'settleAccountsDepart', width: 150, filterable: true, filter: {type: 'string'} },{ + header: '处理科室', dataIndex: 'handleDepart', width: 150, filterable: true, filter: {type: 'string'} + },{ header: '申请人', dataIndex: 'applicant', width: 70, filterable: true, filter: {type: 'string'} },{ - header: '申请时间', dataIndex: 'applicationTime', width: 150, filterable: true, filter: {type: 'date'}, renderer: rendererTime + header: '申请时间', dataIndex: 'applicationTime', width: 130, filterable: true, filter: {type: 'date'}, renderer: rendererTime },{ + header: '最后修改时间', dataIndex: 'submitTime', width: 130, filterable: true, filter: {type: 'date'}, renderer: rendererTime + },{ header: '已提交', dataIndex: 'committedStatus', width: 50, renderer: function(value, metaData, record, rowIndex, colIndex, store, view) { var color = ""; var status = '否'; @@ -61,10 +120,14 @@ },{ name : 'settleAccountsDepart', mapping : 'settleAccountsDepart' },{ + name : 'handleDepart', mapping : 'handleDepart' + },{ name : 'applicant', mapping : 'applicant' },{ name : 'applicationTime', mapping : 'applicationTime' },{ + name : 'submitTime', mapping : 'submitTime' + },{ name : 'committedStatus', mapping : 'committedStatus' },{ name : 'deliverStatus', mapping : 'deliverStatus' @@ -78,6 +141,12 @@ handler : function() { addOrEidtExpensiveGoodsApplicationForApply(null); } + },{ + text : '删除', + iconCls : 'btn_delete', + handler : function() { + deleteExpensiveGoodsApplication(grid); + } }]; grid = Ext4.create('ExtJs.forgon4.Grid', { @@ -86,7 +155,7 @@ fields : fields, columns : columns, tbar: tbar, - sorters : {property : 'id', direction: 'DESC'}, + sorters : {property : 'applicationTime', direction: 'DESC'}, extraParams : {}, //如果你要自定义参数,这里一定要先给一个空的对象,要不然会报空异常 showRightClick : false }); @@ -96,5 +165,4 @@ items : grid }); - }); \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationForm.js =================================================================== diff -u -r22307 -r22314 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationForm.js (.../expensiveGoodsApplicationForm.js) (revision 22307) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/expensiveGoodsApplication/expensiveGoodsApplicationForm.js (.../expensiveGoodsApplicationForm.js) (revision 22314) @@ -252,11 +252,11 @@ },{ dataIndex: 'specification', hidden: true },{ - header: '生产厂家',dataIndex: 'supplierName', width: 250 + header: '生产厂家',dataIndex: 'supplierName', width: 300 },{ - header: '名称', dataIndex: 'showName', width: 250 + header: '名称', dataIndex: 'showName', width: 300 },{ - header: '型号', dataIndex: 'expensiveGoodsModelName', width: 180 + header: '型号', dataIndex: 'expensiveGoodsModelName', width: 150 },{ header: '申请数量', dataIndex : 'amount', width: 70, align: 'center', sortable: false, editor: { @@ -393,7 +393,7 @@ setSettleAccountsDepartmentByApplyDepartment(settleAccountsDepartmentStore, departmentCode, departmentName); } }, - readOnly: notAllowChanges + readOnly: isApproval },{ xtype : 'combo', fieldLabel: '结算科室', @@ -422,7 +422,7 @@ Ext4.getCmp('settleAccountsDepartCoding').setValue(record.data.departmentCode); } }, - readOnly: notAllowChanges + readOnly: isApproval },{ xtype : 'combo', fieldLabel: '处理科室', @@ -448,7 +448,7 @@ Ext4.getCmp('handleDepartCoding').setValue(record.data.departmentCode); } }, - readOnly: notAllowChanges + readOnly: isApproval },{ xtype : 'textfield', fieldLabel : '住院号', @@ -567,13 +567,11 @@ minChars : 0, displayField : 'doctor', listConfig: {width: 300}, - forceSelection : true, lazyInit : true, triggerAction : 'all', hideTrigger : false, typeAhead : false, allowBlank : true, - forceSelection:false, store : commonlyUsedDoctorJsonStore, readOnly : notAllowChanges },{ @@ -616,8 +614,8 @@ valueField : 'id', displayField : 'name', matchFieldWidth: false, - width : 180, - listConfig: {width : 180}, + width : 230, + listConfig: {width : 300}, store : expensiveGoodsSupplierStore, forceSelection : true, lazyInit : true, @@ -643,8 +641,8 @@ valueField : 'id', displayField : 'showName', matchFieldWidth: false, - width : 260, - listConfig: {width : 260}, + width : 250, + listConfig: {width : 300}, store : expensiveGoodsStore, forceSelection : true, lazyInit : true, @@ -678,8 +676,8 @@ valueField : 'id', displayField : 'model', matchFieldWidth: false, - width : 180, - listConfig: {width : 180}, + width : 130, + listConfig: {width : 250}, store : expensiveGoodsModelStore, forceSelection : true, lazyInit : true, @@ -809,20 +807,6 @@ Ext4.getCmp('temporarySave').hide(); Ext4.getCmp('saveBtn').hide(); } - - - - - - //1、“手术时间” - var operationTime = data.operationTime; - if(operationTime){ - Ext4.getCmp("operationTime").setValue(operationTime); - } - - //2、设置申请项 - treePanelStore.proxy.data = {children: data.tousseItems}; - treePanelStore.load(); }, params : { id : id @@ -980,7 +964,7 @@ store.proxy.extraParams.formType = '高值耗材申请单'; }, load : function(thiz, records, successful, eOpts){ - if (records && records.length > 0) { + if (records && records.length == 1) { Ext4.getCmp('nextNodeHandler').setValue(records[0].data.userId); } } Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java =================================================================== diff -u -r22308 -r22314 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 22308) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 22314) @@ -121,6 +121,7 @@ import com.forgon.tools.util.ForgonDateUtils; import com.forgon.tools.util.SqlUtils; import com.forgon.treenode.model.THTreeNode; +import com.forgon.workflow.service.WorkFlowApprovalTaskManager; import com.google.common.collect.Maps; /** @@ -165,6 +166,8 @@ private ApplicationLogManager applicationLogManager; + private WorkFlowApprovalTaskManager workFlowApprovalTaskManager; + private volatile static ScheduledExecutorService executorService; private static ScheduledExecutorService getExecutorService() { if (executorService == null) { @@ -177,6 +180,11 @@ return executorService; } + public void setWorkFlowApprovalTaskManager( + WorkFlowApprovalTaskManager workFlowApprovalTaskManager) { + this.workFlowApprovalTaskManager = workFlowApprovalTaskManager; + } + public void setInventoryManager(InventoryManager inventoryManager) { this.inventoryManager = inventoryManager; } @@ -464,6 +472,15 @@ } else { delete(invoicePlan); } + + //这里如果是高值耗材,需要删除此申请单的代办审批任务 + if (InvoicePlan.TYPE_EXPENSIVEGOODS_FORM.equals(invoicePlan.getType())) { + //1、需要删除此申请单的代办审批任务 + Long currentNodeDefinitionId = invoicePlan.getCurrentNodeDefinitionId(); + if (DatabaseUtil.isPoIdValid(currentNodeDefinitionId)) { + workFlowApprovalTaskManager.deleteWorkFlowApprovalTaskByFormIdAndNodeDefinitionId(invoicePlan.getId(), currentNodeDefinitionId); + } + } applicationLogManager.saveApplicationLog(invoicePlan, "申请单删除", ApplicationLogStatusEnum.DELETE); return true; } else { Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationView.js =================================================================== diff -u -r22307 -r22314 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationView.js (.../goodsApplicationView.js) (revision 22307) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationView.js (.../goodsApplicationView.js) (revision 22314) @@ -1598,8 +1598,6 @@ addAndEditForeignTousseApplication(id); }else if(type == customTousseApplicationForm){ addAndEditCustomTousse(id,null,'01',function(){}); - }else if(type == expensiveGoodsForm) { //高值耗材申请单 - addOrEidtExpensiveGoodsApplicationForm (id); } }; Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/dwr/table/RecyclingApplicationTableManager.java =================================================================== diff -u -r21769 -r22314 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/dwr/table/RecyclingApplicationTableManager.java (.../RecyclingApplicationTableManager.java) (revision 21769) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/dwr/table/RecyclingApplicationTableManager.java (.../RecyclingApplicationTableManager.java) (revision 22314) @@ -218,9 +218,7 @@ if (CssdUtils.getSystemSetConfigByNameBool("hideReservationList", false)) { //手术预约申请单 excludeTypelist.add(InvoicePlan.TYPE_OPERATION_RESERVATION_APPLICATION); } - if (!CssdUtils.getSystemSetConfigByNameBool("enableExpensiveGoods", false)) { //高值耗材申请单 - excludeTypelist.add(InvoicePlan.TYPE_EXPENSIVEGOODS_FORM); - } + excludeTypelist.add(InvoicePlan.TYPE_EXPENSIVEGOODS_FORM); String excludeTypeSql = String.format(" and %s ", SqlBuilder.build_IN_Statement("po.type", SqlBuilder.NOT_IN, excludeTypelist)); sqlBuilder.append(excludeTypeSql); Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManagerImpl.java =================================================================== diff -u -r22307 -r22314 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManagerImpl.java (.../ExpensiveGoodsApplicationManagerImpl.java) (revision 22307) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/expensivegoodsapplication/service/ExpensiveGoodsApplicationManagerImpl.java (.../ExpensiveGoodsApplicationManagerImpl.java) (revision 22314) @@ -110,7 +110,7 @@ //1、设置申请项 setTousseItem(expensiveGoodsApplication, items); - //2、设置时间(申请时间的赋值,两种操作需要赋值: 1、“第一次提交” 2、“暂存后的提交” 最好修改时间:无论提交或者暂存都要赋值) + //2、设置时间(申请时间的赋值,两种操作需要赋值: 1、“第一次提交” 2、“暂存后的提交” 最后修改时间:无论提交或者暂存都要赋值) Date currentDateTime = new Date(); if(expensiveGoodsApplication.getApplicationTime() == null || (commit && !originalCommittedStatus)){ expensiveGoodsApplication.setApplicationTime(currentDateTime);