Browse Source

1、otherIndex 指标名称修改

zhaops 4 năm trước cách đây
mục cha
commit
3615373e0e

+ 64 - 0
src/main/java/com/diagbot/enums/OtherIndexEnum.java

@@ -0,0 +1,64 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/5/25 10:41
+ */
+public enum OtherIndexEnum implements KeyedNamed {
+
+    TcmDiag(1, "tcmDiag"),
+    TcmSyndrome(2, "tcmSyndrome");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    OtherIndexEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static OtherIndexEnum getEnum(int key) {
+        for (OtherIndexEnum item : OtherIndexEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static OtherIndexEnum getEnum(String name) {
+        for (OtherIndexEnum item : OtherIndexEnum.values()) {
+            if (item.name.equals(name)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        OtherIndexEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    public static Integer getKey(String name) {
+        OtherIndexEnum item = getEnum(name);
+        return item != null ? item.key : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 6 - 4
src/main/java/com/diagbot/service/impl/MrServiceImpl.java

@@ -2,6 +2,7 @@ package com.diagbot.service.impl;
 
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.dto.TcmDTO;
+import com.diagbot.enums.OtherIndexEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.facade.TcmdiseaseConfigFacade;
@@ -121,6 +122,7 @@ public class MrServiceImpl implements MrService {
 
     /**
      * 获取中医病历信息
+     *
      * @param mrId
      * @return
      */
@@ -138,8 +140,8 @@ public class MrServiceImpl implements MrService {
         Map<String, String> otherIndex = pushJoinVO.getOtherIndex();
         if (otherIndex != null) {
             Item tcmdisease = new Item();
-            if (otherIndex.containsKey("中医疾病")) {
-                tcmdisease.setName(otherIndex.get("中医疾病"));
+            if (otherIndex.containsKey(OtherIndexEnum.getName(OtherIndexEnum.TcmDiag.getKey()))) {
+                tcmdisease.setName(otherIndex.get(OtherIndexEnum.getName(OtherIndexEnum.TcmDiag.getKey())));
                 Map<String, Map<String, Long>> configMap
                         = tcmdiseaseConfigFacade.getConfigMap(hospitalId,
                         Arrays.asList(new String[] { tcmdisease.getName() }), null);
@@ -152,8 +154,8 @@ public class MrServiceImpl implements MrService {
             }
 
             Item tcmsyndrome = new Item();
-            if (otherIndex.containsKey("中医证候")) {
-                tcmsyndrome.setName(otherIndex.get("中医证候"));
+            if (otherIndex.containsKey(OtherIndexEnum.getName(OtherIndexEnum.TcmSyndrome.getKey()))) {
+                tcmsyndrome.setName(otherIndex.get(OtherIndexEnum.getName(OtherIndexEnum.TcmSyndrome.getKey())));
                 Map<String, Map<String, Long>> configMap
                         = tcmsyndromeConfigFacade.getConfigMap(hospitalId,
                         Arrays.asList(new String[] { tcmsyndrome.getName() }), null);