| 
					
				 | 
			
			
				@ -911,4 +911,97 @@ public class MonitorPlatformController extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation("获取运动记录") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "getSportRecord",method = {RequestMethod.POST,RequestMethod.GET}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop getSportRecord( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name="patient",value="i健康居民code",defaultValue = "0fab4dd67e074e16ac86db6b6c15233e") @RequestParam(value = "patient", required = false)String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name="startDate",value="开始日期,如2020-05-09",defaultValue = "2020-05-09") @RequestParam(value = "startDate", required = false)String startDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name="endDate",value="结束日期,如2020-05-10",defaultValue = "2020-05-10") @RequestParam(value = "endDate", required = false)String endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //心率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> hearDo = monitorPlatformService.getHeartByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (hearDo.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("hear",hearDo);//心率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("hear",0);//心率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //健康分  retWeekTime("week");  周的健康分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> scoreDO = monitorPlatformService.getHealthScoreByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (scoreDO.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String,Object> healthScoreDO = scoreDO.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("score",healthScoreDO.get("score")); //健康分值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("total",healthScoreDO.get("total")); //健康分值总分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("score",0); //健康分值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("total",0); //健康分值总分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 实时数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> realtimeDateDo = monitorPlatformService.getRealtimeDateByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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")); //实时卡路里,累积卡路里 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("realtimehr",0); //实时心率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("realtimest",0); //实时步数,采集开始后的累积步数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("realtimecal",0); //实时卡路里,累积卡路里 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //运动数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String , Object>> rundateDo = monitorPlatformService.getRundatePatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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")); //跑步消耗卡路里 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }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); //跑步消耗卡路里 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //PAI数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> paiDo = monitorPlatformService.getPaiPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (paiDo.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String,Object> map = paiDo.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("totalPai",map.get("total_pai")); //总 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("dailyPai",map.get("daily_pai")); //总距离 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("totalPai",0); //总 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("dailyPai",0); //总距离 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //睡眠数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String , Object>> sleepDo = monitorPlatformService.getSleepByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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设备为时间戳 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }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设备为时间戳 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return success("查询成功",json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getError("查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |