|  |  | @ -37,6 +37,8 @@ public class TRecordServiceImpl implements ITRecordService | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     private static Map<String, JSONObject> jsonKeyMap = new HashMap<>(); |  |  |  |     private static Map<String, JSONObject> jsonKeyMap = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private static int index = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     private static Map<String, String> newJsonKeyMap = new HashMap<String, String>(){{ |  |  |  |     private static Map<String, String> newJsonKeyMap = new HashMap<String, String>(){{ | 
			
		
	
		
		
			
				
					
					|  |  |  |         put("sx_vein_color", "sx_vein_color2"); |  |  |  |         put("sx_vein_color", "sx_vein_color2"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         put("sz_color", "sz_color2"); |  |  |  |         put("sz_color", "sz_color2"); | 
			
		
	
	
		
		
			
				
					|  |  | @ -67,24 +69,13 @@ public class TRecordServiceImpl implements ITRecordService | 
			
		
	
		
		
			
				
					
					|  |  |  |     }}; |  |  |  |     }}; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 只需要获取量化值的key |  |  |  |      * 需要获取量化值的key | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     private static final List<String> getQuantificationKeys = new ArrayList<String>(){{ |  |  |  |     private static final List<String> getQuantificationKeys = new ArrayList<String>(){{ | 
			
		
	
		
		
			
				
					
					|  |  |  |         add("sx_vein_width"); |  |  |  |         add("sx_vein_width"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         add("sx_vein_length"); |  |  |  |         add("sx_vein_length"); | 
			
		
	
		
		
			
				
					
					|  |  |  |     }}; |  |  |  |     }}; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 需要追加量化值的keys |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     private static final List<String> addQuantificationKeys = new ArrayList<String>(){{ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         add("sz_pangshou"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         add("st_houbo"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         add("st_funi"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         add("st_runzao"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         add("st_cao"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     }}; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Autowired |  |  |  |     @Autowired | 
			
		
	
		
		
			
				
					
					|  |  |  |     private TRecordMapper tRecordMapper; |  |  |  |     private TRecordMapper tRecordMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -203,6 +194,7 @@ public class TRecordServiceImpl implements ITRecordService | 
			
		
	
		
		
			
				
					
					|  |  |  |             return ""; |  |  |  |             return ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         // 将老数据结构对应的数据读出来
 |  |  |  |         // 将老数据结构对应的数据读出来
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         jsonKeyMap.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         JSONObject jsonObject = JSONObject.parseObject(jsonString); |  |  |  |         JSONObject jsonObject = JSONObject.parseObject(jsonString); | 
			
		
	
		
		
			
				
					
					|  |  |  |         readJsonToMap(jsonObject.getJSONObject("data")); |  |  |  |         readJsonToMap(jsonObject.getJSONObject("data")); | 
			
		
	
		
		
			
				
					
					|  |  |  |         logger.info("jsonKeyMap is {}", jsonKeyMap); |  |  |  |         logger.info("jsonKeyMap is {}", jsonKeyMap); | 
			
		
	
	
		
		
			
				
					|  |  | @ -295,11 +287,11 @@ public class TRecordServiceImpl implements ITRecordService | 
			
		
	
		
		
			
				
					
					|  |  |  |     { |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |         logger.info("get history list param is : {} ", tRecord); |  |  |  |         logger.info("get history list param is : {} ", tRecord); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<TRecord> tRecords = tRecordMapper.selectTRecordList(tRecord); |  |  |  |         List<TRecord> tRecords = tRecordMapper.selectTRecordList(tRecord); | 
			
		
	
		
		
			
				
					
					|  |  |  |         tRecords.removeIf(o->"0".equals(o.getStatus())); |  |  |  |         List<TRecord> collect = tRecords.stream().filter(tRecord1 -> "1".equals(tRecord1.getStatus())).collect(Collectors.toList()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if (CollectionUtils.isEmpty(tRecords)){ |  |  |  |         if (CollectionUtils.isEmpty(collect)){ | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             return AjaxResult.success(); |  |  |  |             return AjaxResult.success(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<TRecord> records = tRecords.stream().sorted(Comparator.comparing(TRecord::getCreateTime)).collect(Collectors.toList()); |  |  |  |         List<TRecord> records = collect.stream().sorted(Comparator.comparing(TRecord::getCreateTime)).collect(Collectors.toList()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         RecordHistoryDataResp recordHistoryDataRespMap = getDataList(records); |  |  |  |         RecordHistoryDataResp recordHistoryDataRespMap = getDataList(records); | 
			
		
	
		
		
			
				
					
					|  |  |  |         return AjaxResult.success(recordHistoryDataRespMap); |  |  |  |         return AjaxResult.success(recordHistoryDataRespMap); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -328,17 +320,20 @@ public class TRecordServiceImpl implements ITRecordService | 
			
		
	
		
		
			
				
					
					|  |  |  |         }).filter(Objects::nonNull).collect(Collectors.toList()); |  |  |  |         }).filter(Objects::nonNull).collect(Collectors.toList()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (!CollectionUtils.isEmpty(result)){ |  |  |  |         if (!CollectionUtils.isEmpty(result)){ | 
			
		
	
		
		
			
				
					
					|  |  |  |             HashMap<String, ArrayList<Object>> map = new HashMap<>(); |  |  |  |             HashMap<String, ArrayList<Object>> map = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             result.forEach(jsonObject -> { |  |  |  |             for (int i = 0; i < result.size(); i++) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 getJsonData(jsonObject.getJSONObject("data"), "data", map, ignoreKeys); |  |  |  |                 index = i + 1; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 logger.info("history map is {} ", map); |  |  |  |                 getJsonData(result.get(i).getJSONObject("data"), "data", map, ignoreKeys); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 map.forEach((key, value) -> { |  |  |  |                 map.forEach((key, value) -> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (value.size() < result.indexOf(jsonObject) + 1) { |  |  |  |                     // 向后插入
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (value.size() < index) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         value.add("-1"); |  |  |  |                         value.add("-1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 }); |  |  |  |                 }); | 
			
		
	
		
		
			
				
					
					|  |  |  |             }); |  |  |  |                 logger.info("index is '{}', history map is '{}' ", index,  map); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             recordHistoryDataResp.setHistoryDataMap(map); |  |  |  |             recordHistoryDataResp.setHistoryDataMap(map); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         index = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |         return recordHistoryDataResp; |  |  |  |         return recordHistoryDataResp; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -358,7 +353,7 @@ public class TRecordServiceImpl implements ITRecordService | 
			
		
	
		
		
			
				
					
					|  |  |  |             // 这两种情况应该添加默认值
 |  |  |  |             // 这两种情况应该添加默认值
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (nullValKeys.contains(listName) && null == ((JSONObject) obj).get("v")) { |  |  |  |             if (nullValKeys.contains(listName) && null == ((JSONObject) obj).get("v")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 // 加默认值
 |  |  |  |                 // 加默认值
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 doSetHistoryData(historyDataMap, listName, "0"); |  |  |  |                 doSetHistoryData(historyDataMap, listName, "-1"); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (Map.Entry<String, Object> entry : ((JSONObject) obj).entrySet()) { |  |  |  |             for (Map.Entry<String, Object> entry : ((JSONObject) obj).entrySet()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 // 忽略带图片字段
 |  |  |  |                 // 忽略带图片字段
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -378,11 +373,6 @@ public class TRecordServiceImpl implements ITRecordService | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (!getQuantificationKeys.contains(listName) && "v".equals(entry.getKey())) { |  |  |  |                     if (!getQuantificationKeys.contains(listName) && "v".equals(entry.getKey())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         doSetHistoryData(historyDataMap, listName, entry.getValue()); |  |  |  |                         doSetHistoryData(historyDataMap, listName, entry.getValue()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     // 追加量化值数据
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (addQuantificationKeys.contains(listName) && "quantification".equals(entry.getKey())) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         String newListName = listName + "_q"; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         doSetHistoryData(historyDataMap, newListName, entry.getValue()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
	
		
		
			
				
					|  |  | @ -402,6 +392,12 @@ public class TRecordServiceImpl implements ITRecordService | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             list = historyDataMap.get(listName); |  |  |  |             list = historyDataMap.get(listName); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         // 判断是否需要向前补数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if ((list.size() + 1) < index) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (int i = 0; i < index - list.size(); i++) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 list.add(0, "-1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         list.add(StringUtils.isNull(val) || StringUtils.isEmpty(val.toString()) ? "-1" : val); |  |  |  |         list.add(StringUtils.isNull(val) || StringUtils.isEmpty(val.toString()) ? "-1" : val); | 
			
		
	
		
		
			
				
					
					|  |  |  |         historyDataMap.put(listName, list); |  |  |  |         historyDataMap.put(listName, list); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |