فهرست منبع

恩泽:crf模型剖宫产映射

wangsy 4 سال پیش
والد
کامیت
64f2a00b56
1فایلهای تغییر یافته به همراه43 افزوده شده و 3 حذف شده
  1. 43 3
      structure-center/src/main/java/com/lantone/structure/facade/StructureFacade.java

+ 43 - 3
structure-center/src/main/java/com/lantone/structure/facade/StructureFacade.java

@@ -8,6 +8,7 @@ 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.common.util.StringUtil;
 import com.lantone.structure.ai.AIAnalyze;
 import com.lantone.structure.client.CRFServiceClient;
 import com.lantone.structure.client.SimilarityServiceClient;
@@ -86,6 +87,7 @@ public class StructureFacade {
     public AnalysisDTO saveMap(InputInfo inputInfo, AnalysisVO analysisVO) {
         Map<String, Object> map = Maps.newHashMap();
         Map<String, String> retMap = new HashMap<>();
+        Map<String, String> structureMap = new HashMap<>();
         AnalysisDTO analysisDTO = new AnalysisDTO();
         Map<String, String> keyContrastMap = Maps.newHashMap();
         if (analysisVO.getType().equals("剖宫产手术")) {
@@ -93,10 +95,11 @@ public class StructureFacade {
             //添加keyContrastMap数据
             AddKeyValue(keyContrastMap, sectionKeyContrasts);
             mapKeyContrastCommon(jsonMap, keyContrastMap, retMap);
+            replaceMapping(retMap,ezSectionMaps,structureMap);
         } else if (analysisVO.getType().equals("输血记录")) {
             Map<String, Object> jsonMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(inputInfo.getClinicalBloodDocs().get(0).getClinicalBloodLabel()));
             AddKeyValue(keyContrastMap, bloodKeyContrasts);
-            bloodKeyContrastCommon(jsonMap, keyContrastMap, retMap);
+            bloodKeyContrastCommon(jsonMap, keyContrastMap, structureMap);
         } else if (analysisVO.getType().equals("抢救记录")) {
             Map<String, Object> jsonMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(inputInfo.getRescueDocs().get(0).getRescueLabel()));
           //  AddKeyValue(keyContrastMap, rescueContrasts);
@@ -105,7 +108,7 @@ public class StructureFacade {
             Map<String, Object> jsonMap = FastJsonUtils.getJsonToMap(FastJsonUtils.getBeanToJson(inputInfo.getStagesSummaryDocs().get(0).getStagesSummaryLabel()));
             mapKeyContrastCommon(jsonMap, keyContrastMap, retMap);
         }
-        map.put(analysisVO.getType(), retMap);
+        map.put(analysisVO.getType(), structureMap);
         analysisDTO.setResult(map);
 
         return analysisDTO;
@@ -319,8 +322,45 @@ public class StructureFacade {
         }
     }
 
+    public void replaceMapping(Map sourceMap, List<String> keyContrasts, Map<String, String> retMap) {
+        Map<String, String> sourceMap_ = copyMap(sourceMap);
+        String[] arry = null;
+        String sourceKey = null, targetKey;
+        Set<String> removeKey = new HashSet<>();
+        for (String keyContrast : keyContrasts) {
+            arry = keyContrast.split("=");
+            sourceKey = arry[0];
+            if (arry.length == 1) {
+                targetKey = arry[0];
+            } else {
+                targetKey = arry[1];
+            }
+            if (StringUtil.isNotBlank(sourceMap_.get(sourceKey))
+                    && (!retMap.containsKey(targetKey) || StringUtil.isBlank(retMap.get(targetKey)))) {
+                retMap.put(targetKey, sourceMap_.get(sourceKey));
+            }
+            removeKey.add(sourceKey);
+        }
+        Set<String> keySet = retMap.keySet();
+        for (String key : sourceMap_.keySet()) {
+            if (!keySet.contains(key) && !removeKey.contains(key)) { // 如果之前已放过key就不用放了
+                retMap.put(key, sourceMap_.get(key));
+            }
+        }
+    }
 
-
+    private List<String> ezSectionMaps = Lists.newArrayList(
+            "诊断名称=手术指征",
+            "量=羊水量(mL)",
+            "长度=新生儿出生身长(cm)",
+            "圈数=绕颈身(周)",
+            "宫缩剂用法=宫缩剂使用方法",
+            "手术用药名称=手术用药",
+            "术中出血量=出血量(mL)",
+            "补液量=输液量(mL)",
+            "脐带长度=脐带长度(cm)",
+            "分数=Apgar评分值"
+    );