kongwz před 4 roky
rodič
revize
1b24af7dd5
100 změnil soubory, kde provedl 3772 přidání a 0 odebrání
  1. 22 0
      pom.xml
  2. 23 0
      src/main/java/com/diagbot/client/CRFServiceClient.java
  3. 10 0
      src/main/java/com/diagbot/client/hystrix/CRFServiceHystrix.java
  4. 30 0
      src/main/java/com/diagbot/model/ai/AIAnalyze.java
  5. 491 0
      src/main/java/com/diagbot/model/ai/BeHospitalizedAI.java
  6. 251 0
      src/main/java/com/diagbot/model/ai/ModelAI.java
  7. 22 0
      src/main/java/com/diagbot/model/ai/model/CrfOut.java
  8. 241 0
      src/main/java/com/diagbot/model/ai/model/EntityEnum.java
  9. 35 0
      src/main/java/com/diagbot/model/ai/model/Lemma.java
  10. 19 0
      src/main/java/com/diagbot/model/ai/model/Relation.java
  11. 376 0
      src/main/java/com/diagbot/model/ai/process/EntityProcess.java
  12. 143 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessClinic.java
  13. 39 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessDiag.java
  14. 176 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessFamily.java
  15. 40 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessGenerals.java
  16. 50 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessLis.java
  17. 70 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessMarital.java
  18. 119 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessMenses.java
  19. 90 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessPacs.java
  20. 200 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessPast.java
  21. 138 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessPersonal.java
  22. 57 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessVital.java
  23. 15 0
      src/main/java/com/diagbot/model/entity/Address.java
  24. 10 0
      src/main/java/com/diagbot/model/entity/Age.java
  25. 10 0
      src/main/java/com/diagbot/model/entity/Aggravate.java
  26. 18 0
      src/main/java/com/diagbot/model/entity/Allergy.java
  27. 10 0
      src/main/java/com/diagbot/model/entity/AllergyDesc.java
  28. 19 0
      src/main/java/com/diagbot/model/entity/AllergyFood.java
  29. 19 0
      src/main/java/com/diagbot/model/entity/AllergyMedicine.java
  30. 18 0
      src/main/java/com/diagbot/model/entity/Annotation.java
  31. 10 0
      src/main/java/com/diagbot/model/entity/BeHospitalizedWay.java
  32. 15 0
      src/main/java/com/diagbot/model/entity/BetterFinding.java
  33. 10 0
      src/main/java/com/diagbot/model/entity/BloodReaction.java
  34. 18 0
      src/main/java/com/diagbot/model/entity/BloodTransfusion.java
  35. 9 0
      src/main/java/com/diagbot/model/entity/BodyPart.java
  36. 9 0
      src/main/java/com/diagbot/model/entity/Cause.java
  37. 16 0
      src/main/java/com/diagbot/model/entity/Chief.java
  38. 18 0
      src/main/java/com/diagbot/model/entity/ChiefPresentAnnotation.java
  39. 27 0
      src/main/java/com/diagbot/model/entity/Clinical.java
  40. 15 0
      src/main/java/com/diagbot/model/entity/ConjugalRelation.java
  41. 16 0
      src/main/java/com/diagbot/model/entity/Consanguineous.java
  42. 15 0
      src/main/java/com/diagbot/model/entity/Consultation.java
  43. 15 0
      src/main/java/com/diagbot/model/entity/Contact.java
  44. 18 0
      src/main/java/com/diagbot/model/entity/Dead.java
  45. 13 0
      src/main/java/com/diagbot/model/entity/DeadReason.java
  46. 16 0
      src/main/java/com/diagbot/model/entity/Decorate.java
  47. 9 0
      src/main/java/com/diagbot/model/entity/Degree.java
  48. 21 0
      src/main/java/com/diagbot/model/entity/Diag.java
  49. 10 0
      src/main/java/com/diagbot/model/entity/DiagHistory.java
  50. 16 0
      src/main/java/com/diagbot/model/entity/DiagInfectious.java
  51. 10 0
      src/main/java/com/diagbot/model/entity/DoctorAdvice.java
  52. 15 0
      src/main/java/com/diagbot/model/entity/Dose.java
  53. 18 0
      src/main/java/com/diagbot/model/entity/Drinking.java
  54. 15 0
      src/main/java/com/diagbot/model/entity/EpidemicArea.java
  55. 29 0
      src/main/java/com/diagbot/model/entity/Family.java
  56. 15 0
      src/main/java/com/diagbot/model/entity/Fertility.java
  57. 15 0
      src/main/java/com/diagbot/model/entity/Frequency.java
  58. 23 0
      src/main/java/com/diagbot/model/entity/General.java
  59. 16 0
      src/main/java/com/diagbot/model/entity/GeneralDesc.java
  60. 13 0
      src/main/java/com/diagbot/model/entity/GeneticDiseaseKeyword.java
  61. 15 0
      src/main/java/com/diagbot/model/entity/HealthCondition.java
  62. 15 0
      src/main/java/com/diagbot/model/entity/IndexValue.java
  63. 10 0
      src/main/java/com/diagbot/model/entity/LastMenstrual.java
  64. 18 0
      src/main/java/com/diagbot/model/entity/Leukorrhea.java
  65. 19 0
      src/main/java/com/diagbot/model/entity/Lis.java
  66. 16 0
      src/main/java/com/diagbot/model/entity/LisValue.java
  67. 16 0
      src/main/java/com/diagbot/model/entity/MaritalHistory.java
  68. 15 0
      src/main/java/com/diagbot/model/entity/MaritalStatus.java
  69. 15 0
      src/main/java/com/diagbot/model/entity/Marryiage.java
  70. 10 0
      src/main/java/com/diagbot/model/entity/Medicine.java
  71. 10 0
      src/main/java/com/diagbot/model/entity/MenarcheAge.java
  72. 10 0
      src/main/java/com/diagbot/model/entity/MenopauseAge.java
  73. 10 0
      src/main/java/com/diagbot/model/entity/MenopauseTime.java
  74. 24 0
      src/main/java/com/diagbot/model/entity/Menses.java
  75. 10 0
      src/main/java/com/diagbot/model/entity/MensesDuration.java
  76. 10 0
      src/main/java/com/diagbot/model/entity/MenstrualCycle.java
  77. 9 0
      src/main/java/com/diagbot/model/entity/Modification.java
  78. 17 0
      src/main/java/com/diagbot/model/entity/Negative.java
  79. 10 0
      src/main/java/com/diagbot/model/entity/Notes.java
  80. 10 0
      src/main/java/com/diagbot/model/entity/NursingLevel.java
  81. 15 0
      src/main/java/com/diagbot/model/entity/Occupation.java
  82. 19 0
      src/main/java/com/diagbot/model/entity/Operation.java
  83. 10 0
      src/main/java/com/diagbot/model/entity/OperationResult.java
  84. 15 0
      src/main/java/com/diagbot/model/entity/Organism.java
  85. 14 0
      src/main/java/com/diagbot/model/entity/Outcome.java
  86. 15 0
      src/main/java/com/diagbot/model/entity/OutcomeCure.java
  87. 15 0
      src/main/java/com/diagbot/model/entity/OutcomeToBetter.java
  88. 19 0
      src/main/java/com/diagbot/model/entity/OuterCourtyard.java
  89. 11 0
      src/main/java/com/diagbot/model/entity/PD.java
  90. 20 0
      src/main/java/com/diagbot/model/entity/Pacs.java
  91. 16 0
      src/main/java/com/diagbot/model/entity/PacsValue.java
  92. 19 0
      src/main/java/com/diagbot/model/entity/Past.java
  93. 15 0
      src/main/java/com/diagbot/model/entity/PositiveFinding.java
  94. 11 0
      src/main/java/com/diagbot/model/entity/Possible.java
  95. 10 0
      src/main/java/com/diagbot/model/entity/Property.java
  96. 15 0
      src/main/java/com/diagbot/model/entity/Quantity.java
  97. 10 0
      src/main/java/com/diagbot/model/entity/Relief.java
  98. 12 0
      src/main/java/com/diagbot/model/entity/Sign.java
  99. 16 0
      src/main/java/com/diagbot/model/entity/SimilarDiag.java
  100. 0 0
      src/main/java/com/diagbot/model/entity/Smoking.java

+ 22 - 0
pom.xml

@@ -176,6 +176,28 @@
             <scope>runtime</scope>
         </dependency>
 
