新增查报告接口导出

master
宇宙皮皮娃 11 months ago
parent a0b1726b27
commit ea6f1b60c2

@ -2,6 +2,7 @@ package com.docus.server.collection.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
import com.docus.core.util.DateUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.core.exception.BaseException;
import com.docus.infrastructure.util.easyexcel.ExcelUtil;
@ -12,6 +13,7 @@ import com.docus.server.collection.dto.FirstPageCheckoutInDTO;
import com.docus.server.collection.dto.FirstPageCheckoutRequest;
import com.docus.server.collection.dto.VJsjWzh7addnjreportDto;
import com.docus.server.collection.entity.VJsjWzh7addnjreport;
import com.docus.server.collection.entity.VJsjWzh7addnjreportVo;
import com.docus.server.collection.feign.service.MedicalrecordService;
import com.docus.server.collection.infrastructure.dao.sqlserver.VJsjWzh7addnjreportMapper;
import com.docus.server.collection.service.MzZyHisService;
@ -28,6 +30,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@Api("梅州中西HIS相关接口")
@ -80,10 +83,10 @@ public class MzZyHisController {
}
@ApiOperation("内镜超期导出excel---按勾选")
@PostMapping("/export")
public void export(HttpServletResponse resp, @RequestBody List<VJsjWzh7addnjreport> vos) {
public void export(HttpServletResponse resp, @RequestBody List<VJsjWzh7addnjreportVo> vos) {
OutputStream outputStream = ExcelUtil.getOutputStream("内镜超期报告.xls", resp);
ExcelWriterBuilder write = EasyExcel.write(outputStream, VJsjWzh7addnjreport.class);
ExcelWriterBuilder write = EasyExcel.write(outputStream, VJsjWzh7addnjreportVo.class);
write.sheet("sheet1").doWrite(vos);
}
@ -92,7 +95,19 @@ public class MzZyHisController {
public void exportAll(HttpServletResponse resp,
@RequestBody VJsjWzh7addnjreportDto dto) {
List<VJsjWzh7addnjreport> reports = vmp.getReport(dto);
export(resp, reports);
List<VJsjWzh7addnjreportVo> reportsVo=new ArrayList<VJsjWzh7addnjreportVo>();
reports.forEach(report->{
VJsjWzh7addnjreportVo vo=new VJsjWzh7addnjreportVo();
vo.setDept(report.getDept());
vo.setInpatientNo(report.getInpatientNo());
vo.setItem(report.getItem());
vo.setName(report.getName());
vo.setRegistDateTime(DateUtil.format(report.getRegistDateTime(),"yyyy-MM-dd HH:mm:ss"));
vo.setReportDateTime(DateUtil.format(report.getReportDateTime(),"yyyy-MM-dd HH:mm:ss"));
vo.setType(report.getType());
reportsVo.add(vo);
});
export(resp, reportsVo);
}
@ApiOperation("测试")
@GetMapping("/test")

@ -0,0 +1,46 @@
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;
/**
* @BelongsProject: docus-mzzy-collector
* @BelongsPackage: com.docus.server.collection.entity
* @Author: chierhao
* @CreateTime: 2024-07-31 15:47
* @Description: TODO
* @Version: 1.0
*/
@Data
public class VJsjWzh7addnjreportVo 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 String RegistDateTime;
@ApiModelProperty(value = "报告时间")
@ExcelProperty(value = {"报告时间"}, index =6 )
private String ReportDateTime;
}
Loading…
Cancel
Save