Merge branch '0418_小程序开发' of http://182.92.166.109:3000/zhuangyuanke/PostDischargePatientManage into 0418_小程序开发
Conflicts: postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.java postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java
This commit is contained in:
commit
ec10885a85
@ -267,3 +267,10 @@ applet-page-config:
|
||||
page-url: pages/startup/startup
|
||||
# 个人中心-优惠券页面跳转路径
|
||||
propaganda-page-url: pages/propaganda/propaganda
|
||||
|
||||
#推送消息限制
|
||||
push-message-restrictions:
|
||||
#次数
|
||||
number: 1
|
||||
#时间 : 单位,天
|
||||
time: 2
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xinelu.common.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Description 新医路院后微信小程序消息参数配置类
|
||||
* @Author zh
|
||||
* @Date 2024-07-31
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "push-message-restrictions")
|
||||
public class PushMessageRestrictions {
|
||||
|
||||
private Long number;
|
||||
|
||||
private Long time;
|
||||
}
|
||||
@ -105,7 +105,7 @@ public class DepartmentController extends BaseController {
|
||||
@Log(title = "科室信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody Department department) {
|
||||
return toAjax(departmentService.insertDepartment(department));
|
||||
return departmentService.insertDepartment(department);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,7 +115,7 @@ public class DepartmentController extends BaseController {
|
||||
@Log(title = "科室信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody Department department) {
|
||||
return toAjax(departmentService.updateDepartment(department));
|
||||
return departmentService.updateDepartment(department);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -81,8 +81,8 @@ public class PatientTaskExecuteRecordController extends BaseController {
|
||||
* 根据患者信息查询就诊记录
|
||||
*/
|
||||
@GetMapping("/selectVisitRecord")
|
||||
public AjaxResult selectVisitRecord(Long id) {
|
||||
return patientTaskExecuteRecordService.selectVisitRecord(id);
|
||||
public AjaxResult selectVisitRecord(Long patientId) {
|
||||
return patientTaskExecuteRecordService.selectVisitRecord(patientId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -82,7 +82,7 @@ public class SpecialDiseaseNodeController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改专病路径-管理节点信息
|
||||
* 修改专病路径-管理节点信息(专病路径新增修改)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:specialDiseaseNode:edit')")
|
||||
@Log(title = "专病路径-管理节点信息", businessType = BusinessType.UPDATE)
|
||||
|
||||
@ -246,11 +246,18 @@ public class SpecialDiseaseNode extends BaseEntity {
|
||||
private String phoneDialMethod;
|
||||
|
||||
/**
|
||||
* AI电话模板表id
|
||||
* 话术表 ID
|
||||
*/
|
||||
@ApiModelProperty(value = "AI电话模板表id")
|
||||
@ApiModelProperty(value = "话术表 ID")
|
||||
@Excel(name = "话术表 ID")
|
||||
private Long scriptInfoId;
|
||||
|
||||
/**
|
||||
* AI电话模板id
|
||||
*/
|
||||
@ApiModelProperty(value = "AI电话模板id")
|
||||
@Excel(name = "AI电话模板表id")
|
||||
private Long phoneTemplateId;
|
||||
private String phoneTemplateId;
|
||||
|
||||
/**
|
||||
* AI电话模板名称
|
||||
|
||||
@ -101,7 +101,7 @@ public class SubscribeMessageSendRecord extends BaseEntity {
|
||||
* 推送结果状态码(0表示成功)
|
||||
*/
|
||||
@ApiModelProperty(value = "推送结果状态码")
|
||||
@Excel(name = "推送结果状态码", readConverterExp = "0=表示成功")
|
||||
@Excel(name = "推送结果状态码", readConverterExp = "0表示成功")
|
||||
private Integer errorCode;
|
||||
|
||||
/**
|
||||
|
||||
@ -145,4 +145,12 @@ public interface DepartmentMapper {
|
||||
* @return 机构信息
|
||||
*/
|
||||
List<Department> selectDepartmentByParentId(Long[] id);
|
||||
|
||||
/**
|
||||
* 根据上级机构id和科室名称查询数量
|
||||
*
|
||||
* @param department 科室
|
||||
* @return int
|
||||
*/
|
||||
List<Department> selectDepartmentNameCount(Department department);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xinelu.manage.mapper.patienttaskexecuterecord;
|
||||
|
||||
import com.xinelu.manage.domain.patienttaskexecuterecord.PatientTaskExecuteRecord;
|
||||
import com.xinelu.manage.vo.patienttaskexecuterecord.PatientTaskExecuteRecordVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -71,8 +72,8 @@ public interface PatientTaskExecuteRecordMapper {
|
||||
/**
|
||||
* 根据患者信息查询就诊记录
|
||||
*
|
||||
* @param id id
|
||||
* @param patientId id
|
||||
* @return AjaxResult
|
||||
*/
|
||||
PatientTaskExecuteRecordVO selectVisitRecord(Long id);
|
||||
PatientTaskExecuteRecordVO selectVisitRecord(@Param("patientId") Long patientId);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.xinelu.manage.mapper.shortmessagesendrecord;
|
||||
|
||||
import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
|
||||
import com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -58,4 +60,12 @@ public interface ShortMessageSendRecordMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteShortMessageSendRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 节点推送数量
|
||||
*
|
||||
* @param manageRouteNodeIds 节点id
|
||||
* @return RecordNum
|
||||
*/
|
||||
List<RecordNum> selectShortMessageRecordCountByManageRouteNodeIds(@Param("manageRouteNodeIds") List<Long> manageRouteNodeIds);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public interface SignPatientManageRouteNodeMapper {
|
||||
|
||||
/**
|
||||
* 患者详情,查询任务节点详情
|
||||
* @param manageRouteIds 路径列表
|
||||
* @param manageRouteIds 路径主键列表
|
||||
* @return 节点详细信息列表
|
||||
*/
|
||||
List<SignPatientTaskVo> selectNodeInfoByManageIds(@Param("manageRouteIds") List<Long> manageRouteIds);
|
||||
@ -142,10 +142,14 @@ public interface SignPatientManageRouteNodeMapper {
|
||||
List<TextMessage> selectMessagePushSign();
|
||||
|
||||
/**
|
||||
* 根据节点id修改状态
|
||||
* 修改执行状态
|
||||
*
|
||||
* @param ids 节点ids
|
||||
* @param manageRouteNodeIds 节点id
|
||||
* @param nodeExecuteStatus 执行状态
|
||||
* @param appletStatus 小程序发送状态
|
||||
* @param messageStatus 短信发送状态
|
||||
* @param officialStatus 公众号发送状态
|
||||
* @return int
|
||||
*/
|
||||
int updateMessageStatusByIds(@Param("ids") List<Long> ids);
|
||||
int updateNodeExecuteStatusByIds(@Param("manageRouteNodeIds") List<Long> manageRouteNodeIds, @Param("nodeExecuteStatus") String nodeExecuteStatus, @Param("appletStatus") String appletStatus, @Param("messageStatus") String messageStatus, @Param("officialStatus") String officialStatus);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.xinelu.manage.mapper.subscribemessagesendrecord;
|
||||
|
||||
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
|
||||
import com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -66,4 +68,12 @@ public interface SubscribeMessageSendRecordMapper {
|
||||
* @return int
|
||||
**/
|
||||
int insertSubscribeMessageSendRecordList(List<SubscribeMessageSendRecord> subscribeMessageSendRecordList);
|
||||
|
||||
/**
|
||||
* 节点推送数量
|
||||
*
|
||||
* @param manageRouteNodeIds 节点id
|
||||
* @return RecordNum
|
||||
*/
|
||||
List<RecordNum> selectRecordCountByManageRouteNodeIds(@Param("manageRouteNodeIds") List<Long> manageRouteNodeIds);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public interface IDepartmentService {
|
||||
* @param department 科室信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDepartment(Department department);
|
||||
AjaxResult insertDepartment(Department department);
|
||||
|
||||
/**
|
||||
* 修改科室信息
|
||||
@ -60,7 +60,7 @@ public interface IDepartmentService {
|
||||
* @param department 科室信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDepartment(Department department);
|
||||
AjaxResult updateDepartment(Department department);
|
||||
|
||||
/**
|
||||
* 批量删除科室信息
|
||||
|
||||
@ -19,18 +19,19 @@ import com.xinelu.manage.vo.department.DepartmentBaseVo;
|
||||
import com.xinelu.manage.vo.department.DepartmentListVO;
|
||||
import com.xinelu.manage.vo.department.DepartmentVO;
|
||||
import com.xinelu.system.mapper.SysUserMapper;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 科室信息Service业务层处理
|
||||
@ -46,8 +47,8 @@ public class DepartmentServiceImpl implements IDepartmentService {
|
||||
private RegexUtil regexUtil;
|
||||
@Resource
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Resource
|
||||
private AgencyMapper agencyMapper;
|
||||
@Resource
|
||||
private AgencyMapper agencyMapper;
|
||||
@Resource
|
||||
private GenerateSystemCodeUtil generateSystemCodeUtil;
|
||||
|
||||
@ -111,14 +112,28 @@ public class DepartmentServiceImpl implements IDepartmentService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDepartment(Department department) {
|
||||
public AjaxResult insertDepartment(Department department) {
|
||||
if (Objects.isNull(department.getParentDepartmentId())) {
|
||||
department.setParentDepartmentId(0L);
|
||||
}
|
||||
department.setCreateTime(LocalDateTime.now());
|
||||
department.setCreateBy(SecurityUtils.getUsername());
|
||||
//根据上级机构id查询
|
||||
List<Department> departmentList = departmentMapper.selectDepartmentNameCount(department);
|
||||
if (CollectionUtils.isNotEmpty(departmentList)) {
|
||||
//重名
|
||||
List<Department> departmentName = departmentList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getDepartmentName()) && department.getDepartmentName().equals(item.getDepartmentName())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(departmentName)) {
|
||||
return AjaxResult.error("该" + department.getHospitalAgencyName() + "下,已存在名称为" + department.getDepartmentName() + "的科室!");
|
||||
}
|
||||
//重编号
|
||||
List<Department> departmentCode = departmentList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getDepartmentCode()) && department.getDepartmentCode().equals(item.getDepartmentName())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(departmentCode)) {
|
||||
return AjaxResult.error("该" + department.getHospitalAgencyName() + "下,已存在科室编号为" + department.getDepartmentName() + "的科室!");
|
||||
}
|
||||
}
|
||||
//department.setDepartmentCode(Constants.DEPARTMENT_CODE + generateSystemCodeUtil.generateSystemCode(Constants.DEPARTMENT_CODE));
|
||||
return departmentMapper.insertDepartment(department);
|
||||
return AjaxResult.success(departmentMapper.insertDepartment(department));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,13 +143,28 @@ public class DepartmentServiceImpl implements IDepartmentService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDepartment(Department department) {
|
||||
public AjaxResult updateDepartment(Department department) {
|
||||
//上级科室是自己本身,取消上级科室
|
||||
if (Objects.nonNull(department) && Objects.nonNull(department.getId()) && Objects.nonNull(department.getParentDepartmentId()) && department.getId().equals(department.getParentDepartmentId())) {
|
||||
department.setParentDepartmentId(null);
|
||||
}
|
||||
//根据上级机构id查询
|
||||
List<Department> departmentList = departmentMapper.selectDepartmentNameCount(department);
|
||||
if (CollectionUtils.isNotEmpty(departmentList)) {
|
||||
//重名
|
||||
List<Department> departmentName = departmentList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getDepartmentName()) && department.getDepartmentName().equals(item.getDepartmentName()) && !department.getId().equals(item.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(departmentName)) {
|
||||
return AjaxResult.error("该" + department.getHospitalAgencyName() + "下,已存在名称为" + department.getDepartmentName() + "的科室!");
|
||||
}
|
||||
//重编号
|
||||
List<Department> departmentCode = departmentList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getDepartmentCode()) && department.getDepartmentCode().equals(item.getDepartmentName()) && !department.getId().equals(item.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(departmentCode)) {
|
||||
return AjaxResult.error("该" + department.getHospitalAgencyName() + "下,已存在科室编号为" + department.getDepartmentName() + "的科室!");
|
||||
}
|
||||
}
|
||||
department.setUpdateBy(SecurityUtils.getUsername());
|
||||
department.setUpdateTime(LocalDateTime.now());
|
||||
return departmentMapper.updateDepartmentById(department);
|
||||
return AjaxResult.success(departmentMapper.updateDepartmentById(department));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -245,9 +275,9 @@ public class DepartmentServiceImpl implements IDepartmentService {
|
||||
return AjaxResult.error("当前科室电话:" + department.getDepartmentPhone() + " 格式不正确,请重新录入!");
|
||||
}
|
||||
List<String> departmentName = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getDepartmentName())).map(Department::getDepartmentName).distinct().collect(Collectors.toList());
|
||||
//根据名称查询护理站基本信息
|
||||
//根据名称查询科室基本信息
|
||||
List<Department> allDepartment = departmentMapper.getAllDepartmentInfo(departmentName);
|
||||
//做差集,去除数据库中已经存在的护理站信息
|
||||
//做差集,去除数据库中已经存在的科室信息
|
||||
List<Department> subtractList = new ArrayList<>(CollectionUtils.subtract(importDataList, allDepartment));
|
||||
if (CollectionUtils.isEmpty(subtractList)) {
|
||||
return AjaxResult.success();
|
||||
@ -279,9 +309,9 @@ public class DepartmentServiceImpl implements IDepartmentService {
|
||||
@DataScope(agencyAlias = "d", deptAlias = "sp")
|
||||
@Override
|
||||
public DepartmentBaseVo selectListServicePackageNum(DepartmentDTO departmentDto) {
|
||||
Agency agency = agencyMapper.selectAgencyById(departmentDto.getHospitalAgencyId());
|
||||
List<DepartmentVO> departmentVOList = departmentMapper.selectListServicePackageNum(departmentDto);
|
||||
return DepartmentBaseVo.builder().hospitalAgencyName(ObjectUtils.isEmpty(agency) ? "" : agency.getAgencyName())
|
||||
.deptNumList(departmentVOList).build();
|
||||
Agency agency = agencyMapper.selectAgencyById(departmentDto.getHospitalAgencyId());
|
||||
List<DepartmentVO> departmentVOList = departmentMapper.selectListServicePackageNum(departmentDto);
|
||||
return DepartmentBaseVo.builder().hospitalAgencyName(ObjectUtils.isEmpty(agency) ? "" : agency.getAgencyName())
|
||||
.deptNumList(departmentVOList).build();
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,10 +64,10 @@ public interface IPatientTaskExecuteRecordService {
|
||||
/**
|
||||
* 根据患者信息查询就诊记录
|
||||
*
|
||||
* @param id 记录id
|
||||
* @param patientId 患者id
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult selectVisitRecord(Long id);
|
||||
AjaxResult selectVisitRecord(Long patientId);
|
||||
|
||||
/**
|
||||
* 根据任务执行记录查询患者问卷信息
|
||||
|
||||
@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 患者管理任务执行记录Service业务层处理
|
||||
@ -99,13 +100,18 @@ public class PatientTaskExecuteRecordServiceImpl implements IPatientTaskExecuteR
|
||||
/**
|
||||
* 根据患者信息查询就诊记录
|
||||
*
|
||||
* @param id id
|
||||
* @param patientId id
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult selectVisitRecord(Long id) {
|
||||
PatientTaskExecuteRecordVO patientTaskExecuteRecordVO = patientTaskExecuteRecordMapper.selectVisitRecord(id);
|
||||
patientTaskExecuteRecordVO.setAge(AgeUtil.getAgeMonth(patientTaskExecuteRecordVO.getBirthDate().toString()));
|
||||
public AjaxResult selectVisitRecord(Long patientId) {
|
||||
if (Objects.isNull(patientId)) {
|
||||
return AjaxResult.error("请选择要查询的信息!");
|
||||
}
|
||||
PatientTaskExecuteRecordVO patientTaskExecuteRecordVO = patientTaskExecuteRecordMapper.selectVisitRecord(patientId);
|
||||
if (Objects.nonNull(patientTaskExecuteRecordVO) && Objects.nonNull(patientTaskExecuteRecordVO.getBirthDate())) {
|
||||
patientTaskExecuteRecordVO.setAge(AgeUtil.getAgeMonth(patientTaskExecuteRecordVO.getBirthDate().toString()));
|
||||
}
|
||||
return AjaxResult.success(patientTaskExecuteRecordVO);
|
||||
}
|
||||
|
||||
|
||||
@ -273,10 +273,10 @@ public class PatientVisitRecordServiceImpl implements IPatientVisitRecordService
|
||||
PatientInfo patientInfo = patientMapper.selectPatientInfoById(updDto.getPatientId());
|
||||
// 修改患者信息
|
||||
patientInfo.setVisitMethod(updDto.getVisitMethod());
|
||||
patientInfo.setDepartmentId(updDto.getDepartmentId());
|
||||
patientInfo.setDepartmentName(updDto.getDepartmentName());
|
||||
patientInfo.setAdmissionTime(updDto.getAdmissionTime());
|
||||
patientInfo.setDischargeTime(updDto.getDischargeTime());
|
||||
patientInfo.setDepartmentId(updDto.getDepartmentId());
|
||||
patientInfo.setDepartmentName(updDto.getDepartmentName());
|
||||
patientInfo.setAdmissionTime(updDto.getAdmissionTime());
|
||||
patientInfo.setDischargeTime(updDto.getDischargeTime());
|
||||
setPatientType(patientInfo, patientVisitRecord);
|
||||
patientInfoService.updatePatientInfo(patientInfo);
|
||||
}
|
||||
|
||||
@ -309,13 +309,16 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
@Override
|
||||
@DataScope(agencyAlias = "pi", deptAlias = "pi")
|
||||
public List<ManualFollowUpVO> selectManualFollowUpList(ManualFollowUpDTO manualFollowUpDTO) {
|
||||
if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.UNEXECUTED.getInfo())){
|
||||
if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.UNEXECUTED.getInfo())) {
|
||||
manualFollowUpDTO.setPhoneNodeExecuteResultStatus(null);
|
||||
}
|
||||
List<ManualFollowUpVO> manualFollowUpVOS = signPatientManageRouteMapper.selectManualFollowUpList(manualFollowUpDTO);
|
||||
if (StringUtils.isNotBlank(manualFollowUpDTO.getTimeSign()) && manualFollowUpDTO.getTimeSign().equals("WHOLE")) {
|
||||
return manualFollowUpVOS;
|
||||
}
|
||||
if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.EXECUTED.getInfo())) {
|
||||
return manualFollowUpVOS;
|
||||
}
|
||||
ArrayList<ManualFollowUpVO> manualFollowUps = new ArrayList<>();
|
||||
for (ManualFollowUpVO manualFollowUpVO : manualFollowUpVOS) {
|
||||
//判断路径节点,组装数据
|
||||
@ -693,9 +696,9 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
break;
|
||||
// 话术
|
||||
case TaskNodeTypeConstants.PHONE_OUTBOUND:
|
||||
manageRouteNode.setPhoneId(node.getPhoneTemplateId());
|
||||
manageRouteNode.setPhoneId(node.getScriptInfoId());
|
||||
// 查询话术
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(node.getPhoneTemplateId());
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(node.getScriptInfoId());
|
||||
if (ObjectUtils.isNotEmpty(scriptInfo)) {
|
||||
// 话术库json内容替换
|
||||
manageRouteNode.setPhoneNodeContent(signPatientManageRouteNodeService.getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
|
||||
|
||||
@ -1127,9 +1127,9 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
break;
|
||||
// 话术
|
||||
case TaskNodeTypeConstants.PHONE_OUTBOUND:
|
||||
manageRouteNode.setPhoneId(node.getPhoneTemplateId());
|
||||
manageRouteNode.setPhoneId(node.getScriptInfoId());
|
||||
// 查询话术
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(node.getPhoneTemplateId());
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(node.getScriptInfoId());
|
||||
if (ObjectUtils.isNotEmpty(scriptInfo)) {
|
||||
// 话术库json内容替换
|
||||
manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
|
||||
|
||||
@ -342,9 +342,9 @@ public class SpecialDiseaseRouteServiceImpl implements ISpecialDiseaseRouteServi
|
||||
break;
|
||||
// 话术
|
||||
case TaskNodeTypeConstants.PHONE_OUTBOUND:
|
||||
manageRouteNode.setPhoneId(node.getPhoneTemplateId());
|
||||
manageRouteNode.setPhoneId(node.getScriptInfoId());
|
||||
// 查询话术
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(node.getPhoneTemplateId());
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(node.getScriptInfoId());
|
||||
if (ObjectUtils.isNotEmpty(scriptInfo)) {
|
||||
// 话术库json内容替换
|
||||
manageRouteNode.setPhoneNodeContent(scriptInfo.getFlowScheme());
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xinelu.manage.vo.subscribemessagesendrecord;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 微信小程序订阅消息发送结果记录数量
|
||||
*
|
||||
* @author zh
|
||||
* @date 2024-07-31
|
||||
*/
|
||||
@Data
|
||||
public class RecordNum {
|
||||
|
||||
/*
|
||||
*推送数量
|
||||
*/
|
||||
private Long num;
|
||||
|
||||
/**
|
||||
* 节点id
|
||||
*/
|
||||
private Long manageRouteNodeId;
|
||||
}
|
||||
@ -496,76 +496,76 @@
|
||||
update department
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="parentDepartmentId != null">parent_department_id =
|
||||
#{parentDepartmentId},
|
||||
#{parentDepartmentId},
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">hospital_agency_id =
|
||||
#{hospitalAgencyId},
|
||||
#{hospitalAgencyId},
|
||||
</if>
|
||||
<if test="hospitalAgencyName != null">hospital_agency_name =
|
||||
#{hospitalAgencyName},
|
||||
#{hospitalAgencyName},
|
||||
</if>
|
||||
<if test="departmentName != null">department_name =
|
||||
#{departmentName},
|
||||
#{departmentName},
|
||||
</if>
|
||||
<if test="departmentCode != null">department_code =
|
||||
#{departmentCode},
|
||||
#{departmentCode},
|
||||
</if>
|
||||
<if test="departmentType != null">department_type =
|
||||
#{departmentType},
|
||||
#{departmentType},
|
||||
</if>
|
||||
<if test="departmentAbbreviation != null">department_abbreviation =
|
||||
#{departmentAbbreviation},
|
||||
#{departmentAbbreviation},
|
||||
</if>
|
||||
<if test="departmentPersonId != null">department_person_id =
|
||||
#{departmentPersonId},
|
||||
#{departmentPersonId},
|
||||
</if>
|
||||
<if test="departmentPersonName != null">department_person_name =
|
||||
#{departmentPersonName},
|
||||
#{departmentPersonName},
|
||||
</if>
|
||||
<if test="nodeType != null">node_type =
|
||||
#{nodeType},
|
||||
#{nodeType},
|
||||
</if>
|
||||
<if test="provideServiceCategory != null">provide_service_category =
|
||||
#{provideServiceCategory},
|
||||
#{provideServiceCategory},
|
||||
</if>
|
||||
<if test="subdivisionCategoryId != null">subdivision_category_id =
|
||||
#{subdivisionCategoryId},
|
||||
#{subdivisionCategoryId},
|
||||
</if>
|
||||
<if test="subdivisionCategoryName != null">subdivision_category_name =
|
||||
#{subdivisionCategoryName},
|
||||
#{subdivisionCategoryName},
|
||||
</if>
|
||||
<if test="normDepartmentCompareId != null">norm_department_compare_id =
|
||||
#{normDepartmentCompareId},
|
||||
#{normDepartmentCompareId},
|
||||
</if>
|
||||
<if test="normDepartmentCompareName != null">norm_department_compare_name =
|
||||
#{normDepartmentCompareName},
|
||||
#{normDepartmentCompareName},
|
||||
</if>
|
||||
<if test="prepareBedsCount != null">prepare_beds_count =
|
||||
#{prepareBedsCount},
|
||||
#{prepareBedsCount},
|
||||
</if>
|
||||
<if test="departmentPhone != null">department_phone =
|
||||
#{departmentPhone},
|
||||
#{departmentPhone},
|
||||
</if>
|
||||
<if test="departmentMail != null">department_mail =
|
||||
#{departmentMail},
|
||||
#{departmentMail},
|
||||
</if>
|
||||
<if test="establishDate != null">establish_date =
|
||||
#{establishDate},
|
||||
#{establishDate},
|
||||
</if>
|
||||
<if test="revokeDate != null">revoke_date =
|
||||
#{revokeDate},
|
||||
#{revokeDate},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">update_by =
|
||||
#{updateBy},
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">update_time =
|
||||
#{updateTime},
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
@ -624,4 +624,13 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectDepartmentNameCount" resultType="com.xinelu.manage.domain.department.Department" resultMap="DepartmentResult">
|
||||
<include refid="selectDepartmentVo"/>
|
||||
<where>
|
||||
<if test="hospitalAgencyId != null ">
|
||||
and hospital_agency_id =#{hospitalAgencyId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -313,10 +313,9 @@
|
||||
ri.card_no,
|
||||
ri.sex,
|
||||
ri.address
|
||||
FROM patient_task_execute_record pter
|
||||
LEFT JOIN patient_visit_record pvr ON pter.visit_record_id = pvr.id
|
||||
LEFT JOIN patient_info pi ON pi.id = pter.patient_id
|
||||
FROM patient_info pi
|
||||
LEFT JOIN patient_visit_record pvr ON pvr.id = pi.patient_visit_record_id
|
||||
LEFT JOIN resident_info ri ON ri.id = pi.resident_id
|
||||
where pter.id = #{id}
|
||||
where pi.id = #{patientId}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -198,4 +198,16 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectShortMessageRecordCountByManageRouteNodeIds"
|
||||
resultType="com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum">
|
||||
select
|
||||
manage_route_node_id,
|
||||
COUNT(1) num
|
||||
from short_message_send_record
|
||||
where manage_route_node_id IN
|
||||
<foreach item="manageRouteNodeId" collection="manageRouteNodeId" open="(" separator="," close=")">
|
||||
#{manageRouteNodeId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -889,14 +889,28 @@
|
||||
where spmrn.message_push_sign = 1
|
||||
and spmrn.del_flag = 0
|
||||
and spmrn.node_execute_status = 'UNEXECUTED'
|
||||
and (spmrn.message_node_execute_result_status is null or spmrn.message_node_execute_result_status = ' ')
|
||||
</select>
|
||||
|
||||
<update id="updateMessageStatusByIds">
|
||||
<update id="updateNodeExecuteStatusByIds">
|
||||
update sign_patient_manage_route_node
|
||||
set message_status = 'EXECUTED'
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="nodeExecuteStatus != null">node_execute_status =
|
||||
#{nodeExecuteStatus},
|
||||
</if>
|
||||
<if test="appletStatus != null">applet_node_execute_result_status =
|
||||
#{appletStatus},
|
||||
</if>
|
||||
<if test="messageStatus != null">message_node_execute_result_status =
|
||||
#{messageStatus},
|
||||
</if>
|
||||
<if test="officialStatus != null">official_node_execute_result_status =
|
||||
#{officialStatus},
|
||||
</if>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach item="ids" collection="ids" open="(" separator="," close=")">
|
||||
#{ids}
|
||||
<foreach item="manageRouteNodeIds" collection="manageRouteNodeIds" open="(" separator="," close=")">
|
||||
#{manageRouteNodeIds}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
@ -75,6 +75,7 @@
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="scriptInfoId" column="script_info_id"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO" id="SpecialDiseaseNodeVOResult">
|
||||
@ -128,6 +129,7 @@
|
||||
<result property="taskStatusName" column="taskStatusName"/>
|
||||
<result property="nodeContent" column="node_content"/>
|
||||
<result property="flowScheme" column="flowScheme"/>
|
||||
<result property="scriptInfoId" column="script_info_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSpecialDiseaseNodeVo">
|
||||
@ -180,7 +182,8 @@
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
update_time,
|
||||
script_info_id
|
||||
from special_disease_node
|
||||
</sql>
|
||||
|
||||
@ -316,6 +319,9 @@
|
||||
<if test="nodeContent != null and nodeContent != ''">
|
||||
and node_content = #{nodeContent}
|
||||
</if>
|
||||
<if test="scriptInfoId != null and scriptInfoId != ''">
|
||||
and script_info_id = #{scriptInfoId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectSpeciaDiseaseNodeVoList" parameterType="SpecialDiseaseNode" resultMap="SpecialDiseaseNodeVOResult">
|
||||
@ -439,6 +445,8 @@
|
||||
</if>
|
||||
<if test="phoneDialMethod != null">phone_dial_method,
|
||||
</if>
|
||||
<if test="scriptInfoId != null">script_info_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="routeId != null">#{routeId},
|
||||
@ -539,6 +547,8 @@
|
||||
</if>
|
||||
<if test="phoneDialMethod != null ">#{phoneDialMethod}
|
||||
</if>
|
||||
<if test="scriptInfoId != null ">#{scriptInfoId}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -692,6 +702,9 @@
|
||||
<if test="phoneDialMethod != null ">phone_dial_method =
|
||||
#{phoneDialMethod},
|
||||
</if>
|
||||
<if test="scriptInfoId != null ">script_info_id =
|
||||
#{scriptInfoId},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -758,7 +771,8 @@
|
||||
node_content,
|
||||
create_by,
|
||||
create_time,
|
||||
phone_dial_method
|
||||
phone_dial_method,
|
||||
script_info_id
|
||||
) values
|
||||
<foreach item="specialDiseaseNodeList" index="index" collection="list" separator=",">
|
||||
(
|
||||
@ -809,7 +823,8 @@
|
||||
#{specialDiseaseNodeList.nodeContent},
|
||||
#{specialDiseaseNodeList.createBy},
|
||||
#{specialDiseaseNodeList.createTime},
|
||||
#{specialDiseaseNodeList.phoneDialMethod}
|
||||
#{specialDiseaseNodeList.phoneDialMethod},
|
||||
#{specialDiseaseNodeList.scriptInfoId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
@ -880,6 +895,7 @@
|
||||
sdn.route_check_remark,
|
||||
sdn.node_content,
|
||||
sdn.phone_dial_method,
|
||||
sdn.script_info_id,
|
||||
(select flow_scheme from script_info where id = sdn.phone_template_id) flowScheme,
|
||||
(select COUNT(1)
|
||||
from special_disease_node
|
||||
|
||||
@ -231,4 +231,16 @@
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectRecordCountByManageRouteNodeIds"
|
||||
resultType="com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum">
|
||||
select
|
||||
manage_route_node_id,
|
||||
COUNT(1) num
|
||||
from subscribe_message_send_record
|
||||
where manage_route_node_id IN
|
||||
<foreach item="manageRouteNodeIds" collection="manageRouteNodeIds" open="(" separator="," close=")">
|
||||
#{manageRouteNodeIds}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -119,4 +119,12 @@ public class HomePageController extends BaseController {
|
||||
public AjaxResult nodeExecuteStatus(Long manageRouteNodeId) {
|
||||
return homePageService.nodeExecuteStatus(manageRouteNodeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存宣教文章查看时间
|
||||
*/
|
||||
@PostMapping("/viewPropaganda")
|
||||
public AjaxResult viewPropaganda(Long manageRouteNodeId) {
|
||||
return homePageService.viewPropaganda(manageRouteNodeId);
|
||||
}
|
||||
}
|
||||
@ -60,14 +60,6 @@ public interface HomePageMapper {
|
||||
*/
|
||||
List<PatientVO> selectSignPatientManageRouteNode(@Param("patientId") List<Long> patientId);
|
||||
|
||||
/**
|
||||
* 修改执行状态
|
||||
*
|
||||
* @param signPatientManageRouteNodeIds 节点id
|
||||
* @return int
|
||||
*/
|
||||
int updateNodeExecuteStatusByIds(@Param("signPatientManageRouteNodeIds") List<Long> signPatientManageRouteNodeIds, @Param("nodeExecuteStatus") String nodeExecuteStatus, @Param("appletNodeExecuteResultStatus") String appletNodeExecuteResultStatus);
|
||||
|
||||
/**
|
||||
* 查询个人任务消息
|
||||
*
|
||||
|
||||
@ -105,4 +105,12 @@ public interface HomePageService {
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult nodeExecuteStatus(Long manageRouteNodeId);
|
||||
|
||||
/**
|
||||
* 保存宣教文章查看时间
|
||||
*
|
||||
* @param manageRouteNodeId 节点id
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult viewPropaganda(Long manageRouteNodeId);
|
||||
}
|
||||
@ -209,7 +209,8 @@ public class HomePageServiceImpl implements HomePageService {
|
||||
patientQuestionSubmitResult.setCreateTime(time);
|
||||
// 新增患者问卷提交结果
|
||||
if (patientQuestionSubmitResultMapper.insertPatientQuestionSubmitResult(patientQuestionSubmitResult) <= 0) {
|
||||
throw new ServiceException("新增患者问卷提交结果失败");
|
||||
log.info("新增任务记录表失败");
|
||||
throw new ServiceException("问卷提交失败!");
|
||||
}
|
||||
// 获取到患者问卷题目提交结果信息DTO
|
||||
List<PatientQuestionSubjectResultDTO> subjectResultList = dto.getSubjectResultDTOList();
|
||||
@ -229,7 +230,8 @@ public class HomePageServiceImpl implements HomePageService {
|
||||
}
|
||||
// 新增患者问卷题目提交结果
|
||||
if (patientQuestionSubjectResultMapper.saveQuestionSubjectList(patientQuestionSubjectResults) < 0) {
|
||||
throw new ServiceException("新增患者问卷题目提交结果失败");
|
||||
log.info("新增患者问卷题目提交结果失败");
|
||||
throw new ServiceException("问卷提交失败");
|
||||
}
|
||||
if (CollectionUtils.isEmpty(patientQuestionOptionResults)) {
|
||||
return AjaxResult.success();
|
||||
@ -247,7 +249,17 @@ public class HomePageServiceImpl implements HomePageService {
|
||||
}
|
||||
// 新增患者问卷题目选项提交结果
|
||||
if (patientQuestionOptionResultMapper.saveQuestionOptionList(saveQuestionSubjectOptions) < 0) {
|
||||
throw new ServiceException("新增患者问卷题目选项提交结果失败");
|
||||
log.info("新增患者问卷题目选项提交结果失败");
|
||||
throw new ServiceException("问卷提交失败");
|
||||
}
|
||||
SignPatientManageRouteNode signPatientManageRouteNode = new SignPatientManageRouteNode();
|
||||
signPatientManageRouteNode.setId(dto.getManageRouteNodeId());
|
||||
signPatientManageRouteNode.setRouteCheckDate(time);
|
||||
signPatientManageRouteNode.setRouteHandleId(dto.getPatientId());
|
||||
signPatientManageRouteNode.setRouteHandlePerson(dto.getRouteHandlePerson());
|
||||
if (signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(signPatientManageRouteNode) < 0) {
|
||||
log.info("修改签约患者管理任务路径节点表失败");
|
||||
throw new ServiceException("问卷提交失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@ -400,4 +412,19 @@ public class HomePageServiceImpl implements HomePageService {
|
||||
}
|
||||
return AjaxResult.success(nodeExecuteStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存宣教文章查看时间
|
||||
*
|
||||
* @param manageRouteNodeId 节点id
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult viewPropaganda(Long manageRouteNodeId) {
|
||||
SignPatientManageRouteNode signPatientManageRouteNode = new SignPatientManageRouteNode();
|
||||
signPatientManageRouteNode.setId(manageRouteNodeId);
|
||||
signPatientManageRouteNode.setNodeFinishDate(LocalDateTime.now());
|
||||
signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(signPatientManageRouteNode);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
@ -62,4 +62,6 @@ public class MessageTabulationVO {
|
||||
* 模版名称
|
||||
*/
|
||||
private String manageRouteNodeName;
|
||||
|
||||
private String nodeFinishDate;
|
||||
}
|
||||
|
||||
@ -86,7 +86,8 @@
|
||||
LEFT JOIN patient_question_submit_result pqsr on spmrn.id = pqsr.manage_route_node_id
|
||||
WHERE qi.question_type = #{questionType}
|
||||
AND qi.questionnaire_status = #{questionnaireStatus}
|
||||
and pi.resident_id = #{residentId}
|
||||
AND pi.resident_id = #{residentId}
|
||||
AND spmrn.node_execute_status = 'EXECUTED'
|
||||
ORDER BY pqsr.create_time DESC, spmrn.create_time DESC
|
||||
</select>
|
||||
|
||||
@ -147,17 +148,6 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="updateNodeExecuteStatusByIds">
|
||||
update sign_patient_manage_route_node
|
||||
set node_execute_status = #{nodeExecuteStatus},
|
||||
applet_node_execute_result_status = #{appletNodeExecuteResultStatus}
|
||||
where id in
|
||||
<foreach item="signPatientManageRouteNodeIds" collection="signPatientManageRouteNodeIds" open="(" separator=","
|
||||
close=")">
|
||||
#{signPatientManageRouteNodeIds}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="selectManageRouteByResidentId"
|
||||
resultType="com.xinelu.mobile.vo.homepage.MessageTabulationVO">
|
||||
select spmrn.id manageRouteNodeId,
|
||||
@ -169,6 +159,7 @@
|
||||
IF(pter.id is NULL, 0, 1) sign,
|
||||
pter.id patientTaskExecuteRecordId,
|
||||
spmrn.task_node_type,
|
||||
spmrn.node_finish_date,
|
||||
CASE
|
||||
WHEN spmrn.task_node_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.questionnaire_name
|
||||
WHEN spmrn.task_node_type = 'PROPAGANDA_ARTICLE' THEN spmrn.propaganda_title
|
||||
@ -180,6 +171,8 @@
|
||||
LEFT JOIN patient_task_execute_record pter ON pter.manage_route_node_id = spmrn.id
|
||||
where pi.resident_id = #{residentId}
|
||||
and spmrn.node_execute_status = #{nodeExecuteStatus}
|
||||
and spmrn.applet_node_execute_result_status = 'SUCCESS'
|
||||
and spmrn.applet_push_sign = 1
|
||||
and spmrn.del_flag = 0
|
||||
and pi.del_flag = 0
|
||||
and (spmrn.task_node_type = 'PROPAGANDA_ARTICLE' or spmrn.task_node_type = 'TEXT_REMIND' or
|
||||
@ -191,13 +184,15 @@
|
||||
resultType="com.xinelu.manage.domain.patienttaskexecuterecord.PatientTaskExecuteRecord">
|
||||
select spmr.patient_id,
|
||||
spmr.patient_name,
|
||||
spmr.id manageRouteId,
|
||||
spmrn.id manageRouteNodeId,
|
||||
spmrn.manage_route_name manageRouteName,
|
||||
spmrn.route_node_name manageRouteNodeName,
|
||||
spmrn.task_node_type taskNodeType
|
||||
spmr.id manageRouteId,
|
||||
spmrn.id manageRouteNodeId,
|
||||
spmrn.manage_route_name manageRouteName,
|
||||
spmrn.route_node_name manageRouteNodeName,
|
||||
spmrn.task_node_type taskNodeType,
|
||||
pi.patient_visit_record_id visitRecordId
|
||||
from sign_patient_manage_route_node spmrn
|
||||
LEFT JOIN sign_patient_manage_route spmr ON spmr.id = spmrn.manage_route_id
|
||||
LEFT JOIN patient_info pi ON pi.id = spmr.patient_id
|
||||
where spmrn.id = #{manageRouteNodeId}
|
||||
</select>
|
||||
|
||||
|
||||
@ -2,10 +2,17 @@ package com.xinelu.quartz.service.impl;
|
||||
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.xinelu.common.config.AliYunSmsTwoConfig;
|
||||
import com.xinelu.common.config.PushMessageRestrictions;
|
||||
import com.xinelu.common.enums.ErrorStatusEnum;
|
||||
import com.xinelu.common.enums.NodeExecuteResultStatusEnum;
|
||||
import com.xinelu.common.enums.NodeExecuteStatusEnum;
|
||||
import com.xinelu.common.enums.RouteNodeNameEnum;
|
||||
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
|
||||
import com.xinelu.manage.dto.smssend.SmsInfoDTO;
|
||||
import com.xinelu.manage.mapper.shortmessagesendrecord.ShortMessageSendRecordMapper;
|
||||
import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper;
|
||||
import com.xinelu.manage.vo.signpatientmanageroutenode.TextMessage;
|
||||
import com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum;
|
||||
import com.xinelu.mobile.utils.SmsSendUtils;
|
||||
import com.xinelu.quartz.service.SendTextMessageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -15,9 +22,11 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description 短信发送定时任务业务层
|
||||
@ -34,6 +43,10 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
|
||||
private SmsSendUtils smsSendUtils;
|
||||
@Resource
|
||||
private AliYunSmsTwoConfig aliYunSmsTwoConfig;
|
||||
@Resource
|
||||
private PushMessageRestrictions pushMessageRestrictions;
|
||||
@Resource
|
||||
private ShortMessageSendRecordMapper shortMessageSendRecordMapper;
|
||||
|
||||
/**
|
||||
* 签约患者管理任务路径节点短信发送定时任务
|
||||
@ -44,7 +57,13 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
|
||||
public void sendTextMessageSendTask() throws ClientException {
|
||||
//查询短信发送数据
|
||||
List<TextMessage> textMessages = signPatientManageRouteNodeMapper.selectMessagePushSign();
|
||||
if (CollectionUtils.isEmpty(textMessages)) {
|
||||
return;
|
||||
}
|
||||
//条件过滤后短信信息
|
||||
List<TextMessage> messages = new ArrayList<>();
|
||||
//超时短信ids
|
||||
List<Long> expiredManageRouteNodeIds = new ArrayList<>();
|
||||
for (TextMessage textMessage : textMessages) {
|
||||
//判断推送状态
|
||||
if (Objects.isNull(textMessage.getMessagePushSign()) || textMessage.getMessagePushSign() != 1) {
|
||||
@ -70,10 +89,20 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
|
||||
}
|
||||
boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now());
|
||||
if (before) {
|
||||
//超出7天,更改状态
|
||||
long until = localDate.until(LocalDate.now(), ChronoUnit.DAYS);
|
||||
if (until >= pushMessageRestrictions.getTime()) {
|
||||
expiredManageRouteNodeIds.add(textMessage.getSignPatientManageRouteNodeId());
|
||||
continue;
|
||||
}
|
||||
textMessage.setRouteNodeName(RouteNodeNameEnum.getNameByInfo(textMessage.getRouteNodeName()).getName());
|
||||
messages.add(textMessage);
|
||||
}
|
||||
}
|
||||
//更改过期执行状态
|
||||
if (CollectionUtils.isNotEmpty(expiredManageRouteNodeIds)) {
|
||||
signPatientManageRouteNodeMapper.updateNodeExecuteStatusByIds(expiredManageRouteNodeIds, NodeExecuteStatusEnum.EXECUTED.getInfo(), null, NodeExecuteResultStatusEnum.EXPIRED.getInfo(), null);
|
||||
}
|
||||
|
||||
//判断路径节点,组装数据
|
||||
// if (textMessage.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_DISCHARGE.getInfo()) || textMessage.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_VISIT_DISCHARGE.getInfo())) {
|
||||
@ -107,7 +136,12 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//节点推送数量
|
||||
List<Long> collect = messages.stream().filter(Objects::nonNull).map(TextMessage::getSignPatientManageRouteNodeId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
List<RecordNum> recordNums = shortMessageSendRecordMapper.selectShortMessageRecordCountByManageRouteNodeIds(collect);
|
||||
//发送
|
||||
//发送失败ids
|
||||
List<Long> failSignPatientManageRouteNodeIds = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(messages)) {
|
||||
List<Long> ids = new ArrayList<>();
|
||||
for (TextMessage message : messages) {
|
||||
@ -117,13 +151,30 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
|
||||
// 根据模版id发送
|
||||
smsInfoDTO.setTemplateCode(message.getTextMessageId());
|
||||
Boolean aBoolean = smsSendUtils.sendTextMessage(smsInfoDTO);
|
||||
SubscribeMessageSendRecord subscribeMessageSendRecord = new SubscribeMessageSendRecord();
|
||||
//成功
|
||||
if (aBoolean) {
|
||||
ids.add(message.getSignPatientManageRouteNodeId());
|
||||
subscribeMessageSendRecord.setErrorCode(0);
|
||||
subscribeMessageSendRecord.setErrorStatus(ErrorStatusEnum.success.getValue());
|
||||
} else {
|
||||
//失败
|
||||
subscribeMessageSendRecord.setErrorCode(1);
|
||||
subscribeMessageSendRecord.setErrorStatus(ErrorStatusEnum.fail.getValue());
|
||||
RecordNum recordNum = recordNums.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getManageRouteNodeId()) && item.getManageRouteNodeId().equals(message.getSignPatientManageRouteNodeId())).findFirst().orElse(new RecordNum());
|
||||
//三次失败
|
||||
if (Objects.nonNull(recordNum.getNum()) && recordNum.getNum() >= pushMessageRestrictions.getNumber()) {
|
||||
failSignPatientManageRouteNodeIds.add(message.getSignPatientManageRouteNodeId());
|
||||
}
|
||||
}
|
||||
}
|
||||
//修改节点状态
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
signPatientManageRouteNodeMapper.updateMessageStatusByIds(ids);
|
||||
if (CollectionUtils.isNotEmpty(expiredManageRouteNodeIds)) {
|
||||
signPatientManageRouteNodeMapper.updateNodeExecuteStatusByIds(ids, NodeExecuteStatusEnum.EXECUTED.getInfo(), null, NodeExecuteResultStatusEnum.SUCCESS.getInfo(), null);
|
||||
}
|
||||
//修改节点状态
|
||||
if (CollectionUtils.isNotEmpty(expiredManageRouteNodeIds)) {
|
||||
signPatientManageRouteNodeMapper.updateNodeExecuteStatusByIds(failSignPatientManageRouteNodeIds, NodeExecuteStatusEnum.EXECUTED.getInfo(), null, NodeExecuteResultStatusEnum.FAILURE.getInfo(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
package com.xinelu.quartz.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.xinelu.common.config.PushMessageRestrictions;
|
||||
import com.xinelu.common.config.WeChatAppletChatConfig;
|
||||
import com.xinelu.common.enums.*;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
|
||||
import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper;
|
||||
import com.xinelu.manage.mapper.subscribemessagesendrecord.SubscribeMessageSendRecordMapper;
|
||||
import com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum;
|
||||
import com.xinelu.mobile.domain.TemplateContent;
|
||||
import com.xinelu.mobile.mapper.homepage.HomePageMapper;
|
||||
import com.xinelu.mobile.utils.WeChatOfficialAccountUtils;
|
||||
@ -18,6 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -40,6 +44,10 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
|
||||
private WeChatOfficialAccountUtils weChatOfficialAccountUtils;
|
||||
@Resource
|
||||
private SubscribeMessageSendRecordMapper subscribeMessageSendRecordMapper;
|
||||
@Resource
|
||||
private PushMessageRestrictions pushMessageRestrictions;
|
||||
@Resource
|
||||
private SignPatientManageRouteNodeMapper signPatientManageRouteNodeMapper;
|
||||
|
||||
/**
|
||||
* 推送任务组装数据
|
||||
@ -53,6 +61,9 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
|
||||
}
|
||||
// 患者节点表
|
||||
List<PatientVO> signPatientManageRouteNodes = homePageMapper.selectSignPatientManageRouteNode(patientIdList);
|
||||
if (CollectionUtils.isEmpty(signPatientManageRouteNodes)) {
|
||||
return;
|
||||
}
|
||||
// 注:PatientVO 包含签约路径节点相关属性,后面用于推送消息
|
||||
List<PatientVO> patientVOList = new ArrayList<>();
|
||||
//发送消息到期节点id集合
|
||||
@ -76,8 +87,8 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
|
||||
}
|
||||
boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now());
|
||||
if (before) {
|
||||
int i = LocalDate.now().compareTo(localDate);
|
||||
if (i >= 1) {
|
||||
long until =localDate.until(LocalDate.now(), ChronoUnit.DAYS);
|
||||
if (until >= pushMessageRestrictions.getTime()) {
|
||||
expiredManageRouteNodeIds.add(patientVO.getSignPatientManageRouteNodeId());
|
||||
continue;
|
||||
}
|
||||
@ -89,7 +100,7 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
|
||||
}
|
||||
//更改过期执行状态
|
||||
if (CollectionUtils.isNotEmpty(expiredManageRouteNodeIds)) {
|
||||
homePageMapper.updateNodeExecuteStatusByIds(expiredManageRouteNodeIds, NodeExecuteStatusEnum.EXECUTED.getInfo(), NodeExecuteResultStatusEnum.EXPIRED.getInfo());
|
||||
signPatientManageRouteNodeMapper.updateNodeExecuteStatusByIds(expiredManageRouteNodeIds, NodeExecuteStatusEnum.EXECUTED.getInfo(), NodeExecuteResultStatusEnum.EXPIRED.getInfo(), null, null);
|
||||
}
|
||||
|
||||
// //如果节点 适用范围是 出院后或就诊/出院后
|
||||
@ -112,6 +123,7 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
|
||||
// PatientVO patientVO = patientList.stream().filter(Objects::nonNull).filter(item -> signPatientManageRouteNode.getPatientId().equals(item.getPatientId())).findFirst().orElse(new PatientVO());
|
||||
// //患者类型如果是 在院患者
|
||||
// if (patientVO.getPatientType().equals(PatientTypeEnum.IN_HOSPITAL_PATIENT.getInfo())) {
|
||||
// if (patientVO.getPatientType().equals(PatientTypeEnum.IN_HOSPITAL_PATIENT.getInfo())) {
|
||||
// //入院时间
|
||||
// LocalDate localDate = patientVO.getAdmissionTime().plusDays(signPatientManageRouteNode.getRouteNodeDay());
|
||||
// boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now());
|
||||
@ -137,11 +149,19 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//发送
|
||||
//发送失败id集合
|
||||
if (CollectionUtils.isEmpty(patientVOList)) {
|
||||
return;
|
||||
}
|
||||
//节点推送数量
|
||||
List<Long> collect = patientVOList.stream().filter(Objects::nonNull).map(PatientVO::getSignPatientManageRouteNodeId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
List<RecordNum> recordNums = subscribeMessageSendRecordMapper.selectRecordCountByManageRouteNodeIds(collect);
|
||||
//发送成功id集合
|
||||
List<Long> signPatientManageRouteNodeIds = new ArrayList<>();
|
||||
//发送失败
|
||||
List<Long> failSignPatientManageRouteNodeIds = new ArrayList<>();
|
||||
for (PatientVO patientVO : patientVOList) {
|
||||
try {
|
||||
//判断推送内容格式是否符合
|
||||
JSON.parseArray(patientVO.getAppletNodeContent(), TemplateContent.class);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
@ -149,13 +169,18 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
|
||||
// 开始推送消息
|
||||
Integer integer = weChatOfficialAccountUtils.sendAppletTemplateMessage(patientVO);
|
||||
SubscribeMessageSendRecord subscribeMessageSendRecord = new SubscribeMessageSendRecord();
|
||||
//推送结果
|
||||
if (integer == 0) {
|
||||
signPatientManageRouteNodeIds.add(patientVO.getSignPatientManageRouteNodeId());
|
||||
subscribeMessageSendRecord.setErrorCode(0);
|
||||
subscribeMessageSendRecord.setErrorStatus(ErrorStatusEnum.success.getValue());
|
||||
} else {
|
||||
subscribeMessageSendRecord.setErrorCode(1);
|
||||
subscribeMessageSendRecord.setErrorCode(integer);
|
||||
subscribeMessageSendRecord.setErrorStatus(ErrorStatusEnum.fail.getValue());
|
||||
RecordNum recordNum = recordNums.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getManageRouteNodeId()) && item.getManageRouteNodeId().equals(patientVO.getSignPatientManageRouteNodeId())).findFirst().orElse(new RecordNum());
|
||||
if (Objects.nonNull(recordNum.getNum()) && recordNum.getNum() >= pushMessageRestrictions.getNumber()) {
|
||||
failSignPatientManageRouteNodeIds.add(patientVO.getSignPatientManageRouteNodeId());
|
||||
}
|
||||
}
|
||||
subscribeMessageSendRecord.setPatientId(patientVO.getPatientId());
|
||||
subscribeMessageSendRecord.setManageRouteNodeId(patientVO.getSignPatientManageRouteNodeId());
|
||||
@ -169,7 +194,11 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
|
||||
}
|
||||
//更改成功执行状态
|
||||
if (CollectionUtils.isNotEmpty(signPatientManageRouteNodeIds)) {
|
||||
homePageMapper.updateNodeExecuteStatusByIds(signPatientManageRouteNodeIds, NodeExecuteStatusEnum.EXECUTED.getInfo(), NodeExecuteResultStatusEnum.SUCCESS.getInfo());
|
||||
signPatientManageRouteNodeMapper.updateNodeExecuteStatusByIds(signPatientManageRouteNodeIds, NodeExecuteStatusEnum.EXECUTED.getInfo(), NodeExecuteResultStatusEnum.SUCCESS.getInfo(), null, null);
|
||||
}
|
||||
//更改失败执行状态
|
||||
if (CollectionUtils.isNotEmpty(failSignPatientManageRouteNodeIds)) {
|
||||
signPatientManageRouteNodeMapper.updateNodeExecuteStatusByIds(failSignPatientManageRouteNodeIds, NodeExecuteStatusEnum.EXECUTED.getInfo(), NodeExecuteResultStatusEnum.FAILURE.getInfo(), null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user