Exemplo n.º 1
0
def insert_patient(user=None):
    patient = Patient(first_name='John',
                      last_name='Richmond',
                      dob='1950-01-01',
                      ssn='111-11-1111')
    db.session.add(patient)
    db.session.commit()

    if user:
        patient.created_by = user
        db.session.commit()

    return patient
Exemplo n.º 2
0
def insert_patient(user=None):
    patient = Patient(
        first_name='John',
        last_name='Richmond',
        dob='1950-01-01',
        ssn='111-11-1111'
    )
    db.session.add(patient)
    db.session.commit()
    
    if user:
        patient.created_by = user
        db.session.commit()

    return patient
Exemplo n.º 3
0
def patient_create():
    patient = Patient()
    episodes = []

    form = PatientEditForm(obj=patient)
    form.hospital_id.choices = _hospital_id_choices()

    if form.validate_on_submit():
        patient.name = form.name.data
        patient.email = form.email.data
        patient.hospital_id = form.hospital_id.data
        patient.gender = form.gender.data
        patient.phone1 = form.phone.data
        patient.address = form.address.data

        patient.created_by = current_user
        patient.updated_by = current_user

        db.session.add(patient)
        db.session.commit()
        flash('New patient details for {} have been registered.'.format(patient.name))
        return redirect(url_for('patient', id=patient.id))

    return render_template('patient.html', title='Register New Patient', form=form, episodes=episodes)