|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONException;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
import com.ruoyi.system.domain.TPatientHospitalDoctor;
|
|
|
|
@ -147,9 +145,13 @@ public class TRecordServiceImpl implements ITRecordService
|
|
|
|
|
}
|
|
|
|
|
List<TRecord> records = tRecords.stream().sorted(Comparator.comparing(TRecord::getCreateTime)).collect(Collectors.toList());
|
|
|
|
|
List<String> jsonKeyList = new ArrayList<String>(){{
|
|
|
|
|
add("shemian-img_sz");
|
|
|
|
|
add("img_sz");
|
|
|
|
|
add("img_sz_yudian");
|
|
|
|
|
add("img_sz_yuban");
|
|
|
|
|
add("img_sz_liewen");
|
|
|
|
|
add("img_st");
|
|
|
|
|
add("img_sx");
|
|
|
|
|
add("img_sx_vein");
|
|
|
|
|
}};
|
|
|
|
|
RecordHistoryDataResp recordHistoryDataRespMap = getDataList(records,jsonKeyList);
|
|
|
|
|
return AjaxResult.success(recordHistoryDataRespMap);
|
|
|
|
@ -171,35 +173,47 @@ public class TRecordServiceImpl implements ITRecordService
|
|
|
|
|
return jsonObject;
|
|
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
|
if (!CollectionUtils.isEmpty(result)){
|
|
|
|
|
List<Integer> shezhiList = new LinkedList<>();
|
|
|
|
|
List<Integer> shetaiList = new LinkedList<>();
|
|
|
|
|
List<Integer> shexiaList = new LinkedList<>();
|
|
|
|
|
String[] keys0 = jsonKeyList.get(0).split("-");
|
|
|
|
|
String key1 = jsonKeyList.get(1);
|
|
|
|
|
String key2 = jsonKeyList.get(2);
|
|
|
|
|
HashMap<String, ArrayList<String>> map = new HashMap<>();
|
|
|
|
|
result.forEach(jsonObject -> {
|
|
|
|
|
Integer value1 ;
|
|
|
|
|
Integer value2 ;
|
|
|
|
|
Integer value3 ;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
value1 = jsonObject.getJSONObject("data").getJSONObject("shezhi").getJSONObject(keys0[0]).getJSONObject(keys0[1]).getInteger("anomaly");
|
|
|
|
|
value2 = jsonObject.getJSONObject("data").getJSONObject("shetai").getJSONObject(key1).getInteger("anomaly");
|
|
|
|
|
value3 = jsonObject.getJSONObject("data").getJSONObject("shexia").getJSONObject(key2).getInteger("anomaly");
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
throw new ServiceException("JSON格式错误");
|
|
|
|
|
}
|
|
|
|
|
shezhiList.add(value1);
|
|
|
|
|
shetaiList.add(value2);
|
|
|
|
|
shexiaList.add(value3);
|
|
|
|
|
getJsonData(jsonObject.getJSONObject("data"), "data", map, jsonKeyList);
|
|
|
|
|
});
|
|
|
|
|
recordHistoryDataResp.setShezhiList(shezhiList);
|
|
|
|
|
recordHistoryDataResp.setShetaiList(shetaiList);
|
|
|
|
|
recordHistoryDataResp.setShexiaList(shexiaList);
|
|
|
|
|
recordHistoryDataResp.setHistoryDataMap(map);
|
|
|
|
|
}
|
|
|
|
|
return recordHistoryDataResp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 得到json关键字
|
|
|
|
|
*
|
|
|
|
|
* @param obj obj
|
|
|
|
|
* @param listName 列表名称
|
|
|
|
|
* @param historyDataMap 历史数据
|
|
|
|
|
* @param removeKeyList 删除键列表
|
|
|
|
|
*/
|
|
|
|
|
private static void getJsonData(Object obj, String listName, HashMap<String, ArrayList<String>> historyDataMap, List<String> removeKeyList) {
|
|
|
|
|
// aiResult结果集中只包括JSONObject,不包括JSONArray
|
|
|
|
|
if (obj instanceof JSONObject) {
|
|
|
|
|
for (Map.Entry<String, Object> entry : ((JSONObject) obj).entrySet()) {
|
|
|
|
|
if (!(entry.getValue() instanceof String)) {
|
|
|
|
|
getJsonData(entry.getValue(), entry.getKey(), historyDataMap, removeKeyList);
|
|
|
|
|
} else {
|
|
|
|
|
// 去除
|
|
|
|
|
if (removeKeyList.contains(listName)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
ArrayList<String> list;
|
|
|
|
|
if (null == historyDataMap.get(listName)) {
|
|
|
|
|
list = new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
list = historyDataMap.get(listName);
|
|
|
|
|
}
|
|
|
|
|
list.add((String) entry.getValue());
|
|
|
|
|
historyDataMap.put(listName, list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询医生诊断次数
|
|
|
|
|
*
|
|
|
|
|