修改超声和影像查询诊断模版方法
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
yudao-ui-admin CI / build (14.x) (push) Has been cancelled
yudao-ui-admin CI / build (16.x) (push) Has been cancelled
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
yudao-ui-admin CI / build (14.x) (push) Has been cancelled
yudao-ui-admin CI / build (16.x) (push) Has been cancelled
This commit is contained in:
parent
a6fd0ef154
commit
a680fd3830
@ -13,6 +13,7 @@ public class Tree {
|
|||||||
public String tempname;
|
public String tempname;
|
||||||
public String examDescription;
|
public String examDescription;
|
||||||
public String diagResults;
|
public String diagResults;
|
||||||
|
public String dataType;
|
||||||
public List<Tree> children;
|
public List<Tree> children;
|
||||||
// public Tree(String id, String cname, String pid,String tempname,String examDescription,String diagResults) {
|
// public Tree(String id, String cname, String pid,String tempname,String examDescription,String diagResults) {
|
||||||
// this.id = id;
|
// this.id = id;
|
||||||
|
@ -118,28 +118,24 @@ public class ultrasonicController {
|
|||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String json = mapper.writeValueAsString(filteredList);
|
String json = mapper.writeValueAsString(filteredList);
|
||||||
|
|
||||||
List<Tree> tree = convertJsonToTree(json);
|
List<Tree> tree = convertJsonToTree(json,isprivate);
|
||||||
|
|
||||||
return success(tree);
|
return success(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//返回树结构
|
//返回树结构
|
||||||
private List<Tree> convertJsonToTree(String jsonData) {
|
private List<Tree> convertJsonToTree(String jsonData,String isprivate) {
|
||||||
List<Map<String, Object>> dataList;
|
|
||||||
try {
|
try {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
dataList = objectMapper.readValue(jsonData, List.class);
|
List<Map<String, Object>> dataList = objectMapper.readValue(jsonData, List.class);
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Tree> treeMap = new HashMap<>();
|
Map<String, Tree> treeMap = new HashMap<>();
|
||||||
List<Tree> treeList = new ArrayList<>();
|
List<Tree> privateTrees = new ArrayList<>(); // 私有节点列表
|
||||||
|
List<Tree> publicTrees = new ArrayList<>(); // 公共节点列表
|
||||||
|
|
||||||
for (Map<String, Object> data : dataList) {
|
for (Map<String, Object> data : dataList) {
|
||||||
String pid = (String) data.get("pid");
|
|
||||||
String id = (String) data.get("id");
|
String id = (String) data.get("id");
|
||||||
|
String pid = (String) data.get("pid");
|
||||||
String privateId = (String) data.get("privateDoctorId");
|
String privateId = (String) data.get("privateDoctorId");
|
||||||
|
|
||||||
Tree tree = new Tree();
|
Tree tree = new Tree();
|
||||||
@ -149,31 +145,52 @@ public class ultrasonicController {
|
|||||||
tree.tempname = (String) data.get("templateName");
|
tree.tempname = (String) data.get("templateName");
|
||||||
tree.examDescription = (String) data.get("examDescription");
|
tree.examDescription = (String) data.get("examDescription");
|
||||||
tree.diagResults = (String) data.get("diagResults");
|
tree.diagResults = (String) data.get("diagResults");
|
||||||
|
tree.dataType=(String) data.get("dataType");
|
||||||
treeMap.put(id, tree);
|
treeMap.put(id, tree);
|
||||||
if (pid != null && treeMap.containsKey(pid)) {
|
|
||||||
Tree parent = treeMap.get(pid);
|
if (privateId != null && !privateId.isEmpty()) {
|
||||||
if (parent.children == null) {
|
privateTrees.add(tree); // 添加到私有节点列表
|
||||||
parent.children = new ArrayList<>(); // 初始化 parent.children 列表
|
} else if ("0".equals(pid)) {
|
||||||
|
publicTrees.add(tree); // 添加到公共节点列表
|
||||||
}
|
}
|
||||||
parent.children.add(tree);
|
}
|
||||||
} else if (privateId != null && !privateId.isEmpty())//判断是否是私有模版 私有的直接加到树里面
|
if (isprivate.equals("1"))
|
||||||
{
|
{
|
||||||
treeList.add(tree);
|
// 构建公共树
|
||||||
|
buildTree(privateTrees, "0", treeMap);
|
||||||
|
// 将私有节点添加到结果列表
|
||||||
|
return new ArrayList<>(privateTrees); //
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 构建公共树
|
||||||
|
buildTree(publicTrees, "0", treeMap);
|
||||||
|
// 将私有节点添加到结果列表
|
||||||
|
return new ArrayList<>(publicTrees); //
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (Tree tree : treeMap.values()) {
|
|
||||||
if ("0".equals(tree.pid)) {
|
} catch (JsonProcessingException e) {
|
||||||
treeList.add(tree);
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return treeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private void buildTree(List<Tree> currentLevelTrees, String parentId, Map<String, Tree> treeMap) {
|
||||||
|
for (Tree tree : currentLevelTrees) {
|
||||||
|
if (treeMap.containsKey(tree.id)) {
|
||||||
|
List<Tree> children = new ArrayList<>();
|
||||||
|
for (Tree child : treeMap.values()) {
|
||||||
|
if (child.pid != null && child.pid.equals(tree.id)) {
|
||||||
|
children.add(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tree.children = children;
|
||||||
|
buildTree(children, tree.id, treeMap); // 递归构建子树
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@GetMapping("/getimageslist")
|
@GetMapping("/getimageslist")
|
||||||
@Operation(summary = "获取图片列表")
|
@Operation(summary = "获取图片列表")
|
||||||
@Parameter(name = "orgid", description = "机构ID", required = true, example = "1024")
|
@Parameter(name = "orgid", description = "机构ID", required = true, example = "1024")
|
||||||
|
@ -111,4 +111,7 @@ public class ultrasonicDO {
|
|||||||
@TableField("updateTime")
|
@TableField("updateTime")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
@TableField("dataType")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user