Cs Pra-2
Cs Pra-2
ABOUT PROJECT
About python
Source code
Output screen
Conclusion
HARDWARE
REQUIREMENTS:
❖Operating System: - Windows 10 or
above
Software
Requirements :
❖Windows OS
About Python:
Python is a high-level, interpreted
programming language known for its
simplicity and versatility. It is widely
used for software development, data
analysis, artificial intelligence, and
more. In this project, Python is used
to interact with the MySQL database
and implement the hospital
management features
About MySQL
Connector:
MySQL Connector is a Python library
that facilitates connecting Python
applications to a MySQL database. It
provides a convenient way to perform
database operations such as creating
tables, inserting records, retrieving
data, and managing transactions
Source Code:
while(True):
print("""
================================
WELCOME TO MY HOSPITAL
================================
""")
import mysql.connector
mysql=mysql.connector.connect(host="localhost",user="root",p
assword="pugalmp@2008",database='hospital')
mycursor=mysql.cursor()
#creating database
mycursor.execute("use my_hospitals")
#printing option
while(True):
if r==2:
print("""=======================================!!!!!!!
PLEASE REGISTER YOURSELF!!!!!!!!
=======================================""")
mysql.commit()
print("""=======================================!!!!!!!!
REGISTERED SUCCESSFULLY!!!!!!!!
=======================================""")
elif r==1:
print("""==================================!!!!!!!!
{{SIGN IN }} !!!!!!!!!!
==================================""")
row=mycursor.fetchall()
for i in row:
a=list(i)
if a[0]==str(ps):
while(True):
if a==1:
if b==1:
if c==1:
mycursor.execute("select * from
doctor_details")
row=mycursor.fetchall()
for i in row:
b=0
v=list(i)
k=["NAME","SPECIALISATION","AGE","ADDRESS","CONTACT","F
EES","MONTHLY_SALARY"]
d=dict(zip(k,v))
print(d)
elif c==2:
mycursor.execute("select * from
nurse_details")
row=mycursor.fetchall()
for i in row:
v=list(i)
k=["NAME","SPECIALISATION","AGE","ADDRESS","CONTACT","
MONTHLY_SALARY"]
d=dict(zip(k,v))
print(d)
elif c==3:
mycursor.execute("select * from
other_workers_details")
row=mycursor.fetchall()
for i in row:
v=list(i)
k=["NAME","SPECIALISATION","AGE","ADDRESS","CONTACT","
MONTHLY_SALARY"]
d=dict(zip(k,v))
print(d)
elif b==2:
if c==1:
spe=input("ENTER SPECIALISATION:")
age=input("ENTER AGE:")
add=input("ENTER ADDRESS:")
fees=input("ENTER FEES:")
ms=input("ENTER MONTHLY_SALARY:")
#INSERTING VALUES ENTERED INTO THE
DOCTORS_TABLE
mysql.commit()
print("SUCCESSFULLY ADDED")
elif c==2:
age=input("ENTER AGE:")
add=input("ENTER ADDRESS:")
ms=int(input("ENTER MONTHLY_SALARY:"))
mysql.commit()
print("SUCCESSFULLY ADDED")
#for entering workers details
elif c1==3:
age=input("ENTER AGE:")
add=input("ENTER ADDRESS:")
ms=input("ENTER MONTHLY_SALARY:")
mycursor.execute("insert into
other_workers_details
values('"+name+"','"+age+"','"+add+"','"+cont+"','"+ms+"')")
mysql.commit()
print("SUCCESSFULLY ADDED")
elif b==3:
mycursor.execute("select * from
doctor_details where name=='"+name+"'")
row=mycursor.fetchall()
print(row)
if p=="y":
mycursor.execute("delete from
doctor_details where name='"+name+"'")
mysql.commit()
print("SUCCESSFULLY DELETED!!")
else:
print("NOT DELETED")
elif c==2:
mycursor.execute("select * nurse_details
where name=='"+name+"'")
row=mycursor.fetchall()
print(row)
if p=="y":
mycursor.execute("delete from
nurse_details where name='"+name+"'")
mysql.commit()
print("SUCCESSFULLY DELETED!!")
else:
print("NOT DELETED")
elif c==3:
mycursor.execute("select * from
workers_details wherename=='"+name+"'")
row=mycursor.fetchall()
print(row)
mycursor.execute("delete from
other_workers_details where name='"+name+"'")
mysql.commit()
print("SUCCESSFULLY DELETED!!")
else:
print("NOT DELETED")
if b==4:
break
elif a==2:
if b==1:
mycursor.execute("select * from
patient_details")
row=mycursor.fetchall()
for i in row:
b=0
v=list(i)
k=["NAME","SEX","AGE","ADDRESS","CONTACT"]
d=dict(zip(k,v))
print(d)
elif b==2:
address=str(input("ADDRESS: "))
mycursor.execute("select * from
patient_details")
for i in mycursor:
v=list(i)
k=['NAME','SEX','AGE','ADDRESS','CONTACT']
print(dict(zip(k,v)))
print("""====================================!!!!!!!
REGISTERED SUCCESSFULLY!!!!!!
====================================""")
elif b==3:
mycursor.execute("select * from
patient_details where name='"+name+"'")
row=mycursor.fetchall()
print(row)
if bill=="y":
mycursor.execute("delete from
patient_details where name='"+name+"'")
mysql.commit()
elif b==4:
break
###SIGN OUT
elif a==3:
break
else:
break
OUTPUT: