统计查询。
This commit is contained in:
parent
7445850990
commit
87175fac69
@ -3,16 +3,16 @@ package com.xinelu.manage.controller.patientquestionsubmitresult;
|
||||
import com.xinelu.common.annotation.Log;
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.domain.R;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.common.enums.BusinessType;
|
||||
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||
import com.xinelu.manage.domain.patientquestionsubmitresult.PatientQuestionSubmitResult;
|
||||
import com.xinelu.manage.dto.patientquestionsubmitresult.PatientQuestionSubmitStatistisDto;
|
||||
import com.xinelu.manage.dto.specialdiseaseroute.SpecialDiseaseRouteDTO;
|
||||
import com.xinelu.manage.service.patientquestionsubmitresult.IPatientQuestionSubmitResultService;
|
||||
import com.xinelu.manage.vo.patientquestionsubmitresult.PatientQuestionSubmitListVo;
|
||||
import com.xinelu.manage.vo.patientquestionsubmitresult.SatisfactionSurveyVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @author xinelu
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
@Api(tags = "患者问卷提交结果信息接口")
|
||||
@RestController
|
||||
@RequestMapping("/system/patientQuestionSubmitResult")
|
||||
public class PatientQuestionSubmitResultController extends BaseController {
|
||||
@ -119,17 +120,28 @@ public class PatientQuestionSubmitResultController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室提交问卷数量
|
||||
*/
|
||||
* @description 科室提交问卷数量
|
||||
* @Param 问卷统计传输对象
|
||||
* @Author haown
|
||||
* @Date 2024-10-30 9:23
|
||||
*/
|
||||
@ApiOperation("科室提交问卷数量")
|
||||
@GetMapping("/departmenQuestionSubmitCount")
|
||||
public AjaxResult departmenQuestionSubmitCount(PatientQuestionSubmitStatistisDto queryDto) {
|
||||
return patientQuestionSubmitResultService.departmenQuestionSubmitCount(queryDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 问卷统计列表
|
||||
* @description 问卷统计列表
|
||||
* @Param 问卷统计传输对象
|
||||
* @Author haown
|
||||
* @Date 2024-10-30 9:23
|
||||
*/
|
||||
@ApiOperation("问卷统计列表")
|
||||
@GetMapping("/patientQuestionSubmitList")
|
||||
public R<List<PatientQuestionSubmitListVo>> patientQuestionSubmitList(PatientQuestionSubmitStatistisDto queryDto) {
|
||||
return R.ok(patientQuestionSubmitResultService.patientQuestionSubmitList(queryDto));
|
||||
public TableDataInfo patientQuestionSubmitList(PatientQuestionSubmitStatistisDto queryDto) {
|
||||
startPage();
|
||||
List<PatientQuestionSubmitListVo> list = patientQuestionSubmitResultService.patientQuestionSubmitList(queryDto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package com.xinelu.manage.controller.statistics;
|
||||
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.R;
|
||||
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
|
||||
import com.xinelu.manage.service.statistics.IStatisticsService;
|
||||
import com.xinelu.manage.vo.statistics.FollowUpDetailVo;
|
||||
import com.xinelu.manage.vo.statistics.FollowUpRateVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @description: 统计模块控制器
|
||||
* @author: haown
|
||||
* @create: 2024-10-30 13:56
|
||||
**/
|
||||
@Api(tags = "统计模块控制器")
|
||||
@RestController
|
||||
@RequestMapping("/system/statistics")
|
||||
public class StatisticsController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IStatisticsService statisticsService;
|
||||
|
||||
/**
|
||||
* 随访成功率统计
|
||||
*/
|
||||
@ApiOperation("随访成功率统计")
|
||||
@GetMapping("/getFollowUpRate")
|
||||
public R<FollowUpRateVo> getFollowUpRate(FollowUpRateDto queryDto) {
|
||||
return R.ok(statisticsService.getFollowUpRate(queryDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 随访明细表查询
|
||||
*/
|
||||
@ApiOperation("随访明细表查询")
|
||||
@GetMapping("/getFollowUpDetail")
|
||||
public R<List<FollowUpDetailVo>> getFollowUpDetail(FollowUpRateDto queryDto) {
|
||||
return R.ok(statisticsService.getFollowUpDetail(queryDto));
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.xinelu.manage.dto.patientquestionsubmitresult;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.time.LocalDate;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @description: 问卷统计传输对象
|
||||
@ -52,11 +53,13 @@ public class PatientQuestionSubmitStatistisDto {
|
||||
* 起始时间
|
||||
*/
|
||||
@ApiModelProperty(value = "起始时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate startDate;
|
||||
|
||||
/**
|
||||
* 截至时间
|
||||
*/
|
||||
@ApiModelProperty(value = "截至时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate endDate;
|
||||
}
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.xinelu.manage.dto.statistics;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.time.LocalDate;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @description: 随访成功率查询传输对象
|
||||
* @author: haown
|
||||
* @create: 2024-10-30 16:47
|
||||
**/
|
||||
@ApiModel("随访成功率查询传输对象")
|
||||
@Data
|
||||
public class FollowUpRateDto {
|
||||
|
||||
/**
|
||||
* 开始月份
|
||||
*/
|
||||
@ApiModelProperty("开始月份")
|
||||
@DateTimeFormat(pattern = "yyyy-MM")
|
||||
private LocalDate startDate;
|
||||
|
||||
/**
|
||||
* 结束月份
|
||||
*/
|
||||
@ApiModelProperty("结束月份")
|
||||
@DateTimeFormat(pattern = "yyyy-MM")
|
||||
private LocalDate endDate;
|
||||
|
||||
/**
|
||||
* 所属医院id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属医院id")
|
||||
private Long hospitalAgencyId;
|
||||
|
||||
/**
|
||||
* 所属院区id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属院区id")
|
||||
private Long campusAgencyId;
|
||||
|
||||
/**
|
||||
* 所属科室id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属科室id")
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 所属病区id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属病区id")
|
||||
private Long wardId;
|
||||
|
||||
/**
|
||||
* 就诊方式,门诊:OUTPATIENT_SERVICE,住院:BE_IN_HOSPITAL
|
||||
*/
|
||||
@ApiModelProperty(value = "就诊方式,门诊:OUTPATIENT_SERVICE,住院:BE_IN_HOSPITAL")
|
||||
private String visitMethod;
|
||||
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
package com.xinelu.manage.mapper.phonedialrecord;
|
||||
|
||||
import com.xinelu.manage.domain.phonedialrecord.PhoneDialRecord;
|
||||
|
||||
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
|
||||
import com.xinelu.manage.vo.phonedialrecord.PhoneDialRecordVo;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -58,4 +59,6 @@ public interface PhoneDialRecordMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePhoneDialRecordByIds(Long[] ids);
|
||||
|
||||
List<PhoneDialRecordVo> getPhoneDialStatistic(FollowUpRateDto queryDto);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.xinelu.manage.mapper.shortmessagesendrecord;
|
||||
|
||||
import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
|
||||
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
|
||||
import com.xinelu.manage.vo.statistics.MessageSendVo;
|
||||
import com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -68,4 +70,6 @@ public interface ShortMessageSendRecordMapper {
|
||||
* @return RecordNum
|
||||
*/
|
||||
List<RecordNum> selectShortMessageRecordCountByManageRouteNodeIds(@Param("manageRouteNodeIds") List<Long> manageRouteNodeIds);
|
||||
|
||||
List<MessageSendVo> getStatisticNum(FollowUpRateDto queryDto);
|
||||
}
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
package com.xinelu.manage.mapper.subscribemessagesendrecord;
|
||||
|
||||
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
|
||||
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
|
||||
import com.xinelu.manage.vo.statistics.MessageSendVo;
|
||||
import com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 微信小程序订阅消息发送结果记录Mapper接口
|
||||
@ -76,4 +77,6 @@ public interface SubscribeMessageSendRecordMapper {
|
||||
* @return RecordNum
|
||||
*/
|
||||
List<RecordNum> selectRecordCountByManageRouteNodeIds(@Param("manageRouteNodeIds") List<Long> manageRouteNodeIds);
|
||||
|
||||
List<MessageSendVo> getStatisticNum(FollowUpRateDto queryDto);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xinelu.manage.service.patientquestionsubmitresult.impl;
|
||||
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.enums.QuestionTypeEnum;
|
||||
import com.xinelu.common.utils.PageServiceUtil;
|
||||
import com.xinelu.manage.domain.agency.Agency;
|
||||
import com.xinelu.manage.domain.patientquestionsubmitresult.PatientQuestionSubmitResult;
|
||||
import com.xinelu.manage.dto.patientquestionsubmitresult.PatientQuestionSubmitStatistisDto;
|
||||
@ -30,6 +31,8 @@ public class PatientQuestionSubmitResultServiceImpl implements IPatientQuestionS
|
||||
private PatientQuestionSubmitResultMapper patientQuestionSubmitResultMapper;
|
||||
@Resource
|
||||
private AgencyMapper agencyMapper;
|
||||
@Resource
|
||||
private PageServiceUtil pageServiceUtil;
|
||||
|
||||
/**
|
||||
* 查询患者问卷提交结果信息
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package com.xinelu.manage.service.statistics;
|
||||
|
||||
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
|
||||
import com.xinelu.manage.vo.statistics.FollowUpDetailVo;
|
||||
import com.xinelu.manage.vo.statistics.FollowUpRateVo;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 统计模块Service接口
|
||||
*
|
||||
* @author haown
|
||||
* @date 2024-10-31
|
||||
*/
|
||||
public interface IStatisticsService {
|
||||
|
||||
/**
|
||||
* @description 随访成功率统计
|
||||
* @Param queryDto 随访成功率查询传输对象
|
||||
* @return 随访成功率查询返回视图类
|
||||
* @Author haown
|
||||
* @Date 2024-11-1 10:48
|
||||
*/
|
||||
FollowUpRateVo getFollowUpRate(FollowUpRateDto queryDto);
|
||||
|
||||
/**
|
||||
* @description 随访明细表统计查询
|
||||
* @Param queryDto 随访成功率查询传输对象
|
||||
* @return 随访明细表
|
||||
* @Author haown
|
||||
* @Date 2024-11-1 10:47
|
||||
*/
|
||||
List<FollowUpDetailVo> getFollowUpDetail(FollowUpRateDto queryDto);
|
||||
}
|
||||
@ -0,0 +1,192 @@
|
||||
package com.xinelu.manage.service.statistics.impl;
|
||||
|
||||
import com.xinelu.common.enums.PhoneDialMethodEnum;
|
||||
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
|
||||
import com.xinelu.manage.mapper.phonedialrecord.PhoneDialRecordMapper;
|
||||
import com.xinelu.manage.mapper.shortmessagesendrecord.ShortMessageSendRecordMapper;
|
||||
import com.xinelu.manage.mapper.subscribemessagesendrecord.SubscribeMessageSendRecordMapper;
|
||||
import com.xinelu.manage.service.statistics.IStatisticsService;
|
||||
import com.xinelu.manage.vo.phonedialrecord.PhoneDialRecordVo;
|
||||
import com.xinelu.manage.vo.statistics.FollowUpDetailVo;
|
||||
import com.xinelu.manage.vo.statistics.FollowUpNumTrendVo;
|
||||
import com.xinelu.manage.vo.statistics.FollowUpRateTrendVo;
|
||||
import com.xinelu.manage.vo.statistics.FollowUpRateVo;
|
||||
import com.xinelu.manage.vo.statistics.MessageSendVo;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @description: 统计模块Service业务层处理
|
||||
* @author: haown
|
||||
* @create: 2024-10-31 11:24
|
||||
**/
|
||||
@Service
|
||||
public class StatisticsServiceImpl implements IStatisticsService {
|
||||
|
||||
@Resource
|
||||
private PhoneDialRecordMapper phoneDialRecordMapper;
|
||||
@Resource
|
||||
private ShortMessageSendRecordMapper shortMessageSendRecordMapper;
|
||||
@Resource
|
||||
private SubscribeMessageSendRecordMapper subscribeMessageSendRecordMapper;
|
||||
|
||||
/**
|
||||
* @description 随访成功率统计
|
||||
* @Param queryDto 随访成功率查询传输对象
|
||||
* @return 随访成功率查询返回视图类
|
||||
* @Author haown
|
||||
* @Date 2024-11-1 10:48
|
||||
*/
|
||||
@Override
|
||||
public FollowUpRateVo getFollowUpRate(FollowUpRateDto queryDto) {
|
||||
if (queryDto.getStartDate() == null) {
|
||||
queryDto.setStartDate(LocalDate.now().withDayOfYear(1));
|
||||
}
|
||||
if (queryDto.getEndDate() == null) {
|
||||
queryDto.setEndDate(LocalDate.now());
|
||||
}
|
||||
FollowUpRateVo retObj = new FollowUpRateVo();
|
||||
List<PhoneDialRecordVo> phoneDialRecordVoList = phoneDialRecordMapper.getPhoneDialStatistic(queryDto);
|
||||
// 统计AI电话拨打次数、AI电话拨打次数成功率、AI拨打人数、AI拨打人数成功率、人工电话拨打次数、人工电话拨打次数成功率、人工拨打人数、人工拨打人数成功率
|
||||
retObj = getFollowUpRateVo(phoneDialRecordVoList);
|
||||
// 电话拨打总人数
|
||||
retObj.setSumPatientNum(retObj.getAiPatientNum() + retObj.getCommonPatientNum());
|
||||
// 短信发送数量
|
||||
List<MessageSendVo> messageSendList = shortMessageSendRecordMapper.getStatisticNum(queryDto);
|
||||
if (CollectionUtils.isNotEmpty(messageSendList)) {
|
||||
retObj.setSmsNum(messageSendList.size());
|
||||
}
|
||||
|
||||
// 小程序推送数量
|
||||
List<MessageSendVo> subscribeRecordList = subscribeMessageSendRecordMapper.getStatisticNum(queryDto);
|
||||
if (CollectionUtils.isNotEmpty(subscribeRecordList)) {
|
||||
retObj.setSubscribeNum(subscribeRecordList.size());
|
||||
}
|
||||
|
||||
// 数据趋势图
|
||||
List<FollowUpRateTrendVo> rateTrendVoList = new ArrayList<>();
|
||||
List<FollowUpNumTrendVo> numTrendVoList = new ArrayList<>();
|
||||
|
||||
Map<String, List<PhoneDialRecordVo>> groupByDialTime = phoneDialRecordVoList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(PhoneDialRecordVo::getDialTimeMonth));
|
||||
|
||||
Map<String, List<MessageSendVo>> megGroupBySendTime = messageSendList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(MessageSendVo::getSendTimeMonthStr));
|
||||
Map<String, List<MessageSendVo>> subGroupBySendTime = subscribeRecordList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(MessageSendVo::getSendTimeMonthStr));
|
||||
|
||||
// 横坐标日期
|
||||
List<String> months = new ArrayList<>();
|
||||
LocalDate startDate = queryDto.getStartDate();
|
||||
while (!startDate.isAfter(queryDto.getEndDate())) {
|
||||
months.add(startDate.format(DateTimeFormatter.ofPattern("yyyy-MM")));
|
||||
startDate = startDate.plus(1, ChronoUnit.MONTHS);
|
||||
}
|
||||
|
||||
// 成功率趋势图
|
||||
for (String month : months) {
|
||||
List<PhoneDialRecordVo> monthDialList = groupByDialTime.get(month);
|
||||
FollowUpRateVo monthObj = getFollowUpRateVo(monthDialList);
|
||||
FollowUpRateTrendVo rateTrendVo = new FollowUpRateTrendVo();
|
||||
FollowUpNumTrendVo numTrendVo = new FollowUpNumTrendVo();
|
||||
|
||||
rateTrendVo.setFollowUpMonth(month);
|
||||
rateTrendVo.setAiSuccessRate(monthObj.getAiSuccessRate());
|
||||
rateTrendVo.setCommonSuccessRate(monthObj.getCommonSuccessRate());
|
||||
rateTrendVo.setAiPatientSuccessRate(monthObj.getAiPatientSuccessRate());
|
||||
rateTrendVo.setCommonPatientSuccessRate(monthObj.getCommonPatientSuccessRate());
|
||||
rateTrendVoList.add(rateTrendVo);
|
||||
|
||||
numTrendVo.setAiPatientNum(monthObj.getAiPatientNum());
|
||||
numTrendVo.setCommonPatientNum(monthObj.getCommonPatientNum());
|
||||
|
||||
// 短信发送数量
|
||||
List<MessageSendVo> megList = megGroupBySendTime.get(month);
|
||||
numTrendVo.setSmsNum(CollectionUtils.isEmpty(megList) ? 0 : megList.size());
|
||||
// 小程序发送数量
|
||||
List<MessageSendVo> subList = subGroupBySendTime.get(month);
|
||||
numTrendVo.setSubscribeNum(CollectionUtils.isEmpty(subList) ? 0 : subList.size());
|
||||
numTrendVoList.add(numTrendVo);
|
||||
}
|
||||
retObj.setRateTrendVoList(rateTrendVoList);
|
||||
retObj.setNumTrendVoList(numTrendVoList);
|
||||
return retObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 随访明细表统计查询
|
||||
* @Param queryDto 随访成功率查询传输对象
|
||||
* @return 随访明细表
|
||||
* @Author haown
|
||||
* @Date 2024-11-1 10:47
|
||||
*/
|
||||
@Override
|
||||
public List<FollowUpDetailVo> getFollowUpDetail(FollowUpRateDto queryDto) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 统计AI电话拨打次数、AI电话拨打次数成功率、AI拨打人数、AI拨打人数成功率、人工电话拨打次数、人工电话拨打次数成功率、人工拨打人数、人工拨打人数成功率
|
||||
* @Param 拨打电话记录列表
|
||||
* @return 随访成功率查询返回视图类
|
||||
* @Author haown
|
||||
* @Date 2024-11-1 9:31
|
||||
*/
|
||||
private FollowUpRateVo getFollowUpRateVo(List<PhoneDialRecordVo> phoneDialRecordVoList) {
|
||||
FollowUpRateVo retObj = new FollowUpRateVo();
|
||||
if (CollectionUtils.isEmpty(phoneDialRecordVoList)) {
|
||||
return retObj;
|
||||
}
|
||||
// 按照拨打方式分组
|
||||
Map<String, List<PhoneDialRecordVo>> groupByDialMethod = phoneDialRecordVoList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(PhoneDialRecordVo::getPhoneDialMethod));
|
||||
List<PhoneDialRecordVo> aiDialList = groupByDialMethod.get(PhoneDialMethodEnum.AI.getInfo());
|
||||
List<PhoneDialRecordVo> commonDialList = groupByDialMethod.get(PhoneDialMethodEnum.COMMON.getInfo());
|
||||
if (CollectionUtils.isNotEmpty(aiDialList)) {
|
||||
// 筛选成功数量
|
||||
List<PhoneDialRecordVo> aiSuccessList = aiDialList.stream().filter(item -> item.getErrorCode() == 0).collect(Collectors.toList());
|
||||
// 统计AI电话拨打次数
|
||||
retObj.setAiNum(aiDialList.size());
|
||||
// 统计AI电话拨打次数成功率
|
||||
retObj.setAiSuccessRate(CollectionUtils.isEmpty(aiSuccessList) ? BigDecimal.ZERO :
|
||||
new BigDecimal(aiSuccessList.size()).divide(new BigDecimal(retObj.getAiNum()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
||||
|
||||
// 统计AI拨打人数
|
||||
Map<Long, List<PhoneDialRecordVo>> groupByPatient = aiDialList.stream().collect(Collectors.groupingBy(PhoneDialRecordVo::getPatientId));
|
||||
retObj.setAiPatientNum(groupByPatient.keySet().size());
|
||||
// AI拨打人数成功率
|
||||
if (CollectionUtils.isNotEmpty(aiSuccessList)) {
|
||||
Map<Long, List<PhoneDialRecordVo>> aiSuccessGroupByPatient = aiSuccessList.stream().collect(Collectors.groupingBy(PhoneDialRecordVo::getPatientId));
|
||||
retObj.setAiSuccessRate(new BigDecimal(aiSuccessGroupByPatient.keySet().size()).divide(new BigDecimal(retObj.getAiPatientNum()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(commonDialList)) {
|
||||
// 筛选成功数量
|
||||
List<PhoneDialRecordVo> commonSuccessList = commonDialList.stream().filter(item -> item.getErrorCode() == 0).collect(Collectors.toList());
|
||||
// 统计人工电话拨打次数
|
||||
retObj.setCommonNum(commonDialList.size());
|
||||
// 统计人工电话拨打次数成功率
|
||||
retObj.setCommonSuccessRate(CollectionUtils.isEmpty(commonSuccessList) ? BigDecimal.ZERO :
|
||||
new BigDecimal(commonSuccessList.size()).divide(new BigDecimal(commonDialList.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
||||
|
||||
// 统计人工拨打人数
|
||||
Map<Long, List<PhoneDialRecordVo>> groupByPatient = commonDialList.stream().collect(Collectors.groupingBy(PhoneDialRecordVo::getPatientId));
|
||||
retObj.setAiPatientNum(groupByPatient.keySet().size());
|
||||
// 人工拨打人数成功率
|
||||
if (CollectionUtils.isNotEmpty(commonSuccessList)) {
|
||||
Map<Long, List<PhoneDialRecordVo>> commonSuccessGroupByPatient = commonSuccessList.stream().collect(Collectors.groupingBy(PhoneDialRecordVo::getPatientId));
|
||||
retObj.setCommonSuccessRate(new BigDecimal(commonSuccessGroupByPatient.keySet().size()).divide(new BigDecimal(retObj.getCommonPatientNum()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
||||
}
|
||||
}
|
||||
return retObj;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.xinelu.manage.vo.phonedialrecord;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 拨打电话记录统计返回视图类
|
||||
* @author: haown
|
||||
* @create: 2024-10-31 14:53
|
||||
**/
|
||||
@Data
|
||||
@ApiModel("拨打电话记录统计返回视图类")
|
||||
public class PhoneDialRecordVo {
|
||||
|
||||
/**
|
||||
* 患者主键
|
||||
*/
|
||||
@ApiModelProperty(value = "患者主键")
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 所属医院id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属医院id")
|
||||
private Long hospitalAgencyId;
|
||||
|
||||
/**
|
||||
* 所属院区id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属院区id")
|
||||
private Long campusAgencyId;
|
||||
|
||||
/**
|
||||
* 所属科室id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属科室id")
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 所属病区id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属病区id")
|
||||
private Long wardId;
|
||||
|
||||
/**
|
||||
* 呼叫时间
|
||||
*/
|
||||
@ApiModelProperty(value = "呼叫时间")
|
||||
private String dialTimeMonth;
|
||||
|
||||
/**
|
||||
* AI :自动外呼 或 COMMON:人工随访电话,否则为空
|
||||
*/
|
||||
@ApiModelProperty(value = "AI :自动外呼 或 COMMON:人工随访电话,否则为空")
|
||||
private String phoneDialMethod;
|
||||
|
||||
/**
|
||||
* 推送结果状态码(0表示成功)
|
||||
*/
|
||||
@ApiModelProperty(value = "推送结果状态码")
|
||||
private Long errorCode;
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.xinelu.manage.vo.statistics;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 随访明细表查询返回视图类
|
||||
* @author: haown
|
||||
* @create: 2024-10-30 16:28
|
||||
**/
|
||||
@Data
|
||||
public class FollowUpDetailVo {
|
||||
|
||||
/**
|
||||
* 列表第一列名称
|
||||
*/
|
||||
private String rowName;
|
||||
|
||||
/**
|
||||
* 就诊/出院患者人数
|
||||
*/
|
||||
@ApiModelProperty("就诊/出院患者人数")
|
||||
private Integer patientNum;
|
||||
|
||||
/**
|
||||
* 有随访计划人数
|
||||
*/
|
||||
@ApiModelProperty("有随访计划人数")
|
||||
private Integer followUpNum;
|
||||
|
||||
/**
|
||||
* 随访覆盖率
|
||||
*/
|
||||
@ApiModelProperty("随访覆盖率")
|
||||
private BigDecimal followUpCoverRate;
|
||||
|
||||
/**
|
||||
* 随访成功人数
|
||||
*/
|
||||
@ApiModelProperty("随访成功人数")
|
||||
private Integer followUpSuccessNum;
|
||||
|
||||
/**
|
||||
* 随访成功率
|
||||
*/
|
||||
@ApiModelProperty("随访成功率")
|
||||
private BigDecimal followUpSuccessRate;
|
||||
|
||||
/**
|
||||
* 下一级随访明细表
|
||||
*/
|
||||
List<FollowUpDetailVo> childerenList;
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xinelu.manage.vo.statistics;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 随访数量趋势图返回视图类
|
||||
* @author: haown
|
||||
* @create: 2024-11-01 09:23
|
||||
**/
|
||||
@ApiModel("随访数量趋势图返回视图类")
|
||||
@Data
|
||||
public class FollowUpNumTrendVo {
|
||||
|
||||
/**
|
||||
* 随访月份
|
||||
*/
|
||||
private String followUpMonth;
|
||||
|
||||
/**
|
||||
* AI电话拨打人数
|
||||
*/
|
||||
@ApiModelProperty("AI电话拨打人数")
|
||||
private Integer aiPatientNum = 0;
|
||||
|
||||
/**
|
||||
* 人工电话拨打人数
|
||||
*/
|
||||
@ApiModelProperty("人工电话拨打人数")
|
||||
private Integer commonPatientNum = 0;
|
||||
|
||||
/**
|
||||
* 短信发送数
|
||||
*/
|
||||
@ApiModelProperty("短信发送数")
|
||||
private Integer smsNum = 0;
|
||||
|
||||
/**
|
||||
* 小程序通知数
|
||||
*/
|
||||
@ApiModelProperty("小程序通知数")
|
||||
private Integer subscribeNum = 0;
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.xinelu.manage.vo.statistics;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 随访成功率趋势图返回视图类
|
||||
* @author: haown
|
||||
* @create: 2024-10-31 10:39
|
||||
**/
|
||||
@ApiModel("随访成功率趋势图返回视图类")
|
||||
@Data
|
||||
public class FollowUpRateTrendVo {
|
||||
|
||||
/**
|
||||
* 随访月份
|
||||
*/
|
||||
private String followUpMonth;
|
||||
|
||||
/**
|
||||
* AI电话拨打成功率
|
||||
*/
|
||||
@ApiModelProperty("AI电话拨打成功率")
|
||||
private BigDecimal aiSuccessRate;
|
||||
|
||||
/**
|
||||
* 人工电话拨打成功率
|
||||
*/
|
||||
@ApiModelProperty("人工电话拨打成功率")
|
||||
private BigDecimal commonSuccessRate;
|
||||
|
||||
/**
|
||||
* AI电话拨打人数成功率
|
||||
*/
|
||||
@ApiModelProperty("AI电话拨打人数成功率")
|
||||
private BigDecimal aiPatientSuccessRate;
|
||||
|
||||
/**
|
||||
* 人工电话拨打人数成功率
|
||||
*/
|
||||
@ApiModelProperty("人工电话拨打人数成功率")
|
||||
private BigDecimal commonPatientSuccessRate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package com.xinelu.manage.vo.statistics;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: 随访成功率查询返回视图类
|
||||
* @author: haown
|
||||
* @create: 2024-10-30 16:42
|
||||
**/
|
||||
@ApiModel("随访成功率查询返回视图类")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FollowUpRateVo {
|
||||
|
||||
/**
|
||||
* AI电话拨打次数
|
||||
*/
|
||||
@ApiModelProperty("AI电话拨打次数")
|
||||
private Integer aiNum = 0;
|
||||
|
||||
/**
|
||||
* AI电话拨打成功率
|
||||
*/
|
||||
@ApiModelProperty("AI电话拨打成功率")
|
||||
private BigDecimal aiSuccessRate = BigDecimal.ZERO;
|
||||
|
||||
/**
|
||||
* 人工电话拨打次数
|
||||
*/
|
||||
@ApiModelProperty("人工电话拨打次数")
|
||||
private Integer commonNum = 0;
|
||||
|
||||
/**
|
||||
* 人工电话拨打成功率
|
||||
*/
|
||||
@ApiModelProperty("人工电话拨打成功率")
|
||||
private BigDecimal commonSuccessRate = BigDecimal.ZERO;
|
||||
|
||||
/**
|
||||
* AI电话拨打人数
|
||||
*/
|
||||
@ApiModelProperty("AI电话拨打人数")
|
||||
private Integer aiPatientNum = 0;
|
||||
|
||||
/**
|
||||
* AI拨打人数成功率
|
||||
*/
|
||||
@ApiModelProperty("AI拨打人数成功率")
|
||||
private BigDecimal aiPatientSuccessRate = BigDecimal.ZERO;
|
||||
|
||||
/**
|
||||
* 人工电话拨打人数
|
||||
*/
|
||||
@ApiModelProperty("人工电话拨打人数")
|
||||
private Integer commonPatientNum = 0;
|
||||
|
||||
/**
|
||||
* 人工电话拨打人数成功率
|
||||
*/
|
||||
@ApiModelProperty("人工电话拨打人数成功率")
|
||||
private BigDecimal commonPatientSuccessRate = BigDecimal.ZERO;
|
||||
|
||||
/**
|
||||
* 总通话人数
|
||||
*/
|
||||
@ApiModelProperty("总通话人数")
|
||||
private Integer sumPatientNum = 0;
|
||||
|
||||
/**
|
||||
* 短信发送数
|
||||
*/
|
||||
@ApiModelProperty("短信发送数")
|
||||
private Integer smsNum = 0;
|
||||
|
||||
/**
|
||||
* 小程序通知数
|
||||
*/
|
||||
@ApiModelProperty("小程序通知数")
|
||||
private Integer subscribeNum = 0;
|
||||
|
||||
/**
|
||||
* 成功率趋势图
|
||||
*/
|
||||
@ApiModelProperty("成功率趋势图")
|
||||
List<FollowUpRateTrendVo> rateTrendVoList;
|
||||
|
||||
/**
|
||||
* 推送数量趋势图
|
||||
*/
|
||||
@ApiModelProperty("推送数量趋势图")
|
||||
List<FollowUpNumTrendVo> numTrendVoList;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xinelu.manage.vo.statistics;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 发送短信数量、推送小程序数量统计返回视图类
|
||||
* @author: haown
|
||||
* @create: 2024-11-01 10:17
|
||||
**/
|
||||
@ApiModel("发送短信数量、推送小程序数量统计返回视图类")
|
||||
@Data
|
||||
public class MessageSendVo {
|
||||
|
||||
/**
|
||||
* 患者主键
|
||||
*/
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 发送时间月份字符串
|
||||
*/
|
||||
private String sendTimeMonthStr;
|
||||
|
||||
}
|
||||
@ -471,21 +471,17 @@
|
||||
FROM patient_question_submit_result a
|
||||
LEFT JOIN sign_patient_manage_route route on a.manage_route_id = route.id
|
||||
LEFT JOIN sign_patient_record record ON route.sign_patient_record_id = record.id
|
||||
WHERE record.department_id = dt.id
|
||||
left join patient_visit_record vr on record.patient_visit_record_id = vr.id
|
||||
WHERE vr.department_id = dt.id
|
||||
) AS countNum
|
||||
from department dt
|
||||
left join patient_question_submit_result pqsr on dt.id = pqsr.department_id
|
||||
LEFT JOIN sign_patient_manage_route route on pqsr.manage_route_id = route.id
|
||||
LEFT JOIN sign_patient_record record ON route.sign_patient_record_id = record.id
|
||||
<where>
|
||||
<if test="hospitalAgencyId != null ">
|
||||
and dt.hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
and dt.department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="departmentName != null and departmentName != ''">
|
||||
and dt.department_name like concat('%',#{departmentName},'%')
|
||||
and dt.id = #{departmentId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY dt.id
|
||||
@ -513,17 +509,25 @@
|
||||
LEFT JOIN sign_patient_manage_route route on pqsr.manage_route_id = route.id
|
||||
LEFT JOIN sign_patient_record record ON route.sign_patient_record_id = record.id
|
||||
left join patient_visit_record vr on record.patient_visit_record_id = vr.id
|
||||
<if test="questionInfoId != null">
|
||||
and pqsr.question_info_id = #{questionInfoId}
|
||||
</if>
|
||||
<if test="patientName != null and patientName != ''">
|
||||
and vr.patient_name like concat('%', #{patientName}, '%')
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
and pqsr.create_time >=#{startDate}
|
||||
</if>
|
||||
<if test="endDate != null ">
|
||||
and pqsr.create_time <= #{endDate}
|
||||
</if>
|
||||
<where>
|
||||
<if test="hospitalAgencyId != null">
|
||||
and vr.hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
and vr.department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="questionInfoId != null">
|
||||
and pqsr.question_info_id = #{questionInfoId}
|
||||
</if>
|
||||
<if test="patientName != null and patientName != ''">
|
||||
and vr.patient_name like concat('%', #{patientName}, '%')
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
and pqsr.create_time >=#{startDate}
|
||||
</if>
|
||||
<if test="endDate != null ">
|
||||
and pqsr.create_time <= #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -209,4 +209,39 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getPhoneDialStatistic" parameterType="com.xinelu.manage.dto.statistics.FollowUpRateDto"
|
||||
resultType="com.xinelu.manage.vo.phonedialrecord.PhoneDialRecordVo">
|
||||
select record.patient_id,
|
||||
date_format(record.dial_time, '%Y-%m') as dialTimeMonth,
|
||||
record.phone_dial_method,
|
||||
record.error_code,
|
||||
patient.hospital_agency_id,
|
||||
patient.campus_agency_id,
|
||||
patient.department_id,
|
||||
patient.ward_id,
|
||||
count(record.id) as count
|
||||
from phone_dial_record record
|
||||
left join patient_info patient on patient.id = record.patient_id
|
||||
<where>
|
||||
<if test="hospitalAgencyId != null">
|
||||
and patient.hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
<if test="campusAgencyId != null">
|
||||
and patient.campus_agency_id = #{campusAgencyId}
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
and patient.department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="wardId != null">
|
||||
and patient.ward_id = #{wardId}
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
and date_format(record.dial_time,'%y%m') >= date_format(#{startDate},'%y%m')
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
and date_format(record.dial_time,'%y%m') <= date_format(#{endDate},'%y%m')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -210,4 +210,32 @@
|
||||
#{manageRouteNodeId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getStatisticNum" parameterType="com.xinelu.manage.dto.statistics.FollowUpRateDto"
|
||||
resultType="com.xinelu.manage.vo.statistics.MessageSendVo">
|
||||
select
|
||||
record.patient_id,
|
||||
date_format(record.subscribe_time, '%Y-%m') as sendTimeMonthStr
|
||||
from short_message_send_record record left join patient_info patient on patient.id = record.patient_id
|
||||
<where>
|
||||
<if test="hospitalAgencyId != null">
|
||||
and patient.hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
<if test="campusAgencyId != null">
|
||||
and patient.campus_agency_id = #{campusAgencyId}
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
and patient.department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="wardId != null">
|
||||
and patient.ward_id = #{wardId}
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
and date_format(record.send_time,'%y%m') >= date_format(#{startDate},'%y%m')
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
and date_format(record.send_time,'%y%m') <= date_format(#{endDate},'%y%m')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -245,4 +245,32 @@
|
||||
#{manageRouteNodeIds}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getStatisticNum" parameterType="com.xinelu.manage.dto.statistics.FollowUpRateDto"
|
||||
resultType="com.xinelu.manage.vo.statistics.MessageSendVo">
|
||||
select
|
||||
record.patient_id,
|
||||
date_format(record.subscribe_time, '%Y-%m') as sendTimeMonthStr
|
||||
from subscribe_message_send_record record left join patient_info patient on patient.id = record.patient_id
|
||||
<where>
|
||||
<if test="hospitalAgencyId != null">
|
||||
and patient.hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
<if test="campusAgencyId != null">
|
||||
and patient.campus_agency_id = #{campusAgencyId}
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
and patient.department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="wardId != null">
|
||||
and patient.ward_id = #{wardId}
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
and date_format(record.subscribe_time,'%y%m') >= date_format(#{startDate},'%y%m')
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
and date_format(record.subscribe_time,'%y%m') <= date_format(#{endDate},'%y%m')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user