|
@ -169,6 +169,7 @@ public class DetectionPlatformService {
|
|
|
|
|
|
public JSONArray getDeviceByCondition(String categoryCode , String user){
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
JSONArray arrayAll = new JSONArray();
|
|
|
List<DevicePatientDevice> patientDevices = patientDeviceDao.findAllGroupUser();
|
|
|
if (StringUtils.isNotBlank(categoryCode)) { //categoryCode != null 根据设备类型查询
|
|
|
patientDevices = patientDeviceDao.findAllByCategoryCode(categoryCode);
|
|
@ -187,7 +188,6 @@ public class DetectionPlatformService {
|
|
|
// List<Map<String , Object>> userList = jdbcTemplate.queryForList(userSql);
|
|
|
if (patientDevices.size() > 0) {
|
|
|
for (int i=0;i<patientDevices.size();i++) {
|
|
|
JSONArray arrayAll = new JSONArray();
|
|
|
JSONArray array = new JSONArray();
|
|
|
JSONObject userObj = new JSONObject();
|
|
|
userObj.put("patient",patientDevices.get(i).getUser());
|
|
@ -222,13 +222,12 @@ public class DetectionPlatformService {
|
|
|
userObj.put("deviceInfo",array);
|
|
|
arrayAll.add(userObj);
|
|
|
}
|
|
|
jsonArray.add(arrayAll);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
return jsonArray;
|
|
|
return arrayAll;
|
|
|
}
|
|
|
return jsonArray;
|
|
|
return arrayAll;
|
|
|
}
|
|
|
|
|
|
public JSONObject getDeviceInfo(String deviceSn) throws Exception{
|
|
@ -252,8 +251,10 @@ public class DetectionPlatformService {
|
|
|
object.put("idcard",patientInfoList.get(0).get("idcard"));
|
|
|
object.put("address",patientInfoList.get(0).get("address"));
|
|
|
String dataSql= "";
|
|
|
String recordSql = "";
|
|
|
List<Map<String , Object>> dataList = new ArrayList<>();
|
|
|
switch (categoryCode) {
|
|
|
List<Map<String , Object>> recordList = new ArrayList<>();
|
|
|
switch (categoryCode) { //设备数据
|
|
|
// 1=血糖仪 2=血压计 14=燃气报警器 15=烟雾报警器
|
|
|
// 4=智能手表 7=居家安全报警器 16=智能拐杖 13=智能床带/睡眠带
|
|
|
case "1" :
|
|
@ -270,11 +271,17 @@ public class DetectionPlatformService {
|
|
|
dataSql = "SELECT record_time recordDate,`value`,unit,device_type FROM base_device_health_index WHERE device_sn = '"+deviceSn+"' ORDER BY record_time DESC LIMIT 10 ";
|
|
|
dataList = jdbcTemplate.queryForList(dataSql);
|
|
|
object.put("data",dataList);
|
|
|
recordSql = "SELECT * FROM base_device_health_index WHERE device_sn = '"+deviceSn+"' order by record_time desc ";
|
|
|
recordList = jdbcTemplate.queryForList(recordSql);
|
|
|
object.put("record",recordList);
|
|
|
break;
|
|
|
case "15" :
|
|
|
dataSql = "SELECT record_time recordDate,`value`,unit,device_type FROM base_device_health_index WHERE device_sn = '"+deviceSn+"' ORDER BY record_time DESC LIMIT 10 ";
|
|
|
dataList = jdbcTemplate.queryForList(dataSql);
|
|
|
object.put("data",dataList);
|
|
|
recordSql = "SELECT * FROM base_device_health_index WHERE device_sn = '"+deviceSn+"' order by record_time desc ";
|
|
|
recordList = jdbcTemplate.queryForList(recordSql);
|
|
|
object.put("record",recordList);
|
|
|
break;
|
|
|
}
|
|
|
} else {
|