首页根据医院查询修改
This commit is contained in:
parent
efc9632033
commit
13b77fb9eb
@ -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);
|
||||
|
||||
/**
|
||||
* 服务中患者总数
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ public interface SignPatientManageRouteNodeMapper {
|
||||
*
|
||||
* @return PatientAndNode
|
||||
*/
|
||||
List<PatientAndNode> selectNodeExecuteStatus();
|
||||
List<PatientAndNode> selectNodeExecuteStatus(Long hospitalAgencyId);
|
||||
|
||||
List<PatientFollowUpPlanVo> getFollowUpPlan(FollowUpRateDto queryDto);
|
||||
|
||||
|
||||
@ -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> 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<SignPatientCount> 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> 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<TaskSituation> taskSituations = new ArrayList<>();
|
||||
//未审核
|
||||
@ -156,7 +189,7 @@ public class SystemHomePageServiceImpl implements SystemHomePageService {
|
||||
//全部
|
||||
int signTimeCount = signPatientRecordMapper.selectCheckStatus(null, "SERVICE_CENTER");
|
||||
//任务
|
||||
List<PatientAndNode> patientAndNodes = signPatientManageRouteNodeMapper.selectNodeExecuteStatus();
|
||||
List<PatientAndNode> patientAndNodes = signPatientManageRouteNodeMapper.selectNodeExecuteStatus(hospitalAgencyId);
|
||||
//未审核
|
||||
int unExecutedCount = 0;
|
||||
//全部
|
||||
|
||||
@ -837,6 +837,9 @@
|
||||
<if test="firstDay != null">
|
||||
and DATE(create_time) <= #{now}
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">
|
||||
and hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectPatientInfoCountBySignTime" resultType="java.lang.Integer">
|
||||
@ -851,6 +854,9 @@
|
||||
<if test="firstDay != null">
|
||||
and DATE(sign_time) <= #{now}
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">
|
||||
and hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectPatientSignTotalCount" resultType="java.lang.Integer">
|
||||
@ -858,6 +864,9 @@
|
||||
from patient_info
|
||||
where del_flag = 0
|
||||
and (service_status = 'SERVICE_CENTER' or service_status = 'SERVICE_END')
|
||||
<if test="hospitalAgencyId != null">
|
||||
and hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectPatientSignServiceCount" resultType="java.lang.Integer">
|
||||
|
||||
@ -396,9 +396,11 @@
|
||||
select
|
||||
count(1)
|
||||
from patient_pre_hospitalization
|
||||
where
|
||||
del_flag = 0
|
||||
where del_flag = 0
|
||||
and create_time >= #{firstDay}
|
||||
and create_time <= #{now}
|
||||
<if test="hospitalAgencyId != null">
|
||||
and hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -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')
|
||||
<if test="hospitalAgencyId != null">
|
||||
and pi.hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getFollowUpPlan" resultType="com.xinelu.manage.vo.signpatientmanageroutenode.PatientFollowUpPlanVo">
|
||||
SELECT task.manage_route_node_id as id,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user