+        <!-- 文件上传相关�?? -->
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+            <version>1.9.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>${commons-lang3.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+        </dependency>
+
     </dependencies>
 
     <!-- 私有仓库 -->

+ 23 - 0
src/main/java/com/diagbot/client/CRFServiceClient.java

@@ -0,0 +1,23 @@
+package com.diagbot.client;
+
+
+import com.diagbot.vo.CRFVo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+
+/**
+ * @Description: 调用条件随机场服务
+ * @author: Mark Huang
+ * @time: 2019/12/13 9:52
+ */
+@FeignClient(value = "CRF-service", url="${CRF.url}")
+public interface CRFServiceClient {
+
+    @PostMapping(value = "")
+    String getAnnotation(@RequestBody CRFVo crfVo);
+}
+
+
+

+ 10 - 0
src/main/java/com/diagbot/client/hystrix/CRFServiceHystrix.java

@@ -0,0 +1,10 @@
+package com.diagbot.client.hystrix;
+
+
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class CRFServiceHystrix {
+
+}

+ 30 - 0
src/main/java/com/diagbot/model/ai/AIAnalyze.java

@@ -0,0 +1,30 @@
+package com.diagbot.model.ai;
+
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class AIAnalyze {
+
+    /*private CRFServiceClient crfServiceClient;
+    private SimilarityServiceClient similarityServiceClient;
+    BeHospitalizedAI beHospitalizedAI = new BeHospitalizedAI();
+    FirstCourseRecordAI firstCourseRecordAI = new FirstCourseRecordAI();
+    LeaveHospitalAI leaveHospitalAI = new LeaveHospitalAI();
+    ThreeLevelWardAI threeLevelWardAI = new ThreeLevelWardAI();
+    OperationAI operationAI = new OperationAI();
+
+    public AIAnalyze(CRFServiceClient crfService, SimilarityServiceClient similarityServiceClient) {
+        this.crfServiceClient = crfService;
+        this.similarityServiceClient = similarityServiceClient;
+    }
+
+    public void aiProcess(InputInfo inputInfo) {
+        beHospitalizedAI.medrec(inputInfo, crfServiceClient);
+        firstCourseRecordAI.medrec(inputInfo, crfServiceClient, similarityServiceClient);
+        leaveHospitalAI.medrec(inputInfo, crfServiceClient);
+        threeLevelWardAI.medrec(inputInfo, crfServiceClient);
+        operationAI.medrec(inputInfo, crfServiceClient);
+    }*/
+
+}

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

@@ -0,0 +1,491 @@
+//package com.diagbot.model.ai;
+//
+//import com.alibaba.fastjson.JSONArray;
+//import com.alibaba.fastjson.JSONObject;
+//import com.diagbot.client.CRFServiceClient;
+//import com.diagbot.model.ai.process.*;
+//import com.diagbot.model.entity.Diag;
+//import com.diagbot.model.entity.Lis;
+//import com.diagbot.model.entity.Pacs;
+//import com.diagbot.model.entity.Vital;
+//import com.diagbot.model.label.*;
+//import com.diagbot.util.Content;
+//import com.diagbot.util.StringUtil;
+//import org.springframework.stereotype.Component;
+//
+//import java.util.Arrays;
+//import java.util.List;
+//
+///**
+// * @ClassName : InHospitalDoc
+// * @Description :
+// * @Author : 楼辉荣
+// * @Date: 2020-03-03 18:58
+// */
+//@Component
+//public class BeHospitalizedAI extends ModelAI {
+//    /**
+//     * FirstCourseRecord_cx[病历首程]
+//     * PastFamily_cx[既往史家族史]
+//     * PersonalHistory_cx[个人史(月经史、婚育史)]
+//     * HPIForCX_cx[主诉、现病史、专科检查]
+//     * GeneralVital_cx[一般体格检查]
+//     * chief_present[邵逸夫医院主诉]
+//     * Diagnoses_cx[诊断]
+//     * Present_cx[现病史]
+//     */
+//    public static List<String> medicalTextType = Arrays.asList("FirstCourseRecord_cx", "PastFamily_cx", "PersonalHistory_cx", "HPIForCX_cx",
+//            "GeneralVital_cx", "chief_present", "Diagnoses_cx", "Present_cx");
+//    public static String entityRelationObject = "entity_relation_object";
+//    public static String outputs = "outputs";
+//
+//    public void medrec(InputInfo inputInfo, CRFServiceClient crfServiceClient) {
+//        JSONArray crfContent = new JSONArray();
+//        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+//        if (beHospitalizedDoc != null) {
+//            /* 主诉 */
+//            if (beHospitalizedDoc.getChiefLabel() != null && beHospitalizedDoc.getChiefLabel().isCrfLabel()) {
+//                String chiefText = beHospitalizedDoc.getChiefLabel().getText();
+//                if (StringUtil.isNotBlank(chiefText)) {
+//                    chiefText = "主诉:" + StringUtil.removeBlank(chiefText);//主诉入参 文本前需加 "主诉:"
+//                    putContent(crfContent, medicalTextType.get(7), chiefText, Content.chief);/* 2020-06-08修改主诉模型为现病史模型 */
+//                }
+//            }
+//            /* 现病史 */
+//            if (beHospitalizedDoc.getPresentLabel() != null && beHospitalizedDoc.getPresentLabel().isCrfLabel()) {
+//                String presentText = beHospitalizedDoc.getPresentLabel().getText();
+//                putContent(crfContent, medicalTextType.get(7), presentText, Content.present);
+//            }
+//            /* 既往史 */
+//            if (beHospitalizedDoc.getPastLabel() != null && beHospitalizedDoc.getPastLabel().isCrfLabel()) {
+//                String pastText = beHospitalizedDoc.getPastLabel().getText();
+//                putContent(crfContent, medicalTextType.get(1), pastText, Content.past);
+//            }
+//            /* 月经史文本需从个人史截取一部分文本拼接 */
+//            String concatMenstrual = "";
+//            /* 个人史 */
+//            if (beHospitalizedDoc.getPersonalLabel() != null && beHospitalizedDoc.getPersonalLabel().isCrfLabel()) {
+//                String personalText = beHospitalizedDoc.getPersonalLabel().getText();
+//                putContent(crfContent, medicalTextType.get(2), personalText, Content.personal);
+//                concatMenstrual = getConcatMenstrual(concatMenstrual, personalText);
+//            }
+//            /* 婚育史 */
+//            if (beHospitalizedDoc.getMaritalLabel() != null && beHospitalizedDoc.getMaritalLabel().isCrfLabel()) {
+//                String maritalText = beHospitalizedDoc.getMaritalLabel().getText();
+//                putContent(crfContent, medicalTextType.get(2), maritalText, Content.marriage);
+//            }
+//            /* 月经史 */
+//            if (beHospitalizedDoc.getMenstrualLabel() != null && beHospitalizedDoc.getMenstrualLabel().isCrfLabel()) {
+//                String menstrualText = beHospitalizedDoc.getMenstrualLabel().getText();
+//                putContent(crfContent, medicalTextType.get(2), concatMenstrual, menstrualText, Content.menses);
+//            }
+//            /* 家族史 */
+//            if (beHospitalizedDoc.getFamilyLabel() != null && beHospitalizedDoc.getFamilyLabel().isCrfLabel()) {
+//                String familyText = beHospitalizedDoc.getFamilyLabel().getText();
+//                putContent(crfContent, medicalTextType.get(1), familyText, Content.family);
+//            }
+//            /* 辅助检查(暂用主诉现病史模型,之后会新训练单独模型再做修改) */
+//            if (beHospitalizedDoc.getPacsLabel() != null && beHospitalizedDoc.getPacsLabel().isCrfLabel()) {
+//                String pacsText = beHospitalizedDoc.getPacsLabel().getText();
+//                putContent(crfContent, medicalTextType.get(3), pacsText, Content.pacs);
+//            }
+//            /* 专科检查(专科体格检查) */
+//            if (beHospitalizedDoc.getVitalLabelSpecial() != null && beHospitalizedDoc.getVitalLabelSpecial().isCrfLabel()) {
+//                String vitalSpecialText = beHospitalizedDoc.getVitalLabelSpecial().getText();
+//                putContent(crfContent, medicalTextType.get(3), vitalSpecialText, Content.special_exam);
+//            }
+//            /* 一般体格检查(存放一般查体) */
+//            if (beHospitalizedDoc.getVitalLabel() != null && beHospitalizedDoc.getVitalLabel().isCrfLabel()) {
+//                String vitalText = beHospitalizedDoc.getVitalLabel().getText();
+//                putContent(crfContent, medicalTextType.get(4), vitalText, Content.phys_exam);
+//            }
+//            /* 初步诊断 */
+//            if (beHospitalizedDoc.getInitialDiagLabel() != null && beHospitalizedDoc.getInitialDiagLabel().isCrfLabel()) {
+//                String initialDiagText = beHospitalizedDoc.getInitialDiagLabel().getText();
+//                if (StringUtil.isNotBlank(initialDiagText)) {
+//                    /*initial_diag_text = CatalogueUtil.removeBetweenWordSpace(initial_diag_text);*/
+//                    putContent(crfContent, medicalTextType.get(6), initialDiagText, Content.initial_diag);
+//                }
+//            }
+//            /* 修正诊断 */
+//            if (beHospitalizedDoc.getRevisedDiagLabel() != null && beHospitalizedDoc.getRevisedDiagLabel().isCrfLabel()) {
+//                String revisedDiagText = beHospitalizedDoc.getRevisedDiagLabel().getText();
+//                /*if (CatalogueUtil.numberExist(initial_diag_text)) {
+//                    revised_diag_text = CatalogueUtil.removeBetweenWordSpace(revised_diag_text);
+//                }*/
+//                putContent(crfContent, medicalTextType.get(6), revisedDiagText, Content.revised_diag);
+//            }
+//            /* 补充诊断 */
+//            if (beHospitalizedDoc.getSuppleDiagLabel() != null && beHospitalizedDoc.getSuppleDiagLabel().isCrfLabel()) {
+//                String suppleDiagText = beHospitalizedDoc.getSuppleDiagLabel().getText();
+//                /*if (CatalogueUtil.numberExist(initial_diag_text)) {
+//                    supple_diag_text = CatalogueUtil.removeBetweenWordSpace(supple_diag_text);
+//                }*/
+//                putContent(crfContent, medicalTextType.get(6), suppleDiagText, Content.supple_diag);
+//            }
+//
+//            JSONObject midData = loadAI(inputInfo.isUseCrfCache(), inputInfo.getMedicalRecordInfoDoc().getStructureMap().get("behospitalCode"), crfContent, crfServiceClient);
+//
+//            /* 处理主诉 */
+//            if (beHospitalizedDoc.getChiefLabel() != null && beHospitalizedDoc.getChiefLabel().isCrfLabel()) {
+//                putChiefCrfData(midData.getJSONObject(Content.chief), inputInfo);
+//            }
+//            /* 处理现病史 */
+//            if (beHospitalizedDoc.getPresentLabel() != null && beHospitalizedDoc.getPresentLabel().isCrfLabel()) {
+//                putPresentCrfData(midData.getJSONObject(Content.present), inputInfo);
+//            }
+//            /* 处理既往史 */
+//            if (beHospitalizedDoc.getPastLabel() != null && beHospitalizedDoc.getPastLabel().isCrfLabel()) {
+//                putPastCrfData(midData.getJSONObject(Content.past), inputInfo);
+//            }
+//            /* 处理个人史 */
+//            if (beHospitalizedDoc.getPersonalLabel() != null && beHospitalizedDoc.getPersonalLabel().isCrfLabel()) {
+//                putPersonalCrfData(midData.getJSONObject(Content.personal), inputInfo);
+//            }
+//            /* 处理月经史 */
+//            if (beHospitalizedDoc.getMenstrualLabel() != null && beHospitalizedDoc.getMenstrualLabel().isCrfLabel()) {
+//                putMensesCrfData(midData.getJSONObject(Content.menses), inputInfo);
+//            }
+//            /* 处理家族史 */
+//            if (beHospitalizedDoc.getFamilyLabel() != null && beHospitalizedDoc.getFamilyLabel().isCrfLabel()) {
+//                putFamilyCrfData(midData.getJSONObject(Content.family), inputInfo);
+//            }
+//            /* 处理婚育史 */
+//            if (beHospitalizedDoc.getMaritalLabel() != null && beHospitalizedDoc.getMaritalLabel().isCrfLabel()) {
+//                putMaritalCrfData(midData.getJSONObject(Content.marriage), inputInfo);
+//            }
+//            /* 处理初步诊断 */
+//            if (beHospitalizedDoc.getInitialDiagLabel() != null && beHospitalizedDoc.getInitialDiagLabel().isCrfLabel()) {
+//                putInitialDiagCrfData(midData.getJSONObject(Content.initial_diag), inputInfo);
+//            }
+//            /* 处理修正诊断 */
+//            if (beHospitalizedDoc.getRevisedDiagLabel() != null && beHospitalizedDoc.getRevisedDiagLabel().isCrfLabel()) {
+//                putRevisedDiagCrfData(midData.getJSONObject(Content.revised_diag), inputInfo);
+//            }
+//            /* 处理补充诊断 */
+//            if (beHospitalizedDoc.getSuppleDiagLabel() != null && beHospitalizedDoc.getSuppleDiagLabel().isCrfLabel()) {
+//                putSuppleDiagCrfData(midData.getJSONObject(Content.supple_diag), inputInfo);
+//            }
+//            /* 处理辅助检查 */
+//            if (beHospitalizedDoc.getPacsLabel() != null && beHospitalizedDoc.getPacsLabel().isCrfLabel()) {
+//                putPacsCrfData(midData.getJSONObject(Content.pacs), inputInfo);
+//            }
+//        }
+//    }
+//
+//    public void putChiefCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //使用现病史结构
+//        EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
+//        PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
+//
+//        ChiefLabel chiefLabel = inputInfo.getBeHospitalizedDoc().getChiefLabel();
+//        chiefLabel.setClinicals(presentLabel.getClinicals());
+//        chiefLabel.setDiags(presentLabel.getDiags());
+//        chiefLabel.setPds(presentLabel.getPds());
+//    }
+//
+//    public void putPresentCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //放置入inputinfo
+//        EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
+//        PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
+//        presentLabel.setText(inputInfo.getBeHospitalizedDoc().getPresentLabel().getText());
+//        List<Lis> lis = loadLises(aiOut);
+//        presentLabel.setLises(lis);
+//        inputInfo.getBeHospitalizedDoc().setPresentLabel(presentLabel);
+//    }
+//
+//    /**
+//     * 家族史
+//     *
+//     * @param jsonObject
+//     * @param inputInfo
+//     */
+//    public void putFamilyCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //家族史信息处理
+//        EntityProcessFamily entityProcess = new EntityProcessFamily();
+//        FamilyLabel familyLabel = entityProcess.extractEntity(aiOut);
+//        familyLabel.setText(inputInfo.getBeHospitalizedDoc().getFamilyLabel().getText());
+//        inputInfo.getBeHospitalizedDoc().setFamilyLabel(familyLabel);
+//    }
+//
+//    /**
+//     * 婚育史
+//     *
+//     * @param jsonObject
+//     * @param inputInfo
+//     */
+//    public void putMaritalCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //家族史信息处理
+//        EntityProcessMarital entityProcess = new EntityProcessMarital();
+//        MaritalLabel maritalLabel = entityProcess.extractEntity(aiOut);
+//        maritalLabel.setText(inputInfo.getBeHospitalizedDoc().getMaritalLabel().getText());
+//        inputInfo.getBeHospitalizedDoc().setMaritalLabel(maritalLabel);
+//    }
+//
+//    public void putPastCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //放置入inputinfo
+//        EntityProcessPast entityProcessPast = new EntityProcessPast();
+//        PastLabel pastLabel = entityProcessPast.extractEntity(aiOut);
+//        pastLabel.setText(inputInfo.getBeHospitalizedDoc().getPastLabel().getText());
+//        inputInfo.getBeHospitalizedDoc().setPastLabel(pastLabel);
+//
+//    }
+//
+//    /**
+//     * 个人史信息提取
+//     *
+//     * @param jsonObject
+//     * @param inputInfo
+//     */
+//    public void putPersonalCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //个人史信息提取
+//        EntityProcessPersonal entityProcessPersonal = new EntityProcessPersonal();
+//        PersonalLabel personalLabel = entityProcessPersonal.extractEntity(aiOut);
+//        personalLabel.setText(inputInfo.getBeHospitalizedDoc().getPersonalLabel().getText());
+//        inputInfo.getBeHospitalizedDoc().setPersonalLabel(personalLabel);
+//    }
+//
+//    /**
+//     * 月经史信息提取
+//     *
+//     * @param jsonObject
+//     * @param inputInfo
+//     */
+//    public void putMensesCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //月经史信息处理
+//        EntityProcessMenses entityProcess = new EntityProcessMenses();
+//        MenstrualLabel menstrualLabel = entityProcess.extractEntity(aiOut);
+//        menstrualLabel.setText(inputInfo.getBeHospitalizedDoc().getMenstrualLabel().getText());
+//        inputInfo.getBeHospitalizedDoc().setMenstrualLabel(menstrualLabel);
+//    }
+//
+//    /**
+//     * 初步诊断信息提取
+//     *
+//     * @param jsonObject
+//     * @param inputInfo
+//     */
+//    public void putInitialDiagCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //诊断信息
+//        EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
+//        List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
+//
+//        DiagLabel initialDiagLabel = new DiagLabel();
+//        initialDiagLabel.setText(inputInfo.getBeHospitalizedDoc().getInitialDiagLabel().getText());
+//        initialDiagLabel.setDiags(diags);
+//        inputInfo.getBeHospitalizedDoc().setInitialDiagLabel(initialDiagLabel);
+//
+//        //        //因为关系抽取未标注完成,先用规则
+//        //        String diagString = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel().getText();
+//        //        if (StringUtils.isNotEmpty(diagString)) {
+//        //            String[] diagArray = diagString.split(",");
+//        //            List<Diag> diags = new ArrayList<>();
+//        //            for (String d : diagArray) {
+//        //                Diag diag = DiagEnhancer.create(d);
+//        //                diags.add(diag);
+//        //            }
+//        //            InitialDiagLabel initialDiagLabel = new InitialDiagLabel();
+//        //            initialDiagLabel.setDiags(diags);
+//        //        }
+//    }
+//
+//    /**
+//     * 修正诊断信息提取
+//     *
+//     * @param jsonObject
+//     * @param inputInfo
+//     */
+//    public void putRevisedDiagCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //诊断信息
+//        EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
+//        List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
+//
+//        DiagLabel revisedDiagLabel = new DiagLabel();
+//        revisedDiagLabel.setText(inputInfo.getBeHospitalizedDoc().getRevisedDiagLabel().getText());
+//        revisedDiagLabel.setDiags(diags);
+//        inputInfo.getBeHospitalizedDoc().setRevisedDiagLabel(revisedDiagLabel);
+//
+//        //替换初步诊断中的第一个诊断信息
+//       /* DiagLabel initialDiagLabel = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel();
+//        if (initialDiagLabel.getDiags().size() > 0 && diags.size() > 0) {
+//            initialDiagLabel.getDiags().remove(0);
+//            initialDiagLabel.getDiags().add(0, diags.get(0));
+//        }*/
+//    }
+//
+//    /**
+//     * 补充诊断信息提取
+//     *
+//     * @param jsonObject
+//     * @param inputInfo
+//     */
+//    public void putSuppleDiagCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //诊断信息
+//        EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
+//        List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
+//
+//        DiagLabel suppleDiagLabel = new DiagLabel();
+//        suppleDiagLabel.setText(inputInfo.getBeHospitalizedDoc().getSuppleDiagLabel().getText());
+//        suppleDiagLabel.setDiags(diags);
+//        inputInfo.getBeHospitalizedDoc().setSuppleDiagLabel(suppleDiagLabel);
+//    }
+//
+//    /**
+//     * 辅助检查信息抽取
+//     *
+//     * @param jsonObject
+//     * @param inputInfo
+//     */
+//    public void putPacsCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+//        if (jsonObject == null) {
+//            return;
+//        }
+//        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+//        if (aiOut == null) {
+//            return;
+//        }
+//        //放置入inputinfo
+//        PacsLabel pacsLabel = inputInfo.getBeHospitalizedDoc().getPacsLabel();
+//        pacsLabel.setPacses(loadPacses(aiOut));
+//    }
+//
+//    /**
+//     * 关系抽取疾病信息
+//     *
+//     * @param aiOut
+//     * @return
+//     */
+//    public List<Diag> loadDiags(JSONObject aiOut) {
+//        //诊断信息
+//        EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
+//        List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
+//        return diags;
+//    }
+//
+//    /**
+//     * 关系抽取化验信息
+//     *
+//     * @param aiOut
+//     * @return
+//     */
+//    public List<Lis> loadLises(JSONObject aiOut) {
+//        //化验信息
+//        EntityProcessLis entityProcessLis = new EntityProcessLis();
+//        List<Lis> lises = entityProcessLis.extractEntity(aiOut);
+//        return lises;
+//    }
+//
+//    /**
+//     * 关系抽取辅检信息
+//     *
+//     * @param aiOut
+//     * @return
+//     */
+//    public List<Pacs> loadPacses(JSONObject aiOut) {
+//        //辅检信息
+//        EntityProcessPacs entityProcessLis = new EntityProcessPacs();
+//        List<Pacs> pacses = entityProcessLis.extractEntity(aiOut);
+//        return pacses;
+//    }
+//
+//    /**
+//     * 关系抽取体格检查
+//     *
+//     * @param aiOut
+//     * @return
+//     */
+//    public List<Vital> loadvital(JSONObject aiOut) {
+//        //一般情况描述信息
+//        EntityProcessVital entityProcessVital = new EntityProcessVital();
+//        List<Vital> vitals = entityProcessVital.extractEntity(aiOut);
+//        return vitals;
+//    }
+//
+//    /**
+//     * 从个人史取最后30个字,拼接到月经史
+//     *
+//     * @param concatMenstrual
+//     * @param personalText
+//     * @return
+//     */
+//    private String getConcatMenstrual(String concatMenstrual, String personalText) {
+//        if (personalText != null) {
+//            if (personalText.length() > 30) {
+//                concatMenstrual = personalText.substring(personalText.length() - 30);
+//            } else {
+//                concatMenstrual = personalText;
+//            }
+//        }
+//        return concatMenstrual;
+//    }
+//}

+ 251 - 0
src/main/java/com/diagbot/model/ai/ModelAI.java

@@ -0,0 +1,251 @@
+package com.diagbot.model.ai;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.diagbot.client.CRFServiceClient;
+import com.diagbot.model.entity.Annotation;
+import com.diagbot.util.CatalogueUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.CRFVo;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.List;
+
+/**
+ * @ClassName : ModelAI
+ * @Description : 算法基类
+ * @Author : 楼辉荣
+ * @Date: 2020-03-19 15:08
+ */
+@Slf4j
+public class ModelAI {
+    /**
+     * 获取CRF返回数据
+     *
+     * @param crfContent
+     * @param crfServiceClient
+     * @return
+     */
+    protected JSONObject loadAI(boolean useCrfCache, String behospitalCode, JSONArray crfContent, CRFServiceClient crfServiceClient) {
+        JSONArray data = null;
+        /*RedisUtil redisUtil = SpringContextUtil.getBean("redisUtil");
+        SpecialStorageUtil specialStorageUtil = SpringContextUtil.getBean("specialStorageUtil");
+        String prex = "crf_cache:" + specialStorageUtil.getHospitalIdThreadLocal().get() + ":";
+        String classname = this.getClass().getName();
+        if (useCrfCache) {
+            data = (JSONArray) redisUtil.hget(prex + behospitalCode, classname);
+        }*/
+        if (data == null) {
+            //存储CRF完整所需结构数据
+            CRFVo crfVo = new CRFVo();
+            crfVo.setData(crfContent);
+            long t1 = System.currentTimeMillis();
+            //获取CRF模型返回数据
+            data = getAnnotation(crfServiceClient, crfVo).getData();
+            long t2 = System.currentTimeMillis();
+            /*log.error(behospitalCode + "-----" + classname + "(CRF)  耗时:" + (t2 - t1));
+            if (data != null) {
+                redisUtil.hset(prex + behospitalCode, classname, data, 86400);
+            }*/
+        }
+        JSONObject midData = getOutputs(data);
+        return midData;
+    }
+
+    protected JSONObject loadEntity(JSONObject jsonObject, String entityRelationObject, String outputs, String content) {
+        if (jsonObject == null) {
+            return new JSONObject();
+        }
+        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(outputs);
+        aiOut.put(content, jsonObject.getJSONObject(entityRelationObject).getString(content));
+        return aiOut;
+    }
+
+    private Annotation getAnnotation(CRFServiceClient crfServiceClient, CRFVo crfVo) {
+        Annotation annotation = new Annotation();
+        try {
+            String annotation_str = crfServiceClient.getAnnotation(crfVo);
+            annotation = JSON.parseObject(annotation_str, Annotation.class);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            return annotation;
+        }
+    }
+
+    protected void putContent(JSONArray crfContent, String medicalTextType, String text, String sign) {
+        String move_text = CatalogueUtil.removeSpecialChar(text);
+        if (StringUtil.isEmpty(move_text)) {
+            return;
+        }
+        JSONObject detailContent = new JSONObject();
+        detailContent.put("medical_text_type", medicalTextType);
+        detailContent.put("content", move_text);
+        detailContent.put("detail_title", sign);
+        crfContent.add(detailContent);
+    }
+
+    protected void putContent(JSONArray crfContent, String medicalTextType, String firstText, String secondText, String sign) {
+        String firstMoveText = CatalogueUtil.removeSpecialChar(firstText);
+        String secondMoveText = CatalogueUtil.removeSpecialChar(secondText);
+        if (StringUtil.isEmpty(firstMoveText) && StringUtil.isEmpty(secondMoveText)) {
+            return;
+        }
+        JSONObject detailContent = new JSONObject();
+        detailContent.put("medical_text_type", medicalTextType);
+        detailContent.put("content", firstMoveText + "\n" + secondMoveText);
+        detailContent.put("detail_title", sign);
+        crfContent.add(detailContent);
+    }
+
+    /**
+     * 获取CRF模型输出并处理
+     *
+     * @param data
+     * @return
+     */
+    public JSONObject getOutputs(JSONArray data) {
+        JSONObject midData = new JSONObject();
+        for (int i = 0; i < data.size(); i++) {
+            JSONObject detailContent = data.getJSONObject(i);
+            String detail_title = detailContent.getString("detail_title");
+            if (StringUtil.isNotEmpty(detail_title) && midData.get(detail_title) == null) {
+                midData.put(detail_title, detailContent);
+            }
+        }
+        return midData;
+    }
+
+    /*****************************文本相似度算法************************************/
+
+    /**
+     * 存放文本相似度入参内容
+     *
+     * @param similarContent
+     * @param firstText
+     * @param secondText
+     */
+    public void putContent(JSONArray similarContent, String firstText, String secondText) {
+        String moveFirstText = CatalogueUtil.removeSpecialChar(firstText);
+        String moveSecondText = CatalogueUtil.removeSpecialChar(secondText);
+        if (StringUtil.isEmpty(moveFirstText) || StringUtil.isEmpty(moveSecondText)) {
+            return;
+        }
+        JSONObject detailContent = new JSONObject();
+        detailContent.put("text_1", moveFirstText);
+        detailContent.put("text_2", moveSecondText);
+        similarContent.add(detailContent);
+    }
+
+    /*private Annotation getAnnotation(SimilarityServiceClient similarityServiceClient, SimilarityVo similarityVo) {
+        Annotation annotation = new Annotation();
+        try {
+            String annotation_str = similarityServiceClient.getAnnotation(similarityVo);
+            annotation = JSON.parseObject(annotation_str, Annotation.class);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            return annotation;
+        }
+    }*/
+
+    /**
+     * 获取文本相似度返回数据
+     *
+     * @param similarContent
+     * @param similarityServiceClient
+     * @return
+     */
+    /*public double loadSimilarAI(JSONArray similarContent, SimilarityServiceClient similarityServiceClient) {
+        //存储CRF完整所需结构数据
+        SimilarityVo similarityVo = new SimilarityVo();
+        similarityVo.setData(similarContent);
+        //获取CRF模型返回数据
+        JSONArray data = getAnnotation(similarityServiceClient, similarityVo).getData();
+        return getSimilarOutputs(data);
+    }*/
+
+    /**
+     * 获取文本相似度模型输出并处理
+     *
+     * @param data 数组里只有一个对象
+     * @return
+     */
+    public double getSimilarOutputs(JSONArray data) {
+        double likeRate = 0d;
+        if (data.size() > 0) {
+            JSONObject dataContent = data.getJSONObject(0);
+            likeRate = dataContent.getDoubleValue("like_rate");
+        }
+        return likeRate;
+    }
+    /*****************************主诉现病史症状文本相似度算法************************************/
+
+    /**
+     * 存放主诉现病史症状文本相似度入参内容
+     */
+    public void putContent(JSONObject similarContent, String firstText, List<String> clinicArr) {
+        if (StringUtil.isEmpty(firstText) || clinicArr.size() == 0) {
+            return;
+        }
+        similarContent.put("string1", firstText);
+        similarContent.put("string2", clinicArr);
+    }
+
+    /**
+     * 获取主诉现病史症状相似度返回数据
+     *
+     * @param string1
+     * @param string2
+     * @param chiefPresentSimilarityServiceClient
+     * @return
+     */
+   /* public JSONArray loadChiefPresentSimilarAI(String string1, List<String> string2, boolean directionCheck
+            , String modelName, ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient) {
+        //存储CRF完整所需结构数据
+        ChiefPresentSimilarityVo similarityVo = new ChiefPresentSimilarityVo();
+        JSONObject data = new JSONObject();
+        putContent(data, string1, string2);
+        similarityVo.setData(data);
+        similarityVo.setDirection_check(directionCheck);
+        similarityVo.setModel_name(modelName);
+        //获取CRF模型返回数据
+        JSONArray predY = getAnnotation(chiefPresentSimilarityServiceClient, similarityVo).getPred_y();
+        return getChiefPresentSimilarOutputs(predY);
+    }
+
+    *//**
+     * 主诉现病史相似度接口返回
+     *
+     * @param chiefPresentSimilarityServiceClient
+     * @param chiefPresentSimilarityVo
+     * @return
+     *//*
+    private ChiefPresentAnnotation getAnnotation(ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient,
+                                                 ChiefPresentSimilarityVo chiefPresentSimilarityVo) {
+        ChiefPresentAnnotation annotation = new ChiefPresentAnnotation();
+        try {
+            String annotation_str = chiefPresentSimilarityServiceClient.getAnnotation(chiefPresentSimilarityVo);
+            annotation = JSON.parseObject(annotation_str, ChiefPresentAnnotation.class);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            return annotation;
+        }
+    }*/
+
+    /**
+     * 获取主诉现病史文本相似度模型输出并处理
+     *
+     * @param predY
+     * @return
+     */
+    public JSONArray getChiefPresentSimilarOutputs(JSONArray predY) {
+        JSONArray dataArr = new JSONArray();
+        if (predY != null && predY.size() > 0) {
+            dataArr = predY.getJSONArray(0);
+        }
+        return dataArr;
+    }
+}

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

@@ -0,0 +1,22 @@
+package com.diagbot.model.ai.model;
+
+
+import com.diagbot.model.entity.*;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Getter
+@Setter
+public class CrfOut {
+    List<Clinical> symptoms = new ArrayList<Clinical>();//症状
+    List<Vital> vitals = new ArrayList<>();
+    List<Pacs> pacses = new ArrayList<>();
+    List<GeneralDesc> generals = new ArrayList<>();//基本情况
+    List<Lis> lises = new ArrayList<>();
+    List<Diag> diags = new ArrayList<>();
+    List<Past> pasts = new ArrayList<>();
+
+}

+ 241 - 0
src/main/java/com/diagbot/model/ai/model/EntityEnum.java

@@ -0,0 +1,241 @@
+package com.diagbot.model.ai.model;
+
+/**
+ * @Description:
+ * @Author: HUJING
+ * @Date: 2019/12/17 9:58
+ */
+public enum EntityEnum {
+    CLINICAL_FEATURE("临床表现"), DIEASE("疾病名称"), BODY("身体部位"), SIGN("体征"), INDEX_VALUE("指标值"),
+    LABORATORY("实验室检查"), LABORATORY_VALUE("实验室检查值"), AUXILIARY_EXAMINATION("辅助检查"), AUXILIARY_DESCRIPT("辅助检查描述"),
+    NEGATIVE("否定"), POSSIBLE("可能的"), TIME("时间"), CAUSE("诱因"), MODIFICATION("修饰"),
+    PROPERTY("性质"), DEGREE("程度"), AGGRAVATE("加重情况"), RELIEF("缓解情况"), BEHOSPITALIZEDWAY("入院途径"),
+    TREND("趋势"), FREQUENCY("频率"), QUANTITY("数量"), SIZE("尺寸"), CURE("治疗"), TREAT_MENT("治疗或治疗目的"), DRUG("药物名称"),
+    DOSE("药品剂量"), OPERATION("手术名称"), GENERAL("一般情况"), GENERAL_DESCRIPT("一般情况描述"),
+    OPERATION_KEYWORD("手术史"), OPERATION_RESULT("手术结果"), INJURY("外伤史"), ALLERGY("过敏"),
+    FOOD_ALLERGY("食物过敏原"), DRUG_ALLERGY("药物过敏原"), ALLERGY_SYMPTOM("过敏表现"), BLOOD_TRANSFUSION("输血史"),
+    TRANSFUSION_REACTION("输血反应"), VACCINATION("预防接种史"), DISEASE_KEYWORD("疾病史"), INFECTIOUS_KEYWORD("传染病史"),
+    UNKNOWN("情况不详"), HEALTH("健康情况"), AGE("年龄"), SMOKING_HISTORY("吸烟史"),
+    HISTORY_OF_ALCOHOL_INTAKE("饮酒史"), USAGE("用量"), MENSES("月经"), LEUKORRHEA("白带"),
+    BIRTH_HIS("生育情况"), CONJUGAL_RELATION("夫妻关系"), RELATIVES("家属"), GROUP_CONSULTATION("会诊"), ORGANISM("生物体"),
+    OCCUPATION("职业"), LOCATION("地点"), DEAD("死亡"), DEAD_REASON("死亡原因"),TUMOUR("肿瘤病史"),
+    SIMILAR_DISEASE_KEYWORD("相似疾病"), GENETIC_DISEASE_KEYWORD("家族遗传病"), EPIDEMIC_AREA_HISTORY("疫区史"), SPECIAL_HOBBY("特殊嗜好"),
+    CONTACT_HISTORY("接触史"), MARITAL_HISTORY("冶游史"), MARITAL_STATUS("婚姻情况"), MARRYIAGE("结婚年龄"), NEAR_RELATION("近亲史"),
+    CURE_AIM("治疗目的"), OTHER("其他"), OUTERCOURTYARD("外院"), NURSING_LEVEL("护理级别"), CHIEF("主诉"), NOTES("注意事项"),
+    KEY_WORD_FOR_DOCTOR_ADVICES("出院医嘱标题"), DOCTORADVICE("医嘱"), KEY_WORD_FOR_PART("大标题"), OUTCOME("转归情况"),
+    PHYSICAL_EXAMINATION("查体"), TITLE_FOR_SIGN("查体标题"), TITLE_FOR_DIAG("诊断标题"), TITLE_FOR_DIAG_BASIS("诊断依据标题"),
+    TITLE_FOR_DIFF("鉴别诊断标题"), TITLE_FOR_TREAT("诊疗计划标题"), TITLE("标题"), TREATMENT_PLAN("诊疗计划"),
+    TITLE_OF_OPERATIVE_FINDINGS("手术经过标题"), TITLE_OF_MEASURES_AFTER_OP("术后处理措施标题"),
+    TITLE_OF_RISK_AFTER_OP("术后风险标题"), TITLE_OF_ATTENTION_AFTER_OP("术后注意事项标题"), VITAL("生命体征"),
+    BETTER_FINDING("好转表现"),OUTCOME_TO_BETTER("转归情况-好转"),OUTCOME_CURE("转归情况-治愈"),POSITIVE_FINDING("阳性表现"),
+    INSPECTION_ITEMS("检查项目"),DISCHARGE_MODE("出院方式");
+
+    private String value;
+
+    EntityEnum(String value) {
+        this.value = value;
+    }
+
+    public String toString() {
+        return value;
+    }
+
+    public static EntityEnum parseOfValue(String value) {
+        if (value == null) {
+            return EntityEnum.OTHER;
+        }
+        EntityEnum entityEnum = EntityEnum.OTHER;
+        switch (value) {
+            case "临床表现":
+                entityEnum = EntityEnum.CLINICAL_FEATURE;
+                break;
+            case "疾病名称":
+                entityEnum = EntityEnum.DIEASE;
+                break;
+            case "身体部位":
+                entityEnum = EntityEnum.BODY;
+                break;
+            case "体征":
+                entityEnum = EntityEnum.SIGN;
+                break;
+            case "指标值":
+                entityEnum = EntityEnum.INDEX_VALUE;
+                break;
+            case "实验室检查":
+                entityEnum = EntityEnum.LABORATORY;
+                break;
+            case "实验室检查值":
+                entityEnum = EntityEnum.LABORATORY_VALUE;
+                break;
+            case "辅助检查":
+                entityEnum = EntityEnum.AUXILIARY_EXAMINATION;
+                break;
+            case "辅助检查描述":
+                entityEnum = EntityEnum.AUXILIARY_DESCRIPT;
+                break;
+            case "否定":
+                entityEnum = EntityEnum.NEGATIVE;
+                break;
+            case "可能的":
+                entityEnum = EntityEnum.POSSIBLE;
+                break;
+            case "时间":
+                entityEnum = EntityEnum.TIME;
+                break;
+            case "诱因":
+                entityEnum = EntityEnum.CAUSE;
+                break;
+            case "修饰":
+                entityEnum = EntityEnum.MODIFICATION;
+                break;
+            case "趋势":
+                entityEnum = EntityEnum.TREND;
+                break;
+            case "频率":
+                entityEnum = EntityEnum.FREQUENCY;
+                break;
+            case "数量":
+                entityEnum = EntityEnum.QUANTITY;
+                break;
+            case "尺寸":
+                entityEnum = EntityEnum.SIZE;
+                break;
+            case "治疗":
+                entityEnum = EntityEnum.CURE;
+                break;
+            case "药物名称":
+                entityEnum = EntityEnum.DRUG;
+                break;
+            case "药品剂量":
+                entityEnum = EntityEnum.DOSE;
+                break;
+            case "手术名称":
+                entityEnum = EntityEnum.OPERATION;
+                break;
+            case "一般情况":
+                entityEnum = EntityEnum.GENERAL;
+                break;
+            case "一般情况描述":
+                entityEnum = EntityEnum.GENERAL_DESCRIPT;
+                break;
+            case "手术史":
+                entityEnum = EntityEnum.OPERATION_KEYWORD;
+                break;
+            case "手术结果":
+                entityEnum = EntityEnum.OPERATION_RESULT;
+                break;
+            case "外伤史":
+                entityEnum = EntityEnum.INJURY;
+                break;
+            case "过敏":
+                entityEnum = EntityEnum.ALLERGY;
+                break;
+            case "食物过敏原":
+                entityEnum = EntityEnum.FOOD_ALLERGY;
+                break;
+            case "药物过敏原":
+                entityEnum = EntityEnum.DRUG_ALLERGY;
+                break;
+            case "过敏表现":
+                entityEnum = EntityEnum.ALLERGY_SYMPTOM;
+                break;
+            case "输血史":
+                entityEnum = EntityEnum.BLOOD_TRANSFUSION;
+                break;
+            case "输血反应":
+                entityEnum = EntityEnum.TRANSFUSION_REACTION;
+                break;
+            case "预防接种史":
+                entityEnum = EntityEnum.VACCINATION;
+                break;
+            case "疾病史":
+                entityEnum = EntityEnum.DISEASE_KEYWORD;
+                break;
+            case "传染病史":
+                entityEnum = EntityEnum.INFECTIOUS_KEYWORD;
+                break;
+            case "情况不详":
+                entityEnum = EntityEnum.UNKNOWN;
+                break;
+            case "健康状况":
+                entityEnum = EntityEnum.HEALTH;
+                break;
+            case "年龄":
+                entityEnum = EntityEnum.AGE;
+                break;
+            case "吸烟史":
+                entityEnum = EntityEnum.SMOKING_HISTORY;
+                break;
+            case "饮酒史":
+                entityEnum = EntityEnum.HISTORY_OF_ALCOHOL_INTAKE;
+                break;
+            case "用量":
+                entityEnum = EntityEnum.USAGE;
+                break;
+            case "月经":
+                entityEnum = EntityEnum.MENSES;
+                break;
+            case "白带":
+                entityEnum = EntityEnum.LEUKORRHEA;
+                break;
+            case "生育情况":
+                entityEnum = EntityEnum.BIRTH_HIS;
+                break;
+            case "夫妻关系":
+                entityEnum = EntityEnum.CONJUGAL_RELATION;
+                break;
+            case "家属":
+                entityEnum = EntityEnum.RELATIVES;
+                break;
+            case "会诊":
+                entityEnum = EntityEnum.GROUP_CONSULTATION;
+                break;
+            case "生物体":
+                entityEnum = EntityEnum.ORGANISM;
+                break;
+            case "职业":
+                entityEnum = EntityEnum.OCCUPATION;
+                break;
+            case "地点":
+                entityEnum = EntityEnum.LOCATION;
+                break;
+            case "死亡":
+                entityEnum = EntityEnum.DEAD;
+                break;
+            case "死亡原因":
+                entityEnum = EntityEnum.DEAD_REASON;
+                break;
+            case "相似疾病":
+                entityEnum = EntityEnum.SIMILAR_DISEASE_KEYWORD;
+                break;
+            case "家族遗传病":
+                entityEnum = EntityEnum.GENETIC_DISEASE_KEYWORD;
+                break;
+            case "疫区史":
+                entityEnum = EntityEnum.EPIDEMIC_AREA_HISTORY;
+                break;
+            case "特殊嗜好":
+                entityEnum = EntityEnum.SPECIAL_HOBBY;
+                break;
+            case "接触史":
+                entityEnum = EntityEnum.CONTACT_HISTORY;
+                break;
+            case "冶游史":
+                entityEnum = EntityEnum.MARITAL_HISTORY;
+                break;
+            case "婚姻情况":
+                entityEnum = EntityEnum.MARITAL_STATUS;
+                break;
+            case "治疗目的":
+                entityEnum = EntityEnum.CURE_AIM;
+                break;
+            case "检查项目":
+                entityEnum = EntityEnum.INSPECTION_ITEMS;
+                break;
+            case "出院方式":
+                entityEnum = EntityEnum.DISCHARGE_MODE;
+                break;
+        }
+        return entityEnum;
+    }
+}

+ 35 - 0
src/main/java/com/diagbot/model/ai/model/Lemma.java

@@ -0,0 +1,35 @@
+package com.diagbot.model.ai.model;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName
+ * @Description 实体信息
+ * @Author fyeman
+ * @Date
+ * @Version 1.0
+ **/
+@Getter
+@Setter
+public class Lemma {
+    private int id;
+    private String text;
+    private String position;
+    private int from;
+    private int to;
+    private int len;
+    private String property;
+    private String relationName;
+    private Lemma parent;
+    private boolean haveChildren = false;
+    private List<Lemma> relationLemmas = new ArrayList<>();
+
+    public void addRelationLemmas(Lemma lemma) {
+        this.relationLemmas.add(lemma);
+        this.haveChildren = true;
+    }
+}

+ 19 - 0
src/main/java/com/diagbot/model/ai/model/Relation.java

@@ -0,0 +1,19 @@
+package com.diagbot.model.ai.model;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Relation
+ * @Description : 关系信息描述(基于AI)
+ * @Author : 楼辉荣
+ * @Date: 2020-03-11 10:46
+ */
+@Getter
+@Setter
+public class Relation {
+    private int id;
+    private int from;
+    private int to;
+    private String relationName;
+}

+ 376 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcess.java

@@ -0,0 +1,376 @@
+package com.diagbot.model.ai.process;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.diagbot.model.ai.model.EntityEnum;
+import com.diagbot.model.ai.model.Lemma;
+import com.diagbot.model.ai.model.Relation;
+import com.diagbot.model.entity.Negative;
+import com.diagbot.model.entity.PD;
+import com.diagbot.util.CatalogueUtil;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @Description:
+ * @Author: HUJING
+ * @Date: 2020/2/2 10:07
+ */
+@Component
+public class EntityProcess {
+
+    /**
+     * 树形结构存储三元组关系,返回传入实体类型为节点的所有关联实体对象
+     * @param aiOut
+     * @param entityType
+     * @return
+     */
+    public List<Lemma> createEntityTree(JSONObject aiOut, String entityType) {
+        List<Lemma> resultLemmaList = new ArrayList<>();
+        JSONObject annotation = aiOut.getJSONObject("annotation");
+        JSONArray entitys = annotation.getJSONArray("T");
+        JSONArray relations = annotation.getJSONArray("R");
+
+        if (entitys == null || entitys.isEmpty()) return resultLemmaList;
+
+        List<Lemma> allLemmaList = loadAllLemmaList(entitys);
+        for (Lemma l : allLemmaList) {
+            if (entityType.equals(l.getProperty())) {
+                List<String> relationIds = new ArrayList<>();
+                findRelationLemma(l, allLemmaList, relations, relationIds);
+                resultLemmaList.add(l);
+            }
+        }
+        return resultLemmaList;
+    }
+
+    /**
+     * 查找所有实体对象
+     * @param entitys
+     * @return
+     */
+    protected List<Lemma> loadAllLemmaList(JSONArray entitys) {
+        List<Lemma> allLemmaList = new ArrayList<>();
+        //所有实体读取
+        for (int i = 0; i < entitys.size(); i++) {
+            if (StringUtils.isEmpty(entitys.get(i).toString())) {
+                continue;
+            }
+            JSONObject entity = entitys.getJSONObject(i);
+            Lemma lemma = new Lemma();
+            lemma.setId(entity.getIntValue("id"));
+            lemma.setText(entity.getString("value"));
+            lemma.setProperty(entity.getString("name"));
+            lemma.setPosition(entity.getString("start"));
+            allLemmaList.add(lemma);
+        }
+        return allLemmaList;
+    }
+
+    /**
+     * 递归查询所有子实体信息
+     * @param lemma
+     * @param allLemmaList
+     * @param relations
+     */
+    private void findRelationLemma(Lemma lemma, List<Lemma> allLemmaList, JSONArray relations, List<String> relationIds) {
+        List<Relation> connectEntityIdList = getConnectEntityList(lemma.getId(), relations);
+        for (Lemma l : allLemmaList) {
+            for (Relation relation : connectEntityIdList) {
+                if (l.getId() == relation.getId()) {
+                    if (!hasRelation(l.getId(), lemma.getId(), relationIds)) {
+                        l.setRelationName(relation.getRelationName());
+
+                        List<Relation> childConnectEntityIdList = getConnectEntityList(l.getId(), relations);
+                        for (Lemma c_l : allLemmaList) {
+                            for (Relation c_relation : childConnectEntityIdList) {
+                                if (c_l.getId() == c_relation.getId()) {
+                                    if (!hasRelation(c_l.getId(), l.getId(), relationIds)) {
+                                        c_l.setRelationName(relation.getRelationName());
+                                        l.addRelationLemmas(c_l);
+                                    }
+                                }
+                            }
+                        }
+                        lemma.addRelationLemmas(l);
+//                        findRelationLemma(l, allLemmaList, relations, relationIds);
+                    }
+                }
+            }
+        }
+    }
+
+    private boolean hasRelation(int a, int b, List<String> relationIds) {
+        String s = "";
+        if (a > b) {
+            s = a + "," + b;
+        } else {
+            s = b + "," + a;
+        }
+        if (relationIds.contains(s)) {
+            return true;
+        }
+        relationIds.add(s);
+        return false;
+    }
+
+    /**
+     * 处理关系抽取输出的json
+     *
+     * @param outputs    关系抽取输出的json
+     * @param entityType 需要处理的实体类别
+     * @return
+     */
+    public List<Map<String, String>> processJson(JSONObject outputs, String entityType) {
+        List<Map<String, String>> connectEntityList = new ArrayList<>();
+        Map<String, String> connectEntity = null;
+        JSONObject annotation = outputs.getJSONObject("annotation");
+        JSONArray entitys = annotation.getJSONArray("T");
+        JSONArray relations = annotation.getJSONArray("R");
+        for (int i = 0; i < entitys.size(); i++) {
+            if (StringUtils.isEmpty(entitys.get(i).toString())) {
+                continue;
+            }
+            JSONObject entity = entitys.getJSONObject(i);
+            if (entityType.equals(entity.getString("name"))) {
+                int id = entity.getIntValue("id");
+                List<Relation> connectEntityRelationList = getConnectEntityList(id, relations);
+                if (connectEntityRelationList.size() == 0) {
+                    connectEntity = new HashMap<>();
+                    connectEntity.put(entity.getString("name"), entity.getString("value"));
+                    connectEntityList.add(connectEntity);
+                } else {
+                    connectEntity = getConnectEntity(connectEntityRelationList, entitys);
+                    connectEntity.put(entity.getString("name"), entity.getString("value"));
+                    connectEntityList.add(connectEntity);
+                }
+            }
+        }
+        return connectEntityList;
+    }
+
+    /**
+     * 获取与传入实体有关系实体的id列表(List)
+     *
+     * @param entityId  传入实体的id
+     * @param relations 关系抽取出的关系对
+     * @return connectEntityIdList 有关系实体的id列表(List)
+     */
+    public List<Relation> getConnectEntityList(int entityId, JSONArray relations) {
+        List<Relation> connectEntityList = new ArrayList<>();
+        for (int i = 0; i < relations.size(); i++) {
+            if (StringUtils.isEmpty(relations.get(i).toString())) {
+                continue;
+            }
+            JSONObject relationObjs = relations.getJSONObject(i);
+            if (relationObjs.getIntValue("from") == entityId) {
+                Relation relation = new Relation();
+                relation.setId(relationObjs.getIntValue("to"));
+                relation.setFrom(relationObjs.getIntValue("from"));
+                relation.setTo(relationObjs.getIntValue("to"));
+                relation.setRelationName(relationObjs.getString("name"));
+                connectEntityList.add(relation);
+            }
+            if (relationObjs.getIntValue("to") == entityId) {
+                Relation relation = new Relation();
+                relation.setId(relationObjs.getIntValue("from"));
+                relation.setFrom(relationObjs.getIntValue("from"));
+                relation.setTo(relationObjs.getIntValue("to"));
+                relation.setRelationName(relationObjs.getString("name"));
+                connectEntityList.add(relation);
+            }
+        }
+        return connectEntityList;
+    }
+
+    /**
+     * 查找阴性表述, 阴性词需要在实体前面
+     * @param detailLemma
+     * @return
+     */
+    protected Negative findNegative(Lemma detailLemma) {
+        for (Lemma lemma : detailLemma.getRelationLemmas()) {
+            if (lemma.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
+                if (StringUtils.isNotEmpty(lemma.getPosition()) && StringUtils.isNotEmpty(detailLemma.getPosition())) {
+                    if (Integer.parseInt(detailLemma.getPosition()) > Integer.parseInt(lemma.getPosition())) {
+                        Negative negative = new Negative();
+                        negative.setName(lemma.getText());
+                        return negative;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 查找时间表述
+     * @param detailLemma
+     * @return
+     */
+    protected PD findPD(Lemma detailLemma) {
+        for (Lemma lemma : detailLemma.getRelationLemmas()) {
+            if (lemma.getProperty().equals(EntityEnum.TIME.toString())) {
+                PD pd = new PD();
+                pd.setName(lemma.getText());
+                pd.setValue(lemma.getText());
+                return pd;
+            }
+        }
+        return null;
+    }
+
+    protected <T> T findT(Lemma detailLemma, T t, String entityType) throws Exception {
+        for (Lemma lemma : detailLemma.getRelationLemmas()) {
+            if (lemma.getProperty().equals(entityType)) {
+                BeanUtils.copyProperty(t, "name", lemma.getText());
+                return t;
+            }
+        }
+        return null;
+    }
+
+//    /**
+//     * 疾病名称需要映射操作
+//     * @param lemma
+//     * @param diag
+//     */
+//    protected void setDiag(Lemma lemma, Diag diag) {
+//        Map<String, String> diagRedisMap = (Map<String, String>)specialStorageUtil.get(KernelConstants.CONCEPT_DIAG_HOSPITAL_REFLECT);
+//        diag.setHospitalDiagName(lemma.getText());
+//        diag.setName(lemma.getText());//存放医院原始疾病名称
+//        diag.setName(diagRedisMap.get(lemma.getText()) == null ? "" : diagRedisMap.get(lemma.getText()));//映射到我们的标准疾病名称
+//    }
+
+    /**
+     * 查找时间
+     * @param detailLemma
+     * @return
+     */
+    protected List<PD> findTime(Lemma detailLemma) {
+        List<PD> timestamps = new ArrayList<>();
+        String value;
+        for (Lemma lemma : detailLemma.getRelationLemmas()) {
+            if (lemma.getProperty().equals(EntityEnum.TIME.toString())) {
+                PD pd = new PD();
+                value = lemma.getText();
+                String[] valUnit = new String[2];;
+                if (value.trim().length() > 0) {
+                    valUnit = CatalogueUtil.extractDigit(value);
+                }
+                pd.setValue(valUnit[0]);
+                pd.setUnit(valUnit[1]);
+                timestamps.add(pd);
+            }
+        }
+        return timestamps;
+    }
+
+    /**
+     * 获取实体id列表对应的所有实体类型及实体值
+     *
+     * @param connectEntityIdList 实体id列表
+     * @param entitys             关系抽取的实体列表
+     * @return entityRelationPair 实体id列表对应的所有实体类型及实体值
+     */
+    public Map<String, String> getConnectEntity(List<Relation> connectEntityIdList, JSONArray entitys) {
+        Map<String, String> entityRelationPair = new HashMap<>();
+        for (Relation connectEntityId : connectEntityIdList) {
+            for (int i = 0; i < entitys.size(); i++) {
+                if (StringUtils.isEmpty(entitys.get(i).toString())) {
+                    continue;
+                }
+                JSONObject entity = entitys.getJSONObject(i);
+                if (connectEntityId.getId() == entity.getIntValue("id")) {
+                    if (entityRelationPair.containsKey(entity.getString("name"))) {
+                        entityRelationPair.put(entity.getString("name"),
+                                entityRelationPair.get(entity.getString("name")) + "," + entity.getString("value"));
+                    } else {
+                        entityRelationPair.put(entity.getString("name"), entity.getString("value"));
+                    }
+                    break;
+                }
+            }
+        }
+        return entityRelationPair;
+    }
+
+    public  <T> List<T> addEntity(JSONObject aiOut, EntityEnum entityType, Class<T> t) throws Exception {
+        List<T> list = new ArrayList<>();
+        List<Map<String, String>> entityList = processJson(aiOut, entityType.toString());
+        for (Map<String, String> entityMap : entityList) {
+            if (StringUtils.isEmpty(entityMap.get(entityType.toString()))) {
+                continue;
+            }
+            T o = t.newInstance();
+            for (String key : entityMap.keySet()) {
+                if (key.equals(entityType.toString())) {
+                    BeanUtils.copyProperty(o, "name", entityMap.get(key));
+                } else if (key.equals(EntityEnum.NEGATIVE.toString())) {
+                    Negative negative = new Negative();
+                    negative.setName(StringUtils.isEmpty(entityMap.get(key)) ? "" : entityMap.get(key));
+                    BeanUtils.copyProperty(o, "negative", negative);
+                }
+            }
+            list.add(o);
+        }
+        return list;
+    }
+
+    protected  <T> List<T> addEntity(JSONObject aiOut, EntityEnum entityType, Class<T> t, EntityEnum[] subEntityTypes, Object[] subNames) throws Exception {
+        List<T> list = new ArrayList<>();
+        List<Map<String, String>> entityList = processJson(aiOut, entityType.toString());
+        for (Map<String, String> entityMap : entityList) {
+            if (StringUtils.isEmpty(entityMap.get(entityType.toString()))) {
+                continue;
+            }
+            T o = t.newInstance();
+            for (String key : entityMap.keySet()) {
+                if (key.equals(entityType.toString())) {
+                    BeanUtils.copyProperty(o, "name", entityMap.get(key));
+                } else {
+                    for (int i = 0; i < subEntityTypes.length; i++) {
+                        if (key.equals(subEntityTypes[i].toString())) {
+                            if (subNames[i] instanceof String) {
+                                BeanUtils.copyProperty(o, subNames[i].toString(), StringUtils.isEmpty(entityMap.get(key)) ? "" : entityMap.get(key));
+                            } else {
+                                BeanUtils.copyProperty(subNames[i], "name", StringUtils.isEmpty(entityMap.get(key)) ? "" : entityMap.get(key));
+                                BeanUtils.copyProperty(o, subNames[i].getClass().getSimpleName(), subNames[i]);
+                            }
+                        }
+                    }
+                }
+            }
+            list.add(o);
+        }
+        return list;
+    }
+
+
+    public String[] extract_digit(String value) {
+        String[] res = new String[2];
+        try {
+            String reg_time = "([\\d]+)([\\u4e00-\\u9fa5]+)";
+            Pattern pattern = Pattern.compile(reg_time);
+            Matcher matcher = pattern.matcher(value);
+            if (matcher.find(0)) {
+                res[0] = matcher.group(1);
+                res[1] = matcher.group(2);
+            } else {
+                res[0] = value;
+                res[1] = "";
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return res;
+    }
+}

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

@@ -0,0 +1,143 @@
+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;
+    }
+}

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

@@ -0,0 +1,39 @@
+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.Diag;
+import com.diagbot.model.entity.PD;
+import com.diagbot.model.entity.Possible;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Component
+public class EntityProcessDiag extends EntityProcess {
+    private Logger logger = LoggerFactory.getLogger(EntityProcessDiag.class);
+    public List<Diag> extractEntity(JSONObject aiOut) {
+        List<Diag> diags = new ArrayList<>();
+        try {
+            //读取疾病信息
+            List<Lemma> diagLemmas = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
+            for (Lemma lemma : diagLemmas) {
+                Diag diag = new Diag();
+                diag.setName(lemma.getText());
+                if (lemma.isHaveChildren()) {
+                    diag.setNegative(findNegative(lemma));//阴性
+                    diag.setPossible(findT(lemma, new Possible(), EntityEnum.POSSIBLE.toString()));//可能的
+                    diag.setPd(findT(lemma, new PD(), EntityEnum.TIME.toString()));//时间
+                }
+                diags.add(diag);
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+        return diags;
+    }
+}

+ 176 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessFamily.java

@@ -0,0 +1,176 @@
+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.FamilyLabel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 家族史标签处理
+ */
+public class EntityProcessFamily extends EntityProcess {
+    private Logger logger = LoggerFactory.getLogger(EntityProcessFamily.class);
+
+    public FamilyLabel extractEntity(JSONObject aiOut) {
+        FamilyLabel familyLabel = new FamilyLabel();
+        List<Family> families = loadFamilies(aiOut);
+        familyLabel.setFamilies(families);
+        return familyLabel;
+    }
+
+    public List<Family> loadFamilies(JSONObject aiOut) {
+        //家属情况
+        List<Family> families = new ArrayList<>();
+        try {
+            //读取家属所有本体及关联信息
+            List<Lemma> familyLemmas = createEntityTree(aiOut, EntityEnum.RELATIVES.toString());
+            for (Lemma lemma : familyLemmas) {
+                Family family = new Family();
+                family.setName(lemma.getText());
+                if (lemma.isHaveChildren()) {
+                    for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                        if (relationLemma.getProperty().equals(EntityEnum.DEAD.toString())) {
+                            if (family.getDead() == null) {
+                                family.setDead(addDeadLemma(relationLemma));
+                            }
+                        } else if (relationLemma.getProperty().equals(EntityEnum.INFECTIOUS_KEYWORD.toString())) {
+                            family.setDiagInfectious(addInfectious(relationLemma));
+                        } else if (relationLemma.getProperty().equals(EntityEnum.GENETIC_DISEASE_KEYWORD.toString())) {
+                            family.setGeneticDiseaseKeyword(addGeneticDisease(relationLemma));
+                        } else if (relationLemma.getProperty().equals(EntityEnum.HEALTH.toString())) {
+                            family.setHealthCondition(addHealthCondition(relationLemma));
+                        } else if (relationLemma.getProperty().equals(EntityEnum.DIEASE.toString())) {
+                            family.addDiag(addDiags(relationLemma));
+                        } else if (relationLemma.getProperty().equals(EntityEnum.TUMOUR.toString())) {
+                            family.setTumour(findT(lemma, new Tumour(), EntityEnum.TUMOUR.toString()));//肿瘤病史
+                        }
+                    }
+                }
+                families.add(family);
+            }
+            List<Lemma> similarDiseaseLemmas = createEntityTree(aiOut, EntityEnum.SIMILAR_DISEASE_KEYWORD.toString());
+            for (Lemma relationLemma : similarDiseaseLemmas) {
+                Family family = new Family();
+                family.setSimilarDiag(addSimilarDiag(relationLemma));
+                families.add(family);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error(e.getMessage(), e);
+        }
+        return families;
+    }
+
+    /**
+     * 家属死亡
+     *
+     * @param deadLemma
+     * @return
+     */
+    private Dead addDeadLemma(Lemma deadLemma) {
+        Dead dead = new Dead();
+        dead.setName(deadLemma.getText());
+        if (deadLemma.isHaveChildren()) {
+            for (Lemma lemma : deadLemma.getRelationLemmas()) {
+                if (lemma.getProperty().equals(EntityEnum.DEAD_REASON.toString())) {
+                    DeadReason deadReason = new DeadReason();
+                    deadReason.setName(lemma.getText());
+                    dead.setDeadReason(deadReason);
+                } else if (lemma.getProperty().equals(EntityEnum.UNKNOWN.toString())) {
+                    Unknow unknow = new Unknow();
+                    unknow.setName(lemma.getText());
+                    dead.setUnknow(unknow);
+                } else if (lemma.getProperty().equals(EntityEnum.AGE.toString())) {
+                    Age age = new Age();
+                    age.setName(lemma.getText());
+                    dead.setAge(age);
+                } else if (lemma.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
+                    Negative negative = new Negative();
+                    negative.setName(lemma.getText());
+                    dead.setNegative(negative);
+                }
+            }
+        }
+        return dead;
+    }
+
+    /**
+     * 家属传染病史
+     *
+     * @param infectiouLemma
+     * @return
+     */
+    private DiagInfectious addInfectious(Lemma infectiouLemma) {
+        DiagInfectious diagInfectious = new DiagInfectious();
+        diagInfectious.setName(infectiouLemma.getText());
+        if (infectiouLemma.isHaveChildren()) {
+            diagInfectious.setNegative(findNegative(infectiouLemma));
+        }
+        return diagInfectious;
+    }
+
+    /**
+     * 家属遗传病史
+     *
+     * @param geneticLemma
+     * @return
+     */
+    private GeneticDiseaseKeyword addGeneticDisease(Lemma geneticLemma) {
+        GeneticDiseaseKeyword geneticDiseaseKeyword = new GeneticDiseaseKeyword();
+        geneticDiseaseKeyword.setName(geneticLemma.getText());
+        if (geneticLemma.isHaveChildren()) {
+            geneticDiseaseKeyword.setNegative(findNegative(geneticLemma));
+        }
+        return geneticDiseaseKeyword;
+    }
+
+    /**
+     * 家属健康情况
+     *
+     * @param healthConditionLemma
+     * @return
+     */
+    private HealthCondition addHealthCondition(Lemma healthConditionLemma) {
+        HealthCondition healthCondition = new HealthCondition();
+        healthCondition.setName(healthConditionLemma.getText());
+        return healthCondition;
+    }
+
+    /**
+     * 家属疾病史
+     *
+     * @param diagLemma
+     * @return
+     */
+    private Diag addDiags(Lemma diagLemma) {
+//        Diag diag = DiagEnhancer.create(diagLemma.getText());
+        Diag diag = new Diag();
+        diag.setName(diagLemma.getText());
+        if (diagLemma.isHaveChildren()) {
+            diag.setNegative(findNegative(diagLemma));
+        }
+        return diag;
+    }
+
+    /**
+     * 相似疾病
+     *
+     * @param diagLemma
+     * @return
+     */
+    private SimilarDiag addSimilarDiag(Lemma diagLemma) {
+        SimilarDiag similarDiag = new SimilarDiag();
+        similarDiag.setName(diagLemma.getText());
+        if (diagLemma.isHaveChildren()) {
+            similarDiag.setNegative(findNegative(diagLemma));
+        }
+        return similarDiag;
+    }
+}

+ 40 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessGenerals.java

@@ -0,0 +1,40 @@
+package com.diagbot.model.ai.process;
+
+import com.alibaba.fastjson.JSONObject;
+import com.diagbot.model.ai.model.EntityEnum;
+import com.diagbot.model.entity.GeneralDesc;
+import com.diagbot.model.entity.Negative;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class EntityProcessGenerals extends EntityProcess{
+    public List<GeneralDesc> extractEntity(JSONObject outputs) {
+        List<GeneralDesc> generals = new ArrayList<>();
+        GeneralDesc general;
+        List<Map<String, String>> generalEntityList = processJson(outputs, EntityEnum.GENERAL.toString());
+        for (Map<String, String> generalEntityMap : generalEntityList) {
+            if (StringUtils.isEmpty(generalEntityMap.get(EntityEnum.GENERAL.toString()))) {
+                continue;
+            }
+            general = new GeneralDesc();
+            for (String key : generalEntityMap.keySet()) {
+                String entity = StringUtils.isEmpty(generalEntityMap.get(key)) ? "" : generalEntityMap.get(key);
+                switch (EntityEnum.parseOfValue(key)){
+                    case GENERAL:
+                        general.setName(entity);
+                        break;
+                    case NEGATIVE:
+                        Negative negative = new Negative();
+                        negative.setName(entity);
+                        general.setNegative(negative);
+                        break;
+                }
+            }
+            generals.add(general);
+        }
+        return generals;
+    }
+}

+ 50 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessLis.java

@@ -0,0 +1,50 @@
+package com.diagbot.model.ai.process;
+
+import com.alibaba.fastjson.JSONObject;
+import com.diagbot.model.ai.model.EntityEnum;
+import com.diagbot.model.entity.Lis;
+import com.diagbot.model.entity.LisValue;
+import com.diagbot.model.entity.PD;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class EntityProcessLis extends EntityProcess {
+    public List<Lis> extractEntity(JSONObject outputs) {
+        List<Lis> lises = new ArrayList<>();
+        Lis lis = null;
+        List<Map<String, String>> lisEntityList = processJson(outputs, EntityEnum.LABORATORY.toString());
+        for (Map<String, String> lisEntityMap : lisEntityList) {
+            if (StringUtils.isEmpty(lisEntityMap.get(EntityEnum.LABORATORY.toString()))) {
+                continue;
+            }
+            lis = new Lis();
+            for (String key : lisEntityMap.keySet()) {
+                String entity = StringUtils.isEmpty(lisEntityMap.get(key)) ? "" : lisEntityMap.get(key);
+                switch (EntityEnum.parseOfValue(key)) {
+                    case LABORATORY:
+                        lis.setName(entity);
+                        break;
+                    case LABORATORY_VALUE:
+                        LisValue lisValue = new LisValue();
+                        lisValue.setName(entity);
+                        lis.setLisValue(lisValue);
+                        PD pd = new PD();
+                        String value = entity;
+                        String[] val_unit = new String[2];
+                        if (value.trim().length() > 0) {
+                            val_unit = extract_digit(value);
+                        }
+                        pd.setValue(val_unit[0]);
+                        pd.setUnit(val_unit[1]);
+                        lis.setPd(pd);
+                        break;
+                }
+            }
+            lises.add(lis);
+        }
+        return lises;
+    }
+}

+ 70 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessMarital.java

@@ -0,0 +1,70 @@
+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.MaritalLabel;
+
+import java.util.List;
+
+/**
+ * @ClassName : EntityProcessMarital
+ * @Description : 婚育史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-10 10:20
+ */
+public class EntityProcessMarital extends EntityProcess {
+    public MaritalLabel extractEntity(JSONObject aiOut) {
+        MaritalLabel maritalLabel = new MaritalLabel();
+        //家属情况
+        EntityProcessFamily entityProcessFamily = new EntityProcessFamily();
+        maritalLabel.setFamily(entityProcessFamily.extractEntity(aiOut).getFamilies());
+        //读取近亲史所有本体及关联信息
+        List<Lemma> consanguineousLemmas = createEntityTree(aiOut, EntityEnum.NEAR_RELATION.toString());
+        for (Lemma lemma :consanguineousLemmas) {
+            Consanguineous consanguineous = new Consanguineous();
+            consanguineous.setName(lemma.getText());
+            if (lemma.isHaveChildren()) {
+                consanguineous.setNegative(findNegative(lemma));
+            }
+            maritalLabel.setConsanguineous(consanguineous);
+        }
+        //读取结婚年龄所有本体及关联信息
+        List<Lemma> marryiageLemmas = createEntityTree(aiOut, EntityEnum.MARRYIAGE.toString());
+        for (Lemma lemma :marryiageLemmas) {
+            Marryiage marryiage = new Marryiage();
+            marryiage.setName(lemma.getText());
+            maritalLabel.setMarryiage(marryiage);
+        }
+        //读取结婚年龄所有本体及关联信息
+        List<Lemma> ageLemmas = createEntityTree(aiOut, EntityEnum.AGE.toString());
+        for (Lemma lemma :ageLemmas) {
+            Marryiage marryiage = new Marryiage();
+            marryiage.setName(lemma.getText());
+            maritalLabel.setMarryiage(marryiage);
+        }
+        //婚姻情况描述
+        List<Lemma> maritalStatusLemmas = createEntityTree(aiOut, EntityEnum.MARITAL_STATUS.toString());
+        for (Lemma lemma :maritalStatusLemmas) {
+            MaritalStatus maritalStatus = new MaritalStatus();
+            maritalStatus.setName(lemma.getText());
+            maritalLabel.setMaritalStatus(maritalStatus);
+        }
+        //夫妻关系描述
+        List<Lemma> conjugalRelationLemmas = createEntityTree(aiOut, EntityEnum.CONJUGAL_RELATION.toString());
+        for (Lemma lemma :conjugalRelationLemmas) {
+            ConjugalRelation conjugalRelation = new ConjugalRelation();
+            conjugalRelation.setName(lemma.getText());
+            maritalLabel.setConjugalRelation(conjugalRelation);
+        }
+        //生育情况描述
+        List<Lemma> fertilityLemmas = createEntityTree(aiOut, EntityEnum.BIRTH_HIS.toString());
+        for (Lemma lemma :fertilityLemmas) {
+            Fertility fertility = new Fertility();
+            fertility.setName(lemma.getText());
+            maritalLabel.setFertility(fertility);
+        }
+        return maritalLabel;
+    }
+}

+ 119 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessMenses.java

@@ -0,0 +1,119 @@
+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.MenstrualLabel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 月经史标签处理
+ */
+public class EntityProcessMenses extends EntityProcess {
+
+    public MenstrualLabel extractEntity(JSONObject aiOut) {
+        MenstrualLabel menstrualLabel = new MenstrualLabel();
+        //月经情况
+        List<Menses> mensesList = new ArrayList<>();
+        //读取月经所有本体及关联信息
+        List<Lemma> mensesLemmas = createEntityTree(aiOut, EntityEnum.MENSES.toString());
+        List<Clinical> clinicals;
+        for (Lemma lemma : mensesLemmas) {
+            Menses menses = new Menses();
+            clinicals = new ArrayList<>();
+            menses.setName(lemma.getText());
+            if (lemma.isHaveChildren()) {
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    if (relationLemma.getProperty().equals(EntityEnum.CLINICAL_FEATURE.toString())) {
+                        addClinicalLemma(clinicals, relationLemma);
+                    } else if (relationLemma.getProperty().equals(EntityEnum.AGE.toString())) {
+                        findMensesAge(menses, relationLemma);
+                    } else if (relationLemma.getProperty().equals(EntityEnum.TIME.toString())) {
+                        findMensesTime(menses, relationLemma);
+                    }
+                }
+                menses.setClinicals(clinicals);
+            }
+            mensesList.add(menses);
+        }
+        menstrualLabel.setMensesList(mensesList);
+        //白带情况
+        List<Leukorrhea> leukorrheas = new ArrayList<>();
+        //读取月经所有本体及关联信息
+        List<Lemma> leukorrheaLemmas = createEntityTree(aiOut, EntityEnum.LEUKORRHEA.toString());
+        for (Lemma lemma : leukorrheaLemmas) {
+            Leukorrhea leukorrhea = new Leukorrhea();
+            clinicals = new ArrayList<>();
+            leukorrhea.setName(lemma.getText());
+            if (lemma.isHaveChildren()) {
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    if (relationLemma.getProperty().equals(EntityEnum.CLINICAL_FEATURE.toString())) {
+                        addClinicalLemma(clinicals, relationLemma);
+                    }
+                }
+                leukorrhea.setClinical(clinicals);
+            }
+            leukorrheas.add(leukorrhea);
+        }
+        menstrualLabel.setLeukorrheas(leukorrheas);
+        return menstrualLabel;
+    }
+
+    /**
+     * 查找临床表现
+     *
+     * @param clinicals
+     * @param clinicalLemma
+     */
+    private void addClinicalLemma(List<Clinical> clinicals, Lemma clinicalLemma) {
+        Clinical clinical = new Clinical();
+        clinical.setName(clinicalLemma.getText());
+        if (clinicalLemma.isHaveChildren()) {
+            clinical.setTimestamp(findTime(clinicalLemma));
+            clinical.setNegative(findNegative(clinicalLemma));
+        }
+        clinicals.add(clinical);
+    }
+
+    /**
+     * 查找初潮年龄
+     *
+     * @param detailLemma
+     * @return
+     */
+    private void findMensesAge(Menses menses, Lemma detailLemma) {
+        if (detailLemma.getRelationName().contains("初潮")) {
+            MenarcheAge menarcheAge = new MenarcheAge();
+            menarcheAge.setName(detailLemma.getText());
+            menses.setMenarcheAge(menarcheAge);
+        } else if (detailLemma.getRelationName().contains("绝经")) {
+            MenopauseAge menopauseAge = new MenopauseAge();
+            menopauseAge.setName(detailLemma.getText());
+            menses.setMenopauseAge(menopauseAge);
+        }
+    }
+
+    private void findMensesTime(Menses menses, Lemma detailLemma) {
+        if (detailLemma.getRelationName().contains("行经天数")) {
+            MensesDuration mensesDuration = new MensesDuration();
+            mensesDuration.setName(detailLemma.getText());
+            menses.setMensesDuration(mensesDuration);
+        } else if (detailLemma.getRelationName().contains("月经周期")) {
+            MenstrualCycle menstrualCycle = new MenstrualCycle();
+            menstrualCycle.setName(detailLemma.getText());
+            menses.setMenstrualCycle(menstrualCycle);
+        } else if (detailLemma.getRelationName().contains("末次月经")) {
+            LastMenstrual lastMenstrual = new LastMenstrual();
+            lastMenstrual.setName(detailLemma.getText());
+            menses.setLastMenstrual(lastMenstrual);
+        } else if (detailLemma.getRelationName().contains("绝经")) {
+            MenopauseTime menopauseTime = new MenopauseTime();
+            menopauseTime.setName(detailLemma.getText());
+            menses.setMenopauseTime(menopauseTime);
+        }
+    }
+}

+ 90 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessPacs.java

@@ -0,0 +1,90 @@
+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 java.util.ArrayList;
+import java.util.List;
+
+public class EntityProcessPacs extends EntityProcess {
+
+    public List<Pacs> extractEntity(JSONObject aiOut) {
+        //辅检情况
+        List<Pacs> pacses = new ArrayList<>();
+        List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
+        for (Lemma lemma : pacsLemmas) {
+            Pacs pacs = new Pacs();
+            pacs.setName(lemma.getText());
+            if (lemma.isHaveChildren()) {
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    if (relationLemma.getProperty().equals(EntityEnum.AUXILIARY_DESCRIPT.toString())) {
+                        pacs.setPacsValues(addPacsValue(relationLemma));
+                    } else if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
+                        pacs.setBodyPart(addBodyPart(relationLemma));
+                    } else if (relationLemma.getProperty().equals(EntityEnum.OUTERCOURTYARD.toString())) {
+                        pacs.setOuterCourtyard(addOuterCourtyard(relationLemma));
+                    }
+                }
+            }
+            pacses.add(pacs);
+        }
+        //辅检时间(不是辅检具体项目时间)
+        List<Lemma> pdLemmas = createEntityTree(aiOut, EntityEnum.TIME.toString());
+        for (Lemma lemma : pdLemmas) {
+            PD pd = new PD();
+            pd.setName(lemma.getText());
+            Pacs pacs = new Pacs();
+            pacs.setPd(pd);
+            pacses.add(pacs);
+        }
+        return pacses;
+    }
+
+    /**
+     * 添加辅助检查描述
+     *
+     * @param relationLemma
+     * @return
+     */
+    private PacsValue addPacsValue(Lemma relationLemma) {
+        PacsValue pacsValue = new PacsValue();
+        pacsValue.setName(relationLemma.getText());
+        return pacsValue;
+    }
+
+    /**
+     * 添加身体部位
+     *
+     * @param relationLemma
+     * @return
+     */
+    private BodyPart addBodyPart(Lemma relationLemma) {
+        BodyPart bodyPart = new BodyPart();
+        bodyPart.setName(relationLemma.getText());
+        return bodyPart;
+    }
+
+    /**
+     * 添加外院
+     *
+     * @param relationLemma
+     * @return
+     */
+    private OuterCourtyard addOuterCourtyard(Lemma relationLemma) {
+        OuterCourtyard outerCourtyard = new OuterCourtyard();
+        outerCourtyard.setName(relationLemma.getText());
+        if (relationLemma.isHaveChildren()) {
+            outerCourtyard.setPd(findTime(relationLemma));
+            for (Lemma lemma : relationLemma.getRelationLemmas()) {
+                if (lemma.getProperty().equals(EntityEnum.AUXILIARY_DESCRIPT.toString())) {
+                    outerCourtyard.setPacsValue(addPacsValue(lemma));
+                    break;
+                }
+            }
+        }
+        return outerCourtyard;
+    }
+
+}

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

@@ -0,0 +1,200 @@
+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.PastLabel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : EntityProcessPast
+ * @Description : 既往史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-10 10:20
+ */
+@Component
+public class EntityProcessPast extends EntityProcess {
+    private Logger logger = LoggerFactory.getLogger(EntityProcessPast.class);
+
+    public PastLabel extractEntity(JSONObject aiOut) {
+        PastLabel pastLabel = new PastLabel();
+        try {
+            //读取疾病信息
+            List<Lemma> diagLemmas = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
+            for (Lemma lemma : diagLemmas) {
+
+                Diag diag = new Diag();
+                diag.setName(lemma.getText());
+                if (lemma.isHaveChildren()) {
+                    //阴性
+                    diag.setNegative(findNegative(lemma));
+                    //可能的
+                    for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                        if (relationLemma.getProperty().equals(EntityEnum.POSSIBLE.toString())) {
+                            Possible possible = new Possible();
+                            possible.setName(relationLemma.getText());
+                            diag.setPossible(possible);
+                        }
+                    }
+                }
+                pastLabel.addDiag(diag);
+            }
+            //手术名称
+            List<Lemma> operationLemmas = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
+            for (Lemma lemma : operationLemmas) {
+                Operation operation = new Operation();
+                operation.setName(lemma.getText().replaceAll("[“”]",""));
+                if (lemma.isHaveChildren()) {
+                    //阴性
+                    operation.setNegative(findNegative(lemma));
+                    //时间
+                    operation.setPd(findPD(lemma));
+                    //手术结果
+                    for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                        if (relationLemma.getProperty().equals(EntityEnum.OPERATION_RESULT.toString())) {
+                            OperationResult operationResult = new OperationResult();
+                            operationResult.setName(relationLemma.getText());
+                            operation.setOperationResult(operationResult);
+                        }
+                    }
+                    //手术原因
+                    for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                        if (relationLemma.getProperty().equals(EntityEnum.DIEASE.toString())) {
+                            Diag diag = new Diag();
+                            diag.setName(lemma.getText());
+                            operation.setDiag(diag);
+                        }
+                    }
+                }
+                pastLabel.addOperation(operation);
+            }
+            //手术史
+            List<Lemma> operationHistoryLemmas = createEntityTree(aiOut, EntityEnum.OPERATION_KEYWORD.toString());
+            for (Lemma lemma : operationHistoryLemmas) {
+                Operation operation = new Operation();
+                operation.setName(lemma.getText().replaceAll("[“”]",""));
+                if (lemma.isHaveChildren()) {
+                    operation.setNegative(findNegative(lemma));//阴性
+                }
+                pastLabel.addOperation(operation);
+            }
+
+            //外伤史
+            List<Lemma> woundLemmas = createEntityTree(aiOut, EntityEnum.INJURY.toString());
+            for (Lemma lemma : woundLemmas) {
+                Wound wound = new Wound();
+                wound.setName(lemma.getText());
+                if (lemma.isHaveChildren()) {
+                    wound.setNegative(findNegative(lemma));//阴性
+                    wound.setPd(findPD(lemma));//时间
+                    wound.setBodyPart(findT(lemma, new BodyPart(), EntityEnum.BODY.toString()));//部位
+                    wound.setDegree(findT(lemma, new Degree(), EntityEnum.TREND.toString()));//程度
+                    wound.setTreat(findT(lemma, new Treat(), EntityEnum.CURE.toString()));//治疗
+                    wound.setOperation(findT(lemma, new Operation(), EntityEnum.OPERATION.toString()));//手术
+                }
+                pastLabel.addWound(wound);
+            }
+            //过敏史
+            List<Lemma> allergyLemmas = createEntityTree(aiOut, EntityEnum.ALLERGY.toString());
+            for (Lemma lemma : allergyLemmas) {
+                Allergy allergy = new Allergy();
+                allergy.setName(lemma.getText());
+                allergy.setNegative(findNegative(lemma));
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    //食物过敏史
+                    if (relationLemma.getProperty().equals(EntityEnum.FOOD_ALLERGY.toString())) {
+                        AllergyFood allergyFood = new AllergyFood();
+                        allergyFood.setName(relationLemma.getText());
+                        allergyFood.setNegative(findNegative(relationLemma));//阴性
+                        allergyFood.setPd(findPD(relationLemma));//时间
+                        allergyFood.setDegree(findT(relationLemma, new Degree(), EntityEnum.TREND.toString()));//程度
+                        allergyFood.setAllergyDesc(findT(relationLemma, new AllergyDesc(), EntityEnum.ALLERGY_SYMPTOM.toString()));//过敏表现
+                        allergy.setAllergyFood(allergyFood);
+                    }
+                    //药物过敏史
+                    if (relationLemma.getProperty().equals(EntityEnum.DRUG_ALLERGY.toString())) {
+                        AllergyMedicine allergyMedicine = new AllergyMedicine();
+                        allergyMedicine.setName(relationLemma.getText());
+                        allergyMedicine.setNegative(findNegative(relationLemma));//阴性
+                        allergyMedicine.setPd(findPD(relationLemma));//时间
+                        allergyMedicine.setDegree(findT(relationLemma, new Degree(), EntityEnum.TREND.toString()));//程度
+                        allergyMedicine.setAllergyDesc(findT(relationLemma, new AllergyDesc(), EntityEnum.ALLERGY_SYMPTOM.toString()));//过敏表现
+                        allergy.setAllergyMedicine(allergyMedicine);
+                    }
+                }
+                pastLabel.addAllergy(allergy);
+            }
+//            //食物过敏史
+//            List<Lemma> allergyFoodLemmas = createEntityTree(aiOut, EntityEnum.FOOD_ALLERGY.toString());
+//            for (Lemma lemma : allergyFoodLemmas) {
+//                AllergyFood allergyFood = new AllergyFood();
+//                allergyFood.setName(lemma.getText());
+//                if (lemma.isHaveChildren()) {
+//                    allergyFood.setNegative(findNegative(lemma));
+//                    allergyFood.setPd(findPD(lemma));//时间
+//                    allergyFood.setDegree(findT(lemma, new Degree(), EntityEnum.TREND.toString()));//程度
+//                }
+//                pastLabel.addAllergyFood(allergyFood);
+//            }
+//            //药物过敏史
+//            List<Lemma> allergyMedicineLemmas = createEntityTree(aiOut, EntityEnum.DRUG_ALLERGY.toString());
+//            for (Lemma lemma : allergyMedicineLemmas) {
+//                AllergyMedicine allergyMedicine = new AllergyMedicine();
+//                allergyMedicine.setName(lemma.getText());
+//                if (lemma.isHaveChildren()) {
+//                    allergyMedicine.setNegative(findNegative(lemma));
+//                    allergyMedicine.setPd(findPD(lemma));//时间
+//                    allergyMedicine.setDegree(findT(lemma, new Degree(), EntityEnum.TREND.toString()));//程度
+//                }
+//                pastLabel.addAllergyMedicine(allergyMedicine);
+//            }
+            //输血史
+            List<Lemma> bloodTransfusionLemmas = createEntityTree(aiOut, EntityEnum.BLOOD_TRANSFUSION.toString());
+            for (Lemma lemma : bloodTransfusionLemmas) {
+                BloodTransfusion bloodTransfusion = new BloodTransfusion();
+                bloodTransfusion.setName(lemma.getText());
+                if (lemma.isHaveChildren()) {
+                    bloodTransfusion.setNegative(findNegative(lemma));
+                    bloodTransfusion.setQuantity(findT(lemma, new Quantity(), EntityEnum.QUANTITY.toString()));//数量
+                    bloodTransfusion.setPd(findPD(lemma));//时间
+                }
+                pastLabel.addBloodTransfusion(bloodTransfusion);
+            }
+            //预防接种史
+            List<Lemma> vaccinateLemmas = createEntityTree(aiOut, EntityEnum.VACCINATION.toString());
+            for (Lemma lemma : vaccinateLemmas) {
+                Vaccinate vaccinate = new Vaccinate();
+                vaccinate.setName(lemma.getText());
+                if (lemma.isHaveChildren()) {
+                    vaccinate.setNegative(findNegative(lemma));
+                }
+                pastLabel.addVaccinate(vaccinate);
+            }
+            //传染病史
+            List<Lemma> diagInfectiousLemmas = createEntityTree(aiOut, EntityEnum.INFECTIOUS_KEYWORD.toString());
+            for (Lemma lemma : diagInfectiousLemmas) {
+                DiagInfectious diagInfectious = new DiagInfectious();
+                diagInfectious.setName(lemma.getText());
+                if (lemma.isHaveChildren()) {
+                    diagInfectious.setNegative(findNegative(lemma));
+                }
+                pastLabel.addDiagInfectious(diagInfectious);
+            }
+
+            //健康情况
+            List<Lemma> healthLemmas = createEntityTree(aiOut, EntityEnum.HEALTH.toString());
+            for (Lemma lemma : healthLemmas) {
+                pastLabel.setHeathCondition(lemma.getText());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error(e.getMessage(), e);
+        }
+        return pastLabel;
+    }
+}

+ 138 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessPersonal.java

@@ -0,0 +1,138 @@
+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.PersonalLabel;
+
+import java.util.List;
+
+/**
+ * @ClassName : EntityProcessPersonal
+ * @Description : 个人史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-10 10:20
+ */
+public class EntityProcessPersonal extends EntityProcess {
+    public PersonalLabel extractEntity(JSONObject aiOut) {
+        PersonalLabel personalLabel = new PersonalLabel();
+        //地点
+        List<Lemma> addressLemmas = createEntityTree(aiOut, EntityEnum.LOCATION.toString());
+        for (Lemma lemma :addressLemmas) {
+            Address address = new Address();
+            address.setName(lemma.getText());
+            personalLabel.addAddress(address);
+        }
+        //职业
+        List<Lemma> occupationLemmas = createEntityTree(aiOut, EntityEnum.OCCUPATION.toString());
+        for (Lemma lemma :occupationLemmas) {
+            Occupation occupation = new Occupation();
+            occupation.setName(lemma.getText());
+            personalLabel.setOccupation(occupation);
+        }
+        //疫区史
+        List<Lemma> fertilityLemmas = createEntityTree(aiOut, EntityEnum.EPIDEMIC_AREA_HISTORY.toString());
+        for (Lemma lemma :fertilityLemmas) {
+            EpidemicArea epidemicArea = new EpidemicArea();
+            epidemicArea.setName(lemma.getText());
+            personalLabel.setEpidemicArea(epidemicArea);
+        }
+        //接触史
+        List<Lemma> contactLemmas = createEntityTree(aiOut, EntityEnum.CONTACT_HISTORY.toString());
+        for (Lemma lemma :contactLemmas) {
+            Contact contact = new Contact();
+            contact.setName(lemma.getText());
+            personalLabel.setContact(contact);
+        }
+        //特殊嗜好
+        List<Lemma> specialHobbyLemmas = createEntityTree(aiOut, EntityEnum.SPECIAL_HOBBY.toString());
+        for (Lemma lemma :specialHobbyLemmas) {
+            SpecialHobby specialHobby = new SpecialHobby();
+            specialHobby.setName(lemma.getText());
+            //阴性
+            specialHobby.setNegative(findNegative(lemma));
+            personalLabel.setSpecialHobby(specialHobby);
+        }
+        //吸烟史
+        List<Lemma> smokingLemmas = createEntityTree(aiOut, EntityEnum.SMOKING_HISTORY.toString());
+        for (Lemma lemma :smokingLemmas) {
+            Smoking smoking = new Smoking();
+            smoking.setName(lemma.getText());
+            //阴性
+            smoking.setNegative(findNegative(lemma));
+            if (lemma.isHaveChildren()) {
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    if (relationLemma.getProperty().equals(EntityEnum.TIME.toString())) {
+                        smoking.setPd(addPD(relationLemma));
+                    } else if (relationLemma.getProperty().equals(EntityEnum.USAGE.toString())) {
+                        smoking.setUsage(addUsage(relationLemma));
+                    }
+                }
+            }
+            personalLabel.setSmoking(smoking);
+        }
+
+        //饮酒史
+        List<Lemma> drinkingLemmas = createEntityTree(aiOut, EntityEnum.HISTORY_OF_ALCOHOL_INTAKE.toString());
+        for (Lemma lemma :drinkingLemmas) {
+            Drinking drinking = new Drinking();
+            drinking.setName(lemma.getText());
+            //阴性
+            drinking.setNegative(findNegative(lemma));
+            if (lemma.isHaveChildren()) {
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    if (relationLemma.getProperty().equals(EntityEnum.TIME.toString())) {
+                        drinking.setPd(addPD(relationLemma));
+                    } else if (relationLemma.getProperty().equals(EntityEnum.USAGE.toString())) {
+                        drinking.setUsage(addUsage(relationLemma));
+                    }
+                }
+            }
+            personalLabel.setDrinking(drinking);
+        }
+
+        //用量 用于判断吸烟 和 饮酒符合规范
+        List<Lemma> usageLemmas = createEntityTree(aiOut, EntityEnum.USAGE.toString());
+        for (Lemma lemma :usageLemmas) {
+            Usage usage = new Usage();
+            usage.setName(lemma.getText());
+            personalLabel.setUsage(usage);
+        }
+
+        //冶游史
+        List<Lemma> maritalHistoryLemmas = createEntityTree(aiOut, EntityEnum.MARITAL_HISTORY.toString());
+        for (Lemma lemma :maritalHistoryLemmas) {
+            MaritalHistory maritalHistory = new MaritalHistory();
+            maritalHistory.setName(lemma.getText());
+            if (lemma.isHaveChildren()) {
+                maritalHistory.setNegative(findNegative(lemma));
+            }
+            personalLabel.setMaritalHistory(maritalHistory);
+        }
+        return personalLabel;
+    }
+
+    /**
+     * 时间
+     * @param timeLemma
+     * @return
+     */
+    private PD addPD(Lemma timeLemma) {
+        PD pd = new PD();
+        pd.setName(timeLemma.getText());
+        pd.setValue(timeLemma.getText());
+        return pd;
+    }
+
+    /**
+     * 用量
+     * @param usageLemma
+     * @return
+     */
+    private Usage addUsage(Lemma usageLemma) {
+        Usage usage = new Usage();
+        usage.setName(usageLemma.getText());
+        return usage;
+    }
+}

