فهرست منبع

Merge remote-tracking branch 'origin/master'

MarkHuang 4 سال پیش
والد
کامیت
782f4c56f5

+ 17 - 6
src/main/java/com/diagbot/dto/WordBillCrfDTO.java

@@ -12,16 +12,27 @@ import lombok.Data;
  */
 @Data
 public class WordBillCrfDTO {
+    // 主诉
     private ChiefLabel chiefLabel;
-    private DiagLabel diagLabel;
-    private FamilyLabel familyLabel;
-//    private LisLabel lisLabel;
-    private MaritalLabel maritalLabel;
-    private MenstrualLabel menstrualLabel;
+    // 现病史
     private PresentLabel presentLabel;
-//    private PacsLabel pacsLabel;
+    // 既往史 (如:疾病史、外伤史、传染病史、过敏史、食物过敏史、药物过敏史、输血史、手术史、预防接种史)
     private PastLabel pastLabel;
+    // 个人史(如:吸烟史、饮酒史、冶游)
     private PersonalLabel personalLabel;
+    // 家族史(如:家族遗传病)
+    private FamilyLabel familyLabel;
+    // 婚育史
+    private MaritalLabel maritalLabel;
+    // 月经史
+    private MenstrualLabel menstrualLabel;
+    // 体格
     private VitalLabel vitalLabel;
+    // 诊断
+    private DiagLabel diagLabel;
 
+    // 化验
+    // private LisLabel lisLabel;
+    // 辅检
+    // private PacsLabel pacsLabel;
 }

+ 1 - 0
src/main/java/com/diagbot/facade/BillFacade.java

