Merge branch '0418_小程序开发' of http:///192.168.16.64:3000/zhuangyuanke/PostDischargePatientManage into 0418_小程序开发

This commit is contained in:
youxilong 2024-07-03 17:59:43 +08:00
commit 1d46e3c1e3
43 changed files with 633 additions and 344 deletions

View File

@ -82,7 +82,7 @@ spring:
# 数据库索引
database: 6
# 密码
password: xinelu@6990
password:
# 连接超时时间
timeout: 10s
lettuce:
@ -202,15 +202,11 @@ wechat-applet-chat-config:
# 微信小程序事件回调令牌
token: uI1NGHesp7ylIYVYQvp0TlcDmUTKCHj2
# 微信小程序事件回调消息加密密钥
encoding-aes-key: 5rbyhMBpdnxTEVT54zeHMNcXi3ccilQZ209QqGi89EW
# 优惠券领取模板id
coupon-receive-template-id: e1JRZaw1OfTz2b6X9DTqqaJtV4rXEt7uhwXoZLDb_eA
# 商品订单支付成功通知模板id
goods-order-template-id: -IxZeEkkXFhoSwGtBHbipKQ6kjEmkdTkswKeOypSsNQ
# 预约服务订单通知模板id
appoint-order-template-id: nUB9HRbqQXOVuTpkKBIHMgzWlNq6touzxf5QYBiMkbU
# 签到成功通知模板id
sign-template-id: S_c9bR4znSWpXg-6ACIMn7AkaR11dzo113XM8w4CKz0
encoding-aes-key: 5rbyhMBpdnxTEVT54zeHMNcXi3ccilQZ209QqGi8E10
# 随访模板id
follow-template-id: p__w9HO65a8aqgy6OuNG9t_v9_j1dcT81CEA_cdMhaw
# 健康宣教模板id
healthy-propaganda-id: YNeOOaRXbtLFJ1H7HRb9Ot6HADnKO_mg2uLFrqYOhCw
# 院后微信公众号参数配置
wechat-official-account-config:

View File

@ -46,22 +46,12 @@ public class WeChatAppletChatConfig {
private String encodingAesKey;
/**
* 优惠券领取模板id
* 随访模板id
*/
private String couponReceiveTemplateId;
private String followTemplateId;
/**
* 商品订单支付成功通知模板id
* 健康宣教模板id
*/
private String goodsOrderTemplateId;
/**
* 预约服务订单通知模板id
*/
private String appointOrderTemplateId;
/**
* 签到通知模板
*/
private String signTemplateId;
private String healthyPropagandaId;
}

View File

@ -38,7 +38,7 @@ public enum PatientSexEnum {
public static PatientSexEnum getInfoByCode(String code) {
for (PatientSexEnum sex : PatientSexEnum.values()) {
if (code.equals(sex.getInfo())) {
if (code.equals(sex.getCode())) {
return sex;
}
}

View File

@ -12,24 +12,14 @@ import lombok.Getter;
public enum SubscribeMessageTypeEnum {
/**
* 预约服务付款通知提醒
* 随访通知提醒
*/
APPOINT_ORDER_MESSAGE_PUSH("APPOINT_ORDER_MESSAGE_PUSH"),
FOLLOW_MESSAGE_PUSH("FOLLOW_MESSAGE_PUSH"),
/**
* 优惠券领取提醒
* 健康宣教提醒
*/
COUPON_RECEIVE_MESSAGE_PUSH("COUPON_RECEIVE_MESSAGE_PUSH"),
/**
* 商品订单支付成功提醒
*/
GOODS_ORDER_MESSAGE_PUSH("GOODS_ORDER_MESSAGE_PUSH"),
/**
* 签到积分通知提醒
*/
SIGN_MESSAGE_PUSH("SIGN_MESSAGE_PUSH"),
HEALTHY_PROPAGANDA_MESSAGE_PUSH("HEALTHY_PROPAGANDA_MESSAGE_PUSH"),
;
final private String info;

View File

@ -3,20 +3,17 @@ package com.xinelu.manage.controller.labelfieldcontent;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.labelfieldcontent.LabelFieldContent;
import com.xinelu.manage.dto.labelfieldcontent.LabelFieldContentAddDTO;
import com.xinelu.manage.service.labelfieldcontent.ILabelFieldContentService;
import com.xinelu.manage.vo.labelfieldcontent.GroupingValue;
import com.xinelu.manage.vo.labelfieldcontent.LabelField;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldAndPartitionDict;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldAndPartitionDict;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@ -125,11 +122,4 @@ public class LabelFieldContentController extends BaseController {
return labelFieldContentService.insertLabelField(labelField);
}
/**
* 画像查询
*/
@GetMapping("/getPortaitByPatient")
public R<List<List<GroupingValue>>> getPortaitByPatient(Long patientId) {
return R.ok(labelFieldContentService.getPortaitByPatient(patientId));
}
}

View File

@ -10,7 +10,6 @@ import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
import com.xinelu.manage.dto.labelfieldinfo.LabelFieldInfoAddDTO;
import com.xinelu.manage.service.labelfieldinfo.ILabelFieldInfoService;
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldTreeVO;
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@ -116,4 +115,9 @@ public class LabelFieldInfoController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(labelFieldInfoService.deleteLabelFieldInfoByIds(ids));
}
@GetMapping("/taskTypeGrouping")
public AjaxResult taskTypeGrouping() {
return labelFieldInfoService.taskTypeGrouping();
}
}

View File

@ -46,13 +46,6 @@ private static final long serialVersionUID=1L;
@Excel(name = "任务细分名称")
private String taskPartitionDictName;
/**
* 任务细分编码
*/
@ApiModelProperty(value = "任务细分编码")
@Excel(name = "任务细分编码")
private String taskPartitionCode;
/** 任务类型表id */
@ApiModelProperty(value = "任务类型表id")
@Excel(name = "任务类型表id")
@ -63,11 +56,6 @@ private static final long serialVersionUID=1L;
@Excel(name = "任务类型名称")
private String taskTypeName;
/** 任务类型编码 */
@ApiModelProperty(value = "任务类型编码")
@Excel(name = "任务类型编码")
private String taskTypeCode;
/** 专病路径表id */
@ApiModelProperty(value = "专病路径表id")
@Excel(name = "专病路径表id")
@ -108,4 +96,17 @@ private static final long serialVersionUID=1L;
@Excel(name = "键值")
private String paramValue;
/**
* 管理路径id
*/
@ApiModelProperty(value = "管理路径id")
private Long manageRouteNodeId;
/**
* 画像流水号用年月日时分秒毫秒数字转成的字符串
*/
@ApiModelProperty(value = "画像流水号,用年月日时分秒毫秒数字转成的字符串")
@Excel(name = "画像流水号,用年月日时分秒毫秒数字转成的字符串")
private String portraitSn;
}

View File

@ -96,5 +96,15 @@ private static final long serialVersionUID=1L;
@Excel(name = "键值")
private String paramValue;
/**
* 管理路径id
*/
@ApiModelProperty(value = "管理路径id")
private Long manageRouteNodeId;
/**
* 画像流水号用年月日时分秒毫秒数字转成的字符串
*/
@ApiModelProperty(value = "画像流水号,用年月日时分秒毫秒数字转成的字符串")
private String portraitSn;
}

View File

@ -1,6 +1,6 @@
package com.xinelu.manage.dto.signpatientrecord;
import com.xinelu.manage.vo.labelfieldcontent.GroupingValue;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldAndPartitionDict;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import lombok.Data;
@ -14,7 +14,7 @@ import lombok.Data;
public class PortaitCheckDto {
@ApiModelProperty("画像信息")
List<List<GroupingValue>> labelFieldContentList;
private List<LabelFieldAndPartitionDict> labelFieldAndPartitionDictList;
@ApiModelProperty("患者主键")
private Long patientId;

View File

@ -32,6 +32,7 @@ public interface SpecialDiseaseNodeMapper {
*/
List<SpecialDiseaseNode> selectSpecialDiseaseNodeList(SpecialDiseaseNode specialDiseaseNode);
List<SpecialDiseaseNodeVO> selectSpeciaDiseaseNodeVoList(SpecialDiseaseNode specialDiseaseNode);
/**
* 新增专病路径-管理节点信息
*

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.mapper.taskpartitiondict;
import com.xinelu.manage.domain.taskpartitiondict.TaskPartitionDict;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -59,4 +60,6 @@ public interface TaskPartitionDictMapper {
* @return 结果
*/
int deleteTaskPartitionDictByIds(Long[] ids);
List<TaskPartitionDict> selectTaskPartitionList( List<Long> ids);
}

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.mapper.tasktypedict;
import com.xinelu.manage.domain.tasktypedict.TaskTypeDict;
import com.xinelu.manage.vo.tasktypedict.TaskTypeDictVO;
import java.util.List;
@ -59,4 +60,11 @@ public interface TaskTypeDictMapper {
* @return 结果
*/
public int deleteTaskTypeDictByIds(Long[] ids);
/**
* 查询任务类型字典列表
*
* @return 任务类型字典集合
*/
List<TaskTypeDictVO> selectTaskTypeDicts();
}

View File

@ -64,4 +64,12 @@ public interface TermBankMapper {
* @return 结果
*/
int deleteTermBankByIds(Long[] ids);
/**
* 查询父级信息
*
* @param parentTermCode 父级编号
* @return TermBank
*/
TermBank selectTermBankByParentTermCode(String parentTermCode);
}

View File

@ -3,10 +3,8 @@ package com.xinelu.manage.service.labelfieldcontent;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.labelfieldcontent.LabelFieldContent;
import com.xinelu.manage.dto.labelfieldcontent.LabelFieldContentAddDTO;
import com.xinelu.manage.vo.labelfieldcontent.GroupingValue;
import com.xinelu.manage.vo.labelfieldcontent.LabelField;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldAndPartitionDict;
import java.util.List;
/**
@ -93,8 +91,4 @@ public interface ILabelFieldContentService {
*/
AjaxResult insertLabelField(LabelField labelField);
/**
* 画像审核->查询患者画像信息
*/
List<List<GroupingValue>> getPortaitByPatient(Long patientId);
}

