Browse Source

feat(电子病例): 诊断分类添加祖籍字段

matianxiang 2 months ago
parent
commit
51f5e2a433

+ 4 - 0
eitc-patient-base/src/main/java/com/eitc/patient/domain/DiagnosisType.java

@@ -27,6 +27,10 @@ public class DiagnosisType extends EitcBaseEntity {
27 27
     @ApiModelProperty(value = "父级id", name = "parentId")
28 28
     private String parentId;
29 29
 
30
+    @TableField(value = "ancestors")
31
+    @ApiModelProperty(value = "祖籍", name = "ancestors")
32
+    private String ancestors;
33
+
30 34
     @TableField(value = "diagnosis_name")
31 35
     @ApiModelProperty(value = "诊断名称", name = "diagnosisName")
32 36
     @NotBlank(message = "诊断名称不能为空")

+ 10 - 0
eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisTypeController.java

@@ -29,6 +29,7 @@ import javax.validation.Valid;
29 29
 import java.util.ArrayList;
30 30
 import java.util.Arrays;
31 31
 import java.util.List;
32
+import java.util.Objects;
32 33
 
33 34
 /**
34 35
  * DiagnosisTypeController
@@ -109,6 +110,15 @@ public class DiagnosisTypeController extends BaseController {
109 110
         if (count > 0) {
110 111
             return error("不允许添加子集");
111 112
         }
113
+        DiagnosisType type = diagnosisTypeService.getById(diagnosisType.getParentId());
114
+        if (Objects.nonNull(type)) {
115
+            if(StringUtils.isNotBlank(type.getAncestors()) && type.getAncestors().split(",").length > 4){
116
+                return error("不允许继续添加子集");
117
+            }
118
+            diagnosisType.setAncestors(type.getAncestors() + "," + diagnosisType.getParentId());
119
+        } else {
120
+            diagnosisType.setAncestors(diagnosisType.getParentId());
121
+        }
112 122
         return toAjax(diagnosisTypeService.save(diagnosisType));
113 123
     }
114 124