@@ -38,6 +38,7 @@ public class BillFacade {
 
         // 标准词转换 TODO
         Map<String, Map<String, String>> typeStand = neoFacade.standConvert(standConvert);
+        wordBillCrfDTO = commonFacade.dataTypeSet(wordBillCrfDTO, typeStand);
 
         // 图谱接口调用
         BillNeoVO billNeoVO = new BillNeoVO();

+ 2 - 8
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -61,16 +61,10 @@ public class CommonFacade {
         return standConvert;
     }
     //把图谱返回的标准词set到label中
-    public StandConvert dataTypeSet(WordBillCrfDTO wordBillCrfDTO, Map<String, Map<String, String>> map){
-        StandConvert standConvert = new StandConvert();
-        List<String> clinicalList = new ArrayList<>();
-
+    public WordBillCrfDTO dataTypeSet(WordBillCrfDTO wordBillCrfDTO, Map<String, Map<String, String>> map){
         ChiefLabel chiefLabel = wordBillCrfDTO.getChiefLabel();
-
         CoreUtil.setPropertyList(chiefLabel.getClinicals(),map.get("clinicalList"));
-
-        standConvert.setClinicalList(clinicalList);
-        return standConvert;
+        return wordBillCrfDTO;
     }
 
 }

+ 22 - 0
src/main/java/com/diagbot/model/ai/BeHospitalizedAI.java

@@ -39,6 +39,28 @@ public class BeHospitalizedAI extends ModelAI {
     public static String entityRelationObject = "entity_relation_object";
     public static String outputs = "outputs";
 
+
+    /**
+     *
+     * 类型       模型
+     * 主诉	      主诉-现病史模型
+     * 现病史	  主诉-现病史模型
+     * 既往史	  既往家族史模型
+     * 家族史	  既往家族史模型
+     * 个人史	  个人史模型(吸烟、饮酒,冶游)
+     * 婚育史	  个人史模型
+     * 月经史	  个人史模型
+     * 体征	      体征模型
+     * 诊断	      诊断模型
+     *
+     * 化验       化验模型     已结构化,未使用
+     * 辅检	      辅检模型     已结构化,未使用
+     *
+     *
+     * @param inputInfo
+     * @param wordBillCrfDTO
+     * @param crfServiceClient
+     */
     public void medrec(IndicationPushVO inputInfo, WordBillCrfDTO wordBillCrfDTO, CRFServiceClient crfServiceClient) {
         JSONArray crfContent = new JSONArray();
         if (inputInfo != null) {

+ 144 - 143
src/main/java/com/diagbot/model/ai/process/EntityProcessClinic.java

@@ -1,143 +1,144 @@
-package com.diagbot.model.ai.process;
-
-
-import com.alibaba.fastjson.JSONObject;
-import com.diagbot.model.ai.model.EntityEnum;
-import com.diagbot.model.ai.model.Lemma;
-import com.diagbot.model.entity.*;
-import com.diagbot.model.label.PresentLabel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * 现病史处理
- */
-public class EntityProcessClinic extends EntityProcess {
-    private Logger logger = LoggerFactory.getLogger(EntityProcessClinic.class);
-
-    public PresentLabel extractEntity(JSONObject aiOut) {
-        PresentLabel presentLabel = new PresentLabel();
-        try {
-            //临床表现
-            List<Lemma> clinicLemmas = createEntityTree(aiOut, EntityEnum.CLINICAL_FEATURE.toString());
-            for (Lemma lemma : clinicLemmas) {
-                Clinical clinical = new Clinical();
-                clinical.setName(lemma.getText());
-
-                List<PD> timestamp = new LinkedList<>();
-                for (Lemma relationLemma : lemma.getRelationLemmas()) {
-                    if (relationLemma.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
-                        clinical.setNegative(findNegative(lemma));
-                    }
-                    clinical.setModification(findT(lemma, new Modification(), EntityEnum.MODIFICATION.toString()));//修饰
-                    clinical.setBodyPart(findT(lemma, new BodyPart(), EntityEnum.BODY.toString()));//部位
-                    clinical.setTrend(findT(lemma, new Trend(), EntityEnum.TREND.toString()));//趋势
-                    clinical.setCause(findT(lemma, new Cause(), EntityEnum.CAUSE.toString()));//诱因
-                    clinical.setProperty(findT(lemma, new Property(), EntityEnum.PROPERTY.toString()));//性质
-                    clinical.setDegree(findT(lemma, new Degree(), EntityEnum.DEGREE.toString()));//程度
-                    clinical.setAggravate(findT(lemma, new Aggravate(), EntityEnum.AGGRAVATE.toString()));//加重因素
-                    clinical.setRelief(findT(lemma, new Relief(), EntityEnum.RELIEF.toString()));//缓解因素
-                    if (relationLemma.getProperty().equals(EntityEnum.TIME.toString())) {
-                        String[] time_split = relationLemma.getText().split(",");
-                        for (String time : time_split) {
-                            PD pd = new PD();
-                            String[] val_unit = new String[2];
-                            if (time.trim().length() > 0) {
-                                val_unit = extract_digit(time);
-                            }
-                            pd.setValue(val_unit[0]);
-                            pd.setUnit(val_unit[1]);
-                            pd.setName(time);
-                            timestamp.add(pd);
-                        }
-                    }
-                }
-                clinical.setTimestamp(timestamp);
-                presentLabel.add(presentLabel.getClinicals(), clinical);
-            }
-            //入院途径
-            List<Lemma> beHospitalizedWayLemmas = createEntityTree(aiOut, EntityEnum.BEHOSPITALIZEDWAY.toString());
-            for (Lemma lemma : beHospitalizedWayLemmas) {
-                BeHospitalizedWay beHospitalizedWay = new BeHospitalizedWay();
-                beHospitalizedWay.setName(lemma.getText());
-                presentLabel.setBeHospitalizedWay(beHospitalizedWay);
-            }
-            //诊断信息
-            EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
-            List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
-            presentLabel.setDiags(diags);
-
-            //一般情况信息
-            List<Lemma> geneLemmas = createEntityTree(aiOut, EntityEnum.GENERAL_DESCRIPT.toString());
-            for (Lemma lemma : geneLemmas) {
-                General general = new General();
-                general.setName(lemma.getText());
-                presentLabel.add(presentLabel.getGens(), general);
-            }
-            List<Lemma> causeLemmas = createEntityTree(aiOut, EntityEnum.CAUSE.toString());
-            List<Cause> causes = new ArrayList<>();
-            for (Lemma lemma : causeLemmas) {
-                Cause cause = new Cause();
-                cause.setName(lemma.getText());
-                causes.add(cause);
-            }
-            presentLabel.setCauses(causes);
-
-            //一般情况描述信息
-            EntityProcessGenerals entityProcessGeneral = new EntityProcessGenerals();
-            List<GeneralDesc> generals = entityProcessGeneral.extractEntity(aiOut);
-            presentLabel.setGenerals(generals);
-
-            //辅检信息
-            EntityProcessPacs entityProcessLis = new EntityProcessPacs();
-            List<Pacs> pacses = entityProcessLis.extractEntity(aiOut);
-            presentLabel.setPacses(pacses);
-
-            //治疗
-            List<Lemma> cureLemmas = createEntityTree(aiOut, EntityEnum.CURE.toString());
-            List<Treat> treats = new ArrayList<>();
-            for (Lemma lemma : cureLemmas) {
-                Treat treat = new Treat();
-                treat.setName(lemma.getText());
-                treats.add(treat);
-            }
-            presentLabel.setTreats(treats);
-            //治疗
-            List<Lemma> cureLemmas_me = createEntityTree(aiOut, EntityEnum.DRUG.toString());
-            List<Medicine> medicines = new ArrayList<>();
-            for (Lemma lemma : cureLemmas_me) {
-                Medicine medicine = new Medicine();
-                medicine.setName(lemma.getText());
-                medicines.add(medicine);
-            }
-            presentLabel.setMedicines(medicines);
-
-            //手术
-            List<Lemma> operationLemmas = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
-            for (Lemma lemma : operationLemmas) {
-                Operation operation = new Operation();
-                operation.setName(lemma.getText());
-                presentLabel.add(presentLabel.getOperations(), operation);
-            }
-
-            //时间
-            List<Lemma> pdLemmas = createEntityTree(aiOut, EntityEnum.TIME.toString());
-            List<PD> pds = new ArrayList<>();
-            for (Lemma lemma : pdLemmas) {
-                PD pd = new PD();
-                pd.setName(lemma.getText());
-                pds.add(pd);
-            }
-            presentLabel.setPds(pds);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            logger.error(e.getMessage(), e);
-        }
-        return presentLabel;
-    }
-}
+package com.diagbot.model.ai.process;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.diagbot.model.ai.model.EntityEnum;
+import com.diagbot.model.ai.model.Lemma;
+import com.diagbot.model.entity.*;
+import com.diagbot.model.label.PresentLabel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * 现病史处理
+ */
+public class EntityProcessClinic extends EntityProcess {
+    private Logger logger = LoggerFactory.getLogger(EntityProcessClinic.class);
+
+    public PresentLabel extractEntity(JSONObject aiOut) {
+        PresentLabel presentLabel = new PresentLabel();
+        try {
+            //临床表现
+            List<Lemma> clinicLemmas = createEntityTree(aiOut, EntityEnum.CLINICAL_FEATURE.toString());
+            for (Lemma lemma : clinicLemmas) {
+                Clinical clinical = new Clinical();
+                clinical.setName(lemma.getText());
+                clinical.setStandName(lemma.getText());
+
+                List<PD> timestamp = new LinkedList<>();
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    if (relationLemma.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
+                        clinical.setNegative(findNegative(lemma));
+                    }
+                    clinical.setModification(findT(lemma, new Modification(), EntityEnum.MODIFICATION.toString()));//修饰
+                    clinical.setBodyPart(findT(lemma, new BodyPart(), EntityEnum.BODY.toString()));//部位
+                    clinical.setTrend(findT(lemma, new Trend(), EntityEnum.TREND.toString()));//趋势
+                    clinical.setCause(findT(lemma, new Cause(), EntityEnum.CAUSE.toString()));//诱因
+                    clinical.setProperty(findT(lemma, new Property(), EntityEnum.PROPERTY.toString()));//性质
+                    clinical.setDegree(findT(lemma, new Degree(), EntityEnum.DEGREE.toString()));//程度
+                    clinical.setAggravate(findT(lemma, new Aggravate(), EntityEnum.AGGRAVATE.toString()));//加重因素
+                    clinical.setRelief(findT(lemma, new Relief(), EntityEnum.RELIEF.toString()));//缓解因素
+                    if (relationLemma.getProperty().equals(EntityEnum.TIME.toString())) {
+                        String[] time_split = relationLemma.getText().split(",");
+                        for (String time : time_split) {
+                            PD pd = new PD();
+                            String[] val_unit = new String[2];
+                            if (time.trim().length() > 0) {
+                                val_unit = extract_digit(time);
+                            }
+                            pd.setValue(val_unit[0]);
+                            pd.setUnit(val_unit[1]);
+                            pd.setName(time);
+                            timestamp.add(pd);
+                        }
+                    }
+                }
+                clinical.setTimestamp(timestamp);
+                presentLabel.add(presentLabel.getClinicals(), clinical);
+            }
+            //入院途径
+            List<Lemma> beHospitalizedWayLemmas = createEntityTree(aiOut, EntityEnum.BEHOSPITALIZEDWAY.toString());
+            for (Lemma lemma : beHospitalizedWayLemmas) {
+                BeHospitalizedWay beHospitalizedWay = new BeHospitalizedWay();
+                beHospitalizedWay.setName(lemma.getText());
+                presentLabel.setBeHospitalizedWay(beHospitalizedWay);
+            }
+            //诊断信息
+            EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
+            List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
+            presentLabel.setDiags(diags);
+
+            //一般情况信息
+            List<Lemma> geneLemmas = createEntityTree(aiOut, EntityEnum.GENERAL_DESCRIPT.toString());
+            for (Lemma lemma : geneLemmas) {
+                General general = new General();
+                general.setName(lemma.getText());
+                presentLabel.add(presentLabel.getGens(), general);
+            }
+            List<Lemma> causeLemmas = createEntityTree(aiOut, EntityEnum.CAUSE.toString());
+            List<Cause> causes = new ArrayList<>();
+            for (Lemma lemma : causeLemmas) {
+                Cause cause = new Cause();
+                cause.setName(lemma.getText());
+                causes.add(cause);
+            }
+            presentLabel.setCauses(causes);
+
+            //一般情况描述信息
+            EntityProcessGenerals entityProcessGeneral = new EntityProcessGenerals();
+            List<GeneralDesc> generals = entityProcessGeneral.extractEntity(aiOut);
+            presentLabel.setGenerals(generals);
+
+            //辅检信息
+            EntityProcessPacs entityProcessLis = new EntityProcessPacs();
+            List<Pacs> pacses = entityProcessLis.extractEntity(aiOut);
+            presentLabel.setPacses(pacses);
+
+            //治疗
+            List<Lemma> cureLemmas = createEntityTree(aiOut, EntityEnum.CURE.toString());
+            List<Treat> treats = new ArrayList<>();
+            for (Lemma lemma : cureLemmas) {
+                Treat treat = new Treat();
+                treat.setName(lemma.getText());
+                treats.add(treat);
+            }
+            presentLabel.setTreats(treats);
+            //治疗
+            List<Lemma> cureLemmas_me = createEntityTree(aiOut, EntityEnum.DRUG.toString());
+            List<Medicine> medicines = new ArrayList<>();
+            for (Lemma lemma : cureLemmas_me) {
+                Medicine medicine = new Medicine();
+                medicine.setName(lemma.getText());
+                medicines.add(medicine);
+            }
+            presentLabel.setMedicines(medicines);
+
+            //手术
+            List<Lemma> operationLemmas = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
+            for (Lemma lemma : operationLemmas) {
+                Operation operation = new Operation();
+                operation.setName(lemma.getText());
+                presentLabel.add(presentLabel.getOperations(), operation);
+            }
+
+            //时间
+            List<Lemma> pdLemmas = createEntityTree(aiOut, EntityEnum.TIME.toString());
+            List<PD> pds = new ArrayList<>();
+            for (Lemma lemma : pdLemmas) {
+                PD pd = new PD();
+                pd.setName(lemma.getText());
+                pds.add(pd);
+            }
+            presentLabel.setPds(pds);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error(e.getMessage(), e);
+        }
+        return presentLabel;
+    }
+}

+ 1 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessDiag.java

@@ -24,6 +24,7 @@ public class EntityProcessDiag extends EntityProcess {
             for (Lemma lemma : diagLemmas) {
                 Diag diag = new Diag();
                 diag.setName(lemma.getText());
+                diag.setStandName(lemma.getText());
                 if (lemma.isHaveChildren()) {
                     diag.setNegative(findNegative(lemma));//阴性
                     diag.setPossible(findT(lemma, new Possible(), EntityEnum.POSSIBLE.toString()));//可能的

+ 1 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessPast.java

@@ -30,6 +30,7 @@ public class EntityProcessPast extends EntityProcess {
 
                 Diag diag = new Diag();
                 diag.setName(lemma.getText());
+                diag.setStandName(lemma.getText());
                 if (lemma.isHaveChildren()) {
                     //阴性
                     diag.setNegative(findNegative(lemma));

+ 6 - 0
src/main/java/com/diagbot/model/entity/Menses.java

@@ -15,10 +15,16 @@ import java.util.List;
 @Getter
 public class Menses extends General {
     private List<Clinical> clinicals;
+    // 初潮年龄
     private MenarcheAge menarcheAge;
+    // 行经天数
     private MensesDuration mensesDuration;
+    // 月经周期
     private MenstrualCycle menstrualCycle;
+    // 绝经年龄
     private MenopauseAge menopauseAge;
+    // 绝经时间
     private MenopauseTime menopauseTime;
+    // 末次月经
     private LastMenstrual lastMenstrual;
 }

+ 2 - 0
src/main/java/com/diagbot/model/label/MenstrualLabel.java

@@ -17,6 +17,8 @@ import java.util.List;
 @Setter
 @Getter
 public class MenstrualLabel extends GeneralLabel {
+    // 月经
     List<Menses> mensesList;
+    // 白带
     List<Leukorrhea> leukorrheas;
 }