|
@@ -3,13 +3,33 @@ package com.diagbot.model.ai;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.diagbot.client.CRFServiceClient;
|
|
|
-import com.diagbot.dto.WordBillCrfDTO;
|
|
|
-import com.diagbot.model.ai.process.*;
|
|
|
-import com.diagbot.model.entity.*;
|
|
|
-import com.diagbot.model.label.*;
|
|
|
+import com.diagbot.dto.WordCrfDTO;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessClinic;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessDiag;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessFamily;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessLis;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessMarital;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessMenses;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessPacs;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessPast;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessPersonal;
|
|
|
+import com.diagbot.model.ai.process.EntityProcessVital;
|
|
|
+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.ChiefLabel;
|
|
|
+import com.diagbot.model.label.DiagLabel;
|
|
|
+import com.diagbot.model.label.FamilyLabel;
|
|
|
+import com.diagbot.model.label.MaritalLabel;
|
|
|
+import com.diagbot.model.label.MenstrualLabel;
|
|
|
+import com.diagbot.model.label.PastLabel;
|
|
|
+import com.diagbot.model.label.PersonalLabel;
|
|
|
+import com.diagbot.model.label.PresentLabel;
|
|
|
+import com.diagbot.model.label.VitalLabel;
|
|
|
import com.diagbot.util.Content;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
-import com.diagbot.vo.IndicationPushVO;
|
|
|
+import com.diagbot.vo.SearchData;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -58,10 +78,10 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
*
|
|
|
*
|
|
|
* @param inputInfo
|
|
|
- * @param wordBillCrfDTO
|
|
|
+ * @param wordCrfDTO
|
|
|
* @param crfServiceClient
|
|
|
*/
|
|
|
- public void medrec(IndicationPushVO inputInfo, WordBillCrfDTO wordBillCrfDTO, CRFServiceClient crfServiceClient) {
|
|
|
+ public void medrec(SearchData inputInfo, WordCrfDTO wordCrfDTO, CRFServiceClient crfServiceClient) {
|
|
|
JSONArray crfContent = new JSONArray();
|
|
|
if (inputInfo != null) {
|
|
|
/* 主诉 */
|
|
@@ -72,7 +92,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
ChiefLabel chiefLabel = new ChiefLabel();
|
|
|
chiefLabel.setText(chiefText);
|
|
|
chiefLabel.setAiText(chiefText);
|
|
|
- wordBillCrfDTO.setChiefLabel(chiefLabel);
|
|
|
+ wordCrfDTO.setChiefLabel(chiefLabel);
|
|
|
putContent(crfContent, medicalTextType.get(7), chiefText, Content.chief);/* 2020-06-08修改主诉模型为现病史模型 */
|
|
|
}
|
|
|
}
|
|
@@ -82,7 +102,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
PresentLabel presentLabel = new PresentLabel();
|
|
|
presentLabel.setText(presentText);
|
|
|
presentLabel.setAiText(presentText);
|
|
|
- wordBillCrfDTO.setPresentLabel(presentLabel);
|
|
|
+ wordCrfDTO.setPresentLabel(presentLabel);
|
|
|
putContent(crfContent, medicalTextType.get(7), presentText, Content.present);
|
|
|
}
|
|
|
/* 既往史 */
|
|
@@ -91,7 +111,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
PastLabel pastLabel = new PastLabel();
|
|
|
pastLabel.setText(pastText);
|
|
|
pastLabel.setAiText(pastText);
|
|
|
- wordBillCrfDTO.setPastLabel(pastLabel);
|
|
|
+ wordCrfDTO.setPastLabel(pastLabel);
|
|
|
putContent(crfContent, medicalTextType.get(1), pastText, Content.past);
|
|
|
}
|
|
|
/* 月经史文本需从个人史截取一部分文本拼接 */
|
|
@@ -102,7 +122,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
PersonalLabel personalLabel = new PersonalLabel();
|
|
|
personalLabel.setText(personalText);
|
|
|
personalLabel.setAiText(personalText);
|
|
|
- wordBillCrfDTO.setPersonalLabel(personalLabel);
|
|
|
+ wordCrfDTO.setPersonalLabel(personalLabel);
|
|
|
putContent(crfContent, medicalTextType.get(2), personalText, Content.personal);
|
|
|
concatMenstrual = getConcatMenstrual(concatMenstrual, personalText);
|
|
|
}
|
|
@@ -112,7 +132,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
MaritalLabel maritalLabel = new MaritalLabel();
|
|
|
maritalLabel.setText(maritalText);
|
|
|
maritalLabel.setAiText(maritalText);
|
|
|
- wordBillCrfDTO.setMaritalLabel(maritalLabel);
|
|
|
+ wordCrfDTO.setMaritalLabel(maritalLabel);
|
|
|
putContent(crfContent, medicalTextType.get(2), maritalText, Content.marriage);
|
|
|
}
|
|
|
/* 月经史 */
|
|
@@ -121,7 +141,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
MenstrualLabel menstrualLabel = new MenstrualLabel();
|
|
|
menstrualLabel.setText(menstrualText);
|
|
|
menstrualLabel.setAiText(menstrualText);
|
|
|
- wordBillCrfDTO.setMenstrualLabel(menstrualLabel);
|
|
|
+ wordCrfDTO.setMenstrualLabel(menstrualLabel);
|
|
|
putContent(crfContent, medicalTextType.get(2), concatMenstrual, menstrualText, Content.menses);
|
|
|
}
|
|
|
/* 家族史 */
|
|
@@ -130,7 +150,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
FamilyLabel familyLabel = new FamilyLabel();
|
|
|
familyLabel.setText(familyText);
|
|
|
familyLabel.setAiText(familyText);
|
|
|
- wordBillCrfDTO.setFamilyLabel(familyLabel);
|
|
|
+ wordCrfDTO.setFamilyLabel(familyLabel);
|
|
|
putContent(crfContent, medicalTextType.get(1), familyText, Content.family);
|
|
|
}
|
|
|
|
|
@@ -140,7 +160,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
PacsLabel pacsLabel = new PacsLabel();
|
|
|
pacsLabel.setText(pacsText);
|
|
|
pacsLabel.setAiText(pacsText);
|
|
|
- wordBillCrfDTO.setPacsLabel(pacsLabel);
|
|
|
+ wordCrfDTO.setPacsLabel(pacsLabel);
|
|
|
putContent(crfContent, medicalTextType.get(3), pacsText, Content.pacs);
|
|
|
}
|
|
|
//* 专科检查(专科体格检查)
|
|
@@ -154,7 +174,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
VitalLabel vitalLabel = new VitalLabel();
|
|
|
vitalLabel.setAiText(vitalText);
|
|
|
vitalLabel.setText(vitalText);
|
|
|
- wordBillCrfDTO.setVitalLabel(vitalLabel);
|
|
|
+ wordCrfDTO.setVitalLabel(vitalLabel);
|
|
|
putContent(crfContent, medicalTextType.get(4), vitalText, Content.phys_exam);
|
|
|
}
|
|
|
// 初步诊断
|
|
@@ -163,7 +183,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
DiagLabel diagLabel = new DiagLabel();
|
|
|
diagLabel.setText(initialDiagText);
|
|
|
diagLabel.setAiText(initialDiagText);
|
|
|
- wordBillCrfDTO.setDiagLabel(diagLabel);
|
|
|
+ wordCrfDTO.setDiagLabel(diagLabel);
|
|
|
if (StringUtil.isNotBlank(initialDiagText)) {
|
|
|
putContent(crfContent, medicalTextType.get(6), initialDiagText, Content.initial_diag);
|
|
|
}
|
|
@@ -188,36 +208,36 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
|
|
|
JSONObject midData = loadAI(crfContent, crfServiceClient);
|
|
|
/* 处理主诉 */
|
|
|
- if (wordBillCrfDTO.getChiefLabel() != null ) {
|
|
|
- putChiefCrfData(midData.getJSONObject(Content.chief), wordBillCrfDTO);
|
|
|
+ if (wordCrfDTO.getChiefLabel() != null ) {
|
|
|
+ putChiefCrfData(midData.getJSONObject(Content.chief), wordCrfDTO);
|
|
|
}
|
|
|
/* 处理现病史 */
|
|
|
- if (wordBillCrfDTO.getPresentLabel() != null ) {
|
|
|
- putPresentCrfData(midData.getJSONObject(Content.present), wordBillCrfDTO);
|
|
|
+ if (wordCrfDTO.getPresentLabel() != null ) {
|
|
|
+ putPresentCrfData(midData.getJSONObject(Content.present), wordCrfDTO);
|
|
|
}
|
|
|
/* 处理既往史 */
|
|
|
- if (wordBillCrfDTO.getPastLabel() != null) {
|
|
|
- putPastCrfData(midData.getJSONObject(Content.past), wordBillCrfDTO);
|
|
|
+ if (wordCrfDTO.getPastLabel() != null) {
|
|
|
+ putPastCrfData(midData.getJSONObject(Content.past), wordCrfDTO);
|
|
|
}
|
|
|
/* 处理个人史 */
|
|
|
- if (wordBillCrfDTO.getPersonalLabel() != null) {
|
|
|
- putPersonalCrfData(midData.getJSONObject(Content.personal), wordBillCrfDTO);
|
|
|
+ if (wordCrfDTO.getPersonalLabel() != null) {
|
|
|
+ putPersonalCrfData(midData.getJSONObject(Content.personal), wordCrfDTO);
|
|
|
}
|
|
|
/* 处理月经史 */
|
|
|
- if (wordBillCrfDTO.getMenstrualLabel() != null) {
|
|
|
- putMensesCrfData(midData.getJSONObject(Content.menses), wordBillCrfDTO);
|
|
|
+ if (wordCrfDTO.getMenstrualLabel() != null) {
|
|
|
+ putMensesCrfData(midData.getJSONObject(Content.menses), wordCrfDTO);
|
|
|
}
|
|
|
/* 处理家族史 */
|
|
|
- if (wordBillCrfDTO.getFamilyLabel() != null) {
|
|
|
- putFamilyCrfData(midData.getJSONObject(Content.family), wordBillCrfDTO);
|
|
|
+ if (wordCrfDTO.getFamilyLabel() != null) {
|
|
|
+ putFamilyCrfData(midData.getJSONObject(Content.family), wordCrfDTO);
|
|
|
}
|
|
|
/* 处理婚育史 */
|
|
|
- if (wordBillCrfDTO.getMaritalLabel() != null ) {
|
|
|
- putMaritalCrfData(midData.getJSONObject(Content.marriage), wordBillCrfDTO);
|
|
|
+ if (wordCrfDTO.getMaritalLabel() != null ) {
|
|
|
+ putMaritalCrfData(midData.getJSONObject(Content.marriage), wordCrfDTO);
|
|
|
}
|
|
|
//处理初步诊断
|
|
|
- if (wordBillCrfDTO.getDiagLabel() != null) {
|
|
|
- putInitialDiagCrfData(midData.getJSONObject(Content.initial_diag), wordBillCrfDTO);
|
|
|
+ if (wordCrfDTO.getDiagLabel() != null) {
|
|
|
+ putInitialDiagCrfData(midData.getJSONObject(Content.initial_diag), wordCrfDTO);
|
|
|
}
|
|
|
/*//处理修正诊断
|
|
|
if (beHospitalizedDoc.getRevisedDiagLabel() != null && beHospitalizedDoc.getRevisedDiagLabel().isCrfLabel()) {
|
|
@@ -228,13 +248,13 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
putSuppleDiagCrfData(midData.getJSONObject(Content.supple_diag), inputInfo);
|
|
|
}*/
|
|
|
/* 处理辅助检查 */
|
|
|
- /*if (wordBillCrfDTO.getPacsLabel() != null) {
|
|
|
- putPacsCrfData(midData.getJSONObject(Content.pacs), wordBillCrfDTO);
|
|
|
+ /*if (wordCrfDTO.getPacsLabel() != null) {
|
|
|
+ putPacsCrfData(midData.getJSONObject(Content.pacs), wordCrfDTO);
|
|
|
}*/
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void putChiefCrfData(JSONObject jsonObject, WordBillCrfDTO wordBillCrfDTO) {
|
|
|
+ public void putChiefCrfData(JSONObject jsonObject, WordCrfDTO wordCrfDTO) {
|
|
|
if (jsonObject == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -246,13 +266,13 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
|
|
|
PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
|
|
|
|
|
|
- ChiefLabel chiefLabel = wordBillCrfDTO.getChiefLabel();
|
|
|
+ ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
|
|
|
chiefLabel.setClinicals(presentLabel.getClinicals());
|
|
|
chiefLabel.setDiags(presentLabel.getDiags());
|
|
|
chiefLabel.setPds(presentLabel.getPds());
|
|
|
}
|
|
|
|
|
|
- public void putPresentCrfData(JSONObject jsonObject, WordBillCrfDTO wordBillCrfDTO) {
|
|
|
+ public void putPresentCrfData(JSONObject jsonObject, WordCrfDTO wordCrfDTO) {
|
|
|
if (jsonObject == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -263,19 +283,19 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
//放置入inputinfo
|
|
|
EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
|
|
|
PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
|
|
|
- presentLabel.setText(wordBillCrfDTO.getPresentLabel().getText());
|
|
|
+ presentLabel.setText(wordCrfDTO.getPresentLabel().getText());
|
|
|
List<Lis> lis = loadLises(aiOut);
|
|
|
presentLabel.setLises(lis);
|
|
|
- wordBillCrfDTO.setPresentLabel(presentLabel);
|
|
|
+ wordCrfDTO.setPresentLabel(presentLabel);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 家族史
|
|
|
*
|
|
|
* @param jsonObject
|
|
|
- * @param wordBillCrfDTO
|
|
|
+ * @param wordCrfDTO
|
|
|
*/
|
|
|
- public void putFamilyCrfData(JSONObject jsonObject, WordBillCrfDTO wordBillCrfDTO) {
|
|
|
+ public void putFamilyCrfData(JSONObject jsonObject, WordCrfDTO wordCrfDTO) {
|
|
|
if (jsonObject == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -286,17 +306,17 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
//家族史信息处理
|
|
|
EntityProcessFamily entityProcess = new EntityProcessFamily();
|
|
|
FamilyLabel familyLabel = entityProcess.extractEntity(aiOut);
|
|
|
- familyLabel.setText(wordBillCrfDTO.getFamilyLabel().getText());
|
|
|
- wordBillCrfDTO.setFamilyLabel(familyLabel);
|
|
|
+ familyLabel.setText(wordCrfDTO.getFamilyLabel().getText());
|
|
|
+ wordCrfDTO.setFamilyLabel(familyLabel);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 婚育史
|
|
|
*
|
|
|
* @param jsonObject
|
|
|
- * @param wordBillCrfDTO
|
|
|
+ * @param wordCrfDTO
|
|
|
*/
|
|
|
- public void putMaritalCrfData(JSONObject jsonObject, WordBillCrfDTO wordBillCrfDTO) {
|
|
|
+ public void putMaritalCrfData(JSONObject jsonObject, WordCrfDTO wordCrfDTO) {
|
|
|
if (jsonObject == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -307,11 +327,11 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
//家族史信息处理
|
|
|
EntityProcessMarital entityProcess = new EntityProcessMarital();
|
|
|
MaritalLabel maritalLabel = entityProcess.extractEntity(aiOut);
|
|
|
- maritalLabel.setText(wordBillCrfDTO.getMaritalLabel().getText());
|
|
|
- wordBillCrfDTO.setMaritalLabel(maritalLabel);
|
|
|
+ maritalLabel.setText(wordCrfDTO.getMaritalLabel().getText());
|
|
|
+ wordCrfDTO.setMaritalLabel(maritalLabel);
|
|
|
}
|
|
|
|
|
|
- public void putPastCrfData(JSONObject jsonObject, WordBillCrfDTO wordBillCrfDTO) {
|
|
|
+ public void putPastCrfData(JSONObject jsonObject, WordCrfDTO wordCrfDTO) {
|
|
|
if (jsonObject == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -322,8 +342,8 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
//放置入inputinfo
|
|
|
EntityProcessPast entityProcessPast = new EntityProcessPast();
|
|
|
PastLabel pastLabel = entityProcessPast.extractEntity(aiOut);
|
|
|
- pastLabel.setText(wordBillCrfDTO.getPastLabel().getText());
|
|
|
- wordBillCrfDTO.setPastLabel(pastLabel);
|
|
|
+ pastLabel.setText(wordCrfDTO.getPastLabel().getText());
|
|
|
+ wordCrfDTO.setPastLabel(pastLabel);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -331,9 +351,9 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
* 个人史信息提取
|
|
|
*
|
|
|
* @param jsonObject
|
|
|
- * @param wordBillCrfDTO
|
|
|
+ * @param wordCrfDTO
|
|
|
*/
|
|
|
- public void putPersonalCrfData(JSONObject jsonObject, WordBillCrfDTO wordBillCrfDTO) {
|
|
|
+ public void putPersonalCrfData(JSONObject jsonObject, WordCrfDTO wordCrfDTO) {
|
|
|
if (jsonObject == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -344,17 +364,17 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
//个人史信息提取
|
|
|
EntityProcessPersonal entityProcessPersonal = new EntityProcessPersonal();
|
|
|
PersonalLabel personalLabel = entityProcessPersonal.extractEntity(aiOut);
|
|
|
- personalLabel.setText(wordBillCrfDTO.getPersonalLabel().getText());
|
|
|
- wordBillCrfDTO.setPersonalLabel(personalLabel);
|
|
|
+ personalLabel.setText(wordCrfDTO.getPersonalLabel().getText());
|
|
|
+ wordCrfDTO.setPersonalLabel(personalLabel);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 月经史信息提取
|
|
|
*
|
|
|
* @param jsonObject
|
|
|
- * @param wordBillCrfDTO
|
|
|
+ * @param wordCrfDTO
|
|
|
*/
|
|
|
- public void putMensesCrfData(JSONObject jsonObject, WordBillCrfDTO wordBillCrfDTO) {
|
|
|
+ public void putMensesCrfData(JSONObject jsonObject, WordCrfDTO wordCrfDTO) {
|
|
|
if (jsonObject == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -365,8 +385,8 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
//月经史信息处理
|
|
|
EntityProcessMenses entityProcess = new EntityProcessMenses();
|
|
|
MenstrualLabel menstrualLabel = entityProcess.extractEntity(aiOut);
|
|
|
- menstrualLabel.setText(wordBillCrfDTO.getMenstrualLabel().getText());
|
|
|
- wordBillCrfDTO.setMenstrualLabel(menstrualLabel);
|
|
|
+ menstrualLabel.setText(wordCrfDTO.getMenstrualLabel().getText());
|
|
|
+ wordCrfDTO.setMenstrualLabel(menstrualLabel);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -375,7 +395,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
* @param jsonObject
|
|
|
* @param inputInfo
|
|
|
*/
|
|
|
- public void putInitialDiagCrfData(JSONObject jsonObject, WordBillCrfDTO wordBillCrfDTO) {
|
|
|
+ public void putInitialDiagCrfData(JSONObject jsonObject, WordCrfDTO wordCrfDTO) {
|
|
|
if (jsonObject == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -388,9 +408,9 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
|
|
|
|
|
|
DiagLabel initialDiagLabel = new DiagLabel();
|
|
|
- initialDiagLabel.setText(wordBillCrfDTO.getDiagLabel().getText());
|
|
|
+ initialDiagLabel.setText(wordCrfDTO.getDiagLabel().getText());
|
|
|
initialDiagLabel.setDiags(diags);
|
|
|
- wordBillCrfDTO.setDiagLabel(initialDiagLabel);
|
|
|
+ wordCrfDTO.setDiagLabel(initialDiagLabel);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -454,7 +474,7 @@ public class BeHospitalizedAI extends ModelAI {
|
|
|
* @param jsonObject
|
|
|
* @param wordBillCrfDTO
|
|
|
*/
|
|
|
- /* public void putPacsCrfData(JSONObject jsonObject, WordBillCrfDTO wordBillCrfDTO) {
|
|
|
+ /* public void putPacsCrfData(JSONObject jsonObject, WordCrfDTO wordBillCrfDTO) {
|
|
|
if (jsonObject == null) {
|
|
|
return;
|
|
|
}
|