查询患者历史数据图表返回值错乱修复

master
gongzhenkun 2 years ago
parent dbeeddbd5d
commit e2870a44c3

@ -9,20 +9,20 @@ public class RecordHistoryDataResp
private List<Integer> shexiaList; private List<Integer> shexiaList;
private List<Date> dateList; private List<Date> dateList;
private HashMap<String, ArrayList<String>> historyDataMap; private HashMap<String, ArrayList<Object>> historyDataMap;
public RecordHistoryDataResp() public HashMap<String, ArrayList<Object>> getHistoryDataMap() {
{
}
public HashMap<String, ArrayList<String>> getHistoryDataMap() {
return historyDataMap; return historyDataMap;
} }
public void setHistoryDataMap(HashMap<String, ArrayList<String>> historyDataMap) { public void setHistoryDataMap(HashMap<String, ArrayList<Object>> historyDataMap) {
this.historyDataMap = historyDataMap; this.historyDataMap = historyDataMap;
} }
public RecordHistoryDataResp()
{
}
public List<Integer> getShezhiList() public List<Integer> getShezhiList()
{ {
return shezhiList; return shezhiList;

@ -178,7 +178,7 @@ public class TRecordServiceImpl implements ITRecordService
return jsonObject; return jsonObject;
}).filter(Objects::nonNull).collect(Collectors.toList()); }).filter(Objects::nonNull).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(result)){ if (!CollectionUtils.isEmpty(result)){
HashMap<String, ArrayList<String>> map = new HashMap<>(); HashMap<String, ArrayList<Object>> map = new HashMap<>();
result.forEach(jsonObject -> { result.forEach(jsonObject -> {
getJsonData(jsonObject.getJSONObject("data"), "data", map, jsonKeyList); getJsonData(jsonObject.getJSONObject("data"), "data", map, jsonKeyList);
}); });
@ -195,24 +195,29 @@ public class TRecordServiceImpl implements ITRecordService
* @param historyDataMap * @param historyDataMap
* @param removeKeyList * @param removeKeyList
*/ */
private static void getJsonData(Object obj, String listName, HashMap<String, ArrayList<String>> historyDataMap, List<String> removeKeyList) { private static void getJsonData(Object obj, String listName, HashMap<String, ArrayList<Object>> historyDataMap, List<String> removeKeyList) {
// aiResult结果集中只包括JSONObject,不包括JSONArray // aiResult结果集中只包括JSONObject,不包括JSONArray
if (obj instanceof JSONObject) { if (obj instanceof JSONObject) {
for (Map.Entry<String, Object> entry : ((JSONObject) obj).entrySet()) { for (Map.Entry<String, Object> entry : ((JSONObject) obj).entrySet()) {
if (!(entry.getValue() instanceof String)) { if ((entry.getValue() instanceof JSONObject)) {
getJsonData(entry.getValue(), entry.getKey(), historyDataMap, removeKeyList); getJsonData(entry.getValue(), entry.getKey(), historyDataMap, removeKeyList);
} else { } else {
// 去除 // 去除带图片字段
if (removeKeyList.contains(listName)) { if (removeKeyList.contains(listName)) {
continue; continue;
} }
ArrayList<String> list; //sz_avg_purple: { "anomaly": 0, "v": "正常" }
// anomaly属于预留字段暂时无用; 各个任务中的字段v是任务实际值
if (!"v".equals(entry.getKey())) {
continue;
}
ArrayList<Object> list;
if (null == historyDataMap.get(listName)) { if (null == historyDataMap.get(listName)) {
list = new ArrayList<>(); list = new ArrayList<>();
} else { } else {
list = historyDataMap.get(listName); list = historyDataMap.get(listName);
} }
list.add((String) entry.getValue()); list.add(entry.getValue());
historyDataMap.put(listName, list); historyDataMap.put(listName, list);
} }
} }

Loading…
Cancel
Save