예제 #1
0
    def post():
        parser = reqparse.RequestParser()
        parser.add_argument('user_id', type=str, required=False, help=u'user_id 必须')
        parser.add_argument('old_password', type=str, required=True, help=u'old_password 必须')
        parser.add_argument('new_password', type=str, required=True, help=u'new_password 必须')
        parser.add_argument('type', type=str, required=False, help=u'type 必须')

        args = parser.parse_args()

        old_password = args['old_password']
        new_password = args['new_password']
        user_id = get_session('user_id')
        type = get_session('type')

        return_success = success_dic().dic
        return_fail = fail_dic().dic
        # user_id = get_session('user_id')
        if user_id is None:
            return_fail.pop('message')
            return_fail['msg'] = '请先登录!'
            return_fail.pop('code')
            return_fail['code'] = 404
            return return_fail

        is_true = by_id_alter_password(user_id, old_password, new_password, type)
        if is_true:
            return_success['message'] = '修改密码成功'
            return return_success
        else:
            return_success['message'] = '旧密码不正确'
            return return_success
예제 #2
0
    def get():
        """
            所需参数:
                page: 分页,传入当前页码
                type:1列表,0收藏
        """
        parser = reqparse.RequestParser()
        parser.add_argument('page', type=str, required=True, help=u'分页page,传入当前页')
        parser.add_argument('doctor_id', type=str, required=True, help=u'doctor_id 必须')

        args = parser.parse_args()
        page = args['page']
        doctor_id = args['doctor_id']

        resp_suc = success_dic().dic
        fail = fail_dic().dic
        resp_suc['baby_list'] = []
        recent = get_recent_modified()
        resp_suc['recent_modified_time'] = ''
        if recent != 'None':
            resp_suc['recent_modified_time'] = recent['update_time']
        baby, baby_count = baby_list(page, int(doctor_id))
        resp_suc['baby_count'] =baby_count
        if baby:
            if type(baby) is list:
                for bb in baby:
                    format_baby(bb, resp_suc)
            else:
                format_baby(baby, resp_suc)
            return resp_suc
        else:
            return resp_suc
예제 #3
0
    def get():
        """
            参数:
                id: 登录id
        """
        parser = reqparse.RequestParser()
        parser.add_argument('page', type=str, required=True, help=u'page 必须')

        args = parser.parse_args()

        page = args['page']

        success = success_dic().dic
        fail = fail_dic().dic
        success['system_message_list'] = []

        system_message, count = get_meeting_message()
        if system_message:
            if type(system_message) is list:
                for system in system_message:
                    system_message_pickler(system, success)
            else:
                system_message_pickler(system_message, success)
            return success
        else:
            return fail
예제 #4
0
    def get():
        """
            参数
                keyword:关键字搜索
                birthday_time:出生日期搜索
        """
        parser = reqparse.RequestParser()
        parser.add_argument('keyword', type=str, required=True, help=u'keyword关键字必须。')
        parser.add_argument('start_birthday_time', type=str, required=False)
        parser.add_argument('end_birthday_time', type=str, required=False)
        parser.add_argument('page', type=str, required=False)

        args = parser.parse_args()

        success = success_dic().dic
        fail = fail_dic().dic
        success['baby_list'] = []

        keyword = args['keyword']
        birthday_time = args['start_birthday_time']
        end_birthday_time = args.get('end_birthday_time', None)
        page = args.get('page', '1')
        baby = search_by_keyword_time(keyword, birthday_time, end_birthday_time, page)
        if baby:
            if type(baby) is list:
                for b in baby:
                    format_baby(b, success)
            else:
                format_baby(baby, success)
            return success
        else:
            success['message'] = '没有数据'
            return success
예제 #5
0
    def get():
        """
            所需参数:
                page: 分页,传入当前页码
                type:1列表,0收藏
        """
        parser = reqparse.RequestParser()
        parser.add_argument('page', type=str, help=u'分页page,传入当前页')

        args = parser.parse_args()
        page = args['page']

        resp_suc = success_dic().dic
        resp_fail = fail_dic().dic
        resp_suc['baby_list'] = []
        baby = baby_list(page)
        if baby:
            if type(baby) is list:
                for bb in baby:
                    format_baby(bb, resp_suc)
            else:
                format_baby(baby, resp_suc)
            return resp_suc
        else:
            return resp_fail