View File

@ -12,16 +12,23 @@ import com.xinelu.manage.domain.labelfieldcontent.LabelFieldContent;
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
import com.xinelu.manage.domain.patientinfo.PatientAllInfoView;
import com.xinelu.manage.domain.patientinfo.PatientAllInfoViewUppercase;
import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode;
import com.xinelu.manage.dto.labelfieldcontent.LabelFieldContentAddDTO;
import com.xinelu.manage.dto.labelfieldcontent.LabelFieldContentDTO;
import com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto;
import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper;
import com.xinelu.manage.mapper.labelfieldinfo.LabelFieldInfoMapper;
import com.xinelu.manage.mapper.patientinfo.PatientAllInfoViewMapper;
import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper;
import com.xinelu.manage.service.labelfieldcontent.ILabelFieldContentService;
import com.xinelu.manage.vo.labelfieldcontent.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -50,6 +57,8 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
private LabelFieldInfoMapper labelFieldInfoMapper;
@Resource
private PatientAllInfoViewMapper patientAllInfoViewMapper;
@Resource
private SignPatientManageRouteNodeMapper signPatientManageRouteNodeMapper;
/**
* 查询标签字段内容信息
@ -193,6 +202,20 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
if (ObjectUtils.isEmpty(patientId)) {
throw new ServiceException("请选择患者!");
}
PatientTaskDto patientTaskDto = new PatientTaskDto();
patientTaskDto.setPatientId(patientId);
//暂时不用
List<SignPatientManageRouteNode> nodeList = signPatientManageRouteNodeMapper.getNodeList(patientTaskDto);
List<String> nodeContentList = nodeList.stream().filter(Objects::nonNull).map(SignPatientManageRouteNode::getNodeContent).filter(Objects::nonNull).collect(Collectors.toList());
String nodeContentListJoin = String.join(",", nodeContentList);
Document document = Jsoup.parse(nodeContentListJoin);
// 需要提取的span
List<String> string = new ArrayList<>();
Elements spanList = document.select("span[data-w-e-type]");
for (Element span : spanList) {
String paramKey = span.attr("data-fieldMark");
string.add(paramKey);
}
//根据patientId查询是否有已经维护的参数
List<LabelFieldAndPartitionDict> labelFieldContents = labelFieldContentMapper.labelFieldAndPartitionDict(taskPartitionDictId, patientId, null);
if (CollectionUtils.isNotEmpty(labelFieldContents)) {
@ -211,20 +234,26 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
for (int i = 0; i < declaredFields.length; i++) {
strings[i] = declaredFields[i].getName().toUpperCase();
}
List<PortraitSnVO> PortraitSnVOS = new ArrayList<>();
List<String> asListStrings = Arrays.asList(strings);
for (GroupingValue groupingValue : labelFieldContentList) {
PortraitSnVO portraitSnVO = new PortraitSnVO();
groupingValue.setPatientId(patientId);
String s = asListStrings.stream().filter(Objects::nonNull).filter(item -> item.equals(groupingValue.getFieldCode())).findFirst().orElse(new String());
groupingValue.setFieldValue(paramsValue.getOrDefault(s, "").toString());
portraitSnVO.setPortraitSn(groupingValue.getPortraitSn());
PortraitSnVOS.add(portraitSnVO);
}
List<Long> collect = labelFieldContentList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getTaskPartitionDictId())).map(LabelFieldInfo::getTaskPartitionDictId).distinct().collect(Collectors.toList());
List<LabelFieldAndPartitionDict> labelFieldAndPartitionDictList = new ArrayList<>();
LabelFieldAndPartitionDict labelFieldAndPartitionDict = new LabelFieldAndPartitionDict();
labelFieldAndPartitionDict.setPortraitSnVOList(PortraitSnVOS);
labelFieldAndPartitionDictList.add(labelFieldAndPartitionDict);
for (Long aLong : collect) {
List<PortraitSnVO> PortraitSnVOS = new ArrayList<>();
LabelFieldAndPartitionDict labelFieldAndPartitionDict = new LabelFieldAndPartitionDict();
PortraitSnVO portraitSnVO = new PortraitSnVO();
List<GroupingValue> collect1 = labelFieldContentList.stream().filter(Objects::nonNull).filter(item -> aLong.equals(item.getTaskPartitionDictId())).collect(Collectors.toList());
portraitSnVO.setGroupingValues(collect1);
PortraitSnVOS.add(portraitSnVO);
labelFieldAndPartitionDict.setTaskPartitionDictId(aLong);
labelFieldAndPartitionDict.setTaskPartitionDictName(collect1.get(0).getTaskPartitionDictName());
labelFieldAndPartitionDict.setPortraitSnVOList(PortraitSnVOS);
labelFieldAndPartitionDictList.add(labelFieldAndPartitionDict);
}
return labelFieldAndPartitionDictList;
}
@ -296,33 +325,6 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
return AjaxResult.success();
}
@Override
public List<List<GroupingValue>> getPortaitByPatient(Long patientId) {
//List<Map<String, List<List<GroupingValue>>>> retMap = new ArrayList<>();
List<List<GroupingValue>> retList = new ArrayList<>();
List<GroupingValue> labelFieldContents = labelFieldContentMapper.groupingValue(0L, patientId, null);
if (CollectionUtils.isEmpty(labelFieldContents)) {
return null;
}
retList.add(labelFieldContents);
// 按照任务细分分组
//Map<Long, List<GroupingValue>> groupByPartition = labelFieldContents.stream().collect(Collectors.groupingBy(GroupingValue::getTaskPartitionDictId));
//for (Long taskPartitionDictId : groupByPartition.keySet()) {
// Map<String, List<List<GroupingValue>>> retObj = new HashMap<>();
// List<List<GroupingValue>> lists = new ArrayList<>();
// // 按照sn分组
// List<GroupingValue> partitionList = groupByPartition.get(taskPartitionDictId);
// Map<String, List<GroupingValue>> groupBySn = partitionList.stream().collect(Collectors.groupingBy(GroupingValue::getPortraitSn));
// for (String sn : groupBySn.keySet()) {
// lists.add(groupBySn.get(sn));
// }
// retObj.put(partitionList.get(0).getTaskPartitionDictName(), lists);
// retMap.add(retObj);
//}
return retList;
}
/**
* 根据任务细分类型获取患者的真实信息
*

View File

@ -4,7 +4,6 @@ import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
import com.xinelu.manage.dto.labelfieldinfo.LabelFieldInfoAddDTO;
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldTreeVO;
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO;
import java.util.List;
@ -75,4 +74,11 @@ public interface ILabelFieldInfoService {
* 批量新增标签字段信息
*/
int insertLabelFieldInfoList(LabelFieldInfoAddDTO labelFieldInfoAddDTO);
/**
* 查询任务类型
*
* @return AjaxResult
*/
AjaxResult taskTypeGrouping();
}

View File

@ -1,14 +1,18 @@
package com.xinelu.manage.service.labelfieldinfo.impl;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
import com.xinelu.manage.domain.taskpartitiondict.TaskPartitionDict;
import com.xinelu.manage.dto.labelfieldinfo.LabelFieldInfoAddDTO;
import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper;
import com.xinelu.manage.mapper.labelfieldinfo.LabelFieldInfoMapper;
import com.xinelu.manage.mapper.taskpartitiondict.TaskPartitionDictMapper;
import com.xinelu.manage.mapper.tasktypedict.TaskTypeDictMapper;
import com.xinelu.manage.service.labelfieldinfo.ILabelFieldInfoService;
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldTreeVO;
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO;
import com.xinelu.manage.vo.tasktypedict.TaskTypeDictVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -32,9 +36,10 @@ import java.util.stream.Collectors;
public class LabelFieldInfoServiceImpl implements ILabelFieldInfoService {
@Resource
private LabelFieldInfoMapper labelFieldInfoMapper;
@Resource
private LabelFieldContentMapper labelFieldContentMapper;
private TaskTypeDictMapper taskTypeDictMapper;
@Resource
private TaskPartitionDictMapper taskPartitionDictMapper;
/**
* 查询标签字段信息
@ -172,4 +177,21 @@ public class LabelFieldInfoServiceImpl implements ILabelFieldInfoService {
}
return 1;
}
@Override
public AjaxResult taskTypeGrouping() {
List<TaskTypeDictVO> taskTypeDictList = taskTypeDictMapper.selectTaskTypeDicts();
List<Long> ids = taskTypeDictList.stream().filter(Objects::nonNull).map(TaskTypeDictVO::getTaskTypeId).filter(Objects::nonNull).collect(Collectors.toList());
List<TaskPartitionDict> taskPartitionDicts = taskPartitionDictMapper.selectTaskPartitionList(ids);
if (CollectionUtils.isEmpty(taskPartitionDicts)) {
return AjaxResult.success(taskPartitionDicts);
}
for (TaskTypeDictVO taskTypeDictVO : taskTypeDictList) {
List<TaskPartitionDict> collect = taskPartitionDicts.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getTaskTypeId()) && taskTypeDictVO.getTaskTypeId().equals(item.getTaskTypeId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
taskTypeDictVO.setTaskPartitionDictList(collect);
}
}
return AjaxResult.success(taskTypeDictList);
}
}

View File

@ -7,11 +7,11 @@ import com.xinelu.common.constant.TemplateTypeConstants;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.NodeExecuteStatusEnum;
import com.xinelu.common.enums.PhoneConnectStatusEnum;
import com.xinelu.common.enums.PhoneDialMethodEnum;
import com.xinelu.common.enums.PhoneMessageRemindEnum;
import com.xinelu.common.enums.RouteNodeNameEnum;
import com.xinelu.common.enums.TaskContentEnum;
import com.xinelu.common.enums.TaskCreateTypeEnum;
import com.xinelu.common.enums.*;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.AgeUtil;
import com.xinelu.common.utils.SecurityUtils;
@ -63,25 +63,19 @@ import com.xinelu.manage.vo.specialdiseasenode.RouteTaskAuditVo;
import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeAuditVo;
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseChildRouteAuditVo;
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteAuditVo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
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.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
@ -128,6 +122,8 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
private TextMessageMapper textMessageMapper;
@Resource
private WechatTemplateMapper wechatTemplateMapper;
@Resource
private ISignPatientManageRouteNodeService signPatientManageRouteNodeService;
/**
* 查询签约患者管理任务路径
@ -528,7 +524,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
// 替换nodeContent
List<SignPatientManageNodeAuditVo> manageNodeList = new ArrayList<>();
if (StringUtils.contains(node.getNodeContent(), "data-w-e-type")) {
manageNodeList = replaceNodeContent(manageRouteNode, node, labelFieldContentList);
manageNodeList = signPatientManageRouteNodeService.replaceNodeContent(manageRouteNode, node.getTaskPartitionDictId(), labelFieldContentList);
} else {
manageNodeList.add(manageRouteNode);
}
@ -730,7 +726,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
//过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
flowScheme = flowScheme.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
flowScheme = flowScheme.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
}
}
}
@ -754,7 +750,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
// 过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
textMessageContent = textMessageContent.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
textMessageContent = textMessageContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
}
}
return textMessageContent;
@ -771,7 +767,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
}
// 替换小程序模板
if (node.getAppletPushSign() != null && node.getAppletPushSign() == 1) {
manageRouteNode.setAppletNodeContent(replaceWeChatTemplate(node.getOfficialTemplateId(), labelFieldContentList));
manageRouteNode.setAppletNodeContent(replaceWeChatTemplate(node.getAppletTemplateId(), labelFieldContentList));
}
}
@ -792,46 +788,10 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
// 过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
templateContent = templateContent.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
templateContent = templateContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
}
}
return templateContent;
}
/**
* 替换节点内容
* @param node 节点
* @param labelFieldContentList 画像信息
* @return 替换标签后的节点列表
*/
private List<SignPatientManageNodeAuditVo> replaceNodeContent(SignPatientManageNodeAuditVo manageRouteNode, RouteTaskAuditVo node, List<LabelFieldInfoContentVo> labelFieldContentList) {
List<SignPatientManageNodeAuditVo> manageNodeList = new ArrayList<>();
// 按照任务细分分组
Map<Long, List<LabelFieldInfoContentVo>> groupbyPartition = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId));
List<LabelFieldInfoContentVo> nodeParamList = groupbyPartition.get(node.getTaskPartitionDictId());
// 参数按照序列号分组
if (CollectionUtils.isNotEmpty(nodeParamList)) {
Map<String, List<LabelFieldInfoContentVo>> groupBySn = nodeParamList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getPortraitSn));
for (String portraitSn : groupBySn.keySet()) {
SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo();
BeanUtils.copyBeanProp(manageNode, manageRouteNode);
// 替换文本
List<LabelFieldInfoContentVo> nodeParams = groupBySn.get(portraitSn);
Map<String, String> map = nodeParams.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo::getFieldValue,(key1,key2)->key2));
Document document = Jsoup.parse(manageNode.getNodeContent());
// 需要提取的span
Elements spanlist = document.select("span[data-w-e-type]");
for (Element span : spanlist) {
String paramKey = span.attr("data-fieldMark");
span.text(map.getOrDefault(paramKey, ""));
span.unwrap();
}
manageNode.setNodeContent(document.body().html());
manageNodeList.add(manageNode);
}
}
return manageNodeList;
}
}

