web : 1. 体格检查工具配置表 添加排序字段

release_1.0.0
xueqingkun 1 year ago
parent 53039d19bf
commit 0615b43b7d

@ -58,6 +58,13 @@ public class ConfigPhysicalTool implements Serializable {
@TableField(typeHandler = StringListTypeHandler.class) @TableField(typeHandler = StringListTypeHandler.class)
private List<String> callOutQuestion; private List<String> callOutQuestion;
@ApiModelProperty("检查类型排序")
private Integer typePriority;
@ApiModelProperty("code排序")
private Integer codePriority;
/** /**
* ID * ID
*/ */

@ -13,6 +13,8 @@
<result property="requireLocation" column="require_location" jdbcType="INTEGER"/> <result property="requireLocation" column="require_location" jdbcType="INTEGER"/>
<result column="call_out_question" property="callOutQuestion" jdbcType="ARRAY" <result column="call_out_question" property="callOutQuestion" jdbcType="ARRAY"
typeHandler="com.supervision.handler.StringListTypeHandler"/> typeHandler="com.supervision.handler.StringListTypeHandler"/>
<result property="codePriority" column="code_priority" jdbcType="INTEGER"/>
<result property="typePriority" column="type_priority" jdbcType="INTEGER"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/> <result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/> <result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
@ -22,7 +24,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id id
,type,code,icon_base64 ,type,code,icon_base64
tool_name,require_location,create_user_id, tool_name,require_location,type_priority,code_priority,
create_time,update_user_id,update_time create_user_id, create_time,update_user_id,update_time
</sql> </sql>
</mapper> </mapper>

@ -10,5 +10,7 @@ public class ConfigPhysicalToolResVO {
private String toolType; private String toolType;
private transient Integer priority;
private List<ConfigPhysicalTool> toolList; private List<ConfigPhysicalTool> toolList;
} }

@ -1,5 +1,6 @@
package com.supervision.service.impl; package com.supervision.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.supervision.exception.BusinessException; import com.supervision.exception.BusinessException;
import com.supervision.model.*; import com.supervision.model.*;
@ -13,6 +14,7 @@ import com.supervision.vo.ask.AskPhysicalHistoryResVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -33,14 +35,19 @@ public class AskPhysicalServiceImpl implements AskPhysicalService {
@Override @Override
public List<ConfigPhysicalToolResVO> queryPhysicalToolList() { public List<ConfigPhysicalToolResVO> queryPhysicalToolList() {
List<ConfigPhysicalTool> list = toolService.lambdaQuery().list(); List<ConfigPhysicalTool> list = toolService.lambdaQuery().list();
return list.stream().collect(Collectors.groupingBy(ConfigPhysicalTool::getType)).entrySet().stream().map(e ->{ return list.stream().collect(Collectors.groupingBy(ConfigPhysicalTool::getType)).entrySet().stream().map(e ->{
ConfigPhysicalToolResVO tool = new ConfigPhysicalToolResVO(); ConfigPhysicalToolResVO tool = new ConfigPhysicalToolResVO();
tool.setToolType(e.getKey()); tool.setToolType(e.getKey());
int priority = 999;
if (CollectionUtil.isNotEmpty(e.getValue()) && null != e.getValue().get(0).getTypePriority()) {
priority = e.getValue().get(0).getTypePriority();
}
tool.setPriority(priority);
tool.setToolList(e.getValue()); tool.setToolList(e.getValue());
return tool; return tool;
}).sorted(Comparator.comparingInt(ConfigPhysicalToolResVO::getPriority)).collect(Collectors.toList());
}).collect(Collectors.toList());
} }
@Override @Override

Loading…
Cancel
Save