diff --git a/download/src/main/java/com/sict/excel/dto/EarlyCancerHospitalDTO.java b/download/src/main/java/com/sict/excel/dto/EarlyCancerHospitalDTO.java index 3ffe592c0115e26cf236506188a18c5335d3837b..50287f109c0d738ded6d8dc2e2d130af3b593502 100644 --- a/download/src/main/java/com/sict/excel/dto/EarlyCancerHospitalDTO.java +++ b/download/src/main/java/com/sict/excel/dto/EarlyCancerHospitalDTO.java @@ -37,54 +37,36 @@ public class EarlyCancerHospitalDTO { this.total = total; } public Integer getHighEsophagealNeoplasia() { - if (highEsophagealNeoplasia==0) { - return null; - } return highEsophagealNeoplasia; } public void setHighEsophagealNeoplasia(Integer highEsophagealNeoplasia) { this.highEsophagealNeoplasia = highEsophagealNeoplasia; } public Integer getEarlyEsophagealCancer() { - if (earlyEsophagealCancer==0) { - return null; - } return earlyEsophagealCancer; } public void setEarlyEsophagealCancer(Integer earlyEsophagealCancer) { this.earlyEsophagealCancer = earlyEsophagealCancer; } public Integer getAdvancedEsophagealCancer() { - if (advancedEsophagealCancer==0) { - return null; - } return advancedEsophagealCancer; } public void setAdvancedEsophagealCancer(Integer advancedEsophagealCancer) { this.advancedEsophagealCancer = advancedEsophagealCancer; } public Integer getHighGastricNeoplasia() { - if (highGastricNeoplasia==0) { - return null; - } return highGastricNeoplasia; } public void setHighGastricNeoplasia(Integer highGastricNeoplasia) { this.highGastricNeoplasia = highGastricNeoplasia; } public Integer getEarlyGastricCancer() { - if (earlyGastricCancer==0) { - return null; - } return earlyGastricCancer; } public void setEarlyGastricCancer(Integer earlyGastricCancer) { this.earlyGastricCancer = earlyGastricCancer; } public Integer getAdvancedGastricCancer() { - if (advancedGastricCancer==0) { - return null; - } return advancedGastricCancer; } public void setAdvancedGastricCancer(Integer advancedGastricCancer) { diff --git a/download/src/main/java/com/sict/excel/myExcel.java b/download/src/main/java/com/sict/excel/myExcel.java index a10269713de476994b351de53e51d1ea8bf122a1..a1aeb10f398caf6166037a0c9f58a5ef38152bb4 100644 --- a/download/src/main/java/com/sict/excel/myExcel.java +++ b/download/src/main/java/com/sict/excel/myExcel.java @@ -59,16 +59,16 @@ public class myExcel { HSSFSheet sheet9 = screeningRankShchyyExcel.getSheet9(workbook); workbook.setSheetName(8, "社区筛查排名-血检人数"); //体检筛查排名-血检人数 - ScreeningRankGecaExcel screeningRankGecaExcel = new ScreeningRankGecaExcel(); - HSSFWorkbook getsheet10 = screeningRankGecaExcel.getsheet10(workbook); - workbook.setSheetName(9, "体检筛查排名-血检人数"); - //门诊筛查排名-血检人数 ScreeningRankQgExcel screeningRankQgExcel = new ScreeningRankQgExcel(); HSSFSheet sheet11 = screeningRankQgExcel.getSheet11(workbook); + workbook.setSheetName(9, "体检筛查排名-血检人数"); + //门诊筛查排名-血检人数 + ScreeningRankGecaExcel screeningRankGecaExcel = new ScreeningRankGecaExcel(); + HSSFWorkbook getsheet10 = screeningRankGecaExcel.getsheet10(workbook); workbook.setSheetName(10, "门诊筛查排名-血检人数"); - // FileOutputStream outputStream = new FileOutputStream("E:/2019/excel/GICC+map+data.xls"); - FileOutputStream outputStream = new FileOutputStream("/home/gcsvr/excel/GICC+map+data.xls"); + FileOutputStream outputStream = new FileOutputStream("E:/2019/excel/GICC+map+data.xls"); + // FileOutputStream outputStream = new FileOutputStream("/home/gcsvr/excel/GICC+map+data.xls"); workbook.write(outputStream); outputStream.close(); } diff --git a/download/src/main/java/com/sict/excel/test/AnalysisGraphicExcel.java b/download/src/main/java/com/sict/excel/test/AnalysisGraphicExcel.java index a0f034f4858d36418f98c4b14010e9e9c9dfdfe9..c70d4ac82d73b60eb90db0381341c733f5fe2ba4 100644 --- a/download/src/main/java/com/sict/excel/test/AnalysisGraphicExcel.java +++ b/download/src/main/java/com/sict/excel/test/AnalysisGraphicExcel.java @@ -6,8 +6,13 @@ import java.util.ArrayList; import java.util.List; import org.apache.ibatis.session.SqlSession; +import org.apache.poi.hssf.usermodel.HSSFCell; +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.ss.usermodel.IndexedColors; import com.sict.excel.bo.AnalysisGraphicBO; import com.sict.excel.dto.AnalysisGraphicDTO; @@ -25,38 +30,91 @@ public class AnalysisGraphicExcel { DownloadMapper mapper = sqlSession.getMapper(DownloadMapper.class); - ExportExcelUtil util = new ExportExcelUtil(); String[] columnNames = {"收集项","数值","备注"}; - AnalysisGraphicDTO graphicDTO = mapper.getAnalysisGraphicDTOs(); List list = new ArrayList(); AnalysisGraphicBO analysisGraphicBO = new AnalysisGraphicBO(); analysisGraphicBO.setItem("申请胃癌筛查的医院总数"); - analysisGraphicBO.setNumber(graphicDTO.getApplyGastricCancerScreeningHosp()); list.add(analysisGraphicBO); AnalysisGraphicBO analysisGraphicBO2 = new AnalysisGraphicBO(); analysisGraphicBO2.setItem("通过申请医院数 "); - analysisGraphicBO2.setNumber(graphicDTO.getPassApplyHosp()); list.add(analysisGraphicBO2); AnalysisGraphicBO analysisGraphicBO3 = new AnalysisGraphicBO(); analysisGraphicBO3.setItem("平台账号申请医院数"); - analysisGraphicBO3.setNumber(graphicDTO.getPlatAccountApplyHosp()); list.add(analysisGraphicBO3); AnalysisGraphicBO analysisGraphicBO4 = new AnalysisGraphicBO(); analysisGraphicBO4.setItem("账号已开通的医院数"); - analysisGraphicBO4.setNumber(graphicDTO.getOpenAccountHosp()); list.add(analysisGraphicBO4); + + HSSFSheet sheet = workbook.createSheet("运营分析-图例数据"); + sheet.setDefaultColumnWidth(20); + HSSFCellStyle style = workbook.createCellStyle(); + // 设置这些样式 + style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 垂直居中 + // 背景色 蓝色 + style.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + style.setFillBackgroundColor(IndexedColors.PALE_BLUE.getIndex()); + // 设置边框 + style.setBorderBottom(HSSFCellStyle.BORDER_THIN); + style.setBorderLeft(HSSFCellStyle.BORDER_THIN); + style.setBorderRight(HSSFCellStyle.BORDER_THIN); + style.setBorderTop(HSSFCellStyle.BORDER_THIN); + // 生成一个字体 + HSSFFont font = workbook.createFont(); + font.setFontHeightInPoints((short) 12); + font.setColor(IndexedColors.AUTOMATIC.getIndex()); + font.setFontName("宋体"); + style.setFont(font);// 把字体 应用到当前样式 - // String path = "E:/2019/excel/" + "运营分析-图例数据.xls"; + HSSFCellStyle style2 = workbook.createCellStyle(); + // 设置这些样式 + style2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 垂直居中 + // 背景色黄色 + style2.setFillForegroundColor(IndexedColors.YELLOW.getIndex()); + style2.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + style2.setFillBackgroundColor(IndexedColors.YELLOW.getIndex()); + // 设置边框 + style2.setBorderBottom(HSSFCellStyle.BORDER_THIN); + style2.setBorderLeft(HSSFCellStyle.BORDER_THIN); + style2.setBorderRight(HSSFCellStyle.BORDER_THIN); + style2.setBorderTop(HSSFCellStyle.BORDER_THIN); - HSSFSheet sheet = util.exportExcel(workbook,"运营分析-图例数据", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); + HSSFCellStyle style3 = workbook.createCellStyle(); + // 设置这些样式 + // 设置边框 + style3.setBorderBottom(HSSFCellStyle.BORDER_THIN); + style3.setBorderLeft(HSSFCellStyle.BORDER_THIN); + style3.setBorderRight(HSSFCellStyle.BORDER_THIN); + style3.setBorderTop(HSSFCellStyle.BORDER_THIN); + + //HSSFSheet sheet = util.exportExcel(workbook,"运营分析-图例数据", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); + HSSFRow row1 = sheet.createRow(0); + for (int i = 0; i < columnNames.length; i++) { + HSSFCell createCell = row1.createCell(i); + createCell.setCellValue(columnNames[i]); + createCell.setCellStyle(style); + } + for (int i = 0; i < list.size(); i++) { + HSSFRow createRow = sheet.createRow(i+1); + HSSFCell createCell = createRow.createCell(0); + createCell.setCellStyle(style3); + createCell.setCellValue(list.get(i).getItem()); + + HSSFCell cell = createRow.createCell(1); + cell.setCellStyle(style2); + + HSSFCell cell3 = createRow.createCell(2); + cell3.setCellStyle(style3); + } + // HSSFSheet sheet = util.exportExcel(workbook,"运营分析-图例数据", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); sqlSession.commit(); sqlSession.close(); diff --git a/download/src/main/java/com/sict/excel/test/AnalysisHospitalEarlyCancerExcel.java b/download/src/main/java/com/sict/excel/test/AnalysisHospitalEarlyCancerExcel.java index d8bd082acdf336ac739724ed8fefc025cb2f7393..2e639f7dd5c91af3871d014824a09787a56bd35b 100644 --- a/download/src/main/java/com/sict/excel/test/AnalysisHospitalEarlyCancerExcel.java +++ b/download/src/main/java/com/sict/excel/test/AnalysisHospitalEarlyCancerExcel.java @@ -2,12 +2,18 @@ package com.sict.excel.test; import java.io.FileOutputStream; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import org.apache.ibatis.session.SqlSession; import org.apache.poi.hslf.model.Sheet; +import org.apache.poi.hssf.usermodel.HSSFCell; +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.ss.usermodel.IndexedColors; import com.sict.excel.dto.EarlyCancerHospitalDTO; import com.sict.excel.dto.ScreeningRankProvinceDTO; @@ -17,24 +23,169 @@ import com.sict.excel.utils.SqlSessionUtil; public class AnalysisHospitalEarlyCancerExcel { - public static HSSFSheet getsheet6(HSSFWorkbook workbook) throws IOException { + public static HSSFSheet getsheet6(HSSFWorkbook workbook) throws IOException { + + SqlSession sqlSession = SqlSessionUtil.getSession(); + + DownloadMapper mapper = sqlSession.getMapper(DownloadMapper.class); + + // ExportExcelUtil util = new + // ExportExcelUtil(); + + String[] columnNames = { "排名", "医院名称", "省份", "合计", "高级别食管粘膜上皮内瘤变", "早期食管癌", "进展期食管癌", "高级别胃粘膜上皮内瘤病变", "早期胃癌", + "进展期胃癌" }; + + List list = mapper.geteaCancerHospitals(); + HSSFSheet sheet = workbook.createSheet("运营分析-医院早癌 胃癌数"); + HSSFCellStyle style = workbook.createCellStyle(); + // 设置这些样式 + style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 垂直居中 + // 背景色 蓝色 + style.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + style.setFillBackgroundColor(IndexedColors.PALE_BLUE.getIndex()); + // 设置边框 + style.setBorderBottom(HSSFCellStyle.BORDER_THIN); + style.setBorderLeft(HSSFCellStyle.BORDER_THIN); + style.setBorderRight(HSSFCellStyle.BORDER_THIN); + style.setBorderTop(HSSFCellStyle.BORDER_THIN); + // 生成一个字体 + HSSFFont font = workbook.createFont(); + font.setFontHeightInPoints((short) 11); + font.setColor(IndexedColors.AUTOMATIC.getIndex()); + font.setFontName("宋体"); + font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);// 粗体显示 + style.setFont(font);// 把字体 应用到当前样式 + + HSSFCellStyle style2 = workbook.createCellStyle(); + // 设置这些样式 + style2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 垂直居中 + // 设置边框 + style2.setBorderBottom(HSSFCellStyle.BORDER_THIN); + style2.setBorderLeft(HSSFCellStyle.BORDER_THIN); + style2.setBorderRight(HSSFCellStyle.BORDER_THIN); + style2.setBorderTop(HSSFCellStyle.BORDER_THIN); + // 生成一个字体 + HSSFFont font2 = workbook.createFont(); + font2.setFontHeightInPoints((short) 11); + font2.setColor(IndexedColors.AUTOMATIC.getIndex()); + font2.setFontName("宋体"); + style2.setFont(font2);// 把字体 应用到当前样式 + HSSFRow row = sheet.createRow(0); + for (int i = 0; i < columnNames.length; i++) { + HSSFCell cell = row.createCell(i); + cell.setCellValue(columnNames[i]); + cell.setCellStyle(style); + } + + for (int i = 0; i < list.size(); i++) { + HSSFRow row2 = sheet.createRow(i+1); + HSSFCell cell = row2.createCell(0); + cell.setCellStyle(style2); + cell.setCellValue(list.get(i).getId()+""); + HSSFCell cell1 = row2.createCell(1); + cell1.setCellStyle(style2); + cell1.setCellValue(list.get(i).getHospname()); + HSSFCell cell2 = row2.createCell(2); + cell2.setCellStyle(style2); + cell2.setCellValue(list.get(i).getProvince()); + HSSFCell cell3 = row2.createCell(3); + cell3.setCellStyle(style2); + cell3.setCellValue(list.get(i).getTotal()+""); + HSSFCell cell4 = row2.createCell(4); + cell4.setCellStyle(style2); + cell4.setCellValue(list.get(i).getHighEsophagealNeoplasia()>0?list.get(i).getHighEsophagealNeoplasia()+"":""); + HSSFCell cell5 = row2.createCell(5); + cell5.setCellStyle(style2); + cell5.setCellValue(list.get(i).getEarlyEsophagealCancer()>0?list.get(i).getEarlyEsophagealCancer()+"":""); + HSSFCell cell6 = row2.createCell(6); + cell6.setCellStyle(style2); + cell6.setCellValue(list.get(i).getAdvancedEsophagealCancer()>0?list.get(i).getAdvancedEsophagealCancer()+"":""); + HSSFCell cell7 = row2.createCell(7); + cell7.setCellStyle(style2); + cell7.setCellValue(list.get(i).getHighGastricNeoplasia()>0?list.get(i).getHighGastricNeoplasia()+"":""); + HSSFCell cell8 = row2.createCell(8); + cell8.setCellStyle(style2); + cell8.setCellValue(list.get(i).getEarlyGastricCancer()>0?list.get(i).getEarlyGastricCancer()+"":""); + HSSFCell cell9 = row2.createCell(9); + cell9.setCellStyle(style2); + cell9.setCellValue(list.get(i).getAdvancedGastricCancer()>0?list.get(i).getAdvancedGastricCancer()+"":""); + } + HSSFRow row2 = sheet.createRow(list.size()+1); + int total1=0,total2=0,total3=0,total4=0,total5=0,total6=0,total7=0; + for (int i = 0; i < list.size(); i++) { + total1 += list.get(i).getTotal(); + } + for (int i = 0; i < list.size(); i++) { + total2 += list.get(i).getHighEsophagealNeoplasia(); + } + for (int i = 0; i < list.size(); i++) { + total3 += list.get(i).getEarlyEsophagealCancer(); + } + for (int i = 0; i < list.size(); i++) { + total4 += list.get(i).getAdvancedEsophagealCancer(); + } + for (int i = 0; i < list.size(); i++) { + total5 += list.get(i).getHighGastricNeoplasia(); + } + for (int i = 0; i < list.size(); i++) { + total6 += list.get(i).getEarlyGastricCancer(); + } + for (int i = 0; i < list.size(); i++) { + total7 += list.get(i).getAdvancedGastricCancer(); + } + HSSFCell cell1 = row2.createCell(0); + cell1.setCellStyle(style2); + cell1.setCellValue("合计"); + + HSSFCell cell2 = row2.createCell(1); + cell2.setCellStyle(style2); -SqlSession sqlSession = SqlSessionUtil.getSession(); + HSSFCell cell3= row2.createCell(2); + cell3.setCellStyle(style2); + + HSSFCell cell4=row2.createCell(3); + cell4.setCellValue(total1+""); + cell4.setCellStyle(style2); + + HSSFCell cell5 = row2.createCell(4); + cell5.setCellStyle(style2); + cell5.setCellValue(total2+""); + + HSSFCell cell6=row2.createCell(5); + cell6.setCellStyle(style2); + cell6.setCellValue(total3+""); + + HSSFCell cell7 = row2.createCell(6); + cell7.setCellStyle(style2); + cell7.setCellValue(""+total4); + + HSSFCell cell8 = row2.createCell(7); + cell8.setCellStyle(style2); + cell8.setCellValue(""+total5); + + HSSFCell cell9 = row2.createCell(8); + cell9.setCellStyle(style2); + cell9.setCellValue(total6+""); + + HSSFCell cell10 =row2.createCell(9); + cell10.setCellStyle(style2); + cell10.setCellValue(""+total7); + - DownloadMapper mapper = sqlSession.getMapper(DownloadMapper.class); - - ExportExcelUtil util = new ExportExcelUtil(); - - String[] columnNames = {"排名","医院名称","省份","合计","高级别食管粘膜上皮内瘤变","早期食管癌","进展期食管癌","高级别胃粘膜上皮内瘤病变","早期胃癌","进展期胃癌"}; - - List list = mapper.geteaCancerHospitals(); - - // String path = "E:/2019/excel/" + "运营分析-医院早癌 胃癌数.xls"; - HSSFSheet sheet = util.exportExcel(workbook,"运营分析-医院早癌 胃癌数", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); - sqlSession.commit(); - - sqlSession.close(); + sheet.setColumnWidth(0, 10*256); + sheet.setColumnWidth(1, 30*256); + sheet.setColumnWidth(2, 10*256); + sheet.setColumnWidth(3, 10*256); + sheet.setColumnWidth(4, 30*256); + sheet.setColumnWidth(5, 10*256); + sheet.setColumnWidth(6, 10*256); + sheet.setColumnWidth(7, 30*256); + sheet.setColumnWidth(8, 10*256); + sheet.setColumnWidth(9, 10*256); + sqlSession.commit(); + sqlSession.close(); return sheet; } diff --git a/download/src/main/java/com/sict/excel/test/AnalysisProvinceExcel.java b/download/src/main/java/com/sict/excel/test/AnalysisProvinceExcel.java index 727f74a62f28dd9ddb501a077955bdf8680819b1..05b3e0e04a36e915fc247162d9ebab190d6db4a3 100644 --- a/download/src/main/java/com/sict/excel/test/AnalysisProvinceExcel.java +++ b/download/src/main/java/com/sict/excel/test/AnalysisProvinceExcel.java @@ -5,8 +5,13 @@ import java.io.IOException; import java.util.List; import org.apache.ibatis.session.SqlSession; +import org.apache.poi.hssf.usermodel.HSSFCell; +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.ss.usermodel.IndexedColors; import com.sict.excel.dto.AnalysisProvinceDTO; import com.sict.excel.mapper.DownloadMapper; @@ -21,14 +26,71 @@ public class AnalysisProvinceExcel { DownloadMapper mapper = sqlSession.getMapper(DownloadMapper.class); - ExportExcelUtil util = new ExportExcelUtil(); + HSSFSheet sheet = workbook.createSheet("运营分析-省份数据"); + sheet.setDefaultColumnWidth(15); + HSSFCellStyle style = workbook.createCellStyle(); + // 设置这些样式 + style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 垂直居中 + // 背景色 + style.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + style.setFillBackgroundColor(IndexedColors.PALE_BLUE.getIndex()); + // 设置边框 + style.setBorderBottom(HSSFCellStyle.BORDER_THIN); + style.setBorderLeft(HSSFCellStyle.BORDER_THIN); + style.setBorderRight(HSSFCellStyle.BORDER_THIN); + style.setBorderTop(HSSFCellStyle.BORDER_THIN); + // 生成一个字体 + HSSFFont font = workbook.createFont(); + font.setFontHeightInPoints((short) 12); + font.setColor(IndexedColors.AUTOMATIC.getIndex()); + font.setFontName("宋体"); + style.setFont(font);// 把字体 应用到当前样式 - String[] columnNames = {"省份","申请医院总数 ","开通账号医院总数","申请账号中的医院总数","通过申请医院数","平台账号申请医院数","筛查人数","早癌数"}; + HSSFCellStyle style2 = workbook.createCellStyle(); + // 设置这些样式 + style2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 垂直居中 + // 背景色 + style2.setFillForegroundColor(IndexedColors.YELLOW.getIndex()); + style2.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + style2.setFillBackgroundColor(IndexedColors.YELLOW.getIndex()); + // 设置边框 + style2.setBorderBottom(HSSFCellStyle.BORDER_THIN); + style2.setBorderLeft(HSSFCellStyle.BORDER_THIN); + style2.setBorderRight(HSSFCellStyle.BORDER_THIN); + style2.setBorderTop(HSSFCellStyle.BORDER_THIN); + HSSFCellStyle style3 = workbook.createCellStyle(); + // 设置这些样式 + // 设置边框 + style3.setBorderBottom(HSSFCellStyle.BORDER_THIN); + style3.setBorderLeft(HSSFCellStyle.BORDER_THIN); + style3.setBorderRight(HSSFCellStyle.BORDER_THIN); + style3.setBorderTop(HSSFCellStyle.BORDER_THIN); + HSSFRow row1 = sheet.createRow(0); + String[] columnNames = {"省份","申请医院总数 ","开通账号医院总数","申请账号中的医院总数","通过申请医院数","平台账号申请医院数","筛查人数","早癌数"}; + for (int i = 0; i < columnNames.length; i++) { + HSSFCell createCell = row1.createCell(i); + createCell.setCellValue(columnNames[i]); + createCell.setCellStyle(style); + } List list = mapper.getAnalysisProvinceDTOs(); + AnalysisProvinceDTO l1 = new AnalysisProvinceDTO(); + l1.setProvince("合计"); + list.add(l1); + for (int i = 0; i < list.size(); i++) { + HSSFRow createRow = sheet.createRow(i+1); + HSSFCell createCell = createRow.createCell(0); + createCell.setCellValue(list.get(i).getProvince()); + createCell.setCellStyle(style3); + HSSFCell cell = createRow.createCell(1); + cell.setCellStyle(style2); + for (int j = 2; j < columnNames.length; j++) { + HSSFCell cell2 = createRow.createCell(j); + cell2.setCellStyle(style3); + } + } - //String path = "E:/2019/excel/" + "运营分析-省份数据.xls"; - HSSFSheet sheet = util.exportExcel(workbook,"运营分析-省份数据", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); sqlSession.commit(); sqlSession.close(); diff --git a/download/src/main/java/com/sict/excel/test/ProvinceEarlyCancerRankExcel.java b/download/src/main/java/com/sict/excel/test/ProvinceEarlyCancerRankExcel.java index 4900632d293bb715e7b94be047fca602c3e14be7..34afb27b8cd61c109bccebb081c846f075af9ead 100644 --- a/download/src/main/java/com/sict/excel/test/ProvinceEarlyCancerRankExcel.java +++ b/download/src/main/java/com/sict/excel/test/ProvinceEarlyCancerRankExcel.java @@ -4,8 +4,10 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import org.apache.ibatis.session.SqlSession; +import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.tools.ant.types.selectors.modifiedselector.EqualComparator; import com.sict.excel.dto.EarlyCancerRankDTO; import com.sict.excel.mapper.DownloadMapper; @@ -21,8 +23,17 @@ public class ProvinceEarlyCancerRankExcel { ExportExcelUtil util = new ExportExcelUtil(); String[] columnNames = {"省份","早癌数"}; List list = mapper.getEarlyCancerRankDTOs(); - //String path = "E:/2019/excel/" + "省份早癌排名.xls"; + int total = 0; + for (int i = 0; i < list.size(); i++) { + total+=list.get(i).getECamount(); + } + EarlyCancerRankDTO earlyCancerRankDTO = new EarlyCancerRankDTO(); + earlyCancerRankDTO.setProvince("合计"); + earlyCancerRankDTO.setECamount(total); + list.add(earlyCancerRankDTO); HSSFSheet sheet = util.exportExcel(workbook,"省份早癌排名", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); + + sqlSession.commit(); sqlSession.close(); diff --git a/download/src/main/java/com/sict/excel/test/ScreeningRankGecaExcel.java b/download/src/main/java/com/sict/excel/test/ScreeningRankGecaExcel.java index 9d5e4daa91857c2ffcdeb005cb8e62db99de3839..30d1b73eb99e8b3d64bf5418ee6527d96aaecc1a 100644 --- a/download/src/main/java/com/sict/excel/test/ScreeningRankGecaExcel.java +++ b/download/src/main/java/com/sict/excel/test/ScreeningRankGecaExcel.java @@ -4,6 +4,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import org.apache.ibatis.session.SqlSession; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -22,8 +24,17 @@ public class ScreeningRankGecaExcel { ExportExcelUtil util = new ExportExcelUtil(); String[] columnNames = {"排名","医联体名称","血检人数"}; List list = mapper.getScreeningRankDTOs(); - String path = "E:/2019/excel/" + "体检筛查排名-血检人数.xls"; - HSSFSheet sheet = util.exportExcel(workbook,"体检筛查排名-血检人数", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); + int total =0; + for (int i = 0; i < list.size(); i++) { + total+=list.get(i).getActualserum(); + } + HSSFSheet sheet = util.exportExcel(workbook,"门诊筛查排名-血检人数", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); + HSSFRow row = sheet.createRow(list.size()+1); + HSSFCell cell = row.createCell(0); + cell.setCellValue("合计"); + HSSFCell cell2 = row.createCell(2); + cell2.setCellValue(""+total); + sqlSession.commit(); sqlSession.close(); diff --git a/download/src/main/java/com/sict/excel/test/ScreeningRankProvinceExcel.java b/download/src/main/java/com/sict/excel/test/ScreeningRankProvinceExcel.java index 72a3049bc9e50f123dd635b423e2704bc5377013..e2638e6a394ddf493cdec52c0b9aef3ff656524a 100644 --- a/download/src/main/java/com/sict/excel/test/ScreeningRankProvinceExcel.java +++ b/download/src/main/java/com/sict/excel/test/ScreeningRankProvinceExcel.java @@ -5,6 +5,8 @@ import java.io.IOException; import java.util.List; import org.apache.ibatis.session.SqlSession; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -26,9 +28,17 @@ public class ScreeningRankProvinceExcel { String[] columnNames = {"排名","医院名称","省份","血检人数"}; List list = mapper.getScreeningRankProvinceDTOs(); - + int total =0; + for (int i = 0; i < list.size(); i++) { + total+=list.get(i).getActualserum(); + } //String path = "E:/2019/excel/" + "筛查排名-按血检人数排名.xls"; HSSFSheet sheet = util.exportExcel(workbook, "筛查排名-按血检人数排名", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); + HSSFRow row = sheet.createRow(list.size()+1); + HSSFCell cell = row.createCell(0); + cell.setCellValue("合计"); + HSSFCell cell2 = row.createCell(3); + cell2.setCellValue(""+total); sqlSession.commit(); sqlSession.close(); diff --git a/download/src/main/java/com/sict/excel/test/ScreeningRankQgExcel.java b/download/src/main/java/com/sict/excel/test/ScreeningRankQgExcel.java index 44337a53df3727c26c8f0419e026802446341d0e..18a90c8d88b1316690d15d6fa8edefe8a2dd73b4 100644 --- a/download/src/main/java/com/sict/excel/test/ScreeningRankQgExcel.java +++ b/download/src/main/java/com/sict/excel/test/ScreeningRankQgExcel.java @@ -4,6 +4,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import org.apache.ibatis.session.SqlSession; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -22,8 +24,16 @@ public class ScreeningRankQgExcel { ExportExcelUtil util = new ExportExcelUtil(); String[] columnNames = {"排名","医联体名称","血检人数"}; List list = mapper.getScreeningRankDTOs(); - //String path = "E:/2019/excel/" + "门诊筛查排名-血检人数.xls"; - HSSFSheet sheet = util.exportExcel(workbook,"门诊筛查排名-血检人", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); + int total =0; + for (int i = 0; i < list.size(); i++) { + total+=list.get(i).getActualserum(); + } + HSSFSheet sheet = util.exportExcel(workbook,"体检筛查排名-血检人数", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); + HSSFRow row = sheet.createRow(list.size()+1); + HSSFCell cell = row.createCell(0); + cell.setCellValue("合计"); + HSSFCell cell2 = row.createCell(2); + cell2.setCellValue(""+total); sqlSession.commit(); sqlSession.close(); diff --git a/download/src/main/java/com/sict/excel/test/ScreeningRankShchyyExcel.java b/download/src/main/java/com/sict/excel/test/ScreeningRankShchyyExcel.java index 4ce266933963da2e0a0f704cff26fd62366c5fc7..a9744e722b2f240260b2a3724aa1bb040d84e23b 100644 --- a/download/src/main/java/com/sict/excel/test/ScreeningRankShchyyExcel.java +++ b/download/src/main/java/com/sict/excel/test/ScreeningRankShchyyExcel.java @@ -4,6 +4,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import org.apache.ibatis.session.SqlSession; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -22,8 +24,16 @@ public class ScreeningRankShchyyExcel { ExportExcelUtil util = new ExportExcelUtil(); String[] columnNames = {"排名","医联体名称","血检人数"}; List list = mapper.getScreeningRankDTOs(); - String path = "E:/2019/excel/" + "社区筛查排名-血检人数.xls"; + int total =0; + for (int i = 0; i < list.size(); i++) { + total+=list.get(i).getActualserum(); + } HSSFSheet sheet = util.exportExcel(workbook,"社区筛查排名-血检人数", columnNames, list, ExportExcelUtil.EXCEl_FILE_2007); + HSSFRow row = sheet.createRow(list.size()+1); + HSSFCell cell = row.createCell(0); + cell.setCellValue("合计"); + HSSFCell cell2 = row.createCell(2); + cell2.setCellValue(""+total); sqlSession.commit(); sqlSession.close(); return sheet; diff --git a/download/src/main/java/com/sict/excel/test/SerumTest.java b/download/src/main/java/com/sict/excel/test/SerumTest.java index 467e88a5b5156251648647a9552049982a09ab42..cbccf3047bb680e52aa42efdf773a3e804189080 100644 --- a/download/src/main/java/com/sict/excel/test/SerumTest.java +++ b/download/src/main/java/com/sict/excel/test/SerumTest.java @@ -135,7 +135,7 @@ public class SerumTest { cell91.setCellStyle(style3); HSSFCell cell92 = row9.createCell(1); cell92.setCellStyle(style3); - cell92.setCellValue(qgInteger+""); + cell92.setCellValue(gecaintInteger+""); HSSFRow row10 = sheet.createRow(9);//9行 HSSFCell cell101 = row10.createCell(0); @@ -144,7 +144,7 @@ public class SerumTest { cell101.setCellStyle(style3); HSSFCell cell102 = row10.createCell(1); cell102.setCellStyle(style3); - cell102.setCellValue(gecaintInteger+""); + cell102.setCellValue(qgInteger+""); HSSFRow row11= sheet.createRow(10);//10行 HSSFCell cell111 = row11.createCell(0); diff --git a/download/src/main/resources/mapper/DownloadMapper.xml b/download/src/main/resources/mapper/DownloadMapper.xml index 7dd71f6f7ecf0725709047b4931930b7a3c88db8..89432ab8c59d2c23443663072dbc4b8e87e984e0 100644 --- a/download/src/main/resources/mapper/DownloadMapper.xml +++ b/download/src/main/resources/mapper/DownloadMapper.xml @@ -163,68 +163,73 @@ @@ -594,7 +601,8 @@ COUNT(NULL) actual FROM tb_patient p1 INNER JOIN tb_risk_assess p2 - ON p1.id = p2.patient_id RIGHT JOIN (SELECT `name`,number FROM tb_hosp + ON + p1.id = p2.patient_id RIGHT JOIN (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number = p1.hosp_number WHERE p2.grade > 1 AND p2.step = 0 @@ -687,7 +695,8 @@ AND diagnose_result = 1 ) rel1 ON rel1.patient_id = p.id - INNER JOIN (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number = + INNER JOIN (SELECT `name`,number FROM tb_hosp + )rel2 ON rel2.number = p.hosp_number ) rel @@ -718,7 +727,9 @@ patient_id, score, grade FROM tb_risk_assess ) rel1 ON rel1.patient_id = p.id - INNER JOIN (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number = p.hosp_number + INNER JOIN + (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number = + p.hosp_number ) rel GROUP BY 胃癌患病风险等级 diff --git a/download/target/classes/META-INF/maven/download/download/pom.properties b/download/target/classes/META-INF/maven/download/download/pom.properties index fca7f79aa41ce929d9bb5b2e1ec985efe6aecf79..ccec34b4ff39104aab473289fb66a0f569a21805 100644 --- a/download/target/classes/META-INF/maven/download/download/pom.properties +++ b/download/target/classes/META-INF/maven/download/download/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Fri Nov 29 10:09:37 CST 2019 +#Fri Nov 29 11:00:23 CST 2019 version=1.0-SNAPSHOT groupId=download m2e.projectName=download diff --git a/download/target/classes/com/sict/excel/dto/EarlyCancerHospitalDTO.class b/download/target/classes/com/sict/excel/dto/EarlyCancerHospitalDTO.class index 5b6c502638b28f7a036fc534d2bdaf5c085ade06..7d50c857c8dc8541fb7f96c376d8687b0301c338 100644 Binary files a/download/target/classes/com/sict/excel/dto/EarlyCancerHospitalDTO.class and b/download/target/classes/com/sict/excel/dto/EarlyCancerHospitalDTO.class differ diff --git a/download/target/classes/com/sict/excel/myExcel.class b/download/target/classes/com/sict/excel/myExcel.class index aec3759c825a137422e2dd1257273a6fb6ee3d5d..165d7f56f3808ffdc9dbd8d2fd0540937d397513 100644 Binary files a/download/target/classes/com/sict/excel/myExcel.class and b/download/target/classes/com/sict/excel/myExcel.class differ diff --git a/download/target/classes/com/sict/excel/test/AnalysisGraphicExcel.class b/download/target/classes/com/sict/excel/test/AnalysisGraphicExcel.class index 50fcb9e54f0bf24825da65541616016709d69b19..12c18752553020706add1d7ec88fa6c848e78fa1 100644 Binary files a/download/target/classes/com/sict/excel/test/AnalysisGraphicExcel.class and b/download/target/classes/com/sict/excel/test/AnalysisGraphicExcel.class differ diff --git a/download/target/classes/com/sict/excel/test/AnalysisHospitalEarlyCancerExcel.class b/download/target/classes/com/sict/excel/test/AnalysisHospitalEarlyCancerExcel.class index 646d533e20cf095971b5b77680993b82f991d3b9..5ad24e7ade222604696df28f17b90e4625f589ea 100644 Binary files a/download/target/classes/com/sict/excel/test/AnalysisHospitalEarlyCancerExcel.class and b/download/target/classes/com/sict/excel/test/AnalysisHospitalEarlyCancerExcel.class differ diff --git a/download/target/classes/com/sict/excel/test/AnalysisProvinceExcel.class b/download/target/classes/com/sict/excel/test/AnalysisProvinceExcel.class index eccd126089fca4475788f85d9a88177d5b23de1a..802b721076174cb40aaf35b30e8bf7348d351b1c 100644 Binary files a/download/target/classes/com/sict/excel/test/AnalysisProvinceExcel.class and b/download/target/classes/com/sict/excel/test/AnalysisProvinceExcel.class differ diff --git a/download/target/classes/com/sict/excel/test/ProvinceEarlyCancerRankExcel.class b/download/target/classes/com/sict/excel/test/ProvinceEarlyCancerRankExcel.class index 5b4c61c417a9a8276d32163962ac2b1e294d4882..a7616258175b32795493718b425093378126e9d3 100644 Binary files a/download/target/classes/com/sict/excel/test/ProvinceEarlyCancerRankExcel.class and b/download/target/classes/com/sict/excel/test/ProvinceEarlyCancerRankExcel.class differ diff --git a/download/target/classes/com/sict/excel/test/ScreeningRankGecaExcel.class b/download/target/classes/com/sict/excel/test/ScreeningRankGecaExcel.class index ef438ee145edb636ff1075d140d559b63e1f46ef..0cf616f63c1ebf7d648629e1c80c81dd4b889618 100644 Binary files a/download/target/classes/com/sict/excel/test/ScreeningRankGecaExcel.class and b/download/target/classes/com/sict/excel/test/ScreeningRankGecaExcel.class differ diff --git a/download/target/classes/com/sict/excel/test/ScreeningRankProvinceExcel.class b/download/target/classes/com/sict/excel/test/ScreeningRankProvinceExcel.class index ae103d5b24272371344cde1d61c1b2943baa229a..f0615ee0e309e0441bd162c86e138eb0d8d0554e 100644 Binary files a/download/target/classes/com/sict/excel/test/ScreeningRankProvinceExcel.class and b/download/target/classes/com/sict/excel/test/ScreeningRankProvinceExcel.class differ diff --git a/download/target/classes/com/sict/excel/test/ScreeningRankQgExcel.class b/download/target/classes/com/sict/excel/test/ScreeningRankQgExcel.class index a5685234ed28b76e440d654f2de4b0a7bc086a4e..8a0aed55e86b2d72c152ee272408bb1f2b20d7be 100644 Binary files a/download/target/classes/com/sict/excel/test/ScreeningRankQgExcel.class and b/download/target/classes/com/sict/excel/test/ScreeningRankQgExcel.class differ diff --git a/download/target/classes/com/sict/excel/test/ScreeningRankShchyyExcel.class b/download/target/classes/com/sict/excel/test/ScreeningRankShchyyExcel.class index 12b15aa77dde467c188d97b825b07293c7471ad3..045614707dfb2ef082a2d6c1a9fe4827cb6c152e 100644 Binary files a/download/target/classes/com/sict/excel/test/ScreeningRankShchyyExcel.class and b/download/target/classes/com/sict/excel/test/ScreeningRankShchyyExcel.class differ diff --git a/download/target/classes/com/sict/excel/test/SerumTest.class b/download/target/classes/com/sict/excel/test/SerumTest.class index 76132701f75bb3444d4a7fa52dcea392e071ff4c..8fca8ebf42b2b575edb01163056d89dc7d90cd1d 100644 Binary files a/download/target/classes/com/sict/excel/test/SerumTest.class and b/download/target/classes/com/sict/excel/test/SerumTest.class differ diff --git a/download/target/classes/mapper/DownloadMapper.xml b/download/target/classes/mapper/DownloadMapper.xml index 7dd71f6f7ecf0725709047b4931930b7a3c88db8..89432ab8c59d2c23443663072dbc4b8e87e984e0 100644 --- a/download/target/classes/mapper/DownloadMapper.xml +++ b/download/target/classes/mapper/DownloadMapper.xml @@ -163,68 +163,73 @@ @@ -594,7 +601,8 @@ COUNT(NULL) actual FROM tb_patient p1 INNER JOIN tb_risk_assess p2 - ON p1.id = p2.patient_id RIGHT JOIN (SELECT `name`,number FROM tb_hosp + ON + p1.id = p2.patient_id RIGHT JOIN (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number = p1.hosp_number WHERE p2.grade > 1 AND p2.step = 0 @@ -687,7 +695,8 @@ AND diagnose_result = 1 ) rel1 ON rel1.patient_id = p.id - INNER JOIN (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number = + INNER JOIN (SELECT `name`,number FROM tb_hosp + )rel2 ON rel2.number = p.hosp_number ) rel @@ -718,7 +727,9 @@ patient_id, score, grade FROM tb_risk_assess ) rel1 ON rel1.patient_id = p.id - INNER JOIN (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number = p.hosp_number + INNER JOIN + (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number = + p.hosp_number ) rel GROUP BY 胃癌患病风险等级