View File

@ -7,10 +7,12 @@ import com.xinelu.manage.dto.signpatientmanageroutenode.AppletPatientTaskDto;
import com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto;
import com.xinelu.manage.dto.signpatientmanageroutenode.RouteNodeCheckDto;
import com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldInfoContentVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.AppletRouteNodeListVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientManageNodeInfoVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientManageNodeListVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientTaskVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageNodeAuditVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeVo;
import com.xinelu.manage.vo.specialdiseasenode.PatientSpecialDiseaseNodeVo;
import java.time.LocalDateTime;
@ -160,4 +162,13 @@ public interface ISignPatientManageRouteNodeService {
* @param specialDiseaseRouteId 专病管理路径子路径主键
*/
void generateChildRouteTask(Long patientId, Long signPatientRecordId, Long specialDiseaseRouteId);
/**
* 替换节点标签内容
* @param manageRouteNode 签约管理路径节点
* @param taskPartitionDictId 专病节点任务细分
* @param labelFieldContentList 患者画像
* @return 签约路径节点列表
*/
List<SignPatientManageNodeAuditVo> replaceNodeContent(SignPatientManageNodeAuditVo manageRouteNode, Long taskPartitionDictId, List<LabelFieldInfoContentVo> labelFieldContentList);
}

View File

@ -58,9 +58,11 @@ import com.xinelu.manage.vo.signpatientmanageroutenode.AppletRouteNodeListVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientManageNodeInfoVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientManageNodeListVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientTaskVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageNodeAuditVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeInfoVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeVo;
import com.xinelu.manage.vo.specialdiseasenode.PatientSpecialDiseaseNodeVo;
import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO;
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO;
import java.lang.reflect.Field;
import java.math.BigDecimal;
@ -553,15 +555,15 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
case TaskContentConstants.SMS_REMIND: // 短信提醒
// 判断是否发短信
if (!StringUtils.equals(PhoneMessageRemindConstants.NOT_SEND_MESSAGE, signNode.getPhoneMessageRemind())) {
if (signNode.getPhoneMessageTemplateId() == null) {
throw new ServiceException("为选择短信模板");
}
TextMessage textMessage = textMessageMapper.selectTextMessageById(signNode.getPhoneMessageTemplateId());
if (ObjectUtils.isEmpty(textMessage) || StringUtils.isBlank(textMessage.getTextMessageContent())) {
throw new ServiceException("短信模板不存在或短信模板内容为空,请联系管理员!");
}
//if (signNode.getPhoneMessageTemplateId() == null) {
// throw new ServiceException("为选择短信模板");
//}
//TextMessage textMessage = textMessageMapper.selectTextMessageById(signNode.getPhoneMessageTemplateId());
//if (ObjectUtils.isEmpty(textMessage) || StringUtils.isBlank(textMessage.getTextMessageContent())) {
// throw new ServiceException("短信模板不存在或短信模板内容为空,请联系管理员!");
//}
signNode.setId(null);
signNode.setNodeContent(textMessage.getTextMessageContent());
signNode.setNodeContent(signNode.getPhoneMessageTemplateContent());
signNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
signNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
signPatientManageRouteNodeMapper.insertSignPatientManageRouteNode(signNode);
@ -770,7 +772,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 查询路径节点
SpecialDiseaseNode specialDiseaseNodeQuery = new SpecialDiseaseNode();
specialDiseaseNodeQuery.setRouteId(signPatientManageRoute.getRouteId());
List<SpecialDiseaseNode> nodeList = specialDiseaseNodeMapper.selectSpecialDiseaseNodeList(specialDiseaseNodeQuery);
List<SpecialDiseaseNodeVO> nodeList = specialDiseaseNodeMapper.selectSpeciaDiseaseNodeVoList(specialDiseaseNodeQuery);
// 查询患者画像信息
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientId);
if (CollectionUtils.isEmpty(labelFieldContentList)) {
@ -785,6 +787,9 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
manageRouteNode.setId(null);
manageRouteNode.setRouteNodeId(node.getId());
manageRouteNode.setExecuteTime(node.getExecutionTime());
manageRouteNode.setDelFlag(0);
manageRouteNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
manageRouteNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
// 根据模板类型存放模板字段
if(StringUtils.isNotBlank(node.getTemplateType())) {
@ -821,7 +826,15 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 替换nodeContent
List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>();
if (StringUtils.contains(node.getNodeContent(), "data-w-e-type")) {
manageNodeList = replaceNodeContent(manageRouteNode, node, labelFieldContentList);
SignPatientManageNodeAuditVo signPatientManageNodeAuditVo = new SignPatientManageNodeAuditVo();
BeanUtils.copyBeanProp(signPatientManageNodeAuditVo, manageRouteNode);
List<SignPatientManageNodeAuditVo> manageNodeAuditVoList = replaceNodeContent(signPatientManageNodeAuditVo, node.getTaskPartitionDictId(), labelFieldContentList);
manageNodeAuditVoList.forEach(manageNodeAuditVo -> {
SignPatientManageRouteNode signNode = new SignPatientManageRouteNode();
BeanUtils.copyBeanProp(signNode, manageNodeAuditVo);
manageNodeList.add(signNode);
});
} else {
manageNodeList.add(manageRouteNode);
}
@ -860,7 +873,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
//过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
flowScheme = flowScheme.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
flowScheme = flowScheme.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
}
}
}
@ -884,7 +897,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
textMessageContent = textMessageContent.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
textMessageContent = textMessageContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
}
}
return textMessageContent;
@ -907,7 +920,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
}
// 替换小程序模板
if (node.getAppletPushSign() != null && node.getAppletPushSign() == 1) {
manageRouteNode.setAppletNodeContent(replaceWeChatTemplate(node.getOfficialTemplateId(), labelFieldContentList));
manageRouteNode.setAppletNodeContent(replaceWeChatTemplate(node.getAppletTemplateId(), labelFieldContentList));
}
}
@ -928,32 +941,56 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
templateContent = templateContent.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
templateContent = templateContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
}
}
return templateContent;
}
/**
* 替换节点内容
* @param node 节点
* @param labelFieldContentList 画像信息
* @return 替换标签后的节点列表
* 替换节点标签内容
* @param manageRouteNode 签约管理路径节点
* @param taskPartitionDictId 专病节点任务细分
* @param labelFieldContentList 患者画像
* @return 签约路径节点列表
*/
private List<SignPatientManageRouteNode> replaceNodeContent(SignPatientManageRouteNode manageRouteNode, SpecialDiseaseNode node, List<LabelFieldInfoContentVo> labelFieldContentList) {
List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>();
// 按照任务细分分组
Map<Long, List<LabelFieldInfoContentVo>> groupbyPartition = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId));
List<LabelFieldInfoContentVo> nodeParamList = groupbyPartition.get(node.getTaskSubdivision());
// 参数按照序列号分组
if (CollectionUtils.isNotEmpty(nodeParamList)) {
Map<String, List<LabelFieldInfoContentVo>> groupBySn = nodeParamList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getPortraitSn));
@Override
public List<SignPatientManageNodeAuditVo> replaceNodeContent(SignPatientManageNodeAuditVo manageRouteNode, Long taskPartitionDictId, List<LabelFieldInfoContentVo> labelFieldContentList) {
List<SignPatientManageNodeAuditVo> manageNodeList = new ArrayList<>();
Map<String, List<LabelFieldInfoContentVo>> groupByRang = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getApplyRange));
// 筛选应用范围是否有私用的画像
List<LabelFieldInfoContentVo> privateLabelFields = groupByRang.get("PRIVATE");
List<LabelFieldInfoContentVo> publicLabelFields = groupByRang.get("PUBLIC");
// 按照sn进行分组判断生成几条任务
Map<Long, List<LabelFieldInfoContentVo>> groupByPartition = privateLabelFields.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId));
List<LabelFieldInfoContentVo> nodeLabelFieldContent = groupByPartition.get(taskPartitionDictId);
if (CollectionUtils.isEmpty(privateLabelFields) || CollectionUtils.isEmpty(nodeLabelFieldContent)) {
// 都是公有属性只生成一条任务
SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo();
BeanUtils.copyBeanProp(manageNode, manageRouteNode);
// 替换文本
Map<String, String> map = publicLabelFields.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo::getFieldValue,(key1,key2)->key2));
Document document = Jsoup.parse(manageNode.getNodeContent());
// 需要提取的span
Elements spanlist = document.select("span[data-w-e-type]");
for (Element span : spanlist) {
String paramKey = span.attr("data-fieldMark");
span.text(map.getOrDefault(paramKey, ""));
span.unwrap();
}
manageNode.setNodeContent(document.body().html());
manageNodeList.add(manageNode);
} else {
Map<String, List<LabelFieldInfoContentVo>> groupBySn = nodeLabelFieldContent.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getPortraitSn));
for (String portraitSn : groupBySn.keySet()) {
SignPatientManageRouteNode manageNode = new SignPatientManageRouteNode();
SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo();
BeanUtils.copyBeanProp(manageNode, manageRouteNode);
// 替换文本
List<LabelFieldInfoContentVo> nodeParams = groupBySn.get(portraitSn);
nodeParams.addAll(publicLabelFields);
Map<String, String> map = nodeParams.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo::getFieldValue,(key1,key2)->key2));
Document document = Jsoup.parse(manageNode.getNodeContent());
// 需要提取的span

