diff --git a/postdischarge-admin/src/main/resources/application.yml b/postdischarge-admin/src/main/resources/application.yml index 600d7108..61984149 100644 --- a/postdischarge-admin/src/main/resources/application.yml +++ b/postdischarge-admin/src/main/resources/application.yml @@ -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: diff --git a/postdischarge-common/src/main/java/com/xinelu/common/config/WeChatAppletChatConfig.java b/postdischarge-common/src/main/java/com/xinelu/common/config/WeChatAppletChatConfig.java index d2db2da6..939fd2d2 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/config/WeChatAppletChatConfig.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/config/WeChatAppletChatConfig.java @@ -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; } diff --git a/postdischarge-common/src/main/java/com/xinelu/common/enums/PatientSexEnum.java b/postdischarge-common/src/main/java/com/xinelu/common/enums/PatientSexEnum.java index 6ef306c3..76909505 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/enums/PatientSexEnum.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/enums/PatientSexEnum.java @@ -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; } } diff --git a/postdischarge-common/src/main/java/com/xinelu/common/enums/SubscribeMessageTypeEnum.java b/postdischarge-common/src/main/java/com/xinelu/common/enums/SubscribeMessageTypeEnum.java index a2ce93f0..ba10629c 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/enums/SubscribeMessageTypeEnum.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/enums/SubscribeMessageTypeEnum.java @@ -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; diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/labelfieldcontent/LabelFieldContentController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/labelfieldcontent/LabelFieldContentController.java index e17d7723..5414d6dc 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/labelfieldcontent/LabelFieldContentController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/labelfieldcontent/LabelFieldContentController.java @@ -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>> getPortaitByPatient(Long patientId) { - return R.ok(labelFieldContentService.getPortaitByPatient(patientId)); - } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/labelfieldinfo/LabelFieldInfoController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/labelfieldinfo/LabelFieldInfoController.java index cd525f84..a83e7042 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/labelfieldinfo/LabelFieldInfoController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/labelfieldinfo/LabelFieldInfoController.java @@ -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(); + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientnodeparamscurrent/PatientNodeParamsCurrent.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientnodeparamscurrent/PatientNodeParamsCurrent.java index eaa79125..a84e0d6e 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientnodeparamscurrent/PatientNodeParamsCurrent.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientnodeparamscurrent/PatientNodeParamsCurrent.java @@ -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; + } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientnodeparamslog/PatientNodeParamsLog.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientnodeparamslog/PatientNodeParamsLog.java index c5f49518..8b169264 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientnodeparamslog/PatientNodeParamsLog.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientnodeparamslog/PatientNodeParamsLog.java @@ -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; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientrecord/PortaitCheckDto.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientrecord/PortaitCheckDto.java index ad2dadd5..7b768579 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientrecord/PortaitCheckDto.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientrecord/PortaitCheckDto.java @@ -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> labelFieldContentList; + private List labelFieldAndPartitionDictList; @ApiModelProperty("患者主键") private Long patientId; diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/specialdiseasenode/SpecialDiseaseNodeMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/specialdiseasenode/SpecialDiseaseNodeMapper.java index a1350f56..6fa35598 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/specialdiseasenode/SpecialDiseaseNodeMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/specialdiseasenode/SpecialDiseaseNodeMapper.java @@ -32,6 +32,7 @@ public interface SpecialDiseaseNodeMapper { */ List selectSpecialDiseaseNodeList(SpecialDiseaseNode specialDiseaseNode); + List selectSpeciaDiseaseNodeVoList(SpecialDiseaseNode specialDiseaseNode); /** * 新增专病路径-管理节点信息 * diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/taskpartitiondict/TaskPartitionDictMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/taskpartitiondict/TaskPartitionDictMapper.java index 413096b9..4ec120fa 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/taskpartitiondict/TaskPartitionDictMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/taskpartitiondict/TaskPartitionDictMapper.java @@ -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 selectTaskPartitionList( List ids); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/tasktypedict/TaskTypeDictMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/tasktypedict/TaskTypeDictMapper.java index 36374dfb..365b1b94 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/tasktypedict/TaskTypeDictMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/tasktypedict/TaskTypeDictMapper.java @@ -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 selectTaskTypeDicts(); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/termbank/TermBankMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/termbank/TermBankMapper.java index fd15fa23..ee5d0d86 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/termbank/TermBankMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/termbank/TermBankMapper.java @@ -64,4 +64,12 @@ public interface TermBankMapper { * @return 结果 */ int deleteTermBankByIds(Long[] ids); + + /** + * 查询父级信息 + * + * @param parentTermCode 父级编号 + * @return TermBank + */ + TermBank selectTermBankByParentTermCode(String parentTermCode); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/ILabelFieldContentService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/ILabelFieldContentService.java index 7b17e7a3..885291b1 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/ILabelFieldContentService.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/ILabelFieldContentService.java @@ -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> getPortaitByPatient(Long patientId); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/impl/LabelFieldContentServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/impl/LabelFieldContentServiceImpl.java index f7bad8fd..20980ed7 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/impl/LabelFieldContentServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/impl/LabelFieldContentServiceImpl.java @@ -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 nodeList = signPatientManageRouteNodeMapper.getNodeList(patientTaskDto); + List 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 = 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 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 PortraitSnVOS = new ArrayList<>(); List 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 collect = labelFieldContentList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getTaskPartitionDictId())).map(LabelFieldInfo::getTaskPartitionDictId).distinct().collect(Collectors.toList()); List labelFieldAndPartitionDictList = new ArrayList<>(); - LabelFieldAndPartitionDict labelFieldAndPartitionDict = new LabelFieldAndPartitionDict(); - labelFieldAndPartitionDict.setPortraitSnVOList(PortraitSnVOS); - labelFieldAndPartitionDictList.add(labelFieldAndPartitionDict); + for (Long aLong : collect) { + List PortraitSnVOS = new ArrayList<>(); + LabelFieldAndPartitionDict labelFieldAndPartitionDict = new LabelFieldAndPartitionDict(); + PortraitSnVO portraitSnVO = new PortraitSnVO(); + List 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> getPortaitByPatient(Long patientId) { - //List>>> retMap = new ArrayList<>(); - List> retList = new ArrayList<>(); - List labelFieldContents = labelFieldContentMapper.groupingValue(0L, patientId, null); - if (CollectionUtils.isEmpty(labelFieldContents)) { - return null; - } - retList.add(labelFieldContents); - // 按照任务细分分组 - //Map> groupByPartition = labelFieldContents.stream().collect(Collectors.groupingBy(GroupingValue::getTaskPartitionDictId)); - - //for (Long taskPartitionDictId : groupByPartition.keySet()) { - // Map>> retObj = new HashMap<>(); - // List> lists = new ArrayList<>(); - // // 按照sn分组 - // List partitionList = groupByPartition.get(taskPartitionDictId); - // Map> 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; - } - /** * 根据任务细分类型获取患者的真实信息 * diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldinfo/ILabelFieldInfoService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldinfo/ILabelFieldInfoService.java index 22e55ea6..161964c5 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldinfo/ILabelFieldInfoService.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldinfo/ILabelFieldInfoService.java @@ -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(); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldinfo/impl/LabelFieldInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldinfo/impl/LabelFieldInfoServiceImpl.java index 8ee8f694..4a21119a 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldinfo/impl/LabelFieldInfoServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldinfo/impl/LabelFieldInfoServiceImpl.java @@ -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 taskTypeDictList = taskTypeDictMapper.selectTaskTypeDicts(); + List ids = taskTypeDictList.stream().filter(Objects::nonNull).map(TaskTypeDictVO::getTaskTypeId).filter(Objects::nonNull).collect(Collectors.toList()); + List taskPartitionDicts = taskPartitionDictMapper.selectTaskPartitionList(ids); + if (CollectionUtils.isEmpty(taskPartitionDicts)) { + return AjaxResult.success(taskPartitionDicts); + } + for (TaskTypeDictVO taskTypeDictVO : taskTypeDictList) { + List 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); + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java index 63990ab4..33f06ee2 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java @@ -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 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 replaceNodeContent(SignPatientManageNodeAuditVo manageRouteNode, RouteTaskAuditVo node, List labelFieldContentList) { - List manageNodeList = new ArrayList<>(); - // 按照任务细分分组 - Map> groupbyPartition = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId)); - List nodeParamList = groupbyPartition.get(node.getTaskPartitionDictId()); - // 参数按照序列号分组 - if (CollectionUtils.isNotEmpty(nodeParamList)) { - Map> groupBySn = nodeParamList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getPortraitSn)); - - for (String portraitSn : groupBySn.keySet()) { - SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo(); - BeanUtils.copyBeanProp(manageNode, manageRouteNode); - // 替换文本 - List nodeParams = groupBySn.get(portraitSn); - Map 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; - } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/ISignPatientManageRouteNodeService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/ISignPatientManageRouteNodeService.java index 3e20a3e7..f40ddf02 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/ISignPatientManageRouteNodeService.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/ISignPatientManageRouteNodeService.java @@ -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 replaceNodeContent(SignPatientManageNodeAuditVo manageRouteNode, Long taskPartitionDictId, List labelFieldContentList); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java index 8ba26c99..c24a6a51 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java @@ -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 nodeList = specialDiseaseNodeMapper.selectSpecialDiseaseNodeList(specialDiseaseNodeQuery); + List nodeList = specialDiseaseNodeMapper.selectSpeciaDiseaseNodeVoList(specialDiseaseNodeQuery); // 查询患者画像信息 List 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 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 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 replaceNodeContent(SignPatientManageRouteNode manageRouteNode, SpecialDiseaseNode node, List labelFieldContentList) { - List manageNodeList = new ArrayList<>(); - // 按照任务细分分组 - Map> groupbyPartition = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId)); - List nodeParamList = groupbyPartition.get(node.getTaskSubdivision()); - // 参数按照序列号分组 - if (CollectionUtils.isNotEmpty(nodeParamList)) { - Map> groupBySn = nodeParamList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getPortraitSn)); + @Override + public List replaceNodeContent(SignPatientManageNodeAuditVo manageRouteNode, Long taskPartitionDictId, List labelFieldContentList) { + List manageNodeList = new ArrayList<>(); + Map> groupByRang = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getApplyRange)); + // 筛选应用范围是否有私用的画像 + List privateLabelFields = groupByRang.get("PRIVATE"); + List publicLabelFields = groupByRang.get("PUBLIC"); + + // 按照sn进行分组,判断生成几条任务 + Map> groupByPartition = privateLabelFields.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId)); + List nodeLabelFieldContent = groupByPartition.get(taskPartitionDictId); + if (CollectionUtils.isEmpty(privateLabelFields) || CollectionUtils.isEmpty(nodeLabelFieldContent)) { + // 都是公有属性,只生成一条任务 + SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo(); + BeanUtils.copyBeanProp(manageNode, manageRouteNode); + // 替换文本 + Map 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> 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 nodeParams = groupBySn.get(portraitSn); + nodeParams.addAll(publicLabelFields); + Map map = nodeParams.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo::getFieldValue,(key1,key2)->key2)); Document document = Jsoup.parse(manageNode.getNodeContent()); // 需要提取的span diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java index 5b28a20e..56e0d92e 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java @@ -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 manageRouteList = signPatientManageRouteMapper.selectSignPatientManageRouteList(manageRouteQuery); + if (CollectionUtils.isEmpty(manageRouteList)) { + throw new ServiceException("未找到签约路径,请联系管理员"); + } + SignPatientManageRoute signPatientManageRoute = manageRouteList.get(0); + List nodeList = specialDiseaseNodeMapper.getByParentRouteId(signPatientManageRoute.getRouteId()); + List paramsCurrentList = new ArrayList<>(); + List paramsLogList = new ArrayList<>(); + + // 查询画像信息 + List labelFieldContentList = labelFieldContentMapper.selectByPatientId(signPatientRecord.getPatientId()); + if (!CollectionUtils.isEmpty(labelFieldContentList)) { + // 按照公共私用分组 + Map> groupByRang = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getApplyRange)); + // 筛选应用范围是否有私用的画像 + List privateLabelFields = groupByRang.get("PRIVATE"); + List publicLabelFields = groupByRang.get("PUBLIC"); + + Map> groupByPartition = privateLabelFields.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId)); + nodeList.forEach(node -> { + List 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 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> 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 snLabelField = groupBySn.get(sn); + snLabelField.addAll(publicLabelFields); + Map 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); + } + } + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/specialdiseasenode/impl/SpecialDiseaseNodeServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/specialdiseasenode/impl/SpecialDiseaseNodeServiceImpl.java index 10adf70d..f7dcf55b 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/specialdiseasenode/impl/SpecialDiseaseNodeServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/specialdiseasenode/impl/SpecialDiseaseNodeServiceImpl.java @@ -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 longs = specialDiseaseNodeMapper.selectSpecialDiseaseRouteIds(specialDiseaseNode.getSpecialDiseaseRouteId()); SpecialDiseaseRoute specialDiseaseRoute = new SpecialDiseaseRoute(); @@ -156,20 +155,18 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService List 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 getByParentRouteId(Long parentRouteId) { - return specialDiseaseNodeMapper.getByParentRouteId(parentRouteId); - } + @Override + public List 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; } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/termbank/impl/TermBankServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/termbank/impl/TermBankServiceImpl.java index 802051d3..1732cb7f 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/termbank/impl/TermBankServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/termbank/impl/TermBankServiceImpl.java @@ -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()); diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/labelfieldcontent/LabelFieldInfoContentVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/labelfieldcontent/LabelFieldInfoContentVo.java index edf5c694..12fc9e55 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/labelfieldcontent/LabelFieldInfoContentVo.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/labelfieldcontent/LabelFieldInfoContentVo.java @@ -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; + } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/specialdiseasenode/RouteTaskAuditVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/specialdiseasenode/RouteTaskAuditVo.java index 4f1761b0..a23d7a78 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/specialdiseasenode/RouteTaskAuditVo.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/specialdiseasenode/RouteTaskAuditVo.java @@ -12,6 +12,12 @@ import lombok.Data; @Data public class RouteTaskAuditVo extends SpecialDiseaseNode { + /** + * 任务类型id + */ + @ApiModelProperty(value = "任务类型id") + private Long taskTypeId; + /** * 任务类型名称 */ diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/specialdiseasenode/SpecialDiseaseNodeVO.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/specialdiseasenode/SpecialDiseaseNodeVO.java index ed28b426..b12537b1 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/specialdiseasenode/SpecialDiseaseNodeVO.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/specialdiseasenode/SpecialDiseaseNodeVO.java @@ -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; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/tasktypedict/TaskTypeDictVO.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/tasktypedict/TaskTypeDictVO.java new file mode 100644 index 00000000..150d5c9d --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/tasktypedict/TaskTypeDictVO.java @@ -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 taskPartitionDictList; +} diff --git a/postdischarge-manage/src/main/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml index bf330aa4..14bbac09 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml @@ -312,8 +312,11 @@ diff --git a/postdischarge-manage/src/main/resources/mapper/manage/labelfieldinfo/LabelFieldInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/labelfieldinfo/LabelFieldInfoMapper.xml index d3877b1e..d8de48b8 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/labelfieldinfo/LabelFieldInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/labelfieldinfo/LabelFieldInfoMapper.xml @@ -232,17 +232,19 @@ @@ -62,9 +63,6 @@ and route_node_name like concat('%', #{routeNodeName}, '%') - - - and sn = #{sn} and param_name = #{paramName} @@ -107,8 +105,6 @@ route_node_id, route_node_name, - - sn, param_name, @@ -116,6 +112,10 @@ param_value, + manage_route_node_id, + + portrait_sn, + create_time, update_by, @@ -145,8 +145,6 @@ #{routeNodeId}, #{routeNodeName}, - - #{sn}, #{paramName}, @@ -154,6 +152,10 @@ #{paramValue}, + #{manageRouteNodeId}, + + #{portraitSn}, + #{createTime}, #{updateBy}, @@ -197,9 +199,6 @@ route_node_name = #{routeNodeName}, - - sn = - #{sn}, param_name = #{paramName}, @@ -210,6 +209,12 @@ param_value = #{paramValue}, + manage_route_node_id = + #{manageRouteNodeId}, + + portrait_sn = + #{portraitSn}, + create_time = #{createTime}, @@ -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 (#{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} ) diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientnodeparamslog/PatientNodeParamsLogMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientnodeparamslog/PatientNodeParamsLogMapper.xml index 8eb2ed88..b06f37b6 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientnodeparamslog/PatientNodeParamsLogMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientnodeparamslog/PatientNodeParamsLogMapper.xml @@ -16,10 +16,11 @@ - + + @@ -27,7 +28,7 @@ - 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 + - 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 * from task_partition_dict where task_type_id in + + #{ids} + + \ No newline at end of file diff --git a/postdischarge-manage/src/main/resources/mapper/manage/tasktypedict/TaskTypeDictMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/tasktypedict/TaskTypeDictMapper.xml index cb78a349..ac764fb3 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/tasktypedict/TaskTypeDictMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/tasktypedict/TaskTypeDictMapper.xml @@ -137,4 +137,10 @@ #{id} + + \ No newline at end of file diff --git a/postdischarge-manage/src/main/resources/mapper/manage/termbank/TermBankMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/termbank/TermBankMapper.xml index 49b11ae2..cbb13cff 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/termbank/TermBankMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/termbank/TermBankMapper.xml @@ -185,4 +185,13 @@ #{id} + + \ No newline at end of file diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/domain/TemplateContent.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/domain/TemplateContent.java new file mode 100644 index 00000000..9243e4d0 --- /dev/null +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/domain/TemplateContent.java @@ -0,0 +1,14 @@ +package com.xinelu.mobile.domain; + +import lombok.Data; + +/** + * 微信内容实体 + */ +@Data +public class TemplateContent { + + private String name; + + private String value; +} \ No newline at end of file diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/mapper/homepage/HomePageMapper.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/mapper/homepage/HomePageMapper.java index a6796b59..b324f34e 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/mapper/homepage/HomePageMapper.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/mapper/homepage/HomePageMapper.java @@ -41,7 +41,20 @@ public interface HomePageMapper { */ List satisfactionQuestionnaireByResidentId(@Param("residentId") Long residentId, @Param("questionType") String questionType, @Param("questionnaireStatus") String questionnaireStatus); + /** + * 微信小程序订阅消息记录表 + * + * @param subscribeStatus 状态 + * @param templateId 模版 + * @return PatientVO + */ List selectResidentAndSubscribeMessageRecord(@Param("subscribeStatus") String subscribeStatus, @Param("templateId") String templateId); + /** + * 患者节点表 + * + * @param patientId 患者id + * @return PatientVO + */ List selectSignPatientManageRouteNode(@Param("patientId") List patientId); } \ No newline at end of file diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/wechatappletcallback/impl/WeChatAppletCallBackServiceImpl.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/wechatappletcallback/impl/WeChatAppletCallBackServiceImpl.java index 56c427dd..501225ef 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/wechatappletcallback/impl/WeChatAppletCallBackServiceImpl.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/wechatappletcallback/impl/WeChatAppletCallBackServiceImpl.java @@ -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)); diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/utils/WeChatOfficialAccountUtils.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/utils/WeChatOfficialAccountUtils.java index ba8ec775..36aacd0b 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/utils/WeChatOfficialAccountUtils.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/utils/WeChatOfficialAccountUtils.java @@ -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 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 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 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; diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/vo/wechatofficialaccountcallback/PatientVO.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/vo/wechatofficialaccountcallback/PatientVO.java index 83abc4bf..6fed97de 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/vo/wechatofficialaccountcallback/PatientVO.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/vo/wechatofficialaccountcallback/PatientVO.java @@ -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; } diff --git a/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml b/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml index 7ed0eddf..74424dbd 100644 --- a/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml +++ b/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml @@ -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 diff --git a/postdischarge-quartz/src/main/java/com/xinelu/quartz/service/impl/subscribeTaskServiceImpl.java b/postdischarge-quartz/src/main/java/com/xinelu/quartz/service/impl/subscribeTaskServiceImpl.java index 3e9fe107..ed936a54 100644 --- a/postdischarge-quartz/src/main/java/com/xinelu/quartz/service/impl/subscribeTaskServiceImpl.java +++ b/postdischarge-quartz/src/main/java/com/xinelu/quartz/service/impl/subscribeTaskServiceImpl.java @@ -30,18 +30,25 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService { @Resource private WeChatOfficialAccountUtils weChatOfficialAccountUtils; + /** + * 推送任务组装数据 + */ public void signPatientManageRouteNodeTask() { - List patient = homePageMapper.selectResidentAndSubscribeMessageRecord(SubscribeStatusEnum.accept.getValue(), weChatAppletChatConfig.getSignTemplateId()); + //微信小程序订阅消息记录表 + List patient = homePageMapper.selectResidentAndSubscribeMessageRecord(SubscribeStatusEnum.accept.getValue(), weChatAppletChatConfig.getFollowTemplateId()); List collect = patient.stream().filter(Objects::nonNull).map(PatientVO::getPatientId).filter(Objects::nonNull).collect(Collectors.toList()); if (CollectionUtils.isEmpty(collect)) { return; } + //患者节点表 List signPatientManageRouteNodes = homePageMapper.selectSignPatientManageRouteNode(collect); List 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); }