|
@@ -20,15 +20,13 @@ public class EntityDailyCourseRecord extends EntityProcess {
|
|
|
public DailyCourseRecordLabel extractEntity(JSONObject aiOut) {
|
|
|
DailyCourseRecordLabel dailyCourseRecordLabel= new DailyCourseRecordLabel();
|
|
|
try {
|
|
|
-
|
|
|
//医嘱信息
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
+ StringBuffer xb = new StringBuffer();
|
|
|
+ StringBuffer bb = new StringBuffer();
|
|
|
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()) {
|
|
@@ -46,62 +44,153 @@ public class EntityDailyCourseRecord extends EntityProcess {
|
|
|
sb.append(text+"、");
|
|
|
}
|
|
|
}
|
|
|
- //实验室检查
|
|
|
+ Boolean sbxflag = false;
|
|
|
String str = sb.toString();
|
|
|
- if(str.endsWith("、")){
|
|
|
+ StringBuffer sbx = new StringBuffer();
|
|
|
+ StringBuffer sbxx = new StringBuffer();
|
|
|
+ if(str.contains("、")){
|
|
|
+ String[] split = str.split("、");
|
|
|
+ if(split.length>1){
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ if(!(split[i].contains(EntityEnum.STOPNOW.toString()) || split[i].contains(EntityEnum.CONTINUE.toString()))){
|
|
|
+ sbx.append(split[i]+"、");
|
|
|
+ }else{
|
|
|
+ sbxx.append(split[i]+"、");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ sbxflag = true;
|
|
|
+ }
|
|
|
+ sb = new StringBuffer();
|
|
|
+ if(ListUtil.isNotEmpty(drugName)){
|
|
|
+ sb.append("药品:");
|
|
|
+ }
|
|
|
+ if(!sbxflag){
|
|
|
+ if(sbx.toString().endsWith("、")){
|
|
|
+ sbx.deleteCharAt(sbx.toString().length()-1);
|
|
|
+ sbx.append(";");
|
|
|
+ }
|
|
|
+ sb.append(sbx.toString());
|
|
|
+ sb.append(sbxx.toString());
|
|
|
+ }else{
|
|
|
+ sb.append(str);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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(" 实验室检查:");
|
|
|
}
|
|
|
+ //实验室检查
|
|
|
+ List<Lemma> laboratory = createEntityTree(aiOut, EntityEnum.LABORATORY.toString());
|
|
|
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+"、");
|
|
|
+ xb.append(laboratorys+"、");
|
|
|
}
|
|
|
if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
|
|
|
laboratorys = relationLemmaRec.getText()+text;
|
|
|
- sb.append(laboratorys+"、");
|
|
|
+ xb.append(laboratorys+"、");
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
- sb.append(text+" ");
|
|
|
+ xb.append(text+" ");
|
|
|
}
|
|
|
}
|
|
|
- //辅助检查
|
|
|
- str = sb.toString();
|
|
|
+ String xtr = xb.toString();
|
|
|
+ StringBuffer xbx = new StringBuffer();
|
|
|
+ StringBuffer xbxx = new StringBuffer();
|
|
|
+ Boolean xbxflag = false;
|
|
|
+ if(xtr.contains("、")){
|
|
|
+ String[] split = xtr.split("、");
|
|
|
+ if(split.length>1){
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ if(!(split[i].contains(EntityEnum.STOPNOW.toString()) || split[i].contains(EntityEnum.CONTINUE.toString()))){
|
|
|
+ xbx.append(split[i]+"、");
|
|
|
+ }else{
|
|
|
+ xbxx.append(split[i]+"、");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ xbxflag = true;
|
|
|
+ }
|
|
|
+ if(ListUtil.isNotEmpty(laboratory)){
|
|
|
+ sb.append(" 实验室检查:");
|
|
|
+ }
|
|
|
+ if(!xbxflag){
|
|
|
+ if(xbx.toString().endsWith("、")){
|
|
|
+ xbx.deleteCharAt(xbx.toString().length()-1);
|
|
|
+ xbx.append(";");
|
|
|
+ }
|
|
|
+ sb.append(xbx.toString());
|
|
|
+ sb.append(xbxx.toString());
|
|
|
+ }else{
|
|
|
+ sb.append(xtr);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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+"、");
|
|
|
+ bb.append(auxoiliarys+"、");
|
|
|
}
|
|
|
if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
|
|
|
auxoiliarys = relationLemmaRec.getText()+text;
|
|
|
- sb.append(auxoiliarys+"、");
|
|
|
+ bb.append(auxoiliarys+"、");
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
- sb.append(text+" ");
|
|
|
+ bb.append(text+" ");
|
|
|
}
|
|
|
}
|
|
|
+ Boolean bbxflag = false;
|
|
|
+ String btr = bb.toString();
|
|
|
+ StringBuffer bbx = new StringBuffer();
|
|
|
+ StringBuffer bbxx = new StringBuffer();
|
|
|
+ if(btr.contains("、")){
|
|
|
+ String[] split = xtr.split("、");
|
|
|
+ if(split.length>1){
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ if(!(split[i].contains(EntityEnum.STOPNOW.toString()) || split[i].contains(EntityEnum.CONTINUE.toString()))){
|
|
|
+ bbx.append(split[i]+"、");
|
|
|
+ }else{
|
|
|
+ bbxx.append(split[i]+"、");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ bbxflag = true;
|
|
|
+ }
|
|
|
+ if(ListUtil.isNotEmpty(auxoiliary)){
|
|
|
+ sb.append(" 辅助检查:");
|
|
|
+ }
|
|
|
+ if(!bbxflag){
|
|
|
+ if(bbx.toString().endsWith("、")){
|
|
|
+ bbx.deleteCharAt(bbx.toString().length()-1);
|
|
|
+ bbx.append(";");
|
|
|
+ }
|
|
|
+ sb.append(bbx.toString());
|
|
|
+ sb.append(bbxx.toString());
|
|
|
+ }else{
|
|
|
+ sb.append(btr);
|
|
|
+ }
|
|
|
str = sb.toString();
|
|
|
if(str.endsWith("、")){
|
|
|
sb.deleteCharAt(str.length()-1);
|
|
|
}
|
|
|
+
|
|
|
//手术名称
|
|
|
List<Lemma> operation = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
|
|
|
if(ListUtil.isNotEmpty(operation)){
|
|
@@ -120,9 +209,6 @@ public class EntityDailyCourseRecord extends EntityProcess {
|
|
|
// 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);
|