|
@@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.google.common.collect.ObjectArrays;
|
|
|
import com.lantone.common.util.FastJsonUtils;
|
|
|
import com.lantone.structure.ai.AIAnalyze;
|
|
|
import com.lantone.structure.client.CRFServiceClient;
|
|
@@ -15,6 +16,7 @@ import com.lantone.structure.model.InputInfo;
|
|
|
import com.lantone.structure.model.doc.*;
|
|
|
import com.lantone.structure.vo.AnalysisVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -93,9 +95,11 @@ public class StructureFacade {
|
|
|
mapKeyContrastCommon(jsonMap, keyContrastMap, retMap);
|
|
|
} else if (analysisVO.getType().equals("输血记录")) {
|
|
|
Map<String, Object> jsonMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(inputInfo.getClinicalBloodDocs().get(0).getClinicalBloodLabel()));
|
|
|
- mapKeyContrastCommon(jsonMap, keyContrastMap, retMap);
|
|
|
+ AddKeyValue(keyContrastMap, bloodKeyContrasts);
|
|
|
+ bloodKeyContrastCommon(jsonMap, keyContrastMap, retMap);
|
|
|
} else if (analysisVO.getType().equals("抢救记录")) {
|
|
|
Map<String, Object> jsonMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(inputInfo.getRescueDocs().get(0).getRescueLabel()));
|
|
|
+ // AddKeyValue(keyContrastMap, rescueContrasts);
|
|
|
mapKeyContrastCommon(jsonMap, keyContrastMap, retMap);
|
|
|
} else if (analysisVO.getType().equals("阶段小结")) {
|
|
|
Map<String, Object> jsonMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(inputInfo.getStagesSummaryDocs().get(0).getStagesSummaryLabel()));
|
|
@@ -152,18 +156,36 @@ public class StructureFacade {
|
|
|
"caputSuccedaneumPart=产瘤部位"
|
|
|
);
|
|
|
|
|
|
+
|
|
|
private List<String> bloodKeyContrasts = Lists.newArrayList(
|
|
|
+ "reason=输血原因",
|
|
|
+ "responseType=输血反应类型",
|
|
|
+ "indication=输血指征",
|
|
|
+ "type=输血类型",
|
|
|
+ "startTime=输血开始时间",
|
|
|
+ "endTime=输血结束时间",
|
|
|
"当前诊断=死亡诊断",
|
|
|
"死亡日期=死亡时间",
|
|
|
"初步诊断=入院诊断",
|
|
|
"诊治经过=诊疗经过",
|
|
|
- "本人姓名=姓名",
|
|
|
"现病史- 发病情况=发病情况",
|
|
|
+ "本人姓名=姓名",
|
|
|
"病历日期=记录时间",
|
|
|
"医生=记录医师"
|
|
|
);
|
|
|
|
|
|
private List<String> rescueContrasts = Lists.newArrayList(
|
|
|
+ "auxiliaryTest=检查/检验项目名称",
|
|
|
+ "interventions=介入物名称",
|
|
|
+ "operations=手术及操作名称",
|
|
|
+ //无对应
|
|
|
+ "drugs=抢救药品",
|
|
|
+ "methods=操作方法",
|
|
|
+ "diagnosis=疾病诊断名称",
|
|
|
+ //无对应
|
|
|
+ "conditions=抢救病情"
|
|
|
+
|
|
|
+
|
|
|
|
|
|
);
|
|
|
|
|
@@ -225,6 +247,83 @@ public class StructureFacade {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void bloodKeyContrastCommon(Map sourceMap, Map<String, String> keyContrastMap, Map<String, String> retMap) {
|
|
|
+ Map<String, Object> sourceMap_ = copyMap(sourceMap);
|
|
|
+ for (Map.Entry<String, Object> dateEntry : sourceMap_.entrySet()) {
|
|
|
+ try {
|
|
|
+ Object object = JSON.parse(FastJsonUtils.getBeanToJson(dateEntry.getValue()));
|
|
|
+ if (object instanceof JSONObject) {
|
|
|
+ Map<String, Object> firstJsonMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(dateEntry.getValue()));
|
|
|
+ if (firstJsonMap.size() == 1) {
|
|
|
+ String key = keyContrastMap.get(dateEntry.getKey());
|
|
|
+ retMap.put(key, (String) firstJsonMap.get("name"));
|
|
|
+ } else {
|
|
|
+ StringBuffer sbX = new StringBuffer();
|
|
|
+ for (Map.Entry<String, Object> firstDateEntry : firstJsonMap.entrySet()) {
|
|
|
+ String beanToJson = FastJsonUtils.getBeanToJson( firstDateEntry.getValue());
|
|
|
+ if(beanToJson.contains("name")||beanToJson.contains("measurementUnit")){
|
|
|
+ Map<String, Object> jsonToMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(firstDateEntry.getValue()));
|
|
|
+ if (jsonToMap.size() == 1) {
|
|
|
+ String childKey = keyContrastMap.get(firstDateEntry.getKey());
|
|
|
+ if (retMap.containsKey(keyContrastMap.get(firstDateEntry.getKey()))) {
|
|
|
+ retMap.put(keyContrastMap.get(dateEntry.getKey()) + childKey, (String) jsonToMap.get("name"));
|
|
|
+ } else {
|
|
|
+ retMap.put(childKey, (String) jsonToMap.get("name"));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ for (Map.Entry<String, Object> typeObjectEntry : jsonToMap.entrySet()) {
|
|
|
+ Object value = typeObjectEntry.getValue();
|
|
|
+ if(value instanceof JSONObject){
|
|
|
+ Map<String, Object> objToMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(value));
|
|
|
+ sbX.append(objToMap.get("name"));
|
|
|
+ }else{
|
|
|
+ sbX.append( jsonToMap.get("name"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ sbX.append(firstDateEntry.getValue());
|
|
|
+ }
|
|
|
+ retMap.put(keyContrastMap.get(dateEntry.getKey()),sbX.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (object instanceof JSONArray) {
|
|
|
+ List<Map<String, Object>> jsonToListMap = FastJsonUtils.getJsonToListMap(FastJsonUtils.getBeanToJson(dateEntry.getValue()));
|
|
|
+ int count = 1;
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ if(jsonToListMap.size()==1){
|
|
|
+ Object name = jsonToListMap.get(0).get("name");
|
|
|
+ retMap.put(keyContrastMap.get(dateEntry.getKey()),String.valueOf(name));
|
|
|
+ }else{
|
|
|
+ for (Map<String, Object> mapList : jsonToListMap) {
|
|
|
+ for (Map.Entry<String, Object> stringObjectEntry : mapList.entrySet()) {
|
|
|
+ if(stringObjectEntry.getKey()=="negative"){
|
|
|
+ Map<String, Object> negativeJsonMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(stringObjectEntry.getValue()));
|
|
|
+ Object negativeObject = negativeJsonMap.get("name");
|
|
|
+ sb.append((count++) + "." +(negativeObject==null? "":negativeObject));
|
|
|
+ }else if(stringObjectEntry.getKey()=="name"){
|
|
|
+ sb.append(stringObjectEntry.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ retMap.put(keyContrastMap.get(dateEntry.getKey()), sb.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (JSONException e) {
|
|
|
+ log.error(keyContrastMap.get(dateEntry.getKey()) + "json为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 复制一个map
|
|
|
*
|