随访成功率修改

This commit is contained in:
zhangheng 2025-01-23 11:08:33 +08:00
parent 4653495da3
commit 9304e21f01
5 changed files with 97 additions and 23 deletions

View File

@ -11,6 +11,7 @@ import com.xinelu.manage.domain.department.Department;
import com.xinelu.manage.dto.signpatientmanageroutenode.UploadRobotPublishRecordDto; import com.xinelu.manage.dto.signpatientmanageroutenode.UploadRobotPublishRecordDto;
import com.xinelu.manage.dto.statistics.FollowUpRateDto; import com.xinelu.manage.dto.statistics.FollowUpRateDto;
import com.xinelu.manage.dto.statistics.QuestionnaireTaskStatisticsDto; import com.xinelu.manage.dto.statistics.QuestionnaireTaskStatisticsDto;
import com.xinelu.manage.mapper.department.DepartmentMapper;
import com.xinelu.manage.mapper.patientvisitrecord.PatientVisitRecordMapper; import com.xinelu.manage.mapper.patientvisitrecord.PatientVisitRecordMapper;
import com.xinelu.manage.mapper.phonedialrecord.PhoneDialRecordMapper; import com.xinelu.manage.mapper.phonedialrecord.PhoneDialRecordMapper;
import com.xinelu.manage.mapper.shortmessagesendrecord.ShortMessageSendRecordMapper; import com.xinelu.manage.mapper.shortmessagesendrecord.ShortMessageSendRecordMapper;
@ -24,6 +25,7 @@ import com.xinelu.manage.vo.phonedialrecord.PhoneDialRecordVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientFollowUpPlanVo; import com.xinelu.manage.vo.signpatientmanageroutenode.PatientFollowUpPlanVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.UploadRobotPublishRecordVo; import com.xinelu.manage.vo.signpatientmanageroutenode.UploadRobotPublishRecordVo;
import com.xinelu.manage.vo.statistics.*; import com.xinelu.manage.vo.statistics.*;
import com.xinelu.system.mapper.SysUserMapper;
import com.xinelu.system.service.ISysUserService; import com.xinelu.system.service.ISysUserService;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
@ -64,6 +66,10 @@ public class StatisticsServiceImpl implements IStatisticsService {
private IDepartmentService departmentService; private IDepartmentService departmentService;
@Resource @Resource
private ISysUserService userService; private ISysUserService userService;
@Resource
private DepartmentMapper departmentMapper;
@Resource
private SysUserMapper sysUserMapper;
/** /**
* @description 随访成功率统计 * @description 随访成功率统计
@ -193,7 +199,12 @@ public class StatisticsServiceImpl implements IStatisticsService {
Department deptQuery = new Department(); Department deptQuery = new Department();
deptQuery.setHospitalAgencyId(agency.getId()); deptQuery.setHospitalAgencyId(agency.getId());
deptQuery.setNodeType(NodeTypeEnum.DEPARTMENT.getInfo()); deptQuery.setNodeType(NodeTypeEnum.DEPARTMENT.getInfo());
List<Department> deptList = departmentService.selectDepartmentList(deptQuery); //List<Department> deptList = departmentService.selectDepartmentList(deptQuery);
//2025/01/23 zh add start
List<Department> deptList = departmentMapper.selectDepartmentList(deptQuery);
List<Long> departmentIds = deptList.stream().filter(Objects::nonNull).map(Department::getId).distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserMapper.selectUserListByHospitalAgencyId(agency.getId(), departmentIds);
//2025/01/23 zh add end
for (Department dept : deptList) { for (Department dept : deptList) {
FollowUpDetailVo followUpDetailVo = new FollowUpDetailVo(); FollowUpDetailVo followUpDetailVo = new FollowUpDetailVo();
followUpDetailVo.setRowName(dept.getDepartmentName()); followUpDetailVo.setRowName(dept.getDepartmentName());
@ -206,10 +217,13 @@ public class StatisticsServiceImpl implements IStatisticsService {
getFollowUpDetailVo(deptPlanList, followUpDetailVo); getFollowUpDetailVo(deptPlanList, followUpDetailVo);
// 查询科室医生 // 查询科室医生
SysUser userQuery = new SysUser(); // SysUser userQuery = new SysUser();
userQuery.setHospitalAgencyId(dept.getHospitalAgencyId()); // userQuery.setHospitalAgencyId(dept.getHospitalAgencyId());
userQuery.setDepartmentId(dept.getId()); // userQuery.setDepartmentId(dept.getId());
List<SysUser> userList = userService.selectUserList(userQuery); // List<SysUser> userList = userService.selectUserList(userQuery);
//2025/01/23 zh add start
List<SysUser> userList = sysUsers.stream().filter(Objects::nonNull).filter(item -> item.getDepartmentId().equals(dept.getId())).collect(Collectors.toList());
//2025/01/23 zh add end
List<FollowUpDetailVo> childrenList = new ArrayList<>(); List<FollowUpDetailVo> childrenList = new ArrayList<>();
Map<Long, List<PatientVisitRecordStatisticVo>> patientGroupByDoctor = new HashMap<>(); Map<Long, List<PatientVisitRecordStatisticVo>> patientGroupByDoctor = new HashMap<>();
@ -436,16 +450,19 @@ public class StatisticsServiceImpl implements IStatisticsService {
private List<FollowUpDetailVo> getTotalRow(FollowUpDetailVo firstRow, List<FollowUpDetailVo> followUpDetailVoList) { private List<FollowUpDetailVo> getTotalRow(FollowUpDetailVo firstRow, List<FollowUpDetailVo> followUpDetailVoList) {
firstRow.setRowName("总计"); firstRow.setRowName("总计");
// 就诊人数 // 就诊人数
firstRow.setPatientNum(followUpDetailVoList.stream().map(FollowUpDetailVo::getPatientNum).reduce(Integer::sum).get()); //firstRow.setPatientNum(followUpDetailVoList.stream().map(FollowUpDetailVo::getPatientNum).reduce(Integer::sum).get());
firstRow.setPatientNum(followUpDetailVoList.stream().filter(item -> !item.getRowName().equals("总计")).map(FollowUpDetailVo::getPatientNum).reduce(Integer::sum).get());//2025/01/23 zh add
// 随访计划人数 // 随访计划人数
firstRow.setFollowUpNum(followUpDetailVoList.stream().map(FollowUpDetailVo::getFollowUpNum).reduce(Integer::sum).get()); //firstRow.setFollowUpNum(followUpDetailVoList.stream().map(FollowUpDetailVo::getFollowUpNum).reduce(Integer::sum).get());
firstRow.setFollowUpNum(followUpDetailVoList.stream().filter(item -> !item.getRowName().equals("总计")).map(FollowUpDetailVo::getFollowUpNum).reduce(Integer::sum).get());//2025/01/23 zh add
// 随访覆盖率 // 随访覆盖率
if (firstRow.getPatientNum() != null && firstRow.getPatientNum() > 0) { if (firstRow.getPatientNum() != null && firstRow.getPatientNum() > 0) {
firstRow.setFollowUpCoverRate(new BigDecimal(firstRow.getFollowUpNum()).divide(new BigDecimal(firstRow.getPatientNum()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))); firstRow.setFollowUpCoverRate(new BigDecimal(firstRow.getFollowUpNum()).divide(new BigDecimal(firstRow.getPatientNum()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
} }
// 随访成功人数 // 随访成功人数
firstRow.setFollowUpSuccessNum(followUpDetailVoList.stream().map(FollowUpDetailVo::getFollowUpSuccessNum).reduce(Integer::sum).get()); //firstRow.setFollowUpSuccessNum(followUpDetailVoList.stream().map(FollowUpDetailVo::getFollowUpSuccessNum).reduce(Integer::sum).get());
firstRow.setFollowUpSuccessNum(followUpDetailVoList.stream().filter(item -> !item.getRowName().equals("总计")).map(FollowUpDetailVo::getFollowUpSuccessNum).reduce(Integer::sum).get());//2025/01/23 zh add
// 随访成功率 // 随访成功率
if (firstRow.getPatientNum() != null && firstRow.getPatientNum() > 0) { if (firstRow.getPatientNum() != null && firstRow.getPatientNum() > 0) {
firstRow.setFollowUpSuccessRate(new BigDecimal(firstRow.getFollowUpSuccessNum()).divide(new BigDecimal(firstRow.getPatientNum()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))); firstRow.setFollowUpSuccessRate(new BigDecimal(firstRow.getFollowUpSuccessNum()).divide(new BigDecimal(firstRow.getPatientNum()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));

View File

@ -506,7 +506,13 @@
select patient_id, hospital_agency_id, hospital_agency_name, campus_agency_id, campus_agency_name, select patient_id, hospital_agency_id, hospital_agency_name, campus_agency_id, campus_agency_name,
department_id, department_name, ward_id, ward_name, department_id, department_name, ward_id, ward_name,
attending_physician_id,attending_physician_name, attending_physician_id,attending_physician_name,
date_format(discharge_time, '%Y-%m') as dischargeTimeMonthStr <!-- date_format(discharge_time, '%Y-%m') as dischargeTimeMonthStr-->
<!--2025/01/22 zh add start-->
CASE
WHEN discharge_time is not null THEN date_format(discharge_time, '%Y-%m')
WHEN discharge_time is null THEN date_format(visit_date, '%Y-%m')
END AS 'dischargeTimeMonthStr'
<!--2025/01/22 zh add end-->
from patient_visit_record from patient_visit_record
<where> <where>
del_flag = 0 del_flag = 0
@ -522,12 +528,21 @@
<if test="wardId != null"> <if test="wardId != null">
and ward_id = #{wardId} and ward_id = #{wardId}
</if> </if>
<if test="startDate != null"> <!-- <if test="startDate != null">-->
and date_format(discharge_time,'%y%m') &gt;= date_format(#{startDate},'%y%m') <!-- and date_format(discharge_time,'%y%m') &gt;= date_format(#{startDate},'%y%m')-->
</if> <!-- </if>-->
<if test="endDate != null"> <!-- <if test="endDate != null">-->
and date_format(discharge_time,'%y%m') &lt;= date_format(#{endDate},'%y%m') <!-- and date_format(discharge_time,'%y%m') &lt;= date_format(#{endDate},'%y%m')-->
<!-- </if>-->
<!--2025/01/22 zh add start-->
<if test="startDate != null and endDate != null">
and (
(date_format(discharge_time,'%y%m') &gt;= date_format(#{startDate},'%y%m') and date_format(discharge_time,'%y%m') &lt;= date_format(#{endDate},'%y%m'))
or
(date_format(visit_date,'%y%m') &gt;= date_format(#{startDate},'%y%m') and date_format(visit_date,'%y%m') &lt;= date_format(#{endDate},'%y%m'))
)
</if> </if>
<!--2025/01/22 zh add end-->
</where> </where>
</select> </select>

View File

@ -1091,7 +1091,13 @@
task.attending_physician_id, task.attending_physician_id,
task.attending_physician_name, task.attending_physician_name,
task.task_finish_status, task.task_finish_status,
date_format(task.execute_date_time, '%Y-%m') as executeMonthStr -- date_format(task.execute_date_time, '%Y-%m') as executeMonthStr
<!--2025/01/22 zh add start-->
CASE
WHEN task.execute_date_time is not null THEN date_format(task.execute_date_time, '%Y-%m')
WHEN task.execute_date_time is null THEN date_format(task.visit_date, '%Y-%m')
END AS 'executeMonthStr'
<!--2025/01/22 zh add end-->
from patient_task_view task from patient_task_view task
<where> <where>
<if test="hospitalAgencyId != null"> <if test="hospitalAgencyId != null">
@ -1106,12 +1112,21 @@
<if test="wardId != null"> <if test="wardId != null">
and task.ward_id = #{wardId} and task.ward_id = #{wardId}
</if> </if>
<if test="startDate != null"> <!-- <if test="startDate != null">-->
and date_format(task.execute_date_time,'%y%m') &gt;= date_format(#{startDate},'%y%m') <!-- and date_format(task.execute_date_time,'%y%m') &gt;= date_format(#{startDate},'%y%m')-->
</if> <!-- </if>-->
<if test="endDate != null"> <!-- <if test="endDate != null">-->
and date_format(task.execute_date_time,'%y%m') &lt;= date_format(#{endDate},'%y%m') <!-- and date_format(task.execute_date_time,'%y%m') &lt;= date_format(#{endDate},'%y%m')-->
<!-- </if>-->
<!--2025/01/22 zh add start-->
<if test="startDate != null and endDate != null">
and (
(date_format(task.execute_date_time,'%y%m') &gt;= date_format(#{startDate},'%y%m') and date_format(task.execute_date_time,'%y%m') &lt;= date_format(#{endDate},'%y%m'))
or
(date_format(visit_date,'%y%m') &gt;= date_format(#{startDate},'%y%m') and date_format(visit_date,'%y%m') &lt;= date_format(#{endDate},'%y%m'))
)
</if> </if>
<!--2025/01/22 zh add end-->
</where> </where>
</select> </select>

View File

@ -20,6 +20,15 @@ public interface SysUserMapper {
*/ */
public List<SysUser> selectUserList(SysUser sysUser); public List<SysUser> selectUserList(SysUser sysUser);
/**
* 根据医院信息和科室信息查询账号信息
*
* @param hospitalAgencyId 医院信息
* @param departmentIds 科室信息
* @return SysUser
*/
List<SysUser> selectUserListByHospitalAgencyId(@Param("hospitalAgencyId") Long hospitalAgencyId, @Param("departmentIds") List<Long> departmentIds);
/** /**
* 根据条件分页查询已配用户角色列表 * 根据条件分页查询已配用户角色列表
* *

View File

@ -401,4 +401,22 @@
where id = #{departmentId} where id = #{departmentId}
and node_type = 'DEPARTMENT' and node_type = 'DEPARTMENT'
</select> </select>
<select id="selectUserListByHospitalAgencyId" resultType="com.xinelu.common.core.domain.entity.SysUser">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.user_card_no,u.user_birth_date,
u.hospital_agency_id,u.department_id,u.post_name,d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="hospitalAgencyId != null and hospitalAgencyId != 0">
AND u.hospital_agency_id = #{hospitalAgencyId}
</if>
<if test="departmentIds != null and departmentIds.size() > 0">
AND u.department_id in
<foreach collection="departmentIds" item="departmentIds" open="(" separator="," close=")">
#{departmentIds}
</foreach>
</if>
</select>
</mapper> </mapper>