diff --git a/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java b/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java index eb27f38..98f355f 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java +++ b/platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java @@ -631,7 +631,7 @@ public class ExcelUtil ws.addCell(new Label(0, values.size()+5, "注:统计时限:"+ time +";分娩方式中其他包括:吸引产、臀助产、臀牵引、产钳产等。", leftFormt)); - ws.mergeCells(0, values.size()+5, 36, values.size()+5); + ws.mergeCells(0, values.size() + 5, 36, values.size() + 5); ws.addCell(new Label(0, values.size()+6, "填报单位:", leftFormt)); ws.mergeCells(0, values.size()+6, 5, values.size()+6); @@ -672,18 +672,18 @@ public class ExcelUtil ws.mergeCells(0, 0, 0, 1); ws.addCell(new Label(0, 0, "编号",wcf)); ws.mergeCells(1, 0, 1, 1); - ws.addCell(new Label(1, 0, "姓名",wcf)); + ws.addCell(new Label(1, 0, "姓名", wcf)); ws.mergeCells(2, 0, 2, 1); ws.addCell(new Label(2, 0, "家庭住址",wcf)); ws.mergeCells(3, 0, 3, 1); - ws.addCell(new Label(3, 0, "联系电话",wcf)); + ws.addCell(new Label(3, 0, "联系电话", wcf)); ws.mergeCells(4, 0, 4, 1); ws.addCell(new Label(4, 0, "末次月经",wcf)); ws.mergeCells(5, 0, 9, 0); - ws.addCell(new Label(5, 0, "产前检查",wcf)); - ws.addCell(new Label(5, 1, "一",wcf)); + ws.addCell(new Label(5, 0, "产前检查", wcf)); + ws.addCell(new Label(5, 1, "一", wcf)); ws.addCell(new Label(6,1,"二",wcf)); - ws.addCell(new Label(7,1,"三",wcf)); + ws.addCell(new Label(7, 1, "三", wcf)); ws.addCell(new Label(8,1,"四",wcf)); ws.addCell(new Label(9, 1, "五",wcf)); ws.mergeCells(10, 0, 10, 1); @@ -692,7 +692,7 @@ public class ExcelUtil ws.addCell(new Label(11, 0, "出院小结",wcf)); ws.mergeCells(12, 0, 13, 0); ws.addCell(new Label(12, 0, "产后访视",wcf)); - ws.addCell(new Label(12, 1, "7天内",wcf)); + ws.addCell(new Label(12, 1, "7天内", wcf)); ws.addCell(new Label(13, 1, "42天内",wcf)); ws.mergeCells(14, 0, 14, 1); ws.addCell(new Label(14,0,"备注",wcf)); @@ -731,6 +731,158 @@ public class ExcelUtil } + /** + * 婚检导出模板 + * @param out + * @param data + */ + public static void WritePremaritalExcel(OutputStream out,Map data){ + WritableWorkbook wwb; + try{ + wwb = Workbook.createWorkbook(out); + WritableSheet ws = wwb.createSheet("sheet", 0); // 创建一个工作表 + /** + * 设置单元格样式 + */ + WritableFont wf = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); + WritableCellFormat wcf = new WritableCellFormat(wf); + wcf.setAlignment(jxl.format.Alignment.CENTRE);//水平居中 + ws.setRowView(0, 300); // 设置指定行高 + // 设置列宽 + for (int j = 0; j < 31; j++) + { + ws.setColumnView(j, 15); + } + //创建Excel标题格式 + ws.mergeCells(0, 0, 0, 3); + ws.addCell(new Label(0, 0, "填报单位", wcf)); + ws.mergeCells(1, 0, 2, 0); + ws.addCell(new Label(1, 0, "结婚登记人数", wcf)); + ws.mergeCells(1, 1, 1, 3); + ws.addCell(new Label(1, 1, "男", wcf)); + ws.mergeCells(2, 1, 2, 3); + ws.addCell(new Label(2, 1, "女", wcf)); + ws.mergeCells(3, 0, 4, 0); + ws.addCell(new Label(0, 0, "婚前医学检查人数", wcf)); + ws.mergeCells(3, 1, 3, 3); + ws.addCell(new Label(3, 1, "男", wcf)); + ws.mergeCells(4, 1, 4, 3); + ws.addCell(new Label(4, 1, "女", wcf)); + ws.mergeCells(5, 0, 6, 0); + ws.addCell(new Label(5, 0, "婚前卫生咨询情况", wcf)); + ws.mergeCells(5, 1, 5, 3); + ws.addCell(new Label(5, 1, "男", wcf)); + ws.mergeCells(6, 1, 6, 3); + ws.addCell(new Label(6, 1, "女", wcf)); + ws.mergeCells(7, 0, 20, 0); + ws.addCell(new Label(7, 0, "检出疾病分类情况", wcf)); + ws.mergeCells(7, 1, 8, 1); + ws.addCell(new Label(7, 1, "检出疾病人数", wcf)); + ws.mergeCells(7, 2, 7, 3); + ws.addCell(new Label(7, 2, "男", wcf)); + ws.mergeCells(8, 2, 8, 3); + ws.addCell(new Label(8, 2, "女", wcf)); + ws.mergeCells(9, 1, 12, 1); + ws.addCell(new Label(9, 1, "指定传染病", wcf)); + ws.mergeCells(9, 2, 9, 3); + ws.addCell(new Label(9, 2, "男", wcf)); + ws.mergeCells(10, 2, 10, 3); + ws.addCell(new Label(10, 2, "女", wcf)); + ws.mergeCells(11, 2, 12, 2); + ws.addCell(new Label(11, 2, "性病", wcf)); + ws.addCell(new Label(11, 3, "男", wcf)); + ws.addCell(new Label(12,3,"女",wcf)); + ws.mergeCells(13, 1, 14, 1); + ws.addCell(new Label(13, 1, "严重遗传病",wcf)); + ws.mergeCells(13, 2, 13, 3); + ws.addCell(new Label(13,2,"男",wcf)); + ws.mergeCells(14, 2, 14, 3); + ws.addCell(new Label(14,2,"女",wcf)); + ws.mergeCells(15, 1, 16, 1); + ws.addCell(new Label(15,1,"有关精神病",wcf)); + ws.mergeCells(15, 2, 15, 3); + ws.addCell(new Label(15,2,"男",wcf)); + ws.mergeCells(16, 2, 16, 3); + ws.addCell(new Label(16,2,"女",wcf)); + ws.mergeCells(17, 1, 18, 1); + ws.addCell(new Label(17,1,"生殖系统疾病",wcf)); + ws.mergeCells(17, 2, 17, 3); + ws.addCell(new Label(17,2,"男",wcf)); + ws.mergeCells(18, 2, 18, 3); + ws.addCell(new Label(18,2,"女",wcf)); + ws.mergeCells(19, 1, 20, 1); + ws.addCell(new Label(19,1,"内科系统疾病",wcf)); + ws.mergeCells(19, 2, 19, 3); + ws.addCell(new Label(19,2,"男",wcf)); + ws.mergeCells(20, 2, 20, 3); + ws.addCell(new Label(20,2,"女",wcf)); + ws.mergeCells(21, 0, 30, 0); + ws.addCell(new Label(21,0,"对影响婚育疾病的医学指导意见",wcf)); + ws.mergeCells(21, 1, 22, 1); + ws.addCell(new Label(21,1,"对影响婚育疾病的医学意见总人数",wcf)); + ws.mergeCells(21, 2, 21, 3); + ws.addCell(new Label(21, 2, "男", wcf)); + ws.mergeCells(22, 2, 22, 3); + ws.addCell(new Label(22,2,"女",wcf)); + ws.mergeCells(23, 1, 24, 1); + ws.addCell(new Label(23,1,"不宜结婚",wcf)); + ws.mergeCells(23, 2, 23, 3); + ws.addCell(new Label(23,2,"男",wcf)); + ws.mergeCells(24, 2, 24, 3); + ws.addCell(new Label(24,2,"女",wcf)); + ws.mergeCells(25, 1, 26, 1); + ws.addCell(new Label(25,1,"不宜生育",wcf)); + ws.mergeCells(25, 2, 25, 3); + ws.addCell(new Label(25,2,"男",wcf)); + ws.mergeCells(26, 2, 26, 3); + ws.addCell(new Label(26,2,"女",wcf)); + ws.mergeCells(27, 1, 28, 1); + ws.addCell(new Label(27,1,"暂缓结婚",wcf)); + ws.mergeCells(27, 2, 27, 3); + ws.addCell(new Label(27,2,"男",wcf)); + ws.mergeCells(28, 2, 28, 3); + ws.addCell(new Label(28,2,"女",wcf)); + ws.mergeCells(29, 1, 30, 1); + ws.addCell(new Label(29,1,"尊重受检者意愿",wcf)); + ws.mergeCells(29, 2, 29, 3); + ws.addCell(new Label(29,2,"男",wcf)); + ws.mergeCells(30, 2, 30, 3); + ws.addCell(new Label(30,2,"女",wcf)); + + /*int k = 0; + //填充数据 + if(data != null && data.size() > 0) { + for (int i = 0; i < data.size(); i++) { + int l = i + 1; + ws.addCell(new Label(k, i + 2, String.valueOf(l))); + ws.addCell(new Label(k + 1, i + 2, data.get(i).get("name") == null ? "" : data.get(i).get("name").toString())); + ws.addCell(new Label(k + 2, i + 2, data.get(i).get("address") == null ? "" : data.get(i).get("address").toString())); + ws.addCell(new Label(k + 3, i + 2, data.get(i).get("phone") == null ? "" : data.get(i).get("phone").toString())); + ws.addCell(new Label(k + 4, i + 2, data.get(i).get("lastMenses") == null ? "" : data.get(i).get("lastMenses").toString())); + ws.addCell(new Label(k + 5, i + 2, data.get(i).get("yi") == null ? "" : data.get(i).get("yi").toString())); + ws.addCell(new Label(k + 6, i + 2, data.get(i).get("er") == null ? "" : data.get(i).get("er").toString())); + ws.addCell(new Label(k + 7, i + 2, data.get(i).get("san") == null ? "" : data.get(i).get("san").toString())); + ws.addCell(new Label(k + 8, i + 2, data.get(i).get("si") == null ? "" : data.get(i).get("si").toString())); + ws.addCell(new Label(k + 9, i + 2, data.get(i).get("wu") == null ? "" : data.get(i).get("wu").toString())); + ws.addCell(new Label(k + 10, i + 2, data.get(i).get("total") == null ? "" : data.get(i).get("total").toString())); + + ws.addCell(new Label(k + 11, i + 2, data.get(i).get("cyxj") == null ? "" : data.get(i).get("cyxj").toString())); + ws.addCell(new Label(k + 12, i + 2, data.get(i).get("chfs") == null ? "" : data.get(i).get("chfs").toString())); + ws.addCell(new Label(k + 13, i + 2, data.get(i).get("chfc") == null ? "" : data.get(i).get("chfc").toString())); + ws.addCell(new Label(k + 14, i + 2, data.get(i).get("remarks") == null ? "" : data.get(i).get("remarks").toString())); + + } + }*/ + + wwb.write(); + wwb.close(); + + }catch (Exception e){ + ExceptionUtils.catchException(e, e.getMessage()); + } + } + + // public static void main(String[] args) { // ExcelUtil.writeExclFile("F:\\需求文档\\my.xls"); diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PremaritalCheckupController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PremaritalCheckupController.java index 351b80c..80a59f5 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PremaritalCheckupController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PremaritalCheckupController.java @@ -126,9 +126,9 @@ public class PremaritalCheckupController extends BaseController{ @RequestMapping(value = "/queryPremaritalExcel", method = RequestMethod.GET) @ResponseBody @TokenRequired - public BaseResponse queryPremaritalExcel(String provinceId,String cityId,String areaId,String streetId,String time,HttpServletRequest request){ + public void queryPremaritalExcel(String provinceId,String cityId,String areaId,String streetId,String time,HttpServletRequest request,HttpServletResponse response){ LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); - return premaritalCheckupFacade.queryPremaritalExcel(provinceId, cityId, areaId, streetId, time, loginState.getId()); + premaritalCheckupFacade.queryPremaritalExcel(provinceId, cityId, areaId, streetId, time, loginState.getId(),response); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java index 7ba2f20..fec8aec 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java @@ -2191,7 +2191,7 @@ public class PremaritalCheckupFacade { //婚检导出 - public BaseResponse queryPremaritalExcel(String provinceId,String cityId,String areaId,String streetId,String time,Integer userId){ + public void queryPremaritalExcel(String provinceId,String cityId,String areaId,String streetId,String time,Integer userId,HttpServletResponse response){ //获取用户权限医院和筛选条件的交集 List currentUserHospPermissions = areaCountFacade.getCurrentUserHospPermissions2(userId, provinceId, cityId, areaId); @@ -2480,7 +2480,14 @@ public class PremaritalCheckupFacade { datas.put("series", series); datas.put("tableDatas",result); datas.put("xAxis", xAxis); - return new BaseObjectResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(datas); + //return new BaseObjectResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(datas); + OutputStream out = null; + try{ + out = response.getOutputStream(); + }catch (Exception e){ + e.printStackTrace(); + } + ExcelUtil.WritePremaritalExcel(out,datas); }