Hospital Management File by Parav Class 12th
Hospital Management File by Parav Class 12th
SUBMITTED BY:
SUBMITTED to:
PARAV KUMAR
12th A Mrs. Vani
ROLL NO:17 Kochhar
1
This is tothcertify that PARAV KUMAR of
Class 12 has successfully completed
the project titled “Hospital Management
System using Python & MySQL” for the
Class XII CBSE practical examination of the
Central Board of Secondary Education in
the year 2024-25.
PRINCIPAL SIGN :
2
I would like to express my heartfelt gratitude to
my Computer Science teacher, Mrs. Vani
Kochhar, and our esteemed school principal,
Mrs. Charan Kamal Kaur, for giving me the
wonderful opportunity to undertake this
Computer Science Investigatory Project.
3
Objective
System description
System requirements
Working
Add-Ons
Menu description
Programming
Output
Conclusion
4
The objective of the Hospital Management System
project is to streamline and enhance the efficiency of
various hospital operations. This system aims to
improve patient management by effectively handling
admissions, discharges, and transfers. It will provide
a user-friendly interface for appointment scheduling,
allowing patients and staff to easily schedule,
modify, and cancel appointments.
Appointment Scheduling: To develop a user-
friendly interface for patients and staff to
schedule, modify, and cancel appointments
easily.
Streamline Patient Management: To enhance
the efficiency of patient data handling, including
admissions, discharges, and transfers
5
The Hospital Management System will provide
essential functions to streamline hospital
operations. It will allow staff to easily register
patients by adding their personal and medical
information.
Administrators can manage doctor profiles,
including their specialties and availability.
The system will support appointment
scheduling, enabling patients to book,
change, or cancel appointments with
doctors.
6
Hardware Requirements:
• Processor: Minimum Intel i3 or equivalent
• RAM: At least 4 GB (8 GB recommended)
• Storage: Minimum 100 GB of available disk space
• Display: 1024 x 768 resolution or higher
Software Requirements:
Operating System:
o Windows 10 or later
o macOS Mojave or later
o Linux (Ubuntu 18.04 or later)
Python:
o Python 3.6 or later
o Required Libraries:
mysql-connector-python or PyMySQL for
database connectivity
Other libraries as needed (e.g., Flask for
web framework, Pandas for data manipulation)
7
MySQL:
o MySQL Server 5.7 or later
o MySQL Workbench for database management
(optional)
Web Browser:
o Latest version of Chrome, Firefox, or any
modern web browser (if applicable for web
interface)
Network Requirements:
Stable internet connection for downloading
dependencies
8
• PYTHON
The Hospital Management System is built using
Python, leveraging its versatility and ease of use
to create an intuitive interface for users. The
graphical user interface (GUI) is designed to be
user-friendly, allowing staff to navigate
seamlessly through various functionalities such
as patient registration, appointment scheduling,
and medical record management. Python's robust
libraries enable smooth data handling and
interaction with the MySQL database, ensuring
quick access to patient information and real-time
updates.
• MYSQL
The Hospital Management System utilizes MySQL
as its database management system, providing a
reliable and efficient backend for storing and
retrieving data. MySQL's robust structure enables
seamless management of various data entities,
including patient records, doctor profiles,
appointments, and inventory.
With features such as data integrity, strong
security measures, and support for complex
queries, MySQL ensures that the system can
handle large volumes of information while
maintaining quick access times.
9
1. Data Validation: Implement checks to ensure that all input data
(e.g., patient details, appointment times) are valid before saving
to the database.
4. Audit Logs: Maintain logs of user actions within the system for
accountability and tracking changes made to patient records
10
1. Patient Registration
Add new patient profiles with personal and medical
information
2. Doctor Management
Add and manage doctor profiles, including specialties and
availability.
3. Appointment Scheduling
Book, modify, or cancel appointments with doctors.
4. Search Functionality
Quickly find patients, doctors, or appointments using
search criteria.
11
MySQL code
12
description varchar(30),
FOREIGN KEY (patient_id) REFERENCES patients(id)
);
Python code
import mysql.connector
from datetime import datetime
# Function to connect to MySQL database
def connect_to_db():
return mysql.connector.connect(
host="localhost", # Your MySQL host
user="root", # Your MySQL username
password="your_password", # Your MySQL password
database="hospital_db" # Your database name
# Add a new doctor
def add_doctor(name, specialization, phone_number):
connection = connect_to_db()
cursor = connection.cursor()
cursor.execute("INSERT INTO doctors (name, specialization,
phone_number) VALUES (%s, %s, %s)",
(name, specialization, phone_number))
connection.commit()
cursor.close()
connection.close()
print(f"Doctor {name} added successfully.")
# Add a new patient
14
connection = connect_to_db()
cursor = connection.cursor()
cursor.execute("SELECT * FROM doctors")
doctors = cursor.fetchall()
cursor.close()
connection.close() print("\
nList of Doctors:") for
doctor in doctors:
print(f"ID: {doctor[0]}, Name: {doctor[1]}, Specialization:
{doctor[2]}, Phone: {doctor[3]}")
# View all patients
def view_patients():
connection = connect_to_db()
cursor = connection.cursor()
cursor.execute("SELECT * FROM patients")
patients = cursor.fetchall()
cursor.close()
connection.close() print("\
nList of Patients:") for
patient in patients:
print(f"ID: {patient[0]}, Name: {patient[1]}, Age:
{patient[2]}, Gender: {patient[3]}, Contact: {patient[4]}")
# View all appointments
def view_appointments():
15
connection =
connect_to_db() cursor =
connection.cursor()
cursor.execute("""
SELECT appointments.id, patients.name, doctors.name,
appointments.appointment_date, appointments.description
FROM appointments
JOIN patients ON appointments.patient_id = patients.id
JOIN doctors ON appointments.doctor_id = doctors.id
""")
appointments = cursor.fetchall()
cursor.close()
# Main menu loop for hospital management system
def hospital_management_system():
while True:
print("\nHospital Management System Menu:")
print("1. Add Doctor")
print("2. Add Patient")
print("3. Schedule Appointment")
print("4. View Doctors")
print("5. View Patients")
print("6. View Appointments")
print("7. Exit")
choice = input("Enter your choice: ")
16
if choice == "1":
name = input("Enter doctor's name: ")
specialization = input("Enter doctor's specialization: ")
phone_number = input("Enter doctor's phone number: ")
add_doctor(name, specialization, phone_number)
elif choice == "2":
name = input("Enter patient's name: ")
age = int(input("Enter patient's age: "))
gender = input("Enter patient's gender (M/F): ")
contact_number = input("Enter patient's contact number: ")
add_patient(name, age, gender, contact_number)
elif choice == "3":
try:
patient_id = int(input("Enter patient ID: "))
doctor_id = int(input("Enter doctor ID: "))
appointment_date = input("Enter appointment date (YYYY-
MM-DD): ")
description = input("Enter appointment description: ")
add_appointment(patient_id, doctor_id, appointment_date,
description)
17
except ValueError:
print("Invalid input. Please enter valid data.")
elif choice == "4":
view_doctors()
elif choice == "5":
view_patients()
elif choice == "6":
view_appointments()
18
19
20
21
22
23
The Hospital Management System is designed to
enhance the efficiency and effectiveness of hospital
operations by providing a comprehensive set of
features. It enables seamless patient registration
and doctor management, allowing for easy
scheduling of appointments and maintaining
electronic medical records.
24
COMPUTER SCIENCE CLASS 12TH NCERT
BOOK
W3Schools
25