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:
haown 2024-08-02 13:52:48 +08:00
commit ec10885a85
35 changed files with 427 additions and 124 deletions

View File

@ -267,3 +267,10 @@ applet-page-config:
page-url: pages/startup/startup page-url: pages/startup/startup
# 个人中心-优惠券页面跳转路径 # 个人中心-优惠券页面跳转路径
propaganda-page-url: pages/propaganda/propaganda propaganda-page-url: pages/propaganda/propaganda
#推送消息限制
push-message-restrictions:
#次数
number: 1
#时间 单位,天
time: 2

View File

@ -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;
}

View File

@ -105,7 +105,7 @@ public class DepartmentController extends BaseController {
@Log(title = "科室信息", businessType = BusinessType.INSERT) @Log(title = "科室信息", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
public AjaxResult add(@RequestBody Department department) { 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) @Log(title = "科室信息", businessType = BusinessType.UPDATE)
@PutMapping("/edit") @PutMapping("/edit")
public AjaxResult edit(@RequestBody Department department) { public AjaxResult edit(@RequestBody Department department) {
return toAjax(departmentService.updateDepartment(department)); return departmentService.updateDepartment(department);
} }
/** /**

View File

@ -81,8 +81,8 @@ public class PatientTaskExecuteRecordController extends BaseController {
* 根据患者信息查询就诊记录 * 根据患者信息查询就诊记录
*/ */
@GetMapping("/selectVisitRecord") @GetMapping("/selectVisitRecord")
public AjaxResult selectVisitRecord(Long id) { public AjaxResult selectVisitRecord(Long patientId) {
return patientTaskExecuteRecordService.selectVisitRecord(id); return patientTaskExecuteRecordService.selectVisitRecord(patientId);
} }
/** /**

View File

@ -82,7 +82,7 @@ public class SpecialDiseaseNodeController extends BaseController {
} }
/** /**
* 修改专病路径-管理节点信息 * 修改专病路径-管理节点信息(专病路径新增修改)
*/ */
@PreAuthorize("@ss.hasPermi('system:specialDiseaseNode:edit')") @PreAuthorize("@ss.hasPermi('system:specialDiseaseNode:edit')")
@Log(title = "专病路径-管理节点信息", businessType = BusinessType.UPDATE) @Log(title = "专病路径-管理节点信息", businessType = BusinessType.UPDATE)

View File

@ -246,11 +246,18 @@ public class SpecialDiseaseNode extends BaseEntity {
private String phoneDialMethod; 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") @Excel(name = "AI电话模板表id")
private Long phoneTemplateId; private String phoneTemplateId;
/** /**
* AI电话模板名称 * AI电话模板名称

View File

@ -101,7 +101,7 @@ public class SubscribeMessageSendRecord extends BaseEntity {
* 推送结果状态码0表示成功 * 推送结果状态码0表示成功
*/ */
@ApiModelProperty(value = "推送结果状态码") @ApiModelProperty(value = "推送结果状态码")
@Excel(name = "推送结果状态码", readConverterExp = "0=表示成功") @Excel(name = "推送结果状态码", readConverterExp = "0表示成功")
private Integer errorCode; private Integer errorCode;
/** /**

View File

@ -145,4 +145,12 @@ public interface DepartmentMapper {
* @return 机构信息 * @return 机构信息
*/ */
List<Department> selectDepartmentByParentId(Long[] id); List<Department> selectDepartmentByParentId(Long[] id);
/**
* 根据上级机构id和科室名称查询数量
*
* @param department 科室
* @return int
*/
List<Department> selectDepartmentNameCount(Department department);
} }

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.mapper.patienttaskexecuterecord;
import com.xinelu.manage.domain.patienttaskexecuterecord.PatientTaskExecuteRecord; import com.xinelu.manage.domain.patienttaskexecuterecord.PatientTaskExecuteRecord;
import com.xinelu.manage.vo.patienttaskexecuterecord.PatientTaskExecuteRecordVO; import com.xinelu.manage.vo.patienttaskexecuterecord.PatientTaskExecuteRecordVO;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -71,8 +72,8 @@ public interface PatientTaskExecuteRecordMapper {
/** /**
* 根据患者信息查询就诊记录 * 根据患者信息查询就诊记录
* *
* @param id id * @param patientId id
* @return AjaxResult * @return AjaxResult
*/ */
PatientTaskExecuteRecordVO selectVisitRecord(Long id); PatientTaskExecuteRecordVO selectVisitRecord(@Param("patientId") Long patientId);
} }

View File

@ -1,6 +1,8 @@
package com.xinelu.manage.mapper.shortmessagesendrecord; package com.xinelu.manage.mapper.shortmessagesendrecord;
import com.xinelu.manage.domain.shortmessagesendrecord.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; import java.util.List;
@ -58,4 +60,12 @@ public interface ShortMessageSendRecordMapper {
* @return 结果 * @return 结果
*/ */
int deleteShortMessageSendRecordByIds(Long[] ids); int deleteShortMessageSendRecordByIds(Long[] ids);
/**
* 节点推送数量
*
* @param manageRouteNodeIds 节点id
* @return RecordNum
*/
List<RecordNum> selectShortMessageRecordCountByManageRouteNodeIds(@Param("manageRouteNodeIds") List<Long> manageRouteNodeIds);
} }

View File

