|
@@ -3,21 +3,12 @@ package com.lantone.qc.kernel.structure.ai.process;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
|
|
|
import com.lantone.qc.kernel.structure.ai.model.Lemma;
|
|
|
-import com.lantone.qc.pub.model.entity.BetterFinding;
|
|
|
-import com.lantone.qc.pub.model.entity.Clinical;
|
|
|
-import com.lantone.qc.pub.model.entity.Diag;
|
|
|
-import com.lantone.qc.pub.model.entity.OutcomeCure;
|
|
|
-import com.lantone.qc.pub.model.entity.OutcomeToBetter;
|
|
|
-import com.lantone.qc.pub.model.entity.PositiveFinding;
|
|
|
-import com.lantone.qc.pub.model.entity.Sign;
|
|
|
-import com.lantone.qc.pub.model.entity.TreatmentPlan;
|
|
|
+import com.lantone.qc.pub.model.entity.*;
|
|
|
import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.LinkedHashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @ClassName : EntityProcessThreeLevelWard
|
|
@@ -25,6 +16,7 @@ import java.util.Map;
|
|
|
* @Author : 胡敬
|
|
|
* @Date: 2020-03-20 11:20
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
public class EntityProcessThreeLevelWard extends EntityProcess {
|
|
|
private List<String> titleList = Arrays.asList(
|
|
|
EntityEnum.TITLE_FOR_SIGN.toString(),
|
|
@@ -56,7 +48,7 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
|
|
|
}
|
|
|
|
|
|
//诊断文本
|
|
|
- if (titleText.get(EntityEnum.TITLE_FOR_DIAG.toString()) != null){
|
|
|
+ if (titleText.get(EntityEnum.TITLE_FOR_DIAG.toString()) != null) {
|
|
|
List<String> diagList = titleText.get(EntityEnum.TITLE_FOR_DIAG.toString());
|
|
|
String text = textJoin(content, diagList);
|
|
|
//诊断文本
|
|
@@ -167,6 +159,73 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
|
|
|
positiveFindings.add(positiveFinding);
|
|
|
}
|
|
|
threeLevelWardLabel.setPositiveFindings(positiveFindings);
|
|
|
+
|
|
|
+ try {
|
|
|
+ //实验室检查套餐
|
|
|
+ List<LaboratoryPackage> laboratoryPackages = new ArrayList<>();
|
|
|
+ List<Lemma> laboratoryPackageLemmas = createEntityTree(aiOut, EntityEnum.LABORATORY_PACKAGE.toString());
|
|
|
+ for (Lemma lemma : laboratoryPackageLemmas) {
|
|
|
+ LaboratoryPackage laboratoryPackage = new LaboratoryPackage();
|
|
|
+ laboratoryPackage.setName(lemma.getText());
|
|
|
+ laboratoryPackage.setCheckTime(findTAfter(lemma, new CheckTime(), EntityEnum.CHECK_TIME.toString()));
|
|
|
+ laboratoryPackages.add(laboratoryPackage);
|
|
|
+ }
|
|
|
+ threeLevelWardLabel.setLaboratoryPackages(laboratoryPackages);
|
|
|
+
|
|
|
+ //实验室检查
|
|
|
+ List<Laboratory> laboratories = new ArrayList<>();
|
|
|
+ List<Lemma> laboratoryLemmas = createEntityTree(aiOut, EntityEnum.LABORATORY.toString());
|
|
|
+ for (Lemma lemma : laboratoryLemmas) {
|
|
|
+ Laboratory laboratory = new Laboratory();
|
|
|
+ laboratory.setName(lemma.getText());
|
|
|
+ for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
|
+ if (relationLemma.getProperty().equals(EntityEnum.LABORATORY_PACKAGE.toString())) {
|
|
|
+ LaboratoryPackage laboratoryPackage = new LaboratoryPackage();
|
|
|
+ laboratoryPackage.setCheckTime(findTAfter(lemma, new CheckTime(), EntityEnum.CHECK_TIME.toString()));
|
|
|
+ laboratory.setLaboratoryPackage(findTAfter(lemma, laboratoryPackage, EntityEnum.LABORATORY_PACKAGE.toString()));//实验室检查套餐
|
|
|
+ }
|
|
|
+ }
|
|
|
+ laboratory.setCheckTime(findTAfter(lemma, new CheckTime(), EntityEnum.CHECK_TIME.toString()));//检查时间
|
|
|
+ laboratory.setLaboratoryResults(findTAfter(lemma, new LaboratoryResults(), EntityEnum.LABORATORY_RESULTS.toString()));//实验室检查结果
|
|
|
+ laboratories.add(laboratory);
|
|
|
+ }
|
|
|
+ threeLevelWardLabel.setLaboratories(laboratories);
|
|
|
+
|
|
|
+ //辅助检查
|
|
|
+ List<AuxiliaryExamination> auxiliaryExaminations = new ArrayList<>();
|
|
|
+ List<Lemma> auxiliaryExaminationLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
|
|
|
+ for (Lemma lemma : auxiliaryExaminationLemmas) {
|
|
|
+ AuxiliaryExamination auxiliaryExamination = new AuxiliaryExamination();
|
|
|
+ auxiliaryExamination.setName(lemma.getText());
|
|
|
+ auxiliaryExamination.setCheckTime(findTAfter(lemma, new CheckTime(), EntityEnum.CHECK_TIME.toString()));
|
|
|
+ auxiliaryExamination.setAuxiliaryExaminationResults(findTAfter(lemma, new AuxiliaryExaminationResults(), EntityEnum.AUXILIARY_EXAMINATION_RESULTS.toString()));
|
|
|
+ auxiliaryExaminations.add(auxiliaryExamination);
|
|
|
+ }
|
|
|
+ threeLevelWardLabel.setAuxiliaryExaminations(auxiliaryExaminations);
|
|
|
+
|
|
|
+ //药物
|
|
|
+ List<Drug> drugs = new ArrayList<>();
|
|
|
+ List<Lemma> DrugLemmas = createEntityTree(aiOut, EntityEnum.DRUG.toString());
|
|
|
+ for (Lemma lemma : DrugLemmas) {
|
|
|
+ int lemmaPosition = Integer.parseInt(lemma.getPosition());
|
|
|
+ if (content.substring(Math.max(0, lemmaPosition - 10), lemmaPosition).contains("暂停")){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Drug drug = new Drug();
|
|
|
+ drug.setName(lemma.getText().replaceAll("[“”]",""));
|
|
|
+ drug.setConsumption(findTAfter(lemma, new Consumption(), EntityEnum.CONSUMPTION.toString().split("-")[0]));
|
|
|
+ drug.setUsageWardRound(findTAfter(lemma, new UsageWardRound(), EntityEnum.USAGE_WARD_ROUND.toString()));
|
|
|
+ drug.setFrequency(findTAfter(lemma, new Frequency(), EntityEnum.FREQUENCY.toString()));
|
|
|
+ drug.setStop(findTAfter(lemma, new Stop(), EntityEnum.STOP.toString()));
|
|
|
+ drug.setReasonsForAntibiotic(findTAfter(lemma, new ReasonsForAntibiotic(), EntityEnum.REASONS_FOR_ANTIBIOTIC.toString()));
|
|
|
+ drugs.add(drug);
|
|
|
+ }
|
|
|
+ threeLevelWardLabel.setDrugs(drugs);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
return threeLevelWardLabel;
|
|
|
}
|
|
|
|
|
@@ -211,8 +270,10 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
|
|
|
}
|
|
|
} else {
|
|
|
//将倒数第二个标题存入结构
|
|
|
- subContentIndex = start + "," + Integer.parseInt(lemma.getPosition());
|
|
|
- putSubContent(titleText, title, subContentIndex);
|
|
|
+ if (StringUtil.isNotBlank(title)) {
|
|
|
+ subContentIndex = start + "," + Integer.parseInt(lemma.getPosition());
|
|
|
+ putSubContent(titleText, title, subContentIndex);
|
|
|
+ }
|
|
|
//如果是最后一个Lemma,文本就从当前lemma的position开始取,取到结束
|
|
|
title = lemma.getProperty();//截取的这一段文本的标题
|
|
|
if (titleList.contains(title)) {
|