Ejemplo n.º 1
0
def delete_patient(current_user_token,id):
    patient = Patient.query.get(id)

    db.session.delete(patient)
    db.session.commit()

    result = patient_schema.dump(patient)
    return jsonify(result)
def create_patient():
    name = request.json['full_name']
    gender = request.json['gender']
    address = request.json['address']
    ssn = request.json['ssn']
    blood_type = request.json['blood_type']
    email = request.json['email']

    patient = Patient(name,gender,address,ssn,blood_type,email)
    results = patient_schema.dump(patient)
    return jsonify(results)
Ejemplo n.º 3
0
def create_patient(current_user_token):
    firstName = request.json['first_name']
    lastName = request.json['last_name']
    gender = request.json['gender']
    address = request.json['address']
    ssn = request.json['ssn']
    blood_type = request.json['blood_type']
    email = request.json['email']

    patient = Patient(firstName, lastName, gender, address, ssn, blood_type,
                      email)
    results = patient_schema.dump(patient)
    flash(f"Record for {patient} has been added.", "info")
    return jsonify(results)
Ejemplo n.º 4
0
def create_patient(current_user_token):
    name = request.json['full_name']
    gender = request.json['gender']
    address = request.json['address']
    ssn = request.json['ssn']
    blood_type = request.json['blood_type']
    email = request.json['email']                                                                                           

    patient = Patient(name, gender, address, ssn, blood_type, email)

    db.session.add(patient)
    db.session.commit()

    results = patient_schema.dump(patient)
    return jsonify(results)
Ejemplo n.º 5
0
def create_patient(current_user_token):
    # here we are going to parse input from json style file
    # rather than a formas we did before
    name = request.json['full_name']
    gender = request.json['gender']
    # similar to how we used form.name.data
    address = request.json['address']
    ssn = request.json['ssn']
    blood_type = request.json['blood_type']
    email = request.json['email']

    # adding to model
    patient = Patient(name, gender, address, ssn, blood_type, email)

    # adding to database
    db.session.add(patient)
    db.session.commit()

    # looking at db and checking that requested information was added to the database
    results = patient_schema.dump(patient)
    # Marshmellow patient_schema is a Front End digestible version of the raw db output
    return jsonify(results)
def get_patient(id):
    patient = Patient.query.get(id)
    results = patient_schema.dump(patient)
    return jsonify(results)
Ejemplo n.º 7
0
def get_patient(current_user_token, id):
    patient = Patient.query.get(id)
    results = patient_schema.dump(patient)
    return jsonify(results)