@ -114,7 +114,7 @@ public interface SignPatientManageRouteNodeMapper {
/** /**
* 患者详情查询任务节点详情 * 患者详情查询任务节点详情
* @param manageRouteIds 路径列表 * @param manageRouteIds 路径主键列表
* @return 节点详细信息列表 * @return 节点详细信息列表
*/ */
List<SignPatientTaskVo> selectNodeInfoByManageIds(@Param("manageRouteIds") List<Long> manageRouteIds); List<SignPatientTaskVo> selectNodeInfoByManageIds(@Param("manageRouteIds") List<Long> manageRouteIds);
@ -142,10 +142,14 @@ public interface SignPatientManageRouteNodeMapper {
List<TextMessage> selectMessagePushSign(); List<TextMessage> selectMessagePushSign();
/** /**
* 根据节点id修改状态 * 修改执行状态
* *
* @param ids 节点ids * @param manageRouteNodeIds 节点id
* @param nodeExecuteStatus 执行状态
* @param appletStatus 小程序发送状态
* @param messageStatus 短信发送状态
* @param officialStatus 公众号发送状态
* @return int * @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);
} }

View File

@ -1,6 +1,8 @@
package com.xinelu.manage.mapper.subscribemessagesendrecord; package com.xinelu.manage.mapper.subscribemessagesendrecord;
import com.xinelu.manage.domain.subscribemessagesendrecord.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; import java.util.List;
@ -66,4 +68,12 @@ public interface SubscribeMessageSendRecordMapper {
* @return int * @return int
**/ **/
int insertSubscribeMessageSendRecordList(List<SubscribeMessageSendRecord> subscribeMessageSendRecordList); int insertSubscribeMessageSendRecordList(List<SubscribeMessageSendRecord> subscribeMessageSendRecordList);
/**
* 节点推送数量
*
* @param manageRouteNodeIds 节点id
* @return RecordNum
*/
List<RecordNum> selectRecordCountByManageRouteNodeIds(@Param("manageRouteNodeIds") List<Long> manageRouteNodeIds);
} }

View File

