diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/appservice/IEmrQualityAppService.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/appservice/IEmrQualityAppService.java index e17c285eb..dd45c6d9c 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/appservice/IEmrQualityAppService.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/appservice/IEmrQualityAppService.java @@ -8,4 +8,6 @@ public interface IEmrQualityAppService { List> getDefects(Long encounterId); Map getDefectStatistics(String startDate, String endDate); Map getCompletionRate(String startDate, String endDate); + Map startDefectRectify(Long defectId); + Map completeDefectRectify(Long defectId); } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/appservice/impl/EmrQualityAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/appservice/impl/EmrQualityAppServiceImpl.java index a4975dfe9..7d537ffc7 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/appservice/impl/EmrQualityAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/appservice/impl/EmrQualityAppServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; +import java.util.Date; @Service public class EmrQualityAppServiceImpl implements IEmrQualityAppService { @Autowired private EmrQualityScoreMapper scoreMapper; @@ -80,4 +81,37 @@ public class EmrQualityAppServiceImpl implements IEmrQualityAppService { result.put("totalEncounters", 0); result.put("completedEmr", 0); result.put("overdueEmr", 0); result.put("completionRate", 100); return result; } + + @Override + public Map startDefectRectify(Long defectId) { + Map result = new HashMap<>(); + EmrDefect defect = defectMapper.selectById(defectId); + if (defect != null) { + defect.setRectifyStatus("RECTIFYING"); + defectMapper.updateById(defect); + result.put("success", true); + result.put("message", "开始整改"); + } else { + result.put("success", false); + result.put("message", "缺陷记录不存在"); + } + return result; + } + + @Override + public Map completeDefectRectify(Long defectId) { + Map result = new HashMap<>(); + EmrDefect defect = defectMapper.selectById(defectId); + if (defect != null) { + defect.setRectifyStatus("RECTIFIED"); + defect.setRectifyTime(new Date()); + defectMapper.updateById(defect); + result.put("success", true); + result.put("message", "整改完成"); + } else { + result.put("success", false); + result.put("message", "缺陷记录不存在"); + } + return result; + } } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/controller/EmrQualityController.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/controller/EmrQualityController.java index 6bf9f16f2..37f0aa162 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/controller/EmrQualityController.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/quality/controller/EmrQualityController.java @@ -30,4 +30,12 @@ public class EmrQualityController { @Operation(summary = "完成率") @GetMapping("/completion-rate") public AjaxResult completionRate(@RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate) { return AjaxResult.success(emrQualityAppService.getCompletionRate(startDate, endDate)); } + + @Operation(summary = "开始整改缺陷") @PostMapping("/defect/rectify/{defectId}") + public AjaxResult startDefectRectify(@PathVariable Long defectId) { + return AjaxResult.success(emrQualityAppService.startDefectRectify(defectId)); } + + @Operation(summary = "完成整改缺陷") @PostMapping("/defect/complete/{defectId}") + public AjaxResult completeDefectRectify(@PathVariable Long defectId) { + return AjaxResult.success(emrQualityAppService.completeDefectRectify(defectId)); } }