Shi Kejing 4 years ago
parent
commit
e0bc474d0e

+ 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("查询失败");
        }
    }
}

+ 37 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -1361,4 +1361,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;
    }
}