@ -52,7 +52,7 @@ public interface IDepartmentService {
* @param department 科室信息 * @param department 科室信息
* @return 结果 * @return 结果
*/ */
int insertDepartment(Department department); AjaxResult insertDepartment(Department department);
/** /**
* 修改科室信息 * 修改科室信息
@ -60,7 +60,7 @@ public interface IDepartmentService {
* @param department 科室信息 * @param department 科室信息
* @return 结果 * @return 结果
*/ */
int updateDepartment(Department department); AjaxResult updateDepartment(Department department);
/** /**
* 批量删除科室信息 * 批量删除科室信息

View File

@ -19,18 +19,19 @@ import com.xinelu.manage.vo.department.DepartmentBaseVo;
import com.xinelu.manage.vo.department.DepartmentListVO; import com.xinelu.manage.vo.department.DepartmentListVO;
import com.xinelu.manage.vo.department.DepartmentVO; import com.xinelu.manage.vo.department.DepartmentVO;
import com.xinelu.system.mapper.SysUserMapper; 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.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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业务层处理 * 科室信息Service业务层处理
@ -46,8 +47,8 @@ public class DepartmentServiceImpl implements IDepartmentService {
private RegexUtil regexUtil; private RegexUtil regexUtil;
@Resource @Resource
private SysUserMapper sysUserMapper; private SysUserMapper sysUserMapper;
@Resource @Resource
private AgencyMapper agencyMapper; private AgencyMapper agencyMapper;
@Resource @Resource
private GenerateSystemCodeUtil generateSystemCodeUtil; private GenerateSystemCodeUtil generateSystemCodeUtil;
@ -111,14 +112,28 @@ public class DepartmentServiceImpl implements IDepartmentService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertDepartment(Department department) { public AjaxResult insertDepartment(Department department) {
if (Objects.isNull(department.getParentDepartmentId())) { if (Objects.isNull(department.getParentDepartmentId())) {
department.setParentDepartmentId(0L); department.setParentDepartmentId(0L);
} }
department.setCreateTime(LocalDateTime.now()); department.setCreateTime(LocalDateTime.now());
department.setCreateBy(SecurityUtils.getUsername()); 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)); //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 结果 * @return 结果
*/ */
@Override @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())) { if (Objects.nonNull(department) && Objects.nonNull(department.getId()) && Objects.nonNull(department.getParentDepartmentId()) && department.getId().equals(department.getParentDepartmentId())) {
department.setParentDepartmentId(null); 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.setUpdateBy(SecurityUtils.getUsername());
department.setUpdateTime(LocalDateTime.now()); 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() + " 格式不正确,请重新录入!"); return AjaxResult.error("当前科室电话:" + department.getDepartmentPhone() + " 格式不正确,请重新录入!");
} }
List<String> departmentName = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getDepartmentName())).map(Department::getDepartmentName).distinct().collect(Collectors.toList()); 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> allDepartment = departmentMapper.getAllDepartmentInfo(departmentName);
//做差集去除数据库中已经存在的护理站信息 //做差集去除数据库中已经存在的科室信息
List<Department> subtractList = new ArrayList<>(CollectionUtils.subtract(importDataList, allDepartment)); List<Department> subtractList = new ArrayList<>(CollectionUtils.subtract(importDataList, allDepartment));
if (CollectionUtils.isEmpty(subtractList)) { if (CollectionUtils.isEmpty(subtractList)) {
return AjaxResult.success(); return AjaxResult.success();
@ -279,9 +309,9 @@ public class DepartmentServiceImpl implements IDepartmentService {
@DataScope(agencyAlias = "d", deptAlias = "sp") @DataScope(agencyAlias = "d", deptAlias = "sp")
@Override @Override
public DepartmentBaseVo selectListServicePackageNum(DepartmentDTO departmentDto) { public DepartmentBaseVo selectListServicePackageNum(DepartmentDTO departmentDto) {
Agency agency = agencyMapper.selectAgencyById(departmentDto.getHospitalAgencyId()); Agency agency = agencyMapper.selectAgencyById(departmentDto.getHospitalAgencyId());
List<DepartmentVO> departmentVOList = departmentMapper.selectListServicePackageNum(departmentDto); List<DepartmentVO> departmentVOList = departmentMapper.selectListServicePackageNum(departmentDto);
return DepartmentBaseVo.builder().hospitalAgencyName(ObjectUtils.isEmpty(agency) ? "" : agency.getAgencyName()) return DepartmentBaseVo.builder().hospitalAgencyName(ObjectUtils.isEmpty(agency) ? "" : agency.getAgencyName())
.deptNumList(departmentVOList).build(); .deptNumList(departmentVOList).build();
} }
} }

View File

@ -64,10 +64,10 @@ public interface IPatientTaskExecuteRecordService {
/** /**
* 根据患者信息查询就诊记录 * 根据患者信息查询就诊记录
* *
* @param id 记录id * @param patientId 患者id
* @return AjaxResult * @return AjaxResult
*/ */
AjaxResult selectVisitRecord(Long id); AjaxResult selectVisitRecord(Long patientId);
/** /**
* 根据任务执行记录查询患者问卷信息 * 根据任务执行记录查询患者问卷信息

View File

@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 患者管理任务执行记录Service业务层处理 * 患者管理任务执行记录Service业务层处理
@ -99,13 +100,18 @@ public class PatientTaskExecuteRecordServiceImpl implements IPatientTaskExecuteR
/** /**
* 根据患者信息查询就诊记录 * 根据患者信息查询就诊记录
* *
* @param id id * @param patientId id
* @return AjaxResult * @return AjaxResult
*/ */
@Override @Override
public AjaxResult selectVisitRecord(Long id) { public AjaxResult selectVisitRecord(Long patientId) {
PatientTaskExecuteRecordVO patientTaskExecuteRecordVO = patientTaskExecuteRecordMapper.selectVisitRecord(id); if (Objects.isNull(patientId)) {
patientTaskExecuteRecordVO.setAge(AgeUtil.getAgeMonth(patientTaskExecuteRecordVO.getBirthDate().toString())); 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); return AjaxResult.success(patientTaskExecuteRecordVO);
} }

View File

@ -273,10 +273,10 @@ public class PatientVisitRecordServiceImpl implements IPatientVisitRecordService
PatientInfo patientInfo = patientMapper.selectPatientInfoById(updDto.getPatientId()); PatientInfo patientInfo = patientMapper.selectPatientInfoById(updDto.getPatientId());
// 修改患者信息 // 修改患者信息
patientInfo.setVisitMethod(updDto.getVisitMethod()); patientInfo.setVisitMethod(updDto.getVisitMethod());
patientInfo.setDepartmentId(updDto.getDepartmentId()); patientInfo.setDepartmentId(updDto.getDepartmentId());
patientInfo.setDepartmentName(updDto.getDepartmentName()); patientInfo.setDepartmentName(updDto.getDepartmentName());
patientInfo.setAdmissionTime(updDto.getAdmissionTime()); patientInfo.setAdmissionTime(updDto.getAdmissionTime());
patientInfo.setDischargeTime(updDto.getDischargeTime()); patientInfo.setDischargeTime(updDto.getDischargeTime());
setPatientType(patientInfo, patientVisitRecord); setPatientType(patientInfo, patientVisitRecord);
patientInfoService.updatePatientInfo(patientInfo); patientInfoService.updatePatientInfo(patientInfo);
} }

View File

@ -309,13 +309,16 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
@Override @Override
@DataScope(agencyAlias = "pi", deptAlias = "pi") @DataScope(agencyAlias = "pi", deptAlias = "pi")
public List<ManualFollowUpVO> selectManualFollowUpList(ManualFollowUpDTO manualFollowUpDTO) { public List<ManualFollowUpVO> selectManualFollowUpList(ManualFollowUpDTO manualFollowUpDTO) {
if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.UNEXECUTED.getInfo())){ if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.UNEXECUTED.getInfo())) {
manualFollowUpDTO.setPhoneNodeExecuteResultStatus(null); manualFollowUpDTO.setPhoneNodeExecuteResultStatus(null);
} }
List<ManualFollowUpVO> manualFollowUpVOS = signPatientManageRouteMapper.selectManualFollowUpList(manualFollowUpDTO); List<ManualFollowUpVO> manualFollowUpVOS = signPatientManageRouteMapper.selectManualFollowUpList(manualFollowUpDTO);
if (StringUtils.isNotBlank(manualFollowUpDTO.getTimeSign()) && manualFollowUpDTO.getTimeSign().equals("WHOLE")) { if (StringUtils.isNotBlank(manualFollowUpDTO.getTimeSign()) && manualFollowUpDTO.getTimeSign().equals("WHOLE")) {
return manualFollowUpVOS; return manualFollowUpVOS;
} }
if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.EXECUTED.getInfo())) {
return manualFollowUpVOS;
}
ArrayList<ManualFollowUpVO> manualFollowUps = new ArrayList<>(); ArrayList<ManualFollowUpVO> manualFollowUps = new ArrayList<>();
for (ManualFollowUpVO manualFollowUpVO : manualFollowUpVOS) { for (ManualFollowUpVO manualFollowUpVO : manualFollowUpVOS) {
//判断路径节点组装数据 //判断路径节点组装数据
@ -693,9 +696,9 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
break; break;
// 话术 // 话术
case TaskNodeTypeConstants.PHONE_OUTBOUND: 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)) { if (ObjectUtils.isNotEmpty(scriptInfo)) {
// 话术库json内容替换 // 话术库json内容替换
manageRouteNode.setPhoneNodeContent(signPatientManageRouteNodeService.getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList)); manageRouteNode.setPhoneNodeContent(signPatientManageRouteNodeService.getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));

