From 09e43e4b8cb54e5eb82cc85158a0ef142c96ca78 Mon Sep 17 00:00:00 2001 From: chenqi Date: Wed, 17 Jun 2026 13:47:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(emr):=20=E7=97=85=E5=8E=86=E6=97=B6?= =?UTF-8?q?=E6=95=88=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appservice/IEmrTimelinessAppService.java | 14 + .../impl/EmrTimelinessAppServiceImpl.java | 84 ++++++ .../controller/EmrTimelinessController.java | 44 +++ healthlink-his-ui/src/api/emr.js | 3 + .../inpatientDoctor/EmrTimelinessMonitor.vue | 254 ++++++++++++++++++ 5 files changed, 399 insertions(+) create mode 100644 healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/appservice/IEmrTimelinessAppService.java create mode 100644 healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/appservice/impl/EmrTimelinessAppServiceImpl.java create mode 100644 healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/controller/EmrTimelinessController.java create mode 100644 healthlink-his-ui/src/views/inpatientDoctor/EmrTimelinessMonitor.vue diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/appservice/IEmrTimelinessAppService.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/appservice/IEmrTimelinessAppService.java new file mode 100644 index 000000000..d7523e216 --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/appservice/IEmrTimelinessAppService.java @@ -0,0 +1,14 @@ +package com.healthlink.his.web.emr.appservice; + +import com.healthlink.his.emr.domain.EmrTimeliness; +import com.healthlink.his.emr.dto.EmrTimelinessStatisticsDto; + +import java.util.List; +import java.util.Map; + +public interface IEmrTimelinessAppService { + + EmrTimelinessStatisticsDto checkTimeliness(Long encounterId); + + Map getTimelinessAlerts(String emrType, String status, String departmentName, int pageNum, int pageSize); +} diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/appservice/impl/EmrTimelinessAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/appservice/impl/EmrTimelinessAppServiceImpl.java new file mode 100644 index 000000000..b3a871098 --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/appservice/impl/EmrTimelinessAppServiceImpl.java @@ -0,0 +1,84 @@ +package com.healthlink.his.web.emr.appservice.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.healthlink.his.emr.domain.EmrTimeliness; +import com.healthlink.his.emr.dto.EmrTimelinessStatisticsDto; +import com.healthlink.his.emr.service.IEmrTimelinessService; +import com.healthlink.his.web.emr.appservice.IEmrTimelinessAppService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; + +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@Service +public class EmrTimelinessAppServiceImpl implements IEmrTimelinessAppService { + + @Resource + private IEmrTimelinessService emrTimelinessService; + + @Override + @Transactional(rollbackFor = Exception.class) + public EmrTimelinessStatisticsDto checkTimeliness(Long encounterId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (encounterId != null) { + wrapper.eq(EmrTimeliness::getEncounterId, encounterId); + } + wrapper.eq(EmrTimeliness::getStatus, "PENDING"); + List pendingList = emrTimelinessService.list(wrapper); + + Date now = new Date(); + int overdueCount = 0; + for (EmrTimeliness record : pendingList) { + if (record.getDeadlineTime() != null && now.after(record.getDeadlineTime())) { + record.setStatus("OVERDUE"); + emrTimelinessService.updateById(record); + overdueCount++; + } + } + + EmrTimelinessStatisticsDto stats = new EmrTimelinessStatisticsDto(); + LambdaQueryWrapper countWrapper = new LambdaQueryWrapper<>(); + if (encounterId != null) { + countWrapper.eq(EmrTimeliness::getEncounterId, encounterId); + } + long total = emrTimelinessService.count(countWrapper); + + countWrapper.eq(EmrTimeliness::getStatus, "COMPLETED"); + long completed = emrTimelinessService.count(countWrapper); + + countWrapper.eq(EmrTimeliness::getStatus, "OVERDUE"); + long overdue = emrTimelinessService.count(countWrapper); + + long pending = total - completed - overdue; + double rate = total > 0 ? Math.round(completed * 10000.0 / total) / 100.0 : 0; + + stats.setTotalCount(total); + stats.setCompletedCount(completed); + stats.setOverdueCount(overdue); + stats.setPendingCount(pending); + stats.setCompletionRate(rate); + return stats; + } + + @Override + public Map getTimelinessAlerts(String emrType, String status, String departmentName, int pageNum, int pageSize) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StringUtils.hasText(status), EmrTimeliness::getStatus, status); + wrapper.eq(StringUtils.hasText(emrType), EmrTimeliness::getEmrType, emrType); + wrapper.eq(StringUtils.hasText(departmentName), EmrTimeliness::getDepartmentName, departmentName); + wrapper.orderByAsc(EmrTimeliness::getDeadlineTime); + + Page page = emrTimelinessService.page(new Page<>(pageNum, pageSize), wrapper); + + Map result = new LinkedHashMap<>(); + result.put("total", page.getTotal()); + result.put("rows", page.getRecords()); + return result; + } +} diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/controller/EmrTimelinessController.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/controller/EmrTimelinessController.java new file mode 100644 index 000000000..8fba25ac1 --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/emr/controller/EmrTimelinessController.java @@ -0,0 +1,44 @@ +package com.healthlink.his.web.emr.controller; + +import com.core.common.core.domain.R; +import com.healthlink.his.emr.domain.EmrTimeliness; +import com.healthlink.his.emr.dto.EmrTimelinessStatisticsDto; +import com.healthlink.his.web.emr.appservice.IEmrTimelinessAppService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +@RestController +@RequestMapping("/emr/timeliness") +@Slf4j +@AllArgsConstructor +@Tag(name = "病历时限监控") +public class EmrTimelinessController { + + private final IEmrTimelinessAppService emrTimelinessAppService; + + @PostMapping("/check") + @PreAuthorize("@ss.hasPermi('inpatient:emr:edit')") + @Operation(summary = "执行病历时限检查") + public R checkTimeliness( + @RequestParam(value = "encounterId", required = false) Long encounterId) { + return R.ok(emrTimelinessAppService.checkTimeliness(encounterId)); + } + + @GetMapping("/alerts") + @PreAuthorize("@ss.hasPermi('inpatient:emr:list')") + @Operation(summary = "获取病历时限提醒列表") + public R> getTimelinessAlerts( + @RequestParam(value = "emrType", required = false) String emrType, + @RequestParam(value = "status", required = false) String status, + @RequestParam(value = "departmentName", required = false) String departmentName, + @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, + @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) { + return R.ok(emrTimelinessAppService.getTimelinessAlerts(emrType, status, departmentName, pageNum, pageSize)); + } +} diff --git a/healthlink-his-ui/src/api/emr.js b/healthlink-his-ui/src/api/emr.js index d1e48aee4..feb01352e 100644 --- a/healthlink-his-ui/src/api/emr.js +++ b/healthlink-his-ui/src/api/emr.js @@ -16,3 +16,6 @@ export function compareEmrVersions(id1, id2) { return request({ url: "/emr/versi export function checkCompleteness(emrId, encounterId) { return request({ url: "/emr/completeness/check", method: "post", params: { emrId, encounterId } }) } export function getCompletenessResults(emrId) { return request({ url: "/emr/completeness/results/" + emrId, method: "get" }) } + +export function checkTimeliness(encounterId) { return request({ url: "/emr/timeliness/check", method: "post", params: { encounterId } }) } +export function getTimelinessAlerts(params) { return request({ url: "/emr/timeliness/alerts", method: "get", params }) } diff --git a/healthlink-his-ui/src/views/inpatientDoctor/EmrTimelinessMonitor.vue b/healthlink-his-ui/src/views/inpatientDoctor/EmrTimelinessMonitor.vue new file mode 100644 index 000000000..138d6284d --- /dev/null +++ b/healthlink-his-ui/src/views/inpatientDoctor/EmrTimelinessMonitor.vue @@ -0,0 +1,254 @@ + + + + +