From 13b77fb9eb6323eaaa394bdefe5bb1afb1428ab1 Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Tue, 7 Apr 2026 18:06:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=A0=B9=E6=8D=AE=E5=8C=BB?= =?UTF-8?q?=E9=99=A2=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/patientinfo/PatientInfoMapper.java | 6 +-- .../PatientPreHospitalizationMapper.java | 2 +- .../SignPatientManageRouteNodeMapper.java | 2 +- .../impl/SystemHomePageServiceImpl.java | 51 +++++++++++++++---- .../manage/patientinfo/PatientInfoMapper.xml | 9 ++++ .../PatientPreHospitalizationMapper.xml | 6 ++- .../SignPatientManageRouteNodeMapper.xml | 3 ++ 7 files changed, 63 insertions(+), 16 deletions(-) diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientInfoMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientInfoMapper.java index 789eae9c..efd49a8c 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientInfoMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientInfoMapper.java @@ -117,7 +117,7 @@ public interface PatientInfoMapper { * @param now 当前时间 * @return int */ - int getPatientInfoCountByCreateTime(@Param("firstDay") LocalDate firstDay, @Param("now") LocalDate now); + int getPatientInfoCountByCreateTime(@Param("firstDay") LocalDate firstDay, @Param("now") LocalDate now, @Param("hospitalAgencyId")Long hospitalAgencyId); /** * 根据签约时间查询患者数量 @@ -126,14 +126,14 @@ public interface PatientInfoMapper { * @param now 当前时间 * @return int */ - int selectPatientInfoCountBySignTime(@Param("firstDay") LocalDate firstDay, @Param("now") LocalDate now); + int selectPatientInfoCountBySignTime(@Param("firstDay") LocalDate firstDay, @Param("now") LocalDate now, @Param("hospitalAgencyId")Long hospitalAgencyId); /** * 已签约总数 * * @return int */ - int selectPatientSignTotalCount(); + int selectPatientSignTotalCount(Long hospitalAgencyId); /** * 服务中患者总数 diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientprehospitalization/PatientPreHospitalizationMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientprehospitalization/PatientPreHospitalizationMapper.java index 9160667c..e383dee0 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientprehospitalization/PatientPreHospitalizationMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientprehospitalization/PatientPreHospitalizationMapper.java @@ -48,5 +48,5 @@ public interface PatientPreHospitalizationMapper { * @param now 当前时间 * @return int */ - int getPatientPreHospitalizationCountByCreateTime(@Param("firstDay") LocalDate firstDay, @Param("now") LocalDate now); + int getPatientPreHospitalizationCountByCreateTime(@Param("firstDay") LocalDate firstDay, @Param("now") LocalDate now, @Param("hospitalAgencyId")Long hospitalAgencyId); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.java index 9d3ec3cc..13f5f838 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.java @@ -197,7 +197,7 @@ public interface SignPatientManageRouteNodeMapper { * * @return PatientAndNode */ - List selectNodeExecuteStatus(); + List selectNodeExecuteStatus(Long hospitalAgencyId); List getFollowUpPlan(FollowUpRateDto queryDto); diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/homepage/impl/SystemHomePageServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/homepage/impl/SystemHomePageServiceImpl.java index a91efd41..af79d36b 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/homepage/impl/SystemHomePageServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/homepage/impl/SystemHomePageServiceImpl.java @@ -1,13 +1,18 @@ package com.xinelu.manage.service.homepage.impl; +import com.xinelu.common.core.domain.entity.SysUser; import com.xinelu.common.enums.NodeExecuteStatusEnum; import com.xinelu.common.enums.PhoneDialMethodEnum; +import com.xinelu.common.utils.SecurityUtils; +import com.xinelu.manage.domain.agency.Agency; +import com.xinelu.manage.mapper.agency.AgencyMapper; import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper; import com.xinelu.manage.mapper.patientprehospitalization.PatientPreHospitalizationMapper; import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper; import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper; import com.xinelu.manage.service.homepage.SystemHomePageService; import com.xinelu.manage.vo.homepage.*; +import com.xinelu.system.mapper.SysUserMapper; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; @@ -38,6 +43,10 @@ public class SystemHomePageServiceImpl implements SystemHomePageService { private SignPatientManageRouteNodeMapper signPatientManageRouteNodeMapper; @Resource private SignPatientRecordMapper signPatientRecordMapper; + @Resource + private SysUserMapper sysUserMapper; + @Resource + private AgencyMapper agencyMapper; /** * 顶部统计 @@ -47,23 +56,31 @@ public class SystemHomePageServiceImpl implements SystemHomePageService { @Override public TopStatisticsVO topStatistics() { LocalDate now = LocalDate.now(); + Long hospitalAgencyId = null; + SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); + if(Objects.nonNull(sysUser.getHospitalAgencyId())){ + Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId()); + if (Objects.nonNull(agency.getId())){ + hospitalAgencyId = agency.getId(); + } + } TopStatisticsVO topStatisticsVO = new TopStatisticsVO(); //本月第一天 LocalDate firstDay = now.with(TemporalAdjusters.firstDayOfMonth()); //本月患者数量 - int createPatientCount = patientInfoMapper.getPatientInfoCountByCreateTime(firstDay, now); + int createPatientCount = patientInfoMapper.getPatientInfoCountByCreateTime(firstDay, now, hospitalAgencyId); //本月预住院数量 - int patientPreHospitalizationCount = patientPreHospitalizationMapper.getPatientPreHospitalizationCountByCreateTime(firstDay, now); + int patientPreHospitalizationCount = patientPreHospitalizationMapper.getPatientPreHospitalizationCountByCreateTime(firstDay, now, hospitalAgencyId); //本月患者数 topStatisticsVO.setThisMonthPatient(createPatientCount + patientPreHospitalizationCount); //本月本月出院患者数 统计门诊/出院的 患者数量 topStatisticsVO.setThisMonthDischargePatient(createPatientCount); //本月签约数 - topStatisticsVO.setSignPatientCount(patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, now)); + topStatisticsVO.setSignPatientCount(patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, now, hospitalAgencyId)); //本月任务数 topStatisticsVO.setNodeCount(signPatientManageRouteNodeMapper.selectNodeCountByCreateTime(firstDay, now)); //已签约总数 - topStatisticsVO.setPatientSignCount(patientInfoMapper.selectPatientSignTotalCount()); + topStatisticsVO.setPatientSignCount(patientInfoMapper.selectPatientSignTotalCount(hospitalAgencyId)); //服务中患者数 topStatisticsVO.setPatientSignServiceCount(patientInfoMapper.selectPatientSignServiceCount()); return topStatisticsVO; @@ -77,6 +94,14 @@ public class SystemHomePageServiceImpl implements SystemHomePageService { @Override public List signPatientCount() { //时间集合 + Long hospitalAgencyId = null; + SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); + if(Objects.nonNull(sysUser.getHospitalAgencyId())){ + Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId()); + if (Objects.nonNull(agency.getId())){ + hospitalAgencyId = agency.getId(); + } + } List localDates = new ArrayList<>(); List signPatientCounts = new ArrayList<>(); LocalDate now = LocalDate.now(); @@ -90,11 +115,11 @@ public class SystemHomePageServiceImpl implements SystemHomePageService { LocalDate firstDay = localDate.with(TemporalAdjusters.firstDayOfMonth()); LocalDate lastDay = localDate.with(TemporalAdjusters.lastDayOfMonth()); //患者数量 - int createPatientCount = patientInfoMapper.getPatientInfoCountByCreateTime(firstDay, lastDay); - int patientPreHospitalizationCount = patientPreHospitalizationMapper.getPatientPreHospitalizationCountByCreateTime(firstDay, lastDay); - int i = patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, lastDay); + int createPatientCount = patientInfoMapper.getPatientInfoCountByCreateTime(firstDay, lastDay,hospitalAgencyId); + int patientPreHospitalizationCount = patientPreHospitalizationMapper.getPatientPreHospitalizationCountByCreateTime(firstDay, lastDay,hospitalAgencyId); + int i = patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, lastDay,hospitalAgencyId); //签约 - int signPatient = patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, now); + int signPatient = patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, now,hospitalAgencyId); signPatientCount.setTime(localDate); signPatientCount.setPatientCount(createPatientCount + patientPreHospitalizationCount); signPatientCount.setSignPatientCount(signPatient); @@ -149,6 +174,14 @@ public class SystemHomePageServiceImpl implements SystemHomePageService { */ @Override public List taskSituation() { + Long hospitalAgencyId = null; + SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); + if(Objects.nonNull(sysUser.getHospitalAgencyId())){ + Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId()); + if (Objects.nonNull(agency.getId())){ + hospitalAgencyId = agency.getId(); + } + } LocalDate now = LocalDate.now(); List taskSituations = new ArrayList<>(); //未审核 @@ -156,7 +189,7 @@ public class SystemHomePageServiceImpl implements SystemHomePageService { //全部 int signTimeCount = signPatientRecordMapper.selectCheckStatus(null, "SERVICE_CENTER"); //任务 - List patientAndNodes = signPatientManageRouteNodeMapper.selectNodeExecuteStatus(); + List patientAndNodes = signPatientManageRouteNodeMapper.selectNodeExecuteStatus(hospitalAgencyId); //未审核 int unExecutedCount = 0; //全部 diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml index 2ff494a1..c1e94470 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml @@ -837,6 +837,9 @@ and DATE(create_time) <= #{now} + + and hospital_agency_id = #{hospitalAgencyId} + diff --git a/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml index f2e5ffff..8f6eda7c 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml @@ -1084,6 +1084,9 @@ and spmrn.phone_push_sign = 1 AND spmrn.route_check_status = 'AGREE' AND spmrn.task_node_type in ('PHONE_OUTBOUND','QUESTIONNAIRE_SCALE') + + and pi.hospital_agency_id = #{hospitalAgencyId} +