View File

@ -1127,9 +1127,9 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
break; break;
// 话术 // 话术
case TaskNodeTypeConstants.PHONE_OUTBOUND: 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)) { if (ObjectUtils.isNotEmpty(scriptInfo)) {
// 话术库json内容替换 // 话术库json内容替换
manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList)); manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));

View File

@ -342,9 +342,9 @@ public class SpecialDiseaseRouteServiceImpl implements ISpecialDiseaseRouteServi
break; break;
// 话术 // 话术
case TaskNodeTypeConstants.PHONE_OUTBOUND: 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)) { if (ObjectUtils.isNotEmpty(scriptInfo)) {
// 话术库json内容替换 // 话术库json内容替换
manageRouteNode.setPhoneNodeContent(scriptInfo.getFlowScheme()); manageRouteNode.setPhoneNodeContent(scriptInfo.getFlowScheme());

View File

@ -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;
}

View File

@ -496,76 +496,76 @@
update department update department
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="parentDepartmentId != null">parent_department_id = <if test="parentDepartmentId != null">parent_department_id =
#{parentDepartmentId}, #{parentDepartmentId},
</if> </if>
<if test="hospitalAgencyId != null">hospital_agency_id = <if test="hospitalAgencyId != null">hospital_agency_id =
#{hospitalAgencyId}, #{hospitalAgencyId},
</if> </if>
<if test="hospitalAgencyName != null">hospital_agency_name = <if test="hospitalAgencyName != null">hospital_agency_name =
#{hospitalAgencyName}, #{hospitalAgencyName},
</if> </if>
<if test="departmentName != null">department_name = <if test="departmentName != null">department_name =
#{departmentName}, #{departmentName},
</if> </if>
<if test="departmentCode != null">department_code = <if test="departmentCode != null">department_code =
#{departmentCode}, #{departmentCode},
</if> </if>
<if test="departmentType != null">department_type = <if test="departmentType != null">department_type =
#{departmentType}, #{departmentType},
</if> </if>
<if test="departmentAbbreviation != null">department_abbreviation = <if test="departmentAbbreviation != null">department_abbreviation =
#{departmentAbbreviation}, #{departmentAbbreviation},
</if> </if>
<if test="departmentPersonId != null">department_person_id = <if test="departmentPersonId != null">department_person_id =
#{departmentPersonId}, #{departmentPersonId},
</if> </if>
<if test="departmentPersonName != null">department_person_name = <if test="departmentPersonName != null">department_person_name =
#{departmentPersonName}, #{departmentPersonName},
</if> </if>
<if test="nodeType != null">node_type = <if test="nodeType != null">node_type =
#{nodeType}, #{nodeType},
</if> </if>
<if test="provideServiceCategory != null">provide_service_category = <if test="provideServiceCategory != null">provide_service_category =
#{provideServiceCategory}, #{provideServiceCategory},
</if> </if>
<if test="subdivisionCategoryId != null">subdivision_category_id = <if test="subdivisionCategoryId != null">subdivision_category_id =
#{subdivisionCategoryId}, #{subdivisionCategoryId},
</if> </if>
<if test="subdivisionCategoryName != null">subdivision_category_name = <if test="subdivisionCategoryName != null">subdivision_category_name =
#{subdivisionCategoryName}, #{subdivisionCategoryName},
</if> </if>
<if test="normDepartmentCompareId != null">norm_department_compare_id = <if test="normDepartmentCompareId != null">norm_department_compare_id =
#{normDepartmentCompareId}, #{normDepartmentCompareId},
</if> </if>
<if test="normDepartmentCompareName != null">norm_department_compare_name = <if test="normDepartmentCompareName != null">norm_department_compare_name =
#{normDepartmentCompareName}, #{normDepartmentCompareName},
</if> </if>
<if test="prepareBedsCount != null">prepare_beds_count = <if test="prepareBedsCount != null">prepare_beds_count =
#{prepareBedsCount}, #{prepareBedsCount},
</if> </if>
<if test="departmentPhone != null">department_phone = <if test="departmentPhone != null">department_phone =
#{departmentPhone}, #{departmentPhone},
</if> </if>
<if test="departmentMail != null">department_mail = <if test="departmentMail != null">department_mail =
#{departmentMail}, #{departmentMail},
</if> </if>
<if test="establishDate != null">establish_date = <if test="establishDate != null">establish_date =
#{establishDate}, #{establishDate},
</if> </if>
<if test="revokeDate != null">revoke_date = <if test="revokeDate != null">revoke_date =
#{revokeDate}, #{revokeDate},
</if> </if>
<if test="createBy != null">create_by = <if test="createBy != null">create_by =
#{createBy}, #{createBy},
</if> </if>
<if test="createTime != null">create_time = <if test="createTime != null">create_time =
#{createTime}, #{createTime},
</if> </if>
<if test="updateBy != null">update_by = <if test="updateBy != null">update_by =
#{updateBy}, #{updateBy},
</if> </if>
<if test="updateTime != null">update_time = <if test="updateTime != null">update_time =
#{updateTime}, #{updateTime},
</if> </if>
</trim> </trim>
where id = #{id} where id = #{id}
@ -624,4 +624,13 @@
#{id} #{id}
</foreach> </foreach>
</select> </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> </mapper>

View File

@ -313,10 +313,9 @@
ri.card_no, ri.card_no,
ri.sex, ri.sex,
ri.address ri.address
FROM patient_task_execute_record pter FROM patient_info pi
LEFT JOIN patient_visit_record pvr ON pter.visit_record_id = pvr.id LEFT JOIN patient_visit_record pvr ON pvr.id = pi.patient_visit_record_id
LEFT JOIN patient_info pi ON pi.id = pter.patient_id
LEFT JOIN resident_info ri ON ri.id = pi.resident_id LEFT JOIN resident_info ri ON ri.id = pi.resident_id
where pter.id = #{id} where pi.id = #{patientId}
</select> </select>
</mapper> </mapper>

View File

@ -198,4 +198,16 @@
#{id} #{id}
</foreach> </foreach>
</delete> </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> </mapper>

View File

@ -889,14 +889,28 @@
where spmrn.message_push_sign = 1 where spmrn.message_push_sign = 1
and spmrn.del_flag = 0 and spmrn.del_flag = 0
and spmrn.node_execute_status = 'UNEXECUTED' and spmrn.node_execute_status = 'UNEXECUTED'
and (spmrn.message_node_execute_result_status is null or spmrn.message_node_execute_result_status = ' ')
</select> </select>
<update id="updateMessageStatusByIds"> <update id="updateNodeExecuteStatusByIds">
update sign_patient_manage_route_node 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 where id in
<foreach item="ids" collection="ids" open="(" separator="," close=")"> <foreach item="manageRouteNodeIds" collection="manageRouteNodeIds" open="(" separator="," close=")">
#{ids} #{manageRouteNodeIds}
</foreach> </foreach>
</update> </update>
</mapper> </mapper>

View File

@ -75,6 +75,7 @@
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="scriptInfoId" column="script_info_id"/>
</resultMap> </resultMap>
<resultMap type="com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO" id="SpecialDiseaseNodeVOResult"> <resultMap type="com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO" id="SpecialDiseaseNodeVOResult">
@ -128,6 +129,7 @@
<result property="taskStatusName" column="taskStatusName"/> <result property="taskStatusName" column="taskStatusName"/>
<result property="nodeContent" column="node_content"/> <result property="nodeContent" column="node_content"/>
<result property="flowScheme" column="flowScheme"/> <result property="flowScheme" column="flowScheme"/>
<result property="scriptInfoId" column="script_info_id"/>
</resultMap> </resultMap>
<sql id="selectSpecialDiseaseNodeVo"> <sql id="selectSpecialDiseaseNodeVo">
@ -180,7 +182,8 @@
create_by, create_by,
create_time, create_time,
update_by, update_by,
update_time update_time,
script_info_id
from special_disease_node from special_disease_node
</sql> </sql>
@ -316,6 +319,9 @@
<if test="nodeContent != null and nodeContent != ''"> <if test="nodeContent != null and nodeContent != ''">
and node_content = #{nodeContent} and node_content = #{nodeContent}
</if> </if>
<if test="scriptInfoId != null and scriptInfoId != ''">
and script_info_id = #{scriptInfoId}
</if>
</where> </where>
</select> </select>
<select id="selectSpeciaDiseaseNodeVoList" parameterType="SpecialDiseaseNode" resultMap="SpecialDiseaseNodeVOResult"> <select id="selectSpeciaDiseaseNodeVoList" parameterType="SpecialDiseaseNode" resultMap="SpecialDiseaseNodeVOResult">
@ -439,6 +445,8 @@
</if> </if>
<if test="phoneDialMethod != null">phone_dial_method, <if test="phoneDialMethod != null">phone_dial_method,
</if> </if>
<if test="scriptInfoId != null">script_info_id,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="routeId != null">#{routeId}, <if test="routeId != null">#{routeId},
@ -539,6 +547,8 @@
</if> </if>
<if test="phoneDialMethod != null ">#{phoneDialMethod} <if test="phoneDialMethod != null ">#{phoneDialMethod}
</if> </if>
<if test="scriptInfoId != null ">#{scriptInfoId}
</if>
</trim> </trim>
</insert> </insert>
@ -692,6 +702,9 @@
<if test="phoneDialMethod != null ">phone_dial_method = <if test="phoneDialMethod != null ">phone_dial_method =
#{phoneDialMethod}, #{phoneDialMethod},
</if> </if>
<if test="scriptInfoId != null ">script_info_id =
#{scriptInfoId},
</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -758,7 +771,8 @@
node_content, node_content,
create_by, create_by,
create_time, create_time,
phone_dial_method phone_dial_method,
script_info_id
) values ) values
<foreach item="specialDiseaseNodeList" index="index" collection="list" separator=","> <foreach item="specialDiseaseNodeList" index="index" collection="list" separator=",">
( (
@ -809,7 +823,8 @@
#{specialDiseaseNodeList.nodeContent}, #{specialDiseaseNodeList.nodeContent},
#{specialDiseaseNodeList.createBy}, #{specialDiseaseNodeList.createBy},
#{specialDiseaseNodeList.createTime}, #{specialDiseaseNodeList.createTime},
#{specialDiseaseNodeList.phoneDialMethod} #{specialDiseaseNodeList.phoneDialMethod},
#{specialDiseaseNodeList.scriptInfoId}
) )
</foreach> </foreach>
</insert> </insert>
@ -880,6 +895,7 @@
sdn.route_check_remark, sdn.route_check_remark,
sdn.node_content, sdn.node_content,
sdn.phone_dial_method, sdn.phone_dial_method,
sdn.script_info_id,
(select flow_scheme from script_info where id = sdn.phone_template_id) flowScheme, (select flow_scheme from script_info where id = sdn.phone_template_id) flowScheme,
(select COUNT(1) (select COUNT(1)
from special_disease_node from special_disease_node

View File

@ -231,4 +231,16 @@
) )
</foreach> </foreach>
</insert> </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> </mapper>

