Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Submitted by
B. Tech
in
Prof. R.Sathyaraj
October, 2019
Contents
Abstract
This Hospital management system was created considering 3 different users. They include
the Doctor, Patient and the ADMIN. During creation of a user the user will enter his/her role
and according to the role user will get connected to the required database.The patient will be
able to book appointments on this database. The doctor can view his schedule and see his
appointments. Moreover, the doctor can provide the medicines and give the solution to the
problem. The ADMIN will be in charge of appointing the patients to the respective doctors
depending upon symptoms and doctor department. The ADMIN can also remove the data or
edit it. A database for patient-doctor appointment will be created which will contain all the
appointments of different patients and doctors and each user will have specific permission
and visibility to view this database.
Introduction
Booking an appointment in a hospital is a tedious and tiring process.Often the patients either
has to call the hospital or physically go to the hospital to get a appointment.The ADMIN will
have to comb through schedules to see if a doctor is free and available on that time. Even
doctors need to know their patients and also about the medicines in the hospital.To reduce all
of this workload a simple Hospital Management System has been created. It will have a simple
interface where the patient can book appointment, the receptionist can assign doctors and the
doctor can see his/her schedule and help the patient. It is easy to manage the database and all
the records will be stored in a virtual environment thus saving paper and money.
Background Study
The following links provide a brief explanation and insight on Hospital Management System-
https://ieeexplore.ieee.org/document/7020594
https://doctors.practo.com/hospital-management-system/
https://ieeexplore.ieee.org/document/5564121
Methodology and Tools
ER Diagram
Front End – Python 3.7 with Tkinter
Python 3.7 was used as a frontend tool with Tkinter being used to give it GUI (Graphical
User Interface).
Database - MySQL
One of the most popular SQL databases which is open source. A browser for viewing the
database MySQL Workbench was also used. This was to facilitate easier Viewability
of the database schema and table
class LoginPage(tk.Frame):
def __init__(self,master):
tk.Frame.__init__(self, master)
self.heading = tk.Label(self, text="Hospital Management System",height = 7,
font=('Algerian 40 bold'), fg='black', bg='lightblue').pack()
self.email = tk.Label(self, text="Email Id", font=('arial 18 bold'), fg='black',
bg='lightgreen').pack()
self.email_ent = tk.Entry(self,fg='lightgreen', width=30)
self.email_ent.pack()
self.password = tk.Label(self, text="Password", font=('arial 18 bold'), fg='black',
bg='lightgreen').pack()
self.password_ent = tk.Entry(self,show="*" ,width=30)
self.password_ent.pack()
self.submit = tk.Button(self, text="Login", width=20, height=2, bg='lightgreen',
command = lambda : self.genric(master)).pack()
self.register = tk.Button(self, text="Register", width=20, height=2, bg='lightgreen',
command = lambda : master.switch_frame(UserRegistration)).pack()
def genric(self,master):
email = self.email_ent.get();
password = self.password_ent.get();
if(email == "" or password == ""):
tk.messagebox.showinfo("Warning", "Please Fill Up All Boxes")
return
c.execute("""Select email_id,password,role,first_name from user""")
results = c.fetchall()
global NAME
flag = 0;
for row in results:
email1 = row[0]
password1 = row[1]
role1 = row[2]
fname1 = row[3]
if(email1==email and password1 == password and role1 == "Doctor"):
NAME = fname1
tk.messagebox.showinfo("Congrats", "Successful!!")
master.switch_frame(DoctorPage)
flag=1
return
if(email1==email and password1 == password and role1 == "Patient"):
NAME = fname1
tk.messagebox.showinfo("Congrats", "Successful!!")
master.switch_frame(PatientPage)
flag=1
return
if(email1==email and password1 == password and role1 == "ADMIN"):
NAME = fname1
tk.messagebox.showinfo("Congrats", "Successful!!")
master.switch_frame(ReceptionPage)
flag=1
return
if(flag == 0):
tk.messagebox.showinfo("Warning", "Login Unsuccessful!!")
return
class PatientPage(tk.Frame):
def __init__(self, master):
global NAME
tk.Frame.__init__(self, master)
self.master = master
self.heading=tk.Label(self, text="Welcome " + NAME,width = 20,height = 5,
font=('Algerian 18 bold'), fg='black', bg='lightblue').pack()
self.appointment = tk.Button(self,text = "Book an appointment",font = ('arial 18
bold'),command = lambda : master.switch_frame(addAppointment)).pack()
self.result = tk.Button(self,text = "Results",font = ('arial 18 bold'),command = lambda :
master.switch_frame(Results)).pack()
self.logout = tk.Button(self,text = "Logout",font = ('arial 18 bold'),command = lambda :
master.switch_frame(LoginPage)).pack()
CODE FOR DOCTOR PAGE:
class DoctorPage(tk.Frame):
def __init__(self,master):
global NAME
tk.Frame.__init__(self,master)
self.master = master
self.heading=tk.Label(self,text = "Welcome " + NAME,bg = "lightblue",font = ('Algerian
20 bold'),width = 30, height = 10).pack();
self.id = tk.Label(self,text = "Enter Appointment Id",font = ('arial 18 bold'),bg =
'lightgreen').pack()
self.id_ent = tk.Entry(self,width = 10)
self.id_ent.pack()
self.Update= tk.Button(self, text="Update Appointment", bg='purple',width =10,
command = lambda: self.generic5(master)).pack(fill="both")
self.Logout= tk.Button(self, text="Logout", bg='red',width =10, command = lambda:
master.switch_frame(LoginPage)).pack(fill="both")
def generic5(self,master):
global a_id,name,id2,issue,dname;
global NAME;
a_id = self.id_ent.get();
if(a_id == ""):
tk.messagebox.showinfo("Warning","Please Enter Appointment Id")
return
c.execute("""Select id,p_name,p_id,issue,d_name from record""")
results = c.fetchall();
flag = 0
for row in results:
if(row[0] == int(a_id)):
flag =1
name = row[1]
id2=row[2]
issue = row[3]
dname = row[4]
break
if(flag==0):
tk.messagebox.showinfo("Warning","Id Not Found!!")
return
if(dname!=NAME):
tk.messagebox.showinfo("Warning","Not Assigned to this patient")
return
master.switch_frame(UpdateIssue)
CODE FOR ADMIN:
class ReceptionPage(tk.Frame):
def __init__(self,master):
tk.Frame.__init__(self,master)
self.master = master
self.heading=tk.Label(self, text="Welcome Admin " ,width = 20,height = 10,
font=('Algerian 20 bold'), fg='black', bg='lightblue').pack()
self.id = tk.Label(self,text = "Enter Appointment Id",font = ('arial 18 bold'),bg =
'lightgreen').pack()
self.id_ent = tk.Entry(self,width = 10)
self.id_ent.pack()
self.Update= tk.Button(self, text="Update Appointment", bg='steelblue',width =10,
command = lambda: self.generic3(master)).pack(fill="both")
self.Remove= tk.Button(self, text="Delete Appointment", bg='steelblue',width =10,
command = lambda: self.generic4(master)).pack(fill="both")
self.Logout= tk.Button(self, text="Logout", bg='steelblue',width =10, command =
lambda: master.switch_frame(LoginPage)).pack(fill="both")
def generic3(self,master):
global a_id,name,id2,issue;
a_id = self.id_ent.get();
if(a_id == ""):
tk.messagebox.showinfo("Warning","Please Enter Appointment Id")
return
c.execute("""Select id,p_name,p_id,issue from record""")
results = c.fetchall();
flag = 0
for row in results:
if(row[0] == int(a_id)):
flag =1
name = row[1]
id2=row[2]
issue = row[3]
break
if(flag==0):
tk.messagebox.showinfo("Warning","Id Not Found!!")
return
master.switch_frame(UpdateAppointment);
def generic4(self,master):
global a_id;
a_id = self.id_ent.get();
c.execute("""Select id,p_name,p_id,issue from record""")
results = c.fetchall();
flag = 0
for row in results:
if(row[0] == int(a_id)):
flag =1
name = row[1]
id2=row[2]
issue = row[3]
break
if(flag==0):
tk.messagebox.showinfo("Warning","Id Not Found!!")
return
sql = """delete from record where id = %s"""
c.execute(sql,(a_id,))
db.commit()
tk.messagebox.showinfo("Congrats","Id Deleted")
We illustrate this process with a complete appointment being booked. We register a user as a
patient and then book an appointment, the receptionist assigns the doctor and the doctor gives
the solution to the issue of the patient. The patient can then view his/her results.
Now we login back as the patient,and look at the results and and enter the id
Now since the results have come, we can delete the appointment. This can be done by the ADMIN.
And Delete it
After deletion,
Thus we illustrated the operation of Insertion by the patient, Updating by the doctor and the
receptionist, Selection by the patient and Deletion by the ADMIN.
Conclusion
This is a simple hospital management system which can be used instantly. However, this is
still a prototype and other additional functionalities can be added to make it more useful like
a billing system, laboratories, even other hospitals. We can also model it better to the real
world demands. We could use other databases to reduce the access time and also make it
more interactive. Moreover we can always extend this to multiple hospitals and make a
website for the people to access it.
References
http://effbot.org/tkinterbook/pack.htm
https://wiki.python.org/moin/TkInter