View File

@ -11,6 +11,7 @@ import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent;
import com.xinelu.manage.domain.patientnodeparamslog.PatientNodeParamsLog;
import com.xinelu.manage.domain.signpatientinformed.SignPatientInformed;
import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute;
@ -29,6 +30,7 @@ import com.xinelu.manage.dto.signpatientrecord.SignPatientListDto;
import com.xinelu.manage.dto.signpatientrecord.SignPatientStatusDto;
import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper;
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
import com.xinelu.manage.mapper.patientnodeparamslcurrent.PatientNodeParamsCurrentMapper;
import com.xinelu.manage.mapper.patientnodeparamslog.PatientNodeParamsLogMapper;
import com.xinelu.manage.mapper.signpatientinformed.SignPatientInformedMapper;
import com.xinelu.manage.mapper.signpatientmanageroute.SignPatientManageRouteMapper;
@ -36,10 +38,8 @@ import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRout
import com.xinelu.manage.mapper.signpatientpackage.SignPatientPackageMapper;
import com.xinelu.manage.mapper.signpatientpackagehardware.SignPatientPackageHardwareMapper;
import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper;
import com.xinelu.manage.mapper.signroutetriggercondition.SignRouteTriggerConditionMapper;
import com.xinelu.manage.mapper.specialdiseasenode.SpecialDiseaseNodeMapper;
import com.xinelu.manage.mapper.specialdiseaseroute.SpecialDiseaseRouteMapper;
import com.xinelu.manage.mapper.specialdiseasetriggercondition.SpecialDiseaseTriggerConditionMapper;
import com.xinelu.manage.service.labelfieldcontent.ILabelFieldContentService;
import com.xinelu.manage.service.signpatientmanageroutenode.ISignPatientManageRouteNodeService;
import com.xinelu.manage.service.signpatientrecord.ISignPatientRecordService;
@ -49,6 +49,7 @@ import com.xinelu.manage.vo.patientinfo.PatientPortaitVo;
import com.xinelu.manage.vo.signpatientrecord.SignPatientInfoVo;
import com.xinelu.manage.vo.signpatientrecord.SignPatientListVo;
import com.xinelu.manage.vo.signpatientrecord.SignPatientRecordVo;
import com.xinelu.manage.vo.specialdiseasenode.RouteTaskAuditVo;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ -56,6 +57,10 @@ import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.lang3.ObjectUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -91,9 +96,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
@Resource
private SignPatientManageRouteNodeMapper manageRouteNodeMapper;
@Resource
private SpecialDiseaseTriggerConditionMapper triggerConditionMapper;
@Resource
private SignRouteTriggerConditionMapper signRouteTriggerConditionMapper;
private PatientNodeParamsCurrentMapper patientNodeParamsCurrentMapper;
@Resource
private PatientNodeParamsLogMapper patientNodeParamsLogMapper;
@Resource
@ -194,6 +197,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
BeanUtils.copyBeanProp(signPatientManageRoute, specialDiseaseRoute);
signPatientManageRoute.setSignPatientRecordId(signPatientRecord.getId());
signPatientManageRoute.setPatientId(patient.getId());
signPatientManageRoute.setPatientName(patient.getPatientName());
signPatientManageRoute.setId(null);
signPatientManageRoute.setRouteId(specialDiseaseRoute.getId());
signPatientManageRoute.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE);
@ -393,21 +397,22 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
@Transactional(rollbackFor = Exception.class)
public int updatePortaitCheckStatus(PortaitCheckDto portaitCheckDto) {
// 画像信息保存
if (CollectionUtils.isEmpty(portaitCheckDto.getLabelFieldContentList())) {
throw new ServiceException("请输入画像信息");
if (StringUtils.equals(RouteCheckStatusEnum.AGREE.getInfo(), portaitCheckDto.getPortaitCheckStatus())) {
LabelField labelField = new LabelField();
labelField.setLabelFieldAndPartitionDictList(portaitCheckDto.getLabelFieldAndPartitionDictList());
labelFieldContentService.insertLabelField(labelField);
}
if (StringUtils.isBlank(portaitCheckDto.getPortaitCheckStatus())) {
throw new ServiceException("请输入审核信息");
}
LabelField labelField = new LabelField();
labelField.setGroupingValues(portaitCheckDto.getLabelFieldContentList());
labelFieldContentService.insertLabelField(labelField);
// 修改签约记录
SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(portaitCheckDto.getSignPatientRecordId());
if (ObjectUtils.isEmpty(signPatientRecord)) {
throw new ServiceException("未找到该签约记录");
}
// 画像信息保存到路径参数表
if (StringUtils.equals(RouteCheckStatusEnum.AGREE.getInfo(), portaitCheckDto.getPortaitCheckStatus())) {
saveNodeParams(signPatientRecord);
}
signPatientRecord.setPortaitCheckStatus(portaitCheckDto.getPortaitCheckStatus());
signPatientRecord.setPortaitCheckRemark(portaitCheckDto.getPortaitCheckRemark());
signPatientRecord.setPortaitCheckDate(LocalDateTime.now());
@ -419,6 +424,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
// 替换手动生成的任务中的标签
signPatientManageRouteNodeService.manualCreateTaskLabelReplace(portaitCheckDto.getSignPatientRecordId());
}
return flag;
}
@ -442,4 +448,115 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
}
return flag;
}
/**
* 画像信息保存到路径参数表
* @param signPatientRecord 签约记录信息
*/
private void saveNodeParams(SignPatientRecord signPatientRecord) {
// 画像信息保存到路径参数表
SignPatientManageRoute manageRouteQuery = new SignPatientManageRoute();
manageRouteQuery.setSignPatientRecordId(signPatientRecord.getId());
manageRouteQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE);
List<SignPatientManageRoute> manageRouteList = signPatientManageRouteMapper.selectSignPatientManageRouteList(manageRouteQuery);
if (CollectionUtils.isEmpty(manageRouteList)) {
throw new ServiceException("未找到签约路径,请联系管理员");
}
SignPatientManageRoute signPatientManageRoute = manageRouteList.get(0);
List<RouteTaskAuditVo> nodeList = specialDiseaseNodeMapper.getByParentRouteId(signPatientManageRoute.getRouteId());
List<PatientNodeParamsCurrent> paramsCurrentList = new ArrayList<>();
List<PatientNodeParamsLog> paramsLogList = new ArrayList<>();
// 查询画像信息
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(signPatientRecord.getPatientId());
if (!CollectionUtils.isEmpty(labelFieldContentList)) {
// 按照公共私用分组
Map<String, List<LabelFieldInfoContentVo>> groupByRang = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getApplyRange));
// 筛选应用范围是否有私用的画像
List<LabelFieldInfoContentVo> privateLabelFields = groupByRang.get("PRIVATE");
List<LabelFieldInfoContentVo> publicLabelFields = groupByRang.get("PUBLIC");
Map<Long, List<LabelFieldInfoContentVo>> groupByPartition = privateLabelFields.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId));
nodeList.forEach(node -> {
List<LabelFieldInfoContentVo> nodeLabelFields = groupByPartition.get(node.getTaskPartitionDictId());
if (CollectionUtils.isEmpty(nodeLabelFields)) {
Document document = Jsoup.parse(node.getNodeContent());
// 需要提取的span
Elements spanlist = document.select("span[data-w-e-type]");
Map<String, LabelFieldInfoContentVo> map = publicLabelFields.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo->LabelFieldInfoContentVo ,(key1,key2)->key2));
for (Element span : spanlist) {
String paramKey = span.attr("data-fieldMark");
LabelFieldInfoContentVo labelFieldInfoContentVo = map.get(paramKey);
if (ObjectUtils.isNotEmpty(labelFieldInfoContentVo)) {
PatientNodeParamsCurrent paramsCurrent = new PatientNodeParamsCurrent();
paramsCurrent.setPatientId(signPatientRecord.getPatientId());
paramsCurrent.setPatientName(signPatientRecord.getPatientName());
paramsCurrent.setTaskPartitionDictId(node.getTaskPartitionDictId());
paramsCurrent.setTaskPartitionDictName(node.getTaskPartitionDictName());
paramsCurrent.setTaskTypeId(node.getTaskTypeId());
paramsCurrent.setTaskTypeName(node.getTaskTypeName());
paramsCurrent.setRouteId(node.getRouteId());
paramsCurrent.setRouteName(node.getRouteName());
paramsCurrent.setRouteNodeId(node.getId());
paramsCurrent.setRouteNodeName(node.getRouteNodeName());
paramsCurrent.setParamKey(paramKey);
paramsCurrent.setParamValue(labelFieldInfoContentVo.getFieldValue());
paramsCurrent.setParamName(labelFieldInfoContentVo.getFieldName());
paramsCurrent.setPortraitSn(labelFieldInfoContentVo.getPortraitSn());
paramsCurrentList.add(paramsCurrent);
PatientNodeParamsLog paramsLog = new PatientNodeParamsLog();
BeanUtils.copyBeanProp(paramsLog, paramsCurrent);
paramsLogList.add(paramsLog);
}
}
} else {
Map<String, List<LabelFieldInfoContentVo>> groupBySn = nodeLabelFields.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getPortraitSn));
// 查询node中的标签
if (!CollectionUtils.isEmpty(publicLabelFields) && StringUtils.isNotBlank(node.getNodeContent()) && StringUtils.contains("data-w-e-type", node.getNodeContent())) {
Document document = Jsoup.parse(node.getNodeContent());
// 需要提取的span
Elements spanlist = document.select("span[data-w-e-type]");
for(String sn : groupBySn.keySet()) {
List<LabelFieldInfoContentVo> snLabelField = groupBySn.get(sn);
snLabelField.addAll(publicLabelFields);
Map<String, LabelFieldInfoContentVo> map = snLabelField.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo->LabelFieldInfoContentVo ,(key1,key2)->key2));
for (Element span : spanlist) {
String paramKey = span.attr("data-fieldMark");
LabelFieldInfoContentVo labelFieldInfoContentVo = map.get(paramKey);
if (ObjectUtils.isNotEmpty(labelFieldInfoContentVo)) {
PatientNodeParamsCurrent paramsCurrent = new PatientNodeParamsCurrent();
paramsCurrent.setPatientId(signPatientRecord.getPatientId());
paramsCurrent.setPatientName(signPatientRecord.getPatientName());
paramsCurrent.setTaskPartitionDictId(node.getTaskPartitionDictId());
paramsCurrent.setTaskPartitionDictName(node.getTaskPartitionDictName());
paramsCurrent.setTaskTypeId(node.getTaskTypeId());
paramsCurrent.setTaskTypeName(node.getTaskTypeName());
paramsCurrent.setRouteId(node.getRouteId());
paramsCurrent.setRouteName(node.getRouteName());
paramsCurrent.setRouteNodeId(node.getId());
paramsCurrent.setRouteNodeName(node.getRouteNodeName());
paramsCurrent.setParamKey(paramKey);
paramsCurrent.setParamValue(labelFieldInfoContentVo.getFieldValue());
paramsCurrent.setParamName(labelFieldInfoContentVo.getFieldName());
paramsCurrent.setPortraitSn(labelFieldInfoContentVo.getPortraitSn());
paramsCurrentList.add(paramsCurrent);
PatientNodeParamsLog paramsLog = new PatientNodeParamsLog();
BeanUtils.copyBeanProp(paramsLog, paramsCurrent);
paramsLogList.add(paramsLog);
}
}
}
}
}
});
if (!CollectionUtils.isEmpty(paramsCurrentList)) {
patientNodeParamsCurrentMapper.insertList(paramsCurrentList);
patientNodeParamsLogMapper.insertList(paramsLogList);
}
}
}
}

