|
@ -15,6 +15,7 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import io.swagger.models.auth.In;
|
|
import io.swagger.models.auth.In;
|
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@ -209,6 +210,15 @@ public class DetectionPlatformService {
|
|
// if (StringUtils.isNotBlank(user)) {
|
|
// if (StringUtils.isNotBlank(user)) {
|
|
// patientDOS = patientDao.findAllByDelAndId(user); //user != null 根据居民查询
|
|
// patientDOS = patientDao.findAllByDelAndId(user); //user != null 根据居民查询
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
//查找所有在线的设备
|
|
|
|
String sqlDevice = "SELECT device_code from wlyy_devices where contact_status =1";
|
|
|
|
List<String> deviceStr = jdbcTemplate.queryForList(sqlDevice,String.class);
|
|
|
|
Map<String,Object> devcieMap = new HashedMap();
|
|
|
|
for (String str:deviceStr){
|
|
|
|
devcieMap.put(str,str);
|
|
|
|
}
|
|
|
|
|
|
Map<String, List<BasePatientDO>> byId = patientDOS.stream().collect(Collectors.groupingBy(BasePatientDO::getId));
|
|
Map<String, List<BasePatientDO>> byId = patientDOS.stream().collect(Collectors.groupingBy(BasePatientDO::getId));
|
|
//首页默认根据居民展示 绑定设备的居民
|
|
//首页默认根据居民展示 绑定设备的居民
|
|
// String userSql = "SELECT `user` FROM wlyy_patient_device WHERE del = 0 GROUP BY `user`";
|
|
// String userSql = "SELECT `user` FROM wlyy_patient_device WHERE del = 0 GROUP BY `user`";
|
|
@ -229,9 +239,15 @@ public class DetectionPlatformService {
|
|
if (deviceList.size() > 1) { //居民绑定多台设备
|
|
if (deviceList.size() > 1) { //居民绑定多台设备
|
|
for (int j=0;j<deviceList.size();j++) {
|
|
for (int j=0;j<deviceList.size();j++) {
|
|
JSONObject obj = new JSONObject();
|
|
JSONObject obj = new JSONObject();
|
|
obj.put("deviceSn",deviceList.get(j).getDeviceSn());
|
|
|
|
|
|
String deviceSn = deviceList.get(j).getDeviceSn();
|
|
|
|
obj.put("deviceSn",deviceSn);
|
|
obj.put("deviceName",deviceList.get(j).getDeviceName());
|
|
obj.put("deviceName",deviceList.get(j).getDeviceName());
|
|
obj.put("categoryCode",deviceList.get(j).getCategoryCode());
|
|
obj.put("categoryCode",deviceList.get(j).getCategoryCode());
|
|
|
|
if(devcieMap.containsKey(deviceSn)){
|
|
|
|
obj.put("contactStatus",1);
|
|
|
|
}else{
|
|
|
|
obj.put("contactStatus",0);
|
|
|
|
}
|
|
array.add(obj);
|
|
array.add(obj);
|
|
}
|
|
}
|
|
userObj.put("deviceCount",deviceList.size());
|
|
userObj.put("deviceCount",deviceList.size());
|
|
@ -240,9 +256,15 @@ public class DetectionPlatformService {
|
|
} else { //居民只绑定一台设备
|
|
} else { //居民只绑定一台设备
|
|
for (int j=0;j<deviceList.size();j++) {
|
|
for (int j=0;j<deviceList.size();j++) {
|
|
JSONObject obj = new JSONObject();
|
|
JSONObject obj = new JSONObject();
|
|
obj.put("deviceSn",deviceList.get(j).getDeviceSn());
|
|
|
|
|
|
String deviceSn = deviceList.get(j).getDeviceSn();
|
|
|
|
obj.put("deviceSn",deviceSn);
|
|
obj.put("deviceName",deviceList.get(j).getDeviceName());
|
|
obj.put("deviceName",deviceList.get(j).getDeviceName());
|
|
obj.put("categoryCode",deviceList.get(j).getCategoryCode());
|
|
obj.put("categoryCode",deviceList.get(j).getCategoryCode());
|
|
|
|
if(devcieMap.containsKey(deviceSn)){
|
|
|
|
obj.put("contactStatus",1);
|
|
|
|
}else{
|
|
|
|
obj.put("contactStatus",0);
|
|
|
|
}
|
|
array.add(obj);
|
|
array.add(obj);
|
|
}
|
|
}
|
|
userObj.put("deviceCount",deviceList.size());
|
|
userObj.put("deviceCount",deviceList.size());
|