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

This commit is contained in:
haown 2024-06-27 15:28:00 +08:00
commit 4fe5369d37
10 changed files with 193 additions and 28 deletions

View File

@ -9,6 +9,8 @@ import com.xinelu.common.utils.poi.ExcelUtil;
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;
@ -55,8 +57,8 @@ public class LabelFieldInfoController extends BaseController {
* 查询标签字段信息列表树图
*/
@GetMapping("/labelFieldList")
public AjaxResult labelFieldList(String fieldType) {
return AjaxResult.success(labelFieldInfoService.labelFieldList(fieldType));
public List<LabelFieldTreeVO> labelFieldList(String fieldType) {
return labelFieldInfoService.labelFieldList(fieldType);
}
/**

View File

@ -79,7 +79,7 @@ public interface LabelFieldContentMapper {
* @param labelFieldIds 标签字段信息表
* @return LabelFieldContentVO
*/
List<LabelFieldContentVO> selectLabelFieldContent(@Param("labelFieldIds") List<Long> labelFieldIds);
List<LabelFieldContentVO> selectLabelFieldContent(@Param("labelFieldIds") List<Long> labelFieldIds, @Param("patientId") Long patientId);
/**
* 画像内容查询

View File

@ -95,4 +95,12 @@ public interface LabelFieldInfoMapper {
* @return GroupingValue
*/
List<GroupingValue> selectLabelFieldInfoByTaskPartitionDictId(Long taskPartitionDictId);
/**
* 查询标签
*
* @param taskPartitionDictIds 标签
* @return LabelFieldVO
*/
List<LabelFieldVO> selectLabelFieldNameByTaskPartitionDictIds(@Param("taskPartitionDictIds") List<Long> taskPartitionDictIds);
}

View File

@ -256,7 +256,7 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
//传入标签内容ids
List<Long> afferentLabelFieldContentIds = groupingValues.stream().filter(Objects::nonNull).map(GroupingValue::getLabelFieldContentId).filter(Objects::nonNull).collect(Collectors.toList());
//数据库标签内容ids
List<LabelFieldContentVO> databaseLabelFieldContents = labelFieldContentMapper.selectLabelFieldContent(afferentLabelFieldInfoIds);
List<LabelFieldContentVO> databaseLabelFieldContents = labelFieldContentMapper.selectLabelFieldContent(afferentLabelFieldInfoIds, groupingValues.get(0).getPatientId());
List<Long> databaseLabelFieldContentIds = databaseLabelFieldContents.stream().filter(Objects::nonNull).map(LabelFieldContentVO::getLabelFieldContentId).filter(Objects::nonNull).collect(Collectors.toList());
//做差集
List<Long> subtractLabelFieldContentIds = (List<Long>) CollectionUtils.subtract(databaseLabelFieldContentIds, afferentLabelFieldContentIds);

View File

@ -3,6 +3,8 @@ package com.xinelu.manage.service.labelfieldinfo;
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;
@ -35,7 +37,7 @@ public interface ILabelFieldInfoService {
* @param fieldType 字段类型
* @return AjaxResult
*/
AjaxResult labelFieldList(String fieldType);
List<LabelFieldTreeVO> labelFieldList(String fieldType);
/**
* 新增标签字段信息

View File

@ -1,6 +1,5 @@
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;
@ -8,15 +7,17 @@ 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.service.labelfieldinfo.ILabelFieldInfoService;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldContentVO;
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldTreeVO;
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO;
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;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@ -64,18 +65,36 @@ public class LabelFieldInfoServiceImpl implements ILabelFieldInfoService {
* @return AjaxResult
*/
@Override
public AjaxResult labelFieldList(String fieldType) {
public List<LabelFieldTreeVO> labelFieldList(String fieldType) {
int i = 1;
//查询细分
List<LabelFieldVO> labelFieldList = labelFieldInfoMapper.selectLabelFieldList(fieldType);
List<Long> labelFieldIds = labelFieldList.stream().filter(Objects::nonNull).map(LabelFieldVO::getLabelFieldId).filter(Objects::nonNull).collect(Collectors.toList());
if (labelFieldIds.size() == 0) {
return AjaxResult.success(labelFieldList);
List<Long> taskPartitionDictIds = labelFieldList.stream().filter(Objects::nonNull).map(LabelFieldVO::getTaskPartitionDictId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
if (taskPartitionDictIds.size() == 0) {
return new ArrayList<>();
}
List<LabelFieldContentVO> labelFieldContentList = labelFieldContentMapper.selectLabelFieldContent(labelFieldIds);
for (LabelFieldVO labelField : labelFieldList) {
List<LabelFieldContentVO> collect = labelFieldContentList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getFieldId()) && labelField.getLabelFieldId().equals(item.getFieldId())).collect(Collectors.toList());
labelField.setLabelFieldContentList(collect);
List<LabelFieldVO> collect = labelFieldList.stream().filter(Objects::nonNull).collect(Collectors.toList());
//根据细分查询画像
List<LabelFieldVO> labelFieldInfoList = labelFieldInfoMapper.selectLabelFieldNameByTaskPartitionDictIds(taskPartitionDictIds);
List<LabelFieldVO> labelFieldVOS = new ArrayList<>();
labelFieldVOS.addAll(collect);
labelFieldVOS.addAll(labelFieldInfoList);
//组装编号用于前端判断
for (LabelFieldVO labelFieldVO : labelFieldVOS) {
labelFieldVO.setCode(i);
i++;
}
return AjaxResult.success(labelFieldList);
//组装数据
for (LabelFieldVO labelField : collect) {
if (Objects.nonNull(labelField.getTaskPartitionDictId()) && StringUtils.isNotBlank(labelField.getTaskPartitionDictName()) && StringUtils.isNotBlank(labelField.getLabel())) {
List<LabelFieldVO> collectLabelFieldInfoList = labelFieldInfoList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getTaskPartitionDictId()) && labelField.getTaskPartitionDictId().equals(item.getTaskPartitionDictId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collectLabelFieldInfoList)) {
labelField.setLabelFieldList(collectLabelFieldInfoList);
}
}
}
//树图
return collect.stream().map(LabelFieldTreeVO::new).collect(Collectors.toList());
}
/**

View File

@ -0,0 +1,88 @@
package com.xinelu.manage.vo.labelfieldinfo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* 画像树图信息对象vo
*
* @author xinelu
* @date 2024-06-27
*/
@Data
public class LabelFieldTreeVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private Long id;
/**
* 节点名称
*/
private String label;
/**
* 节点层级
*/
private Integer value;
private String termCode;
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<LabelFieldTreeVO> children;
public LabelFieldTreeVO() {
}
public LabelFieldTreeVO(LabelFieldVO labelField) {
this.id = labelField.getId();
this.label = labelField.getLabel();
this.termCode = labelField.getFieldCode();
this.value = labelField.getCode();
this.children = labelField.getLabelFieldList().stream().map(LabelFieldTreeVO::new).collect(Collectors.toList());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTermCode() {
return termCode;
}
public void setTermCode(String termCode) {
this.termCode = termCode;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public List<LabelFieldTreeVO> getChildren() {
return children;
}
public void setChildren(List<LabelFieldTreeVO> children) {
this.children = children;
}
}

View File

@ -1,10 +1,10 @@
package com.xinelu.manage.vo.labelfieldinfo;
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldContentVO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.ArrayList;
import java.util.List;
/**
@ -23,7 +23,25 @@ public class LabelFieldVO extends LabelFieldInfo {
private Long LabelFieldId;
/**
* 标签内容
* 树图名
*/
private List<LabelFieldContentVO> labelFieldContentList;
private String label;
/**
* 树图编号
*/
private Integer code;
/**
* 子集合
*/
private List<LabelFieldVO> labelFieldList = new ArrayList<LabelFieldVO>();
public List<LabelFieldVO> getChildren() {
return labelFieldList;
}
public void setChildren(List<LabelFieldVO> children) {
this.labelFieldList = children;
}
}

View File

@ -224,11 +224,14 @@
from label_field_content
<where>
<if test="labelFieldIds != null and labelFieldIds.size() > 0">
field_id in
and field_id in
<foreach item="labelFieldIds" collection="labelFieldIds" open="(" separator="," close=")">
#{labelFieldIds}
</foreach>
</if>
<if test="patientId != null">
and patient_id = #{patientId}
</if>
</where>
</select>

View File

@ -61,14 +61,20 @@
<select id="selectLabelFieldList" resultType="com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO">
select id LabelFieldId,
field_name,
field_code,
field_type,
field_sort,
field_remark
from label_field_info
where field_type = #{fieldType}
select
lfi.task_partition_dict_id id,
lfi.task_partition_dict_id,
lfi.task_partition_dict_name,
lfi.task_partition_dict_name label
from label_field_info lfi
LEFT JOIN task_partition_dict tpd ON tpd.id = lfi.task_partition_dict_id
<where>
<if test="fieldType != null and fieldType != ''">
lfi.field_type = #{fieldType}
</if>
</where>
group by task_partition_dict_id
order by tpd.task_partition_sort
</select>
<select id="selectLabelFieldInfoById" parameterType="Long"
@ -248,4 +254,23 @@
</if>
</where>
</select>
<select id="selectLabelFieldNameByTaskPartitionDictIds"
resultType="com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO">
select id,
field_name label,
field_code,
task_partition_dict_id,
task_partition_dict_name
from label_field_info
<where>
<if test="taskPartitionDictIds != null and taskPartitionDictIds.size() > 0">
task_partition_dict_id in
<foreach item="taskPartitionDictIds" collection="taskPartitionDictIds" open="(" separator="," close=")">
#{taskPartitionDictIds}
</foreach>
</if>
</where>
order by field_sort
</select>
</mapper>