Browse Source

治疗方案

zhaops 5 years ago
parent
commit
9ab8da451f
1 changed files with 12 additions and 7 deletions
  1. 12 7
      aipt-service/src/main/java/com/diagbot/facade/TreatmentFacade.java

+ 12 - 7
aipt-service/src/main/java/com/diagbot/facade/TreatmentFacade.java

@@ -59,7 +59,7 @@ public class TreatmentFacade {
         if (disease == null) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "诊断不存在");
         }
-        if (treatmentMap == null || treatmentMap.size() == 0 || !treatmentMap.containsKey(diseaseName)) {
+        if (treatmentMap == null || treatmentMap.size() == 0) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "未找到治疗方案");
         }
 
@@ -67,16 +67,21 @@ public class TreatmentFacade {
         retMap.put("diseaseName", diseaseName);
 
         //获取知识图谱治疗方案
-        JSONObject treatmentJson = treatmentMap.get(diseaseName);
+        /*JSONObject treatmentJson = treatmentMap.get(diseaseName);
         if (treatmentJson == null || treatmentJson.isEmpty()) {
             return retMap;
-        }
+        }*/
+
         //推荐药物
-        List<MedicitionClass> drugsList
-                = FastJsonUtils.getJsonToListByKey(treatmentJson.toString(), "treatment", MedicitionClass.class);
+        List<MedicitionClass> drugsList = Lists.newLinkedList();
+        if (treatmentMap.get("treatment") != null) {
+            drugsList = FastJsonUtils.getJsonToList(treatmentMap.get("treatment").toJSONString(), MedicitionClass.class);
+        }
         //不良反应
-        List<AdverseReaction> adverseReactionList
-                = FastJsonUtils.getJsonToListByKey(treatmentJson.toString(), "adverseEvent", AdverseReaction.class);
+        List<AdverseReaction> adverseReactionList = Lists.newLinkedList();
+        if (treatmentMap.get("adverseEvent") != null) {
+            adverseReactionList = FastJsonUtils.getJsonToList(treatmentMap.get("adverseEvent").toJSONString(), AdverseReaction.class);
+        }
         if (ListUtil.isNotEmpty(drugsList)) {
             //药品大类
             List<String> cateBigNameList = drugsList