Selaa lähdekoodia

智能手表处理

zdm 5 vuotta sitten
vanhempi
commit
7f48f9d0c6

+ 37 - 34
svr/svr-iot-sunnuo/src/main/java/com/yihu/iot/datainput/controller/IotAnalyzerController.java

@ -159,33 +159,34 @@ public class IotAnalyzerController extends EnvelopRestEndpoint {
    }
    @PostMapping(value = "/heartRate" /*,consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE*/)
    @PostMapping(value = "/heartRate")
    @ApiOperation(value = "柏颐心率数据接收", notes = "柏颐心率数据接收")
    public String heartRate(
            @ApiParam(name = "imei", value = "15位设备唯一序号")
            @RequestParam(value = "imei",required = true)String imei,
            @RequestParam(value = "imei",required = false)String imei,
            @ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS")
            @RequestParam(value = "time_begin",required = true)String time_begin,
            @RequestParam(value = "time_begin",required = false)String time_begin,
            @ApiParam(name = "heartrate", value = "心率")
            @RequestParam(value = "heartrate",required = true)int heartrate,
            @RequestParam(value = "heartrate",required = false)int heartrate,
            @ApiParam(name = "theshold_heartrate_h", value = "心率阈值上限")
            @RequestParam(value = "theshold_heartrate_h",required = true)int theshold_heartrate_h,
            @RequestParam(value = "theshold_heartrate_h",required = false)int theshold_heartrate_h,
            @ApiParam(name = "theshold_heartrate_l", value = "心率阈值下限")
            @RequestParam(value = "theshold_heartrate_l",required = true)int theshold_heartrate_l) throws Exception{
            @RequestParam(value = "theshold_heartrate_l",required = false)int theshold_heartrate_l) throws Exception{
        String strResult = "";
        Map res = new HashMap();
        IotDeviceBaiyiDO iotDeviceBaiyiDO=new IotDeviceBaiyiDO();
        iotDeviceBaiyiDO.setImei(imei);
        iotDeviceBaiyiDO.setType(1);
        iotDeviceBaiyiDO.setTimeBegin(time_begin);
        iotDeviceBaiyiDO.setValue1(heartrate);
        iotDeviceBaiyiDO.setValue2(theshold_heartrate_h);
        iotDeviceBaiyiDO.setValue3(theshold_heartrate_l);
        iotDeviceBaiyiDao.save(iotDeviceBaiyiDO);
        String info  = "imei="+imei+";time_begin="+time_begin+";heartrate="+heartrate+";theshold_heartrate_h="+theshold_heartrate_h+";theshold_heartrate_l="+theshold_heartrate_l;
        logger.info("info="+info);
        try {
            String info  = "imei="+imei+";time_begin="+time_begin+";heartrate="+heartrate+";theshold_heartrate_h="+theshold_heartrate_h+";theshold_heartrate_l="+theshold_heartrate_l;
            logger.info("info="+info);
            IotDeviceBaiyiDO iotDeviceBaiyiDO=new IotDeviceBaiyiDO();
            iotDeviceBaiyiDO.setImei(imei);
            iotDeviceBaiyiDO.setType(1);
            iotDeviceBaiyiDO.setTimeBegin(time_begin);
            iotDeviceBaiyiDO.setValue1(heartrate);
            iotDeviceBaiyiDO.setValue2(theshold_heartrate_h);
            iotDeviceBaiyiDO.setValue3(theshold_heartrate_l);
            iotDeviceBaiyiDao.save(iotDeviceBaiyiDO);
            return BaiyiDataParam(iotDeviceBaiyiDO);
//            return "";
        } catch (Exception e) {
            e.printStackTrace();
            res.put("statusCode", "03");
@ -196,36 +197,37 @@ public class IotAnalyzerController extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "/bloodPressure" /*,consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE*/)
    @PostMapping(value = "/bloodPressure")
    @ApiOperation(value = "柏颐血压数据接收", notes = "柏颐血压数据接收")
    public String bloodPressure(
            @ApiParam(name = "imei", value = "15位设备唯一序号", required = true)
            @RequestParam(value = "imei",required = true)String imei,
            @RequestParam(value = "imei",required = false)String imei,
            @ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS", required = true)
            @RequestParam(value = "time_begin",required = true)String time_begin,
            @RequestParam(value = "time_begin",required = false)String time_begin,
            @ApiParam(name = "dbp", value = "舒张压", required = true)
            @RequestParam(value = "dbp",required = true)int dbp,
            @RequestParam(value = "dbp",required = false)int dbp,
            @ApiParam(name = "dbp_l", value = "舒张压报警下限", required = true)
            @RequestParam(value = "dbp_l",required = true)int dbp_l,
            @RequestParam(value = "dbp_l",required = false)int dbp_l,
            @ApiParam(name = "sbp", value = "收缩压", required = true)
            @RequestParam(value = "sbp",required = true)int sbp,
            @RequestParam(value = "sbp",required = false)int sbp,
            @ApiParam(name = "sbp_h", value = "收缩压报警上限", required = true)
            @RequestParam(value = "sbp_h",required = true)int sbp_h) throws Exception{
            @RequestParam(value = "sbp_h",required = false)int sbp_h) throws Exception{
        String strResult = "";
        Map res = new HashMap();
        IotDeviceBaiyiDO iotDeviceBaiyiDO=new IotDeviceBaiyiDO();
        iotDeviceBaiyiDO.setImei(imei);
        iotDeviceBaiyiDO.setTimeBegin(time_begin);
        iotDeviceBaiyiDO.setType(2);
        iotDeviceBaiyiDO.setValue1(dbp);
        iotDeviceBaiyiDO.setValue2(dbp_l);
        iotDeviceBaiyiDO.setValue3(sbp);
        iotDeviceBaiyiDO.setValue4(sbp_h);
        iotDeviceBaiyiDao.save(iotDeviceBaiyiDO);
        String info= "imei="+imei+";time_begin="+time_begin+";dbp="+dbp+";dbp_l="+dbp_l+";sbp="+sbp+";sbp_h="+sbp_h;
        logger.info("info="+info);
        try {
            String info= "imei="+imei+";time_begin="+time_begin+";dbp="+dbp+";dbp_l="+dbp_l+";sbp="+sbp+";sbp_h="+sbp_h;
            logger.info("info="+info);
            IotDeviceBaiyiDO iotDeviceBaiyiDO=new IotDeviceBaiyiDO();
            iotDeviceBaiyiDO.setImei(imei);
            iotDeviceBaiyiDO.setTimeBegin(time_begin);
            iotDeviceBaiyiDO.setType(2);
            iotDeviceBaiyiDO.setValue1(dbp);
            iotDeviceBaiyiDO.setValue2(dbp_l);
            iotDeviceBaiyiDO.setValue3(sbp);
            iotDeviceBaiyiDO.setValue4(sbp_h);
            iotDeviceBaiyiDao.save(iotDeviceBaiyiDO);
            return BaiyiDataParam(iotDeviceBaiyiDO);
//            return "";
        } catch (Exception e) {
            e.printStackTrace();
            res.put("statusCode", "03");
@ -298,5 +300,6 @@ public class IotAnalyzerController extends EnvelopRestEndpoint {
        String strResult = objectMapper.writeValueAsString(res);
        logger.info(strResult);
        return strResult;
//      return "";
    }
}