diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/application/controller/QueueController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/controller/QueueController.java new file mode 100644 index 000000000..10b89ea6d --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/controller/QueueController.java @@ -0,0 +1,41 @@ +package com.openhis.application.controller; + +import com.openhis.application.domain.entity.QueueInfo; +import com.openhis.application.service.QueueService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; +import java.util.List; + +/** + * 智能分诊排队接口 + * + * 新增: + * - /api/queue/current 返回当前排队(包括完诊); + * - /api/queue/history 返回历史排队记录(完诊、已取消)。 + * + * 修复 Bug #544。 + */ +@RestController +public class QueueController { + + private final QueueService queueService; + + public QueueController(QueueService queueService) { + this.queueService = queueService; + } + + @GetMapping("/api/queue/current") + public List getCurrentQueue(@RequestParam(required = false) Long departmentId) { + return queueService.getCurrentQueue(departmentId); + } + + @GetMapping("/api/queue/history") + public List getHistoryQueue(@RequestParam(required = false) Long departmentId, + @RequestParam(required = false) Date startTime, + @RequestParam(required = false) Date endTime) { + return queueService.getHistoryQueue(departmentId, startTime, endTime); + } +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/application/mapper/QueueMapper.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/mapper/QueueMapper.java new file mode 100644 index 000000000..37bc90ba3 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/mapper/QueueMapper.java @@ -0,0 +1,53 @@ +package com.openhis.application.mapper; + +import com.openhis.application.domain.entity.QueueInfo; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * 智能分诊排队队列数据访问层 + * + * 修复 Bug #544: + * 1. 在查询当前排队列表时,加入对 “完诊”(status = 'FINISHED') 状态患者的展示; + * 2. 新增历史队列查询接口,用于查询已完成或已取消的排队记录。 + */ +public interface QueueMapper { + + /** + * 查询当前排队列表(包括待诊、已诊、完诊)。 + * + * @param departmentId 科室ID(可为空,表示查询全部) + * @return 当前排队的患者列表 + */ + @Select("") + List selectCurrentQueue(@Param("departmentId") Long departmentId); + + /** + * 查询历史排队记录(已完成或已取消)。 + * + * @param departmentId 科室ID(可为空) + * @param startTime 起始时间(可为空) + * @param endTime 结束时间(可为空) + * @return 符合条件的历史排队记录 + */ + @Select("") + List selectHistoryQueue(@Param("departmentId") Long departmentId, + @Param("startTime") java.util.Date startTime, + @Param("endTime") java.util.Date endTime); +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/application/service/QueueService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/service/QueueService.java new file mode 100644 index 000000000..f267b2b37 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/service/QueueService.java @@ -0,0 +1,32 @@ +package com.openhis.application.service; + +import com.openhis.application.domain.entity.QueueInfo; + +import java.util.Date; +import java.util.List; + +/** + * 智能分诊排队业务接口 + * + * 包含当前排队查询(已修复显示完诊)以及历史排队查询功能。 + */ +public interface QueueService { + + /** + * 获取当前排队列表(包括 WAIT、DIAGNOSE、FINISHED)。 + * + * @param departmentId 科室ID,可为空 + * @return 当前排队患者列表 + */ + List getCurrentQueue(Long departmentId); + + /** + * 获取历史排队记录(已完成或已取消)。 + * + * @param departmentId 科室ID,可为空 + * @param startTime 起始时间,可为空 + * @param endTime 结束时间,可为空 + * @return 符合条件的历史排队记录 + */ + List getHistoryQueue(Long departmentId, Date startTime, Date endTime); +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/application/service/impl/QueueServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/service/impl/QueueServiceImpl.java new file mode 100644 index 000000000..65a802008 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/application/service/impl/QueueServiceImpl.java @@ -0,0 +1,36 @@ +package com.openhis.application.service.impl; + +import com.openhis.application.domain.entity.QueueInfo; +import com.openhis.application.mapper.QueueMapper; +import com.openhis.application.service.QueueService; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 智能分诊排队服务实现 + * + * 修复 Bug #544: + * - 当前排队列表现在会显示 “完诊” 状态的患者; + * - 新增历史排队查询接口供前端使用。 + */ +@Service +public class QueueServiceImpl implements QueueService { + + private final QueueMapper queueMapper; + + public QueueServiceImpl(QueueMapper queueMapper) { + this.queueMapper = queueMapper; + } + + @Override + public List getCurrentQueue(Long departmentId) { + return queueMapper.selectCurrentQueue(departmentId); + } + + @Override + public List getHistoryQueue(Long departmentId, Date startTime, Date endTime) { + return queueMapper.selectHistoryQueue(departmentId, startTime, endTime); + } +} diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/QueueMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/QueueMapper.xml new file mode 100644 index 000000000..735b4e673 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/QueueMapper.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/openhis-ui-vue3/src/views/outpatient/doctor/QueueList.vue b/openhis-ui-vue3/src/views/outpatient/doctor/QueueList.vue new file mode 100644 index 000000000..04ffafd3b --- /dev/null +++ b/openhis-ui-vue3/src/views/outpatient/doctor/QueueList.vue @@ -0,0 +1,73 @@ + + + + +