短信、电话推送记录

This commit is contained in:
zhangheng 2026-06-23 09:47:42 +08:00
parent 06af6a860d
commit 4ec5725128
12 changed files with 131 additions and 2 deletions

View File

@ -89,4 +89,12 @@ public class PhoneDialRecordController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(phoneDialRecordService.deletePhoneDialRecordByIds(ids));
}
/**
* 电话推送统计
*/
@GetMapping("/phoneCount")
public AjaxResult phoneCount() {
return phoneDialRecordService.phoneCount();
}
}

View File

@ -89,4 +89,12 @@ public class ShortMessageSendRecordController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(shortMessageSendRecordService.deleteShortMessageSendRecordByIds(ids));
}
/**
* 短信推送统计
*/
@GetMapping("/messageCount")
public AjaxResult messageCount() {
return shortMessageSendRecordService.messageCount();
}
}

View File

@ -6,6 +6,7 @@ import com.xinelu.manage.dto.phonedialrecord.PhoneDialRecordDto;
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
import com.xinelu.manage.vo.phonedialrecord.BillPhoneDialVo;
import com.xinelu.manage.vo.phonedialrecord.PhoneDialRecordVo;
import com.xinelu.manage.vo.statistics.PushCount;
import java.util.List;
@ -105,4 +106,9 @@ public interface PhoneDialRecordMapper {
* @return BillInfoDto
*/
List<BillInfoDto> selectPhoneDialStatisticByBillId(Long billId);
/**
* 电话推送统计
*/
PushCount phoneCount();
}

View File

@ -5,6 +5,7 @@ import com.xinelu.manage.dto.billinfo.BillInfoDto;
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
import com.xinelu.manage.vo.shortmessagesendrecord.ShortMessageSendRecordVo;
import com.xinelu.manage.vo.statistics.MessageSendVo;
import com.xinelu.manage.vo.statistics.PushCount;
import com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum;
import org.apache.ibatis.annotations.Param;
@ -98,4 +99,9 @@ public interface ShortMessageSendRecordMapper {
* @return 结果
*/
int insertShortMessageSendRecords(List<ShortMessageSendRecord> shortMessageSendRecords);
/**
* 短信推送统计
*/
PushCount messageCount();
}

View File

@ -212,9 +212,9 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
if (Objects.isNull(isDistinct) || isDistinct == 1) {
list = list.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
}
List<BatchSendTaskInfo> collect = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isEmpty(item.getPatientName()) || StringUtils.isEmpty(item.getPatientPhone()) || StringUtils.isEmpty(item.getPersonnelType())).collect(Collectors.toList());
List<BatchSendTaskInfo> collect = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isEmpty(item.getPatientName()) || StringUtils.isEmpty(item.getPatientPhone()) || StringUtils.isEmpty(item.getPersonnelType()) || Objects.isNull(item.getVisitTime())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
return AjaxResult.error("用户信息不完整,姓名均不允许为空,请完善后重试;");
return AjaxResult.error("用户信息不完整,姓名、联系方式、人员类型、时间均不允许为空,请完善后重试;");
}
SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId());

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.service.phonedialrecord;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.phonedialrecord.PhoneDialRecord;
import com.xinelu.manage.vo.phonedialrecord.BillPhoneDialVo;
@ -59,4 +60,9 @@ public interface IPhoneDialRecordService {
* @return 结果
*/
int deletePhoneDialRecordById(Long id);
/**
* 电话推送统计
*/
AjaxResult phoneCount();
}

View File

