From 757088e4e15b891cf2db06eb45d74b7837de382d Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Tue, 25 Jun 2024 17:26:53 +0800 Subject: [PATCH] =?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 --- .../LabelFieldContentController.java | 17 +- .../labelfieldinfo/LabelFieldInfoMapper.java | 2 +- .../patientinfo/PatientAllInfoViewMapper.java | 7 + .../SignPatientManageRouteNodeMapper.java | 9 -- .../SpecialDiseaseNodeMapper.java | 6 + .../TaskPartitionDictMapper.java | 8 - .../ILabelFieldContentService.java | 13 +- .../impl/LabelFieldContentServiceImpl.java | 149 ++++++++++-------- .../patientinfo/PatientAllInfoViewMapper.xml | 49 ++++++ .../SignPatientManageRouteNodeMapper.xml | 66 -------- .../TaskPartitionDictMapper.xml | 6 - 11 files changed, 161 insertions(+), 171 deletions(-) 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 f8abf7a0..8cc66db2 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 @@ -96,21 +96,20 @@ public class LabelFieldContentController extends BaseController { * 分组信息 */ @GetMapping("/groupingContent") - public AjaxResult groupingContent(Long patientId) { - return labelFieldContentService.groupingContent(patientId); + public AjaxResult groupingContent() { + return labelFieldContentService.groupingContent(); } /** * 画像查询 */ @GetMapping("/groupingValue") - public List groupingValue(Long taskPartitionDictId, Long patientId, Long signPatientManageRouteNodeId) { - return labelFieldContentService.groupingValue(taskPartitionDictId, patientId, signPatientManageRouteNodeId); + public List> groupingValue(Long taskPartitionDictId, Long patientId) { + return labelFieldContentService.groupingValue(taskPartitionDictId, patientId); } -// @PostMapping("/insertLabelField") -// public AjaxResult insertLabelField(@RequestBody LabelField labelField) { -// return labelFieldContentService.insertLabelField(labelField); -// -// } + @PostMapping("/insertLabelField") + public AjaxResult insertLabelField(@RequestBody LabelField labelField) { + return labelFieldContentService.insertLabelField(labelField); + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/labelfieldinfo/LabelFieldInfoMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/labelfieldinfo/LabelFieldInfoMapper.java index 666d2be9..697df589 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/labelfieldinfo/LabelFieldInfoMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/labelfieldinfo/LabelFieldInfoMapper.java @@ -80,7 +80,7 @@ public interface LabelFieldInfoMapper { int countByFieldNameExcludingId(@Param("id") Long id, @Param("fieldType") String fieldType, @Param("fieldName") String fieldName); /** - * 分组信息 (暂不使用) + * 分组信息 * * @param taskPartitionDictName 分组名 * @return LabelFieldInfo diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientAllInfoViewMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientAllInfoViewMapper.java index 937481de..77fb24bb 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientAllInfoViewMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/patientinfo/PatientAllInfoViewMapper.java @@ -27,4 +27,11 @@ public interface PatientAllInfoViewMapper { */ List selectPatientAllInfoViewList(PatientAllInfoView patientAllInfoView); + /** + * 查询患者全部信息视图对象 + * + * @param patientId 患者主键 + * @return 患者全部信息视图对象 + */ + List selectPatientAllInfoListViewByPatientId(Long patientId); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.java index 9fa6504b..a4db231f 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.java @@ -97,13 +97,4 @@ public interface SignPatientManageRouteNodeMapper { String selectNodeContent(Long manageRouteNodeId); int updateMessageStatus(SignPatientManageRouteNode signPatientManageRouteNode); - - /** - * (暂不使用) - * - * @param patientId a - * @param taskPartitionDictId a - * @return SignPatientManageRouteNode - */ - SignPatientManageRouteNode selectNodeByPatientId(Long patientId, Long taskPartitionDictId); } 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 94d29487..fd32557d 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 @@ -97,5 +97,11 @@ public interface SpecialDiseaseNodeMapper { List selectRouteNodeByRouteId(Long specialDiseaseRouteId); + /** + * 根据患者路径查询患者节点表 + * + * @param specialDiseaseRouteId 患者路径 + * @return Long + */ List selectSpecialDiseaseRouteIds(Long specialDiseaseRouteId); } 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 1936761b..413096b9 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 @@ -59,12 +59,4 @@ public interface TaskPartitionDictMapper { * @return 结果 */ int deleteTaskPartitionDictByIds(Long[] ids); - - /** - * 查询任务细分字典 - * - * @param code 任务细分字典主键 - * @return 任务细分字典 - */ - TaskPartitionDict selectTaskPartitionDictByCode(String code); } 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 b1f74b15..ee5962e7 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 @@ -4,6 +4,7 @@ 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 java.util.List; @@ -70,18 +71,18 @@ public interface ILabelFieldContentService { /** * 分组信息 * - * @param patientId 患者信息 * @return LabelFieldInfo */ - AjaxResult groupingContent(Long patientId); + AjaxResult groupingContent(); /** * 画像查询 * - * @param taskPartitionDictId 细分id - * @param patientId 患者id - * @param signPatientManageRouteNodeId 节点id + * @param taskPartitionDictId 细分id + * @param patientId 患者id * @return GroupingValue */ - List groupingValue(Long taskPartitionDictId, Long patientId, Long signPatientManageRouteNodeId); + List> groupingValue(Long taskPartitionDictId, Long patientId); + + AjaxResult insertLabelField(LabelField labelField); } 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 8d3af5b9..b0d83c4c 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 @@ -1,18 +1,20 @@ package com.xinelu.manage.service.labelfieldcontent.impl; -import com.xinelu.common.constant.TaskCreateTypeConstant; +import com.alibaba.fastjson2.JSONObject; import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.enums.PatientSexEnum; import com.xinelu.common.exception.ServiceException; +import com.xinelu.common.utils.BaseUtil; import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.manage.domain.labelfieldcontent.LabelFieldContent; -import com.xinelu.manage.domain.patientinfo.PatientInfo; -import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute; -import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode; -import com.xinelu.manage.domain.taskpartitiondict.TaskPartitionDict; +import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo; +import com.xinelu.manage.domain.patientinfo.PatientAllInfoView; import com.xinelu.manage.dto.labelfieldcontent.LabelFieldContentAddDTO; import com.xinelu.manage.dto.labelfieldcontent.LabelFieldContentDTO; import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper; +import com.xinelu.manage.mapper.labelfieldinfo.LabelFieldInfoMapper; +import com.xinelu.manage.mapper.patientinfo.PatientAllInfoViewMapper; import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper; import com.xinelu.manage.mapper.signpatientmanageroute.SignPatientManageRouteMapper; import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper; @@ -20,14 +22,9 @@ import com.xinelu.manage.mapper.specialdiseasenode.SpecialDiseaseNodeMapper; import com.xinelu.manage.mapper.taskpartitiondict.TaskPartitionDictMapper; import com.xinelu.manage.service.labelfieldcontent.ILabelFieldContentService; import com.xinelu.manage.vo.labelfieldcontent.GroupingValue; -import com.xinelu.manage.vo.specialdiseasenode.PatientSpecialDiseaseNodeVo; +import com.xinelu.manage.vo.labelfieldcontent.LabelField; 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; @@ -36,6 +33,8 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 标签字段内容信息Service业务层处理 @@ -48,15 +47,9 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService { @Resource private LabelFieldContentMapper labelFieldContentMapper; @Resource - private SignPatientManageRouteMapper signPatientManageRouteMapper; + private LabelFieldInfoMapper labelFieldInfoMapper; @Resource - private SignPatientManageRouteNodeMapper signPatientManageRouteNodeMapper; - @Resource - private SpecialDiseaseNodeMapper specialDiseaseNodeMapper; - @Resource - private PatientInfoMapper patientInfoMapper; - @Resource - private TaskPartitionDictMapper taskPartitionDictMapper; + private PatientAllInfoViewMapper patientAllInfoViewMapper; /** * 查询标签字段内容信息 @@ -165,75 +158,99 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService { /** * 分组信息 * - * @param patientId 患者信息 * @return LabelFieldInfo */ @Override - public AjaxResult groupingContent(Long patientId) { + public AjaxResult groupingContent() { //创建全部选项 TaskPartitionDictId =0为全部 - List patientSpecialDiseaseNode = new ArrayList<>(); - PatientSpecialDiseaseNodeVo specialDiseaseNode = new PatientSpecialDiseaseNodeVo(); - specialDiseaseNode.setTaskPartitionDictId(0L); - specialDiseaseNode.setTaskPartitionDictName("全部"); - patientSpecialDiseaseNode.add(specialDiseaseNode); - // 查询最新一次签约记录 - PatientInfo patientInfo = patientInfoMapper.selectPatientInfoById(patientId); - if (ObjectUtils.isEmpty(patientInfo)) { - throw new ServiceException("请选择患者!"); - } - SignPatientManageRoute routeQuery = new SignPatientManageRoute(); - routeQuery.setSignPatientRecordId(patientInfo.getSignPatientRecordId()); - routeQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE); - List manageRouteList = signPatientManageRouteMapper.selectSignPatientManageRouteList(routeQuery); - if (CollectionUtils.isEmpty(manageRouteList)) { - throw new ServiceException("未找到签约管理路径"); - } - // 根据专病路径查询专病节点信息 - List patientSpecialDiseaseNodeVos = specialDiseaseNodeMapper.selectRouteNodeByRouteId(manageRouteList.get(0).getRouteId()); - if (CollectionUtils.isNotEmpty(patientSpecialDiseaseNodeVos)) { - patientSpecialDiseaseNode.addAll(patientSpecialDiseaseNodeVos); + List labelFieldInfoList = new ArrayList<>(); + LabelFieldInfo labelFieldInfo = new LabelFieldInfo(); + labelFieldInfo.setTaskPartitionDictId(0L); + labelFieldInfo.setTaskPartitionDictName("全部"); + labelFieldInfoList.add(labelFieldInfo); + //任务细分表数据 + List labelFieldInfos = labelFieldInfoMapper.taskPartitionDictIdList(null); + if (CollectionUtils.isNotEmpty(labelFieldInfos)) { + labelFieldInfoList.addAll(labelFieldInfos); } //未分组选项 TaskPartitionDictId =null 为未分组 - PatientSpecialDiseaseNodeVo patientSpecialDiseaseNodeVo = new PatientSpecialDiseaseNodeVo(); - patientSpecialDiseaseNodeVo.setTaskPartitionDictName("未分组"); - patientSpecialDiseaseNode.add(patientSpecialDiseaseNodeVo); - return AjaxResult.success(patientSpecialDiseaseNode); + LabelFieldInfo labelFieldInfoTow = new LabelFieldInfo(); + labelFieldInfoTow.setTaskPartitionDictName("未分组"); + labelFieldInfoList.add(labelFieldInfoTow); + return AjaxResult.success(labelFieldInfoList); } /** * 画像查询 * - * @param taskPartitionDictId 细分id - * @param patientId 患者id - * @param signPatientManageRouteNodeId 节点id + * @param taskPartitionDictId 细分id + * @param patientId 患者id * @return GroupingValue */ @Override - public List groupingValue(Long taskPartitionDictId, Long patientId, Long signPatientManageRouteNodeId) { + public List> groupingValue(Long taskPartitionDictId, Long patientId) { if (ObjectUtils.isEmpty(patientId)) { throw new ServiceException("请选择患者!"); } //根据patientId查询是否有已经维护的参数 List labelFieldContents = labelFieldContentMapper.groupingValue(taskPartitionDictId, patientId, null); if (CollectionUtils.isNotEmpty(labelFieldContents)) { - return labelFieldContents; + Map> collect = labelFieldContents.stream().collect(Collectors.groupingBy(GroupingValue::getPortraitSn)); + return new ArrayList<>(collect.values()); } - //未维护时提取 - SignPatientManageRouteNode specialDiseaseNode = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeById(signPatientManageRouteNodeId); - TaskPartitionDict taskPartitionDict = taskPartitionDictMapper.selectTaskPartitionDictByCode(specialDiseaseNode.getTaskSubdivision()); - if (StringUtils.isNotBlank(specialDiseaseNode.getNodeContent()) && specialDiseaseNode.getNodeContent().contains("data-fieldMark")) { - Document document = Jsoup.parse(specialDiseaseNode.getNodeContent()); - // 需要提取的span - Elements spanList = document.select("span[data-w-e-type]"); - GroupingValue groupingValue = new GroupingValue(); - for (Element element : spanList) { - String filename = element.attr("data-filename"); - groupingValue.setFieldName(filename); - groupingValue.setTaskPartitionDictId(taskPartitionDict.getId()); - groupingValue.setTaskPartitionDictName(taskPartitionDict.getTaskPartitionName()); - labelFieldContents.add(groupingValue); + //查询未维护标签及从患者表取值 + List labelFieldContentList = labelFieldContentMapper.groupingValue(taskPartitionDictId, null, null); + JSONObject paramsValue = getParamsValue(patientId); + if (CollectionUtils.isEmpty(labelFieldContentList)) { + return new ArrayList<>(); + } + for (GroupingValue groupingValue : labelFieldContentList) { + //获取不同的文件路径 + switch (groupingValue.getFieldName()) { + case "姓名": + String s = paramsValue.getOrDefault("patientName", "").toString(); + groupingValue.setFieldValue(paramsValue.getOrDefault("patientName", "").toString()); + break; + case "患者电话": + groupingValue.setFieldValue(paramsValue.getOrDefault("patientPhone", "").toString()); + break; + case "性别": + groupingValue.setFieldValue(paramsValue.getOrDefault("sex", "").toString()); + break; + case "医院": + groupingValue.setFieldValue(paramsValue.getOrDefault("hospitalAgencyName", "").toString()); + break; + default: + break; } } - return labelFieldContents; + List> lists = new ArrayList<>(); + lists.add(labelFieldContentList); + return lists; + + } + + /** + * 根据任务细分类型获取患者的真实信息 + * + * @param patientId 患者主键 + * @return 实际信息 + */ + private JSONObject getParamsValue(Long patientId) { + JSONObject retObj; + List patientAllInfoViews = patientAllInfoViewMapper.selectPatientAllInfoListViewByPatientId(patientId); + if (CollectionUtils.isEmpty(patientAllInfoViews) || ObjectUtils.isEmpty(patientAllInfoViews.get(0))) { + throw new ServiceException("患者信息获取错误,请联系管理员!"); + } + PatientAllInfoView patientAllInfoView = patientAllInfoViews.get(0); + retObj = JSONObject.parseObject(JSONObject.toJSONString(patientAllInfoView)); + // 性别转换成中文、计算年龄 + retObj.fluentPut("sex", PatientSexEnum.getInfoByCode(patientAllInfoView.getSex()).getInfo()).fluentPut("age", BaseUtil.getAge(patientAllInfoView.getBirthDate())); + return retObj; + } + + @Override + public AjaxResult insertLabelField(LabelField labelField) { + return null; } } diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientAllInfoViewMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientAllInfoViewMapper.xml index 7f52c97e..dc9fee36 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientAllInfoViewMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientAllInfoViewMapper.xml @@ -73,4 +73,53 @@ where patient_id = #{patientId} + \ No newline at end of file diff --git a/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml index f5e5fdbe..efd712e5 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml @@ -782,70 +782,4 @@ set message_status = #{messageStatus} where id = #{id} - - \ No newline at end of file diff --git a/postdischarge-manage/src/main/resources/mapper/manage/taskpartitiondict/TaskPartitionDictMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/taskpartitiondict/TaskPartitionDictMapper.xml index 0b6d2957..3b2c76a9 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/taskpartitiondict/TaskPartitionDictMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/taskpartitiondict/TaskPartitionDictMapper.xml @@ -206,10 +206,4 @@ #{id} - - \ No newline at end of file