From 87175fac69a1a6baca26e7d3c56f29f1e6d387be Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Fri, 1 Nov 2024 11:25:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=9F=A5=E8=AF=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...PatientQuestionSubmitResultController.java | 26 ++- .../statistics/StatisticsController.java | 47 +++++ .../PatientQuestionSubmitStatistisDto.java | 3 + .../dto/statistics/FollowUpRateDto.java | 62 ++++++ .../PhoneDialRecordMapper.java | 5 +- .../ShortMessageSendRecordMapper.java | 4 + .../SubscribeMessageSendRecordMapper.java | 7 +- ...atientQuestionSubmitResultServiceImpl.java | 3 + .../statistics/IStatisticsService.java | 33 +++ .../impl/StatisticsServiceImpl.java | 192 ++++++++++++++++++ .../vo/phonedialrecord/PhoneDialRecordVo.java | 64 ++++++ .../vo/statistics/FollowUpDetailVo.java | 56 +++++ .../vo/statistics/FollowUpNumTrendVo.java | 44 ++++ .../vo/statistics/FollowUpRateTrendVo.java | 46 +++++ .../manage/vo/statistics/FollowUpRateVo.java | 101 +++++++++ .../manage/vo/statistics/MessageSendVo.java | 25 +++ .../PatientQuestionSubmitResultMapper.xml | 42 ++-- .../phonedialrecord/PhoneDialRecordMapper.xml | 35 ++++ .../ShortMessageSendRecordMapper.xml | 28 +++ .../SubscribeMessageSendRecordMapper.xml | 28 +++ 20 files changed, 822 insertions(+), 29 deletions(-) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/controller/statistics/StatisticsController.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/dto/statistics/FollowUpRateDto.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/statistics/IStatisticsService.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/statistics/impl/StatisticsServiceImpl.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/phonedialrecord/PhoneDialRecordVo.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpDetailVo.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpNumTrendVo.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpRateTrendVo.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpRateVo.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/MessageSendVo.java diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/patientquestionsubmitresult/PatientQuestionSubmitResultController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/patientquestionsubmitresult/PatientQuestionSubmitResultController.java index 22444314..58ec9bfb 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/patientquestionsubmitresult/PatientQuestionSubmitResultController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/patientquestionsubmitresult/PatientQuestionSubmitResultController.java @@ -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> patientQuestionSubmitList(PatientQuestionSubmitStatistisDto queryDto) { - return R.ok(patientQuestionSubmitResultService.patientQuestionSubmitList(queryDto)); + public TableDataInfo patientQuestionSubmitList(PatientQuestionSubmitStatistisDto queryDto) { + startPage(); + List list = patientQuestionSubmitResultService.patientQuestionSubmitList(queryDto); + return getDataTable(list); } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/statistics/StatisticsController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/statistics/StatisticsController.java new file mode 100644 index 00000000..7378c003 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/statistics/StatisticsController.java @@ -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 getFollowUpRate(FollowUpRateDto queryDto) { + return R.ok(statisticsService.getFollowUpRate(queryDto)); + } + + /** + * 随访明细表查询 + */ + @ApiOperation("随访明细表查询") + @GetMapping("/getFollowUpDetail") + public R> getFollowUpDetail(FollowUpRateDto queryDto) { + return R.ok(statisticsService.getFollowUpDetail(queryDto)); + } +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/patientquestionsubmitresult/PatientQuestionSubmitStatistisDto.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/patientquestionsubmitresult/PatientQuestionSubmitStatistisDto.java index cc523631..8dbf6535 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/patientquestionsubmitresult/PatientQuestionSubmitStatistisDto.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/patientquestionsubmitresult/PatientQuestionSubmitStatistisDto.java @@ -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; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/statistics/FollowUpRateDto.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/statistics/FollowUpRateDto.java new file mode 100644 index 00000000..e814f29b --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/statistics/FollowUpRateDto.java @@ -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; + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/phonedialrecord/PhoneDialRecordMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/phonedialrecord/PhoneDialRecordMapper.java index 6f1fbe4b..57fc173b 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/phonedialrecord/PhoneDialRecordMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/phonedialrecord/PhoneDialRecordMapper.java @@ -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 getPhoneDialStatistic(FollowUpRateDto queryDto); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/shortmessagesendrecord/ShortMessageSendRecordMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/shortmessagesendrecord/ShortMessageSendRecordMapper.java index 024b52b3..74e67ebc 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/shortmessagesendrecord/ShortMessageSendRecordMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/shortmessagesendrecord/ShortMessageSendRecordMapper.java @@ -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 selectShortMessageRecordCountByManageRouteNodeIds(@Param("manageRouteNodeIds") List manageRouteNodeIds); + + List getStatisticNum(FollowUpRateDto queryDto); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/subscribemessagesendrecord/SubscribeMessageSendRecordMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/subscribemessagesendrecord/SubscribeMessageSendRecordMapper.java index 3cce61e1..589dd31b 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/subscribemessagesendrecord/SubscribeMessageSendRecordMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/subscribemessagesendrecord/SubscribeMessageSendRecordMapper.java @@ -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 selectRecordCountByManageRouteNodeIds(@Param("manageRouteNodeIds") List manageRouteNodeIds); + + List getStatisticNum(FollowUpRateDto queryDto); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientquestionsubmitresult/impl/PatientQuestionSubmitResultServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientquestionsubmitresult/impl/PatientQuestionSubmitResultServiceImpl.java index bbc33fa6..f9640d0c 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientquestionsubmitresult/impl/PatientQuestionSubmitResultServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientquestionsubmitresult/impl/PatientQuestionSubmitResultServiceImpl.java @@ -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; /** * 查询患者问卷提交结果信息 diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/statistics/IStatisticsService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/statistics/IStatisticsService.java new file mode 100644 index 00000000..b8a68038 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/statistics/IStatisticsService.java @@ -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 getFollowUpDetail(FollowUpRateDto queryDto); +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/statistics/impl/StatisticsServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/statistics/impl/StatisticsServiceImpl.java new file mode 100644 index 00000000..4af6aacb --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/statistics/impl/StatisticsServiceImpl.java @@ -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 phoneDialRecordVoList = phoneDialRecordMapper.getPhoneDialStatistic(queryDto); + // 统计AI电话拨打次数、AI电话拨打次数成功率、AI拨打人数、AI拨打人数成功率、人工电话拨打次数、人工电话拨打次数成功率、人工拨打人数、人工拨打人数成功率 + retObj = getFollowUpRateVo(phoneDialRecordVoList); + // 电话拨打总人数 + retObj.setSumPatientNum(retObj.getAiPatientNum() + retObj.getCommonPatientNum()); + // 短信发送数量 + List messageSendList = shortMessageSendRecordMapper.getStatisticNum(queryDto); + if (CollectionUtils.isNotEmpty(messageSendList)) { + retObj.setSmsNum(messageSendList.size()); + } + + // 小程序推送数量 + List subscribeRecordList = subscribeMessageSendRecordMapper.getStatisticNum(queryDto); + if (CollectionUtils.isNotEmpty(subscribeRecordList)) { + retObj.setSubscribeNum(subscribeRecordList.size()); + } + + // 数据趋势图 + List rateTrendVoList = new ArrayList<>(); + List numTrendVoList = new ArrayList<>(); + + Map> groupByDialTime = phoneDialRecordVoList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(PhoneDialRecordVo::getDialTimeMonth)); + + Map> megGroupBySendTime = messageSendList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(MessageSendVo::getSendTimeMonthStr)); + Map> subGroupBySendTime = subscribeRecordList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(MessageSendVo::getSendTimeMonthStr)); + + // 横坐标日期 + List 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 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 megList = megGroupBySendTime.get(month); + numTrendVo.setSmsNum(CollectionUtils.isEmpty(megList) ? 0 : megList.size()); + // 小程序发送数量 + List 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 getFollowUpDetail(FollowUpRateDto queryDto) { + return null; + } + + /** + * @description 统计AI电话拨打次数、AI电话拨打次数成功率、AI拨打人数、AI拨打人数成功率、人工电话拨打次数、人工电话拨打次数成功率、人工拨打人数、人工拨打人数成功率 + * @Param 拨打电话记录列表 + * @return 随访成功率查询返回视图类 + * @Author haown + * @Date 2024-11-1 9:31 + */ + private FollowUpRateVo getFollowUpRateVo(List phoneDialRecordVoList) { + FollowUpRateVo retObj = new FollowUpRateVo(); + if (CollectionUtils.isEmpty(phoneDialRecordVoList)) { + return retObj; + } + // 按照拨打方式分组 + Map> groupByDialMethod = phoneDialRecordVoList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(PhoneDialRecordVo::getPhoneDialMethod)); + List aiDialList = groupByDialMethod.get(PhoneDialMethodEnum.AI.getInfo()); + List commonDialList = groupByDialMethod.get(PhoneDialMethodEnum.COMMON.getInfo()); + if (CollectionUtils.isNotEmpty(aiDialList)) { + // 筛选成功数量 + List 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> groupByPatient = aiDialList.stream().collect(Collectors.groupingBy(PhoneDialRecordVo::getPatientId)); + retObj.setAiPatientNum(groupByPatient.keySet().size()); + // AI拨打人数成功率 + if (CollectionUtils.isNotEmpty(aiSuccessList)) { + Map> 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 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> groupByPatient = commonDialList.stream().collect(Collectors.groupingBy(PhoneDialRecordVo::getPatientId)); + retObj.setAiPatientNum(groupByPatient.keySet().size()); + // 人工拨打人数成功率 + if (CollectionUtils.isNotEmpty(commonSuccessList)) { + Map> 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; + } + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/phonedialrecord/PhoneDialRecordVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/phonedialrecord/PhoneDialRecordVo.java new file mode 100644 index 00000000..f69aeb8a --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/phonedialrecord/PhoneDialRecordVo.java @@ -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; + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpDetailVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpDetailVo.java new file mode 100644 index 00000000..970030b6 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpDetailVo.java @@ -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 childerenList; + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpNumTrendVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpNumTrendVo.java new file mode 100644 index 00000000..ed2baf5c --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpNumTrendVo.java @@ -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; +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpRateTrendVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpRateTrendVo.java new file mode 100644 index 00000000..5d5bd23d --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpRateTrendVo.java @@ -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; + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpRateVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpRateVo.java new file mode 100644 index 00000000..cd5491f1 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/FollowUpRateVo.java @@ -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 rateTrendVoList; + + /** + * 推送数量趋势图 + */ + @ApiModelProperty("推送数量趋势图") + List numTrendVoList; +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/MessageSendVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/MessageSendVo.java new file mode 100644 index 00000000..4cc9c4c6 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/statistics/MessageSendVo.java @@ -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; + +} diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientquestionsubmitresult/PatientQuestionSubmitResultMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientquestionsubmitresult/PatientQuestionSubmitResultMapper.xml index f7351a93..6e541f98 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientquestionsubmitresult/PatientQuestionSubmitResultMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientquestionsubmitresult/PatientQuestionSubmitResultMapper.xml @@ -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 and dt.hospital_agency_id = #{hospitalAgencyId} - and dt.department_id = #{departmentId} - - - and dt.department_name like concat('%',#{departmentName},'%') + and dt.id = #{departmentId} 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 - - and pqsr.question_info_id = #{questionInfoId} - - - and vr.patient_name like concat('%', #{patientName}, '%') - - - and pqsr.create_time >=#{startDate} - - - and pqsr.create_time <= #{endDate} - + + + and vr.hospital_agency_id = #{hospitalAgencyId} + + + and vr.department_id = #{departmentId} + + + and pqsr.question_info_id = #{questionInfoId} + + + and vr.patient_name like concat('%', #{patientName}, '%') + + + and pqsr.create_time >=#{startDate} + + + and pqsr.create_time <= #{endDate} + + \ No newline at end of file diff --git a/postdischarge-manage/src/main/resources/mapper/manage/phonedialrecord/PhoneDialRecordMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/phonedialrecord/PhoneDialRecordMapper.xml index 5852699c..8e9f3741 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/phonedialrecord/PhoneDialRecordMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/phonedialrecord/PhoneDialRecordMapper.xml @@ -209,4 +209,39 @@ #{id} + + \ No newline at end of file diff --git a/postdischarge-manage/src/main/resources/mapper/manage/shortmessagesendrecord/ShortMessageSendRecordMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/shortmessagesendrecord/ShortMessageSendRecordMapper.xml index 4904777b..90a8d333 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/shortmessagesendrecord/ShortMessageSendRecordMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/shortmessagesendrecord/ShortMessageSendRecordMapper.xml @@ -210,4 +210,32 @@ #{manageRouteNodeId} + + \ No newline at end of file diff --git a/postdischarge-manage/src/main/resources/mapper/manage/subscribemessagesendrecord/SubscribeMessageSendRecordMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/subscribemessagesendrecord/SubscribeMessageSendRecordMapper.xml index 517a6506..1afea11d 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/subscribemessagesendrecord/SubscribeMessageSendRecordMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/subscribemessagesendrecord/SubscribeMessageSendRecordMapper.xml @@ -245,4 +245,32 @@ #{manageRouteNodeIds} + + \ No newline at end of file