View File

@ -119,4 +119,12 @@ public class HomePageController extends BaseController {
public AjaxResult nodeExecuteStatus(Long manageRouteNodeId) { public AjaxResult nodeExecuteStatus(Long manageRouteNodeId) {
return homePageService.nodeExecuteStatus(manageRouteNodeId); return homePageService.nodeExecuteStatus(manageRouteNodeId);
} }
/**
* 保存宣教文章查看时间
*/
@PostMapping("/viewPropaganda")
public AjaxResult viewPropaganda(Long manageRouteNodeId) {
return homePageService.viewPropaganda(manageRouteNodeId);
}
} }

View File

@ -60,14 +60,6 @@ public interface HomePageMapper {
*/ */
List<PatientVO> selectSignPatientManageRouteNode(@Param("patientId") List<Long> patientId); 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);
/** /**
* 查询个人任务消息 * 查询个人任务消息
* *

View File

@ -105,4 +105,12 @@ public interface HomePageService {
* @return AjaxResult * @return AjaxResult
*/ */
AjaxResult nodeExecuteStatus(Long manageRouteNodeId); AjaxResult nodeExecuteStatus(Long manageRouteNodeId);
/**
* 保存宣教文章查看时间
*
* @param manageRouteNodeId 节点id
* @return AjaxResult
*/
AjaxResult viewPropaganda(Long manageRouteNodeId);
} }

