def consultation(username, date, time): patient = user_db.get_patient(username) if request.args.get('action') == 'close': # patientname = request.form['patientname']; # date = request.form['date'] current_user.complete_treatment(username, date, time) return redirect(url_for('appointment')) if request.method == "POST": script = request.form["recordnote"] time = str(datetime.now())[0:16] medicine = request.form["medicine"] patient.add_description(current_user.username, script, time, medicine) return render_template('consultation.html', patient=patient, description=patient.descriptions, time=patient.descriptions_time, med=patient.med_prescriptions) if request.method == 'POST': if request.form['action'] == 'send': providernam = request.form['providername'] provider = centremanager.get_provider(providernam) provider.add_referral(name) return render_template('referral.html', results=results, name=name)
def edit_history(patientname): patient = user_db.get_patient(patientname) time = int(str(curr_time)[0:16]) edit_permission = False if patient.descriptions[current_user.username] != None: edit_permission = True history = patient.descriptions[current_user.username] if request.method == 'POST': script = request.args['history'] patient.add_description(current_user.username, script, time) return render_template('edit_history.html', permission=edit_permission, history=history)
def booking(providername, centre): print("print CENTRE", centre) make = False error = None provider = centremanager.get_provider(providername) patient = user_db.get_patient(current_user.username) date = datetime.now() todaydate = str(date)[0:10] if centre != "individual": start_time, finish_time = provider.get_hour(centre) else: start_time = 7 finish_time = 22 if request.method == 'POST': # Checks the user before logging in appointment_date = request.form['date'] appointment_time = request.form['time'] if request.form['description']: Booking_description = request.form['description'] else: Booking_description = None status = True service = provider.service centrename = centre temp_appointment = Appointment(appointment_date, appointment_time, centrename, provider, service, Booking_description, patient, status) error = temp_appointment.delete() if error == None: centremanager.append_appointment(patient.username, temp_appointment) make = True return render_template('booking.html', provider=provider, make=make, todaydate=todaydate, error=error, start=start_time, finish=finish_time, centre=centre)
def profile(name, type): permission = False is_themself = False # flag to separate between the profile of their own or the others centre_list = [] if type == "Centre": temp = centremanager.get_centre(name) provider_dict = list(temp.providers.values()) else: if type == "Provider" or (type == "Specialist"): temp = centremanager.get_provider(name) provider_dict = temp.centre[1:] print(provider_dict) is_themself = "Provider" centre_list = temp.centre[1:] for idx, i in enumerate(centre_list): centre_list[idx] = centremanager.get_centre(i) print(centre_list) elif type == "Patient": temp = user_db.get_patient(name) provider_dict = None if current_user.username == name: permission = True is_themself = "Patient" for appointment in temp.appointments: if appointment.provider.username == current_user.username: permission = True # is_themself = True if request.method == 'GET' and type != "Patient": rate = request.args.get('rate', '3') print(rate) name = current_user.username temp.make_rate(name, rate) return render_template('profile.html', tempone=temp, provider_dict=provider_dict, permission=permission, ownprofile=is_themself, centre_list=centre_list)
def edit_profile(type): if type == "Provider" or (type == "Specialist"): temp = centremanager.get_provider(current_user.username) elif type == "Patient": temp = user_db.get_patient(current_user.username) # edit button is clicked if request.method == "POST": curr_username = current_user.username fullname = request.form["fullname"] phone = request.form["phonenumber"] temp.edit_personal_info(fullname, phone) print(temp.username) # test write file #------------------ return redirect(url_for("profile", name=temp.username, type=type)) return render_template('edit_profile.html', tempone=temp)