Index: ssts-web/src/main/webapp/disinfectsystem/common/cssdUtils.js =================================================================== diff -u -r24656 -r24685 --- ssts-web/src/main/webapp/disinfectsystem/common/cssdUtils.js (.../cssdUtils.js) (revision 24656) +++ ssts-web/src/main/webapp/disinfectsystem/common/cssdUtils.js (.../cssdUtils.js) (revision 24685) @@ -1,5 +1,10 @@ -var haveJquery = (typeof($) != 'undefined'); +function haveJquery(){ + if (typeof(jQuery) == 'undefined'){ + return false; + } + return true; +} // 根据住院号或者诊疗号加载病人信息 function loadPatientInfoByValAndType(jsonStr) { if (jsonStr != '') { @@ -97,14 +102,15 @@ } // 设置材料 function setMaterialsForPrint(tousseObj,barcode){ - var jsonObj = ""; + var jsonObj = {}; DWREngine.setAsync(false); PackingTableManager.getMaterialByBarcode(barcode,function(result){ jsonObj = JSON.parse(result); }); DWREngine.setAsync(true); setMaterialsByMaterialObjForPrint(tousseObj,jsonObj); + return jsonObj; } function setMaterialsByMaterialObjForPrint(tousseObj,jsonObj){ var materials = []; @@ -135,11 +141,26 @@ // 设置和类型有关的信息 function setTypeInfoForPrint(tousseObj,barcode){ var typeInfoObj = null; - DWREngine.setAsync(false); - PackingTableManager.getTypeInfoForPrint(barcode,function(result){ - typeInfoObj = JSON.parse(result); - }); - DWREngine.setAsync(true); + if(haveJquery()){ + $.ajax({ + url:WWWROOT+"/disinfectSystem/packingController/getTypeInfoForPrint.mhtml", + type: "post", + cache:false, + async:false, + data:{ + "barcode":barcode + }, + success:function(result){ + typeInfoObj = result; + } + }); + }else{ + DWREngine.setAsync(false); + PackingTableManager.getTypeInfoForPrint(barcode,function(result){ + typeInfoObj = JSON.parse(result); + }); + DWREngine.setAsync(true); + } if(typeInfoObj){ tousseObj.typeInfoObj = typeInfoObj; @@ -151,11 +172,27 @@ // 设置灭菌程序简称 function setSterilisationAbbreviationForPrint(tousseObj,barcode){ var sterilisationAbbreviation = ""; - DWREngine.setAsync(false); - PackingTableManager.getSterilisationAbbreviationByBarcode(barcode,function(result){ - sterilisationAbbreviation = result; - }); - DWREngine.setAsync(true); + if(haveJquery()){ + $.ajax({ + url:WWWROOT+"/disinfectSystem/packingController/getSterilisationAbbreviationByBarcode.mhtml", + type: "post", + cache:false, + async:false, + data:{ + "barcode":barcode + }, + success:function(result){ + sterilisationAbbreviation = result.sterilisationAbbreviation; + } + }); + }else{ + DWREngine.setAsync(false); + PackingTableManager.getSterilisationAbbreviationByBarcode(barcode,function(result){ + sterilisationAbbreviation = result; + }); + DWREngine.setAsync(true); + } + tousseObj.sterilisationAbbreviation = sterilisationAbbreviation; } // 记录打印日志 @@ -173,13 +210,58 @@ return; } var str = JSON.stringify(tousseObj); - DWREngine.setAsync(false); - PackingTableManager.logPrintTousse(str,barcode,function(){ - tousseObj.logPrintTousse = false; - }); - DWREngine.setAsync(true); + if(haveJquery()){ + $.ajax({ + url:WWWROOT+"/disinfectSystem/packingController/logPrintTousse.mhtml", + type: "post", + cache:false, + async:false, + data:{ + "barcode":barcode, + "tousse":str + }, + success:function(result){ + tousseObj.logPrintTousse = false; + } + }); + }else{ + DWREngine.setAsync(false); + PackingTableManager.logPrintTousse(str,barcode,function(){ + tousseObj.logPrintTousse = false; + }); + DWREngine.setAsync(true); + } } + +function cssdUtils_findForeignTousseApplication(tousseObj){ + var foreignTousseAppInfo = {}; + if(haveJquery()){ + $.ajax({ + url:WWWROOT+"/disinfectSystem/application/foreignTousseApplicationController/findForeignTousseApplication.mhtml", + type: "post", + cache:false, + async:false, + data:{ + "foreignTousseAppId":tousseObj.foreignTousseApp_id + }, + success:function(result){ + foreignTousseAppInfo = result; + } + }); + }else{ + DWREngine.setAsync(false); + ForeignTousseApplicationTableManager.findForeignTousseApplication(tousseObj.foreignTousseApp_id,function(result){ + if(result != null && result.length > 0){ + foreignTousseAppInfo = JSON.parse(result); + } + }); + DWREngine.setAsync(true); + } + + return foreignTousseAppInfo; +} + function printLabel(tousseObj){ var barcodes = tousseObj.barcodes; @@ -214,13 +296,7 @@ //获取申请单需要打印的手术病人信息 var foreignTousseAppInfo = {}; if(tousseType == '外来器械包' || tousseType == '外来器械拆分小包'){ - DWREngine.setAsync(false); - ForeignTousseApplicationTableManager.findForeignTousseApplication(tousseObj.foreignTousseApp_id,function(result){ - if(result != null && result.length > 0){ - foreignTousseAppInfo = JSON.parse(result); - } - }); - DWREngine.setAsync(true); + foreignTousseAppInfo = cssdUtils_findForeignTousseApplication(tousseObj); } getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM')); if(barcodes != null && barcodes.length > 0){ @@ -260,12 +336,7 @@ defaultPrintForeignToussePackage(printSummaryObj); }else{ //打印标签纸类型(大标签打印材料/小标签不打印材料) - var jsonObj = ""; - DWREngine.setAsync(false); - PackingTableManager.getMaterialByBarcode(barcodes[j],function(result){ - jsonObj = JSON.parse(result); - }); - DWREngine.setAsync(true); + var jsonObj = setMaterialsForPrint(tousseObj,barcodes[j]); var barcodePaperType = jsonObj.barcodePaperType; if(isUndefinedOrNullOrEmpty(barcodePaperType)){ barcodePaperType = tousseObj.pageType; @@ -299,13 +370,7 @@ addDepartPrefixForTousseName(tousseObj); // 消毒物品的标签类型要从祖先定义重新获取 var barcodes = tousseObj.barcodes; - var jsonObj = ""; - DWREngine.setAsync(false); - PackingTableManager.getMaterialByBarcode(barcodes[0],function(result){ - jsonObj = JSON.parse(result); - }); - DWREngine.setAsync(true); - setMaterialsByMaterialObjForPrint(tousseObj,jsonObj); + var jsonObj = setMaterialsForPrint(tousseObj,barcodes[0]); var pageType = jsonObj.barcodePaperType; if(isUndefinedOrNullOrEmpty(pageType)){ pageType = tousseObj.pageType; @@ -375,7 +440,7 @@ } // 必须先调用此代码,然后才能调用Ext.MessageBox.updateProgress // top.Ext.MessageBox.progress('【' + tousseObj.tousseName + '】打印中', '请稍候...'); - if(haveJquery){ + if(haveJquery()){ }else{ top.Ext.MessageBox.progress('打印中', '请稍候...'); @@ -390,7 +455,7 @@ // alert('columnAmount='+columnAmount) if(columnAmount == 1){ for (var tgi=0;tgi