View File

@ -209,7 +209,8 @@ public class HomePageServiceImpl implements HomePageService {
patientQuestionSubmitResult.setCreateTime(time); patientQuestionSubmitResult.setCreateTime(time);
// 新增患者问卷提交结果 // 新增患者问卷提交结果
if (patientQuestionSubmitResultMapper.insertPatientQuestionSubmitResult(patientQuestionSubmitResult) <= 0) { if (patientQuestionSubmitResultMapper.insertPatientQuestionSubmitResult(patientQuestionSubmitResult) <= 0) {
throw new ServiceException("新增患者问卷提交结果失败"); log.info("新增任务记录表失败");
throw new ServiceException("问卷提交失败!");
} }
// 获取到患者问卷题目提交结果信息DTO // 获取到患者问卷题目提交结果信息DTO
List<PatientQuestionSubjectResultDTO> subjectResultList = dto.getSubjectResultDTOList(); List<PatientQuestionSubjectResultDTO> subjectResultList = dto.getSubjectResultDTOList();
@ -229,7 +230,8 @@ public class HomePageServiceImpl implements HomePageService {
} }
// 新增患者问卷题目提交结果 // 新增患者问卷题目提交结果
if (patientQuestionSubjectResultMapper.saveQuestionSubjectList(patientQuestionSubjectResults) < 0) { if (patientQuestionSubjectResultMapper.saveQuestionSubjectList(patientQuestionSubjectResults) < 0) {
throw new ServiceException("新增患者问卷题目提交结果失败"); log.info("新增患者问卷题目提交结果失败");
throw new ServiceException("问卷提交失败");
} }
if (CollectionUtils.isEmpty(patientQuestionOptionResults)) { if (CollectionUtils.isEmpty(patientQuestionOptionResults)) {
return AjaxResult.success(); return AjaxResult.success();
@ -247,7 +249,17 @@ public class HomePageServiceImpl implements HomePageService {
} }
// 新增患者问卷题目选项提交结果 // 新增患者问卷题目选项提交结果
if (patientQuestionOptionResultMapper.saveQuestionOptionList(saveQuestionSubjectOptions) < 0) { 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(); return AjaxResult.success();
} }
@ -400,4 +412,19 @@ public class HomePageServiceImpl implements HomePageService {
} }
return AjaxResult.success(nodeExecuteStatus); 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();
}
} }

View File

@ -62,4 +62,6 @@ public class MessageTabulationVO {
* 模版名称 * 模版名称
*/ */
private String manageRouteNodeName; private String manageRouteNodeName;
private String nodeFinishDate;
} }

View File

