Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

liubing 3 years ago
parent
commit
a7ee80f825

+ 24 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/DetectionPlatformService.java

@ -19,6 +19,7 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import io.swagger.models.auth.In;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -218,6 +219,15 @@ public class DetectionPlatformService  {
//        if (StringUtils.isNotBlank(user)) {
//            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));
        //首页默认根据居民展示  绑定设备的居民
//        String userSql = "SELECT `user` FROM wlyy_patient_device WHERE del = 0 GROUP BY `user`";
@ -238,9 +248,15 @@ public class DetectionPlatformService  {
                    if (deviceList.size() > 1) {    //居民绑定多台设备
                        for (int j=0;j<deviceList.size();j++) {
                            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("categoryCode",deviceList.get(j).getCategoryCode());
                            if(devcieMap.containsKey(deviceSn)){
                                obj.put("contactStatus",1);
                            }else{
                                obj.put("contactStatus",0);
                            }
                            array.add(obj);
                        }
                        userObj.put("deviceCount",deviceList.size());
@ -249,9 +265,15 @@ public class DetectionPlatformService  {
                    } else {    //居民只绑定一台设备
                        for (int j=0;j<deviceList.size();j++) {
                            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("categoryCode",deviceList.get(j).getCategoryCode());
                            if(devcieMap.containsKey(deviceSn)){
                                obj.put("contactStatus",1);
                            }else{
                                obj.put("contactStatus",0);
                            }
                            array.add(obj);
                        }
                        userObj.put("deviceCount",deviceList.size());