示例#1
0
def insert_formula(court_id, brand_id, type, energy, protein, carbon_compound, axunge):
    """

    """
    type_of_milk = TypeOfMilk(court_id=court_id, bran_id=brand_id, type=type, energy=energy, protein=protein,
                            carbon_compound=carbon_compound, axunge=axunge)
    db.add(type_of_milk)
    try:
        db.commit()
    except:
        return False
    return True
示例#2
0
def register_doctor(login_name, login_pass, argument_real_name, argument_province, argument_belong_hospital,
                    argument_belong_department, argument_position, argument_email, argument_tel):
    """
       注册医师
    """
    doctor_result = Doctor.query.filter(or_(Doctor.doctor_name == login_name, Doctor.email == argument_email, Doctor.tel == argument_tel)).first()
    if doctor_result:
        return 0
    else:
        doctor = Doctor(doctor_name=login_name, doctor_pass=login_pass, real_name=argument_real_name, province=argument_province,
                        belong_hospital=argument_belong_hospital, belong_department=argument_belong_department, position=argument_position,
                        email=argument_email, tel=argument_tel)
        try:
            db.add(doctor)
            db.commit()
        except:
            return 0
        return doctor.id
示例#3
0
def insert_or_cancel_collects(doctor_id, type_id, collect_type):
    '''添加收藏'''
    result = check_is_collect(doctor_id, type_id, collect_type)
    if result:
        try:
            db.delete(result)
            db.commit()
        except:
            return False
        return True
    else:
        collect = Collect(doctor_id=doctor_id, type_id=type_id, type=collect_type)
        try:
            db.add(collect)
            db.commit()
        except:
            return False
        return True