标签修改

This commit is contained in:
zhangheng 2024-06-25 17:26:53 +08:00
parent 551e595909
commit 757088e4e1
11 changed files with 161 additions and 171 deletions

View File

@ -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> groupingValue(Long taskPartitionDictId, Long patientId, Long signPatientManageRouteNodeId) {
return labelFieldContentService.groupingValue(taskPartitionDictId, patientId, signPatientManageRouteNodeId);
public List<List<GroupingValue>> 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);
}
}

View File

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

View File

@ -27,4 +27,11 @@ public interface PatientAllInfoViewMapper {
*/
List<PatientAllInfoView> selectPatientAllInfoViewList(PatientAllInfoView patientAllInfoView);
/**
* 查询患者全部信息视图对象
*
* @param patientId 患者主键
* @return 患者全部信息视图对象
*/
List<PatientAllInfoView> selectPatientAllInfoListViewByPatientId(Long patientId);
}

View File

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

View File

@ -97,5 +97,11 @@ public interface SpecialDiseaseNodeMapper {
List<PatientSpecialDiseaseNodeVo> selectRouteNodeByRouteId(Long specialDiseaseRouteId);
/**
* 根据患者路径查询患者节点表
*
* @param specialDiseaseRouteId 患者路径
* @return Long
*/
List<Long> selectSpecialDiseaseRouteIds(Long specialDiseaseRouteId);
}

View File

@ -59,12 +59,4 @@ public interface TaskPartitionDictMapper {
* @return 结果
*/
int deleteTaskPartitionDictByIds(Long[] ids);
/**
* 查询任务细分字典
*
* @param code 任务细分字典主键
* @return 任务细分字典
*/
TaskPartitionDict selectTaskPartitionDictByCode(String code);
}

View File

@ -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> groupingValue(Long taskPartitionDictId, Long patientId, Long signPatientManageRouteNodeId);
List<List<GroupingValue>> groupingValue(Long taskPartitionDictId, Long patientId);
AjaxResult insertLabelField(LabelField labelField);
}

View File

@ -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<PatientSpecialDiseaseNodeVo> 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<SignPatientManageRoute> manageRouteList = signPatientManageRouteMapper.selectSignPatientManageRouteList(routeQuery);
if (CollectionUtils.isEmpty(manageRouteList)) {
throw new ServiceException("未找到签约管理路径");
}
// 根据专病路径查询专病节点信息
List<PatientSpecialDiseaseNodeVo> patientSpecialDiseaseNodeVos = specialDiseaseNodeMapper.selectRouteNodeByRouteId(manageRouteList.get(0).getRouteId());
if (CollectionUtils.isNotEmpty(patientSpecialDiseaseNodeVos)) {
patientSpecialDiseaseNode.addAll(patientSpecialDiseaseNodeVos);
List<LabelFieldInfo> labelFieldInfoList = new ArrayList<>();
LabelFieldInfo labelFieldInfo = new LabelFieldInfo();
labelFieldInfo.setTaskPartitionDictId(0L);
labelFieldInfo.setTaskPartitionDictName("全部");
labelFieldInfoList.add(labelFieldInfo);
//任务细分表数据
List<LabelFieldInfo> 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> groupingValue(Long taskPartitionDictId, Long patientId, Long signPatientManageRouteNodeId) {
public List<List<GroupingValue>> groupingValue(Long taskPartitionDictId, Long patientId) {
if (ObjectUtils.isEmpty(patientId)) {
throw new ServiceException("请选择患者!");
}
//根据patientId查询是否有已经维护的参数
List<GroupingValue> labelFieldContents = labelFieldContentMapper.groupingValue(taskPartitionDictId, patientId, null);
if (CollectionUtils.isNotEmpty(labelFieldContents)) {
return labelFieldContents;
Map<String, List<GroupingValue>> 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<GroupingValue> 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<List<GroupingValue>> lists = new ArrayList<>();
lists.add(labelFieldContentList);
return lists;
}
/**
* 根据任务细分类型获取患者的真实信息
*
* @param patientId 患者主键
* @return 实际信息
*/
private JSONObject getParamsValue(Long patientId) {
JSONObject retObj;
List<PatientAllInfoView> 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;
}
}

View File

@ -73,4 +73,53 @@
where patient_id = #{patientId}
</select>
<select id="selectPatientAllInfoListViewByPatientId"
resultType="com.xinelu.manage.domain.patientinfo.PatientAllInfoView">
select paiv.patient_id,
paiv.patient_name,
paiv.patient_phone,
paiv.family_member_phone,
paiv.birth_date,
paiv.card_no,
paiv.sex,
paiv.address,
paiv.patient_type,
paiv.patient_visit_record_id,
paiv.visit_method,
paiv.visit_date,
paiv.hospital_agency_name,
paiv.campus_agency_name,
paiv.department_name,
paiv.ward_name,
paiv.attending_physician_name,
paiv.main_diagnosis,
paiv.admission_time,
paiv.discharge_time,
paiv.hospitalization_days,
paiv.in_hospital_info,
paiv.out_hospital_info,
paiv.visit_serial_number,
paiv.in_hospital_number,
paiv.responsible_nurse,
paiv.surgical_name,
paiv.surgical_record,
paiv.sign_patient_record_id,
paiv.payment_status,
paiv.health_manage_name,
paiv.service_status,
paiv.sign_status,
paiv.billing_doctor_name,
paiv.sign_time,
paiv.package_name,
paiv.package_payment_status,
paiv.package_price,
paiv.service_start_time,
paiv.service_end_time,
paiv.package_term,
paiv.package_term_unit
from patient_all_info_view paiv
left join patient_info pi ON pi.id = paiv.patient_id
where paiv.patient_id = #{patientId}
Order BY pi.update_time
</select>
</mapper>

View File

@ -782,70 +782,4 @@
set message_status = #{messageStatus}
where id = #{id}
</update>
<select id="selectNodeByPatientId"
resultType="com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode">
select id,
manage_route_id,
manage_route_name,
route_node_id,
route_node_name,
route_node_day,
task_type,
task_status,
task_subdivision,
second_classify_describe,
execute_time,
phone_push_sign,
phone_id,
phone_template_id,
phone_template_name,
phone_node_content,
phone_redial_times,
phone_time_interval,
phone_message_remind,
phone_message_template_id,
phone_message_template_name,
question_info_id,
questionnaire_name,
questionnaire_content,
question_expiration_date,
propaganda_info_id,
propaganda_title,
propaganda_content,
message_push_sign,
message_template_id,
message_template_name,
message_preview,
message_node_content,
official_push_sign,
official_template_id,
official_template_name,
official_remind_content,
official_node_content,
applet_push_sign,
applet_template_id,
applet_template_name,
applet_remind_content,
applet_prompt_description,
applet_node_content,
follow_template_id,
follow_template_name,
follow_content,
route_check_status,
route_check_person,
route_check_date,
route_check_remark,
route_node_remark,
node_execute_status,
route_handle_remark,
route_handle_id,
route_handle_person,
route_link,
text_remind_content,
node_content,
message_status,
del_flag
from sign_patient_manage_route_node
</select>
</mapper>

View File

@ -206,10 +206,4 @@
#{id}
</foreach>
</delete>
<select id="selectTaskPartitionDictByCode"
resultType="com.xinelu.manage.domain.taskpartitiondict.TaskPartitionDict">
<include refid="selectTaskPartitionDictVo"/>
where task_partition_code = #{code}
</select>
</mapper>