增加工作量接口
This commit is contained in:
parent
2da747ef1d
commit
6fc4de5eaf
@ -1829,5 +1829,55 @@ public class InspectPatientController {
|
||||
|
||||
return success(barcodeInfoVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getworkload")
|
||||
@Operation(summary = "根据日期获取卫生院体检统计")
|
||||
public CommonResult<List<WorkloadStatisticsVO>> getWorkload(@RequestParam("dates") @DateTimeFormat(pattern = "yyyy-MM-dd") List<LocalDate> dates) {
|
||||
// 获取指定日期范围内的所有患者补充信息
|
||||
List<PatientSupplementVO> supplements = patientService.getPatientSupplementsByDates(dates);
|
||||
|
||||
// 使用Map来存储统计结果,key为卫生院名称+行政村名称
|
||||
Map<String, WorkloadStatisticsVO> statisticsMap = new HashMap<>();
|
||||
|
||||
// 遍历所有补充信息进行统计
|
||||
for (PatientSupplementVO supplement : supplements) {
|
||||
String key = supplement.getOrgname() + "_" + supplement.getDistrictname();
|
||||
WorkloadStatisticsVO statistics = statisticsMap.computeIfAbsent(key, k -> {
|
||||
WorkloadStatisticsVO vo = new WorkloadStatisticsVO();
|
||||
vo.setOrgname(supplement.getOrgname());
|
||||
vo.setDistrictname(supplement.getDistrictname());
|
||||
vo.setOldmanflag(0);
|
||||
vo.setHtnflag(0);
|
||||
vo.setDiaflag(0);
|
||||
vo.setSmiflag(0);
|
||||
vo.setPulflag(0);
|
||||
vo.setSum(0);
|
||||
return vo;
|
||||
});
|
||||
|
||||
// 统计各项数量
|
||||
if ("1".equals(supplement.getOldmanflag())) {
|
||||
statistics.setOldmanflag(statistics.getOldmanflag() + 1);
|
||||
}
|
||||
if ("1".equals(supplement.getHtnflag())) {
|
||||
statistics.setHtnflag(statistics.getHtnflag() + 1);
|
||||
}
|
||||
if ("1".equals(supplement.getDiaflag())) {
|
||||
statistics.setDiaflag(statistics.getDiaflag() + 1);
|
||||
}
|
||||
if ("1".equals(supplement.getSmiflag())) {
|
||||
statistics.setSmiflag(statistics.getSmiflag() + 1);
|
||||
}
|
||||
if ("1".equals(supplement.getPulflag())) {
|
||||
statistics.setPulflag(statistics.getPulflag() + 1);
|
||||
}
|
||||
|
||||
// 计算总数
|
||||
statistics.setSum(statistics.getOldmanflag() + statistics.getHtnflag() +
|
||||
statistics.getDiaflag() + statistics.getSmiflag() +
|
||||
statistics.getPulflag());
|
||||
}
|
||||
|
||||
// 将Map转换为List并返回
|
||||
return success(new ArrayList<>(statisticsMap.values()));
|
||||
}
|
||||
}
|
@ -1,7 +1,11 @@
|
||||
package cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PatientSupplementVO {
|
||||
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WorkloadStatisticsVO {
|
||||
|
||||
@Schema(description = "卫生院名称")
|
||||
private String orgname;
|
||||
|
||||
@Schema(description = "行政村名称")
|
||||
private String districtname;
|
||||
|
||||
@Schema(description = "老年人数量")
|
||||
private Integer oldmanflag;
|
||||
|
||||
@Schema(description = "高血压数量")
|
||||
private Integer htnflag;
|
||||
|
||||
@Schema(description = "糖尿病数量")
|
||||
private Integer diaflag;
|
||||
|
||||
@Schema(description = "精神病数量")
|
||||
private Integer smiflag;
|
||||
|
||||
@Schema(description = "肺结核数量")
|
||||
private Integer pulflag;
|
||||
|
||||
@Schema(description = "总数")
|
||||
private Integer sum;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.inspect.service.inspectpatient;
|
||||
|
||||
import java.util.*;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo.*;
|
||||
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectpatient.InspectPatientDO;
|
||||
@ -140,4 +141,14 @@ public interface InspectPatientService {
|
||||
*/
|
||||
|
||||
void updateMedicalDateTime(String medicalSn, Date medicalDateTime);
|
||||
|
||||
/**
|
||||
* 根据日期列表获取患者补充信息
|
||||
*
|
||||
* @param dates 日期列表
|
||||
* @return 患者补充信息列表
|
||||
*/
|
||||
List<PatientSupplementVO> getPatientSupplementsByDates(List<LocalDate> dates);
|
||||
|
||||
|
||||
}
|
@ -38,6 +38,7 @@ import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -749,5 +750,32 @@ public class InspectPatientServiceImpl implements InspectPatientService {
|
||||
|
||||
patientMapper.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PatientSupplementVO> getPatientSupplementsByDates(List<LocalDate> dates) {
|
||||
if (dates == null || dates.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<InspectPatientDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(InspectPatientDO::getPrinttime, dates);
|
||||
|
||||
// 查询患者信息
|
||||
List<InspectPatientDO> patients = patientMapper.selectList(queryWrapper);
|
||||
|
||||
// 转换为补充信息VO
|
||||
return patients.stream().map(patient -> {
|
||||
PatientSupplementVO vo = new PatientSupplementVO();
|
||||
vo.setMedicalSn(patient.getMedicalSn());
|
||||
vo.setOrgname(patient.getOrgname());
|
||||
vo.setDistrictname(patient.getDistrictname());
|
||||
vo.setOldmanflag(patient.getOldmanflag());
|
||||
vo.setHtnflag(patient.getHtnflag());
|
||||
vo.setDiaflag(patient.getDiaflag());
|
||||
vo.setSmiflag(patient.getSmiflag());
|
||||
vo.setPulflag(patient.getPulflag());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user