@ -86,7 +86,8 @@
LEFT JOIN patient_question_submit_result pqsr on spmrn.id = pqsr.manage_route_node_id LEFT JOIN patient_question_submit_result pqsr on spmrn.id = pqsr.manage_route_node_id
WHERE qi.question_type = #{questionType} WHERE qi.question_type = #{questionType}
AND qi.questionnaire_status = #{questionnaireStatus} 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 ORDER BY pqsr.create_time DESC, spmrn.create_time DESC
</select> </select>
@ -147,17 +148,6 @@
</if> </if>
</select> </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" <select id="selectManageRouteByResidentId"
resultType="com.xinelu.mobile.vo.homepage.MessageTabulationVO"> resultType="com.xinelu.mobile.vo.homepage.MessageTabulationVO">
select spmrn.id manageRouteNodeId, select spmrn.id manageRouteNodeId,
@ -169,6 +159,7 @@
IF(pter.id is NULL, 0, 1) sign, IF(pter.id is NULL, 0, 1) sign,
pter.id patientTaskExecuteRecordId, pter.id patientTaskExecuteRecordId,
spmrn.task_node_type, spmrn.task_node_type,
spmrn.node_finish_date,
CASE CASE
WHEN spmrn.task_node_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.questionnaire_name WHEN spmrn.task_node_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.questionnaire_name
WHEN spmrn.task_node_type = 'PROPAGANDA_ARTICLE' THEN spmrn.propaganda_title 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 LEFT JOIN patient_task_execute_record pter ON pter.manage_route_node_id = spmrn.id
where pi.resident_id = #{residentId} where pi.resident_id = #{residentId}
and spmrn.node_execute_status = #{nodeExecuteStatus} 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 spmrn.del_flag = 0
and pi.del_flag = 0 and pi.del_flag = 0
and (spmrn.task_node_type = 'PROPAGANDA_ARTICLE' or spmrn.task_node_type = 'TEXT_REMIND' or 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"> resultType="com.xinelu.manage.domain.patienttaskexecuterecord.PatientTaskExecuteRecord">
select spmr.patient_id, select spmr.patient_id,
spmr.patient_name, spmr.patient_name,
spmr.id manageRouteId, spmr.id manageRouteId,
spmrn.id manageRouteNodeId, spmrn.id manageRouteNodeId,
spmrn.manage_route_name manageRouteName, spmrn.manage_route_name manageRouteName,
spmrn.route_node_name manageRouteNodeName, spmrn.route_node_name manageRouteNodeName,
spmrn.task_node_type taskNodeType spmrn.task_node_type taskNodeType,
pi.patient_visit_record_id visitRecordId
from sign_patient_manage_route_node spmrn from sign_patient_manage_route_node spmrn
LEFT JOIN sign_patient_manage_route spmr ON spmr.id = spmrn.manage_route_id 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} where spmrn.id = #{manageRouteNodeId}
</select> </select>

View File

@ -2,10 +2,17 @@ package com.xinelu.quartz.service.impl;
import com.aliyuncs.exceptions.ClientException; import com.aliyuncs.exceptions.ClientException;
import com.xinelu.common.config.AliYunSmsTwoConfig; 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.common.enums.RouteNodeNameEnum;
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
import com.xinelu.manage.dto.smssend.SmsInfoDTO; 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.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper;
import com.xinelu.manage.vo.signpatientmanageroutenode.TextMessage; import com.xinelu.manage.vo.signpatientmanageroutenode.TextMessage;
import com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum;
import com.xinelu.mobile.utils.SmsSendUtils; import com.xinelu.mobile.utils.SmsSendUtils;
import com.xinelu.quartz.service.SendTextMessageService; import com.xinelu.quartz.service.SendTextMessageService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -15,9 +22,11 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* @Description 短信发送定时任务业务层 * @Description 短信发送定时任务业务层
@ -34,6 +43,10 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
private SmsSendUtils smsSendUtils; private SmsSendUtils smsSendUtils;
@Resource @Resource
private AliYunSmsTwoConfig aliYunSmsTwoConfig; 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 { public void sendTextMessageSendTask() throws ClientException {
//查询短信发送数据 //查询短信发送数据
List<TextMessage> textMessages = signPatientManageRouteNodeMapper.selectMessagePushSign(); List<TextMessage> textMessages = signPatientManageRouteNodeMapper.selectMessagePushSign();
if (CollectionUtils.isEmpty(textMessages)) {
return;
}
//条件过滤后短信信息
List<TextMessage> messages = new ArrayList<>(); List<TextMessage> messages = new ArrayList<>();
//超时短信ids
List<Long> expiredManageRouteNodeIds = new ArrayList<>();
for (TextMessage textMessage : textMessages) { for (TextMessage textMessage : textMessages) {
//判断推送状态 //判断推送状态
if (Objects.isNull(textMessage.getMessagePushSign()) || textMessage.getMessagePushSign() != 1) { 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()); boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now());
if (before) { 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()); textMessage.setRouteNodeName(RouteNodeNameEnum.getNameByInfo(textMessage.getRouteNodeName()).getName());
messages.add(textMessage); 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())) { // 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)) { if (CollectionUtils.isNotEmpty(messages)) {
List<Long> ids = new ArrayList<>(); List<Long> ids = new ArrayList<>();
for (TextMessage message : messages) { for (TextMessage message : messages) {
@ -117,13 +151,30 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
// 根据模版id发送 // 根据模版id发送
smsInfoDTO.setTemplateCode(message.getTextMessageId()); smsInfoDTO.setTemplateCode(message.getTextMessageId());
Boolean aBoolean = smsSendUtils.sendTextMessage(smsInfoDTO); Boolean aBoolean = smsSendUtils.sendTextMessage(smsInfoDTO);
SubscribeMessageSendRecord subscribeMessageSendRecord = new SubscribeMessageSendRecord();
//成功
if (aBoolean) { if (aBoolean) {
ids.add(message.getSignPatientManageRouteNodeId()); 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)) { if (CollectionUtils.isNotEmpty(expiredManageRouteNodeIds)) {
signPatientManageRouteNodeMapper.updateMessageStatusByIds(ids); 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);
} }
} }
} }

View File

