|
@@ -3,6 +3,7 @@ package com.lantone.structure.ai;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.lantone.structure.ai.process.EntityProcessOperation;
|
|
|
import com.lantone.structure.client.CRFServiceClient;
|
|
|
import com.lantone.structure.ai.process.EntityProcessDrug;
|
|
|
import com.lantone.structure.ai.process.EntityProcessOperationDiscussion;
|
|
@@ -12,6 +13,7 @@ import com.lantone.structure.model.InputInfo;
|
|
|
import com.lantone.structure.model.doc.operation.OperationDiscussionDoc;
|
|
|
import com.lantone.structure.model.doc.operation.OperationDoc;
|
|
|
import com.lantone.structure.model.doc.operation.OperationRecordDoc;
|
|
|
+import com.lantone.structure.model.doc.operation.PreoperativeDiscussionDoc;
|
|
|
import com.lantone.structure.model.entity.Drug;
|
|
|
import com.lantone.structure.model.label.OperationDiscussionLabel;
|
|
|
import com.lantone.structure.model.label.OperationRecordLabel;
|
|
@@ -32,7 +34,7 @@ public class OperationAI extends ModelAI {
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
- public static List<String> medicalTextType = Arrays.asList("CourseAfterOperation_cx", "CourseRecordSRR");
|
|
|
+ public static List<String> medicalTextType = Arrays.asList("CourseAfterOperation_cx", "CourseRecordSRR","Taizhou_preoperativeDiscussion_record");
|
|
|
public static String entityRelationObject = "entity_relation_object";
|
|
|
public static String outputs = "outputs";
|
|
|
public static String content = "content";
|
|
@@ -43,6 +45,31 @@ public class OperationAI extends ModelAI {
|
|
|
JSONArray crfContent = new JSONArray();
|
|
|
List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
for (int i = 0; i < operationDocs.size(); i++) {
|
|
|
+ if (operationDocs.get(i).getPreoperativeDiscussionDoc() != null) {
|
|
|
+ PreoperativeDiscussionDoc preoperativeDiscussionDoc = operationDocs.get(i).getPreoperativeDiscussionDoc();
|
|
|
+ Map<String, String> structureMap = preoperativeDiscussionDoc.getStructureMap();
|
|
|
+ String text = preoperativeDiscussionDoc.getText();
|
|
|
+ String opName = structureMap.get("拟实施手术及操作名称");
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ if(StringUtil.isNotEmpty(opName)){
|
|
|
+ sb.append("拟实施手术名称:"+opName+"\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ String opFlag = structureMap.get("手术指征");
|
|
|
+ if(StringUtil.isNotEmpty(opFlag)){
|
|
|
+ sb.append("手术指征:"+opFlag+"\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ String simCase = structureMap.get("诊断依据");
|
|
|
+ if(StringUtil.isNotEmpty(simCase)){
|
|
|
+ sb.append("简要病情:"+simCase+"\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtil.isNotEmpty(sb.toString())){
|
|
|
+ text = sb.toString();
|
|
|
+ }
|
|
|
+ putContent(crfContent, medicalTextType.get(2),text, content, Content.preoperativeDiscussion);
|
|
|
+ }
|
|
|
if (operationDocs.get(i).getOperationRecordDoc() != null) {
|
|
|
OperationRecordDoc operationRecordDoc = operationDocs.get(i).getOperationRecordDoc();
|
|
|
Map<String, String> structureMap = operationRecordDoc.getStructureMap();
|
|
@@ -63,6 +90,14 @@ public class OperationAI extends ModelAI {
|
|
|
|
|
|
JSONObject midData = loadAI(crfContent, crfServiceClient);//crf返回数据
|
|
|
|
|
|
+/* for (int i = 0; i < operationDocs.size(); i++) {
|
|
|
+ if (midData.get(Content.preoperativeDiscussion) == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ PreoperativeDiscussionDoc preoperativeDiscussionDoc = putPreoperativeDiscussionCrfData(midData.getJSONObject(Content.preoperativeDiscussion));
|
|
|
+ operationDocs.get(i).setPreoperativeDiscussionDoc(preoperativeDiscussionDoc);
|
|
|
+ }*/
|
|
|
+
|
|
|
for (int i = 0; i < operationDocs.size(); i++) {
|
|
|
if (midData.get("手术记录" + i + "药物") != null) {
|
|
|
OperationRecordDoc operationRecordDoc = operationDocs.get(i).getOperationRecordDoc();
|
|
@@ -118,6 +153,25 @@ public class OperationAI extends ModelAI {
|
|
|
return drugs;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理术前小结
|
|
|
+ *
|
|
|
+ * @param jsonObject
|
|
|
+ */
|
|
|
+ public PreoperativeDiscussionDoc putPreoperativeDiscussionCrfData(JSONObject jsonObject) {
|
|
|
+ PreoperativeDiscussionDoc preoperativeDiscussionDoc = new PreoperativeDiscussionDoc();
|
|
|
+ if (jsonObject == null) {
|
|
|
+ return preoperativeDiscussionDoc;
|
|
|
+ }
|
|
|
+ JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
|
|
|
+ if (aiOut == null) {
|
|
|
+ return preoperativeDiscussionDoc;
|
|
|
+ }
|
|
|
+ EntityProcessOperation entityProcessOperation = new EntityProcessOperation();
|
|
|
+ PreoperativeDiscussionDoc preoperativeDiscussionDoc1 = entityProcessOperation.extractEntity(aiOut);
|
|
|
+ return preoperativeDiscussionDoc1;
|
|
|
+ }
|
|
|
+
|
|
|
protected void putContent(JSONArray crfContent, String medicalTextType, String text, String sign) {
|
|
|
String move_text = CatalogueUtil.removeSpecialChar(text);
|
|
|
if (StringUtil.isEmpty(move_text)) {
|