|
@@ -2,6 +2,7 @@ package com.lantone.structure.ai.process;
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.lantone.common.util.ListUtil;
|
|
|
import com.lantone.structure.ai.model.EntityEnum;
|
|
|
import com.lantone.structure.ai.model.Lemma;
|
|
|
import com.lantone.structure.model.label.DailyCourseRecordLabel;
|
|
@@ -22,18 +23,105 @@ public class EntityDailyCourseRecord extends EntityProcess {
|
|
|
|
|
|
//医嘱信息
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
- int doctorAdvice = 0;
|
|
|
- List<Lemma> doctorAdviceRecord = createEntityTree(aiOut, EntityEnum.DOCTORADVICERECORD.toString());
|
|
|
- for (Lemma lemma : doctorAdviceRecord) {
|
|
|
- doctorAdvice++;
|
|
|
- if(doctorAdviceRecord.size()>1){
|
|
|
- sb.append(doctorAdvice+lemma.getText()+" ");
|
|
|
+ String drugNames = "",laboratorys,auxoiliarys;
|
|
|
+ //药品
|
|
|
+ List<Lemma> drugName = createEntityTree(aiOut, EntityEnum.DRUG_NAME.toString());
|
|
|
+ if(ListUtil.isNotEmpty(drugName)){
|
|
|
+ sb.append("药品:");
|
|
|
+ }
|
|
|
+ for (Lemma lemma : drugName) {
|
|
|
+ String text = lemma.getText();
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.STOPNOW.toString())) {
|
|
|
+ drugNames = relationLemmaRec.getText()+text;
|
|
|
+ sb.append(drugNames+"、");
|
|
|
+ }
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.CONTINUE.toString())) {
|
|
|
+ drugNames = relationLemmaRec.getText()+text;
|
|
|
+ sb.append(drugNames+"、");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //实验室检查
|
|
|
+ String str = sb.toString();
|
|
|
+ if(str.endsWith("、")){
|
|
|
+ sb.deleteCharAt(str.length()-1);
|
|
|
+ }
|
|
|
+ List<Lemma> laboratory = createEntityTree(aiOut, EntityEnum.LABORATORY.toString());
|
|
|
+ if(ListUtil.isNotEmpty(laboratory)){
|
|
|
+ sb.append(" 实验室检查:");
|
|
|
+ }
|
|
|
+ for (Lemma lemma : laboratory) {
|
|
|
+ String text = lemma.getText();
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.REPATE.toString())) {
|
|
|
+ laboratorys = relationLemmaRec.getText()+text;
|
|
|
+ sb.append(laboratorys+"、");
|
|
|
+ }
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
|
|
|
+ laboratorys = relationLemmaRec.getText()+text;
|
|
|
+ sb.append(laboratorys+"、");
|
|
|
+ }
|
|
|
+ }
|
|
|
}else{
|
|
|
- sb.append(lemma.getText());
|
|
|
+ sb.append(text+" ");
|
|
|
}
|
|
|
}
|
|
|
+ //辅助检查
|
|
|
+ str = sb.toString();
|
|
|
+ if(str.endsWith("、")){
|
|
|
+ sb.deleteCharAt(str.length()-1);
|
|
|
+ }
|
|
|
+ List<Lemma> auxoiliary = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
|
|
|
+ if(ListUtil.isNotEmpty(auxoiliary)){
|
|
|
+ sb.append(" 辅助检查:");
|
|
|
+ }
|
|
|
+ for (Lemma lemma : auxoiliary) {
|
|
|
+ String text = lemma.getText();
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.REPATE.toString())) {
|
|
|
+ auxoiliarys = relationLemmaRec.getText()+text;
|
|
|
+ sb.append(auxoiliarys+"、");
|
|
|
+ }
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
|
|
|
+ auxoiliarys = relationLemmaRec.getText()+text;
|
|
|
+ sb.append(auxoiliarys+"、");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ sb.append(text+" ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ str = sb.toString();
|
|
|
+ if(str.endsWith("、")){
|
|
|
+ sb.deleteCharAt(str.length()-1);
|
|
|
+ }
|
|
|
+ //手术名称
|
|
|
+ List<Lemma> operation = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
|
|
|
+ if(ListUtil.isNotEmpty(operation)){
|
|
|
+ sb.append("手术名称:");
|
|
|
+ }
|
|
|
+ for (Lemma lemma : operation) {
|
|
|
+ String text = lemma.getText();
|
|
|
+ sb.append(text+" ");
|
|
|
+ }
|
|
|
dailyCourseRecordLabel.setDoctorAdviceRecord(sb.toString());
|
|
|
- } catch (Exception e) {
|
|
|
+ //停止
|
|
|
+ // List<Lemma> stop = createEntityTree(aiOut, EntityEnum.STOPNOW.toString());
|
|
|
+ //继续
|
|
|
+ // List<Lemma> continues = createEntityTree(aiOut, EntityEnum.CONTINUE.toString());
|
|
|
+ //复查
|
|
|
+ // List<Lemma> repate = createEntityTree(aiOut, EntityEnum.REPATE.toString());
|
|
|
+ //其他复查
|
|
|
+ // List<Lemma> otherRepate = createEntityTree(aiOut, EntityEnum.OTHERREPATE.toString());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
logger.error(e.getMessage(), e);
|
|
|
}
|