画像编辑

This commit is contained in:
zhangheng 2024-07-01 14:47:28 +08:00
parent fe4c9382c9
commit 707f7f5edc
12 changed files with 194 additions and 67 deletions

View File

@ -15,6 +15,8 @@ import com.xinelu.manage.vo.labelfieldcontent.LabelField;
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;
@ -111,7 +113,7 @@ public class LabelFieldContentController extends BaseController {
* 画像查询
*/
@GetMapping("/groupingValue")
public List<List<GroupingValue>> groupingValue(Long taskPartitionDictId, Long patientId) {
public List<LabelFieldAndPartitionDict> groupingValue(Long taskPartitionDictId, Long patientId) {
return labelFieldContentService.groupingValue(taskPartitionDictId, patientId);
}

View File

@ -38,6 +38,9 @@ public class TaskTypeDictController extends BaseController {
return getDataTable(list);
}
/**
* 查询任务类型字典列表(不分页)
*/
@GetMapping("/selectTaskTypeList")
public AjaxResult selectTaskTypeList(TaskTypeDict taskTypeDict) {
return AjaxResult.success(taskTypeDictService.selectTaskTypeDictList(taskTypeDict));

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.mapper.labelfieldcontent;
import com.xinelu.manage.domain.labelfieldcontent.LabelFieldContent;
import com.xinelu.manage.vo.labelfieldcontent.GroupingValue;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldAndPartitionDict;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldContentVO;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldInfoContentVo;
import org.apache.ibatis.annotations.Param;
@ -89,6 +90,8 @@ public interface LabelFieldContentMapper {
* @param portraitStatus 状态
* @return GroupingValue
*/
List<LabelFieldAndPartitionDict> labelFieldAndPartitionDict(@Param("taskPartitionDictId") Long taskPartitionDictId, @Param("patientId") Long patientId, @Param("portraitStatus") String portraitStatus);
List<GroupingValue> groupingValue(@Param("taskPartitionDictId") Long taskPartitionDictId, @Param("patientId") Long patientId, @Param("portraitStatus") String portraitStatus);
/**

View File

@ -83,10 +83,9 @@ public interface LabelFieldInfoMapper {
/**
* 分组信息
*
* @param taskPartitionDictName 分组名
* @return LabelFieldInfo
*/
List<LabelFieldInfo> taskPartitionDictIdList(String taskPartitionDictName);
List<LabelFieldInfo> taskPartitionDictIdList();
/**
* 查询标签

View File

@ -5,6 +5,8 @@ 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;
/**
@ -81,7 +83,7 @@ public interface ILabelFieldContentService {
* @param patientId 患者id
* @return GroupingValue
*/
List<List<GroupingValue>> groupingValue(Long taskPartitionDictId, Long patientId);
List<LabelFieldAndPartitionDict> groupingValue(Long taskPartitionDictId, Long patientId);
/**
* 画像内容新增

View File

@ -18,25 +18,23 @@ 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.service.labelfieldcontent.ILabelFieldContentService;
import com.xinelu.manage.vo.labelfieldcontent.GroupingValue;
import com.xinelu.manage.vo.labelfieldcontent.LabelField;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldContentVO;
import com.xinelu.manage.vo.labelfieldcontent.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
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;
/**
* 标签字段内容信息Service业务层处理
@ -148,7 +146,7 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
BeanUtils.copyProperties(contentDTO, labelFieldContent);
labelFieldContent.setFieldId(labelFieldContentAddDTO.getFieldId());
labelFieldContent.setFieldName(labelFieldContentAddDTO.getFieldName());
labelFieldContent.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo());
labelFieldContent.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo());
labelFieldContent.setCreateBy(SecurityUtils.getUsername());
labelFieldContent.setCreateTime(LocalDateTime.now());
if (labelFieldContentMapper.insertLabelFieldContent(labelFieldContent) <= 0) {
@ -172,7 +170,7 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
labelFieldInfo.setTaskPartitionDictName("全部");
labelFieldInfoList.add(labelFieldInfo);
//任务细分表数据
List<LabelFieldInfo> labelFieldInfos = labelFieldInfoMapper.taskPartitionDictIdList(null);
List<LabelFieldInfo> labelFieldInfos = labelFieldInfoMapper.taskPartitionDictIdList();
if (CollectionUtils.isNotEmpty(labelFieldInfos)) {
labelFieldInfoList.addAll(labelFieldInfos);
}
@ -191,15 +189,14 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
* @return GroupingValue
*/
@Override
public List<List<GroupingValue>> groupingValue(Long taskPartitionDictId, Long patientId) {
public List<LabelFieldAndPartitionDict> groupingValue(Long taskPartitionDictId, Long patientId) {
if (ObjectUtils.isEmpty(patientId)) {
throw new ServiceException("请选择患者!");
}
//根据patientId查询是否有已经维护的参数
List<GroupingValue> labelFieldContents = labelFieldContentMapper.groupingValue(taskPartitionDictId, patientId, null);
List<LabelFieldAndPartitionDict> labelFieldContents = labelFieldContentMapper.labelFieldAndPartitionDict(taskPartitionDictId, patientId, null);
if (CollectionUtils.isNotEmpty(labelFieldContents)) {
Map<String, List<GroupingValue>> collect = labelFieldContents.stream().collect(Collectors.groupingBy(GroupingValue::getPortraitSn));
return new ArrayList<>(collect.values());
return labelFieldContents;
}
//查询未维护标签及从患者表取值
List<GroupingValue> labelFieldContentList = labelFieldInfoMapper.selectLabelFieldInfoByTaskPartitionDictId(taskPartitionDictId);
@ -214,15 +211,21 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
for (int i = 0; i < declaredFields.length; i++) {
strings[i] = declaredFields[i].getName().toUpperCase();
}
List<String> strings1 = Arrays.asList(strings);
List<PortraitSnVO> PortraitSnVOS = new ArrayList<>();
List<String> asListStrings = Arrays.asList(strings);
for (GroupingValue groupingValue : labelFieldContentList) {
PortraitSnVO portraitSnVO = new PortraitSnVO();
groupingValue.setPatientId(patientId);
String s = strings1.stream().filter(Objects::nonNull).filter(item -> item.equals(groupingValue.getFieldCode())).findFirst().orElse(new String());
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<List<GroupingValue>> lists = new ArrayList<>();
lists.add(labelFieldContentList);
return lists;
List<LabelFieldAndPartitionDict> labelFieldAndPartitionDictList = new ArrayList<>();
LabelFieldAndPartitionDict labelFieldAndPartitionDict = new LabelFieldAndPartitionDict();
labelFieldAndPartitionDict.setPortraitSnVOList(PortraitSnVOS);
labelFieldAndPartitionDictList.add(labelFieldAndPartitionDict);
return labelFieldAndPartitionDictList;
}
/**
@ -234,22 +237,27 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult insertLabelField(LabelField labelField) {
if (CollectionUtils.isEmpty(labelField.getGroupingValues())) {
if (CollectionUtils.isEmpty(labelField.getLabelFieldAndPartitionDictList())) {
return AjaxResult.success();
}
List<GroupingValue> groupingValues = new ArrayList<>();
List<PortraitSnVO> PortraitSnVOS = new ArrayList<>();
try {
for (List<GroupingValue> groupingValue : labelField.getGroupingValues()) {
if (StringUtils.isBlank(groupingValue.get(0).getPortraitSn())) {
for (LabelFieldAndPartitionDict labelFieldAndPartitionDict : labelField.getLabelFieldAndPartitionDictList()) {
if (StringUtils.isBlank(labelFieldAndPartitionDict.getPortraitSnVOList().get(0).getPortraitSn())) {
String portraitSn = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
groupingValue.forEach(item -> item.setPortraitSn(portraitSn));
labelFieldAndPartitionDict.getPortraitSnVOList().forEach(item -> item.setPortraitSn(portraitSn));
}
groupingValues.addAll(groupingValue);
PortraitSnVOS.addAll(labelFieldAndPartitionDict.getPortraitSnVOList());
TimeUnit.MILLISECONDS.sleep(10);
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
List<GroupingValue> groupingValues = new ArrayList<>();
for (PortraitSnVO portraitSnVO : PortraitSnVOS) {
portraitSnVO.getGroupingValues().forEach(item -> item.setPortraitSn(portraitSnVO.getPortraitSn()));
groupingValues.addAll(portraitSnVO.getGroupingValues());
}
List<GroupingValue> updateGroupingValues = new ArrayList<>();
List<GroupingValue> insertGroupingValues = new ArrayList<>();
//传入标签ids
@ -269,13 +277,13 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
if (Objects.isNull(groupingValue.getLabelFieldContentId())) {
groupingValue.setCreateBy(SecurityUtils.getUsername());
groupingValue.setCreateTime(LocalDateTime.now());
groupingValue.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo());
groupingValue.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo());
insertGroupingValues.add(groupingValue);
}
if (Objects.nonNull(groupingValue.getLabelFieldContentId())) {
groupingValue.setCreateTime(LocalDateTime.now());
groupingValue.setCreateBy(SecurityUtils.getUsername());
groupingValue.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo());
groupingValue.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo());
updateGroupingValues.add(groupingValue);
}
}
@ -288,33 +296,34 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
return AjaxResult.success();
}
@Override public List<List<GroupingValue>> getPortaitByPatient(Long patientId) {
//List<Map<String, List<List<GroupingValue>>>> retMap = new ArrayList<>();
List<List<GroupingValue>> retList = new ArrayList<>();
List<GroupingValue> labelFieldContents = labelFieldContentMapper.groupingValue(0L, patientId, null);
if (CollectionUtils.isEmpty(labelFieldContents)) {
return null;
}
retList.add(labelFieldContents);
// 按照任务细分分组
//Map<Long, List<GroupingValue>> groupByPartition = labelFieldContents.stream().collect(Collectors.groupingBy(GroupingValue::getTaskPartitionDictId));
@Override
public List<List<GroupingValue>> getPortaitByPatient(Long patientId) {
//List<Map<String, List<List<GroupingValue>>>> retMap = new ArrayList<>();
List<List<GroupingValue>> retList = new ArrayList<>();
List<GroupingValue> labelFieldContents = labelFieldContentMapper.groupingValue(0L, patientId, null);
if (CollectionUtils.isEmpty(labelFieldContents)) {
return null;
}
retList.add(labelFieldContents);
// 按照任务细分分组
//Map<Long, List<GroupingValue>> groupByPartition = labelFieldContents.stream().collect(Collectors.groupingBy(GroupingValue::getTaskPartitionDictId));
//for (Long taskPartitionDictId : groupByPartition.keySet()) {
// Map<String, List<List<GroupingValue>>> retObj = new HashMap<>();
// List<List<GroupingValue>> lists = new ArrayList<>();
// // 按照sn分组
// List<GroupingValue> partitionList = groupByPartition.get(taskPartitionDictId);
// Map<String, List<GroupingValue>> 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;
}
//for (Long taskPartitionDictId : groupByPartition.keySet()) {
// Map<String, List<List<GroupingValue>>> retObj = new HashMap<>();
// List<List<GroupingValue>> lists = new ArrayList<>();
// // 按照sn分组
// List<GroupingValue> partitionList = groupByPartition.get(taskPartitionDictId);
// Map<String, List<GroupingValue>> 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;
}
/**
/**
* 根据任务细分类型获取患者的真实信息
*
* @param patientId 患者主键

View File

@ -78,4 +78,6 @@ public class GroupingValue extends LabelFieldInfo {
*/
@ApiModelProperty(value = "内容备注信息")
private String contentRemark;
private Integer sign;
}

View File

@ -8,4 +8,6 @@ import java.util.List;
public class LabelField {
private List<List<GroupingValue>> groupingValues;
private List<LabelFieldAndPartitionDict> labelFieldAndPartitionDictList;
}

View File

@ -0,0 +1,18 @@
package com.xinelu.manage.vo.labelfieldcontent;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class LabelFieldAndPartitionDict {
@ApiModelProperty(value = "任务细分id当做分组使用")
private Long taskPartitionDictId;
@ApiModelProperty(value = "任务细分名称(冗余)")
private String taskPartitionDictName;
private List<PortraitSnVO> portraitSnVOList;
}

View File

@ -0,0 +1,13 @@
package com.xinelu.manage.vo.labelfieldcontent;
import lombok.Data;
import java.util.List;
@Data
public class PortraitSnVO {
private String portraitSn;
private List<GroupingValue> groupingValues;
}

View File

@ -21,6 +21,42 @@
<result property="updateTime" column="update_time"/>
</resultMap>
<resultMap type="com.xinelu.manage.vo.labelfieldcontent.LabelFieldAndPartitionDict" id="LabelFieldAndPartitionDictResult">
<result property="taskPartitionDictId" column="task_partition_dict_id"/>
<result property="taskPartitionDictName" column="task_partition_dict_name"/>
<collection property="portraitSnVOList" javaType="java.util.List"
resultMap="portraitSnVOResult"/>
</resultMap>
<resultMap type="com.xinelu.manage.vo.labelfieldcontent.PortraitSnVO" id="portraitSnVOResult">
<result property="portraitSn" column="portrait_sn"/>
<collection property="groupingValues" javaType="java.util.List"
resultMap="GroupingValueResult"/>
</resultMap>
<resultMap type="com.xinelu.manage.vo.labelfieldcontent.GroupingValue" id="GroupingValueResult">
<result property="labelFieldInfoId" column="labelFieldInfoId"/>
<result property="fieldName" column="field_name"/>
<result property="fieldCode" column="field_code"/>
<result property="fieldType" column="field_type"/>
<result property="fieldSort" column="field_sort"/>
<result property="fieldRemark" column="field_remark"/>
<result property="taskPartitionDictId" column="task_partition_dict_id"/>
<result property="taskPartitionDictName" column="task_partition_dict_name"/>
<result property="taskTypeId" column="task_type_id"/>
<result property="taskTypeName" column="task_type_name"/>
<result property="labelFieldContentId" column="labelFieldContentId"/>
<result property="fieldId" column="field_id"/>
<result property="fieldName" column="field_name"/>
<result property="fieldCode" column="field_code"/>
<result property="fieldValue" column="field_value"/>
<result property="portraitSn" column="portrait_sn"/>
<result property="patientId" column="patient_id"/>
<result property="portraitStatus" column="portrait_status"/>
<result property="contentSort" column="content_sort"/>
<result property="contentRemark" column="content_remark"/>
</resultMap>
<sql id="selectLabelFieldContentVo">
select id,
field_id,
@ -284,6 +320,46 @@
where content.patient_id = #{patientId} and content.portrait_status='INUSE'
</select>
<select id="labelFieldAndPartitionDict" resultType="com.xinelu.manage.vo.labelfieldcontent.LabelFieldAndPartitionDict" resultMap="LabelFieldAndPartitionDictResult">
select
lfi.id labelFieldInfoId,
lfi.field_name,
lfi.field_code,
lfi.field_type,
lfi.field_sort,
lfi.field_remark,
lfi.task_partition_dict_id,
lfi.task_partition_dict_name,
lfi.task_type_id,
lfi.task_type_name,
lfc.id labelFieldContentId,
lfc.field_id,
lfc.patient_id,
lfc.field_name,
lfc.field_code,
lfc.field_value,
lfc.portrait_sn,
lfc.portrait_status,
lfc.content_sort
from label_field_info lfi
LEFT JOIN label_field_content lfc ON lfi.id =lfc.field_id
LEFT JOIN task_partition_dict tpd on tpd.id = lfi.task_partition_dict_id
where 1=1
<if test="taskPartitionDictId != null and taskPartitionDictId != 0">
and lfi.task_partition_dict_id = #{taskPartitionDictId}
</if>
<if test="taskPartitionDictId == null">
and lfi.task_partition_dict_id is null
</if>
<if test="patientId != null">
and lfc.patient_id = #{patientId}
</if>
<if test="portraitStatus != null">
and lfc.portrait_status = #{portraitStatus}
</if>
Order by tpd.task_partition_sort,lfc.portrait_sn
</select>
<insert id="insertLabelFieldContentList">
insert into label_field_content(
field_id,

View File

@ -221,15 +221,13 @@
</delete>
<select id="taskPartitionDictIdList" resultType="com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo">
select
id taskPartitionDictId,
task_partition_name taskPartitionDictName
from task_partition_dict
<where>
<if test="taskPartitionDictName != null and taskPartitionDictName != ''">
task_partition_dict_name like concat('%', #{taskPartitionDictName}, '%')
</if>
</where>
select tpd.id taskPartitionDictId,
tpd.task_partition_name taskPartitionDictName,
ttd.id taskTypeId,
ttd.task_type_name taskTypeName
from task_partition_dict tpd
LEFT JOIN task_type_dict ttd on tpd.task_type_id = ttd.id
ORDER BY ttd.task_type_sort, tpd.task_partition_sort
</select>
<select id="selectLabelFieldInfoByTaskPartitionDictId"