排行榜接口調(diào)試通過 √
運(yùn)動(dòng)日志調(diào)試通過 √
運(yùn)動(dòng)數(shù)據(jù)以及圖表獲取調(diào)試通過 √
準(zhǔn)備組裝定時(shí)生成健康報(bào)告腳本
模板
# coding:utf-8
from comm.db import db
import datetime
import time
class CreateHealthReport(object):
"""
用來定時(shí)生成健康報(bào)告并存入數(shù)據(jù)庫中
"""
def __init__(self, watch_id):
self.health_report = db.healthreport
self.step_total = 0
self.cal_total = 0
self.smoke = 0
self.drink = {}
self.report_date = time.strftime('%Y-%m',time.localtime(time.time()))
self.watch_id = watch_id
def get_health_report(self):
"""
系統(tǒng)健康報(bào)告
datetime: str 本期報(bào)告時(shí)間(年月)
alert_heart_rate: int 心率警報(bào)次數(shù)
alert_heart_rate_type: str 正常/警惕/風(fēng)險(xiǎn)
alert_blood_pre: int 血壓警報(bào)次數(shù)
alert_blood_pre_type: str 正常/警惕/風(fēng)險(xiǎn)
alert_blood_sugar: int 血糖警報(bào)次數(shù)
alert_blood_sugar_type: str 正常/警惕/風(fēng)險(xiǎn)
run_step_total: int 總步數(shù)
run_cal_total: int 總卡路里
run_step_standard: int 運(yùn)動(dòng)標(biāo)準(zhǔn)值
run_cal_standard: int 卡路里標(biāo)準(zhǔn)值
life_smoke: int 吸煙量(支)
life_drink: int 喝酒量(ml)
life_smoke_standard: int 吸煙標(biāo)準(zhǔn)數(shù)據(jù)(支)
life_drink_standard: int 喝酒標(biāo)準(zhǔn)數(shù)據(jù)(ml)
"""
pass
def doctor_report_heart(self):
"""
datetime: str 本期報(bào)告時(shí)間(年月)
data statistics: arrays 本期報(bào)告時(shí)間段內(nèi)的所有心率數(shù)據(jù)
heart_rate_standard: str 心率正常范圍('60-90')
health_assess: arrays 健康風(fēng)險(xiǎn)評(píng)估(根據(jù)各項(xiàng)數(shù)據(jù)進(jìn)行計(jì)算后存入列表返回)
status_and_guide: arrays 先先瞎編吧
"""
pass
def doctor_report_run(self):
"""
datetime: str 本期報(bào)告時(shí)間(年月)
run_step_total: int 總步數(shù)
run_cal_total: int 記步消耗的總卡路里
run_log:{ arrays 運(yùn)動(dòng)日志,按照天劃分,每天總步數(shù)
datetime: datetime日期(2017-2-10)
step: step 步數(shù)(8000)
}
run_type_log:{ arrays 運(yùn)動(dòng)類型日志
run_type: int (1跑步、2登山、3晨練、4游泳)
run_num: int 運(yùn)動(dòng)次數(shù)
run_exercise: int/str 運(yùn)動(dòng)量(步數(shù)/小時(shí))
run_cal: int 該項(xiàng)運(yùn)動(dòng)消耗的卡路里
}
all_cocal: int 所有運(yùn)動(dòng)消耗的卡路里總數(shù)
run_analysis:{
status: int 運(yùn)動(dòng)狀態(tài)分析(1運(yùn)動(dòng)缺乏、2運(yùn)動(dòng)適量、3運(yùn)動(dòng)過量)
step: int 本月記步
other: int 其他運(yùn)動(dòng)次數(shù)
cal: int 共消耗的卡路里數(shù)
}
run_advise: int 運(yùn)動(dòng)監(jiān)護(hù)建議(根據(jù)運(yùn)行狀態(tài)分析輸出不同的建議)
"""
pass
def doctor_report_sleep(self):
"""
datetime: str 本期報(bào)告時(shí)間(年月)
sleep_month_view:{ arrays 當(dāng)月睡眠數(shù)據(jù)
datetime: int 日期(6 = 6號(hào))
sleep_time: int 睡眠總時(shí)長(/h)
}
sleep_day_view:{ arrays 睡眠日視圖
day: int 日期(6 = 6號(hào))
deep_time: float 深度睡眠時(shí)間(4.5 = 4小時(shí)30分鐘)
light_time: float 安靜睡眠時(shí)間(4.5 = 4小時(shí)30分鐘)
}
sleep_analysis:{ arrays 睡眠分析
content: 寫死先
}
sleep_status:{ arrays 睡眠狀態(tài)
content: 寫死先
}
sleep_advise:{ arrays 睡眠健康指導(dǎo)
content: 寫死先
}
"""
pass
def doctor_report_life(self):
"""
datetime: str 本期報(bào)告時(shí)間(年月)
eat_log_day:{ arrays 膳食記錄-日
food_type: int 食物類型-量
cal_total: int 食物卡路里總量
}
eat_log_week:{ arrays 膳食記錄-周
food_type: int 食物類型-量
cal_total: int 食物卡路里總量
}
eat_log_month:{ arrays 膳食記錄-月
food_type: int 食物類型-量
cal_total: int 食物卡路里總量
}
bad_habit:{
smoke: int 吸煙數(shù)量
drink:{
types: int 類型-量
}
}
health_assess{
status: str 情況
advise: str 建議
num: int 得分
total: int 總分
}
health_advise: str 醫(yī)生填寫的生活建議
"""
pass