@ -1,11 +1,14 @@
package com.xinelu.quartz.service.impl; package com.xinelu.quartz.service.impl;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.xinelu.common.config.PushMessageRestrictions;
import com.xinelu.common.config.WeChatAppletChatConfig; import com.xinelu.common.config.WeChatAppletChatConfig;
import com.xinelu.common.enums.*; import com.xinelu.common.enums.*;
import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord; 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.mapper.subscribemessagesendrecord.SubscribeMessageSendRecordMapper;
import com.xinelu.manage.vo.subscribemessagesendrecord.RecordNum;
import com.xinelu.mobile.domain.TemplateContent; import com.xinelu.mobile.domain.TemplateContent;
import com.xinelu.mobile.mapper.homepage.HomePageMapper; import com.xinelu.mobile.mapper.homepage.HomePageMapper;
import com.xinelu.mobile.utils.WeChatOfficialAccountUtils; import com.xinelu.mobile.utils.WeChatOfficialAccountUtils;
@ -18,6 +21,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -40,6 +44,10 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
private WeChatOfficialAccountUtils weChatOfficialAccountUtils; private WeChatOfficialAccountUtils weChatOfficialAccountUtils;
@Resource @Resource
private SubscribeMessageSendRecordMapper subscribeMessageSendRecordMapper; 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); List<PatientVO> signPatientManageRouteNodes = homePageMapper.selectSignPatientManageRouteNode(patientIdList);
if (CollectionUtils.isEmpty(signPatientManageRouteNodes)) {
return;
}
// PatientVO 包含签约路径节点相关属性后面用于推送消息 // PatientVO 包含签约路径节点相关属性后面用于推送消息
List<PatientVO> patientVOList = new ArrayList<>(); List<PatientVO> patientVOList = new ArrayList<>();
//发送消息到期节点id集合 //发送消息到期节点id集合
@ -76,8 +87,8 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
} }
boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now()); boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now());
if (before) { if (before) {
int i = LocalDate.now().compareTo(localDate); long until =localDate.until(LocalDate.now(), ChronoUnit.DAYS);
if (i >= 1) { if (until >= pushMessageRestrictions.getTime()) {
expiredManageRouteNodeIds.add(patientVO.getSignPatientManageRouteNodeId()); expiredManageRouteNodeIds.add(patientVO.getSignPatientManageRouteNodeId());
continue; continue;
} }
@ -89,7 +100,7 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
} }
//更改过期执行状态 //更改过期执行状态
if (CollectionUtils.isNotEmpty(expiredManageRouteNodeIds)) { 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()); // 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())) {
// if (patientVO.getPatientType().equals(PatientTypeEnum.IN_HOSPITAL_PATIENT.getInfo())) {
// //入院时间 // //入院时间
// LocalDate localDate = patientVO.getAdmissionTime().plusDays(signPatientManageRouteNode.getRouteNodeDay()); // LocalDate localDate = patientVO.getAdmissionTime().plusDays(signPatientManageRouteNode.getRouteNodeDay());
// boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now()); // boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now());
@ -137,11 +149,19 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
// } // }
// } // }
// } // }
//发送 if (CollectionUtils.isEmpty(patientVOList)) {
//发送失败id集合 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> signPatientManageRouteNodeIds = new ArrayList<>();
//发送失败
List<Long> failSignPatientManageRouteNodeIds = new ArrayList<>();
for (PatientVO patientVO : patientVOList) { for (PatientVO patientVO : patientVOList) {
try { try {
//判断推送内容格式是否符合
JSON.parseArray(patientVO.getAppletNodeContent(), TemplateContent.class); JSON.parseArray(patientVO.getAppletNodeContent(), TemplateContent.class);
} catch (Exception e) { } catch (Exception e) {
continue; continue;
@ -149,13 +169,18 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
// 开始推送消息 // 开始推送消息
Integer integer = weChatOfficialAccountUtils.sendAppletTemplateMessage(patientVO); Integer integer = weChatOfficialAccountUtils.sendAppletTemplateMessage(patientVO);
SubscribeMessageSendRecord subscribeMessageSendRecord = new SubscribeMessageSendRecord(); SubscribeMessageSendRecord subscribeMessageSendRecord = new SubscribeMessageSendRecord();
//推送结果
if (integer == 0) { if (integer == 0) {
signPatientManageRouteNodeIds.add(patientVO.getSignPatientManageRouteNodeId()); signPatientManageRouteNodeIds.add(patientVO.getSignPatientManageRouteNodeId());
subscribeMessageSendRecord.setErrorCode(0); subscribeMessageSendRecord.setErrorCode(0);
subscribeMessageSendRecord.setErrorStatus(ErrorStatusEnum.success.getValue()); subscribeMessageSendRecord.setErrorStatus(ErrorStatusEnum.success.getValue());
} else { } else {
subscribeMessageSendRecord.setErrorCode(1); subscribeMessageSendRecord.setErrorCode(integer);
subscribeMessageSendRecord.setErrorStatus(ErrorStatusEnum.fail.getValue()); 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.setPatientId(patientVO.getPatientId());
subscribeMessageSendRecord.setManageRouteNodeId(patientVO.getSignPatientManageRouteNodeId()); subscribeMessageSendRecord.setManageRouteNodeId(patientVO.getSignPatientManageRouteNodeId());
@ -169,7 +194,11 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
} }
//更改成功执行状态 //更改成功执行状态
if (CollectionUtils.isNotEmpty(signPatientManageRouteNodeIds)) { 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);
} }
} }
} }