Final New Hospital Mangement System by Yash Bhimanai
Final New Hospital Mangement System by Yash Bhimanai
Place:-Surat
Date:- 31-01-2022
Principal StaffIn-Charge
SchoolSeal Examiner
INDEX
Want..
This proposed system will be interactive ,faster and user-friendly for any
user.Using The Hospital Management System.
HARDWARE AND SOFTWARE REQUIREMENTS
SOFTWARE REQUIREMENTS:
1.)Windows OS
2.)Front-end : python idle 3.7
3.)Back- end : my sql command line client 8.0
4.)Supporting tools : ms word 2007 and paint
HARDWARE REQUIREMENTS:
1.)250 mb ram
2.)1 Gb hardisk
OBJECTIVES OF THE PROJECT
The objective of this project is to let the students apply the programming knowledge
into a real- world situation/problem and exposed the students how programming
skills helps in developing a good software.
• Write programs utilizing modern software tools.
• Apply object oriented programming principles effectively when developing
small to medium sized projects.
• Write effective procedural code to solve small to medium sized problems.
• Students will demonstrate a breadth of knowledge in Informatics Practices, as
exemplified in the areas of systems, theory and software development.
• Students will demonstrate ability to conduct a research or applied Informatics
practices project, requiring writing and presentation skills which exemplify
scholarly style in Informatics Practices..
CONCEPT OF SOFTWARE USE TO WRITING APPLICATION
Introduction to Python :
Python is an interpreted, object-oriented, high-level programming language
with dynamic semantics. Its high-level built in data structures, combined with
dynamic typing and dynamic binding, make it very attractive for Rapid
Application Development, as well as for use as a scripting or glue language to
connect existing components together.
l.openLogin()
MENU PAGE
from tkinter import *
import newadmission as newd
import doctor as doc_t
import staff
import medicine
import about
def newadd():
newd.openPage()
def doct():
doc_t.thirdpage()
def sta_f():
staff.fourthpage()
def b_d():
medicine.sixthpage()
def abou_t():
about.seventhpage()
def page():
root = Toplevel()
w = root.winfo_screenwidth()
h = root.winfo_screenheight()
geometry="%dx%d+%d+%d"%(w,h,0,0)
root.geometry(geometry)
root.config(bg = "white")
new = PhotoImage(file='new.gif')
doctor = PhotoImage(file='doctor.png')
bed = PhotoImage(file='pharm1.png')
staff = PhotoImage(file='staff2.png')
about = PhotoImage(file='about.png')
# image buttons
newptbt = Button(root, image=new,borderwidth=0,height = 200,width = 200,command = newadd)
newptbt.place(x=190, y=135)
docbt = Button(root, image=doctor,borderwidth=0,height = 200,width = 200,command=doct)
docbt.place(x=555, y=135)
stbt = Button(root, image=staff,borderwidth=0,height = 200,width = 200,command=sta_f)
stbt.place(x=920, y=135)
bedbt = Button(root, image=bed,borderwidth=0,height = 200,width =
200,command=b_d,bg='white')
bedbt.place(x=373, y= 425)
aboutbt = Button(root, image=about,borderwidth=0,height = 200,width = 200,command=abou_t)
aboutbt.place(x=737, y= 425)
headLabel = Label(root,text=" HOSPITAL MANAGEMENT SYSTEM ",font=('arial
black',50),fg='red',bg='light green')
headLabel.place(x= 0,y = 20)
prBtn = Label(root,text="New Admission",font=('arial black',15),bg = "white")
prBtn.place(x= 205,y = 365)
docBtn = Label(root,text="Doctors",font=('arial black',15),bg = "white")
docBtn.place(x= 605,y = 365)
stBtn = Label(root,text="Staff",font=('arial black',15),bg = "white")
stBtn.place(x= 990,y = 365)
bedBtn = Label(root,text="Medical store",font=('arial black',15),bg = "white")
bedBtn.place(x= 404,y = 640)
aboutBtn = Label(root,text="About",font=('arial black',15),bg = "white")
aboutBtn.place(x=798 ,y = 640)
return root.mainloop()
PATIENT DETAILS PAGE
from tkinter import *
from tkinter import ttk
import pandas as pd
import mysql.connector as co
def openPage():
def search_doctor():
sc=Tk()
w = sc.winfo_screenwidth()
h = sc.winfo_screenheight()
geometry = "%dx%d+%d+%d" % (w, h, 0, 0)
sc.geometry(geometry)
sc.title('Search Patient')
# entry box for search customer
sc_box=Entry(sc,font=('arial',15))
sc_box.grid(row=0,column=1,padx=10,pady=10)
sc_label=Label(sc,text='Search Patient ',font=('arial',15))
sc_label.grid(row=1,column=0,padx=10,pady=10)
def update():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sql2 =""" UPDATE patient2 set p_name=%s,p_age=%s,p_gender=%s,p_height=
%s,p_weight=%s ,p_problem=%s,p_phoneno=%s WHERE p_id=%s """
u1=pid.get()
u2=pname.get()
u3=page.get()
u4=pgender.get()
u5=pheight.get()
u6= pweight.get()
u7= pproblem.get()
u8 = pphone.get()
inputs=(u1,u2,u3,u4,u5,u6,u7,u8)
c.execute(sql2 ,inputs)
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
con.commit()
sc.destroy()
def edit_now(id,index):
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sql2 = "SELECT* FROM patient2 WHERE p_id= %s"
name2 = (id, )
result =c.execute(sql2, name2)
result=c.fetchall()
index +=1
# LABEL FOR ENTRY
Label(sc, text="Patient Appointment No:",font=('arial',15)).grid(row=index+1,
column=0, sticky=W,pady=5)
Label(sc, text="Patient Name:",font=('arial',15)).grid(row=index+2, column=0,
sticky=W,pady=5)
Label(sc, text="Patient Name:", font=('arial', 15)).grid(row=index + 3, column=0,
sticky=W,pady=5)
Label(sc, text="Patient Gender:",font=('arial',15)).grid(row=index+4, column=0,
sticky=W,pady=5)
Label(sc, text="Patient Height:",font=('arial',15)).grid(row=index+5, column=0,
sticky=W, pady=5)
Label(sc, text="Patient Weight:",font=('arial',15)).grid(row=index+6, column=0,
sticky=W, pady=5)
Label(sc, text="Patient Problem:",font=('arial',15)).grid(row=index+7, column=0,
sticky=W, pady=5)
Label(sc, text="Patient Phone:",font=('arial',15)).grid(row=index+8, column=0,
sticky=W,pady=5)
# for entry boxes
global pid
pid = Entry(sc,font=('arial',15))
pid.grid(row=index+1, column=1, pady=5)
pid.insert(0, result[0][0])
global pname
pname = Entry(sc,font=('arial',15))
pname.grid(row=index+2, column=1, pady=5)
pname.insert(0, result[0][1])
global page
page = Entry(sc,font=('arial',15))
page.grid(row=index+3, column=1, pady=5)
page.insert(0, result[0][2])
global pgender
pgender = Entry(sc,font=('arial',15))
pgender.grid(row=index+4, column=1, pady=5)
pgender.insert(0, result[0][3])
global pheight
pheight = Entry(sc,font=('arial',15))
pheight.grid(row=index+5, column=1, pady=5)
pheight.insert(0, result[0][4])
global pweight
pweight = Entry(sc,font=('arial',15))
pweight.grid(row=index+6, column=1, pady=5)
pweight.insert(0, result[0][5])
global pproblem
pproblem = Entry(sc,font=('arial',15))
pproblem.grid(row=index+7, column=1, pady=5)
pproblem.insert(0, result[0][6])
global pphone
pphone = Entry(sc,font=('arial',15))
pphone.grid(row=index+8, column=1, pady=5)
pphone.insert(0, result[0][7])
save_rec=Button(sc,text='Update Record',command=update,font=('arial',15))
save_rec.grid(row=index+9,column=1)
def search_now():
selected=vc.get()
if selected =="Search by...":
test=Label(sc,text='Blank Filed')
test.grid(row=3,column=0)
if selected=="ID NO":
sql = "SELECT* FROM patient2 WHERE p_id=%s"
if selected=="Patient Name":
sql = "SELECT* FROM patien2 WHERE p_name =%s"
searched = sc_box.get()
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
name = (searched,)
result = c.execute(sql, name)
result = c.fetchall()
if not result:
result = 'record not found'
searched_label=Label(sc,text=result,font=('arial black',40))
searched_label.grid(row=2,colum=0,padx=10,columnspan=2)
else:
for index ,x in enumerate(result):
num=0
index+=2
id_reference=str(x[0])
edit_button=Button(sc,text='Edit',command=lambda:edit_now(id_reference,index),font=('arial',15))
edit_button.grid(row=index,column=num)
for y in x :
searched_label=Label(sc,text=y,font=('arial',15))
searched_label.grid(row=index,column=num+1)
num+=2
#drop down box
Label(sc,text='Input Here',font=('arial',15)).grid(row=0,column=0)
vc=ttk.Combobox(sc,font=('arial',15), value=["Search by...","ID NO","Patient Name",])
vc.current(0)
vc.grid(row=0,column=2)
op=Button(sc, text="Search Pateint",font=('arial',15), command=search_now)
op.grid(row=1, column=0,padx=0)
sc.mainloop()
def po_cd():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sql = "INSERT INTO
patient2(p_id,p_name,p_age,p_gender,p_height,p_weight,p_problem,p_phoneno) VALUES(%s,%s,
%s,%s,%s,%s,%s,%s)"
er=(pid.get(), pname.get(), page.get(), pgender.get(), pheight.get(), pweight.get(),
pproblem.get(), pphone.get())
c.execute(sql, er)
con.commit()
def clr_fil():
pid.delete(0, END)
pname.delete(0, END)
page.delete(0, END)
pgender.delete(0, END)
pheight.delete(0, END)
pweight.delete(0, END)
pproblem.delete(0, END)
pphone.delete(0, END)
def list_pat():
rt = Tk()
rt.title('PATIENT LIST')
w = rt.winfo_screenwidth()
h = rt.winfo_screenheight()
geometry = "%dx%d+%d+%d" % (w, h, 0, 0)
rt.geometry(geometry)
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
df = pd.read_sql(' SELECT * FROM patient2', con)
frame=Frame(rt)
frame.pack(fill=BOTH,expand=1)
canv_as=Canvas(frame)
canv_as.pack(side=LEFT,fill=BOTH,expand=1)
sbar1=ttk.Scrollbar(frame,orient=VERTICAL,command=canv_as.yview)
sbar1.pack(side=RIGHT,fill=Y)
canv_as.configure(yscrollcommand=sbar1.set)
canv_as.bind('<Configure>',lambda e: canv_as.configure(scrollregion=canv_as.bbox('all')))
second_frame=Frame(canv_as)
canv_as.create_window((0,0),window=second_frame,anchor='nw')
l2 = Label(second_frame, text=df, font=("consolas", 24), bg='white', fg="black")
l2.pack()
rt.mainloop()
fd = Toplevel()
w = fd.winfo_screenwidth()
h = fd.winfo_screenheight()
geometry="%dx%d+%d+%d"%(w,h,0,0)
fd.geometry(geometry)
title_label = Label(fd, text=" ENTER PATIENT DETAILS ", font=("arial black", 50), fg="red",
bg="light green")
title_label.grid(row=0, column=0,pady=10)
#label adding frame for entry and label
frame2=LabelFrame(fd)
frame2.grid(row=1,column=0,pady=20)
Label(frame2, text="Patient Appointment No:",font=('arial',25)).grid(row=1, column=0, sticky=W,
padx=80,pady=5)
Label(frame2, text="Patient Name:",font=('arial',25)).grid(row=2, column=0, sticky=W,
padx=80,pady=5)
Label(frame2, text="Patient Age:",font=('arial',25)).grid(row=3, column=0, sticky=W,
padx=80,pady=5)
Label(frame2, text="Patient Gender:",font=('arial',25)).grid(row=4, column=0, sticky=W,
padx=80,pady=5)
Label(frame2, text="Patient Height(cm):",font=('arial',25)).grid(row=5, column=0, sticky=W,
padx=80,pady=5)
Label(frame2, text="Patient Weight(kg):",font=('arial',25)).grid(row=6, column=0, sticky=W,
padx=80,pady=5)
Label(frame2, text="Patient Problem:",font=('arial',25)).grid(row=7, column=0, sticky=W,
padx=80,pady=5)
Label(frame2, text="Patient Phone:",font=('arial',25)).grid(row=8, column=0, sticky=W,
padx=80,pady=5)
#entry
pid = Entry(frame2,font=('arial',25))
pid.grid(row=1, column=1, pady=5,padx=10)
pname = Entry(frame2,font=('arial',25))
pname.grid(row=2, column=1, pady=5,padx=10)
page = Entry(frame2,font=('arial',25))
page.grid(row=3, column=1, pady=5,padx=10)
pgender = Entry(frame2,font=('arial',25))
pgender.grid(row=4, column=1, pady=5,padx=10)
pheight = Entry(frame2,font=('arial',25))
pheight.grid(row=5, column=1, pady=5,padx=10)
pweight = Entry(frame2,font=('arial',25))
pweight.grid(row=6, column=1, pady=5,padx=10)
pproblem = Entry(frame2,font=('arial',25))
pproblem.grid(row=7, column=1, pady=5,padx=10)
pphone = Entry(frame2,font=('arial',25))
pphone.grid(row=8, column=1, pady=5,padx=10)
####adding a frame1 for buttons
frame1 = LabelFrame(fd)
frame1.grid(row=2,column =0)
add_customer_button = Button(frame1, text="Add Patient ",font=('arial',17), command=po_cd,
padx=40, pady=10)
add_customer_button.grid(row=1, column=2)
clear_fields_button = Button(frame1, text="Clear field",font=('arial',17), command=clr_fil,
padx=40, pady=10)
clear_fields_button.grid(row=1, column=3)
but1=Button(frame1, text="Patient list",font=('arial',17) ,command=list_pat, padx=40, pady=10)
but1.grid(row=1, column=0)
but2=Button(frame1, text="Search/Edit Patient",font=('arial',17) ,command=search_doctor,
padx=10, pady=10)
but2.grid(row=1, column=1)
return fd.mainloop()
DOCTOR DETAILS PAGE
from tkinter import *
from tkinter import ttk
import pandas as pd
import mysql.connector as co
def thirdpage():
# for creating table in mysql
def search_doctor():
sc=Tk()
w = sc.winfo_screenwidth()
h = sc.winfo_screenheight()
geometry = "%dx%d+%d+%d" % (w, h, 0, 0)
sc.geometry(geometry)
sc.title('Search Doctor')
# entry box for search customer
sc_box=Entry(sc,font=('arial',15))
sc_box.grid(row=0,column=1,padx=10,pady=10)
sc_label=Label(sc,text='Search Doctor',font=('arial',15))
sc_label.grid(row=1,column=0,padx=10,pady=10)
#Button(sc, text="EXIT", command=sc.destroy).grid(row=12, column=0)
def update():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sql2 =""" UPDATE doctor2 SET d_name=%s,d_age=%s,d_dept=%s,d_phone=%s WHERE
d_id=%s """
u1=did1.get()
u2=dname1.get()
u3=dage1.get()
u4=ddept1.get()
u5=dphn1.get()
inputs=(u1,u2,u3,u4,u5)
c.execute(sql2 ,inputs)
con.commit()
sc.destroy()
def edit_now(id,index):
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sql2 = "SELECT* FROM doctor2 WHERE d_id= %s"
name2 = (id, )
result =c.execute(sql2, name2)
result=c.fetchall()
print(result)
index +=1
# LABEL FOR ENTRY
lab_1 = Label(sc, text="Doctor ID", font=('arial', 15))
lab_1.grid(row=index+1, column=0, pady=10,sticky=W)
Label(sc, text="First Name", font=('arial', 15)).grid(row=index+2,
sticky=W ,column=0,pady=10)
Label(sc, text="Doctor Age", font=('arial', 15)).grid(row=index+3, sticky=W,column=0,
pady=10)
Label(sc, text="Doctor Department", font=('arial', 15)).grid(row=index+4 ,sticky=W,
column=0, pady=10)
Label(sc, text="Doctor phone number", font=('arial', 15)).grid(row=index+5, sticky=W,
column=0, pady=10)
# for entry boxes
global did1
did1 = Entry(sc,font=('arial',15))
did1.grid(row=index+1, column=1, pady=10)
did1.insert(0,result[0][0])
global dname1
dname1 = Entry(sc, font=('arial ', 15))
dname1.grid(row=index+2, column=1, pady=10)
dname1.insert(0,result[0][1])
global dage1
dage1 = Entry(sc, font=('arial ', 15))
dage1.grid(row=index+3, column=1, pady=10)
dage1.insert(0,result[0][2])
global ddept1
ddept1 = Entry(sc, font=('arial ', 15))
ddept1.grid(row=index+4, column=1, pady=10)
ddept1.insert(0, result[0][3])
global dphn1
dphn1 = Entry(sc, font=('arial ', 15))
dphn1.grid(row=index+5, column=1, pady=10)
dphn1.insert(0,result[0][4])
save_rec=Button(sc,text='Update Record',command=update,font=('arial',15))
save_rec.grid(row=index+6,column=1)
def search_now():
selected=vc.get()
if selected =="Search by...":
test=Label(sc,text='Blank Filed')
test.grid(row=3,column=0)
if selected=="ID NO":
sql = "SELECT* FROM doctor2 WHERE d_id=%s"
if selected=="Doctor Name":
sql = "SELECT* FROM doctor2 WHERE d_name =%s"
searched = sc_box.get()
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
name = (searched,)
result = c.execute(sql,name)
result = c.fetchall()
if not result:
result = 'record not found'
searched_label=Label(sc,text=result,font=('arial black',40))
searched_label.grid(row=2,colum=0,padx=10,columnspan=2)
else:
for index ,x in enumerate(result):
num=0
index+=2
id_reference=str(x[0])
edit_button=Button(sc,text='Edit',command=lambda:edit_now(id_reference,index),font=('arial',15))
edit_button.grid(row=index,column=num)
for y in x :
searched_label=Label(sc,text=y,font=('arial',15))
searched_label.grid(row=index,column=num+1)
num+=2
#drop down box
Label(sc,text='Input Here',font=('arial',15)).grid(row=0,column=0)
vc=ttk.Combobox(sc,font=('arial',15), value=["Search by...","ID NO","Doctor Name"])
vc.current(0)
vc.grid(row=0,column=2)
op=Button(sc, text=" Search Doctor",font=('arial',15), command=search_now)
op.grid(row=1, column=0,padx=0)
sc.mainloop()
def do_cd():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
op = "INSERT INTO doctor2(d_id,d_name,d_age,d_dept,d_phone) VALUES(%s,%s,%s,%s,
%s)"
value = (did.get(), dname.get(), dage.get(), ddept.get(), dphn.get())
c.execute(op, value)
con.commit()
def clr_fil():
did.delete(0, END)
dname.delete(0, END)
dage.delete(0, END)
ddept.delete(0, END)
dphn.delete(0, END)
def list_doc():
rt=Tk()
w = rt.winfo_screenwidth()
h = rt.winfo_screenheight()
geometry = "%dx%d+%d+%d" % (w, h, 0, 0)
rt.geometry(geometry)
# for frame
# and to create canvas
frame=Frame(rt)
frame.pack(fill=BOTH,expand=1)
canv_as=Canvas(frame)
canv_as.pack(side=LEFT,fill=BOTH,expand=1)
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
df = pd.read_sql(' SELECT * FROM doctor2',con)
#for scrollbar and frame
sbar1=ttk.Scrollbar(frame,orient=VERTICAL,command=canv_as.yview)
sbar1.pack(side=RIGHT,fill=Y)
canv_as.configure(yscrollcommand=sbar1.set)
canv_as.bind('<Configure>',lambda e: canv_as.configure(scrollregion=canv_as.bbox('all')))
second_frame=Frame(canv_as)
canv_as.create_window((0,0),window=second_frame,anchor='nw')
l2 = Label(second_frame, text=df, font=("consolas", 30), bg="white", fg="black")
l2.pack()
rt.mainloop()
hj = Toplevel()
w = hj.winfo_screenwidth()
h = hj.winfo_screenheight()
geometry="%dx%d+%d+%d"%(w,h,0,0)
hj.geometry(geometry)
hj.config(bg = "white")
title_label = Label(hj,text=" ENTER DOCTOR DETAILS ", font=("arial black", 50),
fg="red", bg="light green")
title_label.grid(row=0, column=0 ,pady=20)
frame2=LabelFrame(hj)
frame2.grid(row=1, column=0,pady=20)
# LABEL FOR ENTRY
lab_1=Label(frame2, text="Doctor ID",font=('arial',25))
lab_1.grid(row=1, column=0, sticky=W, padx=80,pady=10)
Label(frame2, text="First Name",font=('arial',25)).grid(row=2, column=0, sticky=W,
padx=80,pady=10)
Label(frame2, text="Doctor Age",font=('arial',25)).grid(row=3, column=0, sticky=W,
padx=80,pady=10)
Label(frame2, text="Doctor Department",font=('arial',25)).grid(row=4, column=0, sticky=W,
padx=80,pady=10)
Label(frame2, text="Doctor phone number",font=('arial',25)).grid(row=5, column=0, sticky=W,
padx=80,pady=10)
# for entry boxes
did = Entry(frame2,font=('arial ',25))
did.grid(row=1, column=1,padx=80, pady=10)
dname = Entry(frame2,font=('arial ',25))
dname.grid(row=2, column=1,padx=80, pady=10)
dage = Entry(frame2,font=('arial ',25))
dage.grid(row=3, column=1,padx=80, pady=10)
ddept = Entry(frame2,font=('arial ',25))
ddept.grid(row=4, column=1,padx=80, pady=10)
dphn = Entry(frame2,font=('arial ',25))
dphn.grid(row=5, column=1,padx=80, pady=10)
frame = LabelFrame(hj)
frame.grid(row=2,column =0,pady=20)
add_customer_button = Button(frame, text="Add Doctor ", font=('arial', 17),
command=do_cd,padx=30,pady=10)
add_customer_button.grid(row=1, column=2)
clear_fields_button = Button(frame, text="Clear Field", font=('arial', 17),
command=clr_fil,padx=5,pady=10)
clear_fields_button.grid(row=1, column=3)
but1=Button(frame, text= " Doctors list ",font=('arial',17),
command=list_doc,padx=5,pady=10)
but1.grid(row=1, column=0)
but3=Button(frame, text= "Search/Edit Doctor", font=('arial',17),
command=search_doctor,padx=5,pady=10)
but3.grid(row=1, column=1)
return hj.mainloop()
STAFF DETAILS PAGE
from tkinter import *
from tkinter import ttk
import pandas as pd
import mysql.connector as co
def fourthpage():
def search_worker():
sc=Tk()
w = sc.winfo_screenwidth()
h = sc.winfo_screenheight()
geometry = "%dx%d+%d+%d" % (w, h, 0, 0)
sc.geometry(geometry)
sc.title('Search Staff')
# entry box for search customer
sc_box=Entry(sc,font=('arial',15))
sc_box.grid(row=0,column=1,padx=10,pady=10)
sc_label=Label(sc,text='Search Staff',font=('arial',15))
sc_label.grid(row=1,column=0,padx=10,pady=10)
#Button(sc, text="EXIT", command=sc.destroy).grid(row=12, column=0)
def update():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sql2 =""" UPDATE worker SET w_name=%s,w_age=%s,w_gender=%s,w_work=
%s,w_phone=%s WHERE w_id=%s """
u1=wid.get()
u2=wname.get()
u3=wage.get()
u4=wgender.get()
u5=wwork.get()
u6=wphone.get()
inputs=(u1,u2,u3,u4,u5,u6)
c.execute(sql,inputs)
con.commit()
sc.destroy()
def edit_now(id,index):
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sql2 = "SELECT* FROM worker WHERE w_id= %s"
name2 = (id, )
result =c.execute(sql2, name2)
result=c.fetchall()
print(result)
index +=1
# LABEL FOR ENTRY
Label(sc, text=" Worker ID: ",font=('arial ',15)).grid(row=index+1, column=0,
sticky=W,pady=10)
Label(sc, text=" Worker Name: ",font=('arial ',15)).grid(row=index+2, column=0,
sticky=W,pady=10)
Label(sc, text=" Worker Age: ",font=('arial ',15)).grid(row=index+3, column=0,
sticky=W, pady=10)
Label(sc, text=" Worker gender: ",font=('arial ',15)).grid(row=index+4, column=0,
sticky=W,pady=10)
Label(sc, text=" Worker Work: ",font=('arial ',15)).grid(row=index+5, column=0,
sticky=W, pady=10)
Label(sc, text=" Worker Phone Number: ",font=('arial ',15)).grid(row=index+6,
column=0, sticky=W, pady=10)
global wid
wid = Entry(sc,font=('arial ',15))
wid.grid(row=index+1, column=1, pady=5)
wid.insert(0,result[0][0])
global wname
wname = Entry(sc,font=('arial ',15))
wname.grid(row=index+2, column=1, pady=5)
wname.insert(0,result[0][1])
global wage
wage = Entry(sc,font=('arial ',15))
wage.grid(row=index+3, column=1, pady=5 )
wage.insert(0,result[0][2])
global wgender
wgender = Entry(sc,font=('arial ',15))
wgender.grid(row=index+4, column=1, pady=5)
wgender.insert(0,result[0][3])
global wwork
wwork = Entry(sc,font=('arial ',15))
wwork.grid(row=index+5, column=1, pady=5)
wwork.insert(0,result[0][4])
global wphone
wphone = Entry(sc,font=('arial ',15))
wphone.grid(row=index+6, column=1, pady=5)
wphone.insert(0,result[0][5])
save_rec=Button(sc,text='Update Record',command=update,font=('arial',15))
save_rec.grid(row=index+7,column=1)
def search_now():
selected=vc.get()
if selected =="Search by...":
test=Label(sc,text='Blank Filed')
test.grid(row=3,column=0)
if selected=="Id No":
sql = "SELECT* FROM worker WHERE w_id=%s"
if selected=="Staff Name":
sql = "SELECT* FROM worker WHERE w_name =%s"
searched = sc_box.get()
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
name = (searched,)
result = c.execute(sql,name)
result = c.fetchall()
if not result:
result = 'record not found'
searched_label=Label(sc,text=result,font=('arial black',40))
searched_label.grid(row=2,colum=0,padx=10,columnspan=2)
else:
edit_button=Button(sc,text='Edit',command=lambda:edit_now(id_reference,index),font=('arial',15))
edit_button.grid(row=index,column=num)
for y in x :
searched_label=Label(sc,text=y,font=('arial',15))
searched_label.grid(row=index,column=num+1)
num+=2
#drop down box
Label(sc,text='Input Here',font=('arial',15)).grid(row=0,column=0)
vc=ttk.Combobox(sc,font=('arial',15), value=["Search by...","Id No","Staff Name"])
vc.current(0)
vc.grid(row=0,column=2)
op=Button(sc, text=" Search Staff",font=('arial',15), command=search_now)
op.grid(row=1, column=0,padx=0)
sc.mainloop()
def do_cd():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sl = "INSERT INTO worker(w_id,w_name,w_age,w_gender,w_work,w_phone) VALUES(%s,
%s,%s,%s,%s,%s)"
var = (wid.get(), wname.get(), wage.get(), wgender.get(), wwork.get(), wphone.get())
c.execute(sl, var)
con.commit()
def clr_fil():
wid.delete(0, END)
wname.delete(0, END)
wage.delete(0, END)
wgender.delete(0, END)
wwork.delete(0, END)
wphone.delete(0, END)
def list_doc():
rt = Toplevel()
rt.title('Staff LIST')
w = rt.winfo_screenwidth()
h = rt.winfo_screenheight()
geometry = "%dx%d+%d+%d" % (w, h, 0, 0)
rt.geometry(geometry)
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
df = pd.read_sql(' SELECT * FROM worker',con)
frame=Frame(rt)
frame.pack(fill=BOTH,expand=1)
canv_as=Canvas(frame)
canv_as.pack(side=LEFT,fill=BOTH,expand=1)
sbar1=ttk.Scrollbar(frame,orient=VERTICAL,command=canv_as.yview)
sbar1.pack(side=RIGHT,fill=Y)
canv_as.configure(yscrollcommand=sbar1.set)
canv_as.bind('<Configure>',lambda e: canv_as.configure(scrollregion=canv_as.bbox('all')))
second_frame=Frame(canv_as)
canv_as.create_window((0,0),window=second_frame,anchor='nw')
l2 = Label(second_frame, text=df, font=("consolas", 30), fg="black", bg="white")
l2.pack()
rt.mainloop()
hj = Toplevel()
w = hj.winfo_screenwidth()
h = hj.winfo_screenheight()
geometry="%dx%d+%d+%d"%(w,h,0,0)
hj.geometry(geometry)
hj.config(bg = "white")
title_label = Label(hj,text=" ENTER STAFF DETAILS ", font=("arial black", 50),
fg="red", bg="light green")
title_label.grid(row=0, column=0 ,pady=20)
frame=LabelFrame(hj)
frame.grid(row=1, column=0,pady=20)
# LABEL FOR ENTRY
Label(frame, text=" Worker ID: ",font=('arial ',25)).grid(row=1, column=0, sticky=W,
padx=10,pady=10)
Label(frame, text=" Worker Name: ",font=('arial ',25)).grid(row=2, column=0, sticky=W,
padx=10,pady=10)
Label(frame, text=" Worker Age: ",font=('arial ',25)).grid(row=3, column=0, sticky=W,
padx=10,pady=10)
Label(frame, text=" Worker gender: ",font=('arial ',25)).grid(row=4, column=0, sticky=W,
padx=10,pady=10)
Label(frame, text=" Worker Work: ",font=('arial ',25)).grid(row=5, column=0, sticky=W,
padx=10,pady=10)
Label(frame, text=" Worker Phone Number: ",font=('arial ',25)).grid(row=6, column=0,
sticky=W, padx=10,pady=10)
###entry box
# for entry boxes
wid = Entry(frame,font=('arial ',25))
wid.grid(row=1, column=1, pady=5, padx=10)
wname = Entry(frame,font=('arial ',25))
wname.grid(row=2, column=1, pady=5, padx=10)
wage = Entry(frame,font=('arial ',25))
wage.grid(row=3, column=1, pady=5, padx=10)
wgender = Entry(frame,font=('arial ',25))
wgender.grid(row=4, column=1, pady=5, padx=10)
wwork = Entry(frame,font=('arial ',25))
wwork.grid(row=5, column=1, pady=5, padx=10)
wphone = Entry(frame,font=('arial ',25))
wphone.grid(row=6, column=1, pady=5, padx=10)
frame2 = LabelFrame(hj)
frame2.grid(row=2,column =0,pady=20)
add_customer_button = Button(frame2, text="Add Staff ",font=('arial',17),command=do_cd,
padx=20, pady=10)
add_customer_button.grid(row=1, column=4)
search_button = Button(frame2, text="Search/Edit
Staff",font=('arial',17),command=search_worker, padx=20, pady=10)
search_button.grid(row=1, column=2)
clear_fields_button = Button(frame2, text="Clear Field ",font=('arial',17), command=clr_fil,
padx=20, pady=10)
clear_fields_button.grid(row=1, column=3)
Table=Button(frame2, text="Staff List",font=('arial',17),command=list_doc, padx=20, pady=10)
Table.grid(row=1, column=1)
return hj.mainloop()
MEDICINE LIST PAGE
from tkinter import *
import mysql.connector as co
import pandas as pd
from tkinter import ttk
def sixthpage():
root = Toplevel()
w = root.winfo_screenwidth()
h = root.winfo_screenheight()
geometry="%dx%d+%d+%d"%(w,h,0,0)
root.geometry(geometry)
root.config(bg = "white")
def search_doctor():
sc=Tk()
w = sc.winfo_screenwidth()
h = sc.winfo_screenheight()
geometry = "%dx%d+%d+%d" % (w, h, 0, 0)
sc.geometry(geometry)
sc.title('Search Medicine')
# entry box for search customer
sc_box=Entry(sc,font=('arial',15))
sc_box.grid(row=0,column=1,padx=10,pady=10)
sc_label=Label(sc,text='Search Medicine')
sc_label.grid(row=1,column=0,padx=10,pady=10)
def update():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sql=""" UPDATE stock SET m_name=%s,dateofexpiry=%s,quantity=%s,price=%s WHERE
mcode=%s """
u1=did1.get()
u2=dname1.get()
u3=dage1.get()
u4=ddept1.get()
u5=dphn1.get()
inputs=(u1,u2,u3,u4,u5)
c.execute(sql,inputs)
con.commit()
sc.destroy()
def edit_now(id,index):
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
sql2 = "SELECT* FROM stock WHERE mcode= %s"
name2 = (id, )
result =c.execute(sql2, name2)
result=c.fetchall()
index +=1
# LABEL FOR ENTRY
Label(sc, text="Serial Number:", font=('arial', 15)).grid(row=index+1, column=0,
sticky=W ,pady=10)
Label(sc, text="Medicine Name:", font=('arial', 15)).grid(row=index+2, column=0,
sticky=W,pady=10)
Label(sc, text="Date of Expiry Of Medicine:", font=('arial', 15)).grid(row=index+3,
column=0, sticky=W,pady=10)
Label(sc, text="Quantity Of Medicine:", font=('arial', 15)).grid(row=index+4, column=0,
sticky=W, pady=10)
Label(sc, text="Price Of Medicine:", font=('arial', 15)).grid(row=index+5, column=0,
sticky=W, pady=10)
edit_button=Button(sc,text='Edit',command=lambda:edit_now(id_reference,index),font=('arial',15))
edit_button.grid(row=index,column=num
for y in x :
searched_label=Label(sc,text=y,font=('arial',15))
searched_label.grid(row=index,column=num+1)
num+=2
but1=Button(frame1,image=medicine,font=('arial',28),command=addstock,height=200,width=200,b
g='white',borderwidth=0)
but1.grid(row=0,column=1,padx=20,pady=20)
but2=Button(frame1,image=med,font=('arial',28),command=sortmedicine,bg='white',borderwidth=0
)
but2.grid(row=0,column=2,padx=50,pady=20)
but3= Button(frame1, image=search, font=('arial', 28), command=search_doctor,
bg='white',borderwidth=0)
but3.grid(row=0, column=3, padx=20, pady=20)
#label for image
l1=Label(frame1, text="Add Medicine", font=('arial', 25),borderwidth=0)
l1.grid(row=1, column=1, padx=20, pady=20)
l2=Label(frame1, text="List of Medicine", font=('arial', 25))
l2.grid(row=1, column=2, padx=50, pady=20)
l3=Label(frame1, text="Search", font=('arial', 25))
l3.grid(row=1, column=3, padx=20,pady=20)
#but3=Button(root,text=df2)
return root.mainloop()
ACKNOWLEDGEMENT PAGE
from tkinter import *
import mysql.connector as co
def seventhpage():
root = Toplevel()
w = root.winfo_screenwidth()
h = root.winfo_screenheight()
geometry="%dx%d+%d+%d"%(w,h,0,0)
root.geometry(geometry)
root.config(bg = "white")
root.title('Acknowledgement')
def thanksgiving():
tk = Tk()
w = 700
h = 400
geometry = "%dx%d+%d+%d" % (w, h, 320, 150)
tk.geometry(geometry)
tk.title('Thank You')
Label(tk, text='I Would Like To Thanks DMP SIR',font=('Lucida
Calligraphy',20,'bold')).pack()
Label(tk, text='Codemy.com(YouTube)',font=('Lucida Calligraphy', 20,'bold')).pack()
Label(tk, text='Ajay Kaushdan(Friend)', font=('Lucida Calligraphy', 20,'bold')).pack()
Label(tk, text='Kevin Monpara(Friend))',font=('Lucida Calligraphy',20,'bold')).pack()
Label(tk, text='Namra Mangukiya(Friend)',font=('Lucida Calligraphy',20,'bold')).pack()
Label(tk, text='Brilliant Minds By Neeru(Youtube)',font=('Lucida Calligraphy',
20,'bold')).pack()
Label(tk, text=' To Make This Project Beautifull',font=('Lucida
Calligraphy',20,'bold')).pack()
tk.mainloop()
def abtp():
tk = Tk()
w = 700
h = 400
geometry = "%dx%d+%d+%d" % (w, h, 320, 150)
tk.geometry(geometry)
tk.title('Project Overview')
Label(tk,text='This project is divided into Four parts, ',font=('Lucida
Calligraphy',20,'bold')).pack()
Label(tk,text='First part tells about the Patient Details,',font=('Lucida
Calligraphy',20,'bold')).pack()
Label(tk,text='Second part tells about the Doctor Details,',font=('Lucida
Calligraphy',20,'bold')).pack()
Label(tk, text='Third part tells about the Staff Details,',font=('Lucida
Calligraphy',20,'bold')).pack()
Label(tk, text='Fourth part about the different ',font=('Lucida Calligraphy',20,'bold')).pack()
Label(tk, text=' types of Medicine Available. ',font=('Lucida Calligraphy',20,'bold')).pack()
tk.mainloop()
def prerequisite():
fd = Toplevel()
w = 500
h = 500
geometry = "%dx%d+%d+%d" % (w, h, 320, 150)
fd.geometry(geometry)
fd.title('Prerequisite For project')
def databas():
con = co.connect(host='localhost', user='root', passwd='beradi')
c = con.cursor()
c.execute("CREATE DATABASE devbera")
def pat():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
c.execute("CREATE TABLE patient2(p_id INT(4) primary key,p_name VARCHAR(70),
p_age INT(4),p_gender VARCHAR(15),p_height INT(4),p_weight INT(4),p_problem
VARCHAR(250),p_phoneno BIGINT(15))")
def med():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
c.execute("CREATE TABLE stock(mcode INT(4) primary key,m_name
VARCHAR(82),dateofexpiry DATE,quantity INT(80),price BIGINT(15))")
def doc1():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
c.execute( "CREATE TABLE doctor2(d_id INT(4) primary key,d_name
VARCHAR(82),d_age INT(4),d_dept VARCHAR(80),d_phone BIGINT(15))")
def worker():
con = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
c = con.cursor()
c.execute("CREATE TABLE worker(w_id INT(4) primary key,w_name
VARCHAR(85),w_age INT(4),w_gender VARCHAR(75),w_work VARCHAR(85),w_phone BIGINT(15))")
but5 = Button(fd, text="Create Database", font=('arial', 17), command=databas, padx=40,
pady=10,height=2, width=20)
but5.pack()
but1=Button(fd,text="Create patient table", font=('arial', 17),command=pat, padx=40,
pady=10,height=2,width=20)
but1.pack()
but2=Button(fd,text='Create Medicine Table',font=('arial', 17),command=med, padx=40,
pady=10,height=2,width=20)
but2.pack()
but3=Button(fd,text='Create Doctor Table',font=('arial',
17),command=doc1,padx=40,pady=10,height=2,width=20)
but3.pack()
but4=Button(fd, text="Create Staff Table", font=('arial', 17), command=worker, padx=40,
pady=10,height=2,width=20)
but4.pack()
fd.mainloop()
## create buttons for frame
lab1=Label(root,text=' Acknowledgement ',font=('arial
black',50),pady=20,fg='red',bg='light green')
lab1.pack()
but1=Button(root,text='Prerequisite For project',font=('arial ',25),command=
prerequisite,bg='white',height=2,width=20,pady=20)
but1.pack()
but2 = Button(root, text='Acknowledgement',font=('arial
',25),command=thanksgiving,bg='white',height=2,width=20,pady=20)
but2.pack()
but3= Button(root,text='Details of Project',font=('arial
',25),command=abtp,bg='white',height=2,width=20,pady=20)
but3.pack()
return root.mainloop()
TO RUN THE CODE PAGE
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
import pandas as pd
import mysql.connector as co
import login as l
global mydb
mydb = co.connect(host='localhost', user='root', passwd='beradi', database='devbera')
l.openLogin()
OUTPUT SCREENSHOT
• Run the Program TO RUN THE CODE.py
2.)Keep all Image in same folder where the py. program is exist.
• www.youtube.com
x-x-x-x-x