Index: ssts-web/src/main/webapp/disinfectsystem/sterilizationmanager/sterilizationrecord/sterilizationRecordForm.js =================================================================== diff -u -r21598 -r21796 --- ssts-web/src/main/webapp/disinfectsystem/sterilizationmanager/sterilizationrecord/sterilizationRecordForm.js (.../sterilizationRecordForm.js) (revision 21598) +++ ssts-web/src/main/webapp/disinfectsystem/sterilizationmanager/sterilizationrecord/sterilizationRecordForm.js (.../sterilizationRecordForm.js) (revision 21796) @@ -4,6 +4,8 @@ var isClickDel = false; //灭菌物品列表的ColumnTree var sterilizationColumnTree; +//灭菌物品列表的ColumnTree的可编辑插件 +var sterilizationColumnTreeEditer; //灭菌物品统计的store var tousseItemCountJsonStore; //右边今天审核的待灭菌物品的ColumnTree @@ -12,7 +14,12 @@ var scanUser = sstsConfig.hasOwnProperty('sterilizationScanUser') && sstsConfig.sterilizationScanUser; //灭菌炉名称 var sterilizerNameTemp = ''; +//全局包实例条码 +var myBarcodes=[] +//全局固定条码 +var myFixedBarcodes=[] + var SHELF = "灭菌架"; var BASKET = "灭菌筐"; var STERILIZER = "灭菌炉"; @@ -25,809 +32,870 @@ var _biologicalMonitoringTime = 0; //此灭菌炉的生物监测持续时间 if(sstsConfig.hasOwnProperty('isSRFinishConfirmShowUnload') && sstsConfig.isSRFinishConfirmShowUnload){ - confirmLabel = "灭菌卸载确认人"; + confirmLabel = "灭菌卸载确认人"; } //定义首篮筐的label变量 var beginBarcodeLabel = '扫描条码'; var hiddenEndBarcode = true;//隐藏尾篮筐 if(sstsConfig.disableLoadToVirtualBasket == false){ - beginBarcodeLabel = '条码/篮筐(首)'; - hiddenEndBarcode = false;//显示尾篮筐 + beginBarcodeLabel = '条码/篮筐(首)'; + hiddenEndBarcode = false;//显示尾篮筐 } //条码扫描模式 var currentScanMode = "single"; if(sstsConfig.sterilePageScanMode && sstsConfig.sterilePageScanMode != null){ - currentScanMode = sstsConfig.sterilePageScanMode; + currentScanMode = sstsConfig.sterilePageScanMode; } var sterilizerJsonStore = new Ext.data.SimpleStore({ - fields : [ 'sterilizerName' ], - url : WWWROOT + '/disinfectSystem/baseData/sterilizerAction!getAllSterilizer.do' + fields : [ 'sterilizerName' ], + url : WWWROOT + '/disinfectSystem/baseData/sterilizerAction!getAllSterilizer.do' }); var sterilizationTypeStore = new Ext.data.SimpleStore({ - fields : [ 'id','sterilizationType' ], - url : WWWROOT + '/disinfectSystem/baseData/sterilizerAction!getSterilizerType.do', - listeners : { - beforeload : function(thiz, options){ - thiz.baseParams['sterilizerName'] = top.Ext.getCmp('sterilizerName').getValue(); - thiz.baseParams['type'] = 'sterilizationRecord'; - }, - load : function(thiz, records, options){ - var sterilizationType = top.Ext.getCmp('sterilizationType').getValue(); - if (sterilizationType) { - var isExist = false; - for (var i = 0; i < records.length; i++) { - if (sterilizationType == records[i].data.sterilizationType) { - isExist = true; - break; - } - } - if(!isExist){ - top.Ext.getCmp('sterilizationType').setValue(''); - } - } - } - } + fields : [ 'id','sterilizationType' ], + url : WWWROOT + '/disinfectSystem/baseData/sterilizerAction!getSterilizerType.do', + listeners : { + beforeload : function(thiz, options){ + thiz.baseParams['sterilizerName'] = top.Ext.getCmp('sterilizerName').getValue(); + thiz.baseParams['type'] = 'sterilizationRecord'; + }, + load : function(thiz, records, options){ + var sterilizationType = top.Ext.getCmp('sterilizationType').getValue(); + if (sterilizationType) { + var isExist = false; + for (var i = 0; i < records.length; i++) { + if (sterilizationType == records[i].data.sterilizationType) { + isExist = true; + break; + } + } + if(!isExist){ + top.Ext.getCmp('sterilizationType').setValue(''); + } + } + } + } }); //远程方法请求后台查询灭菌目录 var sterilizationPurposeJsonStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!getSterilizationPurposeList.do', - method : 'POST' - }), - reader : new Ext.data.JsonReader( { - fields : [ - {name : 'id'}, - {name : 'optionText'}, - {name : 'optionValue'} - ] - }) + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!getSterilizationPurposeList.do', + method : 'POST' + }), + reader : new Ext.data.JsonReader( { + fields : [ + {name : 'id'}, + {name : 'optionText'}, + {name : 'optionValue'} + ] + }) }); +function arrRemoval(arr) { + var result=[] + for(var i=0; i0){ - tousseStr += ";"; - } - tousseStr += (cAttr.barcode); - }); - } - var pTousseName = pNode.attributes.barcode; - if(pTousseStr.length>0){ - pTousseStr += "##"; - } - var pType = pNode.attributes.type; - if(pType == '篮筐'){ - tousseStr = "篮筐"; - }else{ - tousseStr = "器械包"; - } - pTousseStr += (pTousseName+ ",,"+tousseStr); - }); - return pTousseStr; + var rootNode = sterilizationColumnTree.getRootNode(); + var pTousseStr = ""; + rootNode.eachChild(function(pNode){ + var tousseStr = ""; + if(!pNode.isLeaf()){//父节点 + pNode.eachChild(function(cNode){ + var cAttr = cNode.attributes; + if(tousseStr.length>0){ + tousseStr += ";"; + } + tousseStr += (cAttr.barcode); + }); + } + var pTousseName = pNode.attributes.barcode; + if(pTousseStr.length>0){ + pTousseStr += "##"; + } + var pType = pNode.attributes.type; + if(pType == '篮筐'){ + tousseStr = "篮筐"; + }else{ + tousseStr = "器械包"; + } + pTousseStr += (pTousseName+ ",,"+tousseStr); + }); + if(myBarcodes.length>0){//全局条码数组(针对不追溯的包) + pTousseStr+="##"; + for(var i=0;i0){ - pBarcodePositionStr += ";"; - } - pBarcodePositionStr += (barcode+ ","+position); - } - }); - return pBarcodePositionStr; + var rootNode = sterilizationColumnTree.getRootNode(); + var pBarcodePositionStr = ""; + rootNode.eachChild(function(pNode){ + var position = pNode.attributes.position; + // 没有位置的器械包或者篮筐,不处理 + if(position != null && position != ''){ + var barcode = pNode.attributes.barcode; + if(pBarcodePositionStr.length>0){ + pBarcodePositionStr += ";"; + } + pBarcodePositionStr += (barcode+ ","+position); + } + }); + return pBarcodePositionStr; } /** * 获取最后的位置名称 */ function getLastPosition(){ - var rootNode = sterilizationColumnTree.getRootNode(); - var positionStr = ""; - rootNode.eachChild(function(pNode){ - var position = pNode.attributes.position; - // 没有位置的器械包或者篮筐,不处理 - if(position != null && position != ''){ - positionStr = position; - } - }); - return positionStr; + var rootNode = sterilizationColumnTree.getRootNode(); + var positionStr = ""; + rootNode.eachChild(function(pNode){ + var position = pNode.attributes.position; + // 没有位置的器械包或者篮筐,不处理 + if(position != null && position != ''){ + positionStr = position; + } + }); + return positionStr; } var tousseItemCountRecord = new Ext.data.Record.create([ { - name : 'tousseName' + name : 'tousseName' }, { - name : 'count', - type : 'int' + name : 'count', + type : 'int' } ]); var monitorResutlStore = new Ext.data.SimpleStore( { - fields : [ 'value' ], - data : [['无'], ['合格'],['不合格']] + fields : [ 'value' ], + data : [['无'], ['合格'],['不合格']] }); /** * 创建节点的方法 - * @param isParentNode 是否父节点(灭菌筐节点或者没有入灭菌筐的器械包节点为true) - * @param barcode 条码(篮筐或器械包) - * @param name 名称(篮筐或器械包) - * @param typeForSterilizationStatistics 器械包类型(注意区别于真正的类型) - * @param depart 科室 - * @param type 值为即“篮筐”或“器械包” - * @param position 位置 - * @param amount 数量(便于以后扫描固定条码支持修改数量的功能,目前值为均为1) - * @param reviewTime 审核时间 + * @param isParentNode 是否父节点(灭菌筐节点或者没有入灭菌筐的器械包节点为true) + * @param barcode 条码(篮筐或器械包) + * @param name 名称(篮筐或器械包) + * @param typeForSterilizationStatistics 器械包类型(注意区别于真正的类型) + * @param depart 科室 + * @param type 值为即“篮筐”或“器械包” + * @param position 位置 + * @param amount 数量(便于以后扫描固定条码支持修改数量的功能,目前值为均为1) + * @param reviewTime 审核时间 */ function createNode(isParentNode,barcode,name,typeForSterilizationStatistics,depart,type,position,amount,reviewTime){ - var node; - if(isParentNode==true){ - //创建父节点(灭菌筐节点或者没有入灭菌筐的器械包节点) - node = new top.Ext.tree.TreeNode({ - id:Ext.id(), - iconCls:type=='篮筐' ? 'task-folder' : 'task', - uiProvider:top.Ext.tree.ColumnNodeUI, - leaf:false, - expanded:true - }); - }else{ - //创建子节点(进入灭菌筐器械包节点) - node = new top.Ext.tree.TreeNode({ - id:Ext.id(), - iconCls:'task', - uiProvider:top.Ext.tree.ColumnNodeUI, - leaf:true, - expanded:true - }); - } + var node; + if(isParentNode==true){ + //创建父节点(灭菌筐节点或者没有入灭菌筐的器械包节点) + node = new top.Ext.tree.TreeNode({ + id:Ext.id(), + iconCls:type=='篮筐' ? 'task-folder' : 'task', + uiProvider:top.Ext.tree.ColumnNodeUI, + leaf:false, + expanded:true + }); + }else{ + //创建子节点(进入灭菌筐器械包节点) + node = new top.Ext.tree.TreeNode({ + id:Ext.id(), + iconCls:'task', + uiProvider:top.Ext.tree.ColumnNodeUI, + leaf:true, + expanded:true + }); + } - node.attributes.isParentNode=isParentNode; - node.attributes.barcode=barcode; - node.attributes.name=name; - node.attributes.typeForSterilizationStatistics=typeForSterilizationStatistics; - node.attributes.depart=depart; - node.attributes.type = type; - node.attributes.position = position; - node.attributes.amount = amount; - node.attributes.reviewTime = reviewTime; - return node; + node.attributes.isParentNode=isParentNode; + node.attributes.barcode=barcode; + node.attributes.name=name; + node.attributes.typeForSterilizationStatistics=typeForSterilizationStatistics; + node.attributes.depart=depart; + node.attributes.type = type; + node.attributes.position = position; + node.attributes.amount = amount; + node.attributes.reviewTime = reviewTime; + return node; } + +function createNodeForPendingStarilizationGoods(isParentNode,barcode,name,type,depart,reviewTime,amount){ + var node; + if(isParentNode==true){ + //创建父节点(灭菌筐节点或者没有入灭菌筐的器械包节点) + node = new top.Ext.tree.TreeNode({ + id:Ext.id(), + iconCls:type=='篮筐' ? 'task-folder' : 'task', + uiProvider:top.Ext.tree.ColumnNodeUI, + leaf:false, + expanded:true + }); + }else{ + //创建子节点(进入灭菌筐器械包节点) + node = new top.Ext.tree.TreeNode({ + id:Ext.id(), + iconCls:'task', + uiProvider:top.Ext.tree.ColumnNodeUI, + leaf:true, + expanded:true + }); + } + node.attributes.objBarcode = barcode; + node.attributes.objName = name; + node.attributes.type = type; + node.attributes.depart = depart; + node.attributes.reviewTime = reviewTime; + node.attributes.objAmount = amount; + return node +} + /** * 统计篮筐和器械包数量,并且更新统计信息列表 */ function statisticsTousseAndBasket () { - var rootNode = sterilizationColumnTree.getRootNode(); //灭菌物品columnTree的根节点 - var basketAmount = 0; //篮筐数量 - - var tousseNameOfAmount = {}; //器械包名称和数量 - var statisticsAmount = {'篮筐':0,'器械包':0,'敷料包':0,'外来器械包':0,'代理灭菌包':0,'灭菌物品总数量':0}; - rootNode.eachChild(function(pNode){ - if(pNode.attributes.type == '篮筐') { //此节点是篮筐 - statisticsAmount['篮筐'] = statisticsAmount['篮筐'] + 1; - if (!pNode.isExpanded()) { //如果没展开,需要手动展开,不然会导致里面的子节点没有加载 - pNode.expand(); - } - pNode.eachChild(function(pNode){ - sumTousseAndBasket(pNode, tousseNameOfAmount, statisticsAmount); - }); - } else { //此节点是器械包 - sumTousseAndBasket(pNode, tousseNameOfAmount, statisticsAmount); - } - }); - - top.Ext.getCmp('totalAmount').setText("灭菌物品总数量:"+(statisticsAmount['灭菌物品总数量'])); - top.Ext.getCmp('typeTotalAmount').setText( - "篮筐:" + statisticsAmount['篮筐'] + - " ,器械包:" + statisticsAmount['器械包'] - + " ,敷料包:" + statisticsAmount['敷料包'] + - " ,外来器械包:" + statisticsAmount['外来器械包'] + - ", 代理灭菌包:"+ statisticsAmount['代理灭菌包']); - - tousseItemCountJsonStore.removeAll(); - for(var key in tousseNameOfAmount){ - if (tousseNameOfAmount.hasOwnProperty(key)) { //过滤掉非“tousseNameOfAmount”本对象的属性比较严谨一些 - tousseItemCountJsonStore.add(new tousseItemCountRecord({ - tousseName : key, - count : tousseNameOfAmount[key] - })); - } - } + var rootNode = sterilizationColumnTree.getRootNode(); //灭菌物品columnTree的根节点 + var basketAmount = 0; //篮筐数量 + + var tousseNameOfAmount = {}; //器械包名称和数量 + var statisticsAmount = {'篮筐':0,'器械包':0,'敷料包':0,'外来器械包':0,'代理灭菌包':0,'灭菌物品总数量':0}; + rootNode.eachChild(function(pNode){ + if(pNode.attributes.type == '篮筐') { //此节点是篮筐 + statisticsAmount['篮筐'] = statisticsAmount['篮筐'] + 1; + if (!pNode.isExpanded()) { //如果没展开,需要手动展开,不然会导致里面的子节点没有加载 + pNode.expand(); + } + pNode.eachChild(function(pNode){ + sumTousseAndBasket(pNode, tousseNameOfAmount, statisticsAmount); + }); + } else { //此节点是器械包 + sumTousseAndBasket(pNode, tousseNameOfAmount, statisticsAmount); + } + }); + + top.Ext.getCmp('totalAmount').setText("灭菌物品总数量:"+(statisticsAmount['灭菌物品总数量'])); + top.Ext.getCmp('typeTotalAmount').setText( + "篮筐:" + statisticsAmount['篮筐'] + + " ,器械包:" + statisticsAmount['器械包'] + + " ,敷料包:" + statisticsAmount['敷料包'] + + " ,外来器械包:" + statisticsAmount['外来器械包'] + + ", 代理灭菌包:"+ statisticsAmount['代理灭菌包']); + + tousseItemCountJsonStore.removeAll(); + for(var key in tousseNameOfAmount){ + if (tousseNameOfAmount.hasOwnProperty(key)) { //过滤掉非“tousseNameOfAmount”本对象的属性比较严谨一些 + tousseItemCountJsonStore.add(new tousseItemCountRecord({ + tousseName : key, + count : tousseNameOfAmount[key] + })); + } + } } /** * 合计器械包和灭菌筐个数 */ function sumTousseAndBasket(pNode, tousseNameOfAmount, statisticsAmount) { - var tousseName = pNode.attributes.name; - var typeForSterilizationStatistics = pNode.attributes.typeForSterilizationStatistics; - var amount = parseInt(pNode.attributes.amount); - if (tousseNameOfAmount.hasOwnProperty(tousseName)) { - tousseNameOfAmount[tousseName] = tousseNameOfAmount[tousseName] + amount; - } else { - tousseNameOfAmount[tousseName] = amount; - } - statisticsAmount[typeForSterilizationStatistics] = statisticsAmount[typeForSterilizationStatistics] + amount; - statisticsAmount['灭菌物品总数量'] = statisticsAmount['灭菌物品总数量'] + amount; + var tousseName = pNode.attributes.name; + var typeForSterilizationStatistics = pNode.attributes.typeForSterilizationStatistics; + var amount = parseInt(pNode.attributes.amount); + if (tousseNameOfAmount.hasOwnProperty(tousseName)) { + tousseNameOfAmount[tousseName] = tousseNameOfAmount[tousseName] + amount; + } else { + tousseNameOfAmount[tousseName] = amount; + } + statisticsAmount[typeForSterilizationStatistics] = statisticsAmount[typeForSterilizationStatistics] + amount; + statisticsAmount['灭菌物品总数量'] = statisticsAmount['灭菌物品总数量'] + amount; } /** * 扫描灭菌架条码 - * @param barcode 架条码条码 + * @param barcode 架条码条码 */ function loadSterilizationShelf(barcode){ - if(barcode != null && barcode.length > 0){ - SterilizationRecordTableManager.getSterilizationShelfByBarcode(barcode,function(sterilizationShelfName) { - if (sterilizationShelfName != null) { - var resultArray = sterilizationShelfName.split(":"); - if(resultArray[0] == "success"){ - top.Ext.getCmp('sterilizationShelf').setValue(resultArray[1]); - speaker.speak(resultArray[1]); - }else{ - showResult(resultArray[1]); - } - - } - } - ); - } + if(barcode != null && barcode.length > 0){ + SterilizationRecordTableManager.getSterilizationShelfByBarcode(barcode,function(sterilizationShelfName) { + if (sterilizationShelfName != null) { + var resultArray = sterilizationShelfName.split(":"); + if(resultArray[0] == "success"){ + top.Ext.getCmp('sterilizationShelf').setValue(resultArray[1]); + speaker.speak(resultArray[1]); + }else{ + showResult(resultArray[1]); + } + + } + } + ); + } } /** * 扫描灭菌炉 */ function getSterilization(barcode, recordId){ - if(barcode != null && barcode.length > 0){ - DWREngine.setAsync(false); - SterilizationRecordTableManager.getRinserSterilizationType(barcode,recordId,function setSterilizationType(result){ - if(result != null){ - var resultArray = result.split(':'); - if(resultArray[0] == "success"){ - top.Ext.getCmp('sterilizerName').setValue(resultArray[1].split(',')[0]); - top.Ext.getCmp('frequency').setValue(resultArray[1].split(',')[1]); - }else{ - showResult(resultArray[1]); - } - } - }); - DWREngine.setAsync(true); - } + if(barcode != null && barcode.length > 0){ + DWREngine.setAsync(false); + SterilizationRecordTableManager.getRinserSterilizationType(barcode,recordId,function setSterilizationType(result){ + if(result != null){ + var resultArray = result.split(':'); + if(resultArray[0] == "success"){ + top.Ext.getCmp('sterilizerName').setValue(resultArray[1].split(',')[0]); + top.Ext.getCmp('frequency').setValue(resultArray[1].split(',')[1]); + }else{ + showResult(resultArray[1]); + } + } + }); + DWREngine.setAsync(true); + } } /** * 扫描灭菌程序 */ function loadSterilizationType(barcode,sterilizerName){ - DWREngine.setAsync(false); - SterilizationRecordTableManager.getSterilizationType(barcode,sterilizerName,function setSterilizationType(result){ - if(result != null){ - var resultArray = result.split(':'); - if(resultArray[0] == "success"){ - var sterilizationType = resultArray[1].split(',')[0]; - top.Ext.getCmp('sterilizationType').setValue(sterilizationType); - //加载灭菌参数 - SterilizationRecordTableManager.getParameter(sterilizationType,function(result){ - if(result != null && result.length > 0){ - top.Ext.getCmp('parameter').setValue(result); - } - }); - }else{ - showResult(resultArray[1]); - } - } - }); - DWREngine.setAsync(true); + DWREngine.setAsync(false); + SterilizationRecordTableManager.getSterilizationType(barcode,sterilizerName,function setSterilizationType(result){ + if(result != null){ + var resultArray = result.split(':'); + if(resultArray[0] == "success"){ + var sterilizationType = resultArray[1].split(',')[0]; + top.Ext.getCmp('sterilizationType').setValue(sterilizationType); + //加载灭菌参数 + SterilizationRecordTableManager.getParameter(sterilizationType,function(result){ + if(result != null && result.length > 0){ + top.Ext.getCmp('parameter').setValue(result); + } + }); + }else{ + showResult(resultArray[1]); + } + } + }); + DWREngine.setAsync(true); } /** * 扫描灭菌员条码 - * @param barcode 灭菌条码 + * @param barcode 灭菌条码 */ function loadSterilizationUser(barcode){ - if(barcode != null && barcode.length > 0){ - SterilizationRecordTableManager.getSterilizationUserByBarcode(barcode,function(response) { - var result = Ext.decode(response); - if (result.success == true) { - top.Ext.getCmp('sterilizationUser').setValue(result.fullName); - }else{ - showResult(result.message); - } - } - ); - } + if(barcode != null && barcode.length > 0){ + SterilizationRecordTableManager.getSterilizationUserByBarcode(barcode,function(response) { + var result = Ext.decode(response); + if (result.success == true) { + top.Ext.getCmp('sterilizationUser').setValue(result.fullName); + }else{ + showResult(result.message); + } + } + ); + } } //根据条码获取位置名称 function loadPositionByBarcode(barcode){ - if(isUndefinedOrNullOrEmpty(barcode)){ - showResult('条码不能为空!'); - return ; - } - PositionTableManager.getPositionNameByBarcode(barcode,false,function(responseText){ - if(!isUndefinedOrNullOrEmpty(responseText)){ - var result = top.Ext.decode(responseText); - if(!result.success){ - showResult(result.message); - return; - } - top.Ext.getCmp('position').setValue(result.name); - var selNode = sterilizationColumnTree.getSelectionModel().getSelectedNode(); - var root = sterilizationColumnTree.getRootNode(); - if(selNode != null){ - var insideTousse = selNode.attributes.insideTousse; - if(typeof(insideTousse) == 'undefined' || insideTousse == true){ - // 篮筐和不入筐灭菌的器械包才修改位置 - selNode.attributes.position = result.name; - var newBasket = cloneBasketOrTousse(selNode); - var curIndex = root.indexOf(selNode); - var nextNode = selNode.nextSibling; - root.removeChild(selNode); - if(nextNode != null){ - root.insertBefore(newBasket,nextNode); - }else{ - root.appendChild(newBasket); - } - } - } - }else{ - showResult('找不到该条码所对应的位置信息'); - } - }); + if(isUndefinedOrNullOrEmpty(barcode)){ + showResult('条码不能为空!'); + return ; + } + PositionTableManager.getPositionNameByBarcode(barcode,false,function(responseText){ + if(!isUndefinedOrNullOrEmpty(responseText)){ + var result = top.Ext.decode(responseText); + if(!result.success){ + showResult(result.message); + return; + } + top.Ext.getCmp('position').setValue(result.name); + var selNode = sterilizationColumnTree.getSelectionModel().getSelectedNode(); + var root = sterilizationColumnTree.getRootNode(); + if(selNode != null){ + var insideTousse = selNode.attributes.insideTousse; + if(typeof(insideTousse) == 'undefined' || insideTousse == true){ + // 篮筐和不入筐灭菌的器械包才修改位置 + selNode.attributes.position = result.name; + var newBasket = cloneBasketOrTousse(selNode); + var curIndex = root.indexOf(selNode); + var nextNode = selNode.nextSibling; + root.removeChild(selNode); + if(nextNode != null){ + root.insertBefore(newBasket,nextNode); + }else{ + root.appendChild(newBasket); + } + } + } + }else{ + showResult('找不到该条码所对应的位置信息'); + } + }); } function cloneBasketOrTousse(node){ - var barcode = node.attributes.barcode; - var name = node.attributes.name; - var typeForSterilizationStatistics = node.attributes.typeForSterilizationStatistics; - var type = node.attributes.type; - var depart = node.attributes.depart; - var position = node.attributes.position; - var amount = node.attributes.amount; - var reviewTime = node.attributes.reviewTime; - // 没入篮筐的器械包或者篮筐 - if(node.attributes.isParentNode){ - if(type == '器械包'){ - var cloneNode = createNode(true,barcode,name,typeForSterilizationStatistics,depart,type,position,amount,reviewTime); - return cloneNode; - }else{ - var cloneNode = createNode(true,barcode,name,typeForSterilizationStatistics,depart,type,position,amount,reviewTime); - var childNodes = node.attributes.children; - if(childNodes != null){ - for(var i=0;i 0){ - for(var i=0;i 0){ + for(var i=0;i 0){ - top.Ext.getCmp('parameter').setValue(result); - } - }); - removePendingSterilizationGoods(barcodeStr) - } else if(success == 2) { //不追溯器械包 - var tousseInstanceArr = resultData.tousseInstanceArr; - var length = tousseInstanceArr.length; - if (length < 1) { - showResult('未找到符合条件的器械包!'); - return; - } - - var sterilingTypeTemp = top.Ext.getCmp('sterilizationType').getValue(); - for(var i = 0; i < length; i ++) { - var tousseInstan = tousseInstanceArr[i]; - var typeForSterilizationStatistics = tousseInstan.typeForSterilizationStatistics; //器械包类型(用于分类统计) - var tousseBarcode = tousseInstan.tousseBarcode; //器械包条码 - var tousseName = tousseInstan.tousseName; //器械包名称 - var sterilingType = tousseInstan.SterilingType; //灭菌程序 - var department = tousseInstan.department; //科室 - var reviewTime = tousseInstan.reviewTime; //审核时间 - - if(checkRepeat(tousseBarcode)){ - showResult("输入的条码已存在!"); - return; - }; - - if(sterilingTypeTemp != sterilingType){ - showResultWithoutSpeak("器械包[" + tousseName + "]的灭菌程序和所选的灭菌程序不同!"); - } - - //添加到灭菌物品视图列表的第一行 - var rootNode = sterilizationColumnTree.getRootNode(); - var parentNode = createNode(true, tousseBarcode, tousseName, typeForSterilizationStatistics, department, '器械包', position, 1, reviewTime); - var firstChildNode = rootNode.item(0); - if(firstChildNode == null || firstChildNode == undefined){ - rootNode.appendChild(parentNode); - }else{ - rootNode.insertBefore(parentNode, firstChildNode); - } - speakBasket.addGoods('', tousseName, 1); - removePendingSterilizationGoods(tousseBarcode); - } - speakContent = sterilizationColumnTree.getRootNode().text; - } else if (success == 3) { //首尾器械包,since2015-10-27 - var tousseInstanceArr = resultData.tousseInstanceArr; - var length = tousseInstanceArr.length; - if (length < 1) { - showResult('未找到符合条件的器械包!'); - return; - } - - var alreadyAdd = 0; - var sterilingTypeTemp = top.Ext.getCmp('sterilizationType').getValue(); - var rootNode = sterilizationColumnTree.getRootNode(); - speakContent = rootNode.text; - for(var i = 0; i < length; i ++) { - var tousseInstan = tousseInstanceArr[i]; - - var tousseBarcode = tousseInstan.tousseBarcode; //器械包条码 - var tousseName = tousseInstan.tousseName; //器械包名称 - var typeForSterilizationStatistics = tousseInstan.typeForSterilizationStatistics; //器械包类型(用于分类统计) - var sterilingType = tousseInstan.SterilingType; //灭菌程序 - var department = tousseInstan.department; //科室 - var reviewTime = tousseInstan.reviewTime; //审核时间 - - if(sterilingTypeTemp != sterilingType){ - showResultWithoutSpeak("器械包[" + tousseName + "]的灭菌程序和所选的灭菌程序不同!"); - } - - var exists = false; - rootNode.eachChild(function(pNode){ - if(pNode.attributes.barcode == tousseBarcode) { //此包已经扫描过了 - exists = true; - return false; - } - if(pNode.childNodes){ - pNode.eachChild(function(cNode){ - if(cNode.attributes.barcode == tousseBarcode) { //此包已经入审核篮筐的 - exists = true; - return false; - } - }); - } - }); - if(!exists){ //此包没有扫描过并且没有入审核篮筐 - //添加到灭菌物品视图列表的第一行 - var parentNode = createNode(true, tousseBarcode, tousseName, typeForSterilizationStatistics, department, '器械包', position, 1, reviewTime); - var firstChildNode = rootNode.item(0); - if(firstChildNode == null || firstChildNode == undefined){ - rootNode.appendChild(parentNode); - }else{ - rootNode.insertBefore(parentNode, firstChildNode); - } - speakBasket.addGoods('', tousseName, 1); - alreadyAdd ++; - removePendingSterilizationGoods(tousseBarcode); - } - } - - //加载灭菌参数 - SterilizationRecordTableManager.getParameter(top.Ext.getCmp('sterilizationType').getValue(), function(result){ - if(result != null && result.length > 0){ - top.Ext.getCmp('parameter').setValue(result); - } - }); - if(alreadyAdd == 0){ - showResult('未找到符合条件的器械包或器械包已扫描至表格中.'); - speakContent = null; - } - } else if(success == 4) { //首尾虚拟篮筐 - var tousseInstanceArr = resultData.tousseInstanceArr; - var length = tousseInstanceArr.length; - if (length < 1) { - showResult('未找到符合条件的器械包!'); - return; - } - - var alreadyAdd = 0; - var sterilingTypeTemp = top.Ext.getCmp('sterilizationType').getValue(); - var rootNode = sterilizationColumnTree.getRootNode(); - speakContent = rootNode.text; - for(var i = 0; i < length; i ++) { - var tousseInstan = tousseInstanceArr[i]; - - var virtualBasketSeqNum = tousseInstan.virtualBasketSeqNum; //虚拟篮筐编号 - var tousseBarcode = tousseInstan.tousseBarcode; //器械包条码 - var tousseName = tousseInstan.tousseName; //器械包名称 - var typeForSterilizationStatistics = tousseInstan.typeForSterilizationStatistics; //器械包类型(用于分类统计) - var sterilingType = tousseInstan.SterilingType; //灭菌程序 - var department = tousseInstan.department; //科室 - var reviewTime = tousseInstan.reviewTime; //审核时间 - - if(sterilingTypeTemp != sterilingType){ - showResultWithoutSpeak("虚拟篮筐[" + virtualBasketSeqNum + "]里面的器械包[" + tousseName + "]的灭菌程序和所选的灭菌程序不同!"); - } - - var exists = false; - var currentParentNode; - rootNode.eachChild(function(pNode){ - if(pNode.attributes.barcode == virtualBasketSeqNum) { - currentParentNode = pNode; - exists = true; - return false; - } - }); - - if(!exists){ - //添加到灭菌物品视图列表的第一行 - currentParentNode = createNode(true, virtualBasketSeqNum, "虚拟篮筐", '', '', '篮筐', position, 1, ''); - var firstChildNode = rootNode.item(0); - if(firstChildNode == null || firstChildNode == undefined){ - rootNode.appendChild(currentParentNode); - }else{ - rootNode.insertBefore(currentParentNode,firstChildNode); - } - - var childNode = createNode(false, tousseBarcode, tousseName, typeForSterilizationStatistics, department, '器械包', '', 1, reviewTime); - currentParentNode.appendChild(childNode); - speakBasket.addGoods('', tousseName, 1); - alreadyAdd ++; - }else{ - var existsCNode = false;//虚拟篮筐的机制 - if(currentParentNode.childNodes){ - currentParentNode.eachChild(function(cNode){ - if(cNode.attributes.barcode == tousseBarcode) { - existsCNode = true; - return false; - } - }); - } - if(!existsCNode){ - var childNode = createNode(false, tousseBarcode, tousseName, typeForSterilizationStatistics, department, '器械包', '', 1, reviewTime); - currentParentNode.appendChild(childNode); - speakBasket.addGoods('', tousseName, 1); - alreadyAdd ++; - } - } - } - - //加载灭菌参数 - SterilizationRecordTableManager.getParameter(top.Ext.getCmp('sterilizationType').getValue(),function(result){ - if(result != null && result.length > 0){ - top.Ext.getCmp('parameter').setValue(result); - } - }); - if(alreadyAdd == 0){ - showResult('未找到符合条件的器械包或器械包已扫描至表格中.'); - speakContent = null; - } - } else if (success == -1) { - showResult(resultData.failureCause); - } - speakBasket.speakContent(); - }else{ - showResult("您扫描的物品非已审核的器械包或篮筐!"); - } - statisticsTousseAndBasket(); //每次成功扫描条码后统计一下器械包的数量和灭菌篮筐的数量 - }, - failure : function(response, options) { - var result = Ext.decode(response.responseText); - showResult(result); - } - }); + if(checkRepeat(barcodeStr)){ + showResult("输入的条码已存在!"); + return; + } + + //当前灭菌程序是否可以添加灭菌物品 + var canAddTousse = sterilizationCanAddTousse(); + if(!canAddTousse){ + showResult("当前灭菌程序不能灭菌物品!"); + return; + } + var position = top.Ext.getCmp('position').getValue(); + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!loadTousseInstanceInfo.do', + params : { + barcode : barcodeStr, + loadTousseNamesInBasket : true, //是否要加载篮筐里的器械包名称 + sterilizationRecordId : sterilizationRecordId, //灭菌记录id + checkProxyDisinfection : 'yes', //是否需要检查代理灭菌是否已录入代理灭菌单 + saveBarcode : getAlreadyScanBarcodes(), //此次扫描之前已经扫描的条码集合,通过节点获取 + myBarcodes : JSON.stringify(myBarcodes) //此次扫描之前已经扫描的条码集合,通过数组获取 + }, + success : function(response, options) { + var result = response.responseText; + var speakContent = null; + var speakBasket = new SpeakBasket(); + if (result && result != 'null') { + var resultData = Ext.decode(result); + var success = resultData.success; + if (success == 0) { + var sterilingType = resultData.SterilingType; //灭菌程序 + var department = resultData.department; //科室 + var tousseName = resultData.tousseName; //器械包名称 + var typeForSterilizationStatistics = resultData.typeForSterilizationStatistics; //器械包类型(用于分类统计) + var includeImplant = resultData.includeImplant; //是否为含有植入物的外来器械包 + var reviewTime = resultData.reviewTime; //审核时间 + + if(top.Ext.getCmp('sterilizationType').getValue() != sterilingType){ + showResultWithoutSpeak("器械包[" + tousseName + "]的灭菌程序和所选的灭菌程序不同!"); + } + + if(includeImplant == "是"){ + showResultWithoutSpeak("此外来器械包含有植入物,需要做生物监测!"); + } + + //添加到灭菌物品视图列表的第一行 + var rootNode = sterilizationColumnTree.getRootNode(); + var parentNode = createNode(true, barcodeStr, tousseName, typeForSterilizationStatistics, department, '器械包', position, 1, reviewTime); + var firstChildNode = rootNode.item(0); + if(firstChildNode == null || firstChildNode == undefined){ + rootNode.appendChild(parentNode); + }else{ + rootNode.insertBefore(parentNode, firstChildNode); + } + speakBasket.addGoods('', tousseName, 1); + removePendingSterilizationGoods(barcodeStr) + } else if (success == 1) { //容器(单个灭菌框或虚拟篮筐) + var tousseInstanceArr = resultData.tousseInstanceArr; //进入容器的器械包集合 + var containerName = resultData.containerName; //容器名称 + var length = tousseInstanceArr.length; + if (length < 1) { + showResult('篮筐内无待灭菌物品'); + return; + } + + speakContent = containerName; + //添加到灭菌物品视图列表的第一行 + var rootNode = sterilizationColumnTree.getRootNode(); + var parentNode = createNode(true, barcodeStr, containerName, '', '', '篮筐', position, 1, ''); + var firstChildNode = rootNode.item(0); + if(firstChildNode == null || firstChildNode == undefined){ + rootNode.appendChild(parentNode); + }else{ + rootNode.insertBefore(parentNode, firstChildNode); + } + + var sterilingTypeTemp = top.Ext.getCmp('sterilizationType').getValue(); + for(var i = 0; i < length; i ++) { + var tousseInstan = tousseInstanceArr[i]; + + var tousseBarcode = tousseInstan.tousseBarcode; //器械包条码 + var tousseName = tousseInstan.tousseName; //器械包名称 + var typeForSterilizationStatistics = tousseInstan.typeForSterilizationStatistics; //器械包类型(用于分类统计) + var sterilingType = tousseInstan.SterilingType; //灭菌程序 + var department = tousseInstan.department; //科室 + var reviewTime = tousseInstan.reviewTime; //审核时间 + + if(sterilingTypeTemp != sterilingType){ + showResultWithoutSpeak("灭菌筐[" + containerName + "]里面的器械包[" + tousseName + "]的灭菌程序和所选的灭菌程序不同!"); + } + + var childNode = createNode(false, tousseBarcode, tousseName, typeForSterilizationStatistics, department, '器械包', '', 1, reviewTime); + parentNode.appendChild(childNode); + speakBasket.addGoods(containerName, tousseName, 1); + } + + //加载灭菌参数 + SterilizationRecordTableManager.getParameter(top.Ext.getCmp('sterilizationType').getValue(), function(result){ + if(result != null && result.length > 0){ + top.Ext.getCmp('parameter').setValue(result); + } + }); + removePendingSterilizationGoods(barcodeStr) + } else if(success == 2) { //不追溯器械包 + var tousseInstanceArr = resultData.tousseInstanceArr; + var length = tousseInstanceArr.length; + if (length < 1) { + showResult('未找到符合条件的器械包!'); + return; + } + + var sterilingTypeTemp = top.Ext.getCmp('sterilizationType').getValue(); + var myBarcodes2=[] + var myBarcodes3=[] + for(var i = 0; i < length; i ++) { + var tousseInstan = tousseInstanceArr[i]; + var typeForSterilizationStatistics = tousseInstan.typeForSterilizationStatistics; //器械包类型(用于分类统计) + var tousseBarcode = tousseInstan.tousseBarcode; //器械包条码 + var tousseName = tousseInstan.tousseName; //器械包名称 + var sterilingType = tousseInstan.SterilingType; //灭菌程序 + var department = tousseInstan.department; //科室 + var reviewTime = tousseInstan.reviewTime; //审核时间 + var amount = tousseInstan.amount; + if(checkRepeat(tousseBarcode)){ + showResult("输入的条码已存在!"); + return; + }; + + + if(sterilingTypeTemp != sterilingType){ + showResultWithoutSpeak("器械包[" + tousseName + "]的灭菌程序和所选的灭菌程序不同!"); + } + if(i==0){ + myBarcodes3[0]=tousseInstan.tousseBarcode//临时存放固定条码 + //添加到灭菌物品视图列表的第一行 + var rootNode = sterilizationColumnTree.getRootNode(); + var parentNode = createNode(true, tousseBarcode, tousseName, typeForSterilizationStatistics, department, '器械包', position, amount, reviewTime); + var firstChildNode = rootNode.item(0); + if(firstChildNode == null || firstChildNode == undefined){//第一行数据为空 + rootNode.appendChild(parentNode); + }else{ + rootNode.insertBefore(parentNode, firstChildNode); + } + speakBasket.addGoods('', tousseName, 1); + Array.prototype.push.apply(myFixedBarcodes,myBarcodes3);//将本次的固定条码存入全局数组 + }else{ + myBarcodes2[i-1]=tousseInstan.tousseBarcode //本次的包实例条码 + } + //removePendingSterilizationGoods(tousseBarcode); + removeAndUpdateAmountToFixedBarcodes(tousseBarcode,amount,true)//针对不追溯的包,动态修改右边对应的数量 + } + Array.prototype.push.apply(myBarcodes,myBarcodes2);//将所有的包实例条码存入全局条码中 + speakContent = sterilizationColumnTree.getRootNode().text; + } else if (success == 3) { //首尾器械包,since2015-10-27 + var tousseInstanceArr = resultData.tousseInstanceArr; + var length = tousseInstanceArr.length; + if (length < 1) { + showResult('未找到符合条件的器械包!'); + return; + } + + var alreadyAdd = 0; + var sterilingTypeTemp = top.Ext.getCmp('sterilizationType').getValue(); + var rootNode = sterilizationColumnTree.getRootNode(); + speakContent = rootNode.text; + for(var i = 0; i < length; i ++) { + var tousseInstan = tousseInstanceArr[i]; + + var tousseBarcode = tousseInstan.tousseBarcode; //器械包条码 + var tousseName = tousseInstan.tousseName; //器械包名称 + var typeForSterilizationStatistics = tousseInstan.typeForSterilizationStatistics; //器械包类型(用于分类统计) + var sterilingType = tousseInstan.SterilingType; //灭菌程序 + var department = tousseInstan.department; //科室 + var reviewTime = tousseInstan.reviewTime; //审核时间 + + if(sterilingTypeTemp != sterilingType){ + showResultWithoutSpeak("器械包[" + tousseName + "]的灭菌程序和所选的灭菌程序不同!"); + } + + var exists = false; + rootNode.eachChild(function(pNode){ + if(pNode.attributes.barcode == tousseBarcode) { //此包已经扫描过了 + exists = true; + return false; + } + if(pNode.childNodes){ + pNode.eachChild(function(cNode){ + if(cNode.attributes.barcode == tousseBarcode) { //此包已经入审核篮筐的 + exists = true; + return false; + } + }); + } + }); + if(!exists){ //此包没有扫描过并且没有入审核篮筐 + //添加到灭菌物品视图列表的第一行 + var parentNode = createNode(true, tousseBarcode, tousseName, typeForSterilizationStatistics, department, '器械包', position, 1, reviewTime); + var firstChildNode = rootNode.item(0); + if(firstChildNode == null || firstChildNode == undefined){ + rootNode.appendChild(parentNode); + }else{ + rootNode.insertBefore(parentNode, firstChildNode); + } + speakBasket.addGoods('', tousseName, 1); + alreadyAdd ++; + removePendingSterilizationGoods(tousseBarcode); + } + } + + //加载灭菌参数 + SterilizationRecordTableManager.getParameter(top.Ext.getCmp('sterilizationType').getValue(), function(result){ + if(result != null && result.length > 0){ + top.Ext.getCmp('parameter').setValue(result); + } + }); + if(alreadyAdd == 0){ + showResult('未找到符合条件的器械包或器械包已扫描至表格中.'); + speakContent = null; + } + } else if(success == 4) { //首尾虚拟篮筐 + var tousseInstanceArr = resultData.tousseInstanceArr; + var length = tousseInstanceArr.length; + if (length < 1) { + showResult('未找到符合条件的器械包!'); + return; + } + + var alreadyAdd = 0; + var sterilingTypeTemp = top.Ext.getCmp('sterilizationType').getValue(); + var rootNode = sterilizationColumnTree.getRootNode(); + speakContent = rootNode.text; + for(var i = 0; i < length; i ++) { + var tousseInstan = tousseInstanceArr[i]; + + var virtualBasketSeqNum = tousseInstan.virtualBasketSeqNum; //虚拟篮筐编号 + var tousseBarcode = tousseInstan.tousseBarcode; //器械包条码 + var tousseName = tousseInstan.tousseName; //器械包名称 + var typeForSterilizationStatistics = tousseInstan.typeForSterilizationStatistics; //器械包类型(用于分类统计) + var sterilingType = tousseInstan.SterilingType; //灭菌程序 + var department = tousseInstan.department; //科室 + var reviewTime = tousseInstan.reviewTime; //审核时间 + + if(sterilingTypeTemp != sterilingType){ + showResultWithoutSpeak("虚拟篮筐[" + virtualBasketSeqNum + "]里面的器械包[" + tousseName + "]的灭菌程序和所选的灭菌程序不同!"); + } + + var exists = false; + var currentParentNode; + rootNode.eachChild(function(pNode){ + if(pNode.attributes.barcode == virtualBasketSeqNum) { + currentParentNode = pNode; + exists = true; + return false; + } + }); + + if(!exists){ + //添加到灭菌物品视图列表的第一行 + currentParentNode = createNode(true, virtualBasketSeqNum, "虚拟篮筐", '', '', '篮筐', position, 1, ''); + var firstChildNode = rootNode.item(0); + if(firstChildNode == null || firstChildNode == undefined){ + rootNode.appendChild(currentParentNode); + }else{ + rootNode.insertBefore(currentParentNode,firstChildNode); + } + + var childNode = createNode(false, tousseBarcode, tousseName, typeForSterilizationStatistics, department, '器械包', '', 1, reviewTime); + currentParentNode.appendChild(childNode); + speakBasket.addGoods('', tousseName, 1); + alreadyAdd ++; + }else{ + var existsCNode = false;//虚拟篮筐的机制 + if(currentParentNode.childNodes){ + currentParentNode.eachChild(function(cNode){ + if(cNode.attributes.barcode == tousseBarcode) { + existsCNode = true; + return false; + } + }); + } + if(!existsCNode){ + var childNode = createNode(false, tousseBarcode, tousseName, typeForSterilizationStatistics, department, '器械包', '', 1, reviewTime); + currentParentNode.appendChild(childNode); + speakBasket.addGoods('', tousseName, 1); + alreadyAdd ++; + } + } + } + + //加载灭菌参数 + SterilizationRecordTableManager.getParameter(top.Ext.getCmp('sterilizationType').getValue(),function(result){ + if(result != null && result.length > 0){ + top.Ext.getCmp('parameter').setValue(result); + } + }); + if(alreadyAdd == 0){ + showResult('未找到符合条件的器械包或器械包已扫描至表格中.'); + speakContent = null; + } + } else if (success == -1) { + showResult(resultData.failureCause); + } + speakBasket.speakContent(); + }else{ + showResult("您扫描的物品非已审核的器械包或篮筐!"); + } + statisticsTousseAndBasket(); //每次成功扫描条码后统计一下器械包的数量和灭菌篮筐的数量 + }, + failure : function(response, options) { + var result = Ext.decode(response.responseText); + showResult(result); + } + }); } /** - * 点击一键入炉按钮,请求后台后的处理(把物品加载到灭菌物品列表) - * 器械包节点 = {type:"器械包",barcode:"器械包条码",name:"器械包名称",typeForSterilizationStatistics:"器械包类型(注意区别于真正的类型)",sterilingType:"灭菌程序",depart:"科室",reviewTime:"审核时间"} - * 篮筐节点 = {type:"篮筐",barcode:"篮筐条码",name:"篮筐名称",dataList:[{barcode:"器械包条码",name:"器械包名称",typeForSterilizationStatistics:"器械包类型(注意区别于真正的类型)",sterilingType:"灭菌程序",depart:"科室",reviewTime:"审核时间"}...]} - * datas格式:[器械包节点/篮筐节点,...] + * 点击一键入炉按钮,请求后台后的处理(把物品加载到灭菌物品列表) + * 器械包节点 = {type:"器械包",barcode:"器械包条码",name:"器械包名称",typeForSterilizationStatistics:"器械包类型(注意区别于真正的类型)",sterilingType:"灭菌程序",depart:"科室",reviewTime:"审核时间"} + * 篮筐节点 = {type:"篮筐",barcode:"篮筐条码",name:"篮筐名称",dataList:[{barcode:"器械包条码",name:"器械包名称",typeForSterilizationStatistics:"器械包类型(注意区别于真正的类型)",sterilingType:"灭菌程序",depart:"科室",reviewTime:"审核时间"}...]} + * datas格式:[器械包节点/篮筐节点,...] */ function loadContainerAndTousseToGrid(datas){ - var position = top.Ext.getCmp('position').getValue(); - var rootNode = sterilizationColumnTree.getRootNode(); - if(datas && datas.length){ - for(var i = 0;i < datas.length;i++){ - var data = datas[i];//一键入炉的待灭菌,没有入篮筐的器械包或篮筐节点 - var parentNode; - if ('器械包' == data.type) { - parentNode = createNode(true,data.barcode,data.name,data.typeForSterilizationStatistics,data.depart,'器械包',position,1,data.reviewTime); - } else { - parentNode = createNode(true,data.barcode,data.name,'',data.depart,'篮筐',position,1,''); - var tousseInstanceArr = data.dataList - if(tousseInstanceArr && tousseInstanceArr.length > 0){ - for(var k = 0; k < tousseInstanceArr.length; k++){ - var ti = tousseInstanceArr[k]; - var childNode = createNode(false,ti.barcode,ti.name,ti.typeForSterilizationStatistics,ti.depart,'器械包',position,1,ti.reviewTime); - parentNode.appendChild(childNode); - } - } - } - var firstChildNode = rootNode.item(0); - if(!firstChildNode){ - rootNode.appendChild(parentNode); - }else{ - rootNode.insertBefore(parentNode,firstChildNode); - } - } - } - statisticsTousseAndBasket(); //每次成功扫描条码后统计一下器械包的数量和灭菌篮筐的数量 + var position = top.Ext.getCmp('position').getValue(); + var rootNode = sterilizationColumnTree.getRootNode(); + if(datas && datas.length){ + for(var i = 0;i < datas.length;i++){ + var data = datas[i];//一键入炉的待灭菌,没有入篮筐的器械包或篮筐节点 + var parentNode; + if ('器械包' == data.type) { + parentNode = createNode(true,data.barcode,data.name,data.typeForSterilizationStatistics,data.depart,'器械包',position,1,data.reviewTime); + } else { + parentNode = createNode(true,data.barcode,data.name,'',data.depart,'篮筐',position,1,''); + var tousseInstanceArr = data.dataList + if(tousseInstanceArr && tousseInstanceArr.length > 0){ + for(var k = 0; k < tousseInstanceArr.length; k++){ + var ti = tousseInstanceArr[k]; + var childNode = createNode(false,ti.barcode,ti.name,ti.typeForSterilizationStatistics,ti.depart,'器械包',position,1,ti.reviewTime); + parentNode.appendChild(childNode); + } + } + } + var firstChildNode = rootNode.item(0); + if(!firstChildNode){ + rootNode.appendChild(parentNode); + }else{ + rootNode.insertBefore(parentNode,firstChildNode); + } + } + } + statisticsTousseAndBasket(); //每次成功扫描条码后统计一下器械包的数量和灭菌篮筐的数量 } /** @@ -836,33 +904,33 @@ * @returns {Boolean} */ function checkRepeat(barcodeStr){ - var barcodeArray = barcodeStr.split(";"); - var barcode = barcodeArray[0]; - if(barcodeArray.length > 1){ - return false; - }else{ - var rootNode = sterilizationColumnTree.getRootNode(); - var isExistTousse = false; - rootNode.eachChild(function(pNode){ - if(pNode.attributes.barcode == barcode) { - isExistTousse = true; - } - }); - } - return isExistTousse; + var barcodeArray = barcodeStr.split(";"); + var barcode = barcodeArray[0]; + if(barcodeArray.length > 1){ + return false; + }else{ + var rootNode = sterilizationColumnTree.getRootNode(); + var isExistTousse = false; + rootNode.eachChild(function(pNode){ + if(pNode.attributes.barcode == barcode) { + isExistTousse = true; + } + }); + } + return isExistTousse; } function setIsClickDel(v){ - isClickDel = (v==1?true:false); + isClickDel = (v==1?true:false); } function deleteGiveBackColumnTreeItem(clickNode){ - addPendingStarilizationGoodsFromRecord(clickNode); - var desMsg = "删除灭菌条码:" + clickNode.attributes.barcode + " ,名称:" + clickNode.attributes.name; - desMsg = desMsg + " ,类型:" + clickNode.attributes.type; - buildSterilizationLogInfo("删除",desMsg); - clickNode.remove(); - statisticsTousseAndBasket(); + addPendingStarilizationGoodsFromRecord(clickNode); + var desMsg = "删除灭菌条码:" + clickNode.attributes.barcode + " ,名称:" + clickNode.attributes.name; + desMsg = desMsg + " ,类型:" + clickNode.attributes.type; + buildSterilizationLogInfo("删除",desMsg); + clickNode.remove(); + statisticsTousseAndBasket(); } /** @@ -872,14 +940,14 @@ * @param name */ function addPendingSterilizationGoodsToRecord(barcode,type,name) { - var desMsg = "载入条码:" + barcode + " ,名称:" + name; - if (type == 'BASKET') { - desMsg = desMsg + " ,类型:篮筐"; - }else if(type == 'TOUSSE'){ - desMsg = desMsg + " ,类型:器械包"; - } - buildSterilizationLogInfo("载入",desMsg); - loadTousseInstanceCheckPosition(barcode,id); + var desMsg = "载入条码:" + barcode + " ,名称:" + name; + if (type == 'BASKET') { + desMsg = desMsg + " ,类型:篮筐"; + }else if(type == 'TOUSSE'){ + desMsg = desMsg + " ,类型:器械包"; + } + buildSterilizationLogInfo("载入",desMsg); + loadTousseInstanceCheckPosition(barcode,id); } /** @@ -888,251 +956,474 @@ * @param description */ function buildSterilizationLogInfo(type,description){ - Ext.Ajax.request({ - url : WWWROOT + '/log/saveLog.do', - params : {model : '灭菌模块',type : type,description : description}, - success : function(response, options) { - } - }); + Ext.Ajax.request({ + url : WWWROOT + '/log/saveLog.do', + params : {model : '灭菌模块',type : type,description : description}, + success : function(response, options) { + } + }); } /** * 移除右边表格的数据(今天待审核的数据列表),barcode可能为单个器械包条码,也可能为首尾两个条码中间用分号隔开(最好别用首尾条码) * @param barcode */ function removePendingSterilizationGoods(barcode) { - pendingSterilizationColumnTree.getRootNode().eachChild(function(pNode){ - //移除某一个节点后,再遍历其他节点得到的是undefined - if (pNode != null && pNode.attributes && pNode.attributes.objBarcode) { - if(barcode.indexOf(";") != -1){ - try{ - var objBarcodeInt = parseInt(pNode.attributes.objBarcode); - var barcodeArray = barcode.split(";"); - if(parseInt(barcodeArray[0]) <= objBarcodeInt && parseInt(barcodeArray[1]) >= objBarcodeInt){ - pNode.remove(); - } - }catch(e){ - - } - }else{ - if(pNode.attributes.objBarcode == barcode){ - pNode.remove(); - } - } - } - }); + pendingSterilizationColumnTree.getRootNode().eachChild(function(pNode){ + //移除某一个节点后,再遍历其他节点得到的是undefined + if (pNode != null && pNode.attributes && pNode.attributes.objBarcode) { + if(barcode.indexOf(";") != -1){ + try{ + var objBarcodeInt = parseInt(pNode.attributes.objBarcode); + var barcodeArray = barcode.split(";"); + if(parseInt(barcodeArray[0]) <= objBarcodeInt && parseInt(barcodeArray[1]) >= objBarcodeInt){ + pNode.remove(); + } + }catch(e){ + + } + }else{ + if(pNode.attributes.objBarcode == barcode){ + pNode.remove(); + } + } + } + }); } + /** + * 扫描固定条码和修改数量后,修改右边表格对应的数量 + * @param barcode 条码 + * @param parentNode 左边的节点 + * @param objAmount 左边的数量 + */ +function removeAndUpdateAmountToFixedBarcodes(barcode,objAmount,isDel){ + var i = 0; + pendingSterilizationColumnTree.getRootNode().eachChild(function(pNode){ + //移除某一个节点后,再遍历其他节点得到的是undefined + if (pNode != null && pNode.attributes && pNode.attributes.objBarcode) { + if(pNode.attributes.objBarcode == barcode &&i<1 ){ + i++ + var name = pNode.attributes.objName; + var type = pNode.attributes.type; + var depart = pNode.attributes.depart; + var reviewTime = pNode.attributes.reviewTime; + var amount = pNode.attributes.objAmount;//右边的数量 + var rootNode = sterilizationColumnTree.getRootNode(); + var finalAmount = parseFloat(amount)+parseFloat(objAmount) + pNode.remove();//移除对应右边的节点 + if(isDel){ + finalAmount = parseFloat(amount)-parseFloat(objAmount) + } + var myNode = createNodeForPendingStarilizationGoods(true,barcode,name,type,depart,reviewTime,finalAmount) + pendingSterilizationColumnTree.getRootNode().appendChild(myNode); + } + } + }); +} + + +/** + * 删除固定条码以后,直接在右边设置库存的最大值 + * @param barcode 条码 + * @param parentNode 左边的节点 + * @param objAmount 左边的数量 + */ +function setAmountToFixedBarcodes(barcode,objAmount){ + var i = 0; + pendingSterilizationColumnTree.getRootNode().eachChild(function(pNode){ + //移除某一个节点后,再遍历其他节点得到的是undefined + if (pNode != null && pNode.attributes && pNode.attributes.objBarcode) { + if(pNode.attributes.objBarcode == barcode &&i<1 ){ + i++ + var name = pNode.attributes.objName; + var type = pNode.attributes.type; + var depart = pNode.attributes.depart; + var reviewTime = pNode.attributes.reviewTime; + var amount = pNode.attributes.objAmount;//右边的数量 + var rootNode = sterilizationColumnTree.getRootNode(); + //var finalAmount = parseFloat(amount)+parseFloat(objAmount) + pNode.remove();//移除对应右边的节点 + var myNode = createNodeForPendingStarilizationGoods(true,barcode,name,type,depart,reviewTime,parseFloat(objAmount)) + pendingSterilizationColumnTree.getRootNode().appendChild(myNode); + } + } + }); +} + + + + +/** * 将器械包移除篮筐(只能移除篮筐里面的器械包,这里只是方便用户,不需要特意回到“灭菌装载”界面操作) - * @param barcode 将要被从灭菌篮筐移除的器械包条码 + * @param barcode 将要被从灭菌篮筐移除的器械包条码 */ function removeGridItem(barcode) { - top.Ext.Msg.confirm("删除确认","是否要将此器械包移除篮筐",function(btn){ - if(btn=='yes'){ - Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/tousseInstanceAction!removeFromBasket.do', - params : {barcode : barcode}, - success : function(response, options) { - var rootNode = pendingSterilizationColumnTree.getRootNode(); - var needToDeletedNode = rootNode.findChild('objBarcode',barcode); - if(needToDeletedNode == null){ - rootNode.eachChild(function(pNode){ - if(pNode.findChild('objBarcode',barcode) != null){ - var newChildNodes = new Array(); - pNode.eachChild(function(cNode){ - if(cNode.attributes.objBarcode != barcode){ - newChildNodes.push(createPendingSterilizationGoodsNode(cNode.attributes.objBarcode, cNode.attributes.objName, cNode.attributes.objAmount, cNode.attributes.type, cNode.attributes.depart, cNode.attributes.reviewTime)); - } - }); - if(newChildNodes.length != 0){ - var newNode = createPendingSterilizationGoodsNode(pNode.attributes.objBarcode, pNode.attributes.objName, pNode.attributes.objAmount - 1, pNode.attributes.type,'',''); - rootNode.replaceChild(newNode,pNode); - newNode.appendChild(newChildNodes); - }else{ - pNode.remove(); - } - return false; - } - }); - }else{ - needToDeletedNode.remove(); - } - }, - failure : function(response, options) { - var result = Ext.decode(response.responseText); - MsgTip.msg('提示', result.cause,true,3); - } - }); - } - }); + top.Ext.Msg.confirm("删除确认","是否要将此器械包移除篮筐",function(btn){ + if(btn=='yes'){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/tousseInstanceAction!removeFromBasket.do', + params : {barcode : barcode}, + success : function(response, options) { + var rootNode = pendingSterilizationColumnTree.getRootNode(); + var needToDeletedNode = rootNode.findChild('objBarcode',barcode); + if(needToDeletedNode == null){ + rootNode.eachChild(function(pNode){ + if(pNode.findChild('objBarcode',barcode) != null){ + var newChildNodes = new Array(); + pNode.eachChild(function(cNode){ + if(cNode.attributes.objBarcode != barcode){ + newChildNodes.push(createPendingSterilizationGoodsNode(cNode.attributes.objBarcode, cNode.attributes.objName, cNode.attributes.objAmount, cNode.attributes.type, cNode.attributes.depart, cNode.attributes.reviewTime)); + } + }); + if(newChildNodes.length != 0){ + var newNode = createPendingSterilizationGoodsNode(pNode.attributes.objBarcode, pNode.attributes.objName, pNode.attributes.objAmount - 1, pNode.attributes.type,'',''); + rootNode.replaceChild(newNode,pNode); + newNode.appendChild(newChildNodes); + }else{ + pNode.remove(); + } + return false; + } + }); + }else{ + needToDeletedNode.remove(); + } + }, + failure : function(response, options) { + var result = Ext.decode(response.responseText); + MsgTip.msg('提示', result.cause,true,3); + } + }); + } + }); } /** * 删除灭菌物品栏,物品回退至待灭菌物品列表 * @param clickNode */ function addPendingStarilizationGoodsFromRecord(clickNode) { - var objBarcode = clickNode.attributes.barcode; - var objName = clickNode.attributes.name; - var type = clickNode.attributes.type; - var depart = clickNode.attributes.depart; - var reviewTime = clickNode.attributes.reviewTime; - - var array = new Array(); - var isBasketUrgent = false; //篮筐是否加急 - var objAmount = 1; - if (type == '篮筐') { - type = 'BASKET'; - objAmount = 0; - clickNode.eachChild(function(pNode){ - objAmount++; - - var childObjBarcode = pNode.attributes.barcode; - var childObjName = pNode.attributes.name; - var childObjAmount = 1; - var childType = 'TOUSSE_IN'; - var isUrgent = '否'; - var childNode = createPendingSterilizationGoodsNode(childObjBarcode, childObjName, childObjAmount, childType , pNode.attributes.depart, pNode.attributes.reviewTime); - DWREngine.setAsync(false); - //如果灭菌程序不能添加器械包,要清除灭菌物品列表 - SterilizationRecordTableManager.isTousseUrgent(childObjBarcode,function(result){ - if(result == true){ - isUrgent = '是'; - isBasketUrgent = true; - } - }); - DWREngine.setAsync(true); - childNode.attributes.isUrgent = isUrgent; - array.push(childNode); - }); - } else { - type = 'TOUSSE'; - } - - var node = createPendingSterilizationGoodsNode(objBarcode, objName, objAmount, type, depart, reviewTime); - if(type == 'TOUSSE'){ - var isUrgent = '否'; - DWREngine.setAsync(false); - //如果灭菌程序不能添加器械包,要清除灭菌物品列表 - SterilizationRecordTableManager.isTousseUrgent(node.attributes.objBarcode,function(result){ - if(result == true){ - isUrgent = '是'; - } - }); - DWREngine.setAsync(true); - node.attributes.isUrgent=isUrgent; - } - if (type == 'BASKET') { - if(isBasketUrgent){ - node.attributes.isUrgent = '是'; - } - node.appendChild(array); - } - - pendingSterilizationColumnTree.getRootNode().appendChild(node); - - //如果一键入炉的按钮不可用,则将其变成可用 - //判断表格中的物品数量是否大于0 - if(pendingSterilizationColumnTree.getRootNode().childNodes.length == 0){ - top.Ext.getCmp("btnBatchAddTousse").disable(); - }else{ - top.Ext.getCmp("btnBatchAddTousse").enable(); - } + var objBarcode = clickNode.attributes.barcode; + var objName = clickNode.attributes.name; + var type = clickNode.attributes.type; + var depart = clickNode.attributes.depart; + var reviewTime = clickNode.attributes.reviewTime; + + var array = new Array(); + var isBasketUrgent = false; //篮筐是否加急 + var objAmount = clickNode.attributes.amount==""?1:clickNode.attributes.amount; + if (type == '篮筐') { + type = 'BASKET'; + objAmount = 0; + clickNode.eachChild(function(pNode){ + objAmount++; + + var childObjBarcode = pNode.attributes.barcode; + var childObjName = pNode.attributes.name; + var childObjAmount = objAmount; + var childType = 'TOUSSE_IN'; + var isUrgent = '否'; + var childNode = createPendingSterilizationGoodsNode(childObjBarcode, childObjName, childObjAmount, childType , pNode.attributes.depart, pNode.attributes.reviewTime); + DWREngine.setAsync(false); + //如果灭菌程序不能添加器械包,要清除灭菌物品列表 + SterilizationRecordTableManager.isTousseUrgent(childObjBarcode,function(result){ + if(result == true){ + isUrgent = '是'; + isBasketUrgent = true; + } + }); + DWREngine.setAsync(true); + childNode.attributes.isUrgent = isUrgent; + array.push(childNode); + }); + } else { + type = 'TOUSSE'; + } + var fixedBarcodeAmount = 1 + + if(myFixedBarcodes.indexOf(objBarcode)!=-1){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!getTousseInsAmountByBarcode.do', + sync:true, + params : { + fixedBarcode :objBarcode + }, + waitMsg : '正在处理,请稍候...', + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.success){ + fixedBarcodeAmount = result.message; + var node = createPendingSterilizationGoodsNode(objBarcode, objName, fixedBarcodeAmount, type, depart, reviewTime); + if(type == 'TOUSSE'){ + var isUrgent = '否'; + DWREngine.setAsync(false); + //如果灭菌程序不能添加器械包,要清除灭菌物品列表 + SterilizationRecordTableManager.isTousseUrgent(node.attributes.objBarcode,function(result){ + if(result == true){ + isUrgent = '是'; + } + }); + DWREngine.setAsync(true); + node.attributes.isUrgent=isUrgent; + } + if (type == 'BASKET') { + if(isBasketUrgent){ + node.attributes.isUrgent = '是'; + } + node.appendChild(array); + } + pendingSterilizationColumnTree.getRootNode().appendChild(node); + }else{ + showResult("发生异常"); + } + }, + failure : function(response, options) { + showResult("后台运行异常,请稍候再试..."); + formObj.getEl().unmask(); + } + }); + }else{ + var node = createPendingSterilizationGoodsNode(objBarcode, objName, fixedBarcodeAmount, type, depart, reviewTime); + if(type == 'TOUSSE'){ + var isUrgent = '否'; + DWREngine.setAsync(false); + //如果灭菌程序不能添加器械包,要清除灭菌物品列表 + SterilizationRecordTableManager.isTousseUrgent(node.attributes.objBarcode,function(result){ + if(result == true){ + isUrgent = '是'; + } + }); + DWREngine.setAsync(true); + node.attributes.isUrgent=isUrgent; + } + if (type == 'BASKET') { + if(isBasketUrgent){ + node.attributes.isUrgent = '是'; + } + node.appendChild(array); + } + pendingSterilizationColumnTree.getRootNode().appendChild(node); + } + + + //如果一键入炉的按钮不可用,则将其变成可用 + //判断表格中的物品数量是否大于0 + if(pendingSterilizationColumnTree.getRootNode().childNodes.length == 0){ + top.Ext.getCmp("btnBatchAddTousse").disable(); + }else{ + top.Ext.getCmp("btnBatchAddTousse").enable(); + } } + + + /** * 生成待灭菌物品节点(“将器械包移除篮筐”和“删除灭菌物品”两个操作会调用此函数) - * @param objBarcode 条码(篮筐或器械包) - * @param objName 名称(篮筐或器械包) - * @param objAmount 数量(如果type=BASKET则表示此篮筐里面的器械包个数,其他的均为1) - * @param type 类型(值为“BASKET”或者“TOUSSE”或者“TOUSSE_IN”,分别表示“篮筐”、“没入篮筐的器械包”、“入灭菌筐的器械包”) - * @param depart 科室 - * @param reviewTime 审核时间 + * @param objBarcode 条码(篮筐或器械包) + * @param objName 名称(篮筐或器械包) + * @param objAmount 数量(如果type=BASKET则表示此篮筐里面的器械包个数,其他的均为1) + * @param type 类型(值为“BASKET”或者“TOUSSE”或者“TOUSSE_IN”,分别表示“篮筐”、“没入篮筐的器械包”、“入灭菌筐的器械包”) + * @param depart 科室 + * @param reviewTime 审核时间 * @returns */ function createPendingSterilizationGoodsNode(objBarcode, objName, objAmount, type, depart, reviewTime) { - var node; - if(type == 'BASKET'){ - //创建父节点 - node = new top.Ext.tree.TreeNode({ - id : Ext.id(), - iconCls:'task-folder', - uiProvider : top.Ext.tree.ColumnNodeUI, - leaf : false, - expanded : false - }); - }else{ - //创建子节点 - node = new top.Ext.tree.TreeNode({ - id : Ext.id(), - iconCls : 'task', - uiProvider : top.Ext.tree.ColumnNodeUI, - leaf : true, - expanded : false - }); - node.attributes.depart=depart; - } - - node.attributes.objBarcode=objBarcode; - node.attributes.objName=objName; - node.attributes.objAmount=objAmount; - node.attributes.type=type; - node.attributes.reviewTime=reviewTime; - return node; + var node; + if(type == 'BASKET'){ + //创建父节点 + node = new top.Ext.tree.TreeNode({ + id : Ext.id(), + iconCls:'task-folder', + uiProvider : top.Ext.tree.ColumnNodeUI, + leaf : false, + expanded : false + }); + }else{ + //创建子节点 + node = new top.Ext.tree.TreeNode({ + id : Ext.id(), + iconCls : 'task', + uiProvider : top.Ext.tree.ColumnNodeUI, + leaf : true, + expanded : false + }); + node.attributes.depart=depart; + } + + node.attributes.objBarcode=objBarcode; + node.attributes.objName=objName; + node.attributes.objAmount=objAmount; + node.attributes.type=type; + node.attributes.reviewTime=reviewTime; + return node; } var InterruptRecordItem = Ext.data.Record.create([ - {name : 'id'}, - {name : 'interruptUser'}, - {name : 'interruptDate'}, - {name : 'interruptFinishDate'}, - {name : 'interruptOptType'}, - {name : 'quatifyMonitoryId'} + {name : 'id'}, + {name : 'interruptUser'}, + {name : 'interruptDate'}, + {name : 'interruptFinishDate'}, + {name : 'interruptOptType'}, + {name : 'quatifyMonitoryId'} ]); + /** + * 只针对固定条码 增加数量 + * @param fixedBarcode 固定条码 + * @param addAmount 修改后数量 - 修改前的数量 = 新增的数量 + */ +function addTousseInsAmount(fixedBarcode,addAmount){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!fixedBarcodeBarcodeAdd.do', + params : { + fixedBarcode :fixedBarcode, + addAmount : addAmount, + myBarcodes: JSON.stringify(myBarcodes)//将数组已json格式传入后台 + }, + waitMsg : '正在处理,请稍候...', + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.success){ + var newBarcode = result.message.split(",") + myBarcodes=myBarcodes.concat(newBarcode);//将返回的条码添加到全局中 + }else{ + showResult("增加数量失败,请勿提交数据"); + } + }, + failure : function(response, options) { + showResult("后台运行异常,请稍候再试..."); + formObj.getEl().unmask(); + } + }); +} + +/** + * 只针对固定条码:点击删除图标后事件 + */ +function clickDeleteIcon(clickNode){ + var delAmount = clickNode.attributes.amount + var fixedBarcode = clickNode.attributes.barcode + delTousseInsAmount(delAmount,fixedBarcode); + //addPendingStarilizationGoodsFromRecord(clickNode); + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!getTousseInsAmountByBarcode.do', + sync:true, + params : { + fixedBarcode :fixedBarcode + }, + waitMsg : '正在处理,请稍候...', + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.success){ + fixedBarcodeAmount = result.message; + if(delAmount==fixedBarcodeAmount){ + //setAmountToFixedBarcodes(fixedBarcode,fixedBarcodeAmount) + removeAndUpdateAmountToFixedBarcodes(fixedBarcode,delAmount,false) + }else{ + removeAndUpdateAmountToFixedBarcodes(fixedBarcode,delAmount,false) + } + clickNode.remove();//将当前节点移除 + }else{ + showResult("发生异常"); + } + }, + failure : function(response, options) { + showResult("后台运行异常,请稍候再试..."); + formObj.getEl().unmask(); + } + }); + + +} + + +/** + * 固定条码删除数量 + * @param delAmount + * @param fixedBarcode + */ +function delTousseInsAmount(delAmount,fixedBarcode){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!fixedBarcodeBarcodeSubtraction.do', + params : { + fixedBarcode : fixedBarcode,//固定条码 + myBarcodes: JSON.stringify(myBarcodes),//将全局数组以json格式传入后台 + delAmount:delAmount//减少的数量 + }, + waitMsg : '正在处理,请稍候...', + success : function(response, options) { + console.log("减少前="+myBarcodes) + var result = Ext.decode(response.responseText); + if(result.success){ + if(typeof(result.message)=="undefined" || result.message==""){ + myBarcodes=[]; + }else{ + myBarcodes = result.message.split(",") + } + }else{ + showResult("减少数量失败,请勿提交数据"); + } + console.log("减少后="+myBarcodes) + }, + failure : function(response, options) { + showResult("后台运行异常,请稍候再试..."); + formObj.getEl().unmask(); + } + }); +} + + +/** * 新增或者修改 - * @param id 灭菌记录的id - * @param currentStatus 灭菌记录的状态 - * @param reSterilization 是否为重新灭菌 + * @param id 灭菌记录的id + * @param currentStatus 灭菌记录的状态 + * @param reSterilization 是否为重新灭菌 */ function addAndEditSterilizationRecord(id, currentStatus, reSterilization) { - tousseItemCountJsonStore = new Ext.data.Store({ - autoLoad : false, - reader : new Ext.data.JsonReader({ - fields : [ { - name : 'tousseName' - }, { - name : 'count' - } ] - }) - }); - - //灭菌物品列表grid的列头,根据可配置的参数进行动态定义 - var sterilizationColumnTreeColumnArray = []; - if(sstsConfig.showDepartOfTousseInstanceSterile){ - sterilizationColumnTreeColumnArray.push({header:'科室',width:150,dataIndex:'depart'}); - } - sterilizationColumnTreeColumnArray.push({header:'条码',width:112,dataIndex:'barcode'}); - sterilizationColumnTreeColumnArray.push({header:'名称',width:170,dataIndex:'name'}); - if (sstsConfig.haveSterilizerPosition) { - sterilizationColumnTreeColumnArray.push({header:'位置',width:80,dataIndex:'position'}); - } - sterilizationColumnTreeColumnArray.push({header:'删除',width:60,dataIndex:'type', - renderer:function(v,p,record){ - //只有“没有入篮筐的器械包节点”或者“篮筐节点”,并且灭菌记录的状态不为“已灭菌”和“灭菌失败”才可以删除 - if(record.isParentNode == true - && currentStatus != statusEnd - && currentStatus != statusFailure){ - return "\"删除外来器械包\""; - } - return ''; - } - }); + //将存放条码的数组初始化 + myBarcodes=[]; + myFixedBarcodes=[]; + + tousseItemCountJsonStore = new Ext.data.Store({ + autoLoad : false, + reader : new Ext.data.JsonReader({ + fields : [ { + name : 'tousseName' + }, { + name : 'count' + } ] + }) + }); + + //灭菌物品列表grid的列头,根据可配置的参数进行动态定义 + var sterilizationColumnTreeColumnArray = []; + if(sstsConfig.showDepartOfTousseInstanceSterile){ + sterilizationColumnTreeColumnArray.push({header:'科室',width:150,dataIndex:'depart'}); + } + sterilizationColumnTreeColumnArray.push({header:'条码',width:112,dataIndex:'barcode'}); + sterilizationColumnTreeColumnArray.push({header:'名称',width:170,dataIndex:'name'}); + sterilizationColumnTreeColumnArray.push({header : "数量",dataIndex : 'amount',width : 50, align:'right', menuDisabled: true}); + if (sstsConfig.haveSterilizerPosition) { + sterilizationColumnTreeColumnArray.push({header:'位置',width:80,dataIndex:'position'}); + } + sterilizationColumnTreeColumnArray.push({header:'删除',width:60,dataIndex:'type', + renderer:function(v,p,record){ + //只有“没有入篮筐的器械包节点”或者“篮筐节点”,并且灭菌记录的状态不为“已灭菌”和“灭菌失败”才可以删除 + if(record.isParentNode == true + && currentStatus != statusEnd + && currentStatus != statusFailure){ + return "\"删除外来器械包\""; + } + return ''; + } + }); - sterilizationColumnTree = new top.Ext.tree.ColumnTree({ - rootVisible:false, + sterilizationColumnTree = new top.Ext.tree.ColumnTree({ + rootVisible:false, autoScroll:true, containerScroll : false, height: 325, @@ -1142,1457 +1433,1548 @@ bodyStyle : 'border:1px solid #afd7af', columns:sterilizationColumnTreeColumnArray, loader: new top.Ext.tree.TreeLoader({ - url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!loadSterilizationGoods.do', - baseParams : {id:id}, - uiProviders:{ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!loadSterilizationGoods.do', + baseParams : {id:id}, + uiProviders:{ 'col': top.Ext.tree.ColumnNodeUI }, listeners : { - load : function(_this, node, response) { - statisticsTousseAndBasket(); - } + load : function(_this, node, response) { + statisticsTousseAndBasket(); + } } }), root: new top.Ext.tree.AsyncTreeNode({ text:'灭菌物品列表' }) - }); - - sterilizationColumnTree.on("beforeclick",function(clickNode,eObj){ - if(isClickDel){ //点击删除图标 - setIsClickDel(0); + }); + + sterilizationColumnTreeEditer = new top.Ext.tree.ColumnTreeEditor(sterilizationColumnTree, { + completeOnEnter : true, + autosize : true, + allowBlank: false, + selectOnFocus : true, + revertInvalid:true, + ignoreNoChange : true + }); + + sterilizationColumnTreeEditer.on("beforestartedit", function(thiz,el,v){ + var tempNode = thiz.editNode;//将要编辑的节点&& tempNode.attributes.scanFixedBarcode == '是' + if(thiz.editColIndex == 'amount'){ + return true; + }else { + return false; + } + }); + + sterilizationColumnTreeEditer.on("complete", function(thiz,newValue,oldValue){//修改后的事件 + var editNode = thiz.editNode; + var attr = editNode.attributes; + var name = attr.name; + var barcode = attr.barcode; + var newAmount = parseInt(newValue) + var oldAmount = parseInt(oldValue) + var reg = new RegExp("^[0-9]*$"); + //修改失败后调用 + var updateFail=function roleBack(){ + //克隆修改前的数据 + var isParentNode = editNode.attributes.isParentNode; + var typeForSterilizationStatistics ; + var department = editNode.attributes.depart; + var position = editNode.attributes.position ; + var amount = editNode.attributes.amount ; + var reviewTime = editNode.attributes.reviewTime ; + + var rootNode = sterilizationColumnTree.getRootNode(); + var parentNode = createNode(true, barcode, name, typeForSterilizationStatistics, department, '器械包', position, oldValue, reviewTime); + var firstChildNode = rootNode.item(0); + editNode.remove();//删除修改后的节点数据 + rootNode.appendChild(parentNode);//追加修改前的数据 + } + if(!reg.test(newValue)){ + showResult("请输入数字"); + updateFail() + return; + } + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!checkTousseInsAmountByBarcode.do', + params : { + barcode : barcode, + newAmount : newValue, + tousseName : name + }, + waitMsg : '正在处理,请稍候...', + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.success){ + if(newAmount>oldAmount){//如果是增加数量 + var count = newAmount - oldAmount + addTousseInsAmount(attr.barcode,count) + removeAndUpdateAmountToFixedBarcodes(barcode,count,true) + }else{ + var count = oldAmount - newAmount //减少的数量 + delTousseInsAmount(count,attr.barcode) + removeAndUpdateAmountToFixedBarcodes(barcode,count,false) + } + }else{//修改数量失败 + showResult(result.message); + updateFail(); + } + //每次修改数量后,进行统计 + statisticsTousseAndBasket(); + + }, + failure : function(response, options) { + showResult("后台运行异常,请稍候再试..."); + formObj.getEl().unmask(); + } + }); + }); + + + + sterilizationColumnTree.on("beforeclick",function(clickNode,eObj){ + if(isClickDel){ //点击删除图标 + if(myFixedBarcodes.indexOf(clickNode.attributes.barcode)!=-1){//该条码为固定条码 + clickDeleteIcon(clickNode); + }else{ + deleteGiveBackColumnTreeItem(clickNode); + } + setIsClickDel(0); clickNode.expand(); - deleteGiveBackColumnTreeItem(clickNode); - } - }); - sterilizationColumnTree.on("load",function(node,response){ - var position = getLastPosition(); - if(top.Ext.getCmp('position') != null){ - top.Ext.getCmp('position').setValue(position); - } - }); - - var urlParam = Ext.urlEncode({ - status :currentStatus - }); - - //灭菌物品列表grid的列头,根据可配置的参数进行动态定义 - var pendingSterilizationColumnTreeColumnArray = []; - pendingSterilizationColumnTreeColumnArray.push({ + + + //统计 + statisticsTousseAndBasket(); + } + }); + sterilizationColumnTree.on("load",function(node,response){ + var position = getLastPosition(); + if(top.Ext.getCmp('position') != null){ + top.Ext.getCmp('position').setValue(position); + } + }); + + var urlParam = Ext.urlEncode({ + status :currentStatus + }); + + //灭菌物品列表grid的列头,根据可配置的参数进行动态定义 + var pendingSterilizationColumnTreeColumnArray = []; + pendingSterilizationColumnTreeColumnArray.push({ header : '条码',width : 105,dataIndex : 'objBarcode' }); - pendingSterilizationColumnTreeColumnArray.push({ + pendingSterilizationColumnTreeColumnArray.push({ header : '名称',width : 150,dataIndex : 'objName' }); - pendingSterilizationColumnTreeColumnArray.push({ - header : '数量',width : 35,dataIndex : 'objAmount' + pendingSterilizationColumnTreeColumnArray.push({ + header : '数量',width : 35,dataIndex : 'objAmount' }); - pendingSterilizationColumnTreeColumnArray.push({ + pendingSterilizationColumnTreeColumnArray.push({ header : '载入',width : 35,dataIndex : 'type', renderer : function(v,p,record){ - var str = "\"\""; - if (record.type == 'BASKET' || record.type == 'TOUSSE') { - if(currentStatus != statusEnd && currentStatus != statusFailure){ - return str; - } - } - return ''; + var str = "\"\""; + if (record.type == 'BASKET' || record.type == 'TOUSSE') { + if(currentStatus != statusEnd && currentStatus != statusFailure){ + return str; + } + } + return ''; } }); - if(sstsConfig.showDepartOfTousseInstanceSterile == true) { - pendingSterilizationColumnTreeColumnArray.push({ - header : '科室',width : 150,dataIndex : 'depart' - }); - } - pendingSterilizationColumnTreeColumnArray.push({ - header : '审核时间',width : 135,dataIndex : 'reviewTime' + if(sstsConfig.showDepartOfTousseInstanceSterile == true) { + pendingSterilizationColumnTreeColumnArray.push({ + header : '科室',width : 150,dataIndex : 'depart' + }); + } + pendingSterilizationColumnTreeColumnArray.push({ + header : '审核时间',width : 135,dataIndex : 'reviewTime' }); - pendingSterilizationColumnTreeColumnArray.push({ - header : '加急',width : 35,dataIndex : 'isUrgent', - renderer : function(v, p, record) { - if (v == '是') { - return '' + v + ''; - }else{ - return '' + '否' + ''; - } - } + pendingSterilizationColumnTreeColumnArray.push({ + header : '加急',width : 35,dataIndex : 'isUrgent', + renderer : function(v, p, record) { + if (v == '是') { + return '' + v + ''; + }else{ + return '' + '否' + ''; + } + } }); - pendingSterilizationColumnTreeColumnArray.push({ + pendingSterilizationColumnTreeColumnArray.push({ header : '删除', width : 40, dataIndex : 'type', renderer : function(v,p,record){ - var str = "\"\""; - if (record.type == 'TOUSSE_IN') { - if(currentStatus != statusEnd && currentStatus != statusFailure){ - return str; - } - } - return ''; + var str = "\"\""; + if (record.type == 'TOUSSE_IN') { + if(currentStatus != statusEnd && currentStatus != statusFailure){ + return str; + } + } + return ''; } }); - - /** - * 今天审核的待灭菌物品列表 - */ - pendingSterilizationColumnTree = new top.Ext.tree.ColumnTree({ - rootVisible : false, + + /** + * 今天审核的待灭菌物品列表 + */ + pendingSterilizationColumnTree = new top.Ext.tree.ColumnTree({ + rootVisible : false, autoScroll : true, containerScroll : false, height : 520 , frame : false, bodyStyle : 'border:1px solid #afd7af', tbar:['-','->',{iconCls : 'btn_ext_add_tousse',id:'btnBatchAddTousse',disabled:true,text:'一键入炉',handler:function() { - var rootNode = pendingSterilizationColumnTree.getRootNode(); - var len = rootNode.childNodes.length; - if(len == 0){ - showResult("暂无今天审核的待灭菌记录"); - return; - } - var canAddTousse = sterilizationCanAddTousse(); - if(!canAddTousse){ - showResult("当前灭菌程序不能灭菌物品!"); - return; - } - - //先将节点的条码存储到集合变量中 - var waitSterilingBarcodeArray = []; - //查询节点的数据是否存在,如果存在则进行循环 - Ext.each(rootNode.childNodes, function(cNode){ - waitSterilingBarcodeArray.push(cNode.attributes["objBarcode"]); - }); - - formObj.getEl().mask("正在加载,请稍候..."); - - //ajax请求后台传递待灭菌的条码(灭菌筐及包实例的条码集合) - Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!batchAddToRecord.do', - params : { - barcodes : waitSterilingBarcodeArray.join(";"), - loadTousseNamesInBasket : true, //是否要加载篮筐里的器械包名称 - //sterilizationRecordId : sterilizationRecordId, //灭菌记录id - checkProxyDisinfection : 'yes', //是否需要检查代理灭菌是否已录入代理灭菌单 - saveBarcode : getAlreadyScanBarcodes() //此次扫描之前已经扫描的条码集合 - }, - waitMsg : '正在处理,请稍候...', - success : function(response, options) { - var result = Ext.decode(response.responseText); - if(result.success){ - //将篮筐与器械包加载到灭菌列表中 - loadContainerAndTousseToGrid(result.datas); - for(var i = 0;i < waitSterilingBarcodeArray.length;i++){ - //移除今天审核待灭菌物品的数据 - removePendingSterilizationGoods(waitSterilingBarcodeArray[i]); - } - top.Ext.getCmp("btnBatchAddTousse").disable(); - }else{ - showResult(result.message); - } - formObj.getEl().unmask(); - }, - failure : function(response, options) { - showResult("后台运行异常,请稍候再试..."); - formObj.getEl().unmask(); - } - }); + var rootNode = pendingSterilizationColumnTree.getRootNode(); + var len = rootNode.childNodes.length; + if(len == 0){ + showResult("暂无今天审核的待灭菌记录"); + return; + } + var canAddTousse = sterilizationCanAddTousse(); + if(!canAddTousse){ + showResult("当前灭菌程序不能灭菌物品!"); + return; + } + + //先将节点的条码存储到集合变量中 + var waitSterilingBarcodeArray = []; + //查询节点的数据是否存在,如果存在则进行循环 + Ext.each(rootNode.childNodes, function(cNode){ + waitSterilingBarcodeArray.push(cNode.attributes["objBarcode"]); + }); + + formObj.getEl().mask("正在加载,请稍候..."); + + //ajax请求后台传递待灭菌的条码(灭菌筐及包实例的条码集合) + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!batchAddToRecord.do', + params : { + barcodes : waitSterilingBarcodeArray.join(";"), + loadTousseNamesInBasket : true, //是否要加载篮筐里的器械包名称 + //sterilizationRecordId : sterilizationRecordId, //灭菌记录id + checkProxyDisinfection : 'yes', //是否需要检查代理灭菌是否已录入代理灭菌单 + saveBarcode : getAlreadyScanBarcodes() //此次扫描之前已经扫描的条码集合 + }, + waitMsg : '正在处理,请稍候...', + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.success){ + //将篮筐与器械包加载到灭菌列表中 + loadContainerAndTousseToGrid(result.datas); + for(var i = 0;i < waitSterilingBarcodeArray.length;i++){ + //移除今天审核待灭菌物品的数据 + removePendingSterilizationGoods(waitSterilingBarcodeArray[i]); + } + top.Ext.getCmp("btnBatchAddTousse").disable(); + }else{ + showResult(result.message); + } + formObj.getEl().unmask(); + }, + failure : function(response, options) { + showResult("后台运行异常,请稍候再试..."); + formObj.getEl().unmask(); + } + }); }}], columns : pendingSterilizationColumnTreeColumnArray, - loader : new top.Ext.tree.TreeLoader({ - url : WWWROOT + '/disinfectSystem/tousseInstanceAction!getTodayPendingSterilizationTousseAndBasket.do?'+urlParam, - uiProviders:{ + loader : new top.Ext.tree.TreeLoader({//加载今天审核的待灭菌物品 + url : WWWROOT + '/disinfectSystem/tousseInstanceAction!getTodayPendingSterilizationTousseAndBasket.do?'+urlParam, + uiProviders:{ 'col': top.Ext.tree.ColumnNodeUI }, listeners:{ - beforeload : function(treeLoader, node){ - treeLoader.baseParams.sterilizerNameTemp = top.Ext.getCmp("sterilizerName").getValue(); - treeLoader.baseParams.ownGroupTemp = ownGroup; + beforeload : function(treeLoader, node){ + treeLoader.baseParams.sterilizerNameTemp = top.Ext.getCmp("sterilizerName").getValue(); + treeLoader.baseParams.ownGroupTemp = ownGroup; }, - load:function(treeLoader, node, response){ - //判断表格中的物品数量是否大于0 - if(pendingSterilizationColumnTree.getRootNode().childNodes.length == 0){ - top.Ext.getCmp("btnBatchAddTousse").disable(); - }else{ - top.Ext.getCmp("btnBatchAddTousse").enable(); - } - //提示超时的灭菌物品 - Ext.Ajax.request({ - url : WWWROOT + '/system/timeoutAction!getTimeoutSetting.do', - params : {procedure : 'reviewToSterile'}, - success : function(response, options) { - var result = Ext.decode(response.responseText); - if(result.success && result.showMessageBox){ - var timeoutCount = 0; - for(var i = 0; i < node.childNodes.length;++i){ - var cNode = node.childNodes[i]; - if(cNode.attributes.isTimeout){ - timeoutCount++; - } - } - if(timeoutCount > 0){ - showResult('有'+timeoutCount+'个超时未灭菌的物品,请及时处理红色标注的物品'); - } - } - } - }); - } + load:function(treeLoader, node, response){ + //判断表格中的物品数量是否大于0 + if(pendingSterilizationColumnTree.getRootNode().childNodes.length == 0){ + top.Ext.getCmp("btnBatchAddTousse").disable(); + }else{ + top.Ext.getCmp("btnBatchAddTousse").enable(); + } + //提示超时的灭菌物品 + Ext.Ajax.request({ + url : WWWROOT + '/system/timeoutAction!getTimeoutSetting.do', + params : {procedure : 'reviewToSterile'}, + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.success && result.showMessageBox){ + var timeoutCount = 0; + for(var i = 0; i < node.childNodes.length;++i){ + var cNode = node.childNodes[i]; + if(cNode.attributes.isTimeout){ + timeoutCount++; + } + } + if(timeoutCount > 0){ + showResult('有'+timeoutCount+'个超时未灭菌的物品,请及时处理红色标注的物品'); + } + } + } + }); + } } }), root: new top.Ext.tree.AsyncTreeNode({ text:'待灭菌物品列表' }) }); - this.id = id; - tousseItemCountJsonStore.removeAll(); - - formObj = new top.Ext.FormPanel({ - id : 'sterilizerForm', - frame : true, - labelSeparator : ':', - bodyStyle : 'padding:5px 5px 0px 5px', - height : 570, - autoWidth:true, - autoScroll : true, - labelAlign:'right', - viewConfig: { + this.id = id; + tousseItemCountJsonStore.removeAll(); + + formObj = new top.Ext.FormPanel({ + id : 'sterilizerForm', + frame : true, + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + height : 570, + autoWidth:true, + autoScroll : true, + labelAlign:'right', + viewConfig: { forceFit:true - }, - items : [{ - layout : 'column', - items : [{ - columnWidth : (top.screen.width > 1030 ? 0.6 : 0.67), - layout : 'column', - items : [{ - xtype : "fieldset", - title : "灭菌参数", - layout : 'column', - autoHeight : true, - columnWidth : 1, - items : [{ - xtype : 'hidden', - name : 'id', - id : 'id' - },{ - xtype : 'hidden', - name : 'reSterilization', - id : 'reSterilization' - },{ - xtype : 'hidden', - name : 'recordId', - id : 'recordId' - },{ - xtype : 'hidden', - name : 'barcodePositionInfo', - id : 'barcodePositionInfo' - },{ - xtype : 'hidden', - name : 'sterilizationGoods', - id : 'sterilizationGoods' - },{ - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'textfield', - fieldLabel : "灭菌员", - labelWidth: 60, - name : "sterilizationUser", - id : "sterilizationUser", - readOnly : true, - allowBlank : false, - anchor : '100%', - cls:'x-item-disabled' - }] - }, { - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [ { - xtype : 'textfield', - fieldLabel : "灭菌架名称", - labelWidth: 85, - listWidth:120, - name : "sterilizationShelf", - id : "sterilizationShelf", - readOnly : true, - allowBlank : true, - anchor : '100%', - cls:'x-item-disabled' - } ] - } , { - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'combo', - fieldLabel : "灭菌炉名称", - labelWidth: 85, - valueField : 'sterilizerName', - displayField : 'sterilizerName', - store : new Ext.data.SimpleStore({ - fields : [ 'sterilizerName' ], - url : WWWROOT + '/disinfectSystem/baseData/sterilizerAction!getAllSterilizer.do?ownGroup=' + encodeURI(ownGroup) - }), - triggerAction : 'all', - mode : 'remote', - listWidth:180, - forceSelection : true, - name : "sterilizerName", - id : "sterilizerName", - allowBlank : false, - editable : false, - readOnly:true, - anchor : '100%', - listeners : { - select : function(combo, record, index) { - DWREngine.setAsync(false); - var recordId = id; - if(reSterilization){ - recordId = "0"; - } - SterilizationRecordTableManager.getMaxFrequency(combo.value,recordId,function(result){ - top.Ext.getCmp('frequency').setValue(result); - }); - SterilizationRecordTableManager.getNextCycleCounter(combo.value,recordId,function(result){ - if(result == 0) - { - top.Ext.getCmp('cycleCounter').setValue(1); - }else - { - top.Ext.getCmp('cycleCounter').setValue(result); - } - }); - //判断是否无条件显示循环次数 - if(sstsConfig.showCycleCountWithoutCondition){ - top.Ext.getCmp('cycleCounterId').show(); - }else{ - // 判断灭菌炉是否关联接口,是否显示循环次数 - SterilizationRecordTableManager.isDefineDeviceInterface(combo.value,function(result) - { - if(result) - { - top.Ext.getCmp('cycleCounterId').show(); - }else - { - top.Ext.getCmp('cycleCounterId').hide(); - } - }); - } - DWREngine.setAsync(true); - sterilizationTypeStore.reload(); - if (sstsConfig.sterilizationCheckTousseSterilingType - && sterilizerNameTemp != combo.value) { //切换灭菌炉时,重新加载待灭菌物品(主要过滤掉,待灭菌物品的默认灭菌程序不在此灭菌炉所有的灭菌程序之内的) - sterilizerNameTemp = combo.value; - pendingSterilizationColumnTree.loader.load(pendingSterilizationColumnTree.root,function(){}); - } - top.Ext.getCmp('sterilizationPurpose').setValue(''); - } - } - }] - }, { - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - hidden : !((sstsConfig.hasOwnProperty('haveSterilizerPosition')) && sstsConfig.haveSterilizerPosition), - items : [{ - xtype : 'textfield', - fieldLabel : "位置", - name : "position", - id : "position", - readOnly : true, - anchor : '100%', - cls:'fieldReadOnlyNoRemove' - }] - },{ - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - hidden : !((sstsConfig.hasOwnProperty('sterilizationRecordFinishConfirm')) && sstsConfig.sterilizationRecordFinishConfirm), - items : [{ - xtype : 'textfield', - fieldLabel : confirmLabel, - name : "srSituationComfirmer", - id : "srSituationComfirmer", - allowBlank : true, - readOnly : true, - anchor : '100%', - cls:'x-item-disabled' - }] - },{ - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'textfield', - fieldLabel : "当天炉次", - name : "frequency", - id : "frequency", - allowBlank : false, - readOnly : true, - anchor : '100%', - cls:'x-item-disabled' - }] - - },{ - id : "cycleCounterId", - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'textfield', - fieldLabel : "循环次数", - name : "cycleCounter", - id : "cycleCounter", - allowBlank : true, - anchor : '100%', - cls:'edit-5char-labelwidth' - }] - },{ - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'combo', - fieldLabel : "灭菌程序", - valueField : 'sterilizationType', - displayField : 'sterilizationType', - store : sterilizationTypeStore, - triggerAction : 'all', - mode : 'remote', - editable : false, - listWidth:150, - forceSelection : true, - name : "sterilizationType", - id : "sterilizationType", - allowBlank : false, - readOnly:true, - anchor : '100%', - listeners : { - select : function(combo, record, index) { - //加载灭菌参数 - SterilizationRecordTableManager.getParameter(combo.getRawValue(),function(result){ - if(result != null && result.length > 0){ - top.Ext.getCmp('parameter').setValue(result); - } - }); - //选择默认灭菌目的 - SterilizationRecordTableManager.getSterilizationPurpose(combo.getRawValue(),function(result){ - if(result != null && result.length > 0){ - top.Ext.getCmp('sterilizationPurpose').setValue(result); - } - }); - } - } - }] - }, { - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'combo', - fieldLabel : "灭菌目的", - valueField : 'optionText', - displayField : 'optionText', - store : sterilizationPurposeJsonStore, - triggerAction : 'all', - mode : 'remote', - listWidth:120, - editable : false, - forceSelection : true, - name : "sterilizationPurpose", - id : "sterilizationPurpose", - allowBlank : false, - anchor : '100%' - }] - },{ - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - hidden : hiddenEndBarcode, - items : [ - { - xtype:'combo', - id : 'scanMode', - name : 'scanMode', - fieldLabel : '扫描模式', - valueField : 'scanModeCode', - displayField : 'scanModeName', - triggerAction : 'all', - listWidth:120, - allowBlank : true, - editable : false, - value:currentScanMode, - store : new Ext.data.SimpleStore({ - fields : ['scanModeCode', 'scanModeName' ], - data : [['single','单个条码'],['area','首尾条码']] - }), - mode:'local', - forceSelection : true, - triggerAction : 'all', - listeners : { - select : function(combo, record, index){ - //alert(record.get("scanModeCode")); - currentScanMode = record.get("scanModeCode"); - } - }, - anchor : '100%' - } - ] - },{ - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'textfield', - fieldLabel : beginBarcodeLabel, - allowBlank : true, - name : "inputBarcode", - id : "inputBarcode", - anchor : '100%', - listeners : { - render : function(p) { - p.getEl().on('keypress',function(e) {//可输入或扫描的类型有灭菌架、灭菌筐、灭菌炉、灭菌程序、器械包;20151102新增加虚拟篮筐 - if (e.getKey() == 13) {//回车键 - var barcode = top.Ext.getCmp('inputBarcode').getValue(); - var recordID = id; - if(barcode != null && barcode.length >0){ - sterilizationColumnTree.getEl().mask("数据重新加载中,请稍等!"); - Ext.Ajax.request( { - url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!getBarcodeType.do', - params : { - barcode : barcode - }, - success : function(response, options) { - sterilizationColumnTree.getEl().unmask(); - var result = response.responseText; - if(result != null && result.length > 0){ - if(SHELF == result){ //灭菌架 - loadSterilizationShelf(barcode); - top.Ext.getCmp('inputBarcode').setValue(""); - }else if(USER == result){ //用户 - if(scanUser == true){ - loadSterilizationUser(barcode); - }else{ - showResult("请输入正确的条码!"); - } - top.Ext.getCmp('inputBarcode').setValue(""); - }else if(BASKET == result){ //灭菌篮筐 - loadTousseInstanceCheckPosition(barcode,recordID); - if(hiddenEndBarcode || currentScanMode == 'single'){ - top.Ext.getCmp('inputBarcode').setValue("");//如果使用虚拟篮筐机制,扫描成功后需要清除该文本内容 - }else{ - top.Ext.getCmp('inputBarcodeEnd').focus();//否则不清除,条码/篮筐(尾)获得焦点 - } - }else if (STERILIZER == result){ //灭菌炉 - getSterilization(barcode,recordID); - top.Ext.getCmp('inputBarcode').setValue(""); - }else if(STERILISATION == result){ //灭菌程序 - var sterilizerName = top.Ext.getCmp('sterilizerName').getRawValue(); - if(sterilizerName.length <= 0){ - showResult("请选择灭菌炉!"); - return; - } - loadSterilizationType(barcode,sterilizerName); - top.Ext.getCmp('inputBarcode').setValue(""); - }else if(TOUSSEINSTANCE == result){ //器械包实例2 - loadTousseInstanceCheckPosition(barcode,recordID); - if(hiddenEndBarcode || currentScanMode == 'single'){ - top.Ext.getCmp('inputBarcode').setValue("");//如果使用虚拟篮筐机制,扫描成功后需要清除该文本内容 - }else{ - top.Ext.getCmp('inputBarcodeEnd').focus();//否则不清除,条码/篮筐(尾)获得焦点 - } - }else if(POSITION == result){ //位置 - loadPositionByBarcode(barcode); - top.Ext.getCmp('inputBarcode').setValue(""); - }else if("virtualBasket" == result){ //虚拟篮筐3 - loadTousseInstanceCheckPosition(barcode,recordID); - if(hiddenEndBarcode || currentScanMode == 'single'){ - top.Ext.getCmp('inputBarcode').setValue("");//如果使用虚拟篮筐机制,扫描成功后需要清除该文本内容 - }else{ - top.Ext.getCmp('inputBarcodeEnd').focus();//否则不清除,条码/篮筐(尾)获得焦点 - } - }else if("notFixedBarcode" == result){ - showResult("该器械包为可追溯的包,不能扫描固定条码!"); - top.Ext.getCmp('inputBarcode').setValue(""); - }else if("errorBasket" == result){ - showResult("请输入正确的篮筐条码!"); - top.Ext.getCmp('inputBarcode').setValue(""); - }else if("barcodeInvalid" == result){ - showResult("请输入正确的条码!"); - top.Ext.getCmp('inputBarcode').setValue(""); - }else{ - showResult(result); - top.Ext.getCmp('inputBarcode').setValue(""); - } - }else{ - showResult("请输入正确的条码!"); - top.Ext.getCmp('inputBarcode').setValue(""); - } - }, - failure : function(response, options) { - sterilizationColumnTree.getEl().unmask(); - var result = Ext.decode(response.responseText); - showResult(result); - } - }); - } - //top.Ext.getCmp('inputBarcode').setValue(""); - } - }); - p.getEl().on('focus',function(e) { - top.Ext.getCmp('inputBarcode').setValue(""); - }); - } - } - }] - },{ - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - hidden : hiddenEndBarcode, - items : [{ - xtype : 'textfield', - fieldLabel : "条码/篮筐(尾)", - allowBlank : true, - name : "inputBarcodeEnd", - id : "inputBarcodeEnd", - width : 50, - anchor : '100%', - listeners : { - render : function(p) { - p.getEl().on('keypress',function(e) {//仅可扫描或输入器械包实例条码或虚拟篮筐,且条码/篮筐(首)不能为空,以及与条码/篮筐(首)类型一致 - if (e.getKey() == 13) {//回车键 - var barcode = top.Ext.getCmp('inputBarcode').getValue(); - var barcodeEnd = top.Ext.getCmp('inputBarcodeEnd').getValue(); - var recordID = id; - if(barcodeEnd != null && barcodeEnd.length >0){ - if(barcode == ''){ - showResult("请先输入条码/篮筐(首)!"); - top.Ext.getCmp('inputBarcode').focus(); - return; - } - sterilizationColumnTree.getEl().mask("数据重新加载中,请稍等!"); - Ext.Ajax.request( { - url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!getBarcodeType.do', - params : { - barcode : barcode + ";" + barcodeEnd - }, - success : function(response, options) { - sterilizationColumnTree.getEl().unmask(); - var result = response.responseText; - if(result != null && result.length > 0){ - if("virtualBasket" == result){ - loadTousseInstanceCheckPosition(barcode + ";" + barcodeEnd,recordID); - }else if(TOUSSEINSTANCE == result){ - loadTousseInstanceCheckPosition(barcode + ";" + barcodeEnd,recordID); - }else if("notTheSame" == result){ - showResult("首尾条码/篮筐类型不一致,必须均为器械包条码或虚拟篮筐编号!"); - }else if("barcodeEndInvalid" == result){ - showResult("请输入正确的条码!"); - top.Ext.getCmp('inputBarcodeEnd').setValue(""); - }else{ - showResult("请输入正确的条码!"); - top.Ext.getCmp('inputBarcodeEnd').setValue(""); - } - }else{ - showResult("请输入正确的条码!"); - top.Ext.getCmp('inputBarcodeEnd').setValue(""); - } - }, - failure : function(response, options) { - sterilizationColumnTree.getEl().unmask(); - top.Ext.getCmp('inputBarcodeEnd').setValue(""); - var result = Ext.decode(response.responseText); - showResult(result); - } - }); - } - /*top.Ext.getCmp('inputBarcode').setValue(""); - top.Ext.getCmp('inputBarcodeEnd').setValue("");*/ - } - }); - p.getEl().on('focus',function(e) { - top.Ext.getCmp('inputBarcodeEnd').setValue(""); - }); - } - } - }] - }, { - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '开始时间', - width : 50, - id : 'startDate', - name : 'startDate', - editable : false, - altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', - selectOnFocus :true, - format : 'Y-m-d H:i', - allowBlank : false, - anchor : '100%' - }] - }, { - columnWidth : .33, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '结束时间', - width : 50, - id : 'endDate', - name : 'endDate', - editable : false, - format : 'Y-m-d H:i', - allowBlank : true, - hidden : id == 0?true:false, - hideLabel : id == 0?true:false, - anchor : '100%' - }] - },{ - columnWidth : 1, - layout : 'form', - items : [{ - xtype : 'textarea', - fieldLabel : "灭菌程序参数", - name : "parameter", - id : "parameter", - readOnly:true, - anchor : '98.5%' - }] - },{ - columnWidth : 1, - layout : 'form', - items : [{ - xtype : 'textfield', - fieldLabel : "备注", - name : "remark", - id : "remark", - readOnly:false, - anchor : '99%' - }] - },{ - layout : 'column', - columnWidth : 1, - labelWidth : 90, - items : [ - { - layout : 'form', - columnWidth : 0.85, - labelWidth : 100, - items : [ - { - xtype : 'textfield', - name : 'uploadImage', - id : 'uploadImage', - fieldLabel : "生物监测图片", - anchor : '100%' - } - ] - }, - { - layout : 'form', - columnWidth : 0.08, - labelWidth : 90, - hidden : statusEnd != currentStatus, - items : [ - { xtype:'button', - text : '上传', - handler : function(){ - if(id == null || id == ''){ - showResult("请先保存后再上传图片!"); - }else{ - uploadWindow(imageType_sterilization); - } - } - } - ] - }, - { - layout : 'form', - columnWidth : 0.12, - labelWidth : 90, - items : [ - { xtype:'button', - text : '预览', - disabled:disableShowImageButton, - iconCls : 'btn_ext_application_search', - handler : function(){ - top.showSterilizationRecordPic(id,"/disinfectSystem/sterilization/bioLogicalMonitorPictureAction",'生物监测图片'); -// sterilizationRecordWin.hide(); - } - } - ] - } - ] - }] - },{ - columnWidth : .46, - id : 'sterilizationColumnTree', - items : [sterilizationColumnTree] - }, { - columnWidth : .54, - items : [ new top.Ext.grid.GridPanel({ - id : 'tousseItemCountPanel', - height : 325, -// width : 385, - frame : false, - border : true, - tbar:[{ - xtype : 'button', - text : '灭菌物品统计' - },"->",{ - xtype : 'button', - id : 'totalAmount'/*, - text : '灭菌物品总数量:'*/ - }], - bbar:[{ - xtype : 'button', - id : "typeTotalAmount" - }], - viewConfig: { - forceFit:true - }, - store : tousseItemCountJsonStore, - cm: new Ext.grid.ColumnModel([ - {header: "器械包名称统计", width: 150, menuDisabled:true,dataIndex:'tousseName'}, - {id: 'count', header: "数量", width: 40, menuDisabled: true,dataIndex:'count'} - ]), - stripeRows : true, - autoExpandColumn : 'count', - bodyStyle : 'border:1px solid #afd7af' - })] - },{ - xtype : "fieldset", - title : "监测结果", - layout : 'column', - height :'80', - columnWidth : 1, - cls:'edit-5char-labelwidth', - id : "monitorResultSet", - items : [{ - columnWidth : 0.5, - layout : 'form', - labelWidth : 120, - items : [{ - xtype : 'combo', - fieldLabel : "物理监测结果", - readOnly : true, - valueField : 'value', - displayField : 'value', - store : monitorResutlStore, - triggerAction : 'all', - mode : 'local', - name : "physicsResult", - id : "physicsResult", - allowBlank : false, - anchor : '100%' - }] - },{ - columnWidth : 0.5, - layout : 'form', - labelWidth : 120, - items : [{ - xtype : 'combo', - fieldLabel : "化学监测结果", - readOnly : true, - valueField : 'value', - displayField : 'value', - store : monitorResutlStore, - triggerAction : 'all', - mode : 'local', - name : "chemistryResult", - id : "chemistryResult", - allowBlank : false, - anchor : '100%' - }] - }, { - columnWidth : (sstsConfig.enableBiologicalObserveDate ? .5 : 1), - layout : 'form', - labelWidth : 120, - items : [{ - xtype : 'combo', - fieldLabel : "生物监测结果", - readOnly : true, - valueField : 'value', - displayField : 'value', - store : monitorResutlStore, - triggerAction : 'all', - mode : 'local', - name : "biologyResult", - id : "biologyResult", - allowBlank : false, - anchor : (sstsConfig.enableBiologicalObserveDate ? '100%' : '50%') - }] - }, { - columnWidth : .5, - layout : 'form', - cls:'edit-5char-labelwidth', - hidden: !sstsConfig.enableBiologicalObserveDate, - labelWidth : 120, - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '生物监测观察时间', - id : 'biologicalObserveDate', - name : 'biologicalObserveDate', - editable : false, - altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', - selectOnFocus :true, -// readOnly : true, - format : 'Y-m-d H:i', - anchor : '100%' - }] - }, { - columnWidth : .5, - layout : 'form', - cls:'edit-5char-labelwidth', - labelWidth : 120, - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '生物监测开始时间', - id : 'biologicalMonitoringStartDate', - name : 'biologicalMonitoringStartDate', - editable : false, -// readOnly : true, - altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', - selectOnFocus :true, - format : 'Y-m-d H:i', - anchor : '100%', - listeners : { - select : function() { //联动把生物监测的结束时间填上 - var temp = top.Ext.getCmp('biologicalMonitoringStartDate').getValue().getTime() + _biologicalMonitoringTime; - top.Ext.getCmp('biologicalMonitoringEndDate').setValue(new Date(temp)); - } - } - }] - }, { - columnWidth : .5, - layout : 'form', - cls:'edit-5char-labelwidth', - labelWidth : 120, - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '生物监测结束时间', - id : 'biologicalMonitoringEndDate', - name : 'biologicalMonitoringEndDate', - editable : false, - altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', - selectOnFocus :true, -// readOnly : true, - format : 'Y-m-d H:i', - anchor : '100%' - }] - }, { - columnWidth : .5, - layout : 'form', - labelWidth : 120, - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'textfield', - fieldLabel : "监测员条码", - name : "monitorUserBarcode", - id : "monitorUserBarcode", - anchor : '100%', - listeners : { - specialkey : function(thiz, e){ - if(e.getKey() == 13){ - var peopleOfBarcode = thiz.getValue(); - if(peopleOfBarcode){ - UserTableManager.getUserByBarcode(peopleOfBarcode, function(responseText){ - top.Ext.getCmp('monitorUserBarcode').setValue(); - if(responseText != null && responseText != ""){ - var result = Ext.decode(responseText); - if(!result.success){ - result.isNotSameOrgUnit?showResult("不允许登记非本科室人员,请扫描本科室人员条码"):showResult("输入的条码有误!"); - return; - } - top.Ext.getCmp('monitorUser').setValue(result.fullName); - top.Ext.getCmp('monitorCheckerBarcode').focus(); - }else{ - showResult('找不到该条码所对应的人员信息'); - } - }); - } - } - } - } - }] - }, { - columnWidth : .5, - labelWidth : 120, - layout : 'form', - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'textfield', - fieldLabel : "监测员", - name : "monitorUser", - id : "monitorUser", - readOnly : true, - anchor : '100%', - cls:'x-item-disabled' - }] - }, { - columnWidth : .5, - layout : 'form', - labelWidth : 120, - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'textfield', - fieldLabel : "监测核对员条码", - name : "monitorCheckerBarcode", - id : "monitorCheckerBarcode", - anchor : '100%', - listeners : { - specialkey : function(thiz, e){ - if(e.getKey() == 13){ - var peopleOfBarcode = thiz.getValue(); - if(peopleOfBarcode){ - UserTableManager.getUserByBarcode(peopleOfBarcode, function(responseText){ - top.Ext.getCmp('monitorCheckerBarcode').setValue(); - if(responseText != null && responseText != ""){ - var result = Ext.decode(responseText); - if(!result.success){ - result.isNotSameOrgUnit?showResult("不允许登记非本科室人员,请扫描本科室人员条码"):showResult("输入的条码有误!"); - return; - } - top.Ext.getCmp('monitorChecker').setValue(result.fullName); - top.Ext.getCmp('monitorAuditorBarcode').focus(); - }else{ - showResult('找不到该条码所对应的人员信息'); - } - }); - } - } - } - } - }] - }, { - columnWidth : .5, - layout : 'form', - labelWidth : 120, - cls:'edit-5char-labelwidth', - items : [{ - xtype : 'textfield', - fieldLabel : "监测核对员", - name : "monitorChecker", - id : "monitorChecker", - readOnly : true, - anchor : '100%', - cls:'x-item-disabled' - }] - }, { - columnWidth : .5, - layout : 'form', - labelWidth : 120, - cls:'edit-5char-labelwidth', - hidden : !sstsConfig.needMonitorAuditor, - items : [{ - xtype : 'textfield', - fieldLabel : "监测审核员条码", - name : "monitorAuditorBarcode", - id : "monitorAuditorBarcode", - anchor : '100%', - listeners : { - specialkey : function(thiz, e){ - if(e.getKey() == 13){ - var peopleOfBarcode = thiz.getValue(); - if(peopleOfBarcode){ - UserTableManager.getUserByBarcode(peopleOfBarcode, function(responseText){ - top.Ext.getCmp('monitorAuditorBarcode').setValue(); - if(responseText != null && responseText != ""){ - var result = Ext.decode(responseText); - if(!result.success){ - result.isNotSameOrgUnit?showResult("不允许登记非本科室人员,请扫描本科室人员条码"):showResult("输入的条码有误!"); - return; - } - top.Ext.getCmp('monitorAuditor').setValue(result.fullName); - }else{ - showResult('找不到该条码所对应的人员信息'); - } - }); - } - } - } - } - }] - }, { - columnWidth : .5, - layout : 'form', - labelWidth : 120, - cls:'edit-5char-labelwidth', - hidden : !sstsConfig.needMonitorAuditor, - items : [{ - xtype : 'textfield', - fieldLabel : "监测审核员", - name : "monitorAuditor", - id : "monitorAuditor", - readOnly : true, - anchor : '100%', - cls:'x-item-disabled' - }] - }] - },{ - xtype : "fieldset", - title : "中断记录列表", - layout : 'fit', - height :200, - columnWidth : 1, - cls:'edit-5char-labelwidth', - id : "interruptList", - items :[ - new top.Ext.grid.GridPanel({ - id : 'interruptRecordItemGrid', - store : new top.Ext.data.Store({ - reader : new top.Ext.data.JsonReader({ - fields : [ - {name : 'id'}, - {name : 'interruptUser'}, - {name : 'interruptDate'}, - {name : 'interruptFinishDate'}, - {name : 'interruptOptType'}, - {name : 'quatifyMonitoryId'} - ] - }) - }), - bodyStyle : 'border:1px solid #afd7af', - cm : new top.Ext.grid.ColumnModel([ - {header : "操作人",dataIndex : 'interruptUser',width : 100,sortable : true}, - {header : "中断时间",width : 150,dataIndex : 'interruptDate'}, - {header : "中断完成时间",width : 150,dataIndex : 'interruptFinishDate'}, - {header : "中断完成类型",width : 100,dataIndex : 'interruptOptType'}, - {header : "质量监测记录",dataIndex : 'quatifyMonitoryId',width : 100, - renderer : function(v, p, record){ - var str = ""; - return str; - }} - ]), -// width : 650, -// height : 100, - border : true, - frame : false - })] - }] - },{ - columnWidth : (top.screen.width > 1030 ? 0.4 :0.33), - bodyStyle : 'margin-left:2px;margin-right:0px', - layout : 'fit', - items : [{ - layout : 'form', - items : [{ - xtype : "fieldset", - title : "今天审核的待灭菌物品", - autoWidth : true,//405, - height : 548, - items : [pendingSterilizationColumnTree] - }] - }] - }] - }], - buttons : [{ - id : 'continueBtn', - text : '继续灭菌', - handler : function (){ - sterilizationContinue(); - }, - hidden : true - },{ - id : 'successBtn', - text : '灭菌完成', - handler : function() { - sterilizationComplete(grid,statusEnd); - }, - hidden : true - },{ - id : 'failureBtn', - text : '灭菌失败', - handler : function() { - sterilizationFailure(grid,statusFailure); - sterilizerStatus = statusFailure; - }, - hidden : true - },{ - id : 'saveBtn', - text : '保存', - handler : save - },{ - id : 'monitorBtn', - text : '保存', - hidden :true, - handler : saveMonitor - },{ - text : '取消', - id : 'saveAndNewBtn', - handler : cancel - }] - }); - - function uploadWindow(imageType){ - var onUploadComplete = function(dialog){ - dialog.hide(); - }; - //文件上传成功后的回调函数 - var onUploadSuccess = function(dialog, filename, resp_data, record){ - showResult("上传图片成功"); - dialog.hide(); - }; -// //文件上传失败后的回调函数 - var onUploadFailed = function(dialog, filename, resp_data, record){ - showResult(resp_data.message);//resp_data是json格式的数据 - }; - var dialog = new top.Ext.ux.UploadDialog.Dialog({ - title: "上传" + imageType, - url:WWWROOT + '/disinfectSystem/baseData/uploadImageFileAction!uploadImage.do?imageType='+imageType+'&objectId='+id , //这里我用struts2做后台处理 - post_var_name:'uploadFiles',//这里是自己定义的,默认的名字叫file - width : 450, - height : 300, - minWidth : 450, - minHeight : 300, - draggable : true , - resizable : true , - constraintoviewport: true , - permitted_extensions:['JPG','jpg','jpeg','JPEG','GIF','gif','png','PNG'], - modal: true , - reset_on_hide: false , - allow_close_on_upload: false , //关闭上传窗口是否仍然上传文件 - upload_autostart: false - }); - dialog.show(); - dialog.on('uploadsuccess',onUploadSuccess); //定义上传成功回调函数 - dialog.on('uploadfailed',onUploadFailed); //定义上传失败回调函数 - } - - sterilizationRecordWin = new top.Ext.Window( { - id : 'sterilizationRecordWin', - layout : 'fit', - title : '灭菌记录信息', - border : false, - modal : true, - width : top.screen.width > 1030 ? 1260 : 1020, + }, + items : [{ + layout : 'column', + items : [{ + columnWidth : (top.screen.width > 1030 ? 0.6 : 0.67), + layout : 'column', + items : [{ + xtype : "fieldset", + title : "灭菌参数", + layout : 'column', + autoHeight : true, + columnWidth : 1, + items : [{ + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + xtype : 'hidden', + name : 'reSterilization', + id : 'reSterilization' + },{ + xtype : 'hidden', + name : 'recordId', + id : 'recordId' + },{ + xtype : 'hidden', + name : 'barcodePositionInfo', + id : 'barcodePositionInfo' + },{ + xtype : 'hidden', + name : 'sterilizationGoods', + id : 'sterilizationGoods' + },{ + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'textfield', + fieldLabel : "灭菌员", + labelWidth: 60, + name : "sterilizationUser", + id : "sterilizationUser", + readOnly : true, + allowBlank : false, + anchor : '100%', + cls:'x-item-disabled' + }] + }, { + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [ { + xtype : 'textfield', + fieldLabel : "灭菌架名称", + labelWidth: 85, + listWidth:120, + name : "sterilizationShelf", + id : "sterilizationShelf", + readOnly : true, + allowBlank : true, + anchor : '100%', + cls:'x-item-disabled' + } ] + } , { + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'combo', + fieldLabel : "灭菌炉名称", + labelWidth: 85, + valueField : 'sterilizerName', + displayField : 'sterilizerName', + store : new Ext.data.SimpleStore({ + fields : [ 'sterilizerName' ], + url : WWWROOT + '/disinfectSystem/baseData/sterilizerAction!getAllSterilizer.do?ownGroup=' + encodeURI(ownGroup) + }), + triggerAction : 'all', + mode : 'remote', + listWidth:180, + forceSelection : true, + name : "sterilizerName", + id : "sterilizerName", + allowBlank : false, + editable : false, + readOnly:true, + anchor : '100%', + listeners : { + select : function(combo, record, index) { + DWREngine.setAsync(false); + var recordId = id; + if(reSterilization){ + recordId = "0"; + } + SterilizationRecordTableManager.getMaxFrequency(combo.value,recordId,function(result){ + top.Ext.getCmp('frequency').setValue(result); + }); + SterilizationRecordTableManager.getNextCycleCounter(combo.value,recordId,function(result){ + if(result == 0) + { + top.Ext.getCmp('cycleCounter').setValue(1); + }else + { + top.Ext.getCmp('cycleCounter').setValue(result); + } + }); + //判断是否无条件显示循环次数 + if(sstsConfig.showCycleCountWithoutCondition){ + top.Ext.getCmp('cycleCounterId').show(); + }else{ + // 判断灭菌炉是否关联接口,是否显示循环次数 + SterilizationRecordTableManager.isDefineDeviceInterface(combo.value,function(result) + { + if(result) + { + top.Ext.getCmp('cycleCounterId').show(); + }else + { + top.Ext.getCmp('cycleCounterId').hide(); + } + }); + } + DWREngine.setAsync(true); + sterilizationTypeStore.reload(); + if (sstsConfig.sterilizationCheckTousseSterilingType + && sterilizerNameTemp != combo.value) { //切换灭菌炉时,重新加载待灭菌物品(主要过滤掉,待灭菌物品的默认灭菌程序不在此灭菌炉所有的灭菌程序之内的) + sterilizerNameTemp = combo.value; + pendingSterilizationColumnTree.loader.load(pendingSterilizationColumnTree.root,function(){}); + } + top.Ext.getCmp('sterilizationPurpose').setValue(''); + } + } + }] + }, { + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + hidden : !((sstsConfig.hasOwnProperty('haveSterilizerPosition')) && sstsConfig.haveSterilizerPosition), + items : [{ + xtype : 'textfield', + fieldLabel : "位置", + name : "position", + id : "position", + readOnly : true, + anchor : '100%', + cls:'fieldReadOnlyNoRemove' + }] + },{ + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + hidden : !((sstsConfig.hasOwnProperty('sterilizationRecordFinishConfirm')) && sstsConfig.sterilizationRecordFinishConfirm), + items : [{ + xtype : 'textfield', + fieldLabel : confirmLabel, + name : "srSituationComfirmer", + id : "srSituationComfirmer", + allowBlank : true, + readOnly : true, + anchor : '100%', + cls:'x-item-disabled' + }] + },{ + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'textfield', + fieldLabel : "当天炉次", + name : "frequency", + id : "frequency", + allowBlank : false, + readOnly : true, + anchor : '100%', + cls:'x-item-disabled' + }] + + },{ + id : "cycleCounterId", + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'textfield', + fieldLabel : "循环次数", + name : "cycleCounter", + id : "cycleCounter", + allowBlank : true, + anchor : '100%', + cls:'edit-5char-labelwidth' + }] + },{ + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'combo', + fieldLabel : "灭菌程序", + valueField : 'sterilizationType', + displayField : 'sterilizationType', + store : sterilizationTypeStore, + triggerAction : 'all', + mode : 'remote', + editable : false, + listWidth:150, + forceSelection : true, + name : "sterilizationType", + id : "sterilizationType", + allowBlank : false, + readOnly:true, + anchor : '100%', + listeners : { + select : function(combo, record, index) { + //加载灭菌参数 + SterilizationRecordTableManager.getParameter(combo.getRawValue(),function(result){ + if(result != null && result.length > 0){ + top.Ext.getCmp('parameter').setValue(result); + } + }); + //选择默认灭菌目的 + SterilizationRecordTableManager.getSterilizationPurpose(combo.getRawValue(),function(result){ + if(result != null && result.length > 0){ + top.Ext.getCmp('sterilizationPurpose').setValue(result); + } + }); + } + } + }] + }, { + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'combo', + fieldLabel : "灭菌目的", + valueField : 'optionText', + displayField : 'optionText', + store : sterilizationPurposeJsonStore, + triggerAction : 'all', + mode : 'remote', + listWidth:120, + editable : false, + forceSelection : true, + name : "sterilizationPurpose", + id : "sterilizationPurpose", + allowBlank : false, + anchor : '100%' + }] + },{ + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + hidden : hiddenEndBarcode, + items : [ + { + xtype:'combo', + id : 'scanMode', + name : 'scanMode', + fieldLabel : '扫描模式', + valueField : 'scanModeCode', + displayField : 'scanModeName', + triggerAction : 'all', + listWidth:120, + allowBlank : true, + editable : false, + value:currentScanMode, + store : new Ext.data.SimpleStore({ + fields : ['scanModeCode', 'scanModeName' ], + data : [['single','单个条码'],['area','首尾条码']] + }), + mode:'local', + forceSelection : true, + triggerAction : 'all', + listeners : { + select : function(combo, record, index){ + currentScanMode = record.get("scanModeCode"); + } + }, + anchor : '100%' + } + ] + },{ + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'textfield', + fieldLabel : beginBarcodeLabel, + allowBlank : true, + name : "inputBarcode", + id : "inputBarcode", + anchor : '100%', + listeners : { + render : function(p) { + p.getEl().on('keypress',function(e) {//可输入或扫描的类型有灭菌架、灭菌筐、灭菌炉、灭菌程序、器械包;20151102新增加虚拟篮筐 + if (e.getKey() == 13) {//回车键 + var barcode = top.Ext.getCmp('inputBarcode').getValue(); + var recordID = id; + if(barcode != null && barcode.length >0){ + sterilizationColumnTree.getEl().mask("数据重新加载中,请稍等!"); + Ext.Ajax.request( { + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!getBarcodeType.do', + params : { + barcode : barcode + }, + success : function(response, options) { + sterilizationColumnTree.getEl().unmask(); + var result = response.responseText; + if(result != null && result.length > 0){ + if(SHELF == result){ //灭菌架 + loadSterilizationShelf(barcode); + top.Ext.getCmp('inputBarcode').setValue(""); + }else if(USER == result){ //用户 + if(scanUser == true){ + loadSterilizationUser(barcode); + }else{ + showResult("请输入正确的条码!"); + } + top.Ext.getCmp('inputBarcode').setValue(""); + }else if(BASKET == result){ //灭菌篮筐 + loadTousseInstanceCheckPosition(barcode,recordID); + if(hiddenEndBarcode || currentScanMode == 'single'){ + top.Ext.getCmp('inputBarcode').setValue("");//如果使用虚拟篮筐机制,扫描成功后需要清除该文本内容 + }else{ + top.Ext.getCmp('inputBarcodeEnd').focus();//否则不清除,条码/篮筐(尾)获得焦点 + } + }else if (STERILIZER == result){ //灭菌炉 + getSterilization(barcode,recordID); + top.Ext.getCmp('inputBarcode').setValue(""); + }else if(STERILISATION == result){ //灭菌程序 + var sterilizerName = top.Ext.getCmp('sterilizerName').getRawValue(); + if(sterilizerName.length <= 0){ + showResult("请选择灭菌炉!"); + return; + } + loadSterilizationType(barcode,sterilizerName); + top.Ext.getCmp('inputBarcode').setValue(""); + }else if(TOUSSEINSTANCE == result){ //器械包实例2 + loadTousseInstanceCheckPosition(barcode,recordID); + if(hiddenEndBarcode || currentScanMode == 'single'){ + top.Ext.getCmp('inputBarcode').setValue("");//如果使用虚拟篮筐机制,扫描成功后需要清除该文本内容 + }else{ + top.Ext.getCmp('inputBarcodeEnd').focus();//否则不清除,条码/篮筐(尾)获得焦点 + } + }else if(POSITION == result){ //位置 + loadPositionByBarcode(barcode); + top.Ext.getCmp('inputBarcode').setValue(""); + }else if("virtualBasket" == result){ //虚拟篮筐3 + loadTousseInstanceCheckPosition(barcode,recordID); + if(hiddenEndBarcode || currentScanMode == 'single'){ + top.Ext.getCmp('inputBarcode').setValue("");//如果使用虚拟篮筐机制,扫描成功后需要清除该文本内容 + }else{ + top.Ext.getCmp('inputBarcodeEnd').focus();//否则不清除,条码/篮筐(尾)获得焦点 + } + }else if("notFixedBarcode" == result){ + showResult("该器械包为可追溯的包,不能扫描固定条码!"); + top.Ext.getCmp('inputBarcode').setValue(""); + }else if("errorBasket" == result){ + showResult("请输入正确的篮筐条码!"); + top.Ext.getCmp('inputBarcode').setValue(""); + }else if("barcodeInvalid" == result){ + showResult("请输入正确的条码!"); + top.Ext.getCmp('inputBarcode').setValue(""); + }else{ + showResult(result); + top.Ext.getCmp('inputBarcode').setValue(""); + } + }else{ + showResult("请输入正确的条码!"); + top.Ext.getCmp('inputBarcode').setValue(""); + } + }, + failure : function(response, options) { + sterilizationColumnTree.getEl().unmask(); + var result = Ext.decode(response.responseText); + showResult(result); + } + }); + } + //top.Ext.getCmp('inputBarcode').setValue(""); + } + }); + p.getEl().on('focus',function(e) { + top.Ext.getCmp('inputBarcode').setValue(""); + }); + } + } + }] + },{ + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + hidden : hiddenEndBarcode, + items : [{ + xtype : 'textfield', + fieldLabel : "条码/篮筐(尾)", + allowBlank : true, + name : "inputBarcodeEnd", + id : "inputBarcodeEnd", + width : 50, + anchor : '100%', + listeners : { + render : function(p) { + p.getEl().on('keypress',function(e) {//仅可扫描或输入器械包实例条码或虚拟篮筐,且条码/篮筐(首)不能为空,以及与条码/篮筐(首)类型一致 + if (e.getKey() == 13) {//回车键 + var barcode = top.Ext.getCmp('inputBarcode').getValue(); + var barcodeEnd = top.Ext.getCmp('inputBarcodeEnd').getValue(); + var recordID = id; + if(barcodeEnd != null && barcodeEnd.length >0){ + if(barcode == ''){ + showResult("请先输入条码/篮筐(首)!"); + top.Ext.getCmp('inputBarcode').focus(); + return; + } + sterilizationColumnTree.getEl().mask("数据重新加载中,请稍等!"); + Ext.Ajax.request( { + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!getBarcodeType.do', + params : { + barcode : barcode + ";" + barcodeEnd + }, + success : function(response, options) { + sterilizationColumnTree.getEl().unmask(); + var result = response.responseText; + if(result != null && result.length > 0){ + if("virtualBasket" == result){ + loadTousseInstanceCheckPosition(barcode + ";" + barcodeEnd,recordID); + }else if(TOUSSEINSTANCE == result){ + loadTousseInstanceCheckPosition(barcode + ";" + barcodeEnd,recordID); + }else if("notTheSame" == result){ + showResult("首尾条码/篮筐类型不一致,必须均为器械包条码或虚拟篮筐编号!"); + }else if("barcodeEndInvalid" == result){ + showResult("请输入正确的条码!"); + top.Ext.getCmp('inputBarcodeEnd').setValue(""); + }else{ + showResult("请输入正确的条码!"); + top.Ext.getCmp('inputBarcodeEnd').setValue(""); + } + }else{ + showResult("请输入正确的条码!"); + top.Ext.getCmp('inputBarcodeEnd').setValue(""); + } + }, + failure : function(response, options) { + sterilizationColumnTree.getEl().unmask(); + top.Ext.getCmp('inputBarcodeEnd').setValue(""); + var result = Ext.decode(response.responseText); + showResult(result); + } + }); + } + /*top.Ext.getCmp('inputBarcode').setValue(""); + top.Ext.getCmp('inputBarcodeEnd').setValue("");*/ + } + }); + p.getEl().on('focus',function(e) { + top.Ext.getCmp('inputBarcodeEnd').setValue(""); + }); + } + } + }] + }, { + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '开始时间', + width : 50, + id : 'startDate', + name : 'startDate', + editable : false, + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + selectOnFocus :true, + format : 'Y-m-d H:i', + allowBlank : false, + anchor : '100%' + }] + }, { + columnWidth : .33, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '结束时间', + width : 50, + id : 'endDate', + name : 'endDate', + editable : false, + format : 'Y-m-d H:i', + allowBlank : true, + hidden : id == 0?true:false, + hideLabel : id == 0?true:false, + anchor : '100%' + }] + },{ + columnWidth : 1, + layout : 'form', + items : [{ + xtype : 'textarea', + fieldLabel : "灭菌程序参数", + name : "parameter", + id : "parameter", + readOnly:true, + anchor : '98.5%' + }] + },{ + columnWidth : 1, + layout : 'form', + items : [{ + xtype : 'textfield', + fieldLabel : "备注", + name : "remark", + id : "remark", + readOnly:false, + anchor : '99%' + }] + },{ + layout : 'column', + columnWidth : 1, + labelWidth : 90, + items : [ + { + layout : 'form', + columnWidth : 0.85, + labelWidth : 100, + items : [ + { + xtype : 'textfield', + name : 'uploadImage', + id : 'uploadImage', + fieldLabel : "生物监测图片", + anchor : '100%' + } + ] + }, + { + layout : 'form', + columnWidth : 0.08, + labelWidth : 90, + hidden : statusEnd != currentStatus, + items : [ + { xtype:'button', + text : '上传', + handler : function(){ + if(id == null || id == ''){ + showResult("请先保存后再上传图片!"); + }else{ + uploadWindow(imageType_sterilization); + } + } + } + ] + }, + { + layout : 'form', + columnWidth : 0.12, + labelWidth : 90, + items : [ + { xtype:'button', + text : '预览', + disabled:disableShowImageButton, + iconCls : 'btn_ext_application_search', + handler : function(){ + top.showSterilizationRecordPic(id,"/disinfectSystem/sterilization/bioLogicalMonitorPictureAction",'生物监测图片'); +// sterilizationRecordWin.hide(); + } + } + ] + } + ] + }] + },{ + columnWidth : .46, + id : 'sterilizationColumnTree', + items : [sterilizationColumnTree] + }, { + columnWidth : .54, + items : [ new top.Ext.grid.GridPanel({ + id : 'tousseItemCountPanel', + height : 325, +// width : 385, + frame : false, + border : true, + tbar:[{ + xtype : 'button', + text : '灭菌物品统计' + },"->",{ + xtype : 'button', + id : 'totalAmount'/*, + text : '灭菌物品总数量:'*/ + }], + bbar:[{ + xtype : 'button', + id : "typeTotalAmount" + }], + viewConfig: { + forceFit:true + }, + store : tousseItemCountJsonStore, + cm: new Ext.grid.ColumnModel([ + {header: "器械包名称统计", width: 150, menuDisabled:true,dataIndex:'tousseName'}, + {id: 'count', header: "数量", width: 40, menuDisabled: true,dataIndex:'count'} + ]), + stripeRows : true, + autoExpandColumn : 'count', + bodyStyle : 'border:1px solid #afd7af' + })] + },{ + xtype : "fieldset", + title : "监测结果", + layout : 'column', + height :'80', + columnWidth : 1, + cls:'edit-5char-labelwidth', + id : "monitorResultSet", + items : [{ + columnWidth : 0.5, + layout : 'form', + labelWidth : 120, + items : [{ + xtype : 'combo', + fieldLabel : "物理监测结果", + readOnly : true, + valueField : 'value', + displayField : 'value', + store : monitorResutlStore, + triggerAction : 'all', + mode : 'local', + name : "physicsResult", + id : "physicsResult", + allowBlank : false, + anchor : '100%' + }] + },{ + columnWidth : 0.5, + layout : 'form', + labelWidth : 120, + items : [{ + xtype : 'combo', + fieldLabel : "化学监测结果", + readOnly : true, + valueField : 'value', + displayField : 'value', + store : monitorResutlStore, + triggerAction : 'all', + mode : 'local', + name : "chemistryResult", + id : "chemistryResult", + allowBlank : false, + anchor : '100%' + }] + }, { + columnWidth : (sstsConfig.enableBiologicalObserveDate ? .5 : 1), + layout : 'form', + labelWidth : 120, + items : [{ + xtype : 'combo', + fieldLabel : "生物监测结果", + readOnly : true, + valueField : 'value', + displayField : 'value', + store : monitorResutlStore, + triggerAction : 'all', + mode : 'local', + name : "biologyResult", + id : "biologyResult", + allowBlank : false, + anchor : (sstsConfig.enableBiologicalObserveDate ? '100%' : '50%') + }] + }, { + columnWidth : .5, + layout : 'form', + cls:'edit-5char-labelwidth', + hidden: !sstsConfig.enableBiologicalObserveDate, + labelWidth : 120, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '生物监测观察时间', + id : 'biologicalObserveDate', + name : 'biologicalObserveDate', + editable : false, + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + selectOnFocus :true, +// readOnly : true, + format : 'Y-m-d H:i', + anchor : '100%' + }] + }, { + columnWidth : .5, + layout : 'form', + cls:'edit-5char-labelwidth', + labelWidth : 120, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '生物监测开始时间', + id : 'biologicalMonitoringStartDate', + name : 'biologicalMonitoringStartDate', + editable : false, +// readOnly : true, + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + selectOnFocus :true, + format : 'Y-m-d H:i', + anchor : '100%', + listeners : { + select : function() { //联动把生物监测的结束时间填上 + var temp = top.Ext.getCmp('biologicalMonitoringStartDate').getValue().getTime() + _biologicalMonitoringTime; + top.Ext.getCmp('biologicalMonitoringEndDate').setValue(new Date(temp)); + } + } + }] + }, { + columnWidth : .5, + layout : 'form', + cls:'edit-5char-labelwidth', + labelWidth : 120, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '生物监测结束时间', + id : 'biologicalMonitoringEndDate', + name : 'biologicalMonitoringEndDate', + editable : false, + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + selectOnFocus :true, +// readOnly : true, + format : 'Y-m-d H:i', + anchor : '100%' + }] + }, { + columnWidth : .5, + layout : 'form', + labelWidth : 120, + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'textfield', + fieldLabel : "监测员条码", + name : "monitorUserBarcode", + id : "monitorUserBarcode", + anchor : '100%', + listeners : { + specialkey : function(thiz, e){ + if(e.getKey() == 13){ + var peopleOfBarcode = thiz.getValue(); + if(peopleOfBarcode){ + UserTableManager.getUserByBarcode(peopleOfBarcode, function(responseText){ + top.Ext.getCmp('monitorUserBarcode').setValue(); + if(responseText != null && responseText != ""){ + var result = Ext.decode(responseText); + if(!result.success){ + result.isNotSameOrgUnit?showResult("不允许登记非本科室人员,请扫描本科室人员条码"):showResult("输入的条码有误!"); + return; + } + top.Ext.getCmp('monitorUser').setValue(result.fullName); + top.Ext.getCmp('monitorCheckerBarcode').focus(); + }else{ + showResult('找不到该条码所对应的人员信息'); + } + }); + } + } + } + } + }] + }, { + columnWidth : .5, + labelWidth : 120, + layout : 'form', + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'textfield', + fieldLabel : "监测员", + name : "monitorUser", + id : "monitorUser", + readOnly : true, + anchor : '100%', + cls:'x-item-disabled' + }] + }, { + columnWidth : .5, + layout : 'form', + labelWidth : 120, + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'textfield', + fieldLabel : "监测核对员条码", + name : "monitorCheckerBarcode", + id : "monitorCheckerBarcode", + anchor : '100%', + listeners : { + specialkey : function(thiz, e){ + if(e.getKey() == 13){ + var peopleOfBarcode = thiz.getValue(); + if(peopleOfBarcode){ + UserTableManager.getUserByBarcode(peopleOfBarcode, function(responseText){ + top.Ext.getCmp('monitorCheckerBarcode').setValue(); + if(responseText != null && responseText != ""){ + var result = Ext.decode(responseText); + if(!result.success){ + result.isNotSameOrgUnit?showResult("不允许登记非本科室人员,请扫描本科室人员条码"):showResult("输入的条码有误!"); + return; + } + top.Ext.getCmp('monitorChecker').setValue(result.fullName); + top.Ext.getCmp('monitorAuditorBarcode').focus(); + }else{ + showResult('找不到该条码所对应的人员信息'); + } + }); + } + } + } + } + }] + }, { + columnWidth : .5, + layout : 'form', + labelWidth : 120, + cls:'edit-5char-labelwidth', + items : [{ + xtype : 'textfield', + fieldLabel : "监测核对员", + name : "monitorChecker", + id : "monitorChecker", + readOnly : true, + anchor : '100%', + cls:'x-item-disabled' + }] + }, { + columnWidth : .5, + layout : 'form', + labelWidth : 120, + cls:'edit-5char-labelwidth', + hidden : !sstsConfig.needMonitorAuditor, + items : [{ + xtype : 'textfield', + fieldLabel : "监测审核员条码", + name : "monitorAuditorBarcode", + id : "monitorAuditorBarcode", + anchor : '100%', + listeners : { + specialkey : function(thiz, e){ + if(e.getKey() == 13){ + var peopleOfBarcode = thiz.getValue(); + if(peopleOfBarcode){ + UserTableManager.getUserByBarcode(peopleOfBarcode, function(responseText){ + top.Ext.getCmp('monitorAuditorBarcode').setValue(); + if(responseText != null && responseText != ""){ + var result = Ext.decode(responseText); + if(!result.success){ + result.isNotSameOrgUnit?showResult("不允许登记非本科室人员,请扫描本科室人员条码"):showResult("输入的条码有误!"); + return; + } + top.Ext.getCmp('monitorAuditor').setValue(result.fullName); + }else{ + showResult('找不到该条码所对应的人员信息'); + } + }); + } + } + } + } + }] + }, { + columnWidth : .5, + layout : 'form', + labelWidth : 120, + cls:'edit-5char-labelwidth', + hidden : !sstsConfig.needMonitorAuditor, + items : [{ + xtype : 'textfield', + fieldLabel : "监测审核员", + name : "monitorAuditor", + id : "monitorAuditor", + readOnly : true, + anchor : '100%', + cls:'x-item-disabled' + }] + }] + },{ + xtype : "fieldset", + title : "中断记录列表", + layout : 'fit', + height :200, + columnWidth : 1, + cls:'edit-5char-labelwidth', + id : "interruptList", + items :[ + new top.Ext.grid.GridPanel({ + id : 'interruptRecordItemGrid', + store : new top.Ext.data.Store({ + reader : new top.Ext.data.JsonReader({ + fields : [ + {name : 'id'}, + {name : 'interruptUser'}, + {name : 'interruptDate'}, + {name : 'interruptFinishDate'}, + {name : 'interruptOptType'}, + {name : 'quatifyMonitoryId'} + ] + }) + }), + bodyStyle : 'border:1px solid #afd7af', + cm : new top.Ext.grid.ColumnModel([ + {header : "操作人",dataIndex : 'interruptUser',width : 100,sortable : true}, + {header : "中断时间",width : 150,dataIndex : 'interruptDate'}, + {header : "中断完成时间",width : 150,dataIndex : 'interruptFinishDate'}, + {header : "中断完成类型",width : 100,dataIndex : 'interruptOptType'}, + {header : "质量监测记录",dataIndex : 'quatifyMonitoryId',width : 100, + renderer : function(v, p, record){ + var str = ""; + return str; + }} + ]), +// width : 650, +// height : 100, + border : true, + frame : false + })] + }] + },{ + columnWidth : (top.screen.width > 1030 ? 0.4 :0.33), + bodyStyle : 'margin-left:2px;margin-right:0px', + layout : 'fit', + items : [{ + layout : 'form', + items : [{ + xtype : "fieldset", + title : "今天审核的待灭菌物品", + autoWidth : true,//405, + height : 548, + items : [pendingSterilizationColumnTree] + }] + }] + }] + }], + buttons : [{ + id : 'continueBtn', + text : '继续灭菌', + handler : function (){ + sterilizationContinue(); + }, + hidden : true + },{ + id : 'successBtn', + text : '灭菌完成', + handler : function() { + sterilizationComplete(grid,statusEnd); + }, + hidden : true + },{ + id : 'failureBtn', + text : '灭菌失败', + handler : function() { + sterilizationFailure(grid,statusFailure); + sterilizerStatus = statusFailure; + }, + hidden : true + },{ + id : 'saveBtn', + text : '保存', + handler : save + },{ + id : 'monitorBtn', + text : '保存', + hidden :true, + handler : saveMonitor + },{ + text : '取消', + id : 'saveAndNewBtn', + handler : cancel + }] + }); + + function uploadWindow(imageType){ + var onUploadComplete = function(dialog){ + dialog.hide(); + }; + //文件上传成功后的回调函数 + var onUploadSuccess = function(dialog, filename, resp_data, record){ + showResult("上传图片成功"); + dialog.hide(); + }; +// //文件上传失败后的回调函数 + var onUploadFailed = function(dialog, filename, resp_data, record){ + showResult(resp_data.message);//resp_data是json格式的数据 + }; + var dialog = new top.Ext.ux.UploadDialog.Dialog({ + title: "上传" + imageType, + url:WWWROOT + '/disinfectSystem/baseData/uploadImageFileAction!uploadImage.do?imageType='+imageType+'&objectId='+id , //这里我用struts2做后台处理 + post_var_name:'uploadFiles',//这里是自己定义的,默认的名字叫file + width : 450, + height : 300, + minWidth : 450, + minHeight : 300, + draggable : true , + resizable : true , + constraintoviewport: true , + permitted_extensions:['JPG','jpg','jpeg','JPEG','GIF','gif','png','PNG'], + modal: true , + reset_on_hide: false , + allow_close_on_upload: false , //关闭上传窗口是否仍然上传文件 + upload_autostart: false + }); + dialog.show(); + dialog.on('uploadsuccess',onUploadSuccess); //定义上传成功回调函数 + dialog.on('uploadfailed',onUploadFailed); //定义上传失败回调函数 + } + + sterilizationRecordWin = new top.Ext.Window( { + id : 'sterilizationRecordWin', + layout : 'fit', + title : '灭菌记录信息', + border : false, + modal : true, + width : top.screen.width > 1030 ? 1260 : 1020, height : top.screen.height > 800 ? 660 : 500, - plain : true, - align : 'center', - items : [ formObj ] - }); - sterilizationRecordWin.show(); + plain : true, + align : 'center', + items : [ formObj ] + }); + sterilizationRecordWin.show(); - formObj.form.load({ - url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!loadSterilizationRecord.do', - method : 'GET', - waitMsg : '正在加载数据,请稍候', - success : function(form, action) { - var sr = action.result.data; //此灭菌记录对象 - - if(!id) { //新加的记录 - setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'startDate'); //(设置开始时间,取服务器时间cjr) - if(scanUser == true){ - top.Ext.getCmp('sterilizationUser').setValue(''); - } - } else { - top.Ext.getCmp('startDate').setValue(formatDateYear(sr.startDate)); - top.Ext.getCmp('endDate').setValue(formatDateYear(sr.endDate)); - top.Ext.getCmp('srSituationComfirmer').setValue(sr.srSituationComfirmer); - } - - if(reSterilization){ //重新灭菌 - SterilizationRecordTableManager.getMaxFrequency(sr.sterilizerName,0,function(result){ - top.Ext.getCmp('frequency').setValue(result); - }); - SterilizationRecordTableManager.getNextCycleCounter(sr.sterilizerName,0,function(result){ - top.Ext.getCmp('cycleCounter').setValue(result == 0 ? 1 : result); - }); - } - //判断是否无条件显示循环次数 - if(sstsConfig.showCycleCountWithoutCondition){ - top.Ext.getCmp('cycleCounterId').show(); - }else{ - SterilizationRecordTableManager.isDefineDeviceInterface(sr.sterilizerName,function(result){ - result == true ? top.Ext.getCmp('cycleCounterId').show() : - top.Ext.getCmp('cycleCounterId').hide(); - }); - } - - //加载灭菌参数 - SterilizationRecordTableManager.getParameter(sr.sterilizationType,function(result){ - if(result != null && result.length > 0){ - top.Ext.getCmp('parameter').setValue(result); - } - }); - - if(sr.status != statusEnd){ //这里有四种情况:新加的记录、灭菌中、灭菌中断、灭菌失败 - top.Ext.getCmp('physicsResult').setValue(sr.physicsResult ? sr.physicsResult : "无"); - top.Ext.getCmp('chemistryResult').setValue(sr.chemistryResult ? sr.chemistryResult : "无"); - top.Ext.getCmp('biologyResult').setValue(sr.biologyResult ? sr.biologyResult : "无"); - top.Ext.getCmp('physicsResult').disable(); - top.Ext.getCmp('chemistryResult').disable(); - top.Ext.getCmp('biologyResult').disable(); - - top.Ext.getCmp('biologicalObserveDate').disable(); - top.Ext.getCmp('biologicalMonitoringStartDate').disable(); - top.Ext.getCmp('biologicalMonitoringEndDate').disable(); - top.Ext.getCmp('monitorCheckerBarcode').disable(); - top.Ext.getCmp('monitorChecker').disable(); - top.Ext.getCmp('monitorUserBarcode').disable(); - top.Ext.getCmp('monitorUser').disable(); - top.Ext.getCmp('monitorAuditorBarcode').disable(); - top.Ext.getCmp('monitorAuditor').disable(); - - if(sr.status == statusFailure && reSterilization == false){ - top.Ext.getCmp('monitorBtn').show(); - top.Ext.getCmp('saveBtn').hide(); - top.Ext.getCmp('inputBarcode').setDisabled(true); - top.Ext.getCmp('biologicalMonitoringStartDate').setDisabled(true); - disableItems(); - } - if(sr.status == statusInterrupt && reSterilization == false){ - top.Ext.getCmp('monitorBtn').show(); - top.Ext.getCmp('saveBtn').hide(); - top.Ext.getCmp('inputBarcode').setDisabled(true); - disableItems(); - } - }else{ //灭菌完成 - _biologicalMonitoringTime = sr.sterilizer.biologicalMonitoringTime*60*1000; //此灭菌炉的生物监测持续时间 - top.Ext.getCmp('biologicalObserveDate').setValue(formatDateYear(sr.biologicalObserveDate)); //生物监测的观察时间 - top.Ext.getCmp('biologicalMonitoringStartDate').setValue(formatDateYear(sr.biologicalMonitoringStartDate)); //生物监测的开始时间 - top.Ext.getCmp('biologicalMonitoringEndDate').setValue(formatDateYear(sr.biologicalMonitoringEndDate)); //生物监测的结束时间 - - top.Ext.getCmp('monitorBtn').show(); - top.Ext.getCmp('saveBtn').hide(); - disableItems(); - } - - // 初始化中断记录列表 - var items = action.result.interruptRecords; - for(var i = 0;items && i < items.length; i++){ - var itemRecord = new InterruptRecordItem({ - id : items[i].id, - interruptUser : items[i].interruptUser, - interruptDate : items[i].interruptDate, - interruptFinishDate : items[i].interruptFinishDate, - interruptOptType : items[i].interruptOptType, - quatifyMonitoryId : items[i].quatifyMonitoryId - }); - top.Ext.getCmp('interruptRecordItemGrid').getStore().add(itemRecord); - } - }, - failure : function(form, action) { - }, - params : { - id : id - } - }); - - - isNewRecord = reSterilization; - - //如果是编辑并且状态是灭菌完成或者登陆用户不属于供应室也不属于二级供应室 - if((id && currentStatus==statusEnd) || (id && currentStatus==statusFailure) || orgUnitCoding == null || orgUnitCoding == ''){ - top.Ext.getCmp('saveBtn').setDisabled(true); - } - - //重新灭菌 - if(reSterilization){ - top.Ext.getCmp('sterilizationRecordWin').setTitle("重新灭菌"); - top.Ext.getCmp('saveBtn').setDisabled(false); - top.Ext.getCmp('saveBtn').setText("重新灭菌"); - if(id && currentStatus==statusInterrupt){ - top.Ext.getCmp('continueBtn').show(); - top.Ext.getCmp('successBtn').show(); - top.Ext.getCmp('failureBtn').show(); - // 灭菌中断 没有重新灭菌按钮 - top.Ext.getCmp('saveBtn').hide(); - } - } - top.Ext.getCmp('inputBarcode').focus(false, 100); + formObj.form.load({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!loadSterilizationRecord.do', + method : 'GET', + waitMsg : '正在加载数据,请稍候', + success : function(form, action) { + var sr = action.result.data; //此灭菌记录对象 + + if(!id) { //新加的记录 + setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'startDate'); //(设置开始时间,取服务器时间cjr) + if(scanUser == true){ + top.Ext.getCmp('sterilizationUser').setValue(''); + } + } else { + top.Ext.getCmp('startDate').setValue(formatDateYear(sr.startDate)); + top.Ext.getCmp('endDate').setValue(formatDateYear(sr.endDate)); + top.Ext.getCmp('srSituationComfirmer').setValue(sr.srSituationComfirmer); + } + + if(reSterilization){ //重新灭菌 + SterilizationRecordTableManager.getMaxFrequency(sr.sterilizerName,0,function(result){ + top.Ext.getCmp('frequency').setValue(result); + }); + SterilizationRecordTableManager.getNextCycleCounter(sr.sterilizerName,0,function(result){ + top.Ext.getCmp('cycleCounter').setValue(result == 0 ? 1 : result); + }); + } + //判断是否无条件显示循环次数 + if(sstsConfig.showCycleCountWithoutCondition){ + top.Ext.getCmp('cycleCounterId').show(); + }else{ + SterilizationRecordTableManager.isDefineDeviceInterface(sr.sterilizerName,function(result){ + result == true ? top.Ext.getCmp('cycleCounterId').show() : + top.Ext.getCmp('cycleCounterId').hide(); + }); + } + + //加载灭菌参数 + SterilizationRecordTableManager.getParameter(sr.sterilizationType,function(result){ + if(result != null && result.length > 0){ + top.Ext.getCmp('parameter').setValue(result); + } + }); + + if(sr.status != statusEnd){ //这里有四种情况:新加的记录、灭菌中、灭菌中断、灭菌失败 + top.Ext.getCmp('physicsResult').setValue(sr.physicsResult ? sr.physicsResult : "无"); + top.Ext.getCmp('chemistryResult').setValue(sr.chemistryResult ? sr.chemistryResult : "无"); + top.Ext.getCmp('biologyResult').setValue(sr.biologyResult ? sr.biologyResult : "无"); + top.Ext.getCmp('physicsResult').disable(); + top.Ext.getCmp('chemistryResult').disable(); + top.Ext.getCmp('biologyResult').disable(); + + top.Ext.getCmp('biologicalObserveDate').disable(); + top.Ext.getCmp('biologicalMonitoringStartDate').disable(); + top.Ext.getCmp('biologicalMonitoringEndDate').disable(); + top.Ext.getCmp('monitorCheckerBarcode').disable(); + top.Ext.getCmp('monitorChecker').disable(); + top.Ext.getCmp('monitorUserBarcode').disable(); + top.Ext.getCmp('monitorUser').disable(); + top.Ext.getCmp('monitorAuditorBarcode').disable(); + top.Ext.getCmp('monitorAuditor').disable(); + + if(sr.status == statusFailure && reSterilization == false){ + top.Ext.getCmp('monitorBtn').show(); + top.Ext.getCmp('saveBtn').hide(); + top.Ext.getCmp('inputBarcode').setDisabled(true); + top.Ext.getCmp('biologicalMonitoringStartDate').setDisabled(true); + disableItems(); + } + if(sr.status == statusInterrupt && reSterilization == false){ + top.Ext.getCmp('monitorBtn').show(); + top.Ext.getCmp('saveBtn').hide(); + top.Ext.getCmp('inputBarcode').setDisabled(true); + disableItems(); + } + }else{ //灭菌完成 + _biologicalMonitoringTime = sr.sterilizer.biologicalMonitoringTime*60*1000; //此灭菌炉的生物监测持续时间 + top.Ext.getCmp('biologicalObserveDate').setValue(formatDateYear(sr.biologicalObserveDate)); //生物监测的观察时间 + top.Ext.getCmp('biologicalMonitoringStartDate').setValue(formatDateYear(sr.biologicalMonitoringStartDate)); //生物监测的开始时间 + top.Ext.getCmp('biologicalMonitoringEndDate').setValue(formatDateYear(sr.biologicalMonitoringEndDate)); //生物监测的结束时间 + + top.Ext.getCmp('monitorBtn').show(); + top.Ext.getCmp('saveBtn').hide(); + disableItems(); + } + + // 初始化中断记录列表 + var items = action.result.interruptRecords; + for(var i = 0;items && i < items.length; i++){ + var itemRecord = new InterruptRecordItem({ + id : items[i].id, + interruptUser : items[i].interruptUser, + interruptDate : items[i].interruptDate, + interruptFinishDate : items[i].interruptFinishDate, + interruptOptType : items[i].interruptOptType, + quatifyMonitoryId : items[i].quatifyMonitoryId + }); + top.Ext.getCmp('interruptRecordItemGrid').getStore().add(itemRecord); + } + }, + failure : function(form, action) { + }, + params : { + id : id + } + }); + + + isNewRecord = reSterilization; + + //如果是编辑并且状态是灭菌完成或者登陆用户不属于供应室也不属于二级供应室 + if((id && currentStatus==statusEnd) || (id && currentStatus==statusFailure) || orgUnitCoding == null || orgUnitCoding == ''){ + top.Ext.getCmp('saveBtn').setDisabled(true); + } + + //重新灭菌 + if(reSterilization){ + top.Ext.getCmp('sterilizationRecordWin').setTitle("重新灭菌"); + top.Ext.getCmp('saveBtn').setDisabled(false); + top.Ext.getCmp('saveBtn').setText("重新灭菌"); + if(id && currentStatus==statusInterrupt){ + top.Ext.getCmp('continueBtn').show(); + top.Ext.getCmp('successBtn').show(); + top.Ext.getCmp('failureBtn').show(); + // 灭菌中断 没有重新灭菌按钮 + top.Ext.getCmp('saveBtn').hide(); + } + } + top.Ext.getCmp('inputBarcode').focus(false, 100); } function formatDateYear(v, p, record) { - try { - return Ext.util.Format.date(new Date(v.time), 'Y-m-d H:i'); - } catch (e) { - } + try { + return Ext.util.Format.date(new Date(v.time), 'Y-m-d H:i'); + } catch (e) { + } } function disableItems(){ - top.Ext.getCmp('sterilizationUser').disable(); - top.Ext.getCmp('sterilizationShelf').disable(); - top.Ext.getCmp('sterilizerName').disable(); - top.Ext.getCmp('frequency').disable(); - top.Ext.getCmp('sterilizationType').disable(); - top.Ext.getCmp('sterilizationPurpose').disable(); - top.Ext.getCmp('startDate').disable(); - top.Ext.getCmp('endDate').disable(); - top.Ext.getCmp('parameter').disable(); + top.Ext.getCmp('sterilizationUser').disable(); + top.Ext.getCmp('sterilizationShelf').disable(); + top.Ext.getCmp('sterilizerName').disable(); + top.Ext.getCmp('frequency').disable(); + top.Ext.getCmp('sterilizationType').disable(); + top.Ext.getCmp('sterilizationPurpose').disable(); + top.Ext.getCmp('startDate').disable(); + top.Ext.getCmp('endDate').disable(); + top.Ext.getCmp('parameter').disable(); } var isNewRecord = false; function save() { - if (!formObj.form.isValid()) { - showResult('请正确填写表单各值'); - 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("当前灭菌程序不能灭菌物品!"); - return false; - } + if (!formObj.form.isValid()) { + showResult('请正确填写表单各值'); + 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("当前灭菌程序不能灭菌物品!"); + 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("当前灭菌炉正在灭菌,保存失败!"); - return false; - } - } - // 验证循环计数器是否已经存在,一个灭菌炉的一个循环次数应是唯一的。 - { - var id = top.Ext.getCmp('id').getValue(); - DWREngine.setAsync(false); - var sign = true; - 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("灭菌炉的循环次数已存在,保存失败!"); - return false; - } - }else if(!sstsConfig.showCycleCountWithoutCondition){ - //如果既没有配置灭菌炉接口也没有开启循环次数则清0 - top.Ext.getCmp('cycleCounter').setValue(0); - } - } - + //验证当前灭菌炉是否是灭菌中 + 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("当前灭菌炉正在灭菌,保存失败!"); + return false; + } + } + // 验证循环计数器是否已经存在,一个灭菌炉的一个循环次数应是唯一的。 + { + var id = top.Ext.getCmp('id').getValue(); + DWREngine.setAsync(false); + var sign = true; + 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("灭菌炉的循环次数已存在,保存失败!"); + return false; + } + }else if(!sstsConfig.showCycleCountWithoutCondition){ + //如果既没有配置灭菌炉接口也没有开启循环次数则清0 + top.Ext.getCmp('cycleCounter').setValue(0); + } + } + var nexFn = function(){ var result = getItemTreeData(); top.Ext.getCmp("sterilizationGoods").setValue(result); @@ -2625,41 +3007,41 @@ } }); } - - if (!hasGoods){ - top.Ext.MessageBox.confirm("请确认","没有添加灭菌的物品,继续灭菌吗?", + + if (!hasGoods){ + top.Ext.MessageBox.confirm("请确认","没有添加灭菌的物品,继续灭菌吗?", function(button, text) { if ("yes" == button){ nexFn(); }else{ return false; } - }); - }else{ - nexFn(); - } + }); + }else{ + nexFn(); + } } function cancel() { - saveBarcode = ""; - sterilizationRecordWin.close(); + saveBarcode = ""; + sterilizationRecordWin.close(); } /** * 获取已经扫描的条码集合(用分号分隔) */ function getAlreadyScanBarcodes() { - var barcodes = ""; - sterilizationColumnTree.getRootNode().eachChild(function(pNode){ - barcodes += pNode.attributes.barcode + ";"; - }); - if (barcodes) { - barcodes = barcodes.substring(0, barcodes.length - 1); - } - return barcodes; + var barcodes = ""; + sterilizationColumnTree.getRootNode().eachChild(function(pNode){ + barcodes += pNode.attributes.barcode + ";"; + }); + if (barcodes) { + barcodes = barcodes.substring(0, barcodes.length - 1); + } + return barcodes; } function showQualityMonitory(qualityMonitoryId){ - sterilizationRecordWin.close(); - addQualityMonitoring(qualityMonitoryId); + sterilizationRecordWin.close(); + addQualityMonitoring(qualityMonitoryId); } \ No newline at end of file Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManager.java =================================================================== diff -u -r21535 -r21796 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManager.java (.../TousseInstanceManager.java) (revision 21535) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManager.java (.../TousseInstanceManager.java) (revision 21796) @@ -664,5 +664,68 @@ * @return */ public String batchSetSignRecordId(String departCode, String departName,Long signRecordId); + + /** + * 判断用户输入的条码和固定条码是否一致 + * @param barcode 输入的条码 + * @return + */ + public boolean equalsBarcode(String barcode); + + /** + * 固定条码修改数量对应的增加方法 + * @param tousseName 包名 + * @param barcodes 已有的条码集合,用逗号分割 + * @return + */ + public String fixedBarcodeBarcodeAdd(String tousseName , String barcodes,int addAmount); + + /** + * 根据条码判断是否为固定条码,如果是则返回tousseDefinition_id(包定义ID),如果不是则返回空字符串 + * @param barcode + * @return + */ + public String checkIsFixedBarcode(String barcode); + + /** + * 固定条码修改数量对应的减少方法 + * @param fixedBarcode + * @param myBarcodes + * @param parseInt + * @return + */ + public String fixedBarcodeBarcodeSubtraction(String fixedBarcode, + String myBarcodes, int parseInt); + + + /** + * 根据固定条码获取包实例集合, + * @param fixedBarcode 固定条码 + * @param barcodes 页面上已经扫描过的条码,用逗号分割 + * @param type 判断类型 (灭菌记录、灭菌装载、审核) 不同页面的查询条件不一样 + * @return + */ + List getTousseInsDataByFixedBarcode(String fixedBarcode,String barcodes ,String type); + + + /** + * 根据条码判断是否需要统计汇总包信息 + * @return + */ + public boolean isCountBarcode(String barcode); + + /** + * 根据包名,获取固定条码。如果没有则返回空字符串 + * @return + */ + public String getTousseInsFixedBarcode(String tousseName); + + /** + * 根据包实例,判断是否追溯 + * @param barcode + * @return + */ + public boolean checkTousseInsBarcodeIsTraceable(String barcode); + } Index: ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/action/SterilizationRecordAction.java =================================================================== diff -u -r20810 -r21796 --- ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/action/SterilizationRecordAction.java (.../SterilizationRecordAction.java) (revision 20810) +++ ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/action/SterilizationRecordAction.java (.../SterilizationRecordAction.java) (revision 21796) @@ -4,12 +4,10 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; -import java.io.PrintWriter; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; @@ -42,8 +40,6 @@ import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; -import org.apache.struts2.impl.StrutsObjectFactory; -import org.hibernate.Query; import com.forgon.Constants; import com.forgon.directory.acegi.tools.AcegiHelper; @@ -64,7 +60,6 @@ import com.forgon.disinfectsystem.entity.sterilizationmanager.sterilizationrecord.SterilizationRecord; import com.forgon.disinfectsystem.entity.sterilizationmanager.sterilizationrecord.SterilizationRecordPic; import com.forgon.disinfectsystem.sterilizationmanager.sterilizationrecord.service.SterilizationRecordManager; -import com.forgon.disinfectsystem.sterilizationmanager.sterilizerrecord.service.SterilizerRecordManager; import com.forgon.disinfectsystem.tousse.imagefilemanager.service.ImageFileManager; import com.forgon.disinfectsystem.tousse.toussedefinition.service.TousseInstanceManager; import com.forgon.log.model.Log; @@ -82,7 +77,7 @@ import com.forgon.tools.string.StringTools; import com.forgon.tools.util.FileUtils; import com.forgon.tools.util.ForgonDateUtils; -import com.forgon.tools.util.StrutsUtils; +import com.forgon.util.StringUtil; import com.opensymphony.xwork2.ModelDriven; import com.opensymphony.xwork2.Preparable; @@ -247,7 +242,6 @@ sterilizationRecord.setStartDate(startDate); sterilizationRecord.setOrgUnitCoding(AcegiHelper.getLoginUser() .getOrgUnitCodingFromSupplyRoomConfig()); - Collection tousseInstanceBarcodes = new ArrayList(); Collection containerBarcodes = new ArrayList(); String[] goodsInfoArray = StringUtils.split(sterilizationGoods, @@ -683,7 +677,14 @@ String barcodeStr = StrutsParamUtils.getPraramValue("barcode", ""); barcodeStr = barcodeStr.replaceAll("\r\n", ""); String savedBarcodes = StrutsParamUtils.getPraramValue("saveBarcode", ""); + String myBarcodes = StrutsParamUtils.getPraramValue("myBarcodes",""); + myBarcodes = myBarcodes.replace("\"","").replace("[","").replace("]","").replace(",",";"); + String finalBarcodes =""; + String str = savedBarcodes==""?"":";"; + finalBarcodes = savedBarcodes+str+myBarcodes; + + JSONObject jsonObj = new JSONObject(); if (StringUtils.isNotBlank(barcodeStr)) { String[] barcodeArray = barcodeStr.split(";"); @@ -723,7 +724,14 @@ //没入灭菌篮筐 if (isOutBasket) { //不追溯的器械包(含普通器械包、敷料包、外部代理灭菌包) - if (tousseInstance.getUnTraceableTousse()) { + if (!StringUtils.equals(Constants.STR_YES, tousseInstance.getTousseDefinition().getIsTraceable())) { + //if (tousseInstance.getUnTraceableTousse()) { + //先判断用户输入的条码是不是固定条码 + if(!tousseInstanceManager.equalsBarcode(barcodeStr)){//如果不是固定条码 + jsonObj.put("success", -1); + jsonObj.put("failureCause", "不追溯的包只支持扫描固定条码"); + StrutsResponseUtils.output(jsonObj); + } String name = tousseDefinition.getName(); String orgUnitCode = AcegiHelper.getLoginUser().getCurrentOrgUnitCode(); Integer scanAmount = tousseDefinition.getScanAmount(); @@ -737,8 +745,8 @@ //从toussesOfToday中删除已经扫描了的器械包集合 List alreadyLoadedTousses = new ArrayList(); - if (StringUtils.isNotBlank(savedBarcodes)) { - String[] savedBarcodeArray = savedBarcodes.split(";"); + if (StringUtils.isNotBlank(finalBarcodes)) { + String[] savedBarcodeArray = finalBarcodes.split(";"); for (int i = 0; i < savedBarcodeArray.length; i++) { String savedBarcodeStr = savedBarcodeArray[i]; TousseInstance tousseInstance2 = todayToussesMap.get(savedBarcodeStr); @@ -764,6 +772,16 @@ for (int i = 0; i < toussesAmount; i++) { TousseInstance tousseInstance1 = toussesOfToday.get(i); JSONObject temp = new JSONObject(); + if(i==0){//页面上只显示第一条数据 + temp.put("tousseBarcode", tousseInstance.getBarcode()); + temp.put("tousseName", tousseInstance1.getTousseName()); + temp.put("typeForSterilizationStatistics", getTypeForSterilizationStatistics(tousseInstance1)); + temp.put("SterilingType", tousseInstance1.getSterilingType()); + temp.put("department", StringUtils.defaultString(tousseInstance1.getDepart(), "")); + temp.put("reviewTime", ForgonDateUtils.safelyFormatDate(tousseInstance1.getReviewTime(), Constants.SIMPLEDATEFORMAT_YYYYMMDDHHMM, "")); + temp.put("amount",toussesAmount ); + tousseInstanceArr.add(temp); + } temp.put("tousseBarcode", tousseInstance1.getBarcode()); temp.put("tousseName", tousseInstance1.getTousseName()); temp.put("typeForSterilizationStatistics", getTypeForSterilizationStatistics(tousseInstance1)); @@ -1793,4 +1811,97 @@ result.put("data", data); StrutsResponseUtils.output(result); } + + /** + * 根据固定条码验证包的库存 + */ + public void checkTousseInsAmountByBarcode(){ + JSONObject jsonObj = new JSONObject(); + String barcode = StrutsParamUtils.getPraramValue("barcode", ""); + String newAmount = StrutsParamUtils.getPraramValue("newAmount", ""); + String tousseName = StrutsParamUtils.getPraramValue("tousseName", ""); + if(Integer.parseInt(newAmount)<1){ + JSONObject jSONObj = JSONUtil.buildJsonObject(false, "最小数量不能为0"); + StrutsResponseUtils.output(jSONObj); + } + List barcodeList =tousseInstanceManager.getTousseInsDataByFixedBarcode(barcode,"","灭菌记录"); + if(!tousseInstanceManager.equalsBarcode(barcode)){ + JSONObject jSONObj = JSONUtil.buildJsonObject(false, "只有扫描固定条码才能修改数量"); + StrutsResponseUtils.output(jSONObj); + } + int amount = 0; + amount = barcodeList.size(); + if(amount barcodeList =tousseInstanceManager.getTousseInsDataByFixedBarcode(barcode,"","灭菌记录"); + JSONObject jSONObj = JSONUtil.buildJsonObject(true, barcodeList.size()+""); + StrutsResponseUtils.output(jSONObj); + } + + + /** + * 得到已审核包的条码,并排除已有的条码 + * @param tousseName 包名 + * @param barcodes 已有的条码集合,用逗号分割 + * @return + */ + public void fixedBarcodeBarcodeAdd(){ + //已有的条码集合 + String myBarcodes = StrutsParamUtils.getPraramValue("myBarcodes",""); + //格式化成字符串:每个条码用逗号隔开 + myBarcodes = myBarcodes.replace("\"","").replace("[","").replace("]","").replace(" ", ""); + String fixedBarcode = StrutsParamUtils.getPraramValue("fixedBarcode", ""); + String addAmount = StrutsParamUtils.getPraramValue("addAmount", ""); + try{ + String barcodeResult = tousseInstanceManager.fixedBarcodeBarcodeAdd(fixedBarcode, myBarcodes,Integer.parseInt(addAmount)); + JSONObject jSONObj = JSONUtil.buildJsonObject(true, barcodeResult); + StrutsResponseUtils.output(jSONObj); + }catch(Exception e){ + e.printStackTrace(); + throw new RuntimeException("发生异常"); + } + } + + /** + * 得到已审核包的条码,并排除已有的条码 + * @param tousseName 包名 + * @param barcodes 已有的条码集合,用逗号分割 + * @return + */ + public void fixedBarcodeBarcodeSubtraction(){ + //已有的条码集合 + String myBarcodes = StrutsParamUtils.getPraramValue("myBarcodes",""); + + //格式化成字符串:每个条码用逗号隔开 + myBarcodes = myBarcodes.replace("\"","").replace("[","").replace("]",""); + + + String fixedBarcode = StrutsParamUtils.getPraramValue("fixedBarcode", ""); + String delAmount = StrutsParamUtils.getPraramValue("delAmount", ""); + + try{ + String barcodeResult = tousseInstanceManager.fixedBarcodeBarcodeSubtraction(fixedBarcode, myBarcodes.replace(" ", ""),Integer.parseInt(delAmount)); + + JSONObject jSONObj = JSONUtil.buildJsonObject(true, barcodeResult); + StrutsResponseUtils.output(jSONObj); + }catch(Exception e){ + e.printStackTrace(); + } + } + + + + } Index: ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/action/TousseInstanceAction.java =================================================================== diff -u -r21541 -r21796 --- ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/action/TousseInstanceAction.java (.../TousseInstanceAction.java) (revision 21541) +++ ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/action/TousseInstanceAction.java (.../TousseInstanceAction.java) (revision 21796) @@ -31,6 +31,7 @@ import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; +import org.testng.collections.Lists; import com.forgon.Constants; import com.forgon.databaseadapter.service.DateQueryAdapter; @@ -81,6 +82,7 @@ import com.forgon.tools.json.JSONUtil; import com.forgon.tools.string.StringTools; import com.forgon.tools.util.ForgonDateUtils; +import com.google.common.collect.Maps; import com.google.gson.JsonArray; import com.google.gson.JsonObject; @@ -922,7 +924,8 @@ // 当天审核的,未入筐的器械包 List toussesOutsideBasketOfToday = tousseInstanceManager .getTodayReviewedTousseInstanceWithOutBasket(orgUnitCoding); - + + // 遍历加载放入灭菌篮筐的器械包 for (ReviewedBasket basket : reviewedBaskets) { Container container = basket.getContainer(); @@ -950,39 +953,57 @@ //灭菌筐里面器械包的全部的灭菌程序,至少要有一个是属于此灭菌分组或者此灭菌炉(或者至少有一个器械包的灭菌程序为“无”)才会显示(没选灭菌炉就按灭菌分组过滤) boolean flag = false; + Map bMap=Maps.newTreeMap(); + for (TousseSimpleVO vo : vos) { if (sterilingTypeMap == null || Constants.HAS_TYPE_NO.equals(vo.getSterilingType()) || sterilingTypeMap.get(vo.getSterilingType()) != null) { flag = true; } - - JSONObject tousseInBasket = new JSONObject(); - String isUrgentTousse = vo.getIsUrgentTousse(); - boolean isTimeout = timeoutManager.isTimeouted(vo.getReviewTime(),timeoutSetting); - tousseInBasket.put("depart", vo.getDepart()); - tousseInBasket.put("objName", vo.getItemDefinition().getName()); - tousseInBasket.put("objBarcode", vo.getBarcode()); - tousseInBasket.put("objAmount", 1); - tousseInBasket.put("reviewTime", vo.getReviewTime()); - tousseInBasket.put("type", "TOUSSE_IN"); - tousseInBasket.put("uiProvider", "col"); - tousseInBasket.put("leaf", true); - tousseInBasket.put("iconCls", "task"); - tousseInBasket.put("cls", isTimeout ? "itemTimeout" : ""); - // 只要有一个包超时,篮筐就显示超时 - if(isTimeout){ - isNotTimeout = false; - } - if(isUrgentTousse != null && isUrgentTousse.equals(TousseDefinition.STR_YES )){ - isBasketUrgent = true; // 只要有一个包加急,篮筐就显示加急 - tousseInBasket.put("isUrgent", TousseDefinition.STR_YES); - }else{ - tousseInBasket.put("isUrgent", TousseDefinition.STR_NO); - } - - tousseInBasketArray.add(tousseInBasket); - + String key = vo.getItemDefinition().getName(); + if(bMap.containsKey(key) && tousseInstanceManager.isCountBarcode(vo.getBarcode())){//只有支持扫固定条码的包,才去统计 + //已存在 则取出该对象,对象中 objAmount 累加。 + JSONObject obj = bMap.get(key); + int amt=(int) obj.get("objAmount"); + amt++; + obj.put("objAmount", amt); + obj.put("objBarcode", tousseInstanceManager.getTousseInsFixedBarcode(vo.getItemDefinition().getName())); + //覆盖 + bMap.put(key, obj); + }else{ + JSONObject tousseInBasket = new JSONObject(); + String isUrgentTousse = vo.getIsUrgentTousse(); + boolean isTimeout = timeoutManager.isTimeouted(vo.getReviewTime(),timeoutSetting); + tousseInBasket.put("depart", vo.getDepart()); + tousseInBasket.put("objName", vo.getItemDefinition().getName()); + tousseInBasket.put("objBarcode", vo.getBarcode()); + tousseInBasket.put("objAmount", 1); + tousseInBasket.put("reviewTime", vo.getReviewTime()); + tousseInBasket.put("type", "TOUSSE_IN"); + tousseInBasket.put("uiProvider", "col"); + tousseInBasket.put("leaf", true); + tousseInBasket.put("iconCls", "task"); + tousseInBasket.put("cls", isTimeout ? "itemTimeout" : ""); + // 只要有一个包超时,篮筐就显示超时 + if(isTimeout){ + isNotTimeout = false; + } + if(isUrgentTousse != null && isUrgentTousse.equals(TousseDefinition.STR_YES )){ + isBasketUrgent = true; // 只要有一个包加急,篮筐就显示加急 + tousseInBasket.put("isUrgent", TousseDefinition.STR_YES); + }else{ + tousseInBasket.put("isUrgent", TousseDefinition.STR_NO); + } + if(tousseInstanceManager.isCountBarcode(vo.getBarcode())){ + bMap.put(key, tousseInBasket); + }else{ + bMap.put(vo.getBarcode(), tousseInBasket); + } + } } - + for (String key : bMap.keySet()) { + JSONObject tousseInBasket=bMap.get(key); + tousseInBasketArray.add(tousseInBasket); + } if (flag) { basketObj.put("children", tousseInBasketArray); basketObj.put("isTimeout", !isNotTimeout); @@ -999,9 +1020,61 @@ } } } + // 去重,key为名称, value为具体的数据。 如果名称重复,则取出该分组数据,累加。否则新增.。 + Map resultMap=Maps.newTreeMap(); + String sortRule="aaaaa";//根据treeMap 特性,将已超时的排在前面 + for (TousseInstance tousseOutsideBasket : toussesOutsideBasketOfToday) { + boolean isTimeout = timeoutManager.isTimeouted(tousseOutsideBasket.getReviewTime(), timeoutSetting); + //器械包的灭菌程序,属于此灭菌分组或者此灭菌炉(或者器械包的灭菌程序为“无”)才会显示(没选灭菌炉就按灭菌分组过滤) + if (sterilingTypeMap != null && !Constants.HAS_TYPE_NO.equals(tousseOutsideBasket.getSterilingType())) { + String sterilingTypeTemp = sterilingTypeMap.get(tousseOutsideBasket.getSterilingType()); + if (sterilingTypeTemp == null) { + continue; + } + } + String key=tousseOutsideBasket.getShowTousseName(); + if(isTimeout){ + key=sortRule+tousseOutsideBasket.getShowTousseName(); + //System.out.println(tousseOutsideBasket.getShowTousseName()+"已超时"); + } + if(resultMap.containsKey(key) && tousseInstanceManager.isCountBarcode(tousseOutsideBasket.getBarcode())){//只有支持扫固定条码的包,才去统计 + //已存在 则取出该对象,对象中 objAmount 累加。 + JSONObject obj = resultMap.get(key); + int amt=(int) obj.get("objAmount"); + amt++; + obj.put("objAmount", amt); + obj.put("objBarcode", tousseInstanceManager.getTousseInsFixedBarcode(tousseOutsideBasket.getTousseName())); + //覆盖 + resultMap.put(key, obj); + }else{ + //不存在,则新增 + JSONObject obj = new JSONObject(); + obj.put("depart", tousseOutsideBasket.getDepart()); + obj.put("objName", tousseOutsideBasket.getShowTousseName()); + obj.put("objBarcode", tousseOutsideBasket.getBarcode()); + obj.put("objAmount", 1); + obj.put("reviewTime", ForgonDateUtils.safelyFormatDate(tousseOutsideBasket.getReviewTime(), Constants.SIMPLEDATEFORMAT_YYYYMMDDHHMM, "")); + obj.put("type", "TOUSSE"); + obj.put("uiProvider", "col"); + obj.put("leaf", true); + obj.put("cls", isTimeout ? "itemTimeout" : "master-task"); + obj.put("iconCls", "task"); + obj.put("isTimeout", isTimeout); + if(tousseOutsideBasket.getIsUrgentTousse() != null && tousseOutsideBasket.getIsUrgentTousse().equals(TousseDefinition.STR_YES )){ + obj.put("isUrgent", TousseDefinition.STR_YES); + }else{ + obj.put("isUrgent", TousseDefinition.STR_NO); + } + if(tousseInstanceManager.isCountBarcode(tousseOutsideBasket.getBarcode())){//只有支持扫固定条码的包,才去统计 + resultMap.put(key, obj); + }else{ + resultMap.put(tousseOutsideBasket.getBarcode(), obj); + } + } + } // 加载未入筐的器械包 - for (TousseInstance tousseOutsideBasket : toussesOutsideBasketOfToday) { + /*for (TousseInstance tousseOutsideBasket : toussesOutsideBasketOfToday) { boolean isTimeout = timeoutManager.isTimeouted(tousseOutsideBasket.getReviewTime(), timeoutSetting); //器械包的灭菌程序,属于此灭菌分组或者此灭菌炉(或者器械包的灭菌程序为“无”)才会显示(没选灭菌炉就按灭菌分组过滤) if (sterilingTypeMap != null && !Constants.HAS_TYPE_NO.equals(tousseOutsideBasket.getSterilingType())) { @@ -1010,7 +1083,6 @@ continue; } } - JSONObject obj = new JSONObject(); obj.put("depart", tousseOutsideBasket.getDepart()); obj.put("objName", tousseOutsideBasket.getShowTousseName()); @@ -1034,9 +1106,14 @@ }else{ notTimeoutArray.add(obj); } - } - - jsonArray.addAll(notTimeoutArray); //未超时的加到最后 + }*/ + List resultList=Lists.newArrayList(); + for (String key : resultMap.keySet()) { + JSONObject obj = resultMap.get(key); + resultList.add(obj); + } + jsonArray.addAll(notTimeoutArray); //未超时的加到最后 + jsonArray.addAll(resultList); @SuppressWarnings("unchecked") Iterator it = jsonArray.iterator(); while (it.hasNext()) { @@ -1047,7 +1124,7 @@ it.remove(); } } - } + } StrutsResponseUtils.output(jsonArray); } catch (Exception e) { e.printStackTrace(); @@ -1631,4 +1708,6 @@ } StrutsResponseUtils.output(result); } + + } \ No newline at end of file Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManagerImpl.java =================================================================== diff -u -r21542 -r21796 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManagerImpl.java (.../TousseInstanceManagerImpl.java) (revision 21542) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManagerImpl.java (.../TousseInstanceManagerImpl.java) (revision 21796) @@ -6,6 +6,7 @@ import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Date; @@ -1162,6 +1163,26 @@ } return false; } + + /** + * 判断用户扫描的是不是固定条码 + * @param barcode 输入的条码 + * @return + */ + public boolean equalsBarcode(String barcode){ + int i =0; + String isFixedBarcodeSql = "select count(0) from TousseDefinition td join TousseInstance ti on ti.tousseDefinition_id=td.id " + + "join barcodeDevice bd on bd.id =ti.id where ti.tousseFixedBarcode=1 and bd.barcode = '"+barcode+"'"; + + i = objectDao.countBySql(isFixedBarcodeSql); + + if(i>0){//是固定条码 + return true; + } + return false; + } + + @Override public void updateTousseExpirationDate(String barcode, Date validDate) { @@ -3229,4 +3250,258 @@ throw new RuntimeException ("系统发生异常,请联系管理员"); } } + + /** + * 固定条码支持修改数量 对应的增加方法 + * @param fixedBarcode 固定条码 + * @param barcodes 已有的条码集合,用逗号分割 + * @param addAmount 增加的数量 + * @return + */ + @Override + public String fixedBarcodeBarcodeAdd(String fixedBarcode, String barcodes,int addAmount) { + if(!StringUtils.isNotBlank(barcodes) && StringUtils.isNotBlank(fixedBarcode)){ + throw new RuntimeException("tousseName 或 barcodes为空"); + } + + List barcodeList =getTousseInsDataByFixedBarcode(fixedBarcode,barcodes,"灭菌记录"); + System.out.println("可增加的数据"+barcodeList); + System.out.println("要加的数量:"+addAmount); + String resultStr=""; + if(StringUtils.isNotBlank(barcodes)){ + for(int i =0;i oldBarcodesList = new ArrayList(); + //将已扫描过的条码转成List + for(int i=0;i barcodeList =getTousseInsDataByFixedBarcode(fixedBarcode,"","灭菌记录"); + + //筛选符合删除条件的条码 + oldBarcodesList.retainAll(barcodeList); + + //页面上已扫描的条码转成List + ArrayList arrayList = new ArrayList(Arrays.asList(oldBarcodes)); + + + //移除数据 + for(int i=0;i getTousseInsDataByFixedBarcode(String fixedBarcode,String barcodes ,String type){ + String idStr = checkIsFixedBarcode(fixedBarcode); + TousseDefinition td = null; + if(StringUtils.isNotBlank(idStr)){ + td = (TousseDefinition) objectDao.getByProperty(TousseDefinition.class.getSimpleName(), "id", Long.parseLong(idStr)); + } + String userCode = AcegiHelper.getLoginUser().getCurrentOrgUnitCode(); + if(null!=td){ + String findSql = ""; + barcodes=StringUtils.isNotBlank(barcodes)?barcodes:"0"; + if(TousseDefinition.PACKAGE_TYPE_INSIDE.equals(td.getTousseType())){//器械包 + findSql =" select ti.id,ti.tousseName,bd.barcode from TousseInstance ti left join " + + " ProxyDisinfection pd on ti.proxyDisinfection_id=pd.id left join invoicePlan ip on " + + " ip.id=pd.id join barcodeDevice bd on bd.id = ti.id where tousseDefinition_id="+td.getId()+" " + + " and((ti.proxyDisinfection_id is not null and ip.handleDepartCoding='"+userCode+"') or " + + " (ti.proxyDisinfection_id is null and ti.orgUnitCoding='"+userCode+"')) " + + " and reviewBasket_id is null and bd.barcode not in ("+barcodes+")"; + }else if(TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(td.getTousseType())){//消毒物品 + findSql =" select ti.id,ti.tousseName,bd.barcode from TousseInstance ti left join ProxyDisinfection pd on " + + " ti.proxyDisinfection_id=pd.id left join invoicePlan ip on ip.id=pd.id " + + " join barcodeDevice bd on bd.id = ti.id where tousseDefinition_id in " + + " (select id from TousseDefinition where ancestorID=1) and((ti.proxyDisinfection_id is not null and " + + " ip.handleDepartCoding='"+userCode+"')or(ti.proxyDisinfection_id is null and ti.orgUnitCoding='"+userCode+"'))" + + " and reviewBasket_id is null and bd.barcode not in ("+barcodes+") order by bd.barcode desc"; + }else{ + return null; + } + + if(type.indexOf("灭菌装载")!=-1 || type.indexOf("审核")!=-1){//灭菌装载和审核 + findSql+=" and ti.orgUnitCoding='"+userCode+"'"; + } + if(type.indexOf("灭菌记录")!=-1 || type.indexOf("灭菌装载")!=-1){//添加灭菌记录扫固定条码、灭菌装载 + findSql+=" and status = '"+TousseInstance.STATUS_REVIEWED+"'";//已审核 + } + if(type.indexOf("审核")!=-1){ + findSql+=" and status = "+TousseInstance.STATUS_PACKED+"";//已装配 + } + ResultSet rs = objectDao.executeSql(findSql); + List barcodeList = new ArrayList(); + try { + while(rs.next()){ + barcodeList.add(rs.getString("barcode")); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return barcodeList; + } + return new ArrayList(); + } + + + /** + * 从List中移除指定元素 + * @param list + * @param target + */ + public static void removeListByKey(List list, String target){ + for(int i = list.size() - 1; i >= 0; i--){ + String item = list.get(i); + if(target.equals(item)){ + list.remove(item); + } + } + } }