From 9ed43c9413495df27f170e7aea526f1cb462b60b Mon Sep 17 00:00:00 2001 From: chenqi Date: Mon, 2 Feb 2026 16:28:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(home):=20=E6=B7=BB=E5=8A=A0=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E4=B8=93=E5=B1=9E=E6=82=A3=E8=80=85=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=92=8C=E8=8F=9C=E5=8D=95=E8=B7=B3=E8=BD=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在HomeStatisticsDto中新增我的患者数量和待写病历数量字段 - 实现医生患者查询功能,支持按租户隔离数据 - 更新首页统计服务,为医生用户提供专属患者统计数据 - 添加菜单名称点击跳转功能,支持路由导航和外部链接打开 - 修复首页统计数据显示,确保医生看到正确的患者数量 - 添加医保日结结算相关实体、服务和前端页面 - 配置前端路由控制器,支持Vue Router History模式 --- .../common/FrontRouterController.java | 46 ++ .../core/common/core/domain/PageResult.java | 34 ++ .../openhis/web/dto/HomeStatisticsDto.java | 10 + .../impl/PatientInformationServiceImpl.java | 6 +- .../mapper/PatientManageMapper.java | 6 +- .../impl/HomeStatisticsServiceImpl.java | 29 +- .../web/system/controller/HomeController.java | 20 +- .../patientmanage/PatientManageMapper.xml | 8 +- .../DayEndMedicalInsuranceSettlement.java | 118 +++++ ...ayEndMedicalInsuranceSettlementMapper.java | 18 + ...yEndMedicalInsuranceSettlementService.java | 74 +++ ...MedicalInsuranceSettlementServiceImpl.java | 128 +++++ .../dayEndMedicalInsuranceSettlement.js | 44 ++ openhis-ui-vue3/src/views/index.vue | 2 +- .../src/views/system/menu/index.vue | 86 ++- .../index.vue | 498 ++++++++++++++++++ 16 files changed, 1100 insertions(+), 27 deletions(-) create mode 100644 openhis-server-new/core-admin/src/main/java/com/core/web/controller/common/FrontRouterController.java create mode 100644 openhis-server-new/core-common/src/main/java/com/core/common/core/domain/PageResult.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/domain/DayEndMedicalInsuranceSettlement.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/mapper/DayEndMedicalInsuranceSettlementMapper.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/IDayEndMedicalInsuranceSettlementService.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/impl/DayEndMedicalInsuranceSettlementServiceImpl.java create mode 100644 openhis-ui-vue3/src/api/ybmanagement/dayEndMedicalInsuranceSettlement.js create mode 100644 openhis-ui-vue3/src/views/ybmanagement/dayEndMedicalInsuranceSettlement/index.vue diff --git a/openhis-server-new/core-admin/src/main/java/com/core/web/controller/common/FrontRouterController.java b/openhis-server-new/core-admin/src/main/java/com/core/web/controller/common/FrontRouterController.java new file mode 100644 index 00000000..e84424c1 --- /dev/null +++ b/openhis-server-new/core-admin/src/main/java/com/core/web/controller/common/FrontRouterController.java @@ -0,0 +1,46 @@ +package com.core.web.controller.common; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * 前端路由 fallback 控制器 + * 处理 Vue Router History 模式下的路由 + * + * @author + */ +@Controller +public class FrontRouterController { + + /** + * 处理前端路由,将所有前端路由请求转发到 index.html + */ + @RequestMapping(value = { + "/ybmanagement/**", + "/system/**", + "/monitor/**", + "/tool/**", + "/doctorstation/**", + "/features/**", + "/todo/**", + "/appoinmentmanage/**", + "/clinicmanagement/**", + "/medicationmanagement/**", + "/yb/**", + "/patient/**", + "/charge/**", + "/nurse/**", + "/pharmacy/**", + "/report/**", + "/document/**", + "/triage/**", + "/check/**", + "/lab/**", + "/financial/**", + "/crosssystem/**", + "/workflow/**" + }) + public String index() { + return "forward:/index.html"; + } +} \ No newline at end of file diff --git a/openhis-server-new/core-common/src/main/java/com/core/common/core/domain/PageResult.java b/openhis-server-new/core-common/src/main/java/com/core/common/core/domain/PageResult.java new file mode 100644 index 00000000..e3420295 --- /dev/null +++ b/openhis-server-new/core-common/src/main/java/com/core/common/core/domain/PageResult.java @@ -0,0 +1,34 @@ +package com.core.common.core.domain; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 分页结果类 + * + * @author + * @date 2026-02-02 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PageResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 数据列表 + */ + private List rows; + + /** + * 总数 + */ + private long total; +} \ No newline at end of file diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/dto/HomeStatisticsDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/dto/HomeStatisticsDto.java index 90fef91c..36a7b79b 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/dto/HomeStatisticsDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/dto/HomeStatisticsDto.java @@ -59,4 +59,14 @@ public class HomeStatisticsDto { * 待审核数量 */ private Integer pendingApprovals; + + /** + * 我的患者数量(医生专属) + */ + private Integer myPatients; + + /** + * 待写病历数量 + */ + private Integer pendingEmr; } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java index 8018fd8d..aa7a63c5 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java @@ -136,6 +136,7 @@ public class PatientInformationServiceImpl implements IPatientInformationService // 获取登录者信息 LoginUser loginUser = SecurityUtils.getLoginUser(); Long userId = loginUser.getUserId(); + Integer tenantId = loginUser.getTenantId().intValue(); // 先构建基础查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper( @@ -159,8 +160,9 @@ public class PatientInformationServiceImpl implements IPatientInformationService if (practitioner != null) { // 查询该医生作为接诊医生(ADMITTER, code="1")和挂号医生(REGISTRATION_DOCTOR, code="12")的所有就诊记录的患者ID List doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId( - practitioner.getId(), - Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode())); + practitioner.getId(), + Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()), + tenantId); if (doctorPatientIds != null && !doctorPatientIds.isEmpty()) { // 添加患者ID过滤条件 - 注意:这里使用列名而不是表别名 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/mapper/PatientManageMapper.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/mapper/PatientManageMapper.java index 6abd7532..2b6b738b 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/mapper/PatientManageMapper.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/mapper/PatientManageMapper.java @@ -64,8 +64,10 @@ public interface PatientManageMapper extends BaseMapper { * * @param practitionerId 医生ID * @param typeCodes 参与者类型代码列表 + * @param tenantId 租户ID * @return 患者ID列表 */ - List getPatientIdsByPractitionerId(@Param("practitionerId") Long practitionerId, - @Param("typeCodes") List typeCodes); + List getPatientIdsByPractitionerId(@Param("practitionerId") Long practitionerId, + @Param("typeCodes") List typeCodes, + @Param("tenantId") Integer tenantId); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/service/impl/HomeStatisticsServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/service/impl/HomeStatisticsServiceImpl.java index 8d74adc2..c46a6c87 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/service/impl/HomeStatisticsServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/service/impl/HomeStatisticsServiceImpl.java @@ -66,23 +66,34 @@ public class HomeStatisticsServiceImpl implements IHomeStatisticsService { Practitioner practitioner = practitionerList != null && !practitionerList.isEmpty() ? practitionerList.get(0) : null; int totalPatients = 0; + int myPatients = 0; // 如果当前用户是医生,查询该医生接诊和被挂号的所有患者 if (practitioner != null) { + // 获取当前登录用户的租户ID + Integer tenantId = SecurityUtils.getLoginUser().getTenantId().intValue(); + // 查询该医生作为接诊医生(ADMITTER, code="1")和挂号医生(REGISTRATION_DOCTOR, code="12")的所有就诊记录的患者ID List doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId( - practitioner.getId(), - Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode())); - - totalPatients = doctorPatientIds != null ? doctorPatientIds.size() : 0; + practitioner.getId(), + Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()), + tenantId); + + myPatients = doctorPatientIds != null ? doctorPatientIds.size() : 0; + + // 对于医生,"我的患者"数量即为该医生负责的患者数量 + statistics.setMyPatients(myPatients); } else { - // 如果不是医生,查询所有患者(与患者管理页面逻辑保持一致) - LambdaQueryWrapper patientQuery = new LambdaQueryWrapper<>(); - patientQuery.eq(Patient::getDeleteFlag, "0"); - List patientList = patientService.list(patientQuery); - totalPatients = patientList != null ? patientList.size() : 0; + // 如果不是医生,"我的患者"数量为0 + statistics.setMyPatients(0); } + // 查询所有患者作为总患者数 + LambdaQueryWrapper patientQuery = new LambdaQueryWrapper<>(); + patientQuery.eq(Patient::getDeleteFlag, "0"); + List patientList = patientService.list(patientQuery); + totalPatients = patientList != null ? patientList.size() : 0; + statistics.setTotalPatients(totalPatients); // 查询昨日在院患者数量(暂时简化处理) 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 ffcb4719..d128d482 100644 --- 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 @@ -3,6 +3,8 @@ package com.openhis.web.system.controller; import com.core.common.core.domain.R; import com.core.common.utils.SecurityUtils; import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService; +import com.openhis.web.dto.HomeStatisticsDto; +import com.openhis.web.service.IHomeStatisticsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -20,19 +22,21 @@ import org.springframework.web.bind.annotation.RestController; public class HomeController { private final IDoctorStationEmrAppService doctorStationEmrAppService; + private final IHomeStatisticsService homeStatisticsService; @ApiOperation("获取首页统计数据") @GetMapping("/statistics") public R getStatistics() { - // 这里可以返回各种统计数据 - // 为了简化,我们只返回待写病历数量 + // 获取基础统计数据 + HomeStatisticsDto statisticsDto = homeStatisticsService.getHomeStatistics(); + + // 获取待写病历数量 Long userId = SecurityUtils.getLoginUser().getUserId(); R pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(userId); - - // 构建返回数据 - java.util.Map data = new java.util.HashMap<>(); - data.put("pendingEmr", pendingEmrCount.getData()); - - return R.ok(data); + + // 将待写病历数量添加到统计数据中 + statisticsDto.setPendingEmr((Integer) pendingEmrCount.getData()); + + return R.ok(statisticsDto); } } \ No newline at end of file diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/patientmanage/PatientManageMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/patientmanage/PatientManageMapper.xml index ce9d8166..1428cd34 100644 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/patientmanage/PatientManageMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/patientmanage/PatientManageMapper.xml @@ -136,13 +136,13 @@