首页根据医院查询修改

This commit is contained in:
zhangheng 2026-04-07 18:06:25 +08:00
parent efc9632033
commit 13b77fb9eb
7 changed files with 63 additions and 16 deletions

View File

@ -117,7 +117,7 @@ public interface PatientInfoMapper {
* @param now 当前时间 * @param now 当前时间
* @return int * @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 当前时间 * @param now 当前时间
* @return int * @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 * @return int
*/ */
int selectPatientSignTotalCount(); int selectPatientSignTotalCount(Long hospitalAgencyId);
/** /**
* 服务中患者总数 * 服务中患者总数

View File

@ -48,5 +48,5 @@ public interface PatientPreHospitalizationMapper {
* @param now 当前时间 * @param now 当前时间
* @return int * @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);
} }

View File

@ -197,7 +197,7 @@ public interface SignPatientManageRouteNodeMapper {
* *
* @return PatientAndNode * @return PatientAndNode
*/ */
List<PatientAndNode> selectNodeExecuteStatus(); List<PatientAndNode> selectNodeExecuteStatus(Long hospitalAgencyId);
List<PatientFollowUpPlanVo> getFollowUpPlan(FollowUpRateDto queryDto); List<PatientFollowUpPlanVo> getFollowUpPlan(FollowUpRateDto queryDto);

View File

@ -1,13 +1,18 @@
package com.xinelu.manage.service.homepage.impl; 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.NodeExecuteStatusEnum;
import com.xinelu.common.enums.PhoneDialMethodEnum; 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.patientinfo.PatientInfoMapper;
import com.xinelu.manage.mapper.patientprehospitalization.PatientPreHospitalizationMapper; import com.xinelu.manage.mapper.patientprehospitalization.PatientPreHospitalizationMapper;
import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper; import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper;
import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper; import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper;
import com.xinelu.manage.service.homepage.SystemHomePageService; import com.xinelu.manage.service.homepage.SystemHomePageService;
import com.xinelu.manage.vo.homepage.*; import com.xinelu.manage.vo.homepage.*;
import com.xinelu.system.mapper.SysUserMapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -38,6 +43,10 @@ public class SystemHomePageServiceImpl implements SystemHomePageService {
private SignPatientManageRouteNodeMapper signPatientManageRouteNodeMapper; private SignPatientManageRouteNodeMapper signPatientManageRouteNodeMapper;
@Resource @Resource
private SignPatientRecordMapper signPatientRecordMapper; private SignPatientRecordMapper signPatientRecordMapper;
@Resource
private SysUserMapper sysUserMapper;
@Resource
private AgencyMapper agencyMapper;
/** /**
* 顶部统计 * 顶部统计
@ -47,23 +56,31 @@ public class SystemHomePageServiceImpl implements SystemHomePageService {
@Override @Override
public TopStatisticsVO topStatistics() { public TopStatisticsVO topStatistics() {
LocalDate now = LocalDate.now(); 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(); TopStatisticsVO topStatisticsVO = new TopStatisticsVO();
//本月第一天 //本月第一天
LocalDate firstDay = now.with(TemporalAdjusters.firstDayOfMonth()); 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.setThisMonthPatient(createPatientCount + patientPreHospitalizationCount);
//本月本月出院患者数 统计门诊/出院的 患者数量 //本月本月出院患者数 统计门诊/出院的 患者数量
topStatisticsVO.setThisMonthDischargePatient(createPatientCount); topStatisticsVO.setThisMonthDischargePatient(createPatientCount);
//本月签约数 //本月签约数
topStatisticsVO.setSignPatientCount(patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, now)); topStatisticsVO.setSignPatientCount(patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, now, hospitalAgencyId));
//本月任务数 //本月任务数
topStatisticsVO.setNodeCount(signPatientManageRouteNodeMapper.selectNodeCountByCreateTime(firstDay, now)); topStatisticsVO.setNodeCount(signPatientManageRouteNodeMapper.selectNodeCountByCreateTime(firstDay, now));
//已签约总数 //已签约总数
topStatisticsVO.setPatientSignCount(patientInfoMapper.selectPatientSignTotalCount()); topStatisticsVO.setPatientSignCount(patientInfoMapper.selectPatientSignTotalCount(hospitalAgencyId));
//服务中患者数 //服务中患者数
topStatisticsVO.setPatientSignServiceCount(patientInfoMapper.selectPatientSignServiceCount()); topStatisticsVO.setPatientSignServiceCount(patientInfoMapper.selectPatientSignServiceCount());
return topStatisticsVO; return topStatisticsVO;
@ -77,6 +94,14 @@ public class SystemHomePageServiceImpl implements SystemHomePageService {
@Override @Override
public List<SignPatientCount> signPatientCount() { public List<SignPatientCount> 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<LocalDate> localDates = new ArrayList<>(); List<LocalDate> localDates = new ArrayList<>();
List<SignPatientCount> signPatientCounts = new ArrayList<>(); List<SignPatientCount> signPatientCounts = new ArrayList<>();
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
@ -90,11 +115,11 @@ public class SystemHomePageServiceImpl implements SystemHomePageService {
LocalDate firstDay = localDate.with(TemporalAdjusters.firstDayOfMonth()); LocalDate firstDay = localDate.with(TemporalAdjusters.firstDayOfMonth());
LocalDate lastDay = localDate.with(TemporalAdjusters.lastDayOfMonth()); LocalDate lastDay = localDate.with(TemporalAdjusters.lastDayOfMonth());
//患者数量 //患者数量
int createPatientCount = patientInfoMapper.getPatientInfoCountByCreateTime(firstDay, lastDay); int createPatientCount = patientInfoMapper.getPatientInfoCountByCreateTime(firstDay, lastDay,hospitalAgencyId);
int patientPreHospitalizationCount = patientPreHospitalizationMapper.getPatientPreHospitalizationCountByCreateTime(firstDay, lastDay); int patientPreHospitalizationCount = patientPreHospitalizationMapper.getPatientPreHospitalizationCountByCreateTime(firstDay, lastDay,hospitalAgencyId);
int i = patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, lastDay); int i = patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, lastDay,hospitalAgencyId);
//签约 //签约
int signPatient = patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, now); int signPatient = patientInfoMapper.selectPatientInfoCountBySignTime(firstDay, now,hospitalAgencyId);
signPatientCount.setTime(localDate); signPatientCount.setTime(localDate);
signPatientCount.setPatientCount(createPatientCount + patientPreHospitalizationCount); signPatientCount.setPatientCount(createPatientCount + patientPreHospitalizationCount);
signPatientCount.setSignPatientCount(signPatient); signPatientCount.setSignPatientCount(signPatient);
@ -149,6 +174,14 @@ public class SystemHomePageServiceImpl implements SystemHomePageService {
*/ */
@Override @Override
public List<TaskSituation> taskSituation() { public List<TaskSituation> 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(); LocalDate now = LocalDate.now();
List<TaskSituation> taskSituations = new ArrayList<>(); List<TaskSituation> taskSituations = new ArrayList<>();
//未审核 //未审核
@ -156,7 +189,7 @@ public class SystemHomePageServiceImpl implements SystemHomePageService {
//全部 //全部
int signTimeCount = signPatientRecordMapper.selectCheckStatus(null, "SERVICE_CENTER"); int signTimeCount = signPatientRecordMapper.selectCheckStatus(null, "SERVICE_CENTER");
//任务 //任务
List<PatientAndNode> patientAndNodes = signPatientManageRouteNodeMapper.selectNodeExecuteStatus(); List<PatientAndNode> patientAndNodes = signPatientManageRouteNodeMapper.selectNodeExecuteStatus(hospitalAgencyId);
//未审核 //未审核
int unExecutedCount = 0; int unExecutedCount = 0;
//全部 //全部

View File

@ -837,6 +837,9 @@
<if test="firstDay != null"> <if test="firstDay != null">
and DATE(create_time) &lt;= #{now} and DATE(create_time) &lt;= #{now}
</if> </if>
<if test="hospitalAgencyId != null">
and hospital_agency_id = #{hospitalAgencyId}
</if>
</select> </select>
<select id="selectPatientInfoCountBySignTime" resultType="java.lang.Integer"> <select id="selectPatientInfoCountBySignTime" resultType="java.lang.Integer">
@ -851,6 +854,9 @@
<if test="firstDay != null"> <if test="firstDay != null">
and DATE(sign_time) &lt;= #{now} and DATE(sign_time) &lt;= #{now}
</if> </if>
<if test="hospitalAgencyId != null">
and hospital_agency_id = #{hospitalAgencyId}
</if>
</select> </select>
<select id="selectPatientSignTotalCount" resultType="java.lang.Integer"> <select id="selectPatientSignTotalCount" resultType="java.lang.Integer">
@ -858,6 +864,9 @@
from patient_info from patient_info
where del_flag = 0 where del_flag = 0
and (service_status = 'SERVICE_CENTER' or service_status = 'SERVICE_END') and (service_status = 'SERVICE_CENTER' or service_status = 'SERVICE_END')
<if test="hospitalAgencyId != null">
and hospital_agency_id = #{hospitalAgencyId}
</if>
</select> </select>
<select id="selectPatientSignServiceCount" resultType="java.lang.Integer"> <select id="selectPatientSignServiceCount" resultType="java.lang.Integer">

View File

@ -396,9 +396,11 @@
select select
count(1) count(1)
from patient_pre_hospitalization from patient_pre_hospitalization
where where del_flag = 0
del_flag = 0
and create_time >= #{firstDay} and create_time >= #{firstDay}
and create_time &lt;= #{now} and create_time &lt;= #{now}
<if test="hospitalAgencyId != null">
and hospital_agency_id = #{hospitalAgencyId}
</if>
</select> </select>
</mapper> </mapper>

View File

@ -1084,6 +1084,9 @@
and spmrn.phone_push_sign = 1 and spmrn.phone_push_sign = 1
AND spmrn.route_check_status = 'AGREE' AND spmrn.route_check_status = 'AGREE'
AND spmrn.task_node_type in ('PHONE_OUTBOUND','QUESTIONNAIRE_SCALE') AND spmrn.task_node_type in ('PHONE_OUTBOUND','QUESTIONNAIRE_SCALE')
<if test="hospitalAgencyId != null">
and pi.hospital_agency_id = #{hospitalAgencyId}
</if>
</select> </select>
<select id="getFollowUpPlan" resultType="com.xinelu.manage.vo.signpatientmanageroutenode.PatientFollowUpPlanVo"> <select id="getFollowUpPlan" resultType="com.xinelu.manage.vo.signpatientmanageroutenode.PatientFollowUpPlanVo">
SELECT task.manage_route_node_id as id, SELECT task.manage_route_node_id as id,