Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Admin import Admin
- from Doctor import Doctor
- from Patient import Patient
- def main():
- admin = Admin('admin','123','B1 1AB')
- doctors = [Doctor('John','Smith','Internal Med.'), Doctor('Jone','Smith','Pediatrics'), Doctor('Jone','Carlos','Cardiology')]
- patients = [Patient('Sara','Smith', 20, '07012345678','B1 234','Flu'), Patient('Mike','Jones', 37,'07555551234','L2 2AB','Heart Attack'), Patient('David','Smith', 15, '07123456789','C1 ABC','Cough')]
- discharged_patients = []
- discharge_patients = []
- while True:
- for login in range(3):
- if admin.login():
- running = True
- break
- else:
- print('Incorrect username or password.')
- else:
- print('Login Denied, too many attempts failed')
- raise SystemExit
- print('login successful')
- while running:
- print('\nChoose the operation: \n1- Register/view/update/delete doctor\n2- View & Discharge patients\n3- Assign doctor to patient\n4- Update admin details\n5- Quit')
- op = input('Option: ')
- if op == '1':
- admin.doctor_management(doctors)
- elif op == '2':
- print('1- View patients\n2- Discharge patients\n3- View discharged patients')
- op = input('option: ')
- if op =='1':
- if patients:
- admin.view_patient(patients)
- else:
- print('There are no patients in the system for viewing.')
- elif op == '2':
- if patients:
- patient_index=admin.discharge(patients, discharge_patients)
- while True:
- discharge_patients = input('Do you want to discharge a patient(Y/N):').lower()
- if discharge_patients == 'yes' or discharge_patients == 'y':
- discharged_patients.append(patients[patient_index])
- patients.pop(patient_index)
- print('Patient has been discharged')
- break
- elif discharge_patients == 'no' or discharge_patients == 'n':
- break
- else:
- print('Please answer by yes or no.')
- else:
- print('There are no patients to discharge.')
- elif op == '3':
- if discharged_patients:
- admin.dischargeview(discharged_patients)
- else:
- print('No patients have been discharged yet, return to this list when patients have been discharged.')
- elif op == '3':
- if patients:
- if doctors:
- admin.assign_doctor_to_patient(patients, doctors)
- else:
- print('There are no doctors available.')
- else:
- print('There are no patients to be assigned.')
- elif op == '4':
- admin.update_details()
- elif op == '5':
- print("Goodbye!")
- raise SystemExit
- else:
- print('Invalid option. Try again')
- return
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement