From 603f8f2bbb90b29f7237757daf8a76f572650cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=AE=99=E7=9A=AE=E7=9A=AE=E5=A8=83?= <2964346877@qq.com> Date: Wed, 28 Aug 2024 10:13:01 +0800 Subject: [PATCH] =?UTF-8?q?=20=20=20=20=E6=96=B0=E5=A2=9E=E6=9F=A5?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E6=8E=A5=E5=8F=A3=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MzZyHisController.java | 20 +++++++++++++++++++ .../entity/VJsjWzh7addnjreport.java | 11 +++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/docus/server/collection/controller/MzZyHisController.java b/src/main/java/com/docus/server/collection/controller/MzZyHisController.java index 341c0b9..d52e83d 100644 --- a/src/main/java/com/docus/server/collection/controller/MzZyHisController.java +++ b/src/main/java/com/docus/server/collection/controller/MzZyHisController.java @@ -1,7 +1,10 @@ package com.docus.server.collection.controller; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.write.builder.ExcelWriterBuilder; import com.docus.core.util.Func; import com.docus.infrastructure.core.exception.BaseException; +import com.docus.infrastructure.util.easyexcel.ExcelUtil; import com.docus.infrastructure.web.api.CommonResult; import com.docus.infrastructure.web.api.ResultCode; import com.docus.server.collection.converter.FirstPageCheckoutConverter; @@ -23,6 +26,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.OutputStream; import java.util.List; @Api("梅州中西HIS相关接口") @@ -73,7 +78,22 @@ public class MzZyHisController { List reports = vmp.getReport(dto); return CommonResult.success(reports); } + @ApiOperation("修改记录导出excel---按勾选") + @PostMapping("/export") + public void export(HttpServletResponse resp, @RequestBody List vos) { + OutputStream outputStream = ExcelUtil.getOutputStream("档案修改记录.xls", resp); + ExcelWriterBuilder write = EasyExcel.write(outputStream, VJsjWzh7addnjreport.class); + write.sheet("sheet1").doWrite(vos); + } + + @ApiOperation("修改导出excel---按条件") + @PostMapping("/exportAll") + public void exportAll(HttpServletResponse resp, + @RequestBody VJsjWzh7addnjreportDto dto) { + List reports = vmp.getReport(dto); + export(resp, reports); + } @ApiOperation("测试") @GetMapping("/test") public CommonResult test() { diff --git a/src/main/java/com/docus/server/collection/entity/VJsjWzh7addnjreport.java b/src/main/java/com/docus/server/collection/entity/VJsjWzh7addnjreport.java index 812a7d6..bbfb3d5 100644 --- a/src/main/java/com/docus/server/collection/entity/VJsjWzh7addnjreport.java +++ b/src/main/java/com/docus/server/collection/entity/VJsjWzh7addnjreport.java @@ -1,5 +1,7 @@ package com.docus.server.collection.entity; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.metadata.BaseRowModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -14,26 +16,33 @@ import java.util.Date; * @Version: 1.0 */ @Data -public class VJsjWzh7addnjreport { +public class VJsjWzh7addnjreport extends BaseRowModel { @ApiModelProperty(value = "姓名") + @ExcelProperty(value = {"姓名"}, index =0 ) private String name; @ApiModelProperty(value = "住院号") + @ExcelProperty(value = {"住院号"}, index =1 ) private String inpatientNo; @ApiModelProperty(value = "类型") + @ExcelProperty(value = {"类型"}, index =2 ) private String type; @ApiModelProperty(value = "申请科室") + @ExcelProperty(value = {"申请科室"}, index =3 ) private String dept; @ApiModelProperty(value = "项目") + @ExcelProperty(value = {"项目"}, index =4 ) private String item; @ApiModelProperty(value = "登记时间") + @ExcelProperty(value = {"登记时间"}, index =5 ) private Date RegistDateTime; @ApiModelProperty(value = "报告时间") + @ExcelProperty(value = {"报告时间"}, index =6 ) private Date ReportDateTime; }