Browse Source

大屏接口

Shi Kejing 3 years ago
parent
commit
68498cb183

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/DetectionPlatformEndpoint.java

@ -55,6 +55,17 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getRealTimeData")
    @ApiOperation(value = "实时数据")
    public ObjEnvelop getRealTimeData(){
        try {
            JSONObject o = platformService.getRealTimeData();
            return success(o);
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "getDeviceType")
    @ApiOperation(value = "设备类型")
    public ListEnvelop getDeviceType(){

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

@ -120,17 +120,33 @@ public class DetectionPlatformService  {
        object.put("lawOfIOT",getRange( (securityIsUser.intValue() + healthIsUser.intValue() ),( securityAllCount.intValue() + healthAllCount.intValue()  ) ));//物联率
        object.put("isUseAllIot",(securityIsUser.intValue() + healthIsUser.intValue()));//已发放设备
        object.put("allIot",securityAllCount.intValue() + healthAllCount.intValue());//总设备
//        String unUseSql = "";//连续一周为上传数据
//        List<Map<String , Object>> unUseList = jdbcTemplate.queryForList(unUseSql);
//        Long unUseCount = (Long) securityList.get(0).get("allCount");
////        if (unUseList.size() > 0){
////            unUseCount = (Long) securityList.get(0).get("allCount");
////        }
//        object.put("lostLaw",getRange(unUseCount.intValue(),securityIsUser.intValue() + healthIsUser.intValue()));//设备失联率
        object.put("lostLaw","0%");//设备失联率
        String unUseSql = "SELECT * FROM wlyy_devices WHERE is_binding = 1 AND contact_status = 0";//contact_status = 0   失联
        List<Map<String , Object>> unUseList = jdbcTemplate.queryForList(unUseSql);
        int unUseCount = unUseList.size();
        object.put("unUseCount",unUseCount);//设备失联数量
        object.put("lostLaw",getRange(unUseCount,(securityIsUser.intValue() + healthIsUser.intValue())));//设备失联率    失联设备/已发放设备
        return object;
    }
    public JSONObject getRealTimeData(){
        JSONObject object = new JSONObject();
        String getMonitorPhysicalSignsSql = "SELECT COUNT(1) FROM wlyy_patient_health_index WHERE (type = 1 or type = 2) AND del = 1";
        Integer getMonitorPhysicalSignsCount = jdbcTemplate.queryForObject(getMonitorPhysicalSignsSql,Integer.class);
        object.put("getMonitorPhysicalSignsCount",getMonitorPhysicalSignsCount);      //监测体征
        String getAbnormalSignsSql = "SELECT COUNT(1) FROM wlyy_patient_health_index WHERE (type = 1 or type = 2) AND del = 1 AND status = 1";
        Integer getAbnormalSignsCount = jdbcTemplate.queryForObject(getAbnormalSignsSql,Integer.class);
        object.put("getAbnormalSignsCount",getAbnormalSignsCount);      //异常体征
        String getGiveEarlyWarningSql = "SELECT COUNT(1) FROM base_security_monitoring_order";
        Integer getGiveEarlyWarningCount = jdbcTemplate.queryForObject(getGiveEarlyWarningSql,Integer.class);
        object.put("getGiveEarlyWarningCount",getGiveEarlyWarningCount);      //预警次数
        String getBaseDeviceHealthIndexSql = "SELECT COUNT(1) FROM base_device_health_index";  //烟感气感数据上传次数
        Integer getBaseDeviceHealthIndexCount = jdbcTemplate.queryForObject(getBaseDeviceHealthIndexSql,Integer.class);
        String getBaseYxdeviceIndexSql = "SELECT COUNT(1) FROM base_yxdevice_index";    //拐杖数据上传
        Integer getBaseYxdeviceIndexCount = jdbcTemplate.queryForObject(getBaseYxdeviceIndexSql,Integer.class);
        Integer getExamineIndexSum = getGiveEarlyWarningCount + getBaseDeviceHealthIndexCount + getBaseYxdeviceIndexCount;
        object.put("getExamineIndexSum",getExamineIndexSum);      //监测指标
        return object;
    }
    public String getRange(int first, int second) {
        if (second == 0 && first > 0) {