Index: ssts-web/src/main/webapp/disinfectsystem/config/gdszyy/print/printConfig.js =================================================================== diff -u -r34583 -r34872 --- ssts-web/src/main/webapp/disinfectsystem/config/gdszyy/print/printConfig.js (.../printConfig.js) (revision 34583) +++ ssts-web/src/main/webapp/disinfectsystem/config/gdszyy/print/printConfig.js (.../printConfig.js) (revision 34872) @@ -688,15 +688,15 @@ position : [80,"2.5%","95%","21cm"], columns : [ {header : "序号", dataIndex : '', width : '35', align : 'center'}, - {header : "申请时间", dataIndex : 'applicationTime', width : '70', align : 'center'}, + {header : "申请时间", dataIndex : 'applicationTime', width : '80', align : 'center'}, {header : "申请科室", dataIndex : 'depart', width : '70', align : 'center'}, {header : "病人所属科室", dataIndex : 'ascriptionDepartment', width : '100', align : 'center'}, {header : "住院号", dataIndex : 'hospitalNumber', width : '40', align : 'center'}, {header : "病人姓名", dataIndex : 'patient', width : '50', align : 'center'}, {header : "手术名称", dataIndex : 'surgery', width : '70', align : 'center'}, {header : "供应商", dataIndex : 'supplierName', width : '80', align : 'center'}, - {header : "物品名称", dataIndex : 'name', width : '80', align : 'center'}, - {header : "灭菌包数量", dataIndex : 'tousseAmount', width : '80', align : 'center'} + {header : "外来器械包名称", dataIndex : 'name', width : '100', align : 'center'}, + {header : "拆分总包数", dataIndex : 'tousseAmount', width : '80', align : 'center'} ] } } Index: ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseApplicationView.jsp =================================================================== diff -u -r34767 -r34872 --- ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseApplicationView.jsp (.../foreignTousseApplicationView.jsp) (revision 34767) +++ ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseApplicationView.jsp (.../foreignTousseApplicationView.jsp) (revision 34872) @@ -197,6 +197,14 @@ + + + + + + + + 外来器械包申请单 @@ -219,6 +227,7 @@ + Index: ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/modifyPatientOfForeignTousseInfoForm.js =================================================================== diff -u -r34583 -r34872 --- ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/modifyPatientOfForeignTousseInfoForm.js (.../modifyPatientOfForeignTousseInfoForm.js) (revision 34583) +++ ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/modifyPatientOfForeignTousseInfoForm.js (.../modifyPatientOfForeignTousseInfoForm.js) (revision 34872) @@ -2,6 +2,7 @@ var originalPatientInfo = {}; //修改后的病人信息 var patientInfo = {}; +var widthArr = []; var foreignToussGrid; /** * 更改病人信息提交 @@ -605,6 +606,13 @@ }], buttons: [{ xtype: 'button', + text: '导出Excel', + hidden: title !== '外来器械处理汇总单', + handler: function () { + getForeignTousseForReceivedData(2, '', title); + } + }, { + xtype: 'button', text: '打印预览', handler: function () { getForeignTousseForReceivedData(1, '', title); @@ -670,13 +678,23 @@ //获取待接收外来器械包数据 function getForeignTousseForReceivedData(printType, ids, title) { - top.Ext.MessageBox.show({ - title: '请等待', - msg: '打印中……', - width: 350, - progress: false, - closable: false - }); + if (printType == 2) { + top.Ext.MessageBox.show({ + title: '请等待', + msg: '导出中……', + width: 350, + progress: false, + closable: false + }); + } else { + top.Ext.MessageBox.show({ + title: '请等待', + msg: '打印中……', + width: 350, + progress: false, + closable: false + }); + } var startDate; var endDate; var orgUnitGroupID = ''; @@ -716,21 +734,237 @@ result.endDate = top.Ext.getCmp('endTime').getRawValue(); } if (result.data.length > 0) { - if (title == '外来器械处理汇总单') { - printForeignTousseProcessingSummaryReports(result, printType); + if (printType == 2) { + exportForeignTousseProcessingSummaryReports(result); } else { - printForeignTousseForReceived(result, printType); + if (title == '外来器械处理汇总单') { + printForeignTousseProcessingSummaryReports(result, printType); + } else { + printForeignTousseForReceived(result, printType); + } + hideMessageBox(true); } } else { - showResult('查询不到打印数据!'); + showResult('查询不到数据!'); + hideMessageBox(true); } } else { showResult(result.message); + hideMessageBox(true); } - hideMessageBox(true); }, failure: function (response, options) { showResult('获取数据失败!'); } }); +} + +//判断是否IE浏览器 +function isIE() { + if (!!window.ActiveXObject || "ActiveXObject" in window) { + return true; + } else { + return false; + } +} + +function exportExcel(data, thisID) { + var fileName = data.fileName + data.fileType; + if (isIE()) { + var tableHtml = ''; + tableHtml += data.html; + tableHtml += ''; + tableHtml = Base64.encode(encodeURI(tableHtml)); + var htmlTable = LZString.compressToEncodedURIComponent(tableHtml) + var jsFileName = "\\disinfectsystem\\reportforms\\js\\LZString.js"; + document.getElementById('thisIframe').contentWindow.document.getElementById('htmlFileName').value = fileName; + document.getElementById('thisIframe').contentWindow.document.getElementById('jsFileName').value = jsFileName; + document.getElementById('thisIframe').contentWindow.document.getElementById('htmlTable').value = htmlTable; + document.getElementById('thisIframe').contentWindow.document.getElementById('submitForm').click(); + hideMessageBox(true); + } else { + XSExport.excelExport( + thisID, + data.fileName, + false, + widthArr + ); + hideMessageBox(true); + } +} + +//导出外来器械处理汇总单 +function exportForeignTousseProcessingSummaryReports(printObj) { + var configObj = printConfig.printForeignTousseProcessingSummaryReports || {}; + widthArr = []; + var tableHtml = ""; + if (!isObjEmpty(configObj.goodsTable)) { + var rowHeight = configObj.goodsTable.rowHeight; + var fontSize = configObj.goodsTable.fontSize; + tableHtml += ""; + if (!isObjEmpty(configObj.headerFooter)) { + var label = configObj.headerFooter[0].label; + var fontSize = configObj.headerFooter[0].fontSize; + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + if (printObj.startDate && printObj.endDate) { + var label2 = configObj.headerFooter[1].label; + var fontSize2 = configObj.headerFooter[1].fontSize; + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + } + } else { + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + if (printObj.startDate && printObj.endDate) { + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + } + } + tableHtml += ""; + for (var i = 0; i < configObj.goodsTable.columns.length; i++) { + var width = configObj.goodsTable.columns[i].width; + var header = configObj.goodsTable.columns[i].header; + widthArr.push(width); + tableHtml += ""; + } + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + for (var i = 0; i < printObj.data.length - 1; i++) { + var details = printObj.data[i].details; + for (var j = 0; j < details.length; j++) { + var foreignTousseVoList = details[j].foreignTousseVoList; + for (var k = 0; k < foreignTousseVoList.length; k++) { + tableHtml += ""; + for (var m = 0; m < configObj.goodsTable.columns.length; m++) { + var width = configObj.goodsTable.columns[m].width; + var header = configObj.goodsTable.columns[m].header; + var dataIndex = configObj.goodsTable.columns[m].dataIndex; + var align = configObj.goodsTable.columns[m].align; + if (header == '序号') { + if (j == 0 && k == 0) { + tableHtml += ""; + } + } else if (dataIndex == 'name') { + tableHtml += ""; + } else if (dataIndex == 'supplierName' || dataIndex == 'tousseAmount') { + if (k == 0) { + tableHtml += ""; + } + } else { + if (j == 0 && k == 0) { + tableHtml += ""; + } + } + } + tableHtml += ""; + } + } + } + //合计 + var len = configObj.goodsTable.columns.length - 2; + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + tableHtml += "
"; + tableHtml += "" + label + ""; + tableHtml += "
"; + tableHtml += "
"; + tableHtml += "
"; + tableHtml += "外来器械处理汇总单"; + tableHtml += "
"; + tableHtml += ""; + tableHtml += "
" + header + "
" + (i + 1) + "" + foreignTousseVoList[k][dataIndex] + "" + details[j][dataIndex] + "" + printObj.data[i][dataIndex] + "
" + printObj.data.length + "" + printObj.data[printObj.data.length - 1].applicationTime + "" + printObj.data[printObj.data.length - 1].depart + "
"; + } else { + var rowHeight = 22; + var fontSize = 15; + widthArr = [35, 80, 70, 70, 40, 50, 60, 80, 100, 80]; + tableHtml += ""; + tableHtml += ""; + tableHtml += "外来器械处理汇总单"; + tableHtml += ""; + tableHtml += ""; + tableHtml += "接收时间:" + printObj.startDate + " 至 " + printObj.endDate + ""; + tableHtml += ""; + tableHtml += ""; + tableHtml += "序号"; + tableHtml += "申请时间"; + tableHtml += "申请科室"; + tableHtml += "病人所属科室"; + tableHtml += "住院号"; + tableHtml += "病人姓名"; + tableHtml += "手术名称"; + tableHtml += "供应商"; + tableHtml += "外来器械包名称"; + tableHtml += "拆分总包数"; + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + for (var i = 0; i < printObj.data.length - 1; i++) { + var details = printObj.data[i].details; + for (var j = 0; j < details.length; j++) { + var foreignTousseVoList = details[j].foreignTousseVoList; + for (var k = 0; k < foreignTousseVoList.length; k++) { + tableHtml += ""; + if (j == 0 && k == 0) { + tableHtml += "" + (i + 1) + ""; + } + if (j == 0 && k == 0) { + tableHtml += "" + printObj.data[i]['applicationTime'] + ""; + } + if (j == 0 && k == 0) { + tableHtml += "" + printObj.data[i]['depart'] + ""; + } + if (j == 0 && k == 0) { + tableHtml += "" + printObj.data[i]['ascriptionDepartment'] + ""; + } + if (j == 0 && k == 0) { + tableHtml += "" + printObj.data[i]['hospitalNumber'] + ""; + } + if (j == 0 && k == 0) { + tableHtml += "" + printObj.data[i]['patient'] + ""; + } + if (j == 0 && k == 0) { + tableHtml += "" + printObj.data[i]['surgery'] + ""; + } + if (k == 0) { + tableHtml += "" + details[j]['supplierName'] + ""; + } + tableHtml += "" + foreignTousseVoList[k]['name'] + ""; + if (k == 0) { + tableHtml += "" + details[j]['tousseAmount'] + ""; + } + tableHtml += ""; + } + } + } + //合计 + tableHtml += ""; + tableHtml += "" + printObj.data.length + ""; + tableHtml += "" + printObj.data[printObj.data.length - 1].applicationTime + ""; + tableHtml += "" + printObj.data[printObj.data.length - 1].depart + ""; + tableHtml += ""; + tableHtml += ""; + tableHtml += ""; + } + + document.getElementById('thisIframe').contentWindow.document.getElementById('table').innerHTML = tableHtml; + + var title = '外来器械处理汇总单(' + printObj.startDate + '至' + printObj.endDate + ')'; + var data = { + fileName: title, + fileType: ".xls",//文档类型 经测试 可以doc xls html 其他的自己去试 + html: tableHtml + } + setTimeout(function () { + exportExcel(data, document.getElementById('thisIframe').contentWindow.document.getElementById('table')); + }, 1000); } \ No newline at end of file