修改工作量查询方法参数
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run

This commit is contained in:
Euni4U 2024-12-10 17:06:28 +08:00
parent 9f9fc10128
commit ea865b9f3d

View File

@ -156,35 +156,36 @@ public class EcganalysisparasController {
@Operation(summary = "导出医生工作量统计Excel")
@PreAuthorize("@ss.hasPermission('tblist:ecganalysisparas:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportWorkloadExcel(@RequestParam("startTime") String startTime,
public void exportWorkloadExcel(
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime,
@RequestParam(value = "doctorName", required = false) String doctorName,
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")
queryWrapper.select("doctorName, DATE(doctorDiagTime) as diagDate, COUNT(*) as count")
.ge("doctorDiagTime", startTime)
.le("doctorDiagTime", endTime)
.groupBy("doctorId, doctorName, doctorDiagTime")
.orderByDesc("doctorDiagTime");
.le("doctorDiagTime", endTime);
if (doctorName != null && !doctorName.isEmpty()) {
queryWrapper.eq("doctorName", doctorName);
}
queryWrapper.groupBy("doctorName, DATE(doctorDiagTime)")
.orderByAsc("doctorName")
.orderByDesc("diagDate");
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.setDoctorDiagTime(result.get("diagDate").toString());
workload.setCount((Long) result.get("count"));
workloadList.add(workload);
}
// 导出Excel
ExcelUtils.write(response, "医生工作量统计.xls", "数据", EcgWorkloadVO.class, BeanUtils.toBean(workloadList, EcgWorkloadVO.class));
ExcelUtils.write(response, "医生工作量统计.xls", "数据", EcgWorkloadVO.class, workloadList);
}
}