@ -1,14 +1,19 @@
package com.xinelu.manage.service.phonedialrecord.impl;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.phonedialrecord.PhoneDialRecord;
import com.xinelu.manage.mapper.phonedialrecord.PhoneDialRecordMapper;
import com.xinelu.manage.service.phonedialrecord.IPhoneDialRecordService;
import com.xinelu.manage.vo.phonedialrecord.BillPhoneDialVo;
import com.xinelu.manage.vo.statistics.PushCount;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
/**
* 电话拨打记录Service业务层处理
@ -88,4 +93,19 @@ public class PhoneDialRecordServiceImpl implements IPhoneDialRecordService {
public int deletePhoneDialRecordById(Long id) {
return phoneDialRecordMapper.deletePhoneDialRecordById(id);
}
/**
* 电话推送统计
*/
@Override
public AjaxResult phoneCount() {
PushCount pushCount = phoneDialRecordMapper.phoneCount();
if (Objects.nonNull(pushCount.getTotal()) && pushCount.getTotal() != 0) {
pushCount.setSuccessRate(new BigDecimal(pushCount.getSuccess()).divide(new BigDecimal(pushCount.getTotal()), 4, RoundingMode.HALF_UP));
}
if (Objects.isNull(pushCount.getTotal()) || pushCount.getTotal() == 0){
pushCount.setSuccessRate(BigDecimal.ZERO);
}
return AjaxResult.success(pushCount);
}
}

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.service.shortmessagesendrecord;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
import com.xinelu.manage.vo.shortmessagesendrecord.ShortMessageSendRecordVo;
@ -59,4 +60,9 @@ public interface IShortMessageSendRecordService {
* @return 结果
*/
int deleteShortMessageSendRecordById(Long id);
/**
* 短信推送统计
*/
AjaxResult messageCount();
}

View File

@ -1,14 +1,19 @@
package com.xinelu.manage.service.shortmessagesendrecord.impl;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
import com.xinelu.manage.mapper.shortmessagesendrecord.ShortMessageSendRecordMapper;
import com.xinelu.manage.service.shortmessagesendrecord.IShortMessageSendRecordService;
import com.xinelu.manage.vo.shortmessagesendrecord.ShortMessageSendRecordVo;
import com.xinelu.manage.vo.statistics.PushCount;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
/**
* 短信发送结果记录Service业务层处理
@ -88,4 +93,19 @@ public class ShortMessageSendRecordServiceImpl implements IShortMessageSendRecor
public int deleteShortMessageSendRecordById(Long id) {
return shortMessageSendRecordMapper.deleteShortMessageSendRecordById(id);
}
/**
* 短信推送统计
*/
@Override
public AjaxResult messageCount() {
PushCount pushCount = shortMessageSendRecordMapper.messageCount();
if (Objects.nonNull(pushCount.getTotal()) && pushCount.getTotal() != 0) {
pushCount.setSuccessRate(new BigDecimal(pushCount.getSuccess()).divide(new BigDecimal(pushCount.getTotal()), 4, RoundingMode.HALF_UP));
}
if (Objects.isNull(pushCount.getTotal()) || pushCount.getTotal() == 0){
pushCount.setSuccessRate(BigDecimal.ZERO);
}
return AjaxResult.success(pushCount);
}
}

View File

@ -0,0 +1,34 @@
package com.xinelu.manage.vo.statistics;
import lombok.Data;
import java.math.BigDecimal;
/**
* 推送统计
*/
@Data
public class PushCount {
/**
* 推送总数
*/
private Long total;
/**
* 发送成功数量
*/
private Long success;
/**
* 发送失败数量
*/
private Long failure;
/**
* 发送成功率
*/
private BigDecimal successRate;
}

View File

@ -377,4 +377,12 @@
left join patient_info patient on patient.id = record.patient_id
where record.bill_id = #{billId}
</select>
<select id="phoneCount" resultType="com.xinelu.manage.vo.statistics.PushCount">
select count(1) as total,
(select count(1) from phone_dial_record where error_code = 0 and phone_dial_method = 'AI') as success,
(select count(1) from phone_dial_record where error_code = 1 and phone_dial_method = 'AI') as failure
from phone_dial_record record
where phone_dial_method = 'AI'
</select>
</mapper>

View File

@ -401,4 +401,11 @@
)
</foreach>
</insert>
<select id="messageCount" resultType="com.xinelu.manage.vo.statistics.PushCount">
select count(1) as total,
(select count(1) from short_message_send_record where error_code = 0) as success,
(select count(1) from short_message_send_record where error_code = 1) as failure
from short_message_send_record
</select>
</mapper>