Sfoglia il codice sorgente

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

liubing 4 anni fa
parent
commit
96e6dd36e0

+ 48 - 40
svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java

@ -950,68 +950,76 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
                // 实时数据
                List<Map<String, Object>> realtimeDateDo = monitorPlatformService.getRealtimeDateByPatient(patient,date);
                if (realtimeDateDo.size() > 0){
                    Map<String,Object> map = realtimeDateDo.get(0);
                    json.put("realtimehr",map.get("hr")); //实时心率
                    json.put("realtimest",map.get("st")); //实时步数,采集开始后的累积步数
                    json.put("realtimecal",map.get("cal")); //实时卡路里,累积卡路里
                    json.put("realtime",realtimeDateDo.get(0)); //实时心率
//                    Map<String,Object> map = realtimeDateDo.get(0);
//                    json.put("realtimehr",map.get("hr")); //实时心率
//                    json.put("realtimest",map.get("st")); //实时步数,采集开始后的累积步数
//                    json.put("realtimecal",map.get("cal")); //实时卡路里,累积卡路里
                }else {
                    json.put("realtimehr",0); //实时心率
                    json.put("realtimest",0); //实时步数,采集开始后的累积步数
                    json.put("realtimecal",0); //实时卡路里,累积卡路里
                    json.put("realtime",0);
//                    json.put("realtimehr",0); //实时心率
//                    json.put("realtimest",0); //实时步数,采集开始后的累积步数
//                    json.put("realtimecal",0); //实时卡路里,累积卡路里
                }
            }
            if (type.equals("runData") || type.equals("all")){
                //运动数据  runDate
                List<Map<String , Object>> rundateDo = monitorPlatformService.getRundatePatient(patient,date);
                if (rundateDo.size() > 0){
                    Map<String,Object> map = rundateDo.get(0);
                    json.put("steps",map.get("steps")); //总步数
                    json.put("distance",map.get("distance")); //总距离
                    json.put("walkTime",map.get("walk_time")); //步行时长
                    json.put("runDistance",map.get("run_distance")); //跑步距离
                    json.put("runTime",map.get("run_time")); //跑步时长
                    json.put("calories",map.get("calories")); //总燃烧卡路里
                    json.put("runCalories",map.get("run_calories")); //跑步消耗卡路里
                    json.put("runData",rundateDo.get(0));
//                    Map<String,Object> map = rundateDo.get(0);
//                    json.put("steps",map.get("steps")); //总步数
//                    json.put("distance",map.get("distance")); //总距离
//                    json.put("walkTime",map.get("walk_time")); //步行时长
//                    json.put("runDistance",map.get("run_distance")); //跑步距离
//                    json.put("runTime",map.get("run_time")); //跑步时长
//                    json.put("calories",map.get("calories")); //总燃烧卡路里
//                    json.put("runCalories",map.get("run_calories")); //跑步消耗卡路里
                }else {
                    json.put("steps",0); //总步数
                    json.put("distance",0); //总距离
                    json.put("walkTime",0); //步行时长
                    json.put("runDistance",0); //跑步距离
                    json.put("runTime",0); //跑步时长
                    json.put("calories",0); //总燃烧卡路里
                    json.put("runCalories",0); //跑步消耗卡路里
                    json.put("runData",0);
//                    json.put("steps",0); //总步数
//                    json.put("distance",0); //总距离
//                    json.put("walkTime",0); //步行时长
//                    json.put("runDistance",0); //跑步距离
//                    json.put("runTime",0); //跑步时长
//                    json.put("calories",0); //总燃烧卡路里
//                    json.put("runCalories",0); //跑步消耗卡路里
                }
            }
            if (type.equals("pai") || type.equals("all")){
                //PAI数据
                List<Map<String,Object>> paiDo = monitorPlatformService.getPaiPatient(patient,date);
                if (paiDo.size() > 0){
                    Map<String,Object> map = paiDo.get(0);
                    json.put("totalPai",map.get("total_pai")); //用户本周运动前获得的所有PAI
                    json.put("dailyPai",map.get("daily_pai")); //用户在当天获得的PAI
                    json.put("pai",paiDo.get(0));
//                    Map<String,Object> map = paiDo.get(0);
//                    json.put("totalPai",map.get("total_pai")); //用户本周运动前获得的所有PAI
//                    json.put("dailyPai",map.get("daily_pai")); //用户在当天获得的PAI
                }else {
                    json.put("totalPai",0); //总
                    json.put("dailyPai",0); //总距离
                    json.put("pai",0);
//                    json.put("totalPai",0); //总
//                    json.put("dailyPai",0); //总距离
                }
            }
            if (type.equals("sleepData") || type.equals("all")){
                //睡眠数据
                List<Map<String , Object>> sleepDo = monitorPlatformService.getSleepByPatient(patient,date);
                if (sleepDo.size() > 0){
                    Map<String,Object> map = sleepDo.get(0);
                    json.put("deepSleepTime",map.get("deep_sleep_time")); //深度睡眠时长,单位为分钟
                    json.put("shallowSleepTime",map.get("shallow_sleep_time")); //浅度睡眠时长,单位为分钟
                    json.put("wakeTime",map.get("wake_time")); //睡眠期间清醒时长,单位为分钟
                    json.put("sleepScore",map.get("sleep_score")); //睡眠评分
                    json.put("start",map.get("start")); //睡眠开始时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
                    json.put("stop",map.get("stop")); //睡眠结束时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
                    json.put("sleepData",sleepDo.get(0));
//                    Map<String,Object> map = sleepDo.get(0);
//                    json.put("deepSleepTime",map.get("deep_sleep_time")); //深度睡眠时长,单位为分钟
//                    json.put("shallowSleepTime",map.get("shallow_sleep_time")); //浅度睡眠时长,单位为分钟
//                    json.put("wakeTime",map.get("wake_time")); //睡眠期间清醒时长,单位为分钟
//                    json.put("sleepScore",map.get("sleep_score")); //睡眠评分
//                    json.put("start",map.get("start")); //睡眠开始时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
//                    json.put("stop",map.get("stop")); //睡眠结束时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
                }else {
                    json.put("deepSleepTime",0); //深度睡眠时长,单位为分钟
                    json.put("shallowSleepTime",0); //浅度睡眠时长,单位为分钟
                    json.put("wakeTime",0); //睡眠期间清醒时长,单位为分钟
                    json.put("sleepScore",0); //睡眠评分
                    json.put("start",0); //睡眠开始时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
                    json.put("stop",0); //睡眠结束时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
                    json.put("sleepData",sleepDo.get(0));
//                    json.put("deepSleepTime",0); //深度睡眠时长,单位为分钟
//                    json.put("shallowSleepTime",0); //浅度睡眠时长,单位为分钟
//                    json.put("wakeTime",0); //睡眠期间清醒时长,单位为分钟
//                    json.put("sleepScore",0); //睡眠评分
//                    json.put("start",0); //睡眠开始时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
//                    json.put("stop",0); //睡眠结束时间。Amazfit设备为分钟序号(0-1439),mifit设备为时间戳
                }
            }
            return success("查询成功",json);

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

