0% found this document useful (0 votes)
24 views34 pages

Computer Science Project

Computer science project cover to have the

Uploaded by

yuvashree.b B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views34 pages

Computer Science Project

Computer science project cover to have the

Uploaded by

yuvashree.b B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

INDEX

S.NO TOPIC PG.NO

1 ABSTRACT 01

2 HARDWARE AND SOFTWARE 02


REQUIREMENTS

3 DEVELOPMENT TOOLS AND 03


TECHNOLOGY

4 PURPOSE OF THE PROJECT 09

5 ADVANTAGES 10

6 SOURCE CODE 11

7 OUTPUT 23

8 CONCLUSION 29

9 BIBLIOGRAPHY 30
ABSTRACT

The project Hospital Management System includes registration of


patients, storing their details into the system. The software has the
facility to give a unique id for every patient and stores the details of
every patient and the staff automatically. It includes a search facility
to know the current status of each room. User can search availability
of a doctor and the details of a patient using the id. The Hospital
Management System can be entered using a username and password.
It is accessible either by an administrator or receptionist. Only they
can add data into the database. The data can be retrieved easily. The
interface is very user-friendly. The data are well protected for personal
use and makes the data processing very fast. The purpose of the
project entitled as “HOSPITAL MANAGEMENT SYSTEM” is to
computerize the Front Office Management of Hospital to develop
software which is user friendly, simple, fast, and cost-effective. It
deals with the collection of patient’s information, diagnosis details,
etc., and also to manipulate these details meaningfully System input
contains patient details, diagnosis details; while system output is to
get these details on to the screen.
HARDWARE AND SOFTWARE SPECIFICATIONS:

HARDWARE:
1. Processor : 12th Gen Intel(R) Core (TM) i5-1235U 1.30 GHz
2. Installed RAM : 8.00 GB (7.69 GB usable)
3. System type : 64-bit operating system, x64-based processor
4. Edition : Windows 11 Home Single Language

SOFTWARE:
1. IDLE(Python 3.12 64-bit)
2. Mysql 8.0 Command line client
DEVELOPMENT TOOLS AND TECHNOLOGIES:
WHY MySQL?

• Data security
• On-Demand Scalability
• High Performance
• Round the clock uptime
• Comprehensive transactional support
• Complete workflow control
• Reduced total cost of ownership
• The flexibility of open source
MODULE USED:

• Mysql.connector –

Enables python programs to access MySQL


database.
It retrieves data from a database using a
query. In the data Centre, you can access the connector
page for this and other database in the toolbar at the top
of the window. You connect to your MySQL database in
the Data Centre.
The MySQL connector module is a tool that
allows Python programs to connect to MySQL databases.
METHODS USED:

1.Creating a cursor object

It is a useful control structure of database connectivity. It


will let us execute all the queries we need. Cursor stores all the data as
a temporary container of return data and allows traversal so that we
can fetch data one row at a time from cursor. Cursors are created by
the connection.cursor() method.

<cursor object>=<connectionobject>.cursor()Eg:

Cursor=con.cursor()

2.commit() method

This method sends a COMMIT statement to the MySQL


server, committing the current transaction. Since by default
Connector/Python does not auto commit, it is important to call this
method after every transaction that modifies data for tables that use
transactional storage engines.
3. fetchall() method

The method fetches all (or all remaining) rows of a query result
set and returns a list of tuples. if no more rows are available, it returns
an empty list.

4. fetchone() method

This method retrieves the next row of a query result set and
returns a single sequence, or None if no more rows are available. By
default, the returned tuple consists of data returned by the MySQL
server, converted to Python objects.

5. execute() method

This function is used for the dynamic execution of Python


program which can either be a string or object code.

6. connect() method

To create a connection between the MySQL database and


Python, the connect() method of mysql. connector module is used.
PURPOSE OF THE PROJECT

➢ The main purpose of the project is to manage


the ‘HOSPITAL’.

➢ It helps in managing the patient data , doctor


data , nurse data and staffs data without any
error.
SOURCE CODE:

while (True):
print("""
================================
Welcome To Our Hospital
================================
""")
# creating database connectivity
import mysql.connector
passwd = str(input("Enter the Password Please!!:"))

