一.pomxml中引入jar
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-full</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>5.1.1</version>
</dependency>
二.service代码
public void exportPatientDataList(PatientDataReportReqVo reqVo,HttpServletResponse response){
if (Objects.isNull(reqVo.getEndDate())){
reqVo.setEndDate(new Date());
}
if (Objects.isNull(reqVo.getStartDate())){
reqVo.setStartDate(DateUtil.offsetDay(new Date(),-365));
}
reqVo.setPageNum(1);
reqVo.setPageSize(1000);
BgPatientInfosResBean resBean = dataReportRpcService.queryBgPatientInfos(reqVo);
if (Objects.nonNull(resBean) && CollUtil.isNotEmpty(resBean.getBeanList()))