예제 #6
0
    def get():
        """
            参数:
                id: 登录id
        """
        parser = reqparse.RequestParser()
        parser.add_argument('id', type=str, required=True, help=u'登录的id')

        args = parser.parse_args()

        id = args['id']
        resp_suc = success_dic().dic
        resp_fail = fail_dic().dic
        resp_suc['system_message_list'] = []

        system_message = get_meeting_message(id)
        if system_message:
            if type(system_message) is list:
                for system in system_message:
                    system_message_pickler(system, resp_suc)
            else:
                system_message_pickler(system_message, resp_suc)
            return resp_suc
        else:
            return resp_fail
예제 #7
0
    def post():
        parser = reqparse.RequestParser()
        parser.add_argument('court_id', type=str, required=True, help=u'court_id 必须')
        parser.add_argument('brand_id', type=str, required=True, help=u'brand_id 必须')
        parser.add_argument('kind', type=str, required=True, help=u'type 必须')
        parser.add_argument('energy', type=str, required=False, help=u'energy 必须')
        parser.add_argument('protein', type=str, required=False, help=u'protein 必须')
        parser.add_argument('carbohydrates', type=str, required=False, help=u'carbon_compound 必须')
        parser.add_argument('fat', type=str, required=False, help=u'axunge 必须')

        args = parser.parse_args()

        court_id = args['court_id']
        brand_id = args['brand_id']
        kind = args['kind']
        energy = args['energy']
        protein = args['protein']
        carbohydrates = args['carbohydrates']
        fat = args['fat']

        success = success_dic().dic
        fail = fail_dic().dic

        is_ture = insert_formula(court_id, brand_id, kind, energy, protein, carbohydrates, fat)

        if is_ture:
            success['msg'] = '添加成功'
            return success
        else:
            fail['msg'] = '添加失败'
            return fail
예제 #8
0
    def post():
        parser = reqparse.RequestParser()
        parser.add_argument('login_name', type=str, required=True, help=u'login_name 必须')
        parser.add_argument('login_pass', type=str, required=True, help=u'login_pass 必须')
        parser.add_argument('real_name', type=str, required=True, help=u'real_name 必须')
        parser.add_argument('province_id', type=str, required=True, help=u'province_id 必须')
        parser.add_argument('belong_hospital', type=str, required=True, help=u'belong_hospital 必须')
        parser.add_argument('belong_department', type=str, required=True, help=u'belong_department 必须')
        parser.add_argument('position', type=str, required=True, help=u'position 必须')
        parser.add_argument('email', type=str, required=True, help=u'email 必须')
        parser.add_argument('tel', type=str, required=True, help=u'tel 必须')

        args = parser.parse_args()

        success = success_dic().dic
        fail = fail_dic().dic

        login_name = args.get('login_name')
        login_pass = args.get('login_pass')
        real_name = args.get('real_name')
        province_id = args.get('province_id')
        belong_hospital = args.get('belong_hospital')
        belong_department = args.get('belong_department')
        position = args.get('position')
        email = args.get('email')
        tel = args.get('tel')
        is_true = register_doctor(login_name, login_pass, real_name, province_id, belong_hospital, belong_department,
                                  position, email, tel)
        if is_true != 0:
            success['doctor_id'] = is_true
            success['msg'] = '注册成功'
            return success
        else:
            fail['msg'] = '用户已注册'
            return fail
예제 #9
0
    def get():
        """
            所需参数:
                doctor_id:登录医生id
        """
        parser = reqparse.RequestParser()
        parser.add_argument('doctor_id', type=str, required=True, help=u'登录医生doctor_id')
        parser.add_argument('page', type=str, required=True, help=u'分页,传入当前page页码')

        args = parser.parse_args()
        doctor_id = args['doctor_id']
        page = args['page']
        resp_suc = success_dic().dic
        resp_fail = fail_dic().dic
        resp_suc['baby_list'] = []
        baby_collect = baby_collect_list(page, doctor_id)
        if baby_collect:
            if type(baby_collect) is list:
                for baby_c in baby_collect:
                    format_baby(baby_c, resp_suc)
            else:
                format_baby(baby_collect, resp_suc)
            return resp_suc
        else:
            return resp_fail
예제 #10
0
    def get():
        success = success_dic().dic
        fail = fail_dic().dic

        success['total'] = []
        div_data(success)

        return success
예제 #11
0
    def get():
        success = success_dic().dic
        fail = fail_dic().dic

        is_true = get_complication(success)
        if is_true:
            return success
        else:
            fail['message'] = '没有数据'
            return fail
예제 #12
0
    def get():
        """

        """
        resp_suc = success_dic().dic
        resp_fail = fail_dic().dic
        result = delete_all_search()
        if result == 0:
            return resp_suc
        else:
            return resp_fail