View File

@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSONObject;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.PatientSexEnum;
import com.xinelu.common.enums.ReleaseStatusEnum;
import com.xinelu.common.enums.TemplateTypeEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.BaseUtil;
import com.xinelu.common.utils.SecurityUtils;
@ -55,8 +54,8 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
private PatientNodeParamsCurrentMapper patientNodeParamsCurrentMapper;
@Resource
private PatientInfoMapper patientInfoMapper;
@Resource
private IPatientAllInfoViewService patientAllInfoViewService;
@Resource
private IPatientAllInfoViewService patientAllInfoViewService;
/**
@ -123,16 +122,16 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
if (Objects.nonNull(specialDiseaseNode) && Objects.nonNull(specialDiseaseNode.getSpecialDiseaseRouteId())) {
SpecialDiseaseRoute specialDiseaseRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(specialDiseaseNode.getSpecialDiseaseRouteId());
if (specialDiseaseRoute.getParentRouteId() == null || specialDiseaseRoute.getParentRouteId() == 0) {
if (Objects.nonNull(specialDiseaseRoute) && StringUtils.isNotBlank(specialDiseaseRoute.getReleaseStatus()) && !ReleaseStatusEnum.UNPUBLISHED.getInfo().equals(specialDiseaseRoute.getReleaseStatus())) {
return AjaxResult.error("已发布过的专病路径不能修改!");
}
if (Objects.nonNull(specialDiseaseRoute) && StringUtils.isNotBlank(specialDiseaseRoute.getReleaseStatus()) && !ReleaseStatusEnum.UNPUBLISHED.getInfo().equals(specialDiseaseRoute.getReleaseStatus())) {
return AjaxResult.error("已发布过的专病路径不能修改!");
}
} else {
// 判断主路径的发布状态
SpecialDiseaseRoute parentRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(specialDiseaseRoute.getParentRouteId());
if (Objects.nonNull(parentRoute) && StringUtils.isNotBlank(parentRoute.getReleaseStatus()) && !StringUtils.equals(ReleaseStatusEnum.UNPUBLISHED.getInfo(), specialDiseaseRoute.getReleaseStatus())) {
return AjaxResult.error("已发布过的专病路径不能修改!");
}
}
// 判断主路径的发布状态
SpecialDiseaseRoute parentRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(specialDiseaseRoute.getParentRouteId());
if (Objects.nonNull(parentRoute) && StringUtils.isNotBlank(parentRoute.getReleaseStatus()) && !StringUtils.equals(ReleaseStatusEnum.UNPUBLISHED.getInfo(), specialDiseaseRoute.getReleaseStatus())) {
return AjaxResult.error("已发布过的专病路径不能修改!");
}
}
}
List<Long> longs = specialDiseaseNodeMapper.selectSpecialDiseaseRouteIds(specialDiseaseNode.getSpecialDiseaseRouteId());
SpecialDiseaseRoute specialDiseaseRoute = new SpecialDiseaseRoute();
@ -156,20 +155,18 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
List<SpecialDiseaseNodeVO> specialDiseaseNodeVOS = new ArrayList<>();
int i = 0;
for (SpecialDiseaseNodeVO diseaseNode : specialDiseaseNode.getSpecialDiseaseNodeList()) {
if(StringUtils.isBlank(diseaseNode.getRouteNodeName())) {
throw new ServiceException("请输入节点名称");
}
if (diseaseNode.getRouteNodeDay() == null) {
throw new ServiceException("请输入节点时间");
}
if (StringUtils.isBlank(diseaseNode.getTaskType()) || StringUtils.isBlank(diseaseNode.getTaskSubdivision()) || StringUtils.isBlank(diseaseNode.getTaskStatus())) {
throw new ServiceException("任务类型、任务细分、任务状态不能为空");
}
if (StringUtils.isBlank(diseaseNode.getRouteNodeName())) {
throw new ServiceException("请输入节点名称");
}
if (diseaseNode.getRouteNodeDay() == null) {
throw new ServiceException("请输入节点时间");
}
if (StringUtils.isBlank(diseaseNode.getTaskType()) || StringUtils.isBlank(diseaseNode.getTaskSubdivision()) || StringUtils.isBlank(diseaseNode.getTaskStatus())) {
throw new ServiceException("任务类型、任务细分、任务状态不能为空");
}
diseaseNode.setRouteId(specialDiseaseRoute.getId());
diseaseNode.setRouteName(specialDiseaseNode.getRouteName());
diseaseNode.setTemplateType(null);
if (StringUtils.isNotBlank(diseaseNode.getTaskSubdivisiontemplateType())
&& (TemplateTypeEnum.QUESTIONNAIRE.getInfo().equals(diseaseNode.getTaskSubdivisiontemplateType()) || TemplateTypeEnum.PROPAGANDA.getInfo().equals(diseaseNode.getTaskSubdivisiontemplateType()) || TemplateTypeEnum.SCRIPT.getInfo().equals(diseaseNode.getTaskSubdivisiontemplateType()))) {
if (Objects.isNull(diseaseNode.getPhonePushSign()) || diseaseNode.getPhonePushSign() == 0) {
diseaseNode.setTemplateType(diseaseNode.getTaskSubdivisiontemplateType());
}
diseaseNode.setUpdateTime(LocalDateTime.now());
@ -281,26 +278,27 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
return retList;
}
@Override public List<RouteTaskAuditVo> getByParentRouteId(Long parentRouteId) {
return specialDiseaseNodeMapper.getByParentRouteId(parentRouteId);
}
@Override
public List<RouteTaskAuditVo> getByParentRouteId(Long parentRouteId) {
return specialDiseaseNodeMapper.getByParentRouteId(parentRouteId);
}
/**
/**
* 根据任务细分类型获取患者的真实信息
*
* @param patientId 患者主键
* @param patientId 患者主键
* @return 实际信息
*/
private JSONObject getParamsValue(Long patientId) {
JSONObject retObj = new JSONObject();
PatientAllInfoView patientAllInfoView = patientAllInfoViewService.selectPatientAllInfoViewByPatientId(patientId);
if (ObjectUtils.isEmpty(patientAllInfoView)) {
throw new ServiceException("患者信息获取错误,请联系管理员!");
}
PatientAllInfoView patientAllInfoView = patientAllInfoViewService.selectPatientAllInfoViewByPatientId(patientId);
if (ObjectUtils.isEmpty(patientAllInfoView)) {
throw new ServiceException("患者信息获取错误,请联系管理员!");
}
retObj = JSONObject.parseObject(JSONObject.toJSONString(patientAllInfoView));
// 性别转换成中文计算年龄
retObj.fluentPut("sex", PatientSexEnum.getInfoByCode(patientAllInfoView.getSex()).getInfo())
.fluentPut("age", BaseUtil.getAge(patientAllInfoView.getBirthDate()));
.fluentPut("age", BaseUtil.getAge(patientAllInfoView.getBirthDate()));
return retObj;
}
}

