From b97a3ad59896365ad44cbead6675bee8203b1a5a Mon Sep 17 00:00:00 2001 From: wangjian963 <15215920+aprilry@user.noreply.gitee.com> Date: Wed, 20 May 2026 18:12:58 +0800 Subject: [PATCH] =?UTF-8?q?562=20[=E9=97=A8=E8=AF=8A=E5=8C=BB=E7=94=9F?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=99-=E5=BE=85=E5=86=99=E7=97=85?= =?UTF-8?q?=E5=8E=86]=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BD=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=B6=85=E8=BF=872=E7=A7=92=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=20561=20[=E9=97=A8=E8=AF=8A=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E7=AB=99-=E5=8C=BB=E5=98=B1]=20=E5=8C=BB=E5=98=B1?= =?UTF-8?q?=E5=BD=95=E5=85=A5=E5=90=8E=EF=BC=8C=E6=80=BB=E9=87=8F=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=EF=BC=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=BA=E2=80=9Cnull=E2=80=9D=E8=80=8C=E9=9D=9E?= =?UTF-8?q?=E8=AF=8A=E7=96=97=E7=9B=AE=E5=BD=95=E9=85=8D=E7=BD=AE=E5=80=BC?= =?UTF-8?q?=20544=20=E3=80=90=E6=99=BA=E8=83=BD=E5=88=86=E8=AF=8A=E3=80=91?= =?UTF-8?q?=E6=8E=92=E9=98=9F=E9=98=9F=E5=88=97=E5=88=97=E8=A1=A8=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=98=BE=E7=A4=BA=E2=80=9C=E5=AE=8C=E8=AF=8A=E2=80=9D?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=82=A3=E8=80=85=E4=B8=94=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E9=98=9F=E5=88=97=E6=9F=A5=E8=AF=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20505=20=E3=80=90=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E3=80=91=E8=8D=AF=E5=93=81=E5=8C=BB=E5=98=B1?= =?UTF-8?q?=E5=B7=B2=E7=94=B1=E8=8D=AF=E6=88=BF=E5=8F=91=E8=8D=AF=EF=BC=8C?= =?UTF-8?q?=E6=8A=A4=E5=A3=AB=E4=BB=8D=E8=83=BD=E5=9C=A8=E2=80=9C=E5=8C=BB?= =?UTF-8?q?=E5=98=B1=E6=A0=A1=E5=AF=B9=E2=80=9D=E6=A8=A1=E5=9D=97=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E2=80=9C=E9=80=80=E5=9B=9E=E2=80=9D=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IDoctorStationEmrAppService.java | 10 +- .../DoctorStationAdviceAppServiceImpl.java | 4 + .../impl/DoctorStationEmrAppServiceImpl.java | 108 +++++------------ .../controller/PendingEmrController.java | 30 ++--- .../mapper/DoctorStationEmrAppMapper.java | 9 ++ .../impl/AdviceProcessAppServiceImpl.java | 18 +++ .../web/system/controller/HomeController.java | 4 +- .../impl/TriageQueueAppServiceImpl.java | 9 -- .../DoctorStationEmrAppMapper.xml | 36 +++++- .../components/pendingEmr/index.vue | 10 +- .../src/views/doctorstation/pendingEmr.vue | 13 ++- .../triageandqueuemanage/cardiology/index.vue | 110 ++++++++++++------ 12 files changed, 215 insertions(+), 146 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java index 1110df86..6c4d2ccd 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java @@ -63,17 +63,21 @@ public interface IDoctorStationEmrAppService { * 获取待写病历列表 * * @param doctorId 医生ID - * @return 待写病历列表 + * @param pageNo 当前页码 + * @param pageSize 每页条数 + * @param patientName 患者姓名(可选) + * @return 待写病历分页数据 */ - R getPendingEmrList(Long doctorId); + R getPendingEmrList(Long doctorId, Integer pageNo, Integer pageSize, String patientName); /** * 获取待写病历数量 * * @param doctorId 医生ID + * @param patientName 患者姓名(可选) * @return 待写病历数量 */ - R getPendingEmrCount(Long doctorId); + R getPendingEmrCount(Long doctorId, String patientName); /** * 检查患者是否需要写病历 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java index c5815994..ca722b74 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java @@ -2205,6 +2205,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp // 收费状态 requestBaseDto.setChargeStatus_enumText( EnumUtils.getInfoByValue(ChargeItemStatus.class, requestBaseDto.getChargeStatus())); + // 单位字典翻译失败时回退使用原始值(如手术申请硬编码了中文单位名) + if (StringUtils.isNotBlank(requestBaseDto.getUnitCode()) && StringUtils.isBlank(requestBaseDto.getUnitCode_dictText())) { + requestBaseDto.setUnitCode_dictText(requestBaseDto.getUnitCode()); + } } return R.ok(requestBaseInfo); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java index 38cc522c..ec652722 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java @@ -29,6 +29,7 @@ import com.openhis.document.service.IEmrTemplateService; import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService; import com.openhis.web.doctorstation.dto.EmrTemplateDto; import com.openhis.web.doctorstation.dto.PatientEmrDto; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -41,6 +42,7 @@ import java.util.stream.Collectors; /** * 医生站-电子病历 应用实现类 */ +@Slf4j @Service public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppService { @@ -60,13 +62,7 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi IDocRecordService docRecordService; @Resource - private EncounterMapper encounterMapper; - - @Resource - private PatientMapper patientMapper; - - @Resource - private com.openhis.administration.mapper.EncounterParticipantMapper encounterParticipantMapper; + private com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper doctorStationEmrAppMapper; /** * 添加病人病历信息 @@ -223,52 +219,35 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi * @return 待写病历列表 */ @Override - public R getPendingEmrList(Long doctorId) { - // 由于Encounter实体中没有jzPractitionerUserId字段,我们需要通过关联查询来获取相关信息 - // 使用医生工作站的mapper来查询相关数据 - // 这里我们直接使用医生工作站的查询逻辑 + public R getPendingEmrList(Long doctorId, Integer pageNo, Integer pageSize, String patientName) { + List> allRows = doctorStationEmrAppMapper.getPendingEmrList(doctorId, patientName); + int total = allRows.size(); - // 查询当前医生负责的、状态为"就诊中"但还没有写病历的患者 - // 需要通过EncounterParticipant表来关联医生信息 - List encounters = encounterMapper.selectList( - new LambdaQueryWrapper() - .eq(Encounter::getStatusEnum, EncounterStatus.IN_PROGRESS.getValue()) - ); - - // 过滤出由指定医生负责且还没有写病历的就诊记录 - List> pendingEmrs = new ArrayList<>(); - for (Encounter encounter : encounters) { - // 检查该就诊记录是否已经有病历 - Emr existingEmr = emrService.getOne( - new LambdaQueryWrapper().eq(Emr::getEncounterId, encounter.getId()) - ); - - // 检查该就诊是否由指定医生负责 - boolean isAssignedToDoctor = isEncounterAssignedToDoctor(encounter.getId(), doctorId); - - if (existingEmr == null && isAssignedToDoctor) { - // 如果没有病历且由该医生负责,则添加到待写病历列表 - Map pendingEmr = new java.util.HashMap<>(); - - // 获取患者信息 - Patient patient = patientMapper.selectById(encounter.getPatientId()); - - pendingEmr.put("encounterId", encounter.getId()); - pendingEmr.put("patientId", encounter.getPatientId()); - pendingEmr.put("patientName", patient != null ? patient.getName() : "未知"); - pendingEmr.put("gender", patient != null ? patient.getGenderEnum() : null); - // 使用出生日期计算年龄 - pendingEmr.put("age", patient != null && patient.getBirthDate() != null ? - calculateAge(patient.getBirthDate()) : null); - // 使用创建时间作为挂号时间 - pendingEmr.put("registerTime", encounter.getCreateTime()); - pendingEmr.put("busNo", encounter.getBusNo()); // 病历号 - - pendingEmrs.add(pendingEmr); - } + // 分页截取 + int fromIndex = (pageNo - 1) * pageSize; + int toIndex = Math.min(fromIndex + pageSize, total); + List> pageRows; + if (fromIndex >= total) { + pageRows = new ArrayList<>(); + } else { + pageRows = allRows.subList(fromIndex, toIndex); } - return R.ok(pendingEmrs); + // 计算年龄列 + for (Map row : pageRows) { + Object birthDate = row.get("birthDate"); + if (birthDate instanceof Date) { + row.put("age", calculateAge((Date) birthDate)); + } else { + row.put("age", null); + } + row.remove("birthDate"); + } + + Map result = new java.util.HashMap<>(); + result.put("rows", pageRows); + result.put("total", total); + return R.ok(result); } /** @@ -278,14 +257,9 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi * @return 待写病历数量 */ @Override - public R getPendingEmrCount(Long doctorId) { - // 获取待写病历列表,然后返回数量 - R result = getPendingEmrList(doctorId); - if (result.getCode() == 200) { - List pendingEmrs = (List) result.getData(); - return R.ok(pendingEmrs.size()); - } - return R.ok(0); + public R getPendingEmrCount(Long doctorId, String patientName) { + Long count = doctorStationEmrAppMapper.getPendingEmrCount(doctorId, patientName); + return R.ok(count != null ? count.intValue() : 0); } /** @@ -306,24 +280,6 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi return R.ok(needWrite); } - /** - * 检查就诊是否分配给指定医生 - * - * @param encounterId 就诊ID - * @param doctorId 医生ID - * @return 是否分配给指定医生 - */ - private boolean isEncounterAssignedToDoctor(Long encounterId, Long doctorId) { - // 查询就诊参与者表,检查是否有指定医生的接诊记录 - com.openhis.administration.domain.EncounterParticipant participant = - encounterParticipantMapper.selectOne( - new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper() - .eq(com.openhis.administration.domain.EncounterParticipant::getEncounterId, encounterId) - .eq(com.openhis.administration.domain.EncounterParticipant::getPractitionerId, doctorId) - ); - - return participant != null; - } /** * 根据出生日期计算年龄 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/PendingEmrController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/PendingEmrController.java index d2818c91..4a8cb8ba 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/PendingEmrController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/PendingEmrController.java @@ -26,34 +26,36 @@ public class PendingEmrController { * 获取待写病历列表 * * @param doctorId 医生ID - * @return 待写病历列表 + * @param pageNo 当前页码 + * @param pageSize 每页条数 + * @param patientName 患者姓名(可选) + * @return 待写病历分页数据 */ @GetMapping("/pending-list") - public R getPendingEmrList(@RequestParam(required = false) Long doctorId) { - // 如果没有传递医生ID,则使用当前登录用户ID + public R getPendingEmrList(@RequestParam(required = false) Long doctorId, + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String patientName) { if (doctorId == null) { - doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getUserId(); + doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getPractitionerId(); } - - // 调用服务获取待写病历列表 - return iDoctorStationEmrAppService.getPendingEmrList(doctorId); + return iDoctorStationEmrAppService.getPendingEmrList(doctorId, pageNum, pageSize, patientName); } /** * 获取待写病历数量 - * + * * @param doctorId 医生ID + * @param patientName 患者姓名(可选) * @return 待写病历数量 */ @GetMapping("/pending-count") - public R getPendingEmrCount(@RequestParam(required = false) Long doctorId) { - // 如果没有传递医生ID,则使用当前登录用户ID + public R getPendingEmrCount(@RequestParam(required = false) Long doctorId, + @RequestParam(required = false) String patientName) { if (doctorId == null) { - doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getUserId(); + doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getPractitionerId(); } - - // 调用服务获取待写病历数量 - return iDoctorStationEmrAppService.getPendingEmrCount(doctorId); + return iDoctorStationEmrAppService.getPendingEmrCount(doctorId, patientName); } /** diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationEmrAppMapper.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationEmrAppMapper.java index 6bb8c008..689a62b0 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationEmrAppMapper.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationEmrAppMapper.java @@ -1,11 +1,20 @@ package com.openhis.web.doctorstation.mapper; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; +import java.util.List; +import java.util.Map; + /** * 医生站-电子病历 应用Mapper */ @Repository public interface DoctorStationEmrAppMapper { + List> getPendingEmrList(@Param("doctorId") Long doctorId, + @Param("patientName") String patientName); + + Long getPendingEmrCount(@Param("doctorId") Long doctorId, + @Param("patientName") String patientName); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java index 2238165f..5688384c 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java @@ -359,6 +359,24 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { medRequestList.add(item); } } + // 校验医嘱是否已执行,已执行的医嘱需要先取消执行后才能退回 + List allRequestIds = performInfoList.stream().map(PerformInfoDto::getRequestId).toList(); + List allProcedures = procedureService.list( + new LambdaQueryWrapper() + .in(Procedure::getRequestId, allRequestIds) + .eq(Procedure::getDeleteFlag, "0")); + Set executedIds = allProcedures.stream() + .filter(p -> EventStatus.COMPLETED.getValue().equals(p.getStatusEnum())) + .map(Procedure::getId) + .collect(Collectors.toSet()); + Set cancelledRefundIds = allProcedures.stream() + .filter(p -> EventStatus.CANCEL.getValue().equals(p.getStatusEnum()) && p.getRefundId() != null) + .map(Procedure::getRefundId) + .collect(Collectors.toSet()); + executedIds.removeAll(cancelledRefundIds); + if (!executedIds.isEmpty()) { + return R.fail("该医嘱已执行,请先取消执行后再退回"); + } // 校验药品医嘱是否已发药,已发药的医嘱不允许退回 if (!medRequestList.isEmpty()) { List medReqIds = medRequestList.stream().map(PerformInfoDto::getRequestId).toList(); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/system/controller/HomeController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/system/controller/HomeController.java index d128d482..e86e6252 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/system/controller/HomeController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/system/controller/HomeController.java @@ -31,8 +31,8 @@ public class HomeController { HomeStatisticsDto statisticsDto = homeStatisticsService.getHomeStatistics(); // 获取待写病历数量 - Long userId = SecurityUtils.getLoginUser().getUserId(); - R pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(userId); + Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId(); + R pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(practitionerId, null); // 将待写病历数量添加到统计数据中 statisticsDto.setPendingEmr((Integer) pendingEmrCount.getData()); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/triageandqueuemanage/appservice/impl/TriageQueueAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/triageandqueuemanage/appservice/impl/TriageQueueAppServiceImpl.java index 58b6934a..a90b34b2 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/triageandqueuemanage/appservice/impl/TriageQueueAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/triageandqueuemanage/appservice/impl/TriageQueueAppServiceImpl.java @@ -74,7 +74,6 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService { .eq(TriageQueueItem::getTenantId, tenantId) .eq(TriageQueueItem::getQueueDate, qd) .eq(TriageQueueItem::getDeleteFlag, "0") - .ne(TriageQueueItem::getStatus, TriageQueueStatus.COMPLETED.getValue()) .orderByAsc(TriageQueueItem::getQueueOrder); // 如果指定了科室,按科室过滤;否则查询所有科室(全科模式) @@ -92,14 +91,6 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService { } }); } - - // 双重保险:再次过滤掉 COMPLETED 状态的患者(防止数据库中有异常数据) - if (list != null && !list.isEmpty()) { - int beforeSize = list.size(); - list = list.stream() - .filter(item -> !TriageQueueStatus.COMPLETED.getValue().equals(item.getStatus())) - .collect(java.util.stream.Collectors.toList()); - } return R.ok(list); } diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationEmrAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationEmrAppMapper.xml index 5e0b6a16..d5bbe061 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationEmrAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationEmrAppMapper.xml @@ -4,4 +4,38 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - \ No newline at end of file + + + + + diff --git a/openhis-ui-vue3/src/views/doctorstation/components/pendingEmr/index.vue b/openhis-ui-vue3/src/views/doctorstation/components/pendingEmr/index.vue index 36049b1b..85bfc834 100755 --- a/openhis-ui-vue3/src/views/doctorstation/components/pendingEmr/index.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/pendingEmr/index.vue @@ -89,8 +89,14 @@ const getList = async () => { const response = await listPendingEmr(queryParams) // 根据后端返回的数据结构调整 if (response.code === 200) { - emrList.value = response.data || [] - total.value = Array.isArray(response.data) ? response.data.length : 0 + const data = response.data + if (data && data.rows !== undefined) { + emrList.value = data.rows || [] + total.value = data.total || 0 + } else { + emrList.value = Array.isArray(data) ? data : [] + total.value = emrList.value.length + } } else { ElMessage.error(response.msg || '获取待写病历列表失败') emrList.value = [] diff --git a/openhis-ui-vue3/src/views/doctorstation/pendingEmr.vue b/openhis-ui-vue3/src/views/doctorstation/pendingEmr.vue index 71215b41..ce2f5367 100755 --- a/openhis-ui-vue3/src/views/doctorstation/pendingEmr.vue +++ b/openhis-ui-vue3/src/views/doctorstation/pendingEmr.vue @@ -113,10 +113,17 @@ const getList = async () => { loading.value = true try { const response = await listPendingEmr(queryParams) - // 根据后端返回的数据结构调整 if (response.code === 200) { - emrList.value = response.data || [] - total.value = Array.isArray(response.data) ? response.data.length : 0 + const data = response.data + if (data && data.rows !== undefined) { + // 新分页格式 {rows, total} + emrList.value = data.rows || [] + total.value = data.total || 0 + } else { + // 兼容旧格式(数组) + emrList.value = Array.isArray(data) ? data : [] + total.value = emrList.value.length + } } else { ElMessage.error(response.msg || '获取待写病历列表失败') emrList.value = [] diff --git a/openhis-ui-vue3/src/views/triageandqueuemanage/cardiology/index.vue b/openhis-ui-vue3/src/views/triageandqueuemanage/cardiology/index.vue index 36810119..d42d1a0b 100755 --- a/openhis-ui-vue3/src/views/triageandqueuemanage/cardiology/index.vue +++ b/openhis-ui-vue3/src/views/triageandqueuemanage/cardiology/index.vue @@ -88,16 +88,16 @@
- 加入队列 >> - 一键加入队列 @@ -109,6 +109,19 @@
② 智能队列 (全科) +
+ + 查询 + 今天 +
- << 移出队列 - - @@ -259,30 +272,35 @@
选呼 下一患者 跳过 完成 过号重排 @@ -682,6 +700,14 @@ const showOnlyWaiting = ref(false) // Bug #411:诊室过滤,替代原来的科室下拉框(selectedDept/departmentList 已移除) const selectedRoom = ref('all') +// 历史队列查询日期 (默认当天) +const getTodayStr = () => { + const now = new Date() + return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}` +} +const queryDate = ref(getTodayStr()) +const isQueryingHistory = computed(() => queryDate.value !== getTodayStr()) + // 修复【#397】:动态获取当前科室名称 const currentDeptName = computed(() => { return userStore.deptName || userStore.orgName || '心内科' @@ -901,14 +927,12 @@ const mapFrontendStatusToBackend = (status) => { } // 从数据库加载队列 -const loadQueueFromDb = async () => { +const loadQueueFromDb = async (dateStr) => { try { // Bug #411:不再按科室选筛加载,后端默认按当前登录人科室查询 const organizationId = undefined - // 只查询今天的患者 - const today = new Date() - const todayStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}` - const res = await getTriageQueueList({ organizationId, date: todayStr }).catch((err) => { + const queryDateStr = dateStr || queryDate.value + const res = await getTriageQueueList({ organizationId, date: queryDateStr }).catch((err) => { console.error('【心内科】loadQueueFromDb 请求异常:', err) return { code: 500, msg: err?.message || '请求失败', data: null } }) @@ -931,10 +955,6 @@ const loadQueueFromDb = async () => { originalQueueList.value = list .map((it) => { const frontendStatus = mapBackendStatusToFrontend(it.status) - // 调试日志:检查状态映射 - if (list.length <= 5) { - console.log('【心内科】状态映射:后端状态=', it.status, '-> 前端状态=', frontendStatus, '患者=', it.patientName) - } // 计算等待时间:基于创建时间(createTime) let waitingTime = '00:00' if (it.createTime) { @@ -972,15 +992,7 @@ const loadQueueFromDb = async () => { organizationId: it.organizationId } }) - .filter((item) => { - // 过滤掉"已完成"状态的患者,不显示在队列中 - if (item.status === '已完成') { - console.log('【心内科】过滤掉已完成状态的患者:', item.patientName) - return false - } - return true - }) - + // 调试日志:检查查找结果 const callingCount = originalQueueList.value.filter(i => i.status === '叫号中').length const waitingCount = originalQueueList.value.filter(i => i.status === '等待').length @@ -1196,9 +1208,6 @@ const formatSecondsToMmSs = (totalSeconds) => { const filteredQueueList = computed(() => { let filtered = originalQueueList.value - // 先过滤掉"已完成"状态的患者(无论什么情况都不显示) - filtered = filtered.filter(item => item.status !== '已完成') - // 再按诊室过滤 if (selectedRoom.value !== 'all') { filtered = filtered.filter(item => item.room === selectedRoom.value) @@ -1627,6 +1636,26 @@ const handleRefresh = async () => { ElMessage.success('已刷新(已从数据库恢复队列)') } +// 历史队列查询 +const handleHistoryQuery = async () => { + if (!queryDate.value) { + ElMessage.warning('请选择查询日期') + return + } + console.log('【心内科】历史队列查询:', queryDate.value) + await loadQueueFromDb(queryDate.value) + if (isQueryingHistory.value) { + ElMessage.success(`已加载 ${queryDate.value} 的队列数据`) + } +} + +// 回到今天 +const handleTodayQuery = async () => { + queryDate.value = getTodayStr() + await loadQueueFromDb(getTodayStr()) + ElMessage.success('已切换到今天队列') +} + // 退出 const handleExit = () => { ElMessage.info('退出功能待实现') @@ -2165,12 +2194,21 @@ onUnmounted(() => { padding: 15px 20px; border-bottom: 2px solid #409eff; background-color: #f8f9fa; + display: flex; + justify-content: space-between; + align-items: center; .panel-title { font-size: 16px; font-weight: bold; color: #333; } + + .history-query { + display: flex; + gap: 8px; + align-items: center; + } } .table-container {