diff --git a/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/controller/MedicalRecordController.java b/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/controller/MedicalRecordController.java index bfb030c..2bf965d 100644 --- a/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/controller/MedicalRecordController.java +++ b/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/controller/MedicalRecordController.java @@ -3,22 +3,14 @@ package net.lab1024.sa.admin.module.app.medicalrecord.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import net.lab1024.sa.admin.constant.AdminSwaggerTagConst; -import net.lab1024.sa.admin.module.app.medicalrecord.domain.MedicalRecordAddForm; -import net.lab1024.sa.admin.module.app.medicalrecord.domain.MedicalRecordDetailVO; -import net.lab1024.sa.admin.module.app.medicalrecord.domain.MedicalRecordListVO; -import net.lab1024.sa.admin.module.app.medicalrecord.domain.MedicalRecordQueryForm; -import net.lab1024.sa.admin.module.app.medicalrecord.domain.MedicalRecordUpdateForm; +import net.lab1024.sa.admin.module.app.medicalrecord.domain.*; import net.lab1024.sa.admin.module.app.medicalrecord.service.MedicalRecordService; import net.lab1024.sa.common.common.domain.PageResult; import net.lab1024.sa.common.common.domain.ResponseDTO; import net.lab1024.sa.common.common.util.SmartRequestUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @@ -62,12 +54,12 @@ public class MedicalRecordController { @ApiOperation("获取有效病例数量") @GetMapping("/medicalRecord/count") - public ResponseDTO addCaseplatformAcApp() { + public ResponseDTO getMedicalRecordCount(@Valid @ModelAttribute GetMedicalRecordCountForm form) { Long expertId = SmartRequestUtil.getRequestUserId(); if (expertId == null) { return ResponseDTO.error(LOGIN_STATE_INVALID); } - return medicalRecordService.getMedicalRecordCount(expertId); + return medicalRecordService.getMedicalRecordCount(form,expertId); } } diff --git a/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/domain/GetMedicalRecordCountForm.java b/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/domain/GetMedicalRecordCountForm.java new file mode 100644 index 0000000..22db05c --- /dev/null +++ b/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/domain/GetMedicalRecordCountForm.java @@ -0,0 +1,15 @@ +package net.lab1024.sa.admin.module.app.medicalrecord.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +@Data +public class GetMedicalRecordCountForm { + @ApiModelProperty(value = "类型", required = true) + @NotNull(message = "类型 不能为空") + private Integer type = 1; +} diff --git a/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/service/MedicalRecordService.java b/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/service/MedicalRecordService.java index ff0c53c..c637fd1 100644 --- a/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/service/MedicalRecordService.java +++ b/sa-admin/src/main/java/net/lab1024/sa/admin/module/app/medicalrecord/service/MedicalRecordService.java @@ -453,6 +453,130 @@ public class MedicalRecordService { return ResponseDTO.app_ok(); } +// // 检测所有时间 +// public ResponseDTO checkAllTime(MedicalRecordUpdateForm form){ +// // 转换为 LocalDate +// LocalDate admissionDate = form.getAdmissionTime().toLocalDate(); +// LocalDate dischargeDate = form.getDischargeTime().toLocalDate(); +// LocalDate headDate = form.getHeadTime().toLocalDate(); +// LocalDate afterDate = form.getAfterTime().toLocalDate(); +// LocalDate lastDate = form.getLastTime() != null ? form.getLastTime().toLocalDate() : null; +// List dpmas = form.getDpmas(); +// +// // 时间基准线 +// LocalDate targetDate = LocalDate.of(2024, 10, 1); +// +// // 1. 所有时间必须 >= 2024-10-01(允许等于) +// if (!admissionDate.isEqual(targetDate) && !admissionDate.isAfter(targetDate)) { +// return ResponseDTO.userErrorParam("入院时间需在2024年10月1日或之后"); +// } +// if (!dischargeDate.isEqual(targetDate) && !dischargeDate.isAfter(targetDate)) { +// return ResponseDTO.userErrorParam("出院时间需在2024年10月1日或之后"); +// } +// if (!headDate.isEqual(targetDate) && !headDate.isAfter(targetDate)) { +// return ResponseDTO.userErrorParam("首次人工肝治疗前检测时间需在2024年10月1日或之后"); +// } +// if (!afterDate.isEqual(targetDate) && !afterDate.isAfter(targetDate)) { +// return ResponseDTO.userErrorParam("首次人工肝治疗后检测时间需在2024年10月1日或之后"); +// } +// +// for (DpmsAddForm dpma : dpmas) { +// LocalDate treatTime = dpma.getTreatTime().toLocalDate(); +// +// if (!treatTime.isEqual(targetDate) && !treatTime.isAfter(targetDate)) { +// return ResponseDTO.userErrorParam("人工肝治疗时间需在2024年10月1日或之后"); +// } +// } +// +// if (lastDate != null) { +// if (!lastDate.isEqual(targetDate) && !lastDate.isAfter(targetDate)) { +// return ResponseDTO.userErrorParam("最后一次人工肝治疗后检测时间需在2024年10月1日或之后"); +// } +// } +// +// // 2. 出院时间必须大于入院时间 +// if (dpmas.size() > 1){ +// if (!dischargeDate.isAfter(admissionDate)) { +// return ResponseDTO.userErrorParam("出院时间必须大于入院时间"); +// } +// } +// +// // 3. 所有时间必须在入院与出院之间(含当天) +// if (headDate.isBefore(admissionDate) || headDate.isAfter(dischargeDate)) { +// return ResponseDTO.userErrorParam("首次人工肝治疗前检测时间必须在入院和出院时间之间"); +// } +// if (afterDate.isBefore(admissionDate) || afterDate.isAfter(dischargeDate)) { +// return ResponseDTO.userErrorParam("首次人工肝治疗后检测时间必须在入院和出院时间之间"); +// } +// if (lastDate != null && (lastDate.isBefore(admissionDate) || lastDate.isAfter(dischargeDate))) { +// return ResponseDTO.userErrorParam("最后一次人工肝治疗后检测时间必须在入院和出院时间之间"); +// } +// +// for (int i = 0; i < dpmas.size(); i++) { +// DpmsAddForm dpma = dpmas.get(i); +// LocalDate treatTime = dpma.getTreatTime().toLocalDate(); +// +// if (dpmas.size() > 1) { +// // 多次治疗:必须严格在入院和出院之间(不能等于) +// if (!treatTime.isAfter(admissionDate) || !treatTime.isBefore(dischargeDate)) { +// return ResponseDTO.userErrorParam("第 " + (i + 1) + " 次人工肝治疗时间必须在入院和出院时间之间"); +// } +// } else { +// // 只有一次治疗:允许等于入院或出院时间 +// if (treatTime.isBefore(admissionDate) || treatTime.isAfter(dischargeDate)) { +// return ResponseDTO.userErrorParam("人工肝治疗时间必须在入院和出院时间之间"); +// } +// } +// } +// +// // 4. 治疗时间不能是同一天,且必须递增 +// for (int i = 0; i < dpmas.size(); i++) { +// DpmsAddForm current = dpmas.get(i); +// for (int j = i + 1; j < dpmas.size(); j++) { +// DpmsAddForm next = dpmas.get(j); +// if (current.getTreatTime().toLocalDate().isEqual(next.getTreatTime().toLocalDate())) { +// return ResponseDTO.userErrorParam("人工肝治疗时间不能为同一天:" + current.getTreatTime().toLocalDate()); +// } +// } +// } +// +// for (int i = 1; i < dpmas.size(); i++) { +// LocalDate prev = dpmas.get(i - 1).getTreatTime().toLocalDate(); +// LocalDate curr = dpmas.get(i).getTreatTime().toLocalDate(); +// if (curr.isBefore(prev)) { +// return ResponseDTO.userErrorParam("第 " + (i + 1) + " 次治疗时间必须晚于第 " + i + " 次"); +// } +// } +// +// // 5. 时间顺序关系校验 +// LocalDate firstTreatTime = dpmas.get(0).getTreatTime().toLocalDate(); +// +// if (headDate.isAfter(firstTreatTime)) { +// return ResponseDTO.userErrorParam("首次人工肝治疗前检测时间必须早于第一次治疗时间"); +// } +// +// if (afterDate.isBefore(firstTreatTime)) { +// return ResponseDTO.userErrorParam("首次人工肝治疗后检测时间必须在第一次治疗时间之后"); +// } +// +// if (dpmas.size() > 1) { +// if (lastDate == null) { +// return ResponseDTO.userErrorParam("人工肝治疗次数大于1,需填入最后一次人工肝治疗后检测时间"); +// } +// +// LocalDate lastTreatTime = dpmas.get(dpmas.size() - 1).getTreatTime().toLocalDate(); +// if (lastDate.isBefore(lastTreatTime)) { +// return ResponseDTO.userErrorParam("最后一次人工肝治疗后检测时间必须在最后一次治疗时间之后"); +// } +// +// if (lastDate.isAfter(dischargeDate)) { +// return ResponseDTO.userErrorParam("最后一次人工肝治疗后检测时间必须在出院时间之前"); +// } +// } +// +// return ResponseDTO.app_ok(); +// } + // 检测所有时间 public ResponseDTO checkAllTime(MedicalRecordUpdateForm form){ // 转换为 LocalDate @@ -463,115 +587,49 @@ public class MedicalRecordService { LocalDate lastDate = form.getLastTime() != null ? form.getLastTime().toLocalDate() : null; List dpmas = form.getDpmas(); - // 时间基准线 - LocalDate targetDate = LocalDate.of(2024, 10, 1); - - // 1. 所有时间必须 >= 2024-10-01(允许等于) - if (!admissionDate.isEqual(targetDate) && !admissionDate.isAfter(targetDate)) { - return ResponseDTO.userErrorParam("入院时间需在2024年10月1日或之后"); - } - if (!dischargeDate.isEqual(targetDate) && !dischargeDate.isAfter(targetDate)) { - return ResponseDTO.userErrorParam("出院时间需在2024年10月1日或之后"); - } - if (!headDate.isEqual(targetDate) && !headDate.isAfter(targetDate)) { - return ResponseDTO.userErrorParam("首次人工肝治疗前检测时间需在2024年10月1日或之后"); - } - if (!afterDate.isEqual(targetDate) && !afterDate.isAfter(targetDate)) { - return ResponseDTO.userErrorParam("首次人工肝治疗后检测时间需在2024年10月1日或之后"); + if (admissionDate.isBefore(LocalDate.of(2024, 10, 1))) { + return ResponseDTO.userErrorParam("入院时间不能早于 2024年10月1日"); } - for (DpmsAddForm dpma : dpmas) { - LocalDate treatTime = dpma.getTreatTime().toLocalDate(); - - if (!treatTime.isEqual(targetDate) && !treatTime.isAfter(targetDate)) { - return ResponseDTO.userErrorParam("人工肝治疗时间需在2024年10月1日或之后"); - } + if (headDate.isBefore(admissionDate)) { + return ResponseDTO.userErrorParam("首次人工肝治疗前检测时间不能早于入院时间"); } - if (lastDate != null) { - if (!lastDate.isEqual(targetDate) && !lastDate.isAfter(targetDate)) { - return ResponseDTO.userErrorParam("最后一次人工肝治疗后检测时间需在2024年10月1日或之后"); - } + if (dpmas == null || dpmas.isEmpty()) { + return ResponseDTO.userErrorParam("至少需要填写一次治疗信息"); } - // 2. 出院时间必须大于入院时间 - if (dpmas.size() > 1){ - if (!dischargeDate.isAfter(admissionDate)) { - return ResponseDTO.userErrorParam("出院时间必须大于入院时间"); - } + LocalDate firstTreatDate = dpmas.get(0).getTreatTime().toLocalDate(); + if (firstTreatDate.isBefore(headDate)) { + return ResponseDTO.userErrorParam("第一次治疗时间不能早于首次人工肝治疗前检测时间"); } - // 3. 所有时间必须在入院与出院之间(含当天) - if (headDate.isBefore(admissionDate) || headDate.isAfter(dischargeDate)) { - return ResponseDTO.userErrorParam("首次人工肝治疗前检测时间必须在入院和出院时间之间"); - } - if (afterDate.isBefore(admissionDate) || afterDate.isAfter(dischargeDate)) { - return ResponseDTO.userErrorParam("首次人工肝治疗后检测时间必须在入院和出院时间之间"); - } - if (lastDate != null && (lastDate.isBefore(admissionDate) || lastDate.isAfter(dischargeDate))) { - return ResponseDTO.userErrorParam("最后一次人工肝治疗后检测时间必须在入院和出院时间之间"); - } - - for (int i = 0; i < dpmas.size(); i++) { - DpmsAddForm dpma = dpmas.get(i); - LocalDate treatTime = dpma.getTreatTime().toLocalDate(); - - if (dpmas.size() > 1) { - // 多次治疗:必须严格在入院和出院之间(不能等于) - if (!treatTime.isAfter(admissionDate) || !treatTime.isBefore(dischargeDate)) { - return ResponseDTO.userErrorParam("第 " + (i + 1) + " 次人工肝治疗时间必须在入院和出院时间之间"); - } - } else { - // 只有一次治疗:允许等于入院或出院时间 - if (treatTime.isBefore(admissionDate) || treatTime.isAfter(dischargeDate)) { - return ResponseDTO.userErrorParam("人工肝治疗时间必须在入院和出院时间之间"); - } - } - } - - // 4. 治疗时间不能是同一天,且必须递增 - for (int i = 0; i < dpmas.size(); i++) { - DpmsAddForm current = dpmas.get(i); - for (int j = i + 1; j < dpmas.size(); j++) { - DpmsAddForm next = dpmas.get(j); - if (current.getTreatTime().toLocalDate().isEqual(next.getTreatTime().toLocalDate())) { - return ResponseDTO.userErrorParam("人工肝治疗时间不能为同一天:" + current.getTreatTime().toLocalDate()); - } - } + if (afterDate.isBefore(firstTreatDate)) { + return ResponseDTO.userErrorParam("首次人工肝治疗后检测时间不能早于第一次治疗时间"); } + // 检查治疗时间是否递增 for (int i = 1; i < dpmas.size(); i++) { LocalDate prev = dpmas.get(i - 1).getTreatTime().toLocalDate(); LocalDate curr = dpmas.get(i).getTreatTime().toLocalDate(); if (curr.isBefore(prev)) { - return ResponseDTO.userErrorParam("第 " + (i + 1) + " 次治疗时间必须晚于第 " + i + " 次"); + return ResponseDTO.userErrorParam("第 " + (i + 1) + " 次人工肝治疗时间不能早于第 " + i + " 次"); } } - // 5. 时间顺序关系校验 - LocalDate firstTreatTime = dpmas.get(0).getTreatTime().toLocalDate(); + if (lastDate != null) { + LocalDate lastTreatDate = dpmas.get(dpmas.size() - 1).getTreatTime().toLocalDate(); + if (lastDate.isBefore(lastTreatDate)) { + return ResponseDTO.userErrorParam("最后一次人工肝治疗后检测时间不能早于最后一次治疗时间"); + } - if (headDate.isAfter(firstTreatTime)) { - return ResponseDTO.userErrorParam("首次人工肝治疗前检测时间必须早于第一次治疗时间"); + if (dischargeDate.isBefore(lastDate)) { + return ResponseDTO.userErrorParam("出院时间不能早于最后一次人工肝治疗后检测时间"); + } } - if (afterDate.isBefore(firstTreatTime)) { - return ResponseDTO.userErrorParam("首次人工肝治疗后检测时间必须在第一次治疗时间之后"); - } - - if (dpmas.size() > 1) { - if (lastDate == null) { - return ResponseDTO.userErrorParam("人工肝治疗次数大于1,需填入最后一次人工肝治疗后检测时间"); - } - - LocalDate lastTreatTime = dpmas.get(dpmas.size() - 1).getTreatTime().toLocalDate(); - if (lastDate.isBefore(lastTreatTime)) { - return ResponseDTO.userErrorParam("最后一次人工肝治疗后检测时间必须在最后一次治疗时间之后"); - } - - if (lastDate.isAfter(dischargeDate)) { - return ResponseDTO.userErrorParam("最后一次人工肝治疗后检测时间必须在出院时间之前"); - } + if (dischargeDate.isBefore(afterDate)) { + return ResponseDTO.userErrorParam("出院时间不能早于首次人工肝治疗后检测时间"); } return ResponseDTO.app_ok(); @@ -668,11 +726,23 @@ public class MedicalRecordService { } // 获取病例数量 - public ResponseDTO getMedicalRecordCount(Long expertId) { + public ResponseDTO getMedicalRecordCount(GetMedicalRecordCountForm form ,Long expertId) { // 获取专家提交病例数量 LambdaQueryWrapper caseCountQueryWrapper = new LambdaQueryWrapper<>(); caseCountQueryWrapper.eq(MedicalRecordEntity::getExpertId,expertId); - caseCountQueryWrapper.in(MedicalRecordEntity::getStatus, Arrays.asList(0, 1)); + if (form.getType() == 1){ + // 待审核-审核通过 + caseCountQueryWrapper.in(MedicalRecordEntity::getStatus, Arrays.asList(0, 1)); + } else if (form.getType() == 2) { + // 待审核 + caseCountQueryWrapper.eq(MedicalRecordEntity::getStatus,0); + } else if (form.getType() == 3) { + // 审核通过 + caseCountQueryWrapper.eq(MedicalRecordEntity::getStatus,1); + } else if (form.getType() == 4) { + // 全部 + caseCountQueryWrapper.in(MedicalRecordEntity::getStatus, Arrays.asList(0, 1,2)); + } Long caseCount = medicalRecorDao.selectCount(caseCountQueryWrapper); return ResponseDTO.app_ok(caseCount); diff --git a/sa-admin/src/main/java/net/lab1024/sa/admin/module/business/caseplatformcase/service/CaseplatformCaseService.java b/sa-admin/src/main/java/net/lab1024/sa/admin/module/business/caseplatformcase/service/CaseplatformCaseService.java index e240eac..504d907 100644 --- a/sa-admin/src/main/java/net/lab1024/sa/admin/module/business/caseplatformcase/service/CaseplatformCaseService.java +++ b/sa-admin/src/main/java/net/lab1024/sa/admin/module/business/caseplatformcase/service/CaseplatformCaseService.java @@ -393,6 +393,8 @@ public class CaseplatformCaseService { * @param case_id */ public void settlement(Long case_id){ + // 获取病例数据 + caseplatformCaseDao.settlement(case_id); }