View File

@ -92,13 +92,17 @@ public class TermBankServiceImpl implements ITermBankService {
*/
@Override
public AjaxResult updateTermBank(TermBank termBank) {
if (Objects.nonNull(termBank) && Objects.nonNull(termBank.getTermLevel()) && termBank.getTermLevel() < Constants.TERM_MAX_LEVEL) {
termBank.setTermLevel(termBank.getTermLevel() + 1);
termBank.setTermLevel(1L);
if (StringUtils.isNotBlank(termBank.getParentTermCode())) {
TermBank parentTermCode = termBankMapper.selectTermBankByParentTermCode(termBank.getParentTermCode());
if (Objects.nonNull(parentTermCode) && Objects.nonNull(parentTermCode.getTermLevel())) {
termBank.setTermLevel(parentTermCode.getTermLevel() + 1);
}
}
if (Objects.nonNull(termBank) && Objects.nonNull(termBank.getTermLevel()) && termBank.getTermLevel() > (Constants.TERM_MAX_LEVEL)) {
if (Objects.nonNull(termBank.getTermLevel()) && termBank.getTermLevel() > (Constants.TERM_MAX_LEVEL)) {
return AjaxResult.error("常用话术层数最大值为" + Constants.TERM_MAX_LEVEL + "");
}
if (Objects.nonNull(termBank) && StringUtils.isBlank(termBank.getParentTermCode())) {
if (StringUtils.isBlank(termBank.getParentTermCode())) {
termBank.setTermLevel(Constants.TERM_MIN_LEVEL);
}
termBank.setUpdateTime(LocalDateTime.now());

View File

@ -11,6 +11,12 @@ import lombok.Data;
@Data
public class LabelFieldInfoContentVo {
/**
* 字段名称
*/
@ApiModelProperty(value = "字段名称")
private String fieldName;
/**
* 字段编码
*/
@ -23,6 +29,12 @@ public class LabelFieldInfoContentVo {
@ApiModelProperty(value = "任务细分id当做分组使用")
private Long taskPartitionDictId;
/**
* 任务类型表id(冗余)
*/
@ApiModelProperty(value = "任务类型表id(冗余)")
private Long taskTypeId;
/**
* 字段值同param_value
*/
@ -35,4 +47,10 @@ public class LabelFieldInfoContentVo {
@ApiModelProperty(value = "画像流水号,用年月日时分秒毫秒数字转成的字符串")
private String portraitSn;
/**
* 应用范围;PRIVATE:专用;PUBLIC:公共
*/
@ApiModelProperty("应用范围;PRIVATE:专用PUBLIC:公共")
private String applyRange;
}

View File

@ -12,6 +12,12 @@ import lombok.Data;
@Data
public class RouteTaskAuditVo extends SpecialDiseaseNode {
/**
* 任务类型id
*/
@ApiModelProperty(value = "任务类型id")
private Long taskTypeId;
/**
* 任务类型名称
*/

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.vo.specialdiseasenode;
import com.xinelu.manage.domain.specialdiseasenode.SpecialDiseaseNode;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -18,9 +19,14 @@ public class SpecialDiseaseNodeVO extends SpecialDiseaseNode {
private String taskTypeName;
@ApiModelProperty(value = "任务细分id")
private Long taskPartitionDictId;
private String taskSubdivisionName;
private String taskStatusName;
private String taskSubdivisiontemplateType;
private String flowScheme;
}

View File

@ -0,0 +1,30 @@
package com.xinelu.manage.vo.tasktypedict;
import com.xinelu.manage.domain.taskpartitiondict.TaskPartitionDict;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 任务类型字典对象 task_type_dict
*
* @author xinelu
* @date 2024-03-11
*/
@Data
public class TaskTypeDictVO {
/**
* 主键id
*/
private Long taskTypeId;
/**
* 任务类型名称
*/
@ApiModelProperty(value = "任务类型名称")
private String taskTypeName;
private List<TaskPartitionDict> taskPartitionDictList;
}

View File

@ -312,8 +312,11 @@
<select id="selectByPatientId" resultType="com.xinelu.manage.vo.labelfieldcontent.LabelFieldInfoContentVo">
select
content.field_name,
content.field_code,
info.task_partition_dict_id,
info.task_type_id,
info.apply_range,
content.field_value,
content.portrait_sn
from label_field_content content left join label_field_info info on content.field_id = info.id
@ -357,7 +360,7 @@
<if test="portraitStatus != null">
and lfc.portrait_status = #{portraitStatus}
</if>
Order by tpd.task_partition_sort,lfc.portrait_sn
Order by tpd.task_partition_sort,lfc.portrait_sn,lfi.field_sort
</select>
<insert id="insertLabelFieldContentList">

View File

@ -232,17 +232,19 @@
<select id="selectLabelFieldInfoByTaskPartitionDictId"
resultType="com.xinelu.manage.vo.labelfieldcontent.GroupingValue">
select id labelFieldInfoId,
field_name,
field_code,
field_type,
field_sort,
field_remark,
task_partition_dict_id,
task_partition_dict_name,
task_type_id,
task_type_name
from label_field_info
select lfi.id labelFieldInfoId,
lfi.field_name,
lfi.field_code,
lfi.field_type,
lfi.field_sort,
lfi.field_remark,
lfi.task_partition_dict_id,
lfi.task_partition_dict_name,
lfi.task_type_id,
lfi.task_type_name
from label_field_info lfi
LEFT JOIN task_partition_dict tpd on tpd.id = lfi.task_partition_dict_id
LEFT JOIN task_type_dict ttd on ttd.id = tpd.task_type_id
<where>
<if test="taskPartitionDictId != null and taskPartitionDictId != 0">
and task_partition_dict_id = #{taskPartitionDictId}
@ -251,6 +253,7 @@
and task_partition_dict_id is null
</if>
</where>
Order by ttd.task_type_sort,tpd.task_partition_sort,lfi.field_sort
</select>
<select id="selectLabelFieldNameByTaskPartitionDictIds"

View File

@ -16,10 +16,11 @@
<result property="routeName" column="route_name"/>
<result property="routeNodeId" column="route_node_id"/>
<result property="routeNodeName" column="route_node_name"/>
<result property="sn" column="sn"/>
<result property="paramName" column="param_name"/>
<result property="paramKey" column="param_key"/>
<result property="paramValue" column="param_value"/>
<result property="manageRouteNodeId" column="manage_route_node_id"/>
<result property="portraitSn" column="portrait_sn"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
@ -27,7 +28,7 @@
</resultMap>
<sql id="selectPatientNodeParamsCurrentVo">
select id, patient_id, patient_name, task_partition_dict_id, task_partition_dict_name, task_type_id, task_type_name, route_id, route_name, route_node_id, route_node_name, sn, param_name, param_key, param_value, create_time, update_by, update_time, create_by from patient_node_params_current
select id, patient_id, patient_name, task_partition_dict_id, task_partition_dict_name, task_type_id, task_type_name, route_id, route_name, route_node_id, route_node_name, param_name, param_key, param_value,manage_route_node_id, portrait_sn, create_time, update_by, update_time, create_by from patient_node_params_current
</sql>
<select id="selectPatientNodeParamsCurrentList" parameterType="PatientNodeParamsCurrent" resultMap="PatientNodeParamsCurrentResult">
@ -62,9 +63,6 @@
</if>
<if test="routeNodeName != null and routeNodeName != ''">
and route_node_name like concat('%', #{routeNodeName}, '%')
</if>
<if test="sn != null and sn != ''">
and sn = #{sn}
</if>
<if test="paramName != null and paramName != ''">
and param_name = #{paramName}
@ -107,8 +105,6 @@
<if test="routeNodeId != null">route_node_id,
</if>
<if test="routeNodeName != null">route_node_name,
</if>
<if test="sn != null">sn,
</if>
<if test="paramName != null">param_name,
</if>
@ -116,6 +112,10 @@
</if>
<if test="paramValue != null">param_value,
</if>
<if test="manageRouteNodeId != null">manage_route_node_id,
</if>
<if test="portraitSn != null">portrait_sn,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
@ -145,8 +145,6 @@
<if test="routeNodeId != null">#{routeNodeId},
</if>
<if test="routeNodeName != null">#{routeNodeName},
</if>
<if test="sn != null">#{sn},
</if>
<if test="paramName != null">#{paramName},
</if>
@ -154,6 +152,10 @@
</if>
<if test="paramValue != null">#{paramValue},
</if>
<if test="manageRouteNodeId != null">#{manageRouteNodeId},
</if>
<if test="portraitSn != null">#{portraitSn},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
@ -197,9 +199,6 @@
</if>
<if test="routeNodeName != null">route_node_name =
#{routeNodeName},
</if>
<if test="sn != null">sn =
#{sn},
</if>
<if test="paramName != null">param_name =
#{paramName},
@ -210,6 +209,12 @@
<if test="paramValue != null">param_value =
#{paramValue},
</if>
<if test="manageRouteNodeId != null">manage_route_node_id =
#{manageRouteNodeId},
</if>
<if test="portraitSn != null">portrait_sn =
#{portraitSn},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
@ -241,13 +246,13 @@
insert into patient_node_params_current
(patient_id, patient_name, task_partition_dict_id, task_partition_dict_name,
task_type_id, task_type_name, route_id, route_name, route_node_id, route_node_name,
sn, param_name, param_key, param_value, create_time, update_by, update_time, create_by)
param_name, param_key, param_value, manage_route_node_id, portrait_sn, create_time, update_by, update_time, create_by)
values
<foreach collection="list" separator="," item="item">
(#{item.patientId}, #{item.patientName}, #{item.taskPartitionDictId}, #{item.taskPartitionDictName},
#{item.taskTypeId}, #{item.taskTypeName}, #{item.routeId},
#{item.routeName}, #{item.routeNodeId}, #{item.routeNodeName},
#{item.sn},#{item.paramName},#{item.paramKey},#{item.paramValue}, #{item.createTime}, #{item.updateBy},
#{item.paramName},#{item.paramKey},#{item.paramValue},#{item.manageRouteNodeId},#{item.portraitSn}, #{item.createTime}, #{item.updateBy},
#{item.updateTime}, #{item.createBy}
)
</foreach>

View File

@ -16,10 +16,11 @@
<result property="routeName" column="route_name"/>
<result property="routeNodeId" column="route_node_id"/>
<result property="routeNodeName" column="route_node_name"/>
<result property="sn" column="sn"/>
<result property="paramName" column="param_name"/>
<result property="paramKey" column="param_key"/>
<result property="paramValue" column="param_value"/>
<result property="manageRouteNodeId" column="manage_route_node_id"/>
<result property="portraitSn" column="portrait_sn"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
@ -27,7 +28,7 @@
</resultMap>
<sql id="selectPatientNodeParamsLogVo">
select id, patient_id, patient_name, task_partition_dict_id, task_partition_dict_name, task_type_id, task_type_name, route_id, route_name, route_node_id, route_node_name, sn, param_name, param_key, param_value, create_time, create_by, update_by, update_time from patient_node_params_log
select id, patient_id, patient_name, task_partition_dict_id, task_partition_dict_name, task_type_id, task_type_name, route_id, route_name, route_node_id, route_node_name, param_name, param_key, param_value, manage_route_node_id, portrait_sn, create_time, create_by, update_by, update_time from patient_node_params_log
</sql>
<select id="selectPatientNodeParamsLogList" parameterType="PatientNodeParamsLog" resultMap="PatientNodeParamsLogResult">
@ -62,9 +63,6 @@
</if>
<if test="routeNodeName != null and routeNodeName != ''">
and route_node_name like concat('%', #{routeNodeName}, '%')
</if>
<if test="sn != null and sn != ''">
and sn = #{sn}
</if>
<if test="paramName != null and paramName != ''">
and param_name = #{paramName}
@ -107,8 +105,6 @@
<if test="routeNodeId != null">route_node_id,
</if>
<if test="routeNodeName != null">route_node_name,
</if>
<if test="sn != null">sn,
</if>
<if test="paramName != null">param_name,
</if>
@ -116,6 +112,10 @@
</if>
<if test="paramValue != null">param_value,
</if>
<if test="manageRouteNodeId != null">manage_route_node_id,
</if>
<if test="portraitSn != null">portrait_sn,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
@ -145,8 +145,6 @@
<if test="routeNodeId != null">#{routeNodeId},
</if>
<if test="routeNodeName != null">#{routeNodeName},
</if>
<if test="sn != null">#{sn},
</if>
<if test="paramName != null">#{paramName},
</if>
@ -154,6 +152,10 @@
</if>
<if test="paramValue != null">#{paramValue},
</if>
<if test="manageRouteNodeId != null">#{manageRouteNodeId},
</if>
<if test="portraitSn != null">#{portraitSn},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
@ -197,9 +199,6 @@
</if>
<if test="routeNodeName != null">route_node_name =
#{routeNodeName},
</if>
<if test="sn != null">sn =
#{sn},
</if>
<if test="paramName != null">param_name =
#{paramName},
@ -210,6 +209,12 @@
<if test="paramValue != null">param_value =
#{paramValue},
</if>
<if test="manageRouteNodeId != null">manage_route_node_id =
#{manageRouteNodeId},
</if>
<if test="portraitSn != null">portrait_sn =
#{portraitSn},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
@ -236,18 +241,17 @@
#{id}
</foreach>
</delete>
<insert id="insertList">
insert into patient_node_params_log
(patient_id, patient_name, task_partition_dict_id, task_partition_dict_name,
task_type_id, task_type_name, route_id, route_name, route_node_id, route_node_name,
sn, param_name, param_key, param_value, create_time, create_by, update_by, update_time)
param_name, param_key, param_value, manage_route_node_id, portrait_sn, create_time, create_by, update_by, update_time)
values
<foreach collection="list" separator="," item="item">
(#{item.patientId}, #{item.patientName}, #{item.taskPartitionDictId}, #{item.taskPartitionDictName},
#{item.taskTypeId}, #{item.taskTypeName}, #{item.routeId},
#{item.routeName}, #{item.routeNodeId}, #{item.routeNodeName},
#{item.sn},#{item.paramName},#{item.paramKey},#{item.paramValue}, #{item.createTime}, #{item.createBy}, #{item.updateBy},
#{item.paramName},#{item.paramKey},#{item.paramValue}, #{item.manageRouteNodeId}, #{item.portraitSn}, #{item.createTime}, #{item.createBy}, #{item.updateBy},
#{item.updateTime}
)
</foreach>

View File

@ -331,12 +331,12 @@
spmrn.route_node_name AS 'routeNodeName',
spmrn.task_type,
CASE
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN COALESCE(spmrn.phone_template_name, spmrn.follow_template_name)
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN spmrn.phone_template_name
WHEN spmrn.task_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.questionnaire_name
WHEN spmrn.task_type = 'ARTIFICIAL_FOLLOW_UP' THEN spmrn.follow_template_name
END AS 'templateName',
CASE
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN COALESCE(spmrn.phone_id, spmrn.follow_template_id)
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN spmrn.phone_id
WHEN spmrn.task_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.question_info_id
WHEN spmrn.task_type = 'ARTIFICIAL_FOLLOW_UP' THEN spmrn.follow_template_id
END AS 'templateId',

View File

@ -125,6 +125,7 @@
<result property="taskSubdivisionName" column="taskSubdivisionName"/>
<result property="taskStatusName" column="taskStatusName"/>
<result property="nodeContent" column="node_content"/>
<result property="flowScheme" column="flowScheme"/>
</resultMap>
<sql id="selectSpecialDiseaseNodeVo">
@ -311,6 +312,18 @@
</if>
</where>
</select>
<select id="selectSpeciaDiseaseNodeVoList" parameterType="SpecialDiseaseNode" resultMap="SpecialDiseaseNodeVOResult">
select sdn.*,
tpd.id as taskPartitionDictId,
tpd.task_partition_name as taskSubdivisionName
from special_disease_node sdn
left join task_partition_dict tpd on tpd.task_partition_code = sdn.task_subdivision
<where>
<if test="routeId != null ">
and sdn.route_id = #{routeId}
</if>
</where>
</select>
<select id="selectSpecialDiseaseNodeById" parameterType="Long"
resultMap="SpecialDiseaseNodeResult">
@ -795,7 +808,7 @@
<select id="selectSpecialDiseaseByRouteId"
resultType="com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO"
resultMap="SpecialDiseaseRouteResult">
select sdr.id specialDiseaseRouteId,
select sdr.id specialDiseaseRouteId,
sdr.department_id,
sdr.department_name,
sdr.disease_type_id,
@ -806,7 +819,7 @@
sdr.route_classify,
sdr.release_status,
sdr.suit_range,
sdn.id as specialDiseaseNodeId,
sdn.id as specialDiseaseNodeId,
sdn.route_id,
sdn.route_name,
sdn.route_node_name,
@ -853,16 +866,17 @@
sdn.route_check_remark,
sdn.node_content,
sdn.phone_dial_method,
(select flow_scheme from script_info where id = sdn.phone_template_id) flowScheme,
(select COUNT(1)
from special_disease_node
where route_id = specialDiseaseRouteId) totalNumber,
where route_id = specialDiseaseRouteId) totalNumber,
(select COUNT(1)
from special_disease_node
where route_id = specialDiseaseRouteId
and route_check_status = 'AGREE') agreeNumber,
ttd.task_type_name taskTypeName,
tpd.task_partition_name taskSubdivisionName,
tsd.task_status_name taskStatusName
and route_check_status = 'AGREE') agreeNumber,
ttd.task_type_name taskTypeName,
tpd.task_partition_name taskSubdivisionName,
tsd.task_status_name taskStatusName
from special_disease_route sdr
left join special_disease_node sdn ON sdn.route_id = sdr.id
left join task_type_dict ttd ON ttd.task_type_code = sdn.task_type
@ -917,6 +931,7 @@
<select id="getByParentRouteId" resultType="com.xinelu.manage.vo.specialdiseasenode.RouteTaskAuditVo">
select
sdn.*,
ttd.id taskTypeId,
ttd.task_type_name taskTypeName,
tpd.id taskPartitionDictId,
tpd.task_partition_name taskPartitionDictName

View File

@ -206,4 +206,12 @@
#{id}
</foreach>
</delete>
<select id="selectTaskPartitionList"
resultType="com.xinelu.manage.domain.taskpartitiondict.TaskPartitionDict">
select * from task_partition_dict where task_type_id in
<foreach item="ids" collection="list" open="(" separator="," close=")">
#{ids}
</foreach>
</select>
</mapper>

View File

@ -137,4 +137,10 @@
#{id}
</foreach>
</delete>
<select id="selectTaskTypeDicts" resultType="com.xinelu.manage.vo.tasktypedict.TaskTypeDictVO">
select id taskTypeId,
task_type_name
from task_type_dict
</select>
</mapper>

View File

@ -185,4 +185,13 @@
#{id}
</foreach>
</delete>
<select id="selectTermBankByParentTermCode" resultType="com.xinelu.manage.domain.termbank.TermBank">
<include refid="selectTermBankVo"/>
<where>
<if test="parentTermCode != null and parentTermCode != ''">
and term_code = #{parentTermCode}
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,14 @@
package com.xinelu.mobile.domain;
import lombok.Data;
/**
* 微信内容实体
*/
@Data
public class TemplateContent {
private String name;
private String value;
}

View File

@ -41,7 +41,20 @@ public interface HomePageMapper {
*/
List<SatisfactionQuestionnaire> satisfactionQuestionnaireByResidentId(@Param("residentId") Long residentId, @Param("questionType") String questionType, @Param("questionnaireStatus") String questionnaireStatus);
/**
* 微信小程序订阅消息记录表
*
* @param subscribeStatus 状态
* @param templateId 模版
* @return PatientVO
*/
List<PatientVO> selectResidentAndSubscribeMessageRecord(@Param("subscribeStatus") String subscribeStatus, @Param("templateId") String templateId);
/**
* 患者节点表
*
* @param patientId 患者id
* @return PatientVO
*/
List<PatientVO> selectSignPatientManageRouteNode(@Param("patientId") List<Long> patientId);
}

View File

@ -203,17 +203,8 @@ public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackServ
subscribe.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
subscribe.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());
subscribe.setTemplateId(StringUtils.isBlank(item.getTemplateId()) ? "" : item.getTemplateId());
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getCouponReceiveTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.COUPON_RECEIVE_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getAppointOrderTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.APPOINT_ORDER_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getGoodsOrderTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.GOODS_ORDER_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getSignTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.SIGN_MESSAGE_PUSH.getInfo());
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getFollowTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.FOLLOW_MESSAGE_PUSH.getInfo());
}
subscribe.setSubscribeCount(1);
subscribe.setSubscribeTime(StringUtils.isBlank(weChatMessagePushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(weChatMessagePushVO.getCreateTime()) * 1000L));
@ -232,17 +223,8 @@ public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackServ
subscribe.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
subscribe.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());
subscribe.setTemplateId(StringUtils.isBlank(item.getTemplateId()) ? "" : item.getTemplateId());
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getCouponReceiveTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.COUPON_RECEIVE_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getAppointOrderTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.APPOINT_ORDER_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getGoodsOrderTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.GOODS_ORDER_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getSignTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.SIGN_MESSAGE_PUSH.getInfo());
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getFollowTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.FOLLOW_MESSAGE_PUSH.getInfo());
}
subscribe.setSubscribeCount(1);
subscribe.setSubscribeTime(StringUtils.isBlank(weChatMessagePushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(weChatMessagePushVO.getCreateTime()) * 1000L));

