[go: up one dir, main page]

0% found this document useful (0 votes)
30 views26 pages

Krish

Uploaded by

thappabhau
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)
30 views26 pages

Krish

Uploaded by

thappabhau
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/ 26

COMPUTER

SCIENCE PROJECT
~Hospital Management
system with SQL & Python~
COMPUT ER SCI EN CE
PROJECT ON

HOSPITAL MANAGEMENT
SYSTEM
USING PYTHON (FRONT END) AND MYSQL (BACK
END)

SUBMITTED BY: SUBMITTED to:


Krish Sambyal Mr. Pradeep Swami
12- A
Certificate

This is to certify that Krish Sambyal of class XII-A


has completed their Computer Science Investigatory
project under the guidance of Mr. Pradeep Swami for
the academic year 2024-2025. The certified students
have been dedicated throughout their research and
completed their work before the given deadline
without missing any important details from the
project. It is also certified that this project is the
individual work of the student and can be submitted
for evaluation.

-----------------------------------

Teacher’s signaTure principal’s signaTure


ACKNOWLEDGMENT

I would like to express my special gratitude to my computer


science Teacher Mr. Pradeep Swami as well as the school
principal Mrs. Gurnam Singh who gave me the wonderful
opportunity to do this Computer science Investigatory Project

The opportunity to complete this project has helped me to


improve my research skills and I am really grateful to them.

I would also like to thank my family and friends for


constantly encouraging me during this project, which I
would not have completed without their support.
INDEX

• Objective
• System description
• System requirements
• Working
• Add-Ons
• Menu description
• Programming
• Output
• Conclusion
OBJECTIVE

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
SYSTEM DESCRIPTION

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.
SYSTEM REQUIREMENTS

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)
SYSTEM REQUIREMENTS

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
WORKING

• 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.
ADD-ONS

1. Data Validation: Implement checks to ensure that all input


data (e.g., patient details, appointment times) are valid before
saving to the database.

2. Search Functionality: Add search features to quickly find


patients, doctors, or appointments using various criteria.

3.Dashboard Interface: Create a user-friendly dashboard that


displays key statistics like total patients, upcoming
appointments, and recent admissions.

4. Audit Logs: Maintain logs of user actions within the system


for accountability and tracking changes made to patient
records

5. Session Management: Implement session handling to manage


user sessions securely and allow users to log in and out
effectively.

6. Backup and Restore: Add functionality to back up the


database regularly and restore it when needed, ensuring data
safety.

7.Graphical Reports: Use libraries like Matplotlib or Polly to


create visual representations of data (e.g., patient demographics,
appointment trends).
MENU DESCRIPTION

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.
PROGRAMMING
MySQL code

CREATE DATABASE IF NOT EXISTS hospital_db;


USE hospital_db;
-- Table for doctors
CREATE TABLE doctors (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
specialization VARCHAR(255),
phone_number VARCHAR(20)
);
-- Table for patients
CREATE TABLE patients (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
age INT,
gender VARCHAR(10),
contact_number VARCHAR(20)
);
-- Table for appointments
CREATE TABLE appointments (
id INT AUTO_INCREMENT PRIMARY KEY,
patient_id INT,
doctor_id INT,
appointment_date DATE,
PROGRAMMING
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("Doctor”, name, "added successfully.")
# Add a new patient
def add_patient(name, age, gender, contact_number):
PROGRAMMING
connection = connect_to_db()
cursor = connection.cursor()
cursor.execute("INSERT INTO patients (name, age, gender,
contact_number) VALUES (%s, %s, %s, %s)",
(name, age, gender, contact_number))
connection.commit()
cursor.close()
connection.close()
print(f"Patient {name} added successfully.")
# Schedule an appointment
def add_appointment(patient_id, doctor_id, appointment_date,
description):
connection = connect_to_db()
cursor = connection.cursor()
cursor.execute("INSERT INTO appointments (patient_id,
doctor_id, appointment_date, description) VALUES (%s, %s, %s,
%s)",
(patient_id, doctor_id, appointment_date,
description))
connection.commit()
cursor.close()
connection.close()
print(f"Appointment scheduled for patient ID {patient_id} with
doctor ID {doctor_id} on {appointment_date}.")
# View all doctors
def view_doctors():
PROGRAMMING
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():
PROGRAMMING

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: ")
PROGRAMMING

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)
PROGRAMMING

except ValueError:
print("Invalid input. Please enter valid data.")
elif choice == "4":
view_doctors()
elif choice == "5":
view_patients()
elif choice == "6":
view_appointments()

elif choice == "7":


print("Exiting Hospital Management System. Goodbye!")
break
else:
print("Invalid choice. Please select a valid option.")
if __name__ == "__main__":
hospital_management_system()
OUTPUT
Main menu

Adding Doctor
OUTPUT

Adding Patient

Scheduling an Appointment
OUTPUT

Discharging a Patient

Viewing Doctor’s List


OUTPUT

Viewing Patient’s List

Viewing Appointments
OUTPUT

Viewing Discharge List

Exiting Hospital
management system
CONCLUSION

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.

Overall, this system aims to improve patient care,


optimize hospital operations, and provide a secure
and user-friendly environment for all
stakeholders involved.
BIBLIOGRAPHY

COMPUTER SCIENCE CLASS 12TH NCERT


BOOK

SUMITA ARORA CLASS 12TH COMPUTER


SCIENCE BOOK

W3Schools

You might also like