Quellcode durchsuchen

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

wangzhinan vor 4 Jahren
Ursprung
Commit
0c2d8fb188

+ 11 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java

@ -803,4 +803,15 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
        return success(monitorPlatformService.getBrandsDetail(deviceType));
    }
    @RequestMapping(value="/getDeviceData", method = RequestMethod.GET)
    @ApiOperation("物联网大屏实时动态设备")
    public Envelop getDeviceData(){
        try {
            return success(monitorPlatformService.getDeviceData());
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
}

+ 53 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -17,7 +17,6 @@ import com.yihu.jw.entity.iot.equipment.IotEquipmentDetailDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.http.HttpClientUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.util.Json;
import iot.device.LocationDataVO;
import org.apache.http.Consts;
import org.apache.http.client.utils.URLEncodedUtils;
@ -1155,6 +1154,19 @@ public class MonitorPlatformService  {
                    if ("0".equals(showLevel)){
                        obj.put("device_name","单体征测量仪");
                        obj.put("Subdivision",true);//是否可查看下一层次
                        StringBuffer sqlTmp = new StringBuffer("select code from xmiot.iot_system_dict where dict_name='DEVICE_TYPE' and `code` in ('");
                        sqlTmp.append(deviceType.replace(",","','")).append("') ");
                        sqlTmp.append("and del=1 and parent_code \n" +
                                "in(select id from xmiot.iot_system_dict where dict_name='DEVICE' and `value`='单体征测量仪' and del=1)");
                        List<String> list = jdbcTemplate.queryForList(sqlTmp.toString(),String.class);
                        sqlTmp = new StringBuffer();
                        for (String s:list){
                            sqlTmp.append(","+s);
                        }
                        if (list.size()!=0){
                            sqlTmp.deleteCharAt(0);
                        }
                        obj.put("type",sqlTmp.toString());
                    }
                    else if("1".equals(showLevel)){
                        String temp = obj.getString("type");
@ -1168,6 +1180,7 @@ public class MonitorPlatformService  {
                    else{
                        obj.put("Subdivision",false);
                    }
                    obj.put("showLevel",Integer.parseInt(showLevel));
                }
                result.put("deviceInfo",arr);//设备信息统计
                //统计物联率设备,失联设备
@ -1208,6 +1221,7 @@ public class MonitorPlatformService  {
                    tmp.put("device_name","健康小屋");
                    tmp.put("Subdivision",false);
                }
                tmp.put("showLevel",Integer.parseInt(showLevel));
                result.getJSONArray("deviceInfo").add(tmp);
                result.put("grantCount",result.getInteger("grantCount")+count);
                //统计健康小屋数据/ 小屋全部统计为正常使用
@ -1242,7 +1256,7 @@ public class MonitorPlatformService  {
        float size = (float) (first * 100) / second;
        DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0
        String filesize = df.format(size);
        return filesize + "%";
        return filesize;
    }
    /**
@ -1362,4 +1376,41 @@ public class MonitorPlatformService  {
            return null;
        }
    }
    public JSONObject getDeviceData(){
        JSONObject object = new JSONObject();
        //血糖仪数量
        String bloodGlucosemeterCount = "SELECT COUNT(1) FROM wlyy.wlyy_patient_device WHERE category_code = 1 AND del = 0";
        //血压计数量
        String sphygmomanometerCount = "SELECT COUNT(1) FROM wlyy.wlyy_patient_device WHERE category_code = 2 AND del = 0";
        Integer aa = jdbcTemplate.queryForObject(bloodGlucosemeterCount,Integer.class);
        Integer bb = jdbcTemplate.queryForObject(sphygmomanometerCount,Integer.class);
        object.put("homeHealthEquipment",aa+bb);
        //血糖仪 血压计 体征数据
        String physicalSignData = "SELECT count(1) from wlyy.wlyy_sign_family s,wlyy.wlyy_patient_device d, device.wlyy_patient_health_index p WHERE s.`status`>0 \n" +
                "and d.`user` = s.patient and p.`user`=d.`user` and p.del=1 and (p.type=1 or p.type=2)";
        Integer cc = jdbcTemplate.queryForObject(physicalSignData,Integer.class);
        object.put("homePhysicalSignData",cc);
        //异常数据
        String abnormalPhysicalSignData = "SELECT count(1) from wlyy.wlyy_sign_family s,wlyy.wlyy_patient_device d,device.wlyy_patient_health_index p WHERE s.`status`>0 \n" +
                "and d.`user` = s.patient and p.`user`=d.`user` and p.`status`=1 and p.del=1 and (p.type=1 or p.type=2)";
        Integer dd = jdbcTemplate.queryForObject(abnormalPhysicalSignData,Integer.class);
        object.put("homeAbnormalSignData",dd);
        //小屋数量
        String cabinCount = "SELECT COUNT(1) FROM xmiot.iot_equipmet_detail";
        Integer ee = jdbcTemplate.queryForObject(cabinCount,Integer.class);
        object.put("medicalInstitutionIquipment",ee);
        //小屋体征数据
        String cabinSignData = "SELECT count(1) from wlyy.wlyy_sign_family s,wlyy.wlyy_patient_device d, device.wlyy_patient_health_index p WHERE s.`status`>0 \n" +
                "and d.`user` = s.patient and p.`user`=d.`user` and p.del=1 and p.type>2";
        Integer ff = jdbcTemplate.queryForObject(cabinSignData,Integer.class);
        object.put("medicalPhysicalSignData",ff);
        //小屋异常体征数据
        String abnormalSignDataOfCabin = "SELECT count(1) from wlyy.wlyy_sign_family s,wlyy.wlyy_patient_device d,device.wlyy_patient_health_index p WHERE s.`status`>0 \n" +
                "and d.`user` = s.patient and p.`user`=d.`user` and p.`status`=1 and p.del=1 and p.type>2";
        Integer gg = jdbcTemplate.queryForObject(abnormalSignDataOfCabin,Integer.class);
        object.put("medicalAbnormalSignData",gg);
        return object;
    }
}