View File

@ -8,15 +8,18 @@ import com.xinelu.common.entity.AccessToken;
import com.xinelu.common.entity.MessageValueEntity;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.http.HttpUtils;
import com.xinelu.mobile.domain.TemplateContent;
import com.xinelu.mobile.vo.wechatofficialaccountcallback.PatientVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@ -187,17 +190,30 @@ public class WeChatOfficialAccountUtils {
* 微信小程序模板消息发送
*/
public void sendAppletTemplateMessage(PatientVO patientVO) {
//微信模版组装
String thing5 = "每日阅读有助于了解当前情况哦";
String thing1 = "新入院注意事项指导、术前须知";
List<TemplateContent> templateContents = JSON.parseArray(patientVO.getAppletNodeContent(), TemplateContent.class);
if (CollectionUtils.isNotEmpty(templateContents)) {
TemplateContent templateContent = templateContents.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getName()) && Objects.nonNull(item.getValue()) && "thing5".equals(item.getName())).findFirst().orElse(new TemplateContent());
thing5 = templateContent.getValue();
TemplateContent templateContentTwo = templateContents.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getName()) && Objects.nonNull(item.getValue()) && "thing5".equals(item.getName())).findFirst().orElse(new TemplateContent());
thing1 = templateContentTwo.getValue();
}
//获取微信小程序的accessToken
String accessToken = this.getWeChatAppletAccessToken();
LocalDateTime now = LocalDateTime.now();
//定义模板内容
Map<String, Object> paramsMap = new LinkedHashMap<>();
paramsMap.put("touser", patientVO.getOpenId());
paramsMap.put("template_id", "S_c9bR4znSWpXg-6ACIMn7AkaR11dzo113XM8w4CKz0");
paramsMap.put("template_id", weChatAppletChatConfig.getHealthyPropagandaId());
paramsMap.put("page", "/postDischarge/homePage/subscriptionMessage?id =" + patientVO.getSignPatientManageRouteNodeId());
Map<String, Object> dataMap = new LinkedHashMap<>();
dataMap.put("thing1", new MessageValueEntity("每日签到"));
dataMap.put("thing2", new MessageValueEntity(LocalDate.now().getYear() + "" + LocalDate.now().getMonthValue() + "" + LocalDate.now().getDayOfMonth() + "日签到成功"));
dataMap.put("thing3", new MessageValueEntity(patientVO.getRouteNodeName() + "" + patientVO.getRouteNodeDay()));
dataMap.put("thing5", new MessageValueEntity(thing5));
dataMap.put("thing4", new MessageValueEntity(patientVO.getHospitalName()));
dataMap.put("time3", new MessageValueEntity(now.getYear() + "" + now.getMonthValue() + "" + now.getDayOfMonth() + "" + now.getHour() + ":" + now.getSecond()));
dataMap.put("thing6", new MessageValueEntity(patientVO.getRouteNodeName() + "" + patientVO.getRouteNodeDay()));
dataMap.put("thing1", new MessageValueEntity(thing1));
paramsMap.put("data", dataMap);
//拼接请求地址并发送
String messageUrl = Constants.OFFICIAL_ACCOUNT_SUBSCRIBE_SEND_URL + accessToken;