@ -1703,42 +1703,42 @@ public class MonitorPlatformService  {
    }
    public List<Map<String, Object>> getHealthScoreByPatient(String patient,String date,String endDate){
        String sql = "SELECT chhs.* FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_health_score chhs,wlyy.hm_token t\n" +
        String sql = "SELECT chhs.device_sn deviceSn,chhs.export_key exportKey,chhs.export_time exportTime,chhs.name name,chhs.score score,chhs.total total,chhs.date date FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_health_score chhs,wlyy.hm_token t\n" +
                "WHERE t.patient = '"+patient+"' AND t.patient = chd.patient AND chd.device_sn = chhs.device_sn and chhs.date > '"+endDate+"' and chhs.date < '"+date+"' ORDER BY export_time DESC ";
        List<Map<String, Object>> scoreDO = jdbcTemplate.queryForList(sql);
        return scoreDO;
    }
    public List<Map<String,Object>> getRealtimeDateByPatient(String patient,String date){
        String sql = "SELECT chrd.* FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_realtime_date chrd,wlyy.hm_token t\n" +
        String sql = "SELECT chrd.device_sn deviceSn,chrd.hr hr,chrd.st st,chrd.cal cal,chrd.date date FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_realtime_date chrd,wlyy.hm_token t\n" +
                "WHERE t.patient = '"+patient+"' AND t.patient = chd.patient AND chd.device_sn = chrd.device_sn and chrd.date = '"+date+"' ORDER BY chrd.`date` DESC";
        List<Map<String, Object>> realtimeDateDo = jdbcTemplate.queryForList(sql);
        return realtimeDateDo;
    }
    public List<Map<String,Object>> getRundatePatient(String patient,String date){
        String sql = "SELECT chr.* FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_rundate chr,wlyy.hm_token t\n" +
        String sql = "SELECT chr.device_sn deviceSn,chr.date date,chr.last_sync_time lastSyncTime,chr.steps steps,chr.distance distance,chr.run_distance runDistance,chr.run_time runTime,chr.walk_time walkTime,chr.calories calories,chr.run_calories runCalories,chr.hour hour FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_rundate chr,wlyy.hm_token t\n" +
                "WHERE t.patient = '"+patient+"' AND t.patient = chd.patient AND chd.device_sn = chr.device_sn and chr.date = '"+date+"' ORDER BY chr.`date` DESC";
        List<Map<String, Object>> rundataDo = jdbcTemplate.queryForList(sql);
        return rundataDo;
    }
    public List<Map<String,Object>> getPaiPatient(String patient,String date){
        String sql = "SELECT chp.* FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_pai chp,wlyy.hm_token t\n" +
        String sql = "SELECT chp.device_sn deviceSn,chp.calendar_day calendarDay,chp.timestamp timestamp,chp.total_pai totalPai,chp.daily_pai dailyPai,chp.date date FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_pai chp,wlyy.hm_token t\n" +
                "WHERE t.patient = '"+patient+"' AND t.patient = chd.patient AND chd.device_sn = chp.device_sn and chp.date = '"+date+"' ORDER BY chp.`timestamp` DESC";
        List<Map<String, Object>> paiDo = jdbcTemplate.queryForList(sql);
        return paiDo;
    }
    public List<Map<String,Object>> getSleepByPatient(String patient,String date){
        String sql = "SELECT chs.* FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_sleep chs,wlyy.hm_token t\n" +
        String sql = "SELECT chs.device_sn deviceSn,chs.date date,chs.last_sync_time lastSyncTime,chs.deep_sleep_time deepSleepTime,chs.shallow_sleep_time shallowSleepTime,chs.wake_time wakeTime,chs.sleep_score sleepScore,chs.start start,chs.stop stop,chs.mode mode FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_sleep chs,wlyy.hm_token t\n" +
                "WHERE t.patient = '"+patient+"' AND t.patient = chd.patient AND chd.device_sn = chs.device_sn and chs.date = '"+date+"' ORDER BY chs.`last_sync_time` DESC";
        List<Map<String, Object>> paiDo = jdbcTemplate.queryForList(sql);
        return paiDo;
    }
    public List<Map<String , Object>> getHeartByPatient(String patient,String date,String endDate){
        String sql = "SELECT chh.* FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_heart chh,wlyy.hm_token t\n" +
        String sql = "SELECT chh.device_sn deviceSn,chh.date date,chh.minute minute,chh.last_sync_time lastSyncTime,chh.timestamp timestamp,chh.heart_rate_data heartRateData,chh.measure_type measureType FROM xmiot.wlyy_copd_huami_device chd,xmiot.wlyy_copd_huami_heart chh,wlyy.hm_token t\n" +
                "WHERE t.patient = '"+patient+"' AND t.patient = chd.patient AND chd.device_sn = chh.device_sn and chh.`date` > '"+endDate+"' and chh.`date` < '"+date+"' ORDER BY chh.`date` DESC";
        List<Map<String, Object>> heartDo = jdbcTemplate.queryForList(sql);
        return heartDo;