Browse Source

Merge branch 'master' of http://192.168.2.236:10080/louhr/qc

louhr 5 years ago
parent
commit
18c5aec434

+ 45 - 3
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/BeHospitalizedAI.java

@@ -5,14 +5,13 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.lantone.qc.kernel.client.CRFServiceClient;
 import com.lantone.qc.kernel.structure.ai.model.CrfOut;
+import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
 import com.lantone.qc.kernel.structure.ai.process.*;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.*;
-import com.lantone.qc.pub.model.label.ChiefLabel;
-import com.lantone.qc.pub.model.label.PastLabel;
-import com.lantone.qc.pub.model.label.PresentLabel;
+import com.lantone.qc.pub.model.label.*;
 import com.lantone.qc.pub.model.vo.CRFVo;
 import com.lantone.qc.pub.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -87,6 +86,11 @@ public class BeHospitalizedAI {
         putPresentCrfData(midData.getJSONObject(Content.present), inputInfo);
         //处理既往史
         putPastCrfData(midData.getJSONObject(Content.past), inputInfo);
+        //处理个人史
+        putPersonCrfData(midData.getJSONObject(Content.personal), inputInfo);
+        //处理家族史
+        putFamilyCrfData(midData.getJSONObject(Content.family),inputInfo);
+
 
 
 //        //存放CRF模型既往史、家族史返回数据
@@ -114,6 +118,7 @@ public class BeHospitalizedAI {
         chiefLabel.setClinicals(loadClinicals(aiOut));
         chiefLabel.setDiags(loadDiags(aiOut));
     }
+
     public void putPresentCrfData(JSONObject jsonObject, InputInfo inputInfo){
         if (jsonObject == null) {
             return;
@@ -125,6 +130,23 @@ public class BeHospitalizedAI {
         presentLabel.setGenerals(loadGeneralDes(aiOut));
         presentLabel.setPacses(loadpacses(aiOut));
     }
+    public void putFamilyCrfData(JSONObject jsonObject, InputInfo inputInfo){
+        if (jsonObject == null) {
+            return;
+        }
+        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        //放置入inputinfo
+        FamilyLabel familyLabel = inputInfo.getBeHospitalizedDoc().getFamilyLabel();
+        familyLabel.setDiags(loadDiags(aiOut));
+        familyLabel.setFamilies(loadFamily(aiOut));
+        EntityProcess entityProcess = new EntityProcess();
+        try {
+            List<DiagInfectious> diagInfectious = entityProcess.addEntity(aiOut, EntityEnum.INFECTIOUS_KEYWORD, DiagInfectious.class);
+            familyLabel.setDiagInfectious(diagInfectious);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
     public void putPastCrfData(JSONObject jsonObject, InputInfo inputInfo){
         if (jsonObject == null) {
             return;
@@ -134,6 +156,16 @@ public class BeHospitalizedAI {
         EntityProcessPast entityProcessPast = new EntityProcessPast();
         inputInfo.getBeHospitalizedDoc().setPastLabel(entityProcessPast.extractEntity(aiOut));
 
+    }
+    public void putPersonCrfData(JSONObject jsonObject, InputInfo inputInfo){
+        if (jsonObject == null) {
+            return;
+        }
+        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        //放置入inputinfo
+        PersonalLabel personalLabel = inputInfo.getBeHospitalizedDoc().getPersonalLabel();
+        personalLabel.setDiags(loadDiags(aiOut));
+
     }
     /**
      * 关系抽取临床表现信息
@@ -146,7 +178,17 @@ public class BeHospitalizedAI {
         List<Clinical> clinicals = entityProcessClinic.extractEntity(aiOut);
         return clinicals;
     }
+    /**
+     * 关系抽取临床表现信息
+     * @param aiOut
+     * @return
+     */
+    public List<Family> loadFamily(JSONObject aiOut) {
 
+        EntityProcessFamily entityProcessFamily= new EntityProcessFamily();
+        List<Family> families = entityProcessFamily.extractEntity(aiOut);
+        return families;
+    }
     /**
      * 关系抽取疾病信息
      * @param aiOut

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcess.java

@@ -109,7 +109,7 @@ public class EntityProcess {
         return entityRelationPair;
     }
 
-    protected  <T> List<T> addEntity(JSONObject aiOut, EntityEnum entityType, Class<T> t) throws Exception {
+    public  <T> List<T> addEntity(JSONObject aiOut, EntityEnum entityType, Class<T> t) throws Exception {
         List<T> list = new ArrayList<>();
         List<Map<String, String>> pastEntityList = processJson(aiOut, entityType.toString());
         for (Map<String, String> pastEntityMap : pastEntityList) {

+ 5 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessDiag.java

@@ -3,6 +3,7 @@ package com.lantone.qc.kernel.structure.ai.process;
 import com.alibaba.fastjson.JSONObject;
 import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
 import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.entity.Negative;
 import com.lantone.qc.pub.model.entity.Possible;
 import org.apache.commons.lang3.StringUtils;
 
@@ -30,6 +31,10 @@ public class EntityProcessDiag extends EntityProcess {
                         possible.setName(value);
                         diag.setPossible(possible);
                         break;
+                    case NEGATIVE:
+                        Negative negative = new Negative();
+                        negative.setName(value);
+                        diag.setNegative(negative);
                 }
             }
             diags.add(diag);

+ 48 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessFamily.java

@@ -0,0 +1,48 @@
+package com.lantone.qc.kernel.structure.ai.process;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
+import com.lantone.qc.pub.model.entity.*;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class EntityProcessFamily extends EntityProcess {
+    public List<Family> extractEntity(JSONObject aiOut) {
+        List<Family> families = new ArrayList<>();
+        Family family;
+        Dead dead;
+        List<Map<String, String>> clinicalEntityList = processJson(aiOut, EntityEnum.RELATIVES.toString());
+        for (Map<String, String> clinicalEntityEntry : clinicalEntityList) {
+            if (StringUtils.isEmpty(clinicalEntityEntry.get(EntityEnum.RELATIVES.toString()))) {
+                continue;
+            }
+            family = new Family();
+            dead = new Dead();
+            for (String key : clinicalEntityEntry.keySet()) {
+                String entity = StringUtils.isEmpty(clinicalEntityEntry.get(key)) ? "" : clinicalEntityEntry.get(key);
+                switch (EntityEnum.parseOfValue(key)){
+                    case RELATIVES:
+                        family.setName(clinicalEntityEntry.get(key));
+                        break;
+                    case DEAD:
+                        dead.setName(entity);
+                        family.setDead(dead);
+                        break;
+                    case UNKNOWN:
+                        Unknow unknow = new Unknow();
+                        unknow.setName(entity);
+                        dead.setUnknow(unknow);
+                        break;
+
+                }
+
+            }
+            families.add(family);
+        }
+        return families;
+    }
+}

+ 0 - 2
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessPast.java

@@ -23,8 +23,6 @@ public class EntityProcessPast extends EntityProcess {
 
     public PastLabel extractEntity(JSONObject aiOut) {
         PastLabel pastLabel = new PastLabel();
-        List<Past> pasts = new ArrayList<>();
-
 
         try {
             List<Diag> diags = addEntity(aiOut, EntityEnum.DIEASE, Diag.class);

+ 13 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/Dead.java

@@ -0,0 +1,13 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 死亡
+ */
+@Setter
+@Getter
+public class Dead extends General {
+    private Unknow unknow;//死亡情况不详
+}

+ 1 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/Diag.java

@@ -14,5 +14,6 @@ import lombok.Setter;
 @Setter
 public class Diag extends General {
     private Possible possible;
+    private Negative negative;
     private String ICD;
 }

+ 4 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/Family.java

@@ -12,4 +12,8 @@ import lombok.Setter;
 @Setter
 @Getter
 public class Family extends General{
+    private Dead dead;
+    private GeneticDiseaseKeyword geneticDiseaseKeyword;//家族遗传病
+    private DiagInfectious diagInfectious;//传染病史
+
 }

+ 8 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/GeneticDiseaseKeyword.java

@@ -0,0 +1,8 @@
+package com.lantone.qc.pub.model.entity;
+
+/**
+ * 家族遗传病
+ */
+public class GeneticDiseaseKeyword extends General {
+    private Negative negative;
+}

+ 6 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/SimilarDiag.java

@@ -1,10 +1,16 @@
 package com.lantone.qc.pub.model.entity;
 
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * @ClassName : SimilarDiag
  * @Description : 相似疾病
  * @Author : 楼辉荣
  * @Date: 2020-03-05 19:25
  */
+@Setter
+@Getter
 public class SimilarDiag extends General {
+    private Negative negative;
 }

+ 12 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/Unknow.java

@@ -0,0 +1,12 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 情况不详
+@Setter
+@Getter
+*/
+public class Unknow extends General{
+}

+ 13 - 0
public/src/main/java/com/lantone/qc/pub/model/label/FamilyLabel.java

@@ -1,10 +1,23 @@
 package com.lantone.qc.pub.model.label;
 
+import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.entity.DiagInfectious;
+import com.lantone.qc.pub.model.entity.Family;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
 /**
  * @ClassName : FamilyLabel
  * @Description : 家族史
  * @Author : 楼辉荣
  * @Date: 2020-03-03 18:49
  */
+@Setter
+@Getter
 public class FamilyLabel extends GeneralLabel {
+    private List<Diag> diags;
+    private List<DiagInfectious> diagInfectious;//传染病史
+    private List<Family> families;
 }

+ 4 - 0
public/src/main/java/com/lantone/qc/pub/model/label/PersonalLabel.java

@@ -1,9 +1,12 @@
 package com.lantone.qc.pub.model.label;
 
+import com.lantone.qc.pub.model.entity.Diag;
 import com.lantone.qc.pub.model.entity.General;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * @ClassName com.lantone.util.module.Personal
  * @Author Mark Huang
@@ -13,4 +16,5 @@ import lombok.Setter;
 @Setter
 @Getter
 public class PersonalLabel extends GeneralLabel {
+    private List<Diag> diags;
 }