Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/common/CssdUtils.java =================================================================== diff -u -r23080 -r23136 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/common/CssdUtils.java (.../CssdUtils.java) (revision 23080) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/common/CssdUtils.java (.../CssdUtils.java) (revision 23136) @@ -14,7 +14,9 @@ import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; +import java.util.Collection; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; @@ -1383,4 +1385,40 @@ return null; } + /** + * 对比两个集合,取出不同的元素 + * @param list1 + * @param tousseInstanceBarcodes + * @return + */ + public static List getDiffrentList(Collection list1, Collection tousseInstanceBarcodes) { + List diff = new ArrayList(); + List maxList = (List) list1; + List minList = (List) tousseInstanceBarcodes; + if(tousseInstanceBarcodes.size()>list1.size()) + { + maxList = (List) tousseInstanceBarcodes; + minList = (List) list1; + } + Map map = new HashMap(maxList.size()); + for (String string : maxList) { + map.put(string, 1); + } + for (String string : minList) { + if(map.get(string)!=null) + { + map.put(string, 2); + continue; + } + diff.add(string); + } + for(Map.Entry entry:map.entrySet()) + { + if(entry.getValue()==1) + { + diff.add(entry.getKey()); + } + } + return diff; + } } Index: ssts-web/src/main/webapp/disinfectsystem/interfere/interfereSterilizationView1.js =================================================================== diff -u -r17202 -r23136 --- ssts-web/src/main/webapp/disinfectsystem/interfere/interfereSterilizationView1.js (.../interfereSterilizationView1.js) (revision 17202) +++ ssts-web/src/main/webapp/disinfectsystem/interfere/interfereSterilizationView1.js (.../interfereSterilizationView1.js) (revision 23136) @@ -62,7 +62,11 @@ var sterilizationMethod = record.data.sterilizationType; var sterilizationUser = record.data.sterilizationUser; var str = ""; - str = ""; + if("灭菌完成"==status){ + str = ""; + }else{ + str = ""; + } return str; } Index: ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/service/SterilizationRecordManagerImpl.java =================================================================== diff -u -r23067 -r23136 --- ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/service/SterilizationRecordManagerImpl.java (.../SterilizationRecordManagerImpl.java) (revision 23067) +++ ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/service/SterilizationRecordManagerImpl.java (.../SterilizationRecordManagerImpl.java) (revision 23136) @@ -74,6 +74,7 @@ import com.forgon.disinfectsystem.vo.SimpleInfoVo; import com.forgon.disinfectsystem.vo.TousseSimpleVO; import com.forgon.exception.SystemException; +import com.forgon.exception.service.ExceptionHandler; import com.forgon.log.model.Log; import com.forgon.log.service.LogManager; import com.forgon.runwithtrans.model.RunWithTransNewTask; @@ -92,6 +93,7 @@ import com.forgon.tools.string.StringTools; import com.forgon.tools.util.ForgonDateUtils; import com.google.common.collect.Maps; +import com.ibm.db2.jcc.am.ne; /** * @author WangYi 2012-2-24 @@ -135,8 +137,14 @@ private SterileUnloadScanTousseManager sterileUnloadScanTousseManager; + private ExceptionHandler exHandler; + + public void setExHandler(ExceptionHandler exHandler) { + this.exHandler = exHandler; + } + public void setSterileUnloadScanTousseManager( SterileUnloadScanTousseManager sterileUnloadScanTousseManager) { this.sterileUnloadScanTousseManager = sterileUnloadScanTousseManager; @@ -3664,4 +3672,208 @@ appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_STERILIZATION, Log.TYPE_UPDATE, description); save(record); } + + @Override + public Map updateSterilizationRecordInterfere( + SterilizationRecord sterilizationRecord, + Collection tousseInstanceBarcodes, + Collection containerBarcodes, + Long originalSterilizationRecordId, + Map barcodePositionMap) { + + Map result = new HashMap(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + //器械包条码增加单引号 + Collection tousseInstanceBarcodesInclude = new ArrayList(); + SterilizationRecord sr = (SterilizationRecord) objectDao.getByProperty(SterilizationRecord.class.getSimpleName(), + "id", sterilizationRecord.getId()); + if(CollectionUtils.isNotEmpty(tousseInstanceBarcodes)){ + for(String tousseInstanceBarcode : tousseInstanceBarcodes){ + tousseInstanceBarcodesInclude.add("'" + tousseInstanceBarcode + "'"); + } + //=========================处理新增器械包 + //新增器械包的处理 + String findTousseInsSql = "select * from TousseInstance ti join barcodeDevice bd on bd.id = ti.id where bd.barcode " + +" in (" + StringUtils.join(tousseInstanceBarcodesInclude.toArray() , ",") + ")" + + "and status = '已审核'"; + String insertSql = "insert into sterilization_tousseInstance (sterilizationRecord_id,tousseInstance_id) values (%s,%s)"; + ResultSet rs = null; + try { + rs = objectDao.executeSql(findTousseInsSql); + while(rs.next()){ + TousseInstance ti = (TousseInstance) objectDao.getByProperty(TousseInstance.class.getSimpleName(), "id", rs.getLong("id")); + if(TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(rs.getString("type"))){ + ti.setStatus(TousseInstance.STATUS_DISINFECTED); + }else{ + ti.setStatus(TousseInstance.STATUS_STERILED); + } + ti.setSterileEndTime(sdf.format( sr.getEndDate())); + ti.setSterileStartTime(sdf.format( sr.getStartDate())); + ti.setSterilizationRecord_id(sr.getId()); + ti.setSterilizationUser(sr.getSterilizationUser()); + ti.setSterilizerName(sr.getSterilizerName()); + ti.setSterileFrequency(sr.getFrequency()+""); + ti.setSterilingType(sr.getSterilizationType()); + objectDao.saveOrUpdate(ti); + objectDao.excuteSQL(String.format(insertSql, sr.getId(),ti.getId()));//中间表插入数据 + } + } catch (Exception e) { + e.printStackTrace(); + result.put(JSONUtil.JSON_KEY_SUCCESS, false); + result.put(JSONUtil.JSON_KEY_MESSAGE, exHandler.handleException(e)); + return result; + }finally{ + DatabaseUtil.closeResultSetAndStatement(rs); + } + } + //=========================处理删除器械包 + //删除的器械包处理 + List tousseInstanceList = sr.getTousseInstanceList(); + List oldBarcodeList = new ArrayList(); + for (TousseInstance ti : tousseInstanceList) { + oldBarcodeList.add(ti.getBarcode()); + } + String deleteSql = " delete from sterilization_tousseInstance where tousseInstance_id = %s"; + //取出删除了的包,放到新的集合中。 + List newBarcodeList = CssdUtils.getDiffrentList(oldBarcodeList, tousseInstanceBarcodes); + BarcodeDevice barcodeDevice = null; + //对删除的包回滚到灭菌前的状态 + for (String barcode : newBarcodeList) { + barcodeDevice = barcodeManager.getBarcodeByBarcode(barcode); + TousseInstance ti = (TousseInstance) barcodeDevice; + if(TousseInstance.STATUS_SHIPPED.equals(ti.getStatus()) || + TousseInstance.STATUS_USED.equals(ti.getStatus())|| + TousseInstance.STATUS_DISCARD.equals(ti.getStatus()) ){ + result.put(JSONUtil.JSON_KEY_SUCCESS, false); + result.put(JSONUtil.JSON_KEY_MESSAGE, ""+ti.getTousseName()+"处于"+ti.getStatus()+"状态不允许删除"); + System.out.println(""+ti.getTousseName()+"处于"+ti.getStatus()+"状态不允许删除"); + return result; + } + ti.setSterileEndTime(null); + ti.setStatus(TousseInstance.STATUS_REVIEWED); + ti.setSterileStartTime(null); + ti.setSterilizationRecord_id(null); + ti.setSterilizationUser(null); + ti.setSterilizerName(null); + ti.setSterileFrequency(null); + ti.setSterilingType(null); + try { + objectDao.saveOrUpdate(ti); + objectDao.excuteSQL(String.format(deleteSql, ti.getId()));//断掉灭菌记录和包实例中间表的关系 + } catch (Exception e) { + e.printStackTrace(); + result.put(JSONUtil.JSON_KEY_SUCCESS, false); + result.put(JSONUtil.JSON_KEY_MESSAGE, exHandler.handleException(e)); + return result; + } + + } + + //=========================处理新增篮筐 + //新增篮筐的处理 + List oldReviewedBasketList = sr.getReviewedBaskets();//旧的篮筐 + List newReviewedBasketList = new ArrayList();//新篮筐 + if(CollectionUtils.isNotEmpty(containerBarcodes)){ + loop1:for (String barcode : containerBarcodes) { + ReviewedBasket reviewedBasket = reviewedBasketManager .getReviewedBasketButNew(barcode); + //找不到则跳过 + if (reviewedBasket == null) { + continue; + } + //排除掉已在该条灭菌的篮筐, + for (ReviewedBasket oldRb : oldReviewedBasketList) { + if(oldRb.getContainer().getBarcode().equals(barcode)){ + continue loop1; + } + } + // 设置篮筐位置 + if(barcodePositionMap != null){ + String positoin = barcodePositionMap.get(barcode); + if(StringUtils.isNotBlank(positoin)){ + reviewedBasket.setSterilizerPosition(positoin); + } + } + newReviewedBasketList.add(reviewedBasket); + reviewedBasket.getContainer().setStatus( Container.CONTAINER_STATUS_FREE);//设置篮筐为空闲 + objectDao.saveOrUpdate(reviewedBasket.getContainer()); + objectDao.saveOrUpdate(reviewedBasket); + } + //如果有新增篮筐,则保存进当前灭菌记录 + if(CollectionUtils.isNotEmpty(newReviewedBasketList)){ + for (ReviewedBasket rb : newReviewedBasketList) { + List tiList = objectDao.findByProperty(TousseInstance.class.getSimpleName(), "reviewBasket_id", rb.getId()+""); + //循环每一个篮筐下的包 + for (TousseInstance ti : tiList) { + if(TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(ti.getType())){ + ti.setStatus(TousseInstance.STATUS_DISINFECTED); + }else{ + ti.setStatus(TousseInstance.STATUS_STERILED); + } + ti.setSterileEndTime(sdf.format( sr.getEndDate())); + ti.setSterileStartTime(sdf.format( sr.getStartDate())); + ti.setSterilizationRecord_id(sr.getId()); + ti.setSterilizationUser(sr.getSterilizationUser()); + ti.setSterilizerName(sr.getSterilizerName()); + ti.setSterileFrequency(sr.getFrequency()+""); + objectDao.saveOrUpdate(ti); + } + rb.getContainer().setStatus( Container.CONTAINER_STATUS_FREE);//设置篮筐为空闲 + objectDao.saveOrUpdate(rb.getContainer()); + objectDao.saveOrUpdate(rb); + } + oldReviewedBasketList.addAll(newReviewedBasketList); + sr.setReviewedBaskets(oldReviewedBasketList); + objectDao.saveOrUpdate(sr); + } + } + + + + //=========================处理移除篮筐 + try { + //移除篮筐的处理 + String delReviewedBasketSql = "delete sterilization_reviewed where reviewedBasket_id =%s and sterilizationRecord_id = "+sr.getId()+" "; + //需要移除的篮筐条码 + List containerBarcodeList = new ArrayList(); + //需要移除的篮筐实例 + List delReviewedBasketList = new ArrayList(); + //删除篮筐的处理 + for (ReviewedBasket reviewedBasket : oldReviewedBasketList) { + containerBarcodeList.add(reviewedBasket.getBarcode()); + } + ResultSet rs = null; + //找到删除的篮筐条码 + List newContainerBarcodes = CssdUtils.getDiffrentList(containerBarcodeList, containerBarcodes); + String findReviewBasketIdSql = "select rb.id from ReviewedBasket rb join Container c on rb.container_id = c.id join barcodeDevice bd on bd.id = c.id where bd.barcode in ('%s') and rb.id in(select reviewedBasket_id from sterilization_reviewed where sterilizationRecord_id = "+sr.getId()+")"; + if(CollectionUtils.isNotEmpty(newContainerBarcodes)){ + for (String barcode : newContainerBarcodes) { + rs = objectDao.executeSql(String.format(findReviewBasketIdSql, barcode)); + while(rs.next()){ + List tis = objectDao.findByProperty(TousseInstance.class.getSimpleName(), "reviewBasket_id", rs.getLong("id")); + ReviewedBasket rb = (ReviewedBasket) objectDao.getByProperty(ReviewedBasket.class.getSimpleName(), "id", rs.getLong("id")); + for (TousseInstance ti : tis) { + ti.setSterileEndTime(null); + ti.setStatus(TousseInstance.STATUS_REVIEWED); + ti.setSterileStartTime(null); + ti.setSterilizationRecord_id(null); + ti.setSterilizationUser(null); + ti.setSterilizerName(null); + ti.setSterileFrequency(null); + ti.setSterilingType(null); + objectDao.saveOrUpdate(ti); + } + rb.getContainer().setStatus(Container.CONTAINER_STATUS_STERILIZELOADING);//移除以后需要把篮筐变成灭菌装载状态 + objectDao.excuteSQL(String.format(delReviewedBasketSql, rs.getLong("id")));//移除中间表 + objectDao.saveOrUpdate(rb.getContainer()); + objectDao.saveOrUpdate(rb); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + result.put(JSONUtil.JSON_KEY_SUCCESS, true); + result.put(JSONUtil.JSON_KEY_MESSAGE, "保存成功"); + return result; + } } Index: forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDao.java =================================================================== diff -u -r22459 -r23136 --- forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDao.java (.../ObjectDao.java) (revision 22459) +++ forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDao.java (.../ObjectDao.java) (revision 23136) @@ -269,4 +269,7 @@ */ List findHqlByParam(String hql, Object[] condition, int start, int limit); + List findByProperty(String objectPOName, String propertyId, + Long propertyValue); + } Index: forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDaoImpl.java =================================================================== diff -u -r22459 -r23136 --- forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDaoImpl.java (.../ObjectDaoImpl.java) (revision 22459) +++ forgon-tools/src/main/java/com/forgon/tools/hibernate/ObjectDaoImpl.java (.../ObjectDaoImpl.java) (revision 23136) @@ -526,6 +526,15 @@ return list; } + @Override + public List findByProperty(String objectPOName, String propertyId, + Long propertyValue) { + List list = getHibernateTemplate().find( + "from " + objectPOName + " po where po." + propertyId + "=" + + propertyValue + " "); + return list; + } + @Override public List findByProperty_ForUpdate(String objectPOName,String propertyName,Object propertyValue){ String str = " =:value "; Index: ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/service/SterilizationRecordManager.java =================================================================== diff -u -r22490 -r23136 --- ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/service/SterilizationRecordManager.java (.../SterilizationRecordManager.java) (revision 22490) +++ ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/service/SterilizationRecordManager.java (.../SterilizationRecordManager.java) (revision 23136) @@ -176,6 +176,17 @@ Collection containerBarcodes, Long originalSterilizationRecordId, Map barcodePositionMap); + + + //灭菌干预的处理 + public Map updateSterilizationRecordInterfere( + SterilizationRecord sterilizationRecord, + Collection tousseInstanceBarcodes, + Collection containerBarcodes, + Long originalSterilizationRecordId, + Map barcodePositionMap); + + /** * 灭菌失败记录的处理 * @param sterilizationRecordIds 灭菌记录id的集合 Index: ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/action/TousseInstanceAction.java =================================================================== diff -u -r22987 -r23136 --- ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/action/TousseInstanceAction.java (.../TousseInstanceAction.java) (revision 22987) +++ ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/action/TousseInstanceAction.java (.../TousseInstanceAction.java) (revision 23136) @@ -64,6 +64,7 @@ import com.forgon.disinfectsystem.vo.TousseSimpleVO; import com.forgon.disinfectsystem.washanddisinfectmanager.washanddisinfectrecord.service.WashAndDisinfectRecordManager; import com.forgon.exception.TousseInstanceNotExist; +import com.forgon.exception.service.ExceptionHandler; import com.forgon.log.model.Log; import com.forgon.log.service.LogManager; import com.forgon.timeout.service.TimeoutManager; @@ -127,9 +128,15 @@ private InitDbConnection dbConnection; + private ExceptionHandler exHandler; - public void setDbConnection(InitDbConnection dbConnection) { + + public void setExHandler(ExceptionHandler exHandler) { + this.exHandler = exHandler; + } + + public void setDbConnection(InitDbConnection dbConnection) { this.dbConnection = dbConnection; } @@ -840,7 +847,7 @@ StrutsResponseUtils.output(jsonObject); } catch (Exception e) { e.printStackTrace(); - jsonObject.put("msg", "系统出错:"+e.getMessage()); + jsonObject.put(JSONUtil.JSON_KEY_MESSAGE, exHandler.handleException(e)); StrutsResponseUtils.output(jsonObject); } } Index: ssts-web/src/main/webapp/disinfectsystem/interfere/interfereRecordForm.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/interfere/interfereRecordForm.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/interfere/interfereRecordForm.js (revision 23136) @@ -0,0 +1,3405 @@ +var id; +var formObj; +var sterilizationRecordWin; +var isClickDel = false; +//灭菌物品列表的ColumnTree +var sterilizationColumnTree; +//灭菌物品列表的ColumnTree的可编辑插件 +var sterilizationColumnTreeEditer; +//灭菌物品统计的store +var tousseItemCountJsonStore; +//右边今天审核的待灭菌物品的ColumnTree +var pendingSterilizationColumnTree; +//右边卸载物品统计列表 +var sterileUnLoadScanTousseColumnTree + +//是否需要扫描灭菌员 +var scanUser = sstsConfig.hasOwnProperty('sterilizationScanUser') && sstsConfig.sterilizationScanUser; +//是否将“已扫描数量”设置为大号字体 +var enableNowScanAmount = sstsConfig.hasOwnProperty('enableNowScanAmount') && sstsConfig.enableNowScanAmount; +//是否隐藏“一键入炉”按钮 +var isHideBtnBatchAddTousse = sstsConfig.hasOwnProperty('isHideBtnBatchAddTousse') && sstsConfig.isHideBtnBatchAddTousse; +//灭菌炉名称 +var sterilizerNameTemp = ''; +//全局包实例条码 +var myBarcodes=[] + +//全局固定条码 +var myFixedBarcodes=[] + +var SHELF = "灭菌架"; +var BASKET = "灭菌筐"; +var STERILIZER = "灭菌炉"; +var STERILISATION = "灭菌程序"; +var TOUSSEINSTANCE = "器械包"; +var USER = "用户"; +var POSITION = "位置"; +var confirmLabel = "灭菌情况确认人"; + +var _biologicalMonitoringTime = 0; //此灭菌炉的生物监测持续时间 + +if(sstsConfig.hasOwnProperty('isSRFinishConfirmShowUnload') && sstsConfig.isSRFinishConfirmShowUnload){ + confirmLabel = "灭菌卸载确认人"; +} +//定义首篮筐的label变量 +var beginBarcodeLabel = '扫描条码'; +var hiddenEndBarcode = true;//隐藏尾篮筐 +if(sstsConfig.disableLoadToVirtualBasket == false){ + beginBarcodeLabel = '条码/篮筐(首)'; + hiddenEndBarcode = false;//显示尾篮筐 +} + +//条码扫描模式 +var currentScanMode = "single"; +if(sstsConfig.sterilePageScanMode && sstsConfig.sterilePageScanMode != null){ + currentScanMode = sstsConfig.sterilePageScanMode; +} + +var sterilizerJsonStore = new Ext.data.SimpleStore({ + 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(''); + } + } + } + } +}); + +//远程方法请求后台查询灭菌目录 +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'} + ] + }) +}); + + +/** + * 获取灭菌物品 + */ +function getItemTreeData(){ + 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; +} +/** + * 获取最后的位置名称 + */ +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 tousseItemCountRecord = new Ext.data.Record.create([ { + name : 'tousseName' +}, { + name : 'count', + type : 'int' +} ]); + +var monitorResutlStore = new Ext.data.SimpleStore( { + fields : [ 'value' ], + data : [['无'], ['合格'],['不合格']] +}); + +/** + * 创建节点的方法 + * @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,stockAmount,todayAmount){ + 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; + node.attributes.stockAmount = stockAmount; + node.attributes.todayAmount = todayAmount; + 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] + })); + } + } +} + +/** + * 合计器械包和灭菌筐个数 + */ +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; + //给已扫描数量(大号字体)赋值 + top.Ext.getCmp('nowScanAmount').setText(""+statisticsAmount['灭菌物品总数量']+"") +} + +/** + * 扫描灭菌架条码 + * @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], null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + + } + } + ); + } +} + +/** + * 扫描灭菌炉 + */ +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], null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + } + }); + 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], null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + } + }); + DWREngine.setAsync(true); +} +/** + * 扫描灭菌员条码 + * @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, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + } + ); + } +} +//根据条码获取位置名称 +function loadPositionByBarcode(barcode){ + if(isUndefinedOrNullOrEmpty(barcode)){ + showResult('条码不能为空!', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return ; + } + PositionTableManager.getPositionNameByBarcode(barcode,false,function(responseText){ + if(!isUndefinedOrNullOrEmpty(responseText)){ + var result = top.Ext.decode(responseText); + if(!result.success){ + showResult(result.message, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + 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('找不到该条码所对应的位置信息', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + }); +} +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,0,0); + return cloneNode; + }else{ + var cloneNode = createNode(true,barcode,name,typeForSterilizationStatistics,depart,type,position,amount,reviewTime,0,0); + var childNodes = node.attributes.children; + if(childNodes != null){ + for(var i=0;i 0){ + for(var i=0;i0){ + var myNode = createNodeForPendingStarilizationGoods(true,fixedBarcode,name,type,depart,reviewTime,amountRight-scanAmount) + pendingSterilizationColumnTree.getRootNode().appendChild(myNode); + } + } + } + }); +} + +function updateLeftFixedBarcodeAmount(fixedBarcode,scanAmount){ + var rootNode = sterilizationColumnTree.getRootNode(); + var i =0 + //循环左边的节点 + rootNode.eachChild(function(pNode){ + if (pNode != null && pNode.attributes && pNode.attributes.barcode){ + if(pNode.attributes.barcode == fixedBarcode && i<1) {//找到左边对应的条码 + i++ + var isParentNode = pNode.attributes.isParentNode; + var typeForSterilizationStatistics =pNode.attributes.typeForSterilizationStatistics; + var department = pNode.attributes.depart; + var position = pNode.attributes.position ; + var amount = parseInt(pNode.attributes.amount)+parseInt(scanAmount);//当前数量加上 扫描加载的数量 + var reviewTime = pNode.attributes.reviewTime ; + var stockAmount = pNode.attributes.stockAmount ; + var todayAmount = pNode.attributes.todayAmount ; + var barcode = pNode.attributes.barcode ; + var name = pNode.attributes.name ; + + var rootNode = sterilizationColumnTree.getRootNode(); + var parentNode = createNode(true, barcode, name, typeForSterilizationStatistics, department, '器械包', position, amount, reviewTime,0,0); + var firstChildNode = rootNode.item(0); + pNode.remove();//删除修改后的节点数据 + rootNode.appendChild(parentNode);//追加修改前的数据 + } + } + }); +} + +/** + * 针对固定条码修改数量后,动态去修改右边对应节点的数量 + * @param fixedBarcode 固定条码 + * @param editAmount 修改的数量 + * @param type 1:增加,2:减少 + */ +function editAmountComplete(fixedBarcode,editCompleteAmount,editType){ + editCompleteAmount = parseInt(editCompleteAmount) + var i=0; + var rigthAmount = getRigthFixedBarcodeAmount(fixedBarcode)//获取右边的数量 + pendingSterilizationColumnTree.getRootNode().eachChild(function(pNode){ + if (pNode != null && pNode.attributes && pNode.attributes.objBarcode) { + if(pNode.attributes.objBarcode == fixedBarcode &&i<1 ){ + i++ + var name = pNode.attributes.objName; + var type = pNode.attributes.type; + var depart = pNode.attributes.depart; + var reviewTime = pNode.attributes.reviewTime; + var amountRight = parseInt(pNode.attributes.objAmount);//右边的数量 + var rootNode = sterilizationColumnTree.getRootNode(); + pNode.remove();//移除对应右边的节点 + var resultAmount = 0; + if(editType==1){//如果是增加了数量,则对应右边要减少 + resultAmount = amountRight - editCompleteAmount + }else if(editType==2){//如果是减少了数量,则对应右边要增加 + resultAmount = amountRight + editCompleteAmount + } + if(resultAmount>0){ + var myNode = createNodeForPendingStarilizationGoods(true,fixedBarcode,name,type,"","",resultAmount) + pendingSterilizationColumnTree.getRootNode().appendChild(myNode); + } + } + } + }); + if(i==0){//没有在右边匹配到对应的条码 + var rootNode = sterilizationColumnTree.getRootNode(); + var j =0 + //循环左边的节点 + rootNode.eachChild(function(pNode){ + if (pNode != null && pNode.attributes && pNode.attributes.barcode){ + if(pNode.attributes.barcode == fixedBarcode && j<1) {//找到左边对应的条码 + i++ + var isParentNode = pNode.attributes.isParentNode; + var type = pNode.attributes.type; + var department = pNode.attributes.depart; + var position = pNode.attributes.position ; + var amount = parseInt(pNode.attributes.amount) + var reviewTime = pNode.attributes.reviewTime ; + var stockAmount = pNode.attributes.stockAmount ; + var todayAmount = pNode.attributes.todayAmount ; + var barcode = pNode.attributes.barcode ; + var name = pNode.attributes.name ; + + var rootNode = sterilizationColumnTree.getRootNode(); + var myNode = createNodeForPendingStarilizationGoods(true,barcode,name,"TOUSSE","","",editCompleteAmount) + pendingSterilizationColumnTree.getRootNode().appendChild(myNode); + } + } + }); + } +} + + +/** + * 加载条码对应的器械包 + * @param barcodeStr 器械包、灭菌篮筐、虚拟篮筐(还有可能是器械包或者虚拟篮筐的条码段) + * @param sterilizationRecordId 灭菌记录id + */ +function loadTousseInstance(barcodeStr, sterilizationRecordId,isFiexdBarcode) { + if(barcodeStr == '' || barcodeStr.length <= 0){ + showResult("请输入条码!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return; + } + if(checkRepeat(barcodeStr) && !isFiexdBarcode){//已有,并且不是固定条码 + showResult("输入的条码已存在!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return; + } + //当前灭菌程序是否可以添加灭菌物品 + var canAddTousse = sterilizationCanAddTousse(); + if(!canAddTousse){ + showResult("当前灭菌程序不能灭菌物品!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return; + } + var position = top.Ext.getCmp('position').getValue(); + sterilizationRecordWin.getEl().mask("正在加载中.请稍等...", "x-mask-loading"); + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!loadTousseInstanceInfo.do', + params : { + sterilizationRecordId : top.Ext.getCmp('id').getValue(), + 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 + "]的灭菌程序和所选的灭菌程序不同!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + + if(includeImplant == "是"){ + showResultWithoutSpeak("此外来器械包含有植入物,需要做生物监测!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + + //添加到灭菌物品视图列表的第一行 + var rootNode = sterilizationColumnTree.getRootNode(); + var parentNode = createNode(true, barcodeStr, tousseName, typeForSterilizationStatistics, department, '器械包', position, 1, reviewTime,0,0); + var firstChildNode = rootNode.item(0); + if(firstChildNode == null || firstChildNode == undefined){ + rootNode.appendChild(parentNode); + }else{ + rootNode.insertBefore(parentNode, firstChildNode); + } + speakBasket.addGoods('', tousseName, 1); + removePendingSterilizationGoods(barcodeStr) + sterilizationRecordWin.getEl().unmask(); + } else if (success == 1) {//容器(单个灭菌框或虚拟篮筐) + var tousseInstanceArr = resultData.tousseInstanceArr; //进入容器的器械包集合 + var containerName = resultData.containerName; //容器名称 + var length = tousseInstanceArr.length; + var amount=0 + if(typeof(tousseInstanceArr[0])!="undefined"){ + for(var i =0;i 0){ + top.Ext.getCmp('parameter').setValue(result); + } + }); + removePendingSterilizationGoods(barcodeStr) + sterilizationRecordWin.getEl().unmask(); + } else if(success == 2) { //不追溯器械包 + var tousseInstanceArr = resultData.tousseInstanceArr; + var length = tousseInstanceArr.length; + if (length < 1) { + showResult('未找到符合条件的器械包!', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + sterilizationRecordWin.getEl().unmask(); + 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 = parseInt(tousseInstan.amount); //每次扫描数量 + var stockAmount =parseInt(tousseInstan.stockAmount);//库存数量 + var todayAmount =parseInt(tousseInstan.todayAmount);//今日审核数量 + if(checkRepeat(tousseBarcode) && !isFiexdBarcode){ + showResult("输入的条码已存在!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + sterilizationRecordWin.getEl().unmask(); + return; + }; + if(sterilingTypeTemp != sterilingType){ + showResultWithoutSpeak("器械包[" + tousseName + "]的灭菌程序和所选的灭菌程序不同!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + if(i==0){ + myBarcodes3[0]=tousseInstan.tousseBarcode//临时存放固定条码 + //添加到灭菌物品视图列表的第一行 + var rootNode = sterilizationColumnTree.getRootNode(); + var parentNode = createNode(true, tousseBarcode, tousseName, typeForSterilizationStatistics, "", '器械包', position, amount, reviewTime,stockAmount,todayAmount); + 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);//将本次的固定条码存入全局数组 + + updateRigthFixedBarcodeAmount(tousseBarcode,amount)//修改右边节点的数量 + + }else{ + myBarcodes2[i-1]=tousseInstan.tousseBarcode //本次的包实例条码 + } + } + Array.prototype.push.apply(myBarcodes,myBarcodes2);//将所有的包实例条码存入全局条码中 + speakContent = sterilizationColumnTree.getRootNode().text; + sterilizationRecordWin.getEl().unmask(); + } else if (success == 3) { //首尾器械包,since2015-10-27 + var tousseInstanceArr = resultData.tousseInstanceArr; + var length = tousseInstanceArr.length; + if (length < 1) { + showResult('未找到符合条件的器械包!', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + sterilizationRecordWin.getEl().unmask(); + 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 + "]的灭菌程序和所选的灭菌程序不同!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + + 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('未找到符合条件的器械包或器械包已扫描至表格中.', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + speakContent = null; + } + sterilizationRecordWin.getEl().unmask(); + } else if(success == 4) { //首尾虚拟篮筐 + var tousseInstanceArr = resultData.tousseInstanceArr; + var length = tousseInstanceArr.length; + if (length < 1) { + showResult('未找到符合条件的器械包!', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + sterilizationRecordWin.getEl().unmask(); + 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 + "]的灭菌程序和所选的灭菌程序不同!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + + 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 ++; + sterilizationRecordWin.getEl().unmask(); + }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 ++; + } + } + } + sterilizationRecordWin.getEl().unmask(); + //加载灭菌参数 + SterilizationRecordTableManager.getParameter(top.Ext.getCmp('sterilizationType').getValue(),function(result){ + if(result != null && result.length > 0){ + top.Ext.getCmp('parameter').setValue(result); + } + }); + if(alreadyAdd == 0){ + sterilizationRecordWin.getEl().unmask(); + showResult('未找到符合条件的器械包或器械包已扫描至表格中.', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + speakContent = null; + } + sterilizationRecordWin.getEl().unmask(); + } else if (success == -1) { + sterilizationRecordWin.getEl().unmask(); + showResult(resultData.failureCause, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + speakBasket.speakContent(); + }else{ + sterilizationRecordWin.getEl().unmask(); + showResult("您扫描的物品非已审核的器械包或篮筐!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + } + statisticsTousseAndBasket(); //每次成功扫描条码后统计一下器械包的数量和灭菌篮筐的数量 + sterilizationRecordWin.getEl().unmask();//关闭加载进度条 + }, + failure : function(response, options) { + var result = Ext.decode(response.responseText); + showResult(result, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + sterilizationRecordWin.getEl().unmask(); + } + }); +} + +/** + * 点击一键入炉按钮,请求后台后的处理(把物品加载到灭菌物品列表) + * 器械包节点 = {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,data.amount,data.reviewTime,0,0); + } else { + var tousseInstanceArr = data.dataList + var length = tousseInstanceArr.length; + var amount=0 + //统计每个篮筐内的数量 + for(var j =0;j 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,ti.amount,ti.reviewTime,0,0); + parentNode.appendChild(childNode); + } + } + } + var firstChildNode = rootNode.item(0); + if(!firstChildNode){ + rootNode.appendChild(parentNode); + }else{ + rootNode.insertBefore(parentNode,firstChildNode); + } + } + } + statisticsTousseAndBasket(); //每次成功扫描条码后统计一下器械包的数量和灭菌篮筐的数量 +} + +/** + * 条码重复性判断,如果是单个条码,则按原有逻辑处理,否则为不重复,需要在结果中判断 + * @param barcodeStr 可以是单个器械包/篮筐条码,也可以是首尾器械包/篮筐条码,用分号分隔 + * @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; +} + +function setIsClickDel(v){ + 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(); +} + +/** + * 待灭菌物品点击按钮添加至灭菌物品栏 + * @param barcode + * @param type + * @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); +} + +/** + * 写日志 + * @param type + * @param description + */ +function buildSterilizationLogInfo(type,description){ + 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(); + } + } + } + }); +} + + +/** + * 扫描固定条码和修改数量后,修改右边表格对应的数量 + * @param barcode 条码 + * @param finalAmount 剩余可用数量 + */ +function updateAmountToFixedBarcodes(barcode,finalAmount){ + var i = 0; + finalAmount = parseInt(finalAmount); + //循环右边的节点 + 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 = parseInt(pNode.attributes.objAmount);//右边的数量 + var rootNode = sterilizationColumnTree.getRootNode(); + pNode.remove();//移除对应右边的节点 + 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 = parseInt(amount)+parseInt(objAmount) + pNode.remove();//移除对应右边的节点 + var myNode = createNodeForPendingStarilizationGoods(true,barcode,name,type,depart,reviewTime,parseInt(objAmount)) + pendingSterilizationColumnTree.getRootNode().appendChild(myNode); + } + } + }); +} + +/** + * 将器械包移除篮筐(只能移除篮筐里面的器械包,这里只是方便用户,不需要特意回到“灭菌装载”界面操作) + * @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); + } + }); + } + }); +} + +/** + * 删除灭菌物品栏,物品回退至待灭菌物品列表 + * @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 amount = clickNode.attributes.amount; + var countAmount=0 + var array = new Array(); + var isBasketUrgent = false; //篮筐是否加急 + var objAmount = 1; + if (type == '篮筐') { + type = 'BASKET'; + clickNode.eachChild(function(pNode){ + countAmount=parseInt(countAmount)+parseInt(pNode.attributes.amount) + var childObjBarcode = pNode.attributes.barcode; + var childObjName = pNode.attributes.name; + var childObjAmount = pNode.attributes.amount; + 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, countAmount==0?1:countAmount, 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 审核时间 + * @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 InterruptRecordItem = Ext.data.Record.create([ + {name : 'id'}, + {name : 'interruptUser'}, + {name : 'interruptDate'}, + {name : 'interruptFinishDate'}, + {name : 'interruptOptType'}, + {name : 'quatifyMonitoryId'} + ]); + + +/** + * 只针对固定条码 增加数量 + * @param fixedBarcode 固定条码 + * @param addAmount 修改后数量 - 修改前的数量 = 新增的数量 + */ +function addTousseInsAmount(fixedBarcode,addAmount,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 stockAmount = parseInt(editNode.attributes.stockAmount) + //修改失败后调用 + var updateFail=function roleBack(){ + //克隆修改前的数据 + var isParentNode = editNode.attributes.isParentNode; + var typeForSterilizationStatistics = editNode.attributes.typeForSterilizationStatistics; + var department = editNode.attributes.depart; + var position = editNode.attributes.position ; + var amount = editNode.attributes.amount ; + var reviewTime = editNode.attributes.reviewTime ; + var stockAmount = editNode.attributes.stockAmount ; + var todayAmount = editNode.attributes.todayAmount ; + + var rootNode = sterilizationColumnTree.getRootNode(); + var parentNode = createNode(true, barcode, name, typeForSterilizationStatistics, department, '器械包', position, oldValue, reviewTime,stockAmount,todayAmount); + var firstChildNode = rootNode.item(0); + editNode.remove();//删除修改后的节点数据 + rootNode.appendChild(parentNode);//追加修改前的数据 + sterilizationRecordWin.getEl().unmask();//关闭进度条 + } + 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);//将返回的条码添加到全局中 + editAmountComplete(fixedBarcode,addAmount,1); + top.Ext.getCmp('saveBtn').enable(); + }else{ + showResult(result.message, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + sterilizationRecordWin.getEl().unmask(); + updateFail(); + top.Ext.getCmp('saveBtn').enable(); + formObj.getEl().unmask(); + statisticsTousseAndBasket(); + } + sterilizationRecordWin.getEl().unmask(); + top.Ext.getCmp('saveBtn').enable(); + statisticsTousseAndBasket(); + }, + failure : function(response, options) { + showResult("系统发生异常,请勿提交数据", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + sterilizationRecordWin.getEl().unmask(); + formObj.getEl().unmask(); + } + }); +} + +/** + * 只针对固定条码:点击删除图标后事件 + */ +function clickDeleteIcon(clickNode){ + var i = 0; + var objName = clickNode.attributes.name; + var type = clickNode.attributes.type; + var depart = clickNode.attributes.depart; + var reviewTime = clickNode.attributes.reviewTime; + var amount = parseInt(clickNode.attributes.amount); + var delAmount = clickNode.attributes.amount + var fixedBarcode = clickNode.attributes.barcode + var todayAmount = parseInt(clickNode.attributes.todayAmount); + var stockAmount = parseInt(clickNode.attributes.stockAmount); + var node; + delTousseInsAmount(delAmount,fixedBarcode)//从全局数组中删除 + myFixedBarcodes.removeByValue(fixedBarcode);//在全局条码中移除该固定条码 + pendingSterilizationColumnTree.getRootNode().eachChild(function(pNode){ + //移除某一个节点后,再遍历其他节点得到的是undefined + if (pNode != null && pNode.attributes && pNode.attributes.objBarcode) { + if(pNode.attributes.objBarcode == fixedBarcode &&i<1 ){ + i++ + var name2 = pNode.attributes.objName; + var type2 = pNode.attributes.type; + var depart2 = pNode.attributes.depart; + var reviewTime2 = pNode.attributes.reviewTime; + var amountRight = parseInt(pNode.attributes.objAmount);//右边的数量 + var rootNode2 = sterilizationColumnTree.getRootNode(); + removePendingSterilizationGoods(fixedBarcode)//删除右边的数据 + node = createPendingSterilizationGoodsNode(fixedBarcode,objName,amount+amountRight,'TOUSSE','',reviewTime) + }else{ + if(stockAmount<0 || isNaN(stockAmount)){ + stockAmount = 0; + } + node = createPendingSterilizationGoodsNode(fixedBarcode,objName,parseInt(stockAmount)+parseInt(amount),'TOUSSE','',reviewTime) + } + } + }); + pendingSterilizationColumnTree.getRootNode().appendChild(node); + clickNode.remove();//将当前节点移除 + statisticsTousseAndBasket(); +} + +/** + * 固定条码删除数量 + * @param delAmount + * @param fixedBarcode + */ +function delTousseInsAmount(delAmount,fixedBarcode){ + top.Ext.getCmp('saveBtn').disable();//删除可能比较慢,先禁用保存按钮 + 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) { + var result = Ext.decode(response.responseText); + if(result.success){ + if(typeof(result.message)=="undefined" || result.message==""){ + myBarcodes=[]; + + }else{ + myBarcodes = result.message.split(",") + editAmountComplete(fixedBarcode,delAmount,2) + + + } + top.Ext.getCmp('saveBtn').enable(); + }else{ + showResult("减少数量失败,请勿提交数据", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + } + sterilizationRecordWin.getEl().unmask(); + top.Ext.getCmp('saveBtn').enable();//成功删除全部后,启用保存按钮 + statisticsTousseAndBasket(); + }, + failure : function(response, options) { + showResult("后台运行异常,请稍候再试...", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + formObj.getEl().unmask(); + } + }); +} + +Array.prototype.removeByValue = function(val) { + for(var i=0; i"; + } + return ''; + } + }); + + sterilizationColumnTree = new top.Ext.tree.ColumnTree({ + rootVisible:false, + autoScroll:true, + containerScroll : false, + height: 325, +// width : 355, + title:'灭菌物品列表', + frame : false, + bodyStyle : 'border:1px solid #afd7af', + columns:sterilizationColumnTreeColumnArray,//根据列头,自动解析1 + loader: new top.Ext.tree.TreeLoader({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!loadSterilizationGoods.do', + baseParams : {id:id}, + uiProviders:{ + 'col': top.Ext.tree.ColumnNodeUI + }, + listeners : { + beforeload : function(treeLoader, node){ + sterilizationColumnTree.getEl().mask("数据加载中,请稍等!"); + }, + load : function(_this, node, response) { + statisticsTousseAndBasket(); + sterilizationColumnTree.getEl().unmask(); + } + } + }), + root: new top.Ext.tree.AsyncTreeNode({ + text:'灭菌物品列表' + }) + }); + + sterilizationColumnTreeEditer = new top.Ext.tree.ColumnTreeEditor(sterilizationColumnTree, { + completeOnEnter : true, + autosize : true, + allowBlank: false, + selectOnFocus : true, + revertInvalid:true, + ignoreNoChange : true, + clicksToEdit:1 + }); + + 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){//修改后的事件 + if(newValue==oldValue){//没有修改数据 + return; + } + sterilizationRecordWin.getEl().mask("正在加载中.请稍等...", "x-mask-loading"); + top.Ext.getCmp('saveBtn').disable();//删除可能比较慢,先禁用保存按钮 + 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 stockAmount = parseInt(editNode.attributes.stockAmount) + //修改失败后调用 + var updateFail=function roleBack(){ + //克隆修改前的数据 + var isParentNode = editNode.attributes.isParentNode; + var typeForSterilizationStatistics = editNode.attributes.typeForSterilizationStatistics; + var department = editNode.attributes.depart; + var position = editNode.attributes.position ; + var amount = editNode.attributes.amount ; + var reviewTime = editNode.attributes.reviewTime ; + var stockAmount = editNode.attributes.stockAmount ; + var todayAmount = editNode.attributes.todayAmount ; + + var rootNode = sterilizationColumnTree.getRootNode(); + var parentNode = createNode(true, barcode, name, typeForSterilizationStatistics, department, '器械包', position, oldValue, reviewTime,stockAmount,todayAmount); + var firstChildNode = rootNode.item(0); + editNode.remove();//删除修改后的节点数据 + rootNode.appendChild(parentNode);//追加修改前的数据 + sterilizationRecordWin.getEl().unmask();//关闭进度条 + } + if(!reg.test(newValue)){ + showResult("请输入数字", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + updateFail() + return; + } + if(newValue==0){ + showResult("请输入大于0的数字", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + updateFail() + return; + } + var stockAmount = editNode.attributes.stockAmount ; + var todayAmount = editNode.attributes.todayAmount ; + var rigthAmount = getRigthFixedBarcodeAmount(barcode) + if(newAmount>oldAmount){//如果是增加数量 + var count = newAmount - oldAmount + if(rigthAmountoldAmount){//如果是增加数量 +// addTousseInsAmount(attr.barcode,newAmount-oldAmount,thiz,newValue,oldValue) +// }else{ +// var count = oldAmount - newAmount //减少的数量 +// delTousseInsAmount(count,attr.barcode) +// } +// }else{//修改数量失败 +// sterilizationRecordWin.getEl().unmask(); +// showResult(result.message); +// updateFail(); +// top.Ext.getCmp('saveBtn').enable(); +// } +// //每次修改数量后,进行统计 +// statisticsTousseAndBasket(); +// }, +// failure : function(response, options) { +// showResult("后台运行异常,请稍候再试..."); + +// formObj.getEl().unmask(); +// top.Ext.getCmp('saveBtn').enable(); +// sterilizationRecordWin.getEl().unmask(); +// } +// }); + + }); + + + + + sterilizationColumnTree.on("beforeclick",function(clickNode,eObj){ + if(isClickDel){ //点击删除图标 + if(myFixedBarcodes.indexOf(clickNode.attributes.barcode)!=-1){//该条码为固定条码 + sterilizationRecordWin.getEl().mask("正在删除.请稍等...", "x-mask-loading"); + clickDeleteIcon(clickNode); + }else{ + deleteGiveBackColumnTreeItem(clickNode); + + } + setIsClickDel(0); + + //统计 + 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({ + header : '名称',width : 150,dataIndex : 'objName' + }); + pendingSterilizationColumnTreeColumnArray.push({ + header : '数量',width : 45,dataIndex : 'objAmount' + }); + 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 ''; + } + }); + 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 : 40, + dataIndex : 'type', + renderer : function(v,p,record){ + var str = "\"\""; + if (record.type == 'TOUSSE_IN') { + if(currentStatus != statusEnd && currentStatus != statusFailure){ + return str; + } + } + return ''; + } + }); + + /** + * 今天审核的待灭菌物品列表 + */ + pendingSterilizationColumnTree = new top.Ext.tree.ColumnTree({ + rootVisible : false, + autoScroll : true, + containerScroll : false, + height : 520 , + frame : false, + bodyStyle : 'border:1px solid #afd7af', + tbar:['-',{id:"nowScanAmount",text:'',hidden:!enableNowScanAmount},'->',{hidden:isHideBtnBatchAddTousse,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("暂无今天审核的待灭菌记录", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return; + } + var canAddTousse = sterilizationCanAddTousse(); + if(!canAddTousse){ + showResult("当前灭菌程序不能灭菌物品!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return; + } + + //先将节点的条码存储到集合变量中 + var waitSterilingBarcodeArray = []; + //查询节点的数据是否存在,如果存在则进行循环 + Ext.each(rootNode.childNodes, function(cNode){ + waitSterilingBarcodeArray.push(cNode.attributes["objBarcode"]); + }); + +// formObj.getEl().mask("正在加载,请稍候..."); + Ext.Ajax.timeout=90000; +// pendingSterilizationColumnTree.getEl().mask("正在加载中.请稍等...", "x-mask-loading"); + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!batchAddToRecord.do', + params : { + sterilizationRecordId : top.Ext.getCmp('id').getValue(), + barcodes : waitSterilingBarcodeArray.join(";"), + loadTousseNamesInBasket : true, //是否要加载篮筐里的器械包名称 + //sterilizationRecordId : sterilizationRecordId, //灭菌记录id + checkProxyDisinfection : 'yes', //是否需要检查代理灭菌是否已录入代理灭菌单 + saveBarcode : getAlreadyScanBarcodes(), //此次扫描之前已经扫描的条码集合 + myBarcode : myBarcodes //此次扫描之前已经扫描的固定条码集合 + }, + waitMsg : '正在处理,请稍候...', + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.success){ + var fixedBarodeJsonArray = result.fixedBarodeJsonArray + var barodeJsonArray = result.barodeJsonArray + + //如果存在固定条码,则缓存在页面上 + if(fixedBarodeJsonArray && barodeJsonArray ){ + for(var f=0;f 0){ + showResult('有'+timeoutCount+'个超时未灭菌的物品,请及时处理红色标注的物品', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + } + } + } + }); + pendingSterilizationColumnTree.getEl().unmask(); + } + } + }), + root: new top.Ext.tree.AsyncTreeNode({ + text:'待灭菌物品列表' + }) + }); + + var completeColumnTreeArray =[]; + completeColumnTreeArray.push({header:'条码',width:100,dataIndex:'barcode'}); + completeColumnTreeArray.push({header:'名称',width:150,dataIndex:'tousseName'}); + completeColumnTreeArray.push({header:'科室',width:80,dataIndex:'depart'}); + completeColumnTreeArray.push({header:'数量',width:50,dataIndex:'amount'}); + sterileUnLoadScanTousseColumnTree = new top.Ext.tree.ColumnTree({ + rootVisible:false, + autoScroll:true, + height: 400, + width : 400, + title:'卸载物品统计列表', + frame : false, + containerScroll : true, + bodyStyle : 'border:1px solid #afd7af', + columns:completeColumnTreeArray, + root: new top.Ext.tree.AsyncTreeNode({ + text:'卸载物品统计列表' + }), + loader : new top.Ext.tree.TreeLoader({ + //加载卸载物品 + url : WWWROOT + '/disinfectSystem/sterilization/sterileUnloadScanTousseAction!getSterileUnloadTousseBySterileRecordId.do?'+urlParam, + uiProviders:{ + 'col': top.Ext.tree.ColumnNodeUI + }, + baseParams : {sterilizationReocrdId:id}, + listeners:{ + beforeload : function(treeLoader, node){ + sterileUnLoadScanTousseColumnTree.getEl().mask("数据重新加载中,请稍等!"); + }, + load:function(treeLoader, node, response){ + var result = Ext.decode(response.responseText); + var countAmount = parseInt(result.length) + top.Ext.getCmp('sterileUnloadTousseAmount').setText("已卸载物品总数:"+countAmount+"") + sterileUnLoadScanTousseColumnTree.getEl().unmask(); + } + } + + }) + }) + + + + 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' + }), + 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("请输入正确的条码!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + } + 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("请选择灭菌炉!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + 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("该器械包为可追溯的包,不能扫描固定条码!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + top.Ext.getCmp('inputBarcode').setValue(""); + }else if("errorBasket" == result){ + showResult("请输入正确的篮筐条码!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + top.Ext.getCmp('inputBarcode').setValue(""); + }else if("barcodeInvalid" == result){ + showResult("请输入正确的条码!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + top.Ext.getCmp('inputBarcode').setValue(""); + }else{ + showResult(result); + + top.Ext.getCmp('inputBarcode').setValue(""); + } + }else{ + showResult("请输入正确的条码!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + top.Ext.getCmp('inputBarcode').setValue(""); + } + }, + failure : function(response, options) { + sterilizationColumnTree.getEl().unmask(); + var result = Ext.decode(response.responseText); + showResult(result, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + } + }); + } + //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("请先输入条码/篮筐(首)!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + 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("首尾条码/篮筐类型不一致,必须均为器械包条码或虚拟篮筐编号!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + }else if("barcodeEndInvalid" == result){ + showResult("请输入正确的条码!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + top.Ext.getCmp('inputBarcodeEnd').setValue(""); + }else{ + showResult("请输入正确的条码!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + top.Ext.getCmp('inputBarcodeEnd').setValue(""); + } + }else{ + showResult("请输入正确的条码!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + 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, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + } + }); + } + /*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("请先保存后再上传图片!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + + }else{ + uploadWindow(imageType_sterilization); + } + } + } + ] + }, + { + layout : 'form', + columnWidth : 0.12, + labelWidth : 90, + items : [ + { xtype:'button', + text : '预览', + iconCls : 'btn_ext_application_search', + handler : function(){ + top.showSterilizationRecordPic(id,"/disinfectSystem/sterilization/bioLogicalMonitorPictureAction",'生物监测图片'); +// sterilizationRecordWin.hide(); + } + } + ] + } + ] + }] + },{ + columnWidth : .50, + id : 'sterilizationColumnTree', + items : [sterilizationColumnTree] + }, { + columnWidth : .50, + 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("不允许登记非本科室人员,请扫描本科室人员条码", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage):showResult("输入的条码有误!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return; + } + top.Ext.getCmp('monitorUser').setValue(result.fullName); + top.Ext.getCmp('monitorCheckerBarcode').focus(); + }else{ + showResult('找不到该条码所对应的人员信息', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + }); + } + } + } + } + }] + }, { + 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("不允许登记非本科室人员,请扫描本科室人员条码", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage):showResult("输入的条码有误!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return; + } + top.Ext.getCmp('monitorChecker').setValue(result.fullName); + top.Ext.getCmp('monitorAuditorBarcode').focus(); + }else{ + showResult('找不到该条码所对应的人员信息', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + }); + } + } + } + } + }] + }, { + 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("不允许登记非本科室人员,请扫描本科室人员条码", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage):showResult("输入的条码有误!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return; + } + top.Ext.getCmp('monitorAuditor').setValue(result.fullName); + }else{ + showResult('找不到该条码所对应的人员信息', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + }); + } + } + } + } + }] + }, { + 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] + }] + }] + },{ + columnWidth : (top.screen.width > 1030 ? 0.4 :0.33), + bodyStyle : 'margin-left:2px;margin-right:0px', + layout : 'fit', + items : [{ + layout : 'form', + items : [{ + xtype : "fieldset", + tbar:['-','->',{id:"sterileUnloadTousseAmount",text:''}], + title : "卸载物品列表统计", + width: 450, + height : 325, + autoScroll:true, + containerScroll : true, + items : [sterileUnLoadScanTousseColumnTree] + }] + }] + }] + }], + 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("上传图片成功", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + dialog.hide(); + }; +// //文件上传失败后的回调函数 + var onUploadFailed = function(dialog, filename, resp_data, record){ + showResult(resp_data.message, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage);//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 ? 1180 : 850, + height : top.screen.height > 800 ? 660 : 400, + plain : true, + align : 'center', + items : [ formObj ] + }); + sterilizationRecordWin.show(); + //灭菌记录 + Ext.Ajax.timeout = 180000; + formObj.form.load({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!loadSterilizationRecord.do', + method : 'GET', +// waitMsg : '正在加载数据,请稍候', + timeout:90000, + 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); + + //加载条码放至全局数组中 + var fixedBarcodes = action.result.fixedBarcodes + var barcodes = action.result.barcodes + myFixedBarcodes = fixedBarcodes.split(",") + myBarcodes = barcodes.split(",") + } + + //判断是否无条件显示循环次数 + 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); + } + }); +/* alert(sr.status) + 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{ //灭菌完成 + 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 + } + }); + + + + + 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) { + } +} +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(); +} + + +function save() { + if (!formObj.form.isValid()) { + showResult('请正确填写表单各值', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + this.enable(); + return false; + } + + + //判断当前灭菌程序是否能灭菌器械包 + var rootNode = sterilizationColumnTree.getRootNode(); + var hasGoods = rootNode.hasChildNodes(); + var canAddTousse = sterilizationCanAddTousse(); + if(false == canAddTousse && hasGoods){ + showResult("当前灭菌程序不能灭菌物品!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return false; + } + + //验证当前灭菌炉是否是灭菌中 + var objId = top.Ext.getCmp('id').getValue(); + if(objId == 0){ + DWREngine.setAsync(false); + var sign = true; + var sterilizerName = top.Ext.getCmp('sterilizerName').getValue(); + SterilizationRecordTableManager.isAllSterilizationed(sterilizerName,function(result){ + sign = result; + }); + DWREngine.setAsync(true); + if(!sign){ + showResult("当前灭菌炉正在灭菌,保存失败!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + return false; + } + } + // 验证循环计数器是否已经存在,一个灭菌炉的一个循环次数应是唯一的。 + { + 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("灭菌炉的循环次数已存在,保存失败!", null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + 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); + var barcodePostionInfo = getBarcodePositionData(); + top.Ext.getCmp("barcodePositionInfo").setValue(barcodePostionInfo); + formObj.form + .submit( { + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!savesterilizationRecord.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + params:{isInterfere:true}, + timeout:90000, + success : function(form, action) { + var result = Ext.decode(action.response.responseText); + if(result && result.message){ + sterilizationRecordWin.close(); + showResult(result.message, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + }else{ + showResult('保存成功', null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + grid.dwrReload(); + sterilizationRecordWin.close(); + }, + failure : function(form, action) { + var result = Ext.decode(action.response.responseText); + if(result && result.message){ + showResult(result.message, null , sstsConfig.messagePauseTimeOnSterilizationRecordPage); + } + } + }); + } + + if (!hasGoods){ + top.Ext.MessageBox.confirm("请确认","没有添加灭菌的物品,继续灭菌吗?", + function(button, text) { + if ("yes" == button){ + nexFn(); + }else{ + return false; + } + }); + }else{ + nexFn(); + } +} + +function cancel() { + 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; +} + +function showQualityMonitory(qualityMonitoryId){ + sterilizationRecordWin.close(); + addQualityMonitoring(qualityMonitoryId); +} \ No newline at end of file Index: ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/action/SterilizationRecordAction.java =================================================================== diff -u -r22490 -r23136 --- ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/action/SterilizationRecordAction.java (.../SterilizationRecordAction.java) (revision 22490) +++ ssts-sterile/src/main/java/com/forgon/disinfectsystem/sterilizationmanager/sterilizationrecord/action/SterilizationRecordAction.java (.../SterilizationRecordAction.java) (revision 23136) @@ -237,8 +237,12 @@ public String savesterilizationRecord() { try { Long originalRecordId = null; + String originalRecordIdStr = StrutsParamUtils.getPraramValue( "recordId", ""); + //这个字段来决定是否从干预界面进入的 + String isInterfereStr = StrutsParamUtils.getPraramValue( + "isInterfere", ""); try { originalRecordId = Long.valueOf(originalRecordIdStr); } catch (NumberFormatException ex) { @@ -268,7 +272,7 @@ } } - +// StrutsResponseUtils.output(true); Map barcodePositionMap = new HashMap(); // barcodePositionInfo 前台传入的格式 barcode,position;barcode2,position2; String[] barcodePositionArray = StringUtils.split(barcodePositionInfo, @@ -281,13 +285,21 @@ barcodePositionMap.put(barcode, position); } } - Map result = sterilizationRecordManager.saveOrUpdateSterilizationRecord( - sterilizationRecord, tousseInstanceBarcodes, - containerBarcodes, originalRecordId,barcodePositionMap); - /*Map result = new HashMap(); - result.put("success", true); - result.put("message", "aaaa");*/ - StrutsResponseUtils.output(JSONObject.fromObject(result)); + //判断是否从干预页面进入 + if(StringUtils.isNotBlank(isInterfereStr)){ + if(isInterfereStr.equals("true")){ + Map result =sterilizationRecordManager.updateSterilizationRecordInterfere( + sterilizationRecord, tousseInstanceBarcodes, + containerBarcodes, originalRecordId,barcodePositionMap); + StrutsResponseUtils.output(JSONObject.fromObject(result)); + } + }else{ + Map result = sterilizationRecordManager.saveOrUpdateSterilizationRecord( + sterilizationRecord, tousseInstanceBarcodes, + containerBarcodes, originalRecordId,barcodePositionMap); + StrutsResponseUtils.output(JSONObject.fromObject(result)); + } + } catch (Exception e) { StrutsResponseUtils.output(false,"保存失败"); } Index: ssts-web/src/main/webapp/disinfectsystem/interfere/interfereSterilizationView1.jsp =================================================================== diff -u -r16066 -r23136 --- ssts-web/src/main/webapp/disinfectsystem/interfere/interfereSterilizationView1.jsp (.../interfereSterilizationView1.jsp) (revision 16066) +++ ssts-web/src/main/webapp/disinfectsystem/interfere/interfereSterilizationView1.jsp (.../interfereSterilizationView1.jsp) (revision 23136) @@ -3,7 +3,7 @@ <%@ page contentType="text/html; charset=UTF-8"%> <%@ include file="/common/taglibs.jsp"%> - + <%@ include file="/common/includeExtJsAndCss.jsp"%> + + + + + + +