Exemplo n.º 1
0
def addNewPatient():
    if request.method == 'POST':
        patient = Patient(
            firstName = str(request.form["firstname"]),
            lastName = str(request.form["lastname"]),
            phoneNumber = str(request.form["phonenumber"]),
            email = str(request.form["email"]),
            operation = str(request.form["operation"]),
            operationDate = datetime.strptime(request.form['operationdate'], '%Y-%m-%d'),
            prescriptionMed = str(request.form["presciptionmedication"]),
            prescriptionDosage = float(request.form["prescriptiondosage"]),
            notes = str(request.form["notes"]),
            priorOpioid = int(request.form["prioropioduse"]),
            onAntidepressants = int(request.form["onantidepressants"]),
            password = ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(6)),
            isDoctor = False
        )
        phonenumber='+15715986645'
        # patient.password = "******"
        sendsms(patient.email,patient.password,phonenumber)
        patient.set_password(patient.password)

        db.session.add(patient)
        db.session.commit()
        return redirect(url_for('doctorDashBoard'))

    return render_template("addnewpatient.html")
def register_patient():
    form = PatientRegistrationForm()
    if form.validate_on_submit():
        user = Patient(username=form.username.data, fname=form.fname.data,lname=form.lname.data)
        user.set_password(form.password.data)
        db.session.add(user)
        db.session.commit()
        flash('CONFIRMATION: The patient has been registered.')
        return redirect(url_for('view_patient_all'))
    return render_template('register_patient.html', title='Register Patient', form=form)
Exemplo n.º 3
0
def register():
    if current_user.is_authenticated:
        return redirect(url_for('index'))
    form = RegistrationForm()
    if form.validate_on_submit():
        patient = Patient(first_name=form.firstname.data,
                          last_name=form.lastname.data,
                          login=form.email.data)
        patient.set_password(form.password.data)
        db.session.add(patient)
        db.session.commit()
        flash('Congratulations, you are now a registered user!')
        return redirect(url_for('login'))
    return render_template('register.html', form=form)