예제 #13
0
    def get():
        """

        """
        success = success_dic().dic
        fail = fail_dic().dic
        result = delete_all_search()
        if result == 0:
            return success
        else:
            return fail
예제 #14
0
    def post():
        """
        参数
        baby_id  婴儿id
        measure_date: 测量日期
        weight: 体重
        height: 身长
        head: 头围
        breastfeeding: 母乳喂养
        location: 院内/外
        brand: 品牌
        kind: 种类
        nutrition: 配方奶营养量
        add_type: 添加类型(baby,doctor如果时妈妈端登陆添加的就是baby,医生端登陆添加的就是doctor)
        """
        parser = reqparse.RequestParser()
        parser.add_argument('baby_id', type=str, required=True, help=u'baby_id 必须')
        parser.add_argument('measure_date', type=str, required=True, help=u'measure_date 必须')
        parser.add_argument('weight', type=str, required=True, help=u'weight 必须')
        parser.add_argument('height', type=str, required=True, help=u'height 必须')
        parser.add_argument('head', type=str, required=True, help=u'head 必须')
        parser.add_argument('breastfeeding', type=str, required=True, help=u'breastfeeding 必须')
        parser.add_argument('location', type=str, required=True, help=u'location 必须')
        parser.add_argument('brand', type=str, required=True, help=u'brand 必须')
        parser.add_argument('kind', type=str, required=True, help=u'kind 必须')
        parser.add_argument('nutrition', type=str, required=True, help=u'nutrition 必须')
        parser.add_argument('add_type', type=str, required=False)

        args = parser.parse_args()

        success = success_dic().dic
        fail = fail_dic().dic

        baby_id = args['baby_id']
        measure_date = args['measure_date']
        weight = args['weight']
        height = args['height']
        head = args['head']
        breastfeeding = args['breastfeeding']
        location = args['location']
        brand = args['brand']
        kind = args['kind']
        nutrition = args['nutrition']
        add_type = args['add_type']

        is_ture = insert_visit_record(baby_id, measure_date, weight, height, head, location, brand,
                                      breastfeeding, kind, nutrition, add_type)
        if is_ture:
            success['msg'] = '添加成功'
            return success
        else:
            fail['msg'] = '添加失败'
            return fail
예제 #15
0
    def post():
        """
            参数:
                doctor_id: 医生登录id
        """
        parser = reqparse.RequestParser()
        parser.add_argument('doctor_id', type=str, required=True, help=u'医生登录doctor_id必须。')
        parser.add_argument('type', type=str, required=False)
        parser.add_argument('real_name', type=str, required=False)
        parser.add_argument('province', type=str, required=False)
        parser.add_argument('belong_hospital', type=str, required=False)
        parser.add_argument('belong_department', type=str, required=False)
        parser.add_argument('position', type=str, required=False)
        parser.add_argument('email', type=str, required=False)
        parser.add_argument('tel', type=str, required=False)
        parser.add_argument('upload_image', type=werkzeug.datastructures.FileStorage, location='files')

        args = parser.parse_args()

        success = success_dic().dic
        fail = fail_dic().dic
        success['doctor_list'] = []

        doctor_id = args['doctor_id']
        type_way = args['type']
        if type_way:
            real_name = args['real_name']
            province_id = args['province']
            belong_hospital = args['belong_hospital']
            belong_department = args['belong_department']
            position = args['position']
            email = args['email']
            tel = args['tel']
            upload_image = args['upload_image']
            is_ture = update_doctor(doctor_id, real_name, province_id, belong_hospital, belong_department, position,
                                    email, tel, upload_image, success)
            if is_ture:
                return success
            else:
                return fail
        else:
            doctor = doctor_info(doctor_id)
            if doctor:
                doctor_pickler(doctor, success)
                return success
            else:
                return fail
예제 #16
0
    def get():
        province, province_count = get_province()
        hospital, hospital_count = get_hospital()
        department, department_count = get_department()
        position, position_count = get_position()

        return_success = success_dic().dic
        return_fail = fail_dic().dic

        if province and hospital and department and position:
            register_data_province(province, return_success)
            register_data_position(position, return_success)
            register_data_hospital(hospital, return_success)
            register_data_department(department, return_success)
            return return_success
        else:
            return return_fail
예제 #17
0
    def get():
        """

        """
        resp_suc = success_dic().dic
        resp_fail = fail_dic().dic
        resp_suc['search_history_list'] = []

        search_history = search_history_list()
        if search_history:
            if type(search_history) is list:
                for search in search_history:
                    search_pickler(search, resp_suc)
            else:
                search_pickler(search_history, resp_suc)
            return resp_suc
        else:
            return resp_fail
