Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2022
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. from Admin import Admin
  2. from Doctor import Doctor
  3. from Patient import Patient
  4.  
  5. def main():
  6.  
  7. admin = Admin('admin','123','B1 1AB')
  8. doctors = [Doctor('John','Smith','Internal Med.'), Doctor('Jone','Smith','Pediatrics'), Doctor('Jone','Carlos','Cardiology')]
  9. 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')]
  10. discharged_patients = []
  11. discharge_patients = []
  12.  
  13. while True:
  14. for login in range(3):
  15. if admin.login():
  16. running = True
  17. break
  18. else:
  19. print('Incorrect username or password.')
  20. else:
  21. print('Login Denied, too many attempts failed')
  22. raise SystemExit
  23. print('login successful')
  24.  
  25. while running:
  26. 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')
  27.  
  28. op = input('Option: ')
  29.  
  30. if op == '1':
  31. admin.doctor_management(doctors)
  32.  
  33. elif op == '2':
  34. print('1- View patients\n2- Discharge patients\n3- View discharged patients')
  35. op = input('option: ')
  36. if op =='1':
  37. if patients:
  38. admin.view_patient(patients)
  39. else:
  40. print('There are no patients in the system for viewing.')
  41.  
  42. elif op == '2':
  43. if patients:
  44. patient_index=admin.discharge(patients, discharge_patients)
  45.  
  46.  
  47. while True:
  48. discharge_patients = input('Do you want to discharge a patient(Y/N):').lower()
  49.  
  50. if discharge_patients == 'yes' or discharge_patients == 'y':
  51. discharged_patients.append(patients[patient_index])
  52. patients.pop(patient_index)
  53.  
  54. print('Patient has been discharged')
  55. break
  56.  
  57. elif discharge_patients == 'no' or discharge_patients == 'n':
  58. break
  59.  
  60. else:
  61. print('Please answer by yes or no.')
  62. else:
  63. print('There are no patients to discharge.')
  64.  
  65. elif op == '3':
  66. if discharged_patients:
  67. admin.dischargeview(discharged_patients)
  68.  
  69. else:
  70. print('No patients have been discharged yet, return to this list when patients have been discharged.')
  71.  
  72. elif op == '3':
  73. if patients:
  74. if doctors:
  75. admin.assign_doctor_to_patient(patients, doctors)
  76.  
  77. else:
  78. print('There are no doctors available.')
  79.  
  80. else:
  81. print('There are no patients to be assigned.')
  82.  
  83. elif op == '4':
  84. admin.update_details()
  85.  
  86. elif op == '5':
  87. print("Goodbye!")
  88. raise SystemExit
  89.  
  90. else:
  91. print('Invalid option. Try again')
  92. return
  93.  
  94. if __name__ == '__main__':
  95. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement