def pharmacy_login(id, ui): global user_id user_id = id sql = "SELECT * FROM Drugs" enter_cursor.execute(sql) appointments = enter_cursor.fetchall() manager.fill_table(ui.drugs_table, appointments) ui.PageStack.setCurrentIndex(5)
def reception_login(id, ui): global user_id user_id = id sql = "SELECT * FROM Appointments" enter_cursor.execute(sql) appointments = enter_cursor.fetchall() manager.fill_table(ui.reception_table, appointments) ui.PageStack.setCurrentIndex(4)
def delete_pending_user(ui, app): a = QtWidgets.QWidget() email_in, ok = QtWidgets.QInputDialog.getText(a, 'Dialog', 'Enter email') if ok: manager.delete(str(email_in), cursor, db) sql = "SELECT email,phone,username FROM Registrations" cursor.execute(sql) pending_list = cursor.fetchall() manager.fill_table(ui.tableWidget, pending_list)
def laboratory_login(id, ui): global user_id user_id = id laboratory.set_lab_id(id) sql = "SELECT * FROM Test" enter_cursor.execute(sql) tests = enter_cursor.fetchall() manager.fill_table(ui.Lab_Table, tests) ui.PageStack.setCurrentIndex(9)
def delete_free_time_dr(ui): a = QtWidgets.QWidget() appointment_id, pr_ok = QtWidgets.QInputDialog.getText( a, 'Delete Appointment', 'Enter Appointment ID') if pr_ok: doctor.delete_freetime(appointment_id, cursor, db) sql = "SELECT * FROM Appointments WHERE DrID = %s ORDER BY AppointmentID" cursor.execute(sql, doctor.dr_id) appointments = cursor.fetchall() manager.fill_table(ui.dr_appmnts_table, appointments)
def add_free_time_dr(ui): a = QtWidgets.QWidget() time, pr_ok = QtWidgets.QInputDialog.getText(a, 'Add Free Time', 'Enter Time') if pr_ok: doctor.add_free_time(cursor, db, time, doctor.dr_id) sql = "SELECT * FROM Appointments WHERE DrID = %s ORDER BY AppointmentID" cursor.execute(sql, doctor.dr_id) appointments = cursor.fetchall() manager.fill_table(ui.dr_appmnts_table, appointments)
def delete_drug(ui): a = QtWidgets.QWidget() drug_name_in, drug_ok = QtWidgets.QInputDialog.getText( a, 'Add New Drug', 'Enter Drug Name') if drug_ok: pharmacy.delete_drug(str(drug_name_in), cursor, db) sql = "SELECT * FROM Drugs" cursor.execute(sql) drugs = cursor.fetchall() manager.fill_table(ui.drugs_table, drugs)
def p_reserve(ui): a = QtWidgets.QWidget() appointment_id, app_ok = QtWidgets.QInputDialog.getText( a, 'Reserve Appointment', 'Enter Appointment ID') if app_ok: patient.p_reserve_appointment(appointment_id, cursor, db) sql = "SELECT * FROM Appointments WHERE PatientID = %s OR PatientID IS NULL ORDER BY AppointmentID" cursor.execute(sql, patient.patient_id) appointments = cursor.fetchall() manager.fill_table(ui.P_AppointmentsTable, appointments)
def delete_appointment(ui): a = QtWidgets.QWidget() appointmentid_in, ok = QtWidgets.QInputDialog.getText( a, 'Delete Appointment', 'Enter Appointment ID') if ok: reception.delete_apponitment(int(appointmentid_in), cursor, db) sql = "SELECT * FROM Appointments" cursor.execute(sql) appointments = cursor.fetchall() manager.fill_table(ui.reception_table, appointments)
def doctor_login(id, ui): global user_id doctor.set_dr_id(id) user_id = id enter_db.commit() sql = "SELECT * From Appointments WHERE DrID = %s ORDER BY AppointmentID" enter_cursor.execute(sql, id) appointments = enter_cursor.fetchall() manager.fill_table(ui.dr_appmnts_table, appointments) ui.PageStack.setCurrentIndex(6)
def patient_login(id, ui): global user_id patient.set_patient_id(id) user_id = id enter_db.commit() sql = "SELECT * From Appointments WHERE PatientID = %s OR PatientID IS NULL ORDER BY AppointmentID" enter_cursor.execute(sql, id) appointments = enter_cursor.fetchall() manager.fill_table(ui.P_AppointmentsTable, appointments) ui.PageStack.setCurrentIndex(8)
def add_drug(ui): a = QtWidgets.QWidget() drug_name_in, drug_ok = QtWidgets.QInputDialog.getText( a, 'Add New Drug', 'Enter Drug Name') exp_in, exp_ok = QtWidgets.QInputDialog.getText(a, 'Add New Drug', 'Enter Expiration Date') if exp_ok and drug_ok: pharmacy.add_drug(str(drug_name_in), str(exp_in), cursor, db) sql = "SELECT * FROM Drugs" cursor.execute(sql) drugs = cursor.fetchall() manager.fill_table(ui.drugs_table, drugs)
def answer_test(): a = QtWidgets.QWidget() test_id, id_ok = QtWidgets.QInputDialog.getText(a, 'Send Diagnose Report', 'Enter Test ID:') test_result, res_ok = QtWidgets.QInputDialog.getMultiLineText( a, 'Send Diagnose Report', 'Enter diagnose report below:') if id_ok and res_ok: laboratory.set_diagnose_report(test_result, test_id, cursor, db) sql = "SELECT * FROM Test" cursor.execute(sql) result = cursor.fetchall() manager.fill_table(ui.Lab_Table, result)
def add_free_time_rec(ui): a = QtWidgets.QWidget() dr_id_in, dr_ok = QtWidgets.QInputDialog.getText(a, 'Add Free Time', 'Enter Dr ID') time_in, time_ok = QtWidgets.QInputDialog.getText(a, 'Add Free Time', 'Enter Time') if dr_ok and time_ok: reception.add_free_time(str(time_in), str(dr_id_in), cursor, db) sql = "SELECT * FROM Appointments" cursor.execute(sql) appointments = cursor.fetchall() manager.fill_table(ui.reception_table, appointments)
def submit_register_form(ui): global manager_add_user name_in = ui.name.toPlainText() email_in = ui.email.toPlainText() phone_in = ui.phone.toPlainText() passwd_in = ui.passwd.toPlainText() role_in = ui.selected_role.currentText() register.register_user(name_in, email_in, phone_in, passwd_in, role_in) if manager_add_user is True: manager.approve(email_in) sql = "SELECT email,phone,username FROM Registrations" cursor.execute(sql) pending_list = cursor.fetchall() ui.tableWidget.clear() manager.fill_table(ui, pending_list) ui.PageStack.setCurrentIndex(2) manager_add_user = False else: ui.PageStack.setCurrentIndex(0)
def p_send_message(ui): messages = patient.get_messages(login.user_id, cursor) manager.fill_table(ui.message_table, messages) ui.PageStack.setCurrentIndex(7)
def filter_drugs(ui): filtered_list = pharmacy.filter(cursor) manager.fill_table(ui.drugs_table, filtered_list)
def manager_login(ui): sql = "SELECT email,phone,username FROM Registrations" enter_cursor.execute(sql) pending_list = enter_cursor.fetchall() manager.fill_table(ui.tableWidget, pending_list) ui.PageStack.setCurrentIndex(2)
def send(ui): content = ui.messsage_txt.toPlainText() receiverid = ui.receiverid_txt.toPlainText() doctor.send_message(content, login.user_id, receiverid, cursor, db) messages = patient.get_messages(login.user_id, cursor) manager.fill_table(ui.message_table, messages)