mysql = mysql.connector.connect(host="localhost", user="root",


passwd="password")
mycursor = mysql.cursor()
mycursor.execute("create database if not exists our_hospitals")
mycursor.execute("use our_hospitals")
# creating the tables we need
mycursor.execute("create table if not exists patient_detail(name varchar(30)
primary key,sex varchar(15),age int(3),address varchar(50),contact
varchar(15))")
mycursor.execute("create table if not exists doctor_details(name varchar(30)
primary key,specialisation varchar(40),age int(2),address varchar(30),contact
varchar(15),fees int(10),monthly_salary int(10))")
mycursor.execute("create table if not exists nurse_details(name varchar(30)
primary key,age int(2),address varchar(30),contact varchar(15),monthly_salary
int(10))")
mycursor.execute("create table if not exists other_workers_details(name
varchar(30) primary key,age int(2),address varchar(30),contact
varchar(15),monthly_salary int(10))")
# creating table for storing the username and password of the user
mycursor.execute("create table if not exists user_data(username varchar(30)
primary key,password varchar(30) default'000')")
while (True):
print("""
1. Sign In
2. Registration
""")

r = int(input("enter your choice:"))


if r == 2:
print("""

=======================================
!!!!!!!!!!Register Yourself!!!!!!!!
=======================================
""")
u = input("Input your username!!:")
p = input("Input the password (Password must be strong!!!:")
mycursor.execute("insert into user_data values('" + u + "','" + p + "')")
mysql.commit()

print("""
============================================
!!Well Done!!Registration Done Successfully!!
============================================
""")
x = input("enter any key to continue:")
# IF USER WANTS TO LOGIN
elif r == 1:
print("""
==================================
!!!!!!!! {{Sign In}} !!!!!!!!!!
==================================
""")
un = input("Enter Username!!:")
ps = input("Enter Password!!:")

mycursor.execute("select password from user_data where username='" +


un
+ "'")
row = mycursor.fetchall()
for i in row:
a = list(i)
if a[0] == str(ps):
while (True):
print("""
1.Administration
2.Patient(Details)
3.Sign Out

""")
a = int(input("ENTER YOUR CHOICE:"))
if a == 1:
print("""
1. Display the details
2. Add a new member
3. Delete a member
4. Make an exit
""")
b = int(input("Enter your Choice:"))
# details
if b == 1:
print("""
1. Doctors Details
2. Nurse Details
3. Others
""")