예제 #18
0
    def get():
        """

        """
        success = success_dic().dic
        fail = fail_dic().dic
        success['search_history_list'] = []

        search_history = search_history_list()
        if search_history:
            if type(search_history) is list:
                for search in search_history:
                    search_pickler(search, success)
            else:
                search_pickler(search_history, success)
            return success
        else:
            return fail
예제 #19
0
    def get():
        parser = reqparse.RequestParser()
        parser.add_argument('academic_id', type=str, required=True, help=u'academic_id 必须')
        parser.add_argument('doctor_id', type=str, required=True, help=u'doctor_id 必须')

        args = parser.parse_args()

        academic_id = args['academic_id']
        doctor_id = args['doctor_id']

        success = success_dic().dic
        fail = fail_dic().dic

        result = get_abstract_by_id(academic_id, doctor_id, success)

        if result:
            return success
        else:
            return fail
예제 #20
0
    def get():
        """
            所需参数:
                doctor_id:登录医生id
        """
        parser = reqparse.RequestParser()
        parser.add_argument('doctor_id', type=str, required=True, help=u'登录医生doctor_id')
        parser.add_argument('page', type=str, required=True, help=u'分页,传入当前page页码')

        args = parser.parse_args()
        doctor_id = args['doctor_id']
        page = args['page']
        resp_suc = success_dic().dic
        fail = fail_dic().dic
        resp_suc['baby_list'] = []
        is_true = baby_collect_list(page, doctor_id, resp_suc)
        if is_true:
            return resp_suc
        else:
            resp_suc['message'] = '没有数据'
            return resp_suc
예제 #21
0
    def get():
        """
            参数:
                doctor_id: 医生登录id
        """
        parser = reqparse.RequestParser()
        parser.add_argument('doctor_id', type=str, required=True, help=u'医生登录doctor_id必须。')

        args = parser.parse_args()

        resp_suc = success_dic().dic
        resp_fail = fail_dic().dic
        resp_suc['doctor_list'] = []

        doctor_id = args['doctor_id']
        doctor = doctor_info(doctor_id)
        if doctor:
            doctor_pickler(doctor, resp_suc)
            return resp_suc
        else:
            return resp_fail
예제 #22
0
    def get():
        """
        doctor_id: 医生id
        """
        parser = reqparse.RequestParser()
        parser.add_argument('doctor_id', type=str, required=True, help=u'doctor_id 必须')
        parser.add_argument('page', type=str, required=True, help=u'page 必须')

        args = parser.parse_args()

        success = success_dic().dic
        fail = fail_dic().dic

        doctor_id = args['doctor_id']
        page = int(args['page'])

        is_true = get_collect_abstract(doctor_id, page, success)
        if is_true:
            return success
        else:
            success['message'] = '没有找到数据'
            return success
예제 #23
0
    def get():
        """
        page: 分页
        """
        parser = reqparse.RequestParser()
        parser.add_argument('page', type=str, required=True, help=u'page 必须')
        parser.add_argument('doctor_id', type=str, required=True, help=u'doctor_id 必须')

        args = parser.parse_args()

        page = int(args['page'])
        doctor_id = args['doctor_id']

        success = success_dic().dic
        fail = fail_dic().dic
        # 调用service中方法获取model数据
        # 根据返回的boolean值来判断是否有数据
        is_true = get_academic_abstract(page, doctor_id, success)

        if is_true:
            return success
        else:
            return fail
예제 #24
0
    def post():
        parser = reqparse.RequestParser()
        parser.add_argument('login_name', type=str, required=True, help=u'login_name 必须')
        parser.add_argument('login_pass', type=str, required=True, help=u'login_pass 必须')
        parser.add_argument('remember', type=str, required=True, help=u'remember 必须')
        parser.add_argument('login_type', type=str, required=True, help=u'login_type 必须')

        args = parser.parse_args()

        return_success = success_dic().dic
        return_fail = fail_dic().dic

        login_name = args.get('login_name')
        login_pass = args.get('login_pass')
        remember = args.get('remember')
        login_type = args.get('login_type')
        result = check_login(login_name, login_pass, login_type)
        is_true = check_is_type(result, remember, return_success)
        if is_true:
            return return_success
        else:
            return_success['message'] = '登陆失败'
            return return_success
