Index: ssts-web/src/main/webapp/disinfectsystem/interfere/interfereUseRecordView.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/interfere/interfereUseRecordView.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/interfere/interfereUseRecordView.js (revision 17497) @@ -0,0 +1,455 @@ +var entityName = "使用记录"; +var grid; + +function newUseRecord() { + addAndEditUseRecord('', ''); + setTimeout("top.Ext.getCmp('hospitalNum').focus(true)", 500); +} + +// 删除 +function deleteUseRecord(grid) { + var records = grid.getSelectionModel().getSelections(); + if (records.length == 0) { + showResult("请选择要删除的" + entityName + "!"); + return false; + } + var ids = null; + for (var i = 0, len = records.length; i < len; i++) { + if (records[i].data['status'] != '未审核') { + showResult('病人名称为“' + records[i].data['patientName'] + '”的使用记录' + + records[i].data['status'] + '不能删除'); + return false; + } + if (ids == null) { + ids = records[i].data['id']; + } else { + ids = ids + ';' + records[i].data['id']; + } + } + top.Ext.MessageBox.confirm("请确认", "是否确定要删除选中的" + entityName + "信息?", + function (button, text) { + if ("yes" == button) { + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/useRecordAction!deleteUseRecord.do', + params: {ids: ids}, + success: function (response, options) { + var result = Ext.decode(response.responseText); + var success = result.success; + if (true != success) { + MsgTip.msg('提示', result.cause, true, 3); + return; + } else { + MsgTip.msg('提示', '删除成功', true, 3); + grid.dwrReload(); + } + }, + failure: function (response, options) { + var result = Ext.decode(response.responseText); + MsgTip.msg('提示', result.cause, true, 3); + } + }); + } + }); + +} +var mask = null; +function getMask() { + if (!mask) { + mask = new Ext.LoadMask(Ext.getBody(), { + msg: '正在处理打印请求,请稍候...' + }); + } + return mask; +} +//批量审核 +function audit(grid) { + var records = grid.getSelectionModel().getSelections(); + if (records.length == 0) { + showResult("请选择要审核的" + entityName + "!"); + return false; + } + var ids = null; + for (var i = 0, len = records.length; i < len; i++) { + + if (records[i].data['status'] != '已审核' && records[i].data['status'] != '已申请') { + if (ids == null) { + ids = records[i].data['id']; + } else { + ids = ids + ';' + records[i].data['id']; + } + } else { + showResult("所选的记录已经审核,请选择未审核记录!"); + return false; + } + } + + top.Ext.MessageBox.confirm("请确认", "确定要审核所选的使用记录吗?", + function (button, text) { + if ("yes" == button) { + +// var mask = new Ext.LoadMask(Ext.getBody(), +// {msg:'正在处理审核请求,请稍候...'} +// ); + getMask(); + mask.msg = '正在处理审核请求,请稍候...'; + mask.show(); + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/useRecordAction!updateRecordStatus.do', + params: {ids: ids}, + success: function (response, options) { + mask.hide(); + var result = Ext.decode(response.responseText); + if (result.msg.length != 0) { + showResult("所选的记录已经审核,请选择未审核记录!"); + } else { + MsgTip.msg('提示', '审核成功!', true, 3); + grid.dwrReload(); + } + }, + failure: function (response, options) { + mask.hide(); + var result = Ext.decode(response.responseText); + MsgTip.msg('提示', result.cause, true, 3); + } + }); + } + }); + +} + +/** + * (陈家儒改) + * 把"已审核"转成"未审核"的方法 + * + */ +function becomeNotAudited(grid) { + var records = grid.getSelectionModel().getSelections(); + if (records.length == 0) { + showResult("请选择要返回的" + entityName + "!"); + return false; + } + var ids = null; + for (var i = 0, len = records.length; i < len; i++) { + if (records[i].data['status'] != '未审核' && records[i].data['status'] != '已申请') { + if (ids == null) { + ids = records[i].data['id']; + } else { + ids = ids + ';' + records[i].data['id']; + } + } else { + showResult("所选的记录不是已审核状态,请选择已审核的记录!"); + return false; + } + } + + + top.Ext.MessageBox.confirm("请确认", "确定要返回成未审核状态吗?", function (button, text) { + if ("yes" == button) { + +// var mask = new Ext.LoadMask(Ext.getBody(), +// {msg:'正在处理请求,请稍候...'} +// ); + getMask(); + mask.msg = '正在处理请求,请稍候...'; + mask.show(); + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/useRecordAction!updateRecordStatus.do', + params: {ids: ids, type: 'becomeNotAudited'}, + success: function (response, options) { + mask.hide(); + var result = Ext.decode(response.responseText); + if (result.msg.length != 0) { + showResult("所选的记录不是已审核状态,请选择已审核的记录!"); + } else { + MsgTip.msg('提示', '所选的记录已成功返回成未审核状态!', true, 3); + grid.dwrReload(); + } + }, + failure: function (response, options) { + mask.hide(); + var result = Ext.decode(response.responseText); + MsgTip.msg('提示', result.cause, true, 3); + } + }); + } + + }); + +} + +/** + * 修改记录 modifyRecord函数 触发modify函数调用,并传入当前列的值以及record.data对象 页面中需要定义 + * modify(v,data) 函数 + */ +function renderCallModifyFunction(v, p, record) { + var data = record.data; + return "" + v + ""; +} + +function rendererColor(v, p, record) { + var data = record.data; + if (audited == data['status']) { + return "
" + v + ""; + } else if (unAudited == data['status']) { + return "
" + v + ""; + } else { + return v; + } +} +// 生成申请单按钮被点击,选中的单的状态必须是已审核才能转换 +function convertButtonClicked(grid) { + + var records = grid.getSelectionModel().getSelections(); + + if (records.length == 0) { + showResult("请选择要生成申请单的" + entityName + "!"); + return false; + } + var ids = null; + var departMap = new Map(); + for (var i = 0, len = records.length; i < len; i++) { + if (records[i].data['status'] != '已审核') { + showResult('病人名称为“' + records[i].data['patientName'] + + '”的使用记录不能生成申请单,请确认使用记录已审核且未转化成申请单'); + return false; + } + if (ids == null) { + ids = records[i].data['id']; + } else { + ids = ids + ';' + records[i].data['id']; + } + departMap.put(records[i].data['depart'], records[i].data['depart']); + } + + if (departMap.size() > 1) { + top.Ext.MessageBox.alert("请确认", "所选择的使用记录的录入科室不一致,不能转换!"); + return false; + } + var operatorStr = grid.getSelectionModel() + .getSelections()[0].data.operator; + var departStr = grid.getSelectionModel() + .getSelections()[0].data.depart; + var departCodingStr = grid.getSelectionModel() + .getSelections()[0].data.departCoding; + + var confirmMessage = "是否确定要将选中的" + entityName + "信息生成申请单?"; + if (sstsConfig.auditAndConvertUseRecordConfirmMessage) { + confirmMessage = "手术是否已完成,不需要追加器械包?"; + } + top.Ext.MessageBox.confirm("请确认", confirmMessage, + function (button, text) { + if ("yes" == button) { + convertUseRecordToApplication(null, ids, operatorStr, departStr, departCodingStr, null); + } + }); +} + +function convertUseRecordToApplication(button, ids, operatorStr, departStr, departCodingStr, win) { + + if (button != null) { + button.disable(); // 防止重复点击 + } + +// var mask = new Ext.LoadMask(Ext.getBody(), +// {msg:'正在生成申请单,请稍候...'} +// ); + getMask(); + mask.msg = '正在生成申请单,请稍候...'; + mask.show(); + + Ext.Ajax.request({ + url: WWWROOT + + '/disinfectSystem/useRecordAction!createRecyclingApplicationByUseRecords.do', + params: { + ids: ids, + operator: operatorStr, + depart: departStr, + departCoding: departCodingStr, + applicationFormType: sstsConfig.applicationFormType + }, + success: function (response, options) { + mask.hide(); + var result = Ext.decode(response.responseText); + if (result.msg.length != 0) { + showResult(result.msg); + } else { + showResult("申请成功!"); + // 关闭使用记录的窗口,打开单张使用记录进行审核 + if (win != null) { + win.close(); + } + grid.dwrReload(); + } + }, + failure: function (response, options) { + mask.hide(); + if (button != null) { + button.enable(); + } + } + }); + +} + +// 审核并转换按钮被点击 +function auditAndConvertBtnClicked(grid) { + + var records = grid.getSelectionModel().getSelections(); + + if (records.length == 0) { + showResult("请选择要生成申请单的" + entityName + "!"); + return false; + } + var ids = null; + var departMap = new Map(); + for (var i = 0, len = records.length; i < len; i++) { + if (records[i].data['status'] == '已申请') { + showResult('病人名称为“' + records[i].data['patientName'] + + '”的使用记录已经生成申请单,不能重复申请'); + return false; + } + if (ids == null) { + ids = records[i].data['id']; + } else { + ids = ids + ';' + records[i].data['id']; + } + departMap.put(records[i].data['depart'], records[i].data['depart']); + } + + if (departMap.size() > 1) { + top.Ext.MessageBox.alert("请确认", "所选择的使用记录的录入科室不一致,不能转换!"); + return false; + } + + var operatorStr = grid.getSelectionModel() + .getSelections()[0].data.operator; + var departStr = grid.getSelectionModel() + .getSelections()[0].data.depart; + var departCodingStr = grid.getSelectionModel() + .getSelections()[0].data.departCoding; + + var confirmMessage = "是否确定要将选中的" + entityName + "信息生成申请单?"; + if (sstsConfig.auditAndConvertUseRecordConfirmMessage) { + confirmMessage = "手术是否已完成,不需要追加器械包?"; + } + + top.Ext.MessageBox.confirm("请确认", confirmMessage, + function (button, text) { + if ("yes" == button) { + convertUseRecordToApplication(null, ids, operatorStr, departStr, departCodingStr, null); + + } + }); +} + +Ext.onReady(function () { + Ext.QuickTips.init(); + // 记录cookie(3步) + + var columns = [ + {header: "病人", width: 70, dataIndex: 'patientName', renderer: renderCallModifyFunction}, + {header: "状态", width: 50, dataIndex: 'status', renderer: rendererColor}, + {header: "住院号", width: 90, dataIndex: 'hospitalNum', renderer: renderCallModifyFunction}, + {header: "诊疗号", width: 90, dataIndex: 'treatmentNum', renderer: renderCallModifyFunction}, + {header: "年龄", width: 40, dataIndex: 'patientAge'}, + {header: "身份证号码", width: 120, dataIndex: 'patientIDCard'}, + {header: "医生", width: 70, dataIndex: 'doctorName'}, + {header: "手术名称", width: 150, dataIndex: 'operation'}, + {header: "录入人", width: 60, dataIndex: 'operator'}, + {header: "录入科室", width: 80, dataIndex: 'depart'}, + {header: "录入时间", width: 120, dataIndex: 'enteringDate', renderer: myDateFormatByMinute}, + {header: "申请时间", width: 120, dataIndex: 'applicationTime', renderer: myDateFormatByMinute}, + {header: "备注", width: 120, dataIndex: 'remark', id: 'autoWidth'} + ]; + + var filters = new Ext.grid.GridFilters({ + filters: [ + {type: 'string', dataIndex: 'treatmentNum'}, + {type: 'string', dataIndex: 'hospitalNum'}, + {type: 'string', dataIndex: 'patientName'}, + {type: 'numeric', dataIndex: 'patientAge'}, + {type: 'string', dataIndex: 'patientIDCard'}, + {type: 'string', dataIndex: 'doctorName'}, + {type: 'string', dataIndex: 'operation'}, + {type: 'string', dataIndex: 'operator'}, + {type: 'date', dataIndex: 'enteringDate'}, + {type: 'date', dataIndex: 'applicationTime'}, + {type: 'list', dataIndex: 'status', options: [unAudited, audited], phpMode: true}, + {type: 'string', dataIndex: 'remark'}, + {type: 'string', dataIndex: 'depart'} + ] + }); + + var readerDetail = [ + {name: 'id'}, + {name: 'treatmentNum'}, + {name: 'hospitalNum'}, + {name: 'patientName'}, + {name: 'patientAge'}, + {name: 'patientIDCard'}, + {name: 'doctorName'}, + {name: 'operation'}, + {name: 'depart'}, + {name: 'operator'}, + {name: 'enteringDate'}, + {name: 'applicationTime'}, + {name: 'status'}, + {name: 'remark'}, + {name: 'departCoding'} + ]; + + var tbar = [{ + text: '修改', + hidden: SSTS_InterfereUeserRecord_ViewMenu, + iconCls: 'btn_ext_application_edit', + id: 'editTbar', + handler: function () { + var records = grid.getSelectionModel().getSelections(); + if (records.length == 0) { + showResult("请选择需要修改的使用记录信息!"); + return false; + } + if (records.length > 1) { + showResult("一次只能修改一个使用记录信息!"); + return false; + } + var d = records[0]; + addAndEditUseRecord(d.data['id'], d.data['status']); + } + }]; + var dwrCallParams = null; + + Ext.ux.ForgonPageGrid.prototype.getGridParameterMap = function () { + }; + + grid = new Ext.ux.ForgonPageGrid({ + tbar: tbar, + pageSize: 20, + defaultSortField: 'case when statusSequence is null then 0 else statusSequence end', + title: '使用记录列表', + defaultSortDirection: 'ASC,enteringDate DESC', + isCheckboxSelectionModel: true, + rememberSelected: false, + isShowSearchField: true, + columns: columns, + plugins: filters, + autoExpandColumn: 'autoWidth', + renderTo: 'gridDiv', + frame: false + }, + readerDetail, + UseRecordTableManager.findUseRecordTableList, + dwrCallParams // 这个参数只是占位作用 + ); + + var viewport = new Ext.Viewport({ + layout: 'border', + items: [{ + region: 'center', + margins: '0 0 0 0', + layout: 'fit', + items: grid + }] + }); +}); \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/interfere/interfereUseRecordForm.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/interfere/interfereUseRecordForm.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/interfere/interfereUseRecordForm.js (revision 17497) @@ -0,0 +1,1534 @@ +var id; +var formObj; +var containerWin; +var useRecordOperationRoomAllowBlank = true; + +//巡回护士项的标签 +var circuitNurseLabelName = sstsConfig.circuitNurseLabelName ? sstsConfig.circuitNurseLabelName : '巡回护士'; +/** + * 自动补零的函数 + * @param value + */ +function paddingZero(value, totalLength) { + if (value != null && value.Trim().length > 0) { + var lengthOfZero = value.Trim().length; + for (var i = 0; i < totalLength - lengthOfZero; i++) { + value = '0' + value; + } + } + return value; +} +var sm = new top.Ext.grid.CheckboxSelectionModel({ + singleSelect: false +}); + +//sm属性需要单独定义出来,不能与器械包的共用 +var materialGridSm = new top.Ext.grid.CheckboxSelectionModel({ + singleSelect: false +}); + +var rd = new Ext.data.JsonReader({ + fields: [ + {name: 'id'}, + {name: 'barcode'}, + {name: 'tousseDefinitionName'}, + {name: 'amount'}, + {name: 'batchNo'}, + {name: 'packageType'}, + {name: 'goodsType'}, + {name: 'validUntil'}, + {name: 'showTousseName'}, + {name: 'tousseType'}, + {name: 'foreignTousseApp_id'}, + {name: 'isUrgentForUseRecord'}, + {name: 'includeImplant'}, + {name: 'actualUsed'} + ] +}); + +var tousseInstanceStore = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/useRecordAction!loadTousseInstaceByUseRecordId.do', + method: 'POST' + }), + reader: rd +}); + +//器械材料数据源 +var materialStore = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/useRecordAction!loadMaterialGoodsByUseRecordId.do', + method: 'POST' + }), + reader: new Ext.data.JsonReader({ + fields: [ + {name: 'externalCode'}, + {name: 'name'}, + {name: 'amount'}, + {name: 'goodsType'}, + {name: 'materialInvoiceSerialNumber'} + ] + }) +}); + +var userReader = new Ext.data.JsonReader({ + fields: [ + {name: 'id'}, + {name: 'fullName'}, + {name: 'orgUnitName'} + ] +}); + +// 查找某科室的人员的store +var departUsersStore = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/systemmanage/user/userAction!loadUsersBySearchString.do', + method: 'POST' + }), + reader: userReader +}); + +var departUsersStore2 = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/systemmanage/user/userAction!loadUsersBySearchString.do', + method: 'POST' + }), + reader: userReader +}); + +var addTousseInstance = Ext.data.Record.create([ + {name: 'id'}, + {name: 'barcode'}, + {name: 'tousseDefinitionName'}, + {name: 'packageType'}, + {name: 'validUntil'}, + {name: 'showTousseName'}, + {name: 'amount'}, + {name: 'batchNo'}, + {name: 'includeImplant'} +]); + +var useAmount = 0; +function loadScanGoods() { + var barcode = top.Ext.getCmp('tempBarcode').getValue(); + top.Ext.getCmp('tempBarcode').setValue(''); + if (barcode != '') { + if (checkBarcodeIsExist(barcode)) { + showResult('条码为:' + barcode + '的物品已在当前扫描物品里!'); + top.Ext.getCmp('tempBarcode').setValue(''); + return; + } + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/useRecordAction!loadScanedGoods.do', + params: { + barcode: barcode, + scanedBarcodes: getTousseGridData() + }, + success: function (response, options) { + var result = response.responseText; + if (result != "" && result != "{}") { + var goodsInfo = Ext.util.JSON.decode(result); + + if (!goodsInfo.success || goodsInfo.success != true) { + showResult(goodsInfo.error); + return; + } + if (goodsInfo.tousseType != '一次性物品') { + //检测该器械包有没有被召回 + if ('msg' in goodsInfo) { + showResult(goodsInfo.msg); + return; + } + var validTime = goodsInfo.validUntil; + var currentTime = Ext.util.Format.date(new Date(), + 'Y-m-d'); + if (goodsInfo.status == '已退货') { + showResult('该器械包已退货,不能被使用!'); + return; + } + // 未签收的器械包不能登记使用记录 + if (goodsInfo.status == hadShipped && sstsConfig.notSignedItemsCanRegistUseRecord == false) { + showResult('该器械包未签收,不能被使用!'); + return; + } + if ((goodsInfo.status == hadShipped && sstsConfig.notSignedItemsCanRegistUseRecord != false) || goodsInfo.status == hadSigned) { + if (!compareDate(currentTime, validTime)) { + showResult('该器械包已过期!'); + } /*else if(goodsInfo.locationForDisplay != top.Ext.getCmp('depart').getValue()){ + if(top.Ext.getCmp('depart').getValue() == ''){ + showResult('该器械包不属于本科室!'); + }else{ + showResult('该器械包不属于'+top.Ext.getCmp('depart').getValue()+'!'); + } + }*/ else { + function addTousse() { + var record = new addTousseInstance({ + id: goodsInfo.id, + barcode: goodsInfo.barcode, + amount: 1, + batchNo: '', + tousseDefinitionName: goodsInfo.tousseDefinitionName, + showTousseName: goodsInfo.showTousseName, + packageType: goodsInfo.packageType, + validUntil: validTime, + tousseType: goodsInfo.tousseType, + foreignTousseApp_id: goodsInfo.foreignTousseApp_id, + includeImplant: goodsInfo.includeImplant, + actualUsed: goodsInfo.actualUsed + }); + tousseInstanceStore.insert(0, record); + useAmount++; + top.Ext.getCmp('useAmount').setValue(useAmount); + } + + if (sstsConfig.olderTousseComfirmForUserecord && goodsInfo.older) { + if (confirm(goodsInfo.older.tousseName + "[条码:" + goodsInfo.older.barcode + "]更接近失效期,是否继续?")) { + addTousse(); + } + } else { + addTousse(); + } + } + } else { + if (sstsConfig.notSignedItemsCanRegistUseRecord == false) { + showResult('器械包状态为【' + goodsInfo.status + '】,只能登记已签收并且未被使用的器械包!'); + } + else { + showResult('器械包状态为【' + goodsInfo.status + '】,只能登记已发货并且未被使用的器械包!'); + } + } + //一次性物品 + } else { + var record = new addTousseInstance({ + id: '', + barcode: goodsInfo.barcode, + tousseDefinitionName: '', + amount: 1, + batchNo: goodsInfo.batchNo, + showTousseName: goodsInfo.showTousseName, + packageType: '', + validUntil: goodsInfo.validUntil, + tousseType: goodsInfo.tousseType, + goodsType: goodsInfo.goodsType, + foreignTousseApp_id: '', + includeImplant: '否', + actualUsed: '是' + }); + tousseInstanceStore.add(record); + useAmount++; + top.Ext.getCmp('useAmount').setValue(useAmount); + } + } else { + showResult('找不到该条码的器械包或一次性物品!'); + } + }, + failure: function (response, options) { + showResult('加载出错!请稍候再试。'); + } + }); + } +} + +function showPatientInfo(patientInfo) { + top.Ext.getCmp('patientName').setValue(patientInfo.patientName); + top.Ext.getCmp('patientAge').setValue(patientInfo.patientAge); + top.Ext.getCmp('patientIDCard').setValue(patientInfo.patientIDCard); + if (patientInfo.patientSex == '男') { + top.Ext.getCmp('patientSex').setValue('男'); + } else if (patientInfo.patientSex == '女') { + top.Ext.getCmp('patientSex').setValue('女'); + } else { + top.Ext.getCmp('patientSex').setValue(''); + } + top.Ext.getCmp('bedNumber').setValue(patientInfo.bedNumber); + top.Ext.getCmp('doctorName').setValue(patientInfo.doctorName); + top.Ext.getCmp('operation').setValue(patientInfo.operation); + top.Ext.getCmp('roomNumber').setValue(patientInfo.roomNumber); + top.Ext.getCmp('visitId').setValue(patientInfo.visitId); + top.Ext.getCmp('operationRoom').setValue(patientInfo.opRoomId); + top.Ext.getCmp('remark').setValue(patientInfo.remark); + top.Ext.getCmp('circuitNurse').setValue(patientInfo.circuitNurse); + top.Ext.getCmp('washHandNurse').setValue(patientInfo.washHandNurse); + top.Ext.getCmp('specialInfection').setValue(patientInfo.specialInfection); + if (patientInfo.hospitalNumber) { + top.Ext.getCmp('hospitalNum').setValue(patientInfo.hospitalNumber); + } +} + +// 获取扫描的物品所有条码 +function getTousseGridData() { + var tousseInstanceBarcodes = ""; + for (var i = 0; i < tousseInstanceStore.getCount(); i++) { + var barcode = tousseInstanceStore.getAt(i).get('barcode'); + if (tousseInstanceBarcodes == "") { + tousseInstanceBarcodes = barcode; + } else { + tousseInstanceBarcodes += ("," + barcode); + } + } + top.Ext.getCmp('tousseInstanceBarcodes').setValue(tousseInstanceBarcodes); + return tousseInstanceBarcodes; +} + +// 检测该条码是否已在扫描的物品里 +function checkBarcodeIsExist(currentBarcode) { + var exist = false; + if (currentBarcode == "") + return exist; + for (var i = 0; i < tousseInstanceStore.getCount(); i++) { + var barcode = tousseInstanceStore.getAt(i).get('barcode'); + if (currentBarcode == barcode) { + exist = true; + break; + } + } + return exist; +} + +// 检测器械包当前状态是否为已发货 +function checkTousseInstanceIsHaveShipped(barcodes, id, callBack) { + var pass = true; + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/tousseInstanceAction!checkTousseInstancesStatus.do', + params: { + tousseInstanceBarcodes: barcodes, + useRecordID: id + }, + success: function (response, options) { + var result = Ext.decode(response.responseText); + var success = result.success; + if (false == success) { + showResult('条码为:' + result.barcode + '的' + result.tousseType + '状态必须为' + + hadShipped + '。'); + pass = false; + } + callBack(pass); + }, + failure: function (response, options) { + showResult('检测条码状态出错!请稍候再试。'); + pass = false; + callBack(pass); + } + }); +} + +function removeGridItem(id) { + var rows = top.Ext.getCmp('tousseInstanceGrid').getSelectionModel() + .getSelections();// 返回值为 + if (rows) { + for (var i = 0; i < rows.length; i++) { + tousseInstanceStore.remove(rows[i]); + useAmount--; + top.Ext.getCmp('useAmount').setValue(useAmount); + + } + } +} + +function loadTousseImages(tousseName) { + if (tousseName.indexOf('_') != -1) { + tousseName = tousseName.substring(0, tousseName.lastIndexOf('_')); + } + showTousseImageWin(tousseName); +} + + +function formatDateYear(v, p, record) { + try { + return Ext.util.Format.date(new Date(v.time), 'Y-m-d H:i'); + } catch (e) { + } +} + +function checkForSave() { + var enteringTime = top.Ext.getCmp('enteringTime').getValue(); + if (!formObj.getForm().isValid()) { + showResult('请正确填写表单各值'); + return false; + } + if (!sstsConfig.noInputTreatmentNumOrHospitalNum && top.Ext.getCmp('treatmentNum').getValue() == '' && top.Ext.getCmp('hospitalNum').getValue() == '' && top.Ext.getCmp('patientName').getValue() == '') { + showResult('请输入诊疗号或者住院号或者病人姓名'); + return false; + } + // 获取扫描的物品所有条码 + var barcodes = getTousseGridData(); + if (barcodes != "") { + return true; + } else { + showResult('器械包列表信息不能为空'); + return false; + } + return false; + +} +function submitUseRecordForm(btObj, win, id, createNew) { + var enteringTime = top.Ext.getCmp('enteringTime').getValue(); + btObj.disable(); + if (!formObj.getForm().isValid()) { + showResult('请正确填写表单各值'); + btObj.enable(); + return false; + } + if (!sstsConfig.noInputTreatmentNumOrHospitalNum && top.Ext.getCmp('treatmentNum').getValue() == '' && top.Ext.getCmp('hospitalNum').getValue() == '' && top.Ext.getCmp('patientName').getValue() == '') { + showResult('请输入诊疗号或者住院号或者病人姓名'); + btObj.enable(); + return false; + } + // 获取扫描的物品所有条码 + var barcodes = getTousseGridData(); + if (barcodes == "") { + showResult('器械包列表信息不能为空'); + btObj.enable(); + return false; + } + // 保存时,检测当前所有器械包的状态是否为已发货 + checkTousseInstanceIsHaveShipped(barcodes, id, function callBack(pass) { + if (!pass) { + btObj.enable(); + return false; + } + top.Ext.MessageBox.confirm("请确认", "是否提交" + entityName + "信息?", function (btn) { + if (btn != 'yes') { + btObj.enable(); + return false; + } + if (sstsConfig.saveUseRecordPrompt && !id) { + if (sstsConfig.useRecordAuditMode == 2) { + alert('请点击"审核并生成申请单"按钮,否则无法发送供应室'); + } else { + alert('请点击"审核"和"生成申请单"按钮,否则无法发送供应室'); + } + } + top.Ext.getCmp('depart').enable(); + setFormParams(formObj.form, ['id', 'washHandNurse', 'circuitNurse', 'operationRoom', 'treatmentNum', + 'hospitalNum', 'patientName', 'patientAge', 'patientSex', 'roomNumber', + 'bedNumber', 'patientIDCard', 'doctorName', 'operationName', 'specialInfection', 'remark']); + // 设置表单上的item参数 + setFormItems(tousseInstanceStore); + formObj.form.submit({ + url: WWWROOT + '/disinfectSystem/useRecordAction!saveUseRecord2.do', + method: 'POST', + params: {'useInterfere': true}, + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', + success: function (form, action) { + if (action.result.success) { + showResult('保存成功'); + } + else { + showResult(action.result.message); + } + win.close(); + grid.dwrReload(); + // 如果保存成功,并且点击的是保存并新建按钮,则打开新的登记使用记录窗口 + if (action.result.success && createNew) { + newUseRecord(); + } + }, + failure: function (form, action) { + if (!isUndefinedOrNullOrEmpty(action.result) && !isUndefinedOrNullOrEmpty(action.result.message)) { + showResult(action.result.message); + } + else { + showResult(action.failureType); + } + btObj.enable(); + top.Ext.getCmp('depart').disable(); + } + }); + }); + return true; + }); +} + +// 审核使用记录 +function reviewUseRecordForm(button, win, id) { + + top.Ext.MessageBox.confirm("请确认", "是否审核" + entityName + "信息?", function (btn) { + if (btn == 'yes') { + button.disable(); + formObj.form.submit({ + url: WWWROOT + '/disinfectSystem/useRecordAction!updateRecordStatus.do', + method: 'POST', + params: {ids: id}, + waitMsg: '正在保存数据,请稍候', + waitTitle: '审核表单', + success: function (form, action) { + if (action.result.msg.length != 0) { + showResult(action.result.msg); + } else { + win.close(); + showResult('审核成功'); + grid.dwrReload(); + } + }, + failure: function (form, action) { + button.enable(); + showResult('提交失败,错误信息:' + action.failureType); + } + }); + } else { + return false; + } + }); +} +// 审核并转换使用记录 +function reviewAndConvertUseRecordForm(button, win, id) { + var confirmMessage = "是否审核" + entityName + "信息?"; + if (sstsConfig.auditAndConvertUseRecordConfirmMessage) { + confirmMessage = "手术是否已完成,不需要追加器械包?"; + } + top.Ext.MessageBox.confirm("请确认", confirmMessage, function (btn) { + if (btn == 'yes') { + var operatorStr = top.Ext.getCmp('operator').getValue(); + var departStr = top.Ext.getCmp('depart').getValue(); + var departCodingStr = top.Ext.getCmp('departCoding').getValue(); + + convertUseRecordToApplication(button, id, operatorStr, departStr, departCodingStr, win); + + } else { + return false; + } + }); +} +// 保存审核并转换使用记录 +function saveAndReviewAndConvertUseRecordForm(btObj, win, createNew) { + if (!checkForSave()) { + return false; + } + var enteringTime = top.Ext.getCmp('enteringTime').getValue(); + btObj.disable(); + + var confirmMessage = "是否提交" + entityName + "信息?"; + if (sstsConfig.auditAndConvertUseRecordConfirmMessage) { + confirmMessage = "手术是否已完成,不需要追加器械包?"; + } + top.Ext.MessageBox.confirm("请确认", confirmMessage, function (btn) { + if (btn == 'yes') { + top.Ext.getCmp('depart').enable(); + setFormParams(formObj.form, ['id', 'washHandNurse', 'circuitNurse', 'operationRoom', 'treatmentNum', + 'hospitalNum', 'patientName', 'patientAge', 'patientSex', 'roomNumber', + 'bedNumber', 'patientIDCard', 'doctorName', 'operationName', 'specialInfection', 'remark']); + // 设置表单上的item参数 + setFormItems(tousseInstanceStore); + formObj.form.submit({ + url: WWWROOT + '/disinfectSystem/useRecordAction!saveAndReviewAndConvertUseRecordForm.do', + method: 'POST', + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', + success: function (form, action) { + if (action.result.success) { + if (createNew) { + showResult('保存成功,并新建使用记录'); + } + else { + showResult('保存成功'); + } + } else { + showResult(action.result.errMsg); + } + + win.close(); + grid.dwrReload(); + // 如果保存成功,并且点击的是保存并新建按钮,则打开新的登记使用记录窗口 + if (action.result.success && createNew) { + newUseRecord(); + } + }, + failure: function (form, action) { + if (!isUndefinedOrNullOrEmpty(action.result.errMsg)) { + showResult(action.result.errMsg); + } else { + showResult(action.failureType); + } + top.Ext.getCmp('depart').disable(); + } + }); + } else { + btObj.enable(); + return false; + } + }); + return true; +} + + +function quickRecycing(window, useRecordID, barcodes) { + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/useRecordAction!quickRecycing.do', + params: {id: useRecordID, barcodes: barcodes}, + success: function (response, options) { + var result = Ext.decode(response.responseText); + if (result.success == 'true' || result.success == true) { + showResult('回收成功'); + window.close(); + grid.dwrReload(); + } else { + showResult(result.msg) +// showResult('选中的器械包已被快速回收,请刷新页面并确认。'); + } + + }, failure: function (response, options) { + var result = Ext.decode(response.responseText); + showResult('选中的器械包已被快速回收,请刷新页面并确认。'); + } + }); +} +/** + * 根据条码查找器械包记录,找到了返回记录,没找到,返回null + * @param barcode + * @returns + */ +function getTousseInstanceRecord(barcode, tousseInstanceGrid) { + var store = tousseInstanceGrid.getStore(); + for (var i = 0; i < store.getCount(); ++i) { + var record = store.getAt(i); + if (record.data.barcode == barcode) { + return record; + } + } + return null; +} +function urgentBtnClick(barcode) { + var tousseInstanceGrid = top.Ext.getCmp('tousseInstanceGrid'); + var record = getTousseInstanceRecord(barcode, tousseInstanceGrid); + + if (record == null) { + return; + } + if (record.data.isUrgentForUseRecord == '是') { + record.data.isUrgentForUseRecord = '否'; + } else { + record.data.isUrgentForUseRecord = '是'; + } + + tousseInstanceGrid.getView().refresh(); +} +function actualUsedClick(barcode, value) { + var tousseInstanceGrid = top.Ext.getCmp('tousseInstanceGrid'); + var record = getTousseInstanceRecord(barcode, tousseInstanceGrid); + if (record != null) { + record.data.actualUsed = value; + } +} +/** + * 如果点击添加按钮,则传过来的ID为空 + * + * @param id + * @param status + * 审核状态 + * @return + */ +function addAndEditUseRecord(id, status) { + useRecordOperationRoomAllowBlank = getBoolValueFromJs('sstsConfig.useRecordOperationRoomAllowBlank', true); + tousseInstanceStore.removeAll(); + useAmount = 0; + var tbar; + var saveBtn = { + text: '保存', + handler: function () { + top.Ext.getCmp("audited").setValue(""); + submitUseRecordForm(this, window, id, false); + } + }; + var saveAndNewBtn = { + text: '保存并新建', + handler: function () { + top.Ext.getCmp("audited").setValue(""); + submitUseRecordForm(this, window, id, true); + } + }; + var reviewBtn = { + text: '审核', + handler: function () { + top.Ext.getCmp("audited").setValue("true");// action里则会根据audited的值判断用户是点击申述还是保存按钮,true为审核 + reviewUseRecordForm(this, window, id); + } + }; + var createApplicationBtn = { + text: '生成申请单', + handler: function () { + + var operatorStr = top.Ext.getCmp('operator').getValue(); + var departStr = top.Ext.getCmp('depart').getValue(); + var departCodingStr = top.Ext.getCmp('departCoding').getValue(); + var btn = this; + var confirmMessage = "确定要将本使用记录生成申请单吗?"; + if (sstsConfig.auditAndConvertUseRecordConfirmMessage) { + confirmMessage = "手术是否已完成,不需要追加器械包?"; + } + top.Ext.MessageBox.confirm("请确认", confirmMessage, + function (button, text) { + if ("yes" == button) { + convertUseRecordToApplication(btn, id, operatorStr, departStr, departCodingStr, window); + } + }); + + } + } + var reviewAndConvertBtn = { + text: '审核并生成申请单', + handler: function () { + top.Ext.getCmp("audited").setValue("true");// action里则会根据audited的值判断用户是点击审核还是保存按钮,true为审核 + reviewAndConvertUseRecordForm(this, window, id); + } + }; + var saveAndReviewAndConvertBtn = { + text: '保存并审核生成申请单', + handler: function () { + top.Ext.getCmp("audited").setValue("true");// action里则会根据audited的值判断用户是点击审核还是保存按钮,true为审核 + saveAndReviewAndConvertUseRecordForm(this, window, false); + } + }; + var saveAndReviewAndConvertAndNewBtn = { + text: '保存并审核生成申请单并新建', + handler: function () { + top.Ext.getCmp("audited").setValue("true");// action里则会根据audited的值判断用户是点击审核还是保存按钮,true为审核 + saveAndReviewAndConvertUseRecordForm(this, window, true); + } + } + var fastRecyclingBtn = { + text: '快速回收', + id: 'quickRecycingID', + handler: function () { + var records = top.Ext.getCmp('tousseInstanceGrid').getSelectionModel().getSelections(); + if (records.length == 0) { + showResult('请选择要快速回收的器械包。'); + return false; + } + var barcodes = ""; + for (var i = 0; i < records.length; i++) { + barcodes += records[i].get('barcode') + ";"; + } + var qrButton = top.Ext.getCmp('quickRecycingID'); + qrButton.disable(); + quickRecycing(window, id, barcodes); + + } + + }; + + var cancelBtn = { + text: '取消', + handler: function () { + window.close(); + } + }; + + tousseInstanceStore.on("beforeload", function (thiz, options) { + thiz.baseParams["useRecordId"] = id; + }); + tousseInstanceStore.on("load", function (store, recordArry, options) { + var count = tousseInstanceStore.getCount(); + useAmount = count; + top.Ext.getCmp('useAmount').setValue(useAmount); + // 保存表单上的原始item参数 + setOriginalItems(tousseInstanceStore); + }); + tousseInstanceStore.load(); + //干预模块只有保存和取消按钮 + tbar = [saveBtn, cancelBtn]; + materialStore.on("beforeload", function (thiz, options) { + thiz.baseParams["useRecordId"] = id; + }); + materialStore.on("load", function (store, recordArry, options) { + var count = materialStore.getCount(); + if (count > 0) { + top.Ext.getCmp('tousseInstanceGrid').setHeight(165); + top.Ext.getCmp('materialGridFieldset').show(); + } + }); + materialStore.load(); + var sexArray = [['男'], ['女']]; + + var operationNameStore = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectsystem/basedatamanager/operationOrgAction!findOrgUnitOperationName.do', + method: 'POST' + }), + reader: new Ext.data.JsonReader({ + totalProperty: 'totalCount', + root: 'data' + }, [ + {name: 'id', mapping: 'id'}, + {name: 'operationName', mapping: 'operationName'}] + ) + }); + + var tousseCm = new Ext.grid.ColumnModel([sm, + {id: 'id', dataIndex: 'id', hidden: true}, + {header: "条码", dataIndex: 'barcode', width: 55, menuDisabled: true, renderer: renderTousseInstanceInfoShowFun}, + {header: "name", dataIndex: 'tousseDefinitionName', hidden: true, menuDisabled: true}, + { + header: "名称", + dataIndex: 'showTousseName', + width: 180, + menuDisabled: true, + renderer: renderTousseInstanceNameForUrgent + }, + { + header: '加急', width: 35, + renderer: function (v, p, record, rowIndex, colIndex) { + var imgName = (record.data.isUrgentForUseRecord == '是') ? 'arrow_down' : 'arrow_top'; + var str = "
+ + | +