import Read_Hospital_Excel_Sheet
import Write_Hospital_Excel_Sheet
def AppointmentIndexInDoctorsDataBase (patient_ID) :
for i in Doctors_DataBase :
for j in Doctors_DataBase[i] :
if str(patient_ID) == str(j[0]) :
Appointment_index = Doctors_DataBase[i].index(j)
return Appointment_index,i
print("********************************************************************")
print("* *")
print("* Welcome to Hospital Management System *")
print("* *")
print("********************************************************************")
tries = 0
tries_flag = ""
while tries_flag != "Close the program" :
Patients_DataBase = Read_Hospital_Excel_Sheet.Read_Patients_DataBase()
Doctors_DataBase = Read_Hospital_Excel_Sheet.Read_Doctors_DataBase()
print("-----------------------------------------")
print("|Enter 1 for Admin mode |\n|Enter 2 for User mode |")
print("-----------------------------------------")
Admin_user_mode = input("Enter your mode : ")
if Admin_user_mode == "1" : #Admin mode
print("*****************************************\n| Welcome to admin mode |\n*****************************************")
Password = input("Please enter your password : ")
while True :
if Password == "1234" :
print("-----------------------------------------")
print("|To manage patients Enter 1 |\n|To manage doctors Enter 2 |\n|To manage appointments Enter 3 |\n|To be back Enter E |")
print("-----------------------------------------")
AdminOptions = input ("Enter your choice : ")
AdminOptions = AdminOptions.upper()
if AdminOptions == "1" : #Admin mode --> Pateints Management
print("-----------------------------------------")
print("|To add new patient Enter 1 |")
print("|To display patient Enter 2 |")
print("|To delete patient data Enter 3 |")
print("|To edit patient data Enter 4 |")
print("|To Back enter E |")
print("-----------------------------------------")
Admin_choice = input ("Enter your choice : ")
Admin_choice = Admin_choice.upper()
if Admin_choice == "1" : #Admin mode --> Pateints Management --> Enter new patient data
try : #To avoid non integer input
patient_ID = int(input("Enter patient ID : "))
while patient_ID in Patients_DataBase : #if Admin entered used ID
patient_ID = int(input("This ID is unavailable, please try another ID : "))
Department=input("Enter patient department : ")
DoctorName=input("Enter name of doctor following the case : ")
Name =input("Enter patient name : ")
Age =input("Enter patient age : ")
Gender =input("Enter patient gender : ")
Address =input("Enter patient address : ")
RoomNumber=input("Enter patient room number : ")
Patients_DataBase[patient_ID]=[Department,DoctorName,Name,Age,Gender,Address,RoomNumber]
print("----------------------Patient added successfully----------------------")
except :
print("Patient ID should be an integer number")
elif Admin_choice == "2" : #Admin mode --> Pateints Management --> Display patient data
try : #To avoid non integer input
patient_ID = int(input("Enter patient ID : "))
while patient_ID not in Patients_DataBase :
patient_ID = int(input("Incorrect ID, Please Enter patient ID : "))
print("\npatient name : ",Patients_DataBase[patient_ID][2])
print("patient age : ",Patients_DataBase[patient_ID][3])
print("patient gender : ",Patients_DataBase[patient_ID][4])
print("patient address : ",Patients_DataBase[patient_ID][5])
print("patient room number : ",Patients_DataBase[patient_ID][6])
print("patient is in "+Patients_DataBase[patient_ID][0]+" department")
print("patient is followed by doctor : "+Patients_DataBase[patient_ID][1])
except :
print("Patient ID should be an integer number")
elif Admin_choice == "3" : #Admin mode --> Pateints Management --> Delete patient data
try : #To avoid non integer input
patient_ID = int(input("Enter patient ID : "))
while patient_ID not in Patients_DataBase :
patient_ID = int(input("Incorrect ID, Please Enter patient ID : "))
Patients_DataBase.pop(patient_ID)
print("----------------------Patient data deleted successfully----------------------")
except :
print("Patient ID should be an integer number")
elif Admin_choice == "4" : #Admin mode --> Pateints Management --> Edit patient data
try : #To avoid non integer input
patient_ID=int(input("Enter patient ID : "))
while patient_ID not in Patients_DataBase :
patient_ID = int(input("Incorrect ID, Please Enter patient ID : "))
while True :
print("------------------------------------------")
print("|To Edit pateint Department Enter 1 : |")
print("|To Edit Doctor following case Enter 2 : |")
print("|To Edit patient Name Enter 3 : |")
print("|To Edit patient Age Enter 4 : |")
print("|To Edit patient Gender Enter 5 : |")
print("|To Edit patient Address Enter 6 : |")
print("|To Edit patient RoomNumber Enter 7 : |")
print("|To be Back Enter E |")
print("-----------------------------------------")
Admin_choice = input("Enter your choice : ")
Admin_choice = Admin_choice.upper()
if Admin_choice == "1" :
Patients_DataBase[patient_ID][0]=input("\nEnter patient department : ")
print("----------------------Patient Department edited successfully----------------------")
elif Admin_choice == "2" :
Patients_DataBase[patient_ID][1]=input("\nEnter Doctor follouing case : ")
print("----------------------Doctor follouing case edited successfully----------------------")
elif Admin_choice == "3" :
Patients_DataBase[patient_ID][2]=input("\nEnter patient name : ")
print("----------------------Patient name edited successfully----------------------")
elif Admin_choice == "4" :
Patients_DataBase[patient_ID][3]=input("\nEnter patient Age : ")
print("----------------------Patient age edited successfully----------------------")
elif Admin_choice == "5" :
Patients_DataBase[patient_ID][4]=input("\nEnter patient gender : ")
print("----------------------Patient address gender successfully----------------------")
elif Admin_choice == "6" :
Patients_DataBase[patient_ID][5]=input("\nEnter patient address : ")
print("----------------------Patient address edited successfully----------------------")
elif Admin_choice == "7" :
Patients_DataBase[patient_ID][6]=input("\nEnter patient RoomNumber : ")
print("----------------------Patient Room Number edited successfully----------------------")
elif Admin_choice == "E" :