Index: ssts-web/src/main/webapp/disinfectsystem/sterilizationmanager/sterilizationrecord/sterilizationRecordForm.js =================================================================== diff -u -r29505 -r29508 --- ssts-web/src/main/webapp/disinfectsystem/sterilizationmanager/sterilizationrecord/sterilizationRecordForm.js (.../sterilizationRecordForm.js) (revision 29505) +++ ssts-web/src/main/webapp/disinfectsystem/sterilizationmanager/sterilizationrecord/sterilizationRecordForm.js (.../sterilizationRecordForm.js) (revision 29508) @@ -4332,70 +4332,29 @@ } } -function save() { - if(sstsConfig.enableScanSterilizationMonitoringPackage){ - var biologicalMonitoring = top.Ext.getCmp('biologicalMonitoring').getValue(); - var monitorTousseDisplay = top.Ext.getCmp('monitorTousseDisplay').getValue(); - var foreignTousseAmount = parseInt(top.Ext.getCmp('foreignTousseAmount').getValue()); - var implantAmount = parseInt(top.Ext.getCmp('implantAmount').getValue()); - var frequency = parseInt(top.Ext.getCmp('frequency').getValue()); - var sterilizerName = top.Ext.getCmp('sterilizerName').getValue(); - if(sstsConfig.enableSterilizerBioMonitoringIntervalReminder){ - Ext.Ajax.request( { - url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!sterilizerBioMonitoringIntervalReminder.do', - params : { - sterilizerName : sterilizerName - }, - success : function(response, options) { - var result = Ext.decode(response.responseText); - if(result.success){ - if(result.message){ - showResult(result.message) - } - } - } - }); - } - if(biologicalMonitoring == ''){ - showResult('监测包条码不能为空', null); - return; - } - if(monitorTousseDisplay !== ''){ - var monitorTousseDisplayArray = monitorTousseDisplay.split(';'); - if(monitorTousseDisplayArray.indexOf('每炉') >=0 && biologicalMonitoring == ''){ - showResult('当前灭菌记录需要扫描监测包条编码,否则不能提交保存。', null); - return; - }else if(monitorTousseDisplayArray.indexOf('每天第一炉') >=0 && frequency == 1 && biologicalMonitoring == ''){ - showResult('当前灭菌记录每天第一炉需要扫描监测包条编码,否则不能提交保存。', null); - return; - }else if(monitorTousseDisplayArray.indexOf('有植入物时') >=0 && implantAmount > 0 && biologicalMonitoring == ''){ - showResult('当前灭菌记录有植入物时需要扫描监测包条编码,否则不能提交保存。', null); - return; - }else if(monitorTousseDisplayArray.indexOf('有外来器械包时') >=0 && foreignTousseAmount > 0 && biologicalMonitoring == ''){ - showResult('当前灭菌记录有外来器械包时需要扫描监测包条编码,否则不能提交保存。', null); - return; - } - } - } +//保存表单 +function daveData(dataType){ if (!formObj.form.isValid()) { showResult('请正确填写表单各值', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); this.enable(); return false; } - var currentStatus = top.Ext.getCmp('currentStatus').getValue(); - var includeImplant = top.Ext.getCmp('includeImplant').getValue(); - var biologicalMonitoringStartDate = top.Ext.getCmp('biologicalMonitoringStartDate').getValue(); - var monitorUser = top.Ext.getCmp('monitorUser').getValue(); - if(currentStatus == '灭菌完成' && includeImplant == '是'){ - if(biologicalMonitoringStartDate == ''){ - showResult('生物监测开始时间不能为空'); - return false; - } - if(monitorUser == ''){ - showResult('监测员不能为空'); - return false; - } - } + if(dataType == 1){ + var currentStatus = top.Ext.getCmp('currentStatus').getValue(); + var includeImplant = top.Ext.getCmp('includeImplant').getValue(); + var biologicalMonitoringStartDate = top.Ext.getCmp('biologicalMonitoringStartDate').getValue(); + var monitorUser = top.Ext.getCmp('monitorUser').getValue(); + if(currentStatus == '灭菌完成' && includeImplant == '是'){ + if(biologicalMonitoringStartDate == ''){ + showResult('生物监测开始时间不能为空'); + return false; + } + if(monitorUser == ''){ + showResult('监测员不能为空'); + return false; + } + } + } //重新灭菌 if(isNewRecord){ var tempid = top.Ext.getCmp('id').getValue(); @@ -4412,20 +4371,21 @@ showResult("当前灭菌程序不能灭菌物品!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); return false; } - - //验证当前灭菌炉是否是灭菌中 - var objId = top.Ext.getCmp('id').getValue(); - if(objId == 0){ - DWREngine.setAsync(false); - var sign = true; - var sterilizerName = top.Ext.getCmp('sterilizerName').getValue(); - SterilizationRecordTableManager.isAllSterilizationed(sterilizerName,function(result){ - sign = result; - }); - DWREngine.setAsync(true); - if(!sign){ - showResult("当前灭菌炉正在灭菌,保存失败!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); - return false; + if(dataType == 1){ + //验证当前灭菌炉是否是灭菌中 + var objId = top.Ext.getCmp('id').getValue(); + if(objId == 0){ + DWREngine.setAsync(false); + var sign = true; + var sterilizerName = top.Ext.getCmp('sterilizerName').getValue(); + SterilizationRecordTableManager.isAllSterilizationed(sterilizerName,function(result){ + sign = result; + }); + DWREngine.setAsync(true); + if(!sign){ + showResult("当前灭菌炉正在灭菌,保存失败!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return false; + } } } // 验证循环计数器是否已经存在,一个灭菌炉的一个循环次数应是唯一的。 @@ -4454,6 +4414,13 @@ top.Ext.getCmp('cycleCounter').setValue(0); } } + + var url; + if(dataType == 1){ + url = WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!savesterilizationRecord.do'; + }else { + url = WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!savesterilizationRecord.do?status='+statusDraft; + } var nexFn = function(){ var result = getItemTreeData(); @@ -4465,7 +4432,7 @@ Ext.getCmp("formSubmitResult").setValue(0); formObj.form .submit( { - url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!savesterilizationRecord.do', + url : url, method : 'POST', waitMsg : '正在保存数据,请稍候', waitTitle : '提交表单', @@ -4510,132 +4477,110 @@ } } -function save2(){ +function save() { if(sstsConfig.enableScanSterilizationMonitoringPackage){ var biologicalMonitoring = top.Ext.getCmp('biologicalMonitoring').getValue(); var monitorTousseDisplay = top.Ext.getCmp('monitorTousseDisplay').getValue(); var foreignTousseAmount = parseInt(top.Ext.getCmp('foreignTousseAmount').getValue()); var implantAmount = parseInt(top.Ext.getCmp('implantAmount').getValue()); var frequency = parseInt(top.Ext.getCmp('frequency').getValue()); + var sterilizerName = top.Ext.getCmp('sterilizerName').getValue(); + if(monitorTousseDisplay !== ''){ var monitorTousseDisplayArray = monitorTousseDisplay.split(';'); if(monitorTousseDisplayArray.indexOf('每炉') >=0 && biologicalMonitoring == ''){ - showResult('当前灭菌记录需要扫描监测包条编码,否则不能提交保存。', null); + showResult('请扫描生物监测包条码:每炉必须做生物监测!', null); return; }else if(monitorTousseDisplayArray.indexOf('每天第一炉') >=0 && frequency == 1 && biologicalMonitoring == ''){ - showResult('当前灭菌记录每天第一炉需要扫描监测包条编码,否则不能提交保存。', null); + showResult('请扫描生物监测包条码:每天第一炉必须做生物监测!', null); return; }else if(monitorTousseDisplayArray.indexOf('有植入物时') >=0 && implantAmount > 0 && biologicalMonitoring == ''){ - showResult('当前灭菌记录有植入物时需要扫描监测包条编码,否则不能提交保存。', null); + showResult('请扫描生物监测包条码:待灭菌物品包含有植入物!', null); return; }else if(monitorTousseDisplayArray.indexOf('有外来器械包时') >=0 && foreignTousseAmount > 0 && biologicalMonitoring == ''){ - showResult('当前灭菌记录有外来器械包时需要扫描监测包条编码,否则不能提交保存。', null); + showResult('请扫描生物监测包条码:待灭菌物品含有外来器械包!', null); return; } } + + if(sstsConfig.enableSterilizerBioMonitoringIntervalReminder){ + Ext.Ajax.request( { + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!sterilizerBioMonitoringIntervalReminder.do', + params : { + sterilizerName : sterilizerName, + isSave:true + }, + async:false, + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.success){ + if(result.message && biologicalMonitoring == ''){ + showResult(result.message); + }else { + daveData(1); + } + } + } + }); + }else { + daveData(1); + } + }else { + daveData(1); } - if (!formObj.form.isValid()) { - showResult('请正确填写表单各值', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); - this.enable(); - return false; - } - //重新灭菌 - if(isNewRecord){ - var tempid = top.Ext.getCmp('id').getValue(); - top.Ext.getCmp('recordId').setValue(tempid); - top.Ext.getCmp('id').setValue(0); - top.Ext.getCmp('reSterilization').setValue("true"); - } - - //判断当前灭菌程序是否能灭菌器械包 - var rootNode = sterilizationColumnTree.getRootNode(); - var hasGoods = rootNode.hasChildNodes(); - var canAddTousse = sterilizationCanAddTousse(); - if(false == canAddTousse && hasGoods){ - showResult("当前灭菌程序不能灭菌物品!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); - return false; - } +} - // 验证循环计数器是否已经存在,一个灭菌炉的一个循环次数应是唯一的。 - { - var id = top.Ext.getCmp('id').getValue(); - DWREngine.setAsync(false); - var sign = true; +function save2(){ + if(sstsConfig.enableScanSterilizationMonitoringPackage){ + var biologicalMonitoring = top.Ext.getCmp('biologicalMonitoring').getValue(); + var monitorTousseDisplay = top.Ext.getCmp('monitorTousseDisplay').getValue(); + var foreignTousseAmount = parseInt(top.Ext.getCmp('foreignTousseAmount').getValue()); + var implantAmount = parseInt(top.Ext.getCmp('implantAmount').getValue()); + var frequency = parseInt(top.Ext.getCmp('frequency').getValue()); var sterilizerName = top.Ext.getCmp('sterilizerName').getValue(); - var cycleCounter = top.Ext.getCmp('cycleCounter').getValue(); - var isDefineDeviceInterface = true; - SterilizationRecordTableManager.isDefineDeviceInterface(sterilizerName,function(result){ - isDefineDeviceInterface = result; - }); - if( isDefineDeviceInterface ){ - SterilizationRecordTableManager.isSterilizerCycleCounterExist(id,sterilizerName,cycleCounter, - function(result) { - sign = result; - }); - DWREngine.setAsync(true); - if (sign) { - showResult("灭菌炉的循环次数已存在,保存失败!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); - return false; + + if(monitorTousseDisplay !== ''){ + var monitorTousseDisplayArray = monitorTousseDisplay.split(';'); + if(monitorTousseDisplayArray.indexOf('每炉') >=0 && biologicalMonitoring == ''){ + showResult('请扫描生物监测包条码:每炉必须做生物监测!', null); + return; + }else if(monitorTousseDisplayArray.indexOf('每天第一炉') >=0 && frequency == 1 && biologicalMonitoring == ''){ + showResult('请扫描生物监测包条码:每天第一炉必须做生物监测!', null); + return; + }else if(monitorTousseDisplayArray.indexOf('有植入物时') >=0 && implantAmount > 0 && biologicalMonitoring == ''){ + showResult('请扫描生物监测包条码:待灭菌物品包含有植入物!', null); + return; + }else if(monitorTousseDisplayArray.indexOf('有外来器械包时') >=0 && foreignTousseAmount > 0 && biologicalMonitoring == ''){ + showResult('请扫描生物监测包条码:待灭菌物品含有外来器械包!', null); + return; } - }else if(!sstsConfig.showCycleCountWithoutCondition){ - //如果既没有配置灭菌炉接口也没有开启循环次数则清0 - top.Ext.getCmp('cycleCounter').setValue(0); } - } - - var nexFn = function(){ - var result = getItemTreeData(); - top.Ext.getCmp("sterilizationGoods").setValue(result); - top.Ext.getCmp("delTousseJson").setValue(JSON.stringify(delTousseJson)); - var barcodePostionInfo = getBarcodePositionData(); - //top.Ext.getCmp("status").setValue(''); - top.Ext.getCmp("barcodePositionInfo").setValue(barcodePostionInfo); - Ext.getCmp("formSubmitResult").setValue(0); - formObj.form - .submit( { - url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!savesterilizationRecord.do?status='+statusDraft, - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - timeout:90000, - success : function(form, action) { - var result = Ext.decode(action.response.responseText); - if(result && result.message){ - var noticeMode = obj.noticeMode; - if(noticeMode == 2){ - noticeDiffSterilingMessage(top.Ext,result.message); - }else{ - showResult(result.message, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); - } - }else{ - showResult('保存成功', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); - } - grid.dwrReload(); - sterilizationRecordWin.close(); - //表单提交完给隐藏域formSubmitResult设置为1,自动化测试会用到 - Ext.getCmp("formSubmitResult").setValue(1); - }, - failure : function(form, action) { - var result = Ext.decode(action.response.responseText); - if(result && result.message){ - showResult(result.message, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + if(sstsConfig.enableSterilizerBioMonitoringIntervalReminder){ + Ext.Ajax.request( { + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!sterilizerBioMonitoringIntervalReminder.do', + params : { + sterilizerName : sterilizerName, + isSave:true + }, + async:false, + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.success){ + if(result.message && biologicalMonitoring == ''){ + showResult(result.message); + }else { + daveData(2); + } + } } - } - }); + }); + }else { + daveData(2); + } + }else { + daveData(2); } - - if (!hasGoods){ - top.Ext.MessageBox.confirm("请确认","没有添加灭菌的物品,继续灭菌吗?", - function(button, text) { - if ("yes" == button){ - nexFn(); - }else{ - return false; - } - }); - }else{ - nexFn(); - } } function cancel() {