Index: ssts-web/src/main/webapp/disinfectsystem/invoice/synOperationReservationForm.js =================================================================== diff -u -r25257 -r29937 --- ssts-web/src/main/webapp/disinfectsystem/invoice/synOperationReservationForm.js (.../synOperationReservationForm.js) (revision 25257) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/synOperationReservationForm.js (.../synOperationReservationForm.js) (revision 29937) @@ -34,6 +34,18 @@ text: '开始手动同步', iconCls: 'btn_ext_add', handler: syncApplication + }, + { + xtype: 'button', + text: '导出Excel文件', + iconCls: 'btn_ext_download', + handler: function() { + var startTime = top.Ext.getCmp("startDate2").getValue(); + var endTime = top.Ext.getCmp("endDate2").getValue(); + var startTimeStr = Ext.util.Format.date(startTime, 'Y-m-d'); + var endTimeStr = Ext.util.Format.date(endTime, 'Y-m-d'); + location.href = WWWROOT + "/disinfectsystem/invoice/exportOperationReservation.jsp?startTime=" + startTimeStr + "&endTime=" + endTimeStr; + } } ]; @@ -51,9 +63,12 @@ {name : 'operatingRoom'}, {name : 'hospitalNumber'}, {name : 'patientName'}, + {name : 'patientSex'}, {name : 'deptName'}, {name : 'operationTime'}, - {name : 'scheduleId'} + {name : 'scheduleId'}, + {name : 'washHandNurse'}, + {name : 'circuitNurse'} ] ); @@ -82,11 +97,14 @@ {header : "住院号",width : 70,dataIndex : 'hospitalNumber'}, {header : "病人姓名",width : 70,dataIndex : 'patientName'}, {header : "病人年龄",width : 70,dataIndex : 'patientAge'}, + {header : "病人性别",width : 70,dataIndex : 'patientSex'}, {header : "病区",width : 70,dataIndex : 'deptName'}, {header : "手术时间",width : 120,dataIndex : 'operationTime', renderer : function myDateFormatByMinute(v, p, record){ return timestampToTime(v.time); }}, - {id:'scheduleId',width : 70 ,header : "手术编号",dataIndex : 'scheduleId'} + {id:'scheduleId',width : 70 ,header : "手术编号",dataIndex : 'scheduleId'}, + {header : "洗手护士",width : 70,dataIndex : 'washHandNurse'}, + {header : "巡回护士",width : 70,dataIndex : 'circuitNurse'} ]); //翻页 Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/operationreservation/service/OperationReservationManager.java =================================================================== diff -u -r25257 -r29937 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/operationreservation/service/OperationReservationManager.java (.../OperationReservationManager.java) (revision 25257) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/operationreservation/service/OperationReservationManager.java (.../OperationReservationManager.java) (revision 29937) @@ -4,6 +4,8 @@ import java.util.Date; import java.util.List; +import javax.servlet.ServletOutputStream; + import net.sf.json.JSONObject; import com.forgon.disinfectsystem.entity.basedatamanager.operationNameManager.OperationUseTousseItem; @@ -93,4 +95,10 @@ * @param endArgument timer.xml的Argument设置的过滤手术结束时间条件参数 */ public void timingSyncOperationReservation(String startArgument,String endArgument); + + /** + * 导出手术预约单(SZSDSRMYY-38) + */ + public void exportOperationReservation(Date startDate, Date endDate, ServletOutputStream outputStream); + } Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/operationreservation/service/OperationReservationManagerImpl.java =================================================================== diff -u -r27331 -r29937 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/operationreservation/service/OperationReservationManagerImpl.java (.../OperationReservationManagerImpl.java) (revision 27331) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/operationreservation/service/OperationReservationManagerImpl.java (.../OperationReservationManagerImpl.java) (revision 29937) @@ -1,5 +1,7 @@ package com.forgon.disinfectsystem.operationreservation.service; +import java.io.FileInputStream; +import java.io.IOException; import java.sql.ResultSet; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -16,13 +18,22 @@ import java.util.Set; import java.util.stream.Collectors; +import javax.servlet.ServletOutputStream; + import net.sf.json.JSONArray; import net.sf.json.JSONObject; import net.sf.json.JsonConfig; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.lang.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; +import org.apache.poi.ss.util.Region; import org.springframework.beans.factory.annotation.Autowired; import com.forgon.Constants; @@ -48,14 +59,19 @@ import com.forgon.disinfectsystem.operationreservation.vo.OperationReservationVo; import com.forgon.disinfectsystem.tousse.toussedefinition.service.TousseDefinitionManager; import com.forgon.disinfectsystem.tousseitem.service.TousseItemManager; +import com.forgon.excel.service.ExcelUtils; +import com.forgon.exception.SystemException; import com.forgon.log.model.Log; import com.forgon.log.service.LogManager; import com.forgon.serialnumber.model.SerialNum; import com.forgon.serialnumber.service.SerialNumManager; import com.forgon.tools.GB2Alpha; import com.forgon.tools.GB2WB; +import com.forgon.tools.Path; import com.forgon.tools.date.DateTools; import com.forgon.tools.db.DatabaseUtil; +import com.forgon.tools.excel.ExcelCellStyle; +import com.forgon.tools.excel.ExcelHelper; import com.forgon.tools.hibernate.BasePoManagerImpl; import com.forgon.tools.json.DateJsonValueProcessor; import com.forgon.tools.json.JSONUtil; @@ -1166,4 +1182,169 @@ return null; } } + + @Override + public void exportOperationReservation(Date startDate, Date endDate, ServletOutputStream outputStream) { + if(startDate == null || endDate == null){ + throw new SystemException("参数错误!"); + } + List hrpInvoicePlanList = this.findSyncOperationReservationByTime(startDate,endDate); + if(CollectionUtils.isEmpty(hrpInvoicePlanList)){ + throw new SystemException("手术预约单不存在!"); + } + createOperationReservationExportFile(hrpInvoicePlanList, outputStream); + } + + /** + * 生成Excel文件 + * @param hrpInvoicePlanList + * @param outputStream + */ + private void createOperationReservationExportFile(List hrpInvoicePlanList, ServletOutputStream outputStream) { + HSSFWorkbook wb = buildExcelFile(outputStream); + HSSFSheet sheet = wb.getSheetAt(0); + HSSFCellStyle cellStyle = buildExcelStyle(wb); + int sheetColumnSize = 0; + buildExcelCell(hrpInvoicePlanList, wb, sheet, cellStyle, sheetColumnSize); + sheetColumnSize = sheet.getRow(1).getPhysicalNumberOfCells(); + //调整列宽度 + for(int i=0;i hrpInvoicePlanList, + HSSFWorkbook wb, HSSFSheet sheet, HSSFCellStyle cellStyle, int sheetColumnSize) { + if(CollectionUtils.isEmpty(hrpInvoicePlanList)){ + return; + } + + // 标题合并单元格的个数 + int rowspanLength = 14; + //标题 + HSSFCellStyle titleCellStyle = buildNullCellStyle(wb); + HSSFFont font = wb.createFont(); + font.setFontHeightInPoints((short) 14); // 设置字体大小为14 + font.setFontName("宋体"); + font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + titleCellStyle.setFont(font); + sheet.addMergedRegion(new Region(0, (short)0, 0, (short)rowspanLength)); + HSSFRow operatingRow0 = sheet.createRow(0); + String title = "手术预约单列表"; + ExcelUtils.createStringCell(operatingRow0, titleCellStyle, 0, title); + + int row = 1; + //列头 + HSSFRow operatingRow1 = sheet.createRow(row); + + sheetColumnSize = 0; + HSSFCellStyle nullCellStyle = buildNullCellStyle(wb); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "申请单号"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "手术名称"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "手术台次"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "医生"); + + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "手术间"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "住院号"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "病人姓名"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "病人性别"); + + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "病人年龄"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "病区"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "手术时间"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "手术编号"); + + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "洗手护士"); + ExcelUtils.createStringCell(operatingRow1, nullCellStyle, sheetColumnSize++, "巡回护士"); + + row++; + + for(int i=0;i +<%@page contentType="text/html; charset=UTF-8"%> +<%@page import="com.forgon.disinfectsystem.operationreservation.service.*"%> +<%@page import="com.forgon.disinfectsystem.inventorymanagement.model.HrpInvoicePlan"%> +<%@page import="java.util.ArrayList"%> +<%@page import="java.util.Arrays"%> +<%@page import="java.util.List"%> +<%@page import="java.util.Date"%> +<%@page import="org.apache.commons.lang.StringUtils"%> +<%@page import="com.forgon.tools.util.SqlUtils"%> +<%@page import="com.forgon.tools.*,org.apache.commons.lang.*,com.forgon.directory.service.*"%> +<% +String fileName= "手术预约单列表.xls"; +ServletOutputStream servletOutputStream = response.getOutputStream(); +response.setContentType("application/octet-stream"); +response.addHeader("Content-Disposition","attachment;filename=" + new String(fileName.getBytes("GBK"), "ISO8859_1")); +OperationReservationManager operationReservationManager = (OperationReservationManager)SpringBeanManger.getBean("operationReservationManager"); +String startTimeStr = request.getParameter("startTime"); +String endTimeStr = request.getParameter("endTime"); +if(StringUtils.isNotBlank(startTimeStr) && StringUtils.isNotBlank(endTimeStr)){ + startTimeStr = startTimeStr + " 00:00:00"; + endTimeStr = endTimeStr + " 23:59:59"; + Date startTime = DateTools.coverStrToDate(startTimeStr, DateTools.COMMON_DATE_HMS); + Date endTime = DateTools.coverStrToDate(endTimeStr, DateTools.COMMON_DATE_HMS); + operationReservationManager.exportOperationReservation(startTime, endTime, servletOutputStream); +} +servletOutputStream.flush(); +out.clear(); +out = pageContext.pushBody(); +%> \ No newline at end of file