예제 #25
0
    def get():
        """
            参数
                keyword:关键字搜索
                birthday_time:出生日期搜索
        """
        parser = reqparse.RequestParser()
        parser.add_argument('keyword', type=str, required=True, help=u'keyword关键字必须。')
        parser.add_argument('birthday_time', type=str, required=False)

        args = parser.parse_args()

        resp_suc = success_dic().dic
        resp_fail = fail_dic().dic
        resp_suc['baby_list'] = []

        keyword = args['keyword']
        birthday_time = args['birthday_time']
        baby = search_by_keyword_time(keyword, birthday_time)
        if baby:
            format_baby(baby, resp_suc)
            return resp_suc
        else:
            return resp_fail
예제 #26
0
    def get():
        """
        argument:
        1.type: 收藏类型,baby  or  abstract
        2.baby_id: 收藏baby id
        3.abstract_id: 收藏abstract id
        4.doctor_id: 医生id
        """
        parser = reqparse.RequestParser()
        parser.add_argument('type', type=str, required=True, help=u'type 必须')
        parser.add_argument('doctor_id', type=str, required=True, help=u'doctor_id 必须')
        parser.add_argument('baby_id', type=str)
        parser.add_argument('abstract_id', type=str)

        args = parser.parse_args()

        collect_type = args['type']
        doctor_id = args['doctor_id']
        baby_id = args['baby_id']
        abstract_id = args['abstract_id']

        success = success_dic().dic
        fail = fail_dic().dic

        if baby_id:
            is_true = insert_or_cancel_collects(doctor_id, baby_id, collect_type)
            if is_true:
                return success
            else:
                return fail
        if abstract_id:
            is_true = insert_or_cancel_collects(doctor_id, abstract_id, collect_type)
            if is_true:
                return success
            else:
                return fail
예제 #27
0
    def post():
        """
        参数:
        patriarch_tel   家长手机号
        baby_name	    婴儿名
        baby_pass       婴儿登录密码
        gender		    性别
        due_date	    预产期
        born_birthday	出生日期
        born_weight		出生体重
        born_height		出生身高
        born_head		出生头围
        childbirth_style	分娩方式
        complication_id	合并症(可以多选,实用逗号隔开)
        growth_standard		生长标准
        """
        parser = reqparse.RequestParser()
        parser.add_argument('patriarch_tel', type=str, required=True, help=u'patriarch_tel 必须')
        parser.add_argument('baby_name', type=str, required=True, help=u'baby_name 必须')
        # parser.add_argument('login_name', type=str, required=True, help=u'login_name 必须')
        parser.add_argument('baby_pass', type=str, required=True, help=u'baby_pass 必须')
        parser.add_argument('gender', type=str, required=True, help=u'gender 必须')
        parser.add_argument('due_date', type=str, required=True, help=u'due_date 必须')
        parser.add_argument('born_birthday', type=str, required=True, help=u'born_birthday 必须')
        parser.add_argument('born_weight', type=str, required=True, help=u'born_weight 必须')
        parser.add_argument('born_height', type=str, required=True, help=u'born_height 必须')
        parser.add_argument('born_head', type=str, required=True, help=u'born_head 必须')
        parser.add_argument('childbirth_style', type=str, required=True, help=u'childbirth_style 必须')
        parser.add_argument('complication_id', type=str, required=True, help=u'complication_id 必须')
        parser.add_argument('growth_standard', type=str, required=False)
        parser.add_argument('doctor_id', type=str, required=False)
        # parser.add_argument('restore_day', type=str, required=True, help=u'restore_day 必须')
        # parser.add_argument('apgar_score', type=str, required=True, help=u'apgar_score 必须')

        args = parser.parse_args()

        success = success_dic().dic
        fail = fail_dic().dic

        patriarch_tel = args['patriarch_tel']
        baby_name = args['baby_name']
        baby_pass = args['baby_pass']
        # login_name = args['login_name']
        gender = args['gender']
        due_date = args['due_date']
        born_birthday = args['born_birthday']
        born_weight = args['born_weight']
        born_height = args['born_height']
        born_head = args['born_head']
        childbirth_style = args['childbirth_style']
        complication_id = args['complication_id']
        growth_standard = args['growth_standard']
        doctor_id = args['doctor_id']
        # restore_day = args['restore_day']
        # apgar_score = args['apgar_score']
        is_ture = create_baby(patriarch_tel, baby_name, baby_pass, gender, due_date, born_birthday, born_weight, born_height, born_head,
                              childbirth_style, complication_id, growth_standard, doctor_id)
        if is_ture == -1:
            fail['message'] = '账户已存在'
            return fail
        elif is_ture == 0:
            fail['message'] = '创建账户失败!系统内部错误'
            return fail
        else:
            success['baby_id'] = is_ture
            success['message'] = '创建账户成功'
            return success