|
@@ -5,16 +5,17 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
import com.lantone.qc.kernel.client.CRFServiceClient;
|
|
import com.lantone.qc.kernel.client.CRFServiceClient;
|
|
|
|
+import com.lantone.qc.kernel.structure.ai.model.CrfOut;
|
|
|
|
+import com.lantone.qc.kernel.structure.ai.process.EntityProcess;
|
|
|
|
+import com.lantone.qc.kernel.structure.ai.process.EntityProcessSymptom;
|
|
import com.lantone.qc.pub.Content;
|
|
import com.lantone.qc.pub.Content;
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
|
|
import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
|
|
import com.lantone.qc.pub.model.entity.Annotation;
|
|
import com.lantone.qc.pub.model.entity.Annotation;
|
|
-import com.lantone.qc.pub.model.label.ChiefLabel;
|
|
|
|
import com.lantone.qc.pub.model.vo.CRFVo;
|
|
import com.lantone.qc.pub.model.vo.CRFVo;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @ClassName : InHospitalDoc
|
|
* @ClassName : InHospitalDoc
|
|
@@ -33,7 +34,10 @@ public class BeHospitalizedAI extends QCCatalogue {
|
|
*/
|
|
*/
|
|
public static List<String> medicalTextType = Arrays.asList("FirstCourseRecord_cx", "PastFamily_cx", "PersonalHistory_cx", "HPIForCX_cx",
|
|
public static List<String> medicalTextType = Arrays.asList("FirstCourseRecord_cx", "PastFamily_cx", "PersonalHistory_cx", "HPIForCX_cx",
|
|
"GeneralVital_cx", "chief_present");
|
|
"GeneralVital_cx", "chief_present");
|
|
|
|
+ public static String entityRelationObject = "entity_relation_object";
|
|
|
|
+ public static String outputs = "outputs";
|
|
public void medrec(InputInfo inputInfo,CRFServiceClient crfServiceClient){
|
|
public void medrec(InputInfo inputInfo,CRFServiceClient crfServiceClient){
|
|
|
|
+ Map<String,List<CrfOut>> crfOut = new HashMap<>();//主诉-->
|
|
JSONArray crfContent = new JSONArray();
|
|
JSONArray crfContent = new JSONArray();
|
|
BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
|
|
BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
|
|
String chief_text = beHospitalizedDoc.getChiefLabel().getText();
|
|
String chief_text = beHospitalizedDoc.getChiefLabel().getText();
|
|
@@ -45,12 +49,19 @@ public class BeHospitalizedAI extends QCCatalogue {
|
|
String menstrual_text = beHospitalizedDoc.getMenstrualLabel().getText();
|
|
String menstrual_text = beHospitalizedDoc.getMenstrualLabel().getText();
|
|
//婚育史
|
|
//婚育史
|
|
String marital_text = beHospitalizedDoc.getMaritalLabel().getText();
|
|
String marital_text = beHospitalizedDoc.getMaritalLabel().getText();
|
|
- //存放主诉、现病史
|
|
|
|
|
|
+ //一般体格检查
|
|
|
|
+ String vital_text = beHospitalizedDoc.getVitalLabel().getText();
|
|
|
|
+ //专科体格检查
|
|
|
|
+ String vitalSpecial_text = beHospitalizedDoc.getVitalLabelSpecial().getText();
|
|
|
|
+ //存放主诉、现病史、专科查体(体格检查(二))
|
|
putContent(crfContent,medicalTextType.get(3), chief_text,Content.chief);
|
|
putContent(crfContent,medicalTextType.get(3), chief_text,Content.chief);
|
|
putContent(crfContent,medicalTextType.get(3), present_text,Content.present);
|
|
putContent(crfContent,medicalTextType.get(3), present_text,Content.present);
|
|
|
|
+ putContent(crfContent,medicalTextType.get(3), vitalSpecial_text,Content.special_exam);
|
|
//存放既往史、家族史
|
|
//存放既往史、家族史
|
|
putContent(crfContent,medicalTextType.get(3), past_text,Content.past);
|
|
putContent(crfContent,medicalTextType.get(3), past_text,Content.past);
|
|
putContent(crfContent,medicalTextType.get(3), family_text,Content.family);
|
|
putContent(crfContent,medicalTextType.get(3), family_text,Content.family);
|
|
|
|
+ //存放一般查体
|
|
|
|
+ putContent(crfContent,medicalTextType.get(3), vital_text,Content.phys_exam);
|
|
//存放个人史、月经史、婚育史
|
|
//存放个人史、月经史、婚育史
|
|
putContent(crfContent,medicalTextType.get(3), Personal_text,Content.personal);
|
|
putContent(crfContent,medicalTextType.get(3), Personal_text,Content.personal);
|
|
putContent(crfContent,medicalTextType.get(3), menstrual_text,Content.menses);
|
|
putContent(crfContent,medicalTextType.get(3), menstrual_text,Content.menses);
|
|
@@ -61,9 +72,24 @@ public class BeHospitalizedAI extends QCCatalogue {
|
|
//获取CRF模型返回数据
|
|
//获取CRF模型返回数据
|
|
JSONArray data = getAnnotation(crfServiceClient, crfVo).getData();
|
|
JSONArray data = getAnnotation(crfServiceClient, crfVo).getData();
|
|
JSONObject midData = getOutputs(data);
|
|
JSONObject midData = getOutputs(data);
|
|
|
|
+ putAllCrfData(midData.getJSONObject(Content.chief),crfOut,Content.chief);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ public void putAllCrfData(JSONObject jsonObject,Map<String,List<CrfOut>> crfOut,String sign){
|
|
|
|
+ if (jsonObject == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ Map<String,List<CrfOut>> detailOutput = new HashMap<>();
|
|
|
|
+ JSONObject outputs = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
|
|
|
|
+ List<CrfOut> outputInfos = new ArrayList<>();
|
|
|
|
+ CrfOut outputInfo = new CrfOut();
|
|
|
|
+ add2Output(new EntityProcessSymptom(), outputs, outputInfo);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ public void add2Output(EntityProcess entityProcess, JSONObject outputs, CrfOut outputInfo){
|
|
|
|
+ entityProcess.extractEntity(outputs, outputInfo);
|
|
}
|
|
}
|
|
public void putContent(JSONArray crfContent, String medicalTextType, String text,String sign){
|
|
public void putContent(JSONArray crfContent, String medicalTextType, String text,String sign){
|
|
String move_text = this.moveSpecialSymbols(text);
|
|
String move_text = this.moveSpecialSymbols(text);
|