View File

@ -1,6 +1,5 @@
package com.xinelu.mobile.vo.wechatofficialaccountcallback;
import com.xinelu.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -9,80 +8,72 @@ import java.time.LocalDate;
@Data
public class PatientVO {
/** 居民表 */
@ApiModelProperty(value = "居民表id")
private Long residentId;
/** 微信标识 */
@ApiModelProperty(value = "微信标识")
private String openId;
/** 患者姓名 */
@ApiModelProperty(value = "患者姓名")
private String patientName;
/** 患者手机号 */
@ApiModelProperty(value = "患者手机号")
private String patientPhone;
/** 患者身份证号 */
@ApiModelProperty(value = "患者身份证号")
private String cardNo;
/** 患者类型 */
@ApiModelProperty(value = "患者类型")
private String patientType;
/** 入院时间 */
@ApiModelProperty(value = "入院时间")
private LocalDate admissionTime;
/** 出院时间 */
@ApiModelProperty(value = "出院时间")
private LocalDate dischargeTime;
/** 就诊时间 */
@ApiModelProperty(value = "就诊时间")
private LocalDate visitDate;
@ApiModelProperty(value = "签约患者管理任务表id")
private Long patientId;
/** 签约患者管理任务表id */
@ApiModelProperty(value = "签约患者管理任务表id")
private Long manageRouteId;
/** 路径名称(任务名称) */
@ApiModelProperty(value = "路径名称")
private String manageRouteName;
/** 管理路径节点名称 */
@ApiModelProperty(value = "管理路径节点名称")
private String routeNodeName;
/** 管理路径节点时间,时间单位为:天 */
@ApiModelProperty(value = "管理路径节点时间,时间单位为:天")
private Integer routeNodeDay;
/** 任务类型 */
@ApiModelProperty(value = "任务类型")
private String taskType;
/** 任务状态 */
@ApiModelProperty(value = "任务状态")
private String taskStatus;
/** 任务细分 */
@ApiModelProperty(value = "任务细分")
private String taskSubdivision;
/** 公众号推送标识0未开启1已开启 */
@ApiModelProperty(value = "公众号推送标识0未开启1已开启")
private Integer officialPushSign;
/** 小程序推送标识0未开启1已开启 */
@ApiModelProperty(value = "小程序推送标识0未开启1已开启")
private Integer appletPushSign;
/**
* 节点内容
*/
@ApiModelProperty(value = "节点内容")
private String nodeContent;
@ApiModelProperty(value = "节点id")
private Long signPatientManageRouteNodeId;
@ApiModelProperty(value = "医院名称")
private String hospitalName;
@ApiModelProperty(value = "微信内容")
private String appletNodeContent;
}

View File

@ -118,7 +118,7 @@
spmrn.applet_push_sign,
spmrn.node_content,
spmrn.node_execute_status,
spmr.patient_id
spmrn.applet_node_content
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

View File

@ -30,18 +30,25 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
@Resource
private WeChatOfficialAccountUtils weChatOfficialAccountUtils;
/**
* 推送任务组装数据
*/
public void signPatientManageRouteNodeTask() {
List<PatientVO> patient = homePageMapper.selectResidentAndSubscribeMessageRecord(SubscribeStatusEnum.accept.getValue(), weChatAppletChatConfig.getSignTemplateId());
//微信小程序订阅消息记录表
List<PatientVO> patient = homePageMapper.selectResidentAndSubscribeMessageRecord(SubscribeStatusEnum.accept.getValue(), weChatAppletChatConfig.getFollowTemplateId());
List<Long> collect = patient.stream().filter(Objects::nonNull).map(PatientVO::getPatientId).filter(Objects::nonNull).collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect)) {
return;
}
//患者节点表
List<PatientVO> signPatientManageRouteNodes = homePageMapper.selectSignPatientManageRouteNode(collect);
List<PatientVO> patientVOS = new ArrayList<>();
for (PatientVO signPatientManageRouteNode : signPatientManageRouteNodes) {
//判断推送状态
if (Objects.isNull(signPatientManageRouteNode.getAppletPushSign()) || signPatientManageRouteNode.getAppletPushSign() != 1) {
continue;
}
//判断路径节点组装数据
if (signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_DISCHARGE.getInfo()) || signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_VISIT_DISCHARGE.getInfo())) {
PatientVO patientVO = patient.stream().filter(Objects::nonNull).filter(item -> signPatientManageRouteNode.getPatientId().equals(item.getPatientId())).findFirst().orElse(new PatientVO());
if (patientVO.getPatientType().equals(PatientTypeEnum.DISCHARGED_PATIENT.getInfo())) {
@ -76,6 +83,7 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
}
}
}
//发送
for (PatientVO patientVO : patientVOS) {
weChatOfficialAccountUtils.sendAppletTemplateMessage(patientVO);
}