12:31 PM ((-) l 70 (27
Download as docx, pdf, or tet
NEED OF USER
Download to rea
SOURCE CODE
from sys import exit
import mysql.connector as sql
conn=sql.connect (host='localhost',user='root' ,passw=!',databa
se='project')
if conn. is connected () :
print(' successfully connected' )
c1=conn. cursor ()
print(
print ("HOSPITAL MANAGEMENT SYsTEM")
print( -')
print( "GOD WISHES YOU")
print ("1.LOGIN")
print ("2.EXIT")
choice=int (input ("ENTER YOUR CHOICE:"))
i f choice==1:
ul=input ("enter user name:")
pwdl=input ("enter the pasSWord: ")
while ul='vasu' and pwdl=='vasu6072:
print ('connected')
print ("WELCOME TO HOSPITAL")
print ("successfully connected")
print('1. RegisteringPatient details')
print ('2.RegisteringDoctor details')
print ("'3.RegisteringWorker details')
Download to ree
U
12:31 PM -)) s 101 27
Download to rea
print ("4. total patient details")
print ("5. total doctor details")
print ("6. total worker details")
print (7.Patient detail' )
print(8.Doctor detail')
print(9.Worker detail')
print(10.Exit')
choice=int (input('ENTER YOUR CHOICE:'))
if choice==1:
P name=input (' Enter Patient Name:')
p age=int (input('Enter Age:'))
p problems=input ('Enter the Problem/Disease: )
P phono=int (input ('Enter Phone number:'))
sql insert="insert into patient details
values (""t "*p_name+","+str (p_age)
+","+pP_ problems+","tstr(p_phono) +") "
cl.execute (sql insert)
print ('SUCCESSFULLY REGISTERED' )
conn.commit()
elif choice==2:
d name=input ('Enter Doctor Name:)
d age=int (input('Enter Age:'))
d department=input (" Enter the Department:')
d phono=int (input('Enter Phone number:'))
Download torea
sql insert="insert into doctor details
12:31 PM () s S 459 (27
Download to rea
sql insert=" insert into doctor details
values ("" "*d name+","+str (d_ age)
+","+d department+","+str (d phono) +") "
cl. execute (sql insert)
print (' success fully registered' )
conn.commit()
elif choice=3:
W name=input ('Enter Worker Nane: )
w_age=int (input ('Enter Age: "))
w workname=input ('Enter type of work:')
w phono=int (input ('Enter Phone number:'))
sql insert=" insert into worker details
values (""* "+w name"',"+str (w age)
+","+w workname+","+str(w phono) +") "
cl.execute (sql insert)
print (' successfully registered' )
conn. commit ()
elif choice=4:
sql w=' select+from patient details
cl.execute (sql w)
r = cl.fetchall ()
for i in r :
print (i)
Download to rea
U
12:31 PM ((-) 25 27
r = cl.fetchall ()
for i in r :
print (i)
Download to rea
elif choice=5:
sql x="select*from doctor details"
cl.execute (sql x)
S=cl.fetchall()
for i in s:
print (1)
elif choice==6:
sql y="select*from workerdetails"
cl.execute (sql y)
t=cl.fetchall()
for i in t:
print (i)
elif choice==7:
h=input ("Enter the name: ")
sql w=' selecttfrom patient details where
p name= (") ") '.format (h)
c1.execute (sql w)
u= c1.fetchall ()
for i in u:
print (i)
elif choice=8:
d=input ("Enter the name:")
Download to rea
U
sql_d='select+ from doctor details where
p name= (")")'.format (d)
c1.execute (sql d)
v=cl.fetchall()
for i in v:
print (i)
elif choice==9:
f=input ("Enter the name: ")
sql f='select+ from worker details where
P_name= (")")'.format (f)
c1.execute (sql f)
w=cl.fetchall ()
for i in w:
print (i)
elif choice==10:
exit ()
break
else:
print('wrong username &pas sword')
if choice==2:
exit ()