c = int(input("Enter your Choice:"))


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", "FEES","MONTHLY_SALARY"]
d = dict(zip(k, v))
print(d)
# displays nurses details
elif c == 2:
mycursor.execute("select * from nurse_details")
row = mycursor.fetchall()
for i in row:
v = list(i)
k = ["NAME","AGE","ADDRESS", "CONTACT",
"MONTHLY_SALARY"]
d = dict(zip(k, v))
print(d)
# displays worker details
elif c == 3:
mycursor.execute("select * from other_workers_details")
row = mycursor.fetchall()
for i in row:
v = list(i)
k = ["NAME","AGE","ADDRESS",
"CONTACT""MONTHLY_SALARY"]
d = dict(zip(k, v))
print(d)
# IF USER WANTS TO ENTER DETAILS
elif b == 2:
print("""
1. Doctor Details
2. Nurse Details
3. Others
""")
c = int(input("ENTER YOUR CHOICE:"))
# enter doctor details
if c == 1:
# ASKING THE DETAILS
name = input("Enter the doctor's name")
spe = input("Enter the specilization:")
age = input("Enter the age:")
add = input("Enter the address:")
cont = input("Enter Contact Details:")
fees = input("Enter the fees:")
ms = input("Enter Monthly Salary:")
# Inserting values in doctors details
mycursor.execute("insert into doctor_details values('" +
name + "','" + spe +"','" + age + "','" + add + "','" + cont + "','" + fees + "','" + ms
+
"')")
mysql.commit()
print("SUCCESSFULLY ADDED")
# for nurse details
elif c == 2:
# ASKING THE DETAILS
name = input("Enter Nurse name:")
age = input("Enter age:")
add = input("Enter address:")
cont = input("Enter Contact No:")
ms = int(input("Enter Monthly Salary"))
# INSERTING VALUES ENTERED TO THE TABLE
mycursor.execute("insert into nurse_details values('" +
name
+ "','" + age + "','" + add + "','" + cont + "','" + str(ms) + "')")
mysql.commit()
print("SUCCESSFULLY ADDED")
# for entering workers details
elif c == 3:
# ASKING THE DETAILS
name = input("Enter worker name:")
age = input("Enter age:")
add = input("Enter address:")
cont = input("Enter Contact No.:")
ms = input("Enter Monthly Salary:")
# INSERTING VALUES ENTERED TO THE TABLE
mycursor.execute("insert into other_workers_details
values('" + name + "','" + age + "','" + add + "','" + cont + "','" + ms + "')")
mysql.commit()
print("SUCCESSFULLY ADDED")
# to delete data
elif b == 3:
print("""
1. Doctor Details
2. Nurse Details
3. Others
""")
c = int(input("Enter your Choice:"))
# deleting doctor's details
if c == 1:
name = input("Enter Doctor's Name:")
mycursor.execute("select * from doctor_details where
name='" + name + "'")
row = mycursor.fetchall()
print(row)
p = input("you really wanna delete this data? (y/n):")
if p == "y":
mycursor.execute("delete from doctor_details where
name='" + name + "'")
mysql.commit()
print("SUCCESSFULLY DELETED!!")
else:
print("NOT DELETED")

# deleting nurse details


elif c == 2:
name = input("Enter Nurse Name:")
mycursor.execute(
"select * from nurse_details where name='" + name +
"'")
row = mycursor.fetchall()
print(row)
p = input("you really wanna delete this data? (y/n):")
if p == "y":
mycursor.execute("delete from nurse_details where
name='" + name + "'")
mysql.commit()
print("SUCCESSFULLY DELETED!!")
else:
print("NOT DELETED")
# deleting other_workers details
elif c == 3:
name = input("Enter the worker Name")
mycursor.execute("select * from workers_details where
name='" + name + "'")
row = mycursor.fetchall()
print(row)
p = input("you really wanna delete this data? (y/n):")
if p == "y":
mycursor.execute("delete from other_workers_details
where name='" + name + "'")
mysql.commit()
print("SUCCESSFULLY DELETED!!")
else:
print("NOT DELETED")
elif b == 4:
break

# entering the patient details table


elif a == 2:

print("""
1. Show Patients Info
2. Add New Patient
3. Discharge Summary
4. Exit """)
b = int(input("Enter your Choice:"))
# showing the existing details
# if user wants to see the details of PATIENT
if b == 1:
mycursor.execute("select * from patient_detail")
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)

# adding new patient


elif b == 2:
name = input("Enter your name ")
sex = input("Enter the gender: ")
age = input("Enter age: ")
address = input("Enter address: ")
contact = input("Contact Details: ")
mycursor.execute("insert into patient_detail values('" +
name + "','" + sex + "','" + age + "','" + address + "','" + contact + "')")
mysql.commit()
mycursor.execute("select * from patient_detail")
for i in mycursor:
v = list(i)
k = ['NAME', 'SEX', 'AGE','ADDRESS', 'CONTACT']
print(dict(zip(k, v)))
print("""
====================================
!!!!!!!Registered Successfully!!!!!!
====================================
""")
# discharge process
elif b == 3:
name = input("Enter the Patient Name:")
mycursor.execute("select * from patient_detail where
name='" + name + "'")
row = mycursor.fetchall()
print(row)
bill = input("Has he paid all the bills? (y/n):")
if bill == "y":
mycursor.execute("delete from patient_detail where
name='" + name + "'")
mysql.commit()
# if user wants to exit
elif b == 4:
break
# SIGN OUT

elif a == 3:
break

# IF THE USERNAME AND PASSWORD IS NOT IN THE


DATABASE
else:
break
OUTPUT:
BIBLIOGRAPHY

1.NCERT class 12 computer science book

2.Computer Science with python class 12 Sumita Arora book

3.https://www.w3schools.com/python/python_mysql_getstarted.asp

4.https://dev.mysql.com/doc/connector-python/en/connector-python-
connecting.html
HOSPITAL
MANAGEMENT
SYSTEM

USING PYTHON AND


MYSQL

DONE BY:
GOWSHIYA R
VISHALI A
YUVASHREE B

You might also like