def to_update_password(): """ to update password """ user_id = request.args.get('user_id') type = request.args.get('type', 'doctor') set_session_user('user_id', user_id, '', '') set_session_user('type', type, '','') return render_template('user_feature/password.html')
def check_login(login_name, login_pass): """ login_name: 登陆名 login_pass: 登陆密码 """ baby = Baby.query.filter(Baby.login_name == login_name, Baby.baby_pass == login_pass).first() doctor = Doctor.query.filter(Doctor.doctor_name == login_name, Doctor.doctor_pass == login_pass).first() if baby != None or doctor != None: if baby != None: set_session_user(baby.login_name, baby.id) return baby if doctor != None: set_session_user(doctor.doctor_name, doctor.id) return doctor return None
def to_record(baby_id): entrance = str(request.args.get('entrance_type', 'doctor')) record, record_count, baby = get_visit_record(baby_id) login_id = 0 if entrance == 'baby': set_session_user('entrance', entrance,'user_id', baby_id) login_id = get_session('user_id') else: set_session_user('entrance', entrance,'baby_id', baby_id) login_id = get_session('baby_id') return render_template('baby/visit_record.html', record=record, record_count=record_count, baby=baby, user_id=login_id, entrance=entrance)
def check_login(login_name, login_pass, login_type): """ login_name: 登陆名 login_pass: 登陆密码 """ if login_type == 'mummy': baby = Baby.query.filter(Baby.patriarch_tel == login_name, Baby.baby_pass == login_pass).first() if baby != None: set_session_user('user', baby.login_name, 'user_id', baby.id) set_session_user('login_type', login_type, '','') return baby else: return None if login_type == 'doctor': doctor = Doctor.query.filter(or_(and_(Doctor.doctor_name == login_name, Doctor.doctor_pass == login_pass), and_(Doctor.email == login_name, Doctor.doctor_pass == login_pass))).first() if doctor != None: set_session_user('user', doctor.doctor_name, 'user_id', doctor.id) set_session_user('login_type', login_type, '','') return doctor else: return None
def to_grow_line(baby_id): record, record_count, baby = get_visit_record(baby_id) show_data_way = check_baby_is_week_or_month(baby) types = request.args.get('type', 'weight') select_type = request.args.get('select_type', 'doctor') set_session_user('select_type', select_type, '','') if baby: baby.select_type = select_type way = request.args.get('way', 'week') tracking = get_tracking(baby_id, types, show_data_way, None) grow_p3, grow_p15, grow_p75, grow_p95 = get_who_standard(baby_id, types) if show_data_way == 'week' and way == 'week': tracking = get_tracking_week(baby_id, types, show_data_way, None) if types == 'weight': if baby.is_compare == 40: tracking = get_tracking_week(baby_id, types, show_data_way, 'fen_tong') grow_p3, grow_p15, grow_p75, grow_p95, grow_negative3 = get_fen_tong_standard(baby_id, types) return render_template('baby/grow_line_fentong_weight.html', tracking=tracking, types=types, user_id=get_session('baby_id'), entrance=get_session('entrance'), baby=baby, grow_p3=grow_p3, grow_p15=grow_p15, grow_p75=grow_p75, grow_p95=grow_p95, grow_negative3=grow_negative3) return render_template('baby/grow_line.html', tracking=tracking, types=types, user_id=get_session('baby_id'), entrance=get_session('entrance'), baby=baby, grow_p3=grow_p3, grow_p15=grow_p15, grow_p75=grow_p75, grow_p95=grow_p95) if types == 'height': return render_template('baby/grow_line_height_week.html', tracking=tracking, types=types, user_id=get_session('baby_id'), entrance=get_session('entrance'), baby=baby, grow_p3=grow_p3, grow_p15=grow_p15, grow_p75=grow_p75, grow_p95=grow_p95) if types == 'head': return render_template('baby/grow_line_head_week.html', tracking=tracking, types=types, user_id=get_session('baby_id'), entrance=get_session('entrance'), baby=baby, grow_p3=grow_p3, grow_p15=grow_p15, grow_p75=grow_p75, grow_p95=grow_p95) else: grow_p3, grow_p15, grow_p75, grow_p95 = get_who_standard_month(baby_id, types) if types == 'weight': if baby.is_compare == 40: tracking = get_tracking(baby_id, types, show_data_way, 'fen_tong') grow_p3, grow_p15, grow_p75, grow_p95, grow_negative3 = get_fen_tong_standard(baby_id, types) return render_template('baby/grow_line_fentong_weight.html', tracking=tracking, types=types, user_id=get_session('baby_id'), entrance=get_session('entrance'), baby=baby, grow_p3=grow_p3, grow_p15=grow_p15, grow_p75=grow_p75, grow_p95=grow_p95, grow_negative3=grow_negative3) return render_template('baby/grow_line_month.html', tracking=tracking, types=types, user_id=get_session('baby_id'), entrance=get_session('entrance'), baby=baby, grow_p3=grow_p3, grow_p15=grow_p15, grow_p75=grow_p75, grow_p95=grow_p95) if types == 'height': return render_template('baby/grow_line_height_month.html', tracking=tracking, types=types, user_id=get_session('baby_id'), entrance=get_session('entrance'), baby=baby, grow_p3=grow_p3, grow_p15=grow_p15, grow_p75=grow_p75, grow_p95=grow_p95) if types == 'head': return render_template('baby/grow_line_head_month.html', tracking=tracking, types=types, user_id=get_session('baby_id'), entrance=get_session('entrance'), baby=baby, grow_p3=grow_p3, grow_p15=grow_p15, grow_p75=grow_p75, grow_p95=grow_p95)