+ 57 - 0
src/main/java/com/diagbot/model/ai/process/EntityProcessVital.java

@@ -0,0 +1,57 @@
+package com.diagbot.model.ai.process;
+
+import com.alibaba.fastjson.JSONObject;
+import com.diagbot.model.ai.model.EntityEnum;
+import com.diagbot.model.entity.*;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class EntityProcessVital extends EntityProcess {
+    public List<Vital> extractEntity(JSONObject outputs) {
+        List<Vital> vitals = new ArrayList<>();
+        Vital vital =null;
+        List<Map<String, String>> vitalEntityList = processJson(outputs, EntityEnum.SIGN.toString());
+        for (Map<String, String> vitalEntityMap : vitalEntityList) {
+            if (StringUtils.isEmpty(vitalEntityMap.get(EntityEnum.SIGN.toString()))) {
+                continue;
+            }
+            vital = new Vital();
+            for (String key:vitalEntityMap.keySet()) {
+                String entity = vitalEntityMap.get(key);
+                switch (EntityEnum.parseOfValue(key)) {
+                    case SIGN:
+                        vital.setVitalName(entity);
+                        break;
+                    case NEGATIVE:
+                        Negative negative = new Negative();
+                        negative.setName(entity);
+                        vital.setNegative(negative);
+                        break;
+                    case BODY:
+                        BodyPart bodyPart = new BodyPart();
+                        bodyPart.setName(entity);
+                        vital.setBodyPart(bodyPart);
+                        break;
+                    case INDEX_VALUE:
+                        vital.setValue(StringUtils.isEmpty(entity)?"":entity);
+                        PD pd =new PD();
+                        pd.setValue(StringUtils.isEmpty(entity)?"":entity);
+                        vital.setPd(pd);
+                        break;
+                    case MODIFICATION:
+                        if(entity.contains("度")){
+                            Degree degree = new Degree();
+                            degree.setName(entity);
+                            vital.setDegree(degree);
+                        }
+                        break;
+                }
+            }
+            vitals.add(vital);
+        }
+        return vitals;
+    }
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Address.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Address
+ * @Description :
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:39
+ */
+@Setter
+@Getter
+public class Address extends General{
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/Age.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : Age
+ * @Description : 年龄
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:15
+ */
+public class Age extends General {
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/Aggravate.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : Aggravate
+ * @Description : 加重因素
+ * @Author : 楼辉荣
+ * @Date: 2020-03-18 18:59
+ */
+public class Aggravate extends General {
+}

+ 18 - 0
src/main/java/com/diagbot/model/entity/Allergy.java

@@ -0,0 +1,18 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Allergy
+ * @Description : 过敏
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:05
+ */
+@Getter
+@Setter
+public class Allergy extends General {
+    private Negative negative; //阴性
+    private AllergyFood allergyFood;//食物过敏史
+    private AllergyMedicine allergyMedicine;//药物过敏史
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/AllergyDesc.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : AllergyDesc
+ * @Description : 过敏表现
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:07
+ */
+public class AllergyDesc extends General {
+}

+ 19 - 0
src/main/java/com/diagbot/model/entity/AllergyFood.java

@@ -0,0 +1,19 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : AllergyFood
+ * @Description : 食物过敏原
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:06
+ */
+@Setter
+@Getter
+public class AllergyFood extends General {
+    private Negative negative;//阴性
+    private PD pd;  //时间
+    private Degree degree; //程度
+    private AllergyDesc allergyDesc;//过敏表现
+}

+ 19 - 0
src/main/java/com/diagbot/model/entity/AllergyMedicine.java

@@ -0,0 +1,19 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : AllergyMedicine
+ * @Description : 药物过敏原
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:07
+ */
+@Setter
+@Getter
+public class AllergyMedicine extends General {
+    private Negative negative;  //阴性
+    private PD pd;  //时间
+    private Degree degree; //程度
+    private AllergyDesc allergyDesc;//过敏表现
+}

+ 18 - 0
src/main/java/com/diagbot/model/entity/Annotation.java

@@ -0,0 +1,18 @@
+package com.diagbot.model.entity;
+
+
+import com.alibaba.fastjson.JSONArray;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:CRF标注内容结构
+ * @time: 13/12/2019
+ */
+
+@Getter
+@Setter
+public class Annotation {
+    private JSONArray data;
+    private boolean status;
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/BeHospitalizedWay.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : BeHospitalizedWay
+ * @Description : 入院途径
+ * @Author : 楼辉荣
+ * @Date: 2020-03-18 19:05
+ */
+public class BeHospitalizedWay extends General {
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/BetterFinding.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : BetterFinding
+ * @Description : 好转表现
+ * @Author : 胡敬
+ * @Date: 2020-03-25 16:54
+ */
+@Setter
+@Getter
+public class BetterFinding extends General {
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/BloodReaction.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : BloodReaction
+ * @Description : 输血反应
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:09
+ */
+public class BloodReaction extends General {
+}

+ 18 - 0
src/main/java/com/diagbot/model/entity/BloodTransfusion.java

@@ -0,0 +1,18 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : BloodTransfusion
+ * @Description : 输血史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:08
+ */
+@Setter
+@Getter
+public class BloodTransfusion extends General {
+    private Negative negative;  //否定
+    private PD pd;//时间
+    private Quantity quantity;//数量
+}

+ 9 - 0
src/main/java/com/diagbot/model/entity/BodyPart.java

@@ -0,0 +1,9 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class BodyPart extends General {
+}

+ 9 - 0
src/main/java/com/diagbot/model/entity/Cause.java

@@ -0,0 +1,9 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class Cause extends General {
+}

+ 16 - 0
src/main/java/com/diagbot/model/entity/Chief.java

@@ -0,0 +1,16 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Chief
+ * @Description : 主诉
+ * @Author : 胡敬
+ * @Date: 2020-03-20 10:52
+ */
+
+@Getter
+@Setter
+public class Chief extends General {
+}

+ 18 - 0
src/main/java/com/diagbot/model/entity/ChiefPresentAnnotation.java

@@ -0,0 +1,18 @@
+package com.diagbot.model.entity;
+
+
+import com.alibaba.fastjson.JSONArray;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:主诉现病史症状相似度算法
+ * @time: 2020-06-01
+ */
+
+@Getter
+@Setter
+public class ChiefPresentAnnotation {
+    private JSONArray pred_y;
+    private boolean status;
+}

+ 27 - 0
src/main/java/com/diagbot/model/entity/Clinical.java

@@ -0,0 +1,27 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 临床表现
+ * Created by louhr on 2020/3/3.
+ */
+@Setter
+@Getter
+public class Clinical extends General {
+    private Negative negative;
+    private BodyPart bodyPart;
+    private Trend trend;//趋势
+    private Degree degree;//程度
+    private Modification modification;//修饰
+    private Cause cause;
+    private Property property;//性质
+    private Aggravate aggravate;//加重因素
+    private Relief relief;//缓解因素
+    private PD pds;
+    private List<PD> timestamp = new ArrayList<>();
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/ConjugalRelation.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : ConjugalRelation
+ * @Description : 夫妻关系
+ * @Author : 楼辉荣
+ * @Date: 2020-03-11 15:06
+ */
+@Setter
+@Getter
+public class ConjugalRelation extends General {
+}

+ 16 - 0
src/main/java/com/diagbot/model/entity/Consanguineous.java

@@ -0,0 +1,16 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Consanguineous
+ * @Description : 近亲
+ * @Author : 楼辉荣
+ * @Date: 2020-03-10 10:23
+ */
+@Getter
+@Setter
+public class Consanguineous extends General {
+    private Negative negative;
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Consultation.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Consultation
+ * @Description :会诊
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:42
+ */
+@Setter
+@Getter
+public class Consultation extends General {
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Contact.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Contact
+ * @Description : 接触史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-10 19:35
+ */
+@Setter
+@Getter
+public class Contact extends General {
+}

+ 18 - 0
src/main/java/com/diagbot/model/entity/Dead.java

@@ -0,0 +1,18 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 死亡
+ */
+@Setter
+@Getter
+public class Dead extends General {
+    private String desc;
+    private DeadReason deadReason;
+    private Unknow unknow;
+    private Negative negative;
+    private Age age;
+    private PD pd;
+}

+ 13 - 0
src/main/java/com/diagbot/model/entity/DeadReason.java

@@ -0,0 +1,13 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 死亡原因
+ */
+@Setter
+@Getter
+public class DeadReason extends General {
+
+}

+ 16 - 0
src/main/java/com/diagbot/model/entity/Decorate.java

@@ -0,0 +1,16 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName com.lantone.util.module.Decorate
+ * @Description 修饰
+ * @Author Mark Huang
+ * @Date 2019/1/18/018 15:04
+ * @Version 1.0
+ **/
+@Setter
+@Getter
+public class Decorate extends General {
+}

+ 9 - 0
src/main/java/com/diagbot/model/entity/Degree.java

@@ -0,0 +1,9 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class Degree extends General {
+}

+ 21 - 0
src/main/java/com/diagbot/model/entity/Diag.java

@@ -0,0 +1,21 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName org.diagbot.nlp.relation.module.Diag
+ * @Description 诊断
+ * @Author Mark Huang
+ * @Date 2019/5/5 14:57
+ * @Version 1.0
+ **/
+@Getter
+@Setter
+public class Diag extends General {
+    private String hospitalDiagName;    //医院疾病名称
+    private Possible possible;
+    private Negative negative;
+    private PD pd;
+    private String ICD;
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/DiagHistory.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : DiagHistory
+ * @Description : 疾病史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:11
+ */
+public class DiagHistory extends General {
+}

+ 16 - 0
src/main/java/com/diagbot/model/entity/DiagInfectious.java

@@ -0,0 +1,16 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : DiagInfectious
+ * @Description : 传染病史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:12
+ */
+@Getter
+@Setter
+public class DiagInfectious extends General {
+    private Negative negative;
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/DoctorAdvice.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : DoctorAdvice
+ * @Description : 医嘱信息
+ * @Author : 楼辉荣
+ * @Date: 2020-03-18 15:55
+ */
+public class DoctorAdvice extends General {
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Dose.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Dose
+ * @Description : 剂量
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:33
+ */
+@Setter
+@Getter
+public class Dose extends General {
+}

+ 18 - 0
src/main/java/com/diagbot/model/entity/Drinking.java

@@ -0,0 +1,18 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Drinking
+ * @Description : 饮酒史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:21
+ */
+@Setter
+@Getter
+public class Drinking extends General {
+    private Negative negative;
+    private PD pd;  //时间
+    private Usage usage;   //用量
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/EpidemicArea.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : EpidemicArea
+ * @Description : 疫区史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-10 19:33
+ */
+@Getter
+@Setter
+public class EpidemicArea extends General {
+}

+ 29 - 0
src/main/java/com/diagbot/model/entity/Family.java

@@ -0,0 +1,29 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName : Family
+ * @Description : 家属
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:43
+ */
+@Setter
+@Getter
+public class Family extends General{
+    private Dead dead;
+    private GeneticDiseaseKeyword geneticDiseaseKeyword;//家族遗传病
+    private DiagInfectious diagInfectious;//传染病史
+    private List<Diag> diags = new ArrayList<>();//疾病名称
+    private HealthCondition healthCondition;//健康状况
+    private SimilarDiag similarDiag;//相似疾病
+    private Tumour tumour;//肿瘤病史
+
+    public void addDiag(Diag diag) {
+        this.diags.add(diag);
+    }
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Fertility.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Fertility
+ * @Description : 生育情况
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:24
+ */
+@Setter
+@Getter
+public class Fertility extends General {
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Frequency.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Frequency
+ * @Description : 频率
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:34
+ */
+@Setter
+@Getter
+public class Frequency extends General{
+}

+ 23 - 0
src/main/java/com/diagbot/model/entity/General.java

@@ -0,0 +1,23 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @ClassName com.lantone.util.module.General
+ * @Description 基础对象,用于继承
+ * @Author Mark Huang
+ * @Date 2019/1/18/018 15:04
+ * @Version 1.0
+ **/
+@Setter
+@Getter
+public class General {
+    private String name;
+    private String standName;
+    protected  <T> void add(List<T> list, T obj) {
+        list.add(obj);
+    }
+}

+ 16 - 0
src/main/java/com/diagbot/model/entity/GeneralDesc.java

@@ -0,0 +1,16 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : GeneralDesc
+ * @Description : 一般情况描述
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:37
+ */
+@Getter
+@Setter
+public class GeneralDesc extends General {
+    private Negative negative;
+}

+ 13 - 0
src/main/java/com/diagbot/model/entity/GeneticDiseaseKeyword.java

@@ -0,0 +1,13 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 家族遗传病
+ */
+@Setter
+@Getter
+public class GeneticDiseaseKeyword extends General {
+    private Negative negative;
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/HealthCondition.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : HealthCondition
+ * @Description : 健康状况
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:14
+ */
+@Getter
+@Setter
+public class HealthCondition extends General {
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/IndexValue.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : IndexValue
+ * @Description : 指标值
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:36
+ */
+@Getter
+@Setter
+public class IndexValue extends General{
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/LastMenstrual.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : LastMenstrual
+ * @Description : 末次月经
+ * @Author : 胡敬
+ * @Date: 2020-03-11 14:24
+ */
+public class LastMenstrual extends General {
+}

+ 18 - 0
src/main/java/com/diagbot/model/entity/Leukorrhea.java

@@ -0,0 +1,18 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @ClassName : Leukorrhea
+ * @Description : 白带
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:24
+ */
+@Setter
+@Getter
+public class Leukorrhea extends General {
+    private List<Clinical> clinical;
+}

+ 19 - 0
src/main/java/com/diagbot/model/entity/Lis.java

@@ -0,0 +1,19 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName com.lantone.util.module.Lis
+ * @Description TODO
+ * @Author Mark Huang
+ * @Date 2019/3/22/022 10:30
+ * @Version 1.0
+ **/
+@Getter
+@Setter
+public class Lis extends General {
+    private LisValue lisValue;
+    private PD pd;
+
+}

+ 16 - 0
src/main/java/com/diagbot/model/entity/LisValue.java

@@ -0,0 +1,16 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName com.lantone.util.module.Lis
+ * @Description 化验结果描述
+ * @Author Mark Huang
+ * @Date 2019/3/22/022 10:30
+ * @Version 1.0
+ **/
+@Getter
+@Setter
+public class LisValue extends General {
+}

+ 16 - 0
src/main/java/com/diagbot/model/entity/MaritalHistory.java

@@ -0,0 +1,16 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : MaritalHistory
+ * @Description : 冶游史
+ * @Author : 楼辉荣
+ * @Date: 2020-03-10 19:38
+ */
+@Getter
+@Setter
+public class MaritalHistory extends General {
+    private Negative negative;
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/MaritalStatus.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : MaritalStatus
+ * @Description :
+ * @Author : 楼辉荣
+ * @Date: 2020-03-10 19:22
+ */
+@Setter
+@Getter
+public class MaritalStatus extends General{
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Marryiage.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Marryiage
+ * @Description : 结婚年龄
+ * @Author : 楼辉荣
+ * @Date: 2020-03-10 10:25
+ */
+@Getter
+@Setter
+public class Marryiage extends General {
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/Medicine.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : Medicine
+ * @Description : 药物
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:32
+ */
+public class Medicine extends General {
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/MenarcheAge.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : MenarcheAge
+ * @Description : 初潮年龄
+ * @Author : 胡敬
+ * @Date: 2020-03-11 13:19
+ */
+public class MenarcheAge extends General {
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/MenopauseAge.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : MenopauseAge
+ * @Description : 绝经年龄
+ * @Author : 胡敬
+ * @Date: 2020-03-11 13:20
+ */
+public class MenopauseAge extends General {
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/MenopauseTime.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : MenopauseTime
+ * @Description : 绝经时间
+ * @Author : 胡敬
+ * @Date: 2020-03-11 13:29
+ */
+public class MenopauseTime extends General {
+}

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

@@ -0,0 +1,24 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @ClassName : Menses
+ * @Description : 月经
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:23
+ */
+@Setter
+@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;
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/MensesDuration.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : MensesDuration
+ * @Description : 行经天数
+ * @Author : 胡敬
+ * @Date: 2020-03-11 13:20
+ */
+public class MensesDuration extends General {
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/MenstrualCycle.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : MenstrualCycle
+ * @Description : 月经周期
+ * @Author : 胡敬
+ * @Date: 2020-03-11 13:20
+ */
+public class MenstrualCycle extends General {
+}

+ 9 - 0
src/main/java/com/diagbot/model/entity/Modification.java

@@ -0,0 +1,9 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class Modification extends General {
+}

+ 17 - 0
src/main/java/com/diagbot/model/entity/Negative.java

@@ -0,0 +1,17 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName com.lantone.util.module.cell.Negative
+ * @Description TODO
+ * @Author Mark Huang
+ * @Date 2019/1/22/022 11:19
+ * @Version 1.0
+ **/
+@Setter
+@Getter
+public class Negative extends General {
+
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/Notes.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : Notice
+ * @Description : 注意事项
+ * @Author : 楼辉荣
+ * @Date: 2020-03-18 15:54
+ */
+public class Notes extends General {
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/NursingLevel.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : NursingLevel
+ * @Description : 护理级别
+ * @Author : 楼辉荣
+ * @Date: 2020-03-19 15:47
+ */
+public class NursingLevel extends General {
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Occupation.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Occupation
+ * @Description : 职业
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:40
+ */
+@Setter
+@Getter
+public class Occupation extends General {
+}

+ 19 - 0
src/main/java/com/diagbot/model/entity/Operation.java

@@ -0,0 +1,19 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Operation
+ * @Description : 手术
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:35
+ */
+@Getter
+@Setter
+public class Operation extends General {
+    private Negative negative;  //阴性
+    private PD pd;  //手术时间
+    private OperationResult operationResult;    //手术结果
+    private Diag diag;  //手术原因
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/OperationResult.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : OperationResult
+ * @Description : 手术结果
+ * @Author : 楼辉荣
+ * @Date: 2020-03-05 19:04
+ */
+public class OperationResult extends General {
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Organism.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Organism
+ * @Description : 生物体
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:41
+ */
+@Setter
+@Getter
+public class Organism extends General {
+}

+ 14 - 0
src/main/java/com/diagbot/model/entity/Outcome.java

@@ -0,0 +1,14 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 转归情况
+@Setter
+@Getter
+*/
+@Setter
+@Getter
+public class Outcome extends General{
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/OutcomeCure.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : OutcomeCure
+ * @Description : 转归情况-治愈
+ * @Author : 胡敬
+ * @Date: 2020-03-25 16:54
+ */
+@Setter
+@Getter
+public class OutcomeCure extends General {
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/OutcomeToBetter.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : OutcomeToBetter
+ * @Description : 转归情况-好转
+ * @Author : 胡敬
+ * @Date: 2020-03-25 16:54
+ */
+@Setter
+@Getter
+public class OutcomeToBetter extends General {
+}

+ 19 - 0
src/main/java/com/diagbot/model/entity/OuterCourtyard.java

@@ -0,0 +1,19 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @ClassName : OuterCourtyard
+ * @Description : 外院
+ * @Author : 楼辉荣
+ * @Date: 2020-03-12 16:03
+ */
+@Setter
+@Getter
+public class OuterCourtyard extends General {
+    private List<PD> pd;
+    private PacsValue pacsValue;
+}

+ 11 - 0
src/main/java/com/diagbot/model/entity/PD.java

@@ -0,0 +1,11 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class PD extends General {
+    private String value;
+    private String unit;
+}

+ 20 - 0
src/main/java/com/diagbot/model/entity/Pacs.java

@@ -0,0 +1,20 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName com.lantone.util.module.Pacs
+ * @Description TODO
+ * @Author mark Huang
+ * @Date 2019/3/25/025 10:06
+ * @Version 1.0
+ **/
+@Setter
+@Getter
+public class Pacs extends General{
+    private PD pd;  //时间
+    private PacsValue pacsValues;
+    private BodyPart bodyPart;
+    private OuterCourtyard outerCourtyard; //外院
+}

+ 16 - 0
src/main/java/com/diagbot/model/entity/PacsValue.java

@@ -0,0 +1,16 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName com.lantone.util.module.Pacs
+ * @Description 辅助检查描述
+ * @Author mark Huang
+ * @Date 2019/3/25/025 10:06
+ * @Version 1.0
+ **/
+@Setter
+@Getter
+public class PacsValue extends General{
+}

+ 19 - 0
src/main/java/com/diagbot/model/entity/Past.java

@@ -0,0 +1,19 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+@Setter
+@Getter
+public class Past extends General {
+    // 0:健康情况,1:手术史,2:外伤史,3:过敏史,4:输血史,5:预防接种史,6:疾病史,7:传染病史
+    private int Type;
+    private String Title;
+    private String Value;
+    private String treat;
+    private String describe;
+    private List<PD> periods;
+    private Negative negative;
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/PositiveFinding.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : PositiveFinding
+ * @Description : 阳性表现
+ * @Author : 胡敬
+ * @Date: 2020-03-25 16:54
+ */
+@Setter
+@Getter
+public class PositiveFinding extends General {
+}

+ 11 - 0
src/main/java/com/diagbot/model/entity/Possible.java

@@ -0,0 +1,11 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : Possible
+ * @Description : 可能的
+ * @Author : 楼辉荣
+ * @Date: 2020-03-03 18:30
+ */
+public class Possible extends General {
+
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/Property.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : Property
+ * @Description : 性质
+ * @Author : 楼辉荣
+ * @Date: 2020-03-18 18:59
+ */
+public class Property extends General {
+}

+ 15 - 0
src/main/java/com/diagbot/model/entity/Quantity.java

@@ -0,0 +1,15 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Quantity
+ * @Description : 数量
+ * @Author : 楼辉荣
+ * @Date: 2020-03-13 11:22
+ */
+@Getter
+@Setter
+public class Quantity extends General {
+}

+ 10 - 0
src/main/java/com/diagbot/model/entity/Relief.java

@@ -0,0 +1,10 @@
+package com.diagbot.model.entity;
+
+/**
+ * @ClassName : Relief
+ * @Description : 缓解因素
+ * @Author : 楼辉荣
+ * @Date: 2020-03-18 19:00
+ */
+public class Relief extends General {
+}

+ 12 - 0
src/main/java/com/diagbot/model/entity/Sign.java

@@ -0,0 +1,12 @@
+package com.diagbot.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 查体
+*/
+@Setter
+@Getter
+public class Sign extends General{
+}

+ 16 - 0
src/main/java/com/diagbot/model/entity/SimilarDiag.java

@@ -0,0 +1,16 @@
+package com.diagbot.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;
+}

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


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů