From 047dd1a4655b16560e170252fa53920b473dab15 Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Tue, 2 Jul 2024 08:52:41 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=EF=BC=8C=E8=B7=AF=E5=BE=84=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=BF=9D=E5=AD=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PatientNodeParamsCurrent.java | 25 +++--- .../PatientNodeParamsLog.java | 10 +++ .../signpatientrecord/PortaitCheckDto.java | 4 +- ...SignPatientManageRouteNodeServiceImpl.java | 19 +++-- .../impl/SignPatientRecordServiceImpl.java | 78 ++++++++++++++++--- .../LabelFieldInfoContentVo.java | 12 +++ .../LabelFieldContentMapper.xml | 2 + .../PatientNodeParamsCurrentMapper.xml | 33 ++++---- .../PatientNodeParamsLogMapper.xml | 34 ++++---- 9 files changed, 154 insertions(+), 63 deletions(-) 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/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java index 8ba26c99..6a9384ca 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 @@ -553,15 +553,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); @@ -785,6 +785,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())) { 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..d5ea6b08 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; @@ -91,9 +92,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 @@ -393,14 +392,8 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { @Transactional(rollbackFor = Exception.class) public int updatePortaitCheckStatus(PortaitCheckDto portaitCheckDto) { // 画像信息保存 - if (CollectionUtils.isEmpty(portaitCheckDto.getLabelFieldContentList())) { - throw new ServiceException("请输入画像信息"); - } - if (StringUtils.isBlank(portaitCheckDto.getPortaitCheckStatus())) { - throw new ServiceException("请输入审核信息"); - } LabelField labelField = new LabelField(); - labelField.setGroupingValues(portaitCheckDto.getLabelFieldContentList()); + labelField.setLabelFieldAndPartitionDictList(portaitCheckDto.getLabelFieldAndPartitionDictList()); labelFieldContentService.insertLabelField(labelField); // 修改签约记录 @@ -408,6 +401,11 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { 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 +417,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { // 替换手动生成的任务中的标签 signPatientManageRouteNodeService.manualCreateTaskLabelReplace(portaitCheckDto.getSignPatientRecordId()); } + return flag; } @@ -442,4 +441,59 @@ 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> groupByPartition = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId)); + nodeList.forEach(node -> { + PatientNodeParamsCurrent paramsCurrent = new PatientNodeParamsCurrent(); + // 根据任务细分查询节点参数 + List nodeLabelFields = groupByPartition.get(node.getTaskPartitionDictId()); + nodeLabelFields.forEach(nodeLabelField -> { + paramsCurrent.setPatientId(signPatientRecord.getPatientId()); + paramsCurrent.setPatientName(signPatientRecord.getPatientName()); + paramsCurrent.setTaskPartitionDictId(nodeLabelField.getTaskPartitionDictId()); + paramsCurrent.setTaskPartitionDictName(node.getTaskPartitionDictName()); + paramsCurrent.setTaskTypeId(nodeLabelField.getTaskTypeId()); + paramsCurrent.setTaskTypeName(node.getTaskTypeName()); + paramsCurrent.setRouteId(node.getRouteId()); + paramsCurrent.setRouteName(node.getRouteName()); + paramsCurrent.setRouteNodeId(node.getId()); + paramsCurrent.setRouteNodeName(node.getRouteNodeName()); + paramsCurrent.setParamKey(nodeLabelField.getFieldCode()); + paramsCurrent.setParamValue(nodeLabelField.getFieldValue()); + paramsCurrent.setParamName(nodeLabelField.getFieldName()); + paramsCurrent.setPortraitSn(nodeLabelField.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/vo/labelfieldcontent/LabelFieldInfoContentVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/labelfieldcontent/LabelFieldInfoContentVo.java index edf5c694..9e8d6c8d 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 */ 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..4fef2eff 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,10 @@ @@ -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 + + + + and term_code = #{parentTermCode} + + + \ No newline at end of file From b60414e5bc3781aa495d96236617610e58c31001 Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Tue, 2 Jul 2024 14:33:42 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- postdischarge-admin/src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postdischarge-admin/src/main/resources/application.yml b/postdischarge-admin/src/main/resources/application.yml index 6e907cdc..c9d79cb8 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: From 236f2ad95807602a6488ad585decd123059a1ec3 Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Tue, 2 Jul 2024 18:13:17 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 12 ++---- .../common/config/WeChatAppletChatConfig.java | 18 ++------- .../enums/SubscribeMessageTypeEnum.java | 18 ++------- .../LabelFieldContentMapper.xml | 2 +- .../xinelu/mobile/domain/TemplateContent.java | 14 +++++++ .../mapper/homepage/HomePageMapper.java | 13 +++++++ .../impl/WeChatAppletCallBackServiceImpl.java | 26 ++----------- .../utils/WeChatOfficialAccountUtils.java | 26 ++++++++++--- .../PatientVO.java | 39 +++++++------------ .../mapper/homepage/HomePageMapper.xml | 2 +- .../impl/subscribeTaskServiceImpl.java | 10 ++++- 11 files changed, 90 insertions(+), 90 deletions(-) create mode 100644 postdischarge-mobile/src/main/java/com/xinelu/mobile/domain/TemplateContent.java diff --git a/postdischarge-admin/src/main/resources/application.yml b/postdischarge-admin/src/main/resources/application.yml index c9d79cb8..f9d0fd12 100644 --- a/postdischarge-admin/src/main/resources/application.yml +++ b/postdischarge-admin/src/main/resources/application.yml @@ -203,14 +203,10 @@ 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 + # 随访模板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/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/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml index bf330aa4..9fa13096 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml @@ -357,7 +357,7 @@ and lfc.portrait_status = #{portraitStatus} - Order by tpd.task_partition_sort,lfc.portrait_sn + Order by tpd.task_partition_sort,lfc.portrait_sn,lfc.content_sort 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); } From 569e60a0ebd5f49f756cd74b72f42341aebf4441 Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Wed, 3 Jul 2024 14:29:23 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E6=9A=82=E5=AD=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...SignPatientManageRouteNodeServiceImpl.java | 54 +++++++++++++------ 1 file changed, 39 insertions(+), 15 deletions(-) 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 6a9384ca..b52647a8 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; @@ -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)) { @@ -824,7 +826,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage // 替换nodeContent List manageNodeList = new ArrayList<>(); if (StringUtils.contains(node.getNodeContent(), "data-w-e-type")) { - manageNodeList = replaceNodeContent(manageRouteNode, node, labelFieldContentList); + manageNodeList = replaceNodeContent(manageRouteNode, node.getTaskPartitionDictId(), labelFieldContentList); } else { manageNodeList.add(manageRouteNode); } @@ -863,7 +865,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()); } } } @@ -887,7 +889,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; @@ -910,7 +912,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)); } } @@ -931,7 +933,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)) { - templateContent = templateContent.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue()); + templateContent = templateContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue()); } } return templateContent; @@ -939,24 +941,46 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage /** * 替换节点内容 - * @param node 节点 + * @param taskPartitionDictId 节点任务细分id * @param labelFieldContentList 画像信息 * @return 替换标签后的节点列表 */ - private List replaceNodeContent(SignPatientManageRouteNode manageRouteNode, SpecialDiseaseNode node, List labelFieldContentList) { + private List replaceNodeContent(SignPatientManageRouteNode manageRouteNode, Long taskPartitionDictId, 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)); + 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 From ce84a8c97fc7ca9b57acf02bdc8e19837ba172c6 Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Wed, 3 Jul 2024 15:09:47 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xinelu/common/enums/PatientSexEnum.java | 2 +- .../LabelFieldContentController.java | 12 +- .../SpecialDiseaseNodeMapper.java | 1 + .../ILabelFieldContentService.java | 6 - .../impl/LabelFieldContentServiceImpl.java | 27 ---- .../SignPatientManageRouteServiceImpl.java | 68 +++------- .../ISignPatientManageRouteNodeService.java | 11 ++ ...SignPatientManageRouteNodeServiceImpl.java | 24 ++-- .../impl/SignPatientRecordServiceImpl.java | 117 ++++++++++++++---- .../LabelFieldInfoContentVo.java | 6 + .../specialdiseasenode/RouteTaskAuditVo.java | 6 + .../SpecialDiseaseNodeVO.java | 4 + .../LabelFieldContentMapper.xml | 3 +- .../SpecialDiseaseNodeMapper.xml | 13 ++ 14 files changed, 166 insertions(+), 134 deletions(-) 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-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/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/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..1ed73eca 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 @@ -296,33 +296,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/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 b52647a8..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 @@ -826,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.getTaskPartitionDictId(), 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); } @@ -940,13 +948,15 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage } /** - * 替换节点内容 - * @param taskPartitionDictId 节点任务细分id - * @param labelFieldContentList 画像信息 - * @return 替换标签后的节点列表 + * 替换节点标签内容 + * @param manageRouteNode 签约管理路径节点 + * @param taskPartitionDictId 专病节点任务细分 + * @param labelFieldContentList 患者画像 + * @return 签约路径节点列表 */ - private List replaceNodeContent(SignPatientManageRouteNode manageRouteNode, Long taskPartitionDictId, List labelFieldContentList) { - List manageNodeList = new ArrayList<>(); + @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"); 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 d5ea6b08..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 @@ -57,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; @@ -193,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); @@ -392,9 +397,11 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { @Transactional(rollbackFor = Exception.class) public int updatePortaitCheckStatus(PortaitCheckDto portaitCheckDto) { // 画像信息保存 - LabelField labelField = new LabelField(); - labelField.setLabelFieldAndPartitionDictList(portaitCheckDto.getLabelFieldAndPartitionDictList()); - labelFieldContentService.insertLabelField(labelField); + if (StringUtils.equals(RouteCheckStatusEnum.AGREE.getInfo(), portaitCheckDto.getPortaitCheckStatus())) { + LabelField labelField = new LabelField(); + labelField.setLabelFieldAndPartitionDictList(portaitCheckDto.getLabelFieldAndPartitionDictList()); + labelFieldContentService.insertLabelField(labelField); + } // 修改签约记录 SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(portaitCheckDto.getSignPatientRecordId()); @@ -463,32 +470,88 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { // 查询画像信息 List labelFieldContentList = labelFieldContentMapper.selectByPatientId(signPatientRecord.getPatientId()); if (!CollectionUtils.isEmpty(labelFieldContentList)) { - // 按照任务细分分组 - Map> groupByPartition = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId)); + // 按照公共私用分组 + 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 -> { - PatientNodeParamsCurrent paramsCurrent = new PatientNodeParamsCurrent(); - // 根据任务细分查询节点参数 List nodeLabelFields = groupByPartition.get(node.getTaskPartitionDictId()); - nodeLabelFields.forEach(nodeLabelField -> { - paramsCurrent.setPatientId(signPatientRecord.getPatientId()); - paramsCurrent.setPatientName(signPatientRecord.getPatientName()); - paramsCurrent.setTaskPartitionDictId(nodeLabelField.getTaskPartitionDictId()); - paramsCurrent.setTaskPartitionDictName(node.getTaskPartitionDictName()); - paramsCurrent.setTaskTypeId(nodeLabelField.getTaskTypeId()); - paramsCurrent.setTaskTypeName(node.getTaskTypeName()); - paramsCurrent.setRouteId(node.getRouteId()); - paramsCurrent.setRouteName(node.getRouteName()); - paramsCurrent.setRouteNodeId(node.getId()); - paramsCurrent.setRouteNodeName(node.getRouteNodeName()); - paramsCurrent.setParamKey(nodeLabelField.getFieldCode()); - paramsCurrent.setParamValue(nodeLabelField.getFieldValue()); - paramsCurrent.setParamName(nodeLabelField.getFieldName()); - paramsCurrent.setPortraitSn(nodeLabelField.getPortraitSn()); - paramsCurrentList.add(paramsCurrent); - PatientNodeParamsLog paramsLog = new PatientNodeParamsLog(); - BeanUtils.copyBeanProp(paramsLog, paramsCurrent); - paramsLogList.add(paramsLog); - }); + 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); 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 9e8d6c8d..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 @@ -47,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..08374d1f 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,6 +19,9 @@ public class SpecialDiseaseNodeVO extends SpecialDiseaseNode { private String taskTypeName; + @ApiModelProperty(value = "任务细分id") + private Long taskPartitionDictId; + private String taskSubdivisionName; private String taskStatusName; 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 4fef2eff..6e69053c 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/labelfieldcontent/LabelFieldContentMapper.xml @@ -316,6 +316,7 @@ 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 @@ -359,7 +360,7 @@ and lfc.portrait_status = #{portraitStatus} - Order by tpd.task_partition_sort,lfc.portrait_sn + Order by tpd.task_partition_sort,lfi.field_sort diff --git a/postdischarge-manage/src/main/resources/mapper/manage/specialdiseasenode/SpecialDiseaseNodeMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/specialdiseasenode/SpecialDiseaseNodeMapper.xml index 4224dff4..92b8d2cc 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/specialdiseasenode/SpecialDiseaseNodeMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/specialdiseasenode/SpecialDiseaseNodeMapper.xml @@ -311,6 +311,18 @@ + select sdn.*, + ttd.id taskTypeId, ttd.task_type_name taskTypeName, tpd.id taskPartitionDictId, tpd.task_partition_name taskPartitionDictName From 8775d6fe01daa56c0b250d86954bcb16e916b37a Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Wed, 3 Jul 2024 15:45:30 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LabelFieldInfoController.java | 6 +++- .../TaskPartitionDictMapper.java | 3 ++ .../tasktypedict/TaskTypeDictMapper.java | 8 +++++ .../ILabelFieldInfoService.java | 8 ++++- .../impl/LabelFieldInfoServiceImpl.java | 28 +++++++++++++++-- .../SpecialDiseaseNodeVO.java | 2 ++ .../vo/tasktypedict/TaskTypeDictVO.java | 30 +++++++++++++++++++ .../SpecialDiseaseNodeMapper.xml | 16 +++++----- .../TaskPartitionDictMapper.xml | 8 +++++ .../tasktypedict/TaskTypeDictMapper.xml | 6 ++++ 10 files changed, 103 insertions(+), 12 deletions(-) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/tasktypedict/TaskTypeDictVO.java 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/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/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/vo/specialdiseasenode/SpecialDiseaseNodeVO.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/specialdiseasenode/SpecialDiseaseNodeVO.java index 08374d1f..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 @@ -27,4 +27,6 @@ public class SpecialDiseaseNodeVO extends SpecialDiseaseNode { 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/specialdiseasenode/SpecialDiseaseNodeMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/specialdiseasenode/SpecialDiseaseNodeMapper.xml index 92b8d2cc..337cf90f 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/specialdiseasenode/SpecialDiseaseNodeMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/specialdiseasenode/SpecialDiseaseNodeMapper.xml @@ -125,6 +125,7 @@ + @@ -807,7 +808,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 From a073c1815ca42d1790a76914ddf90bb26f1eb10f Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Wed, 3 Jul 2024 16:21:32 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E7=94=BB=E5=83=8F=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/LabelFieldContentServiceImpl.java | 21 ++++++++++------ .../labelfieldinfo/LabelFieldInfoMapper.xml | 25 +++++++++++-------- 2 files changed, 28 insertions(+), 18 deletions(-) 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 3e195585..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 @@ -204,6 +204,7 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService { } 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); @@ -233,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; } 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..d6a5ede6 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 @@ 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 d6a5ede6..d8de48b8 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/labelfieldinfo/LabelFieldInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/labelfieldinfo/LabelFieldInfoMapper.xml @@ -253,7 +253,7 @@ and task_partition_dict_id is null - Order by ttd.task_type_sort,tpd.task_partition_sort + Order by ttd.task_type_sort,tpd.task_partition_sort,lfi.field_sort