增加导出Excel
This commit is contained in:
parent
96c127133d
commit
4a867b4c87
@ -33,6 +33,7 @@ import cn.iocoder.yudao.module.tblist.service.ecganalysisparas.EcganalysisparasS
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
@Tag(name = "管理后台 - 心电分析数据")
|
||||
@RestController
|
||||
@ -129,6 +130,7 @@ public class EcganalysisparasController {
|
||||
ExcelUtils.write(response, "心电分析数据.xls", "数据", EcganalysisparasRespVO.class,
|
||||
BeanUtils.toBean(list, EcganalysisparasRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getexamIDdata")
|
||||
@Operation(summary = "根据examId获得心电数据")
|
||||
@Parameter(name = "examID", description = "检查编号", required = true, example = "1024")
|
||||
@ -149,4 +151,40 @@ public class EcganalysisparasController {
|
||||
|
||||
return success(doList);
|
||||
}
|
||||
|
||||
@GetMapping("/export-workload-excel")
|
||||
@Operation(summary = "导出医生工作量统计Excel")
|
||||
@PreAuthorize("@ss.hasPermission('tblist:ecganalysisparas:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportWorkloadExcel(@RequestParam("startTime") String startTime,
|
||||
@RequestParam("endTime") String endTime,
|
||||
HttpServletResponse response) throws IOException {
|
||||
// 设置响应头
|
||||
// response.setContentType("application/vnd.ms-excel");
|
||||
// response.setCharacterEncoding("utf-8");
|
||||
// String fileName = URLEncoder.encode("医生工作量统计", "UTF-8").replaceAll("\\+", "%20");
|
||||
// response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xls");
|
||||
|
||||
QueryWrapper<EcganalysisparasDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("doctorId, doctorName, doctorDiagTime, COUNT(*) as count")
|
||||
.ge("doctorDiagTime", startTime)
|
||||
.le("doctorDiagTime", endTime)
|
||||
.groupBy("doctorId, doctorName, doctorDiagTime")
|
||||
.orderByDesc("doctorDiagTime");
|
||||
|
||||
List<Map<String, Object>> resultList = ecganalysisparasMapper.selectMaps(queryWrapper);
|
||||
List<EcgWorkloadVO> workloadList = new ArrayList<>();
|
||||
|
||||
for (Map<String, Object> result : resultList) {
|
||||
EcgWorkloadVO workload = new EcgWorkloadVO();
|
||||
//workload.setDoctorId((Integer) result.get("doctorId"));
|
||||
workload.setDoctorName(result.get("doctorName").toString());
|
||||
workload.setDoctorDiagTime(result.get("doctorDiagTime").toString().replace('T',' '));
|
||||
workload.setCount((Long) result.get("count"));
|
||||
workloadList.add(workload);
|
||||
}
|
||||
|
||||
// 导出Excel
|
||||
ExcelUtils.write(response, "医生工作量统计.xls", "数据", EcgWorkloadVO.class, BeanUtils.toBean(workloadList, EcgWorkloadVO.class));
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.tblist.controller.admin.ecganalysisparas.vo;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 医生工作量统计 VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EcgWorkloadVO {
|
||||
|
||||
@Schema(description = "医生诊断的时间")
|
||||
@ExcelProperty("诊断时间")
|
||||
private String doctorDiagTime;
|
||||
|
||||
@Schema(description = "诊断医生的姓名", example = "赵六")
|
||||
@ExcelProperty("医生姓名")
|
||||
private String doctorName;
|
||||
|
||||
// @Schema(description = "诊断医生的医生id", example = "29431")
|
||||
// @ExcelProperty("医生ID")
|
||||
// private Integer doctorId;
|
||||
|
||||
@Schema(description = "诊断数量")
|
||||
@ExcelProperty("诊断数量")
|
||||
private Long count;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user