Document 1
Document 1
SCHOOL
SECTOR-3 ROHINI
HOSPITAL MANAGEMENT
SYSTEM
SUBMITTED BY: PRIYANKA JOSHI
ROLL NUMBER: 26624266
ACKNOWLEDGEMENT
It is with pleasure that I acknowledge my sincere gratitude
to our teacher, Harshita ma’am who taught and undertook
the responsibility of teaching the subject computer science.
I have been greatly benefited from his classes.
I am especially indebted to our principal Mrs. Sanyogita
Giri who has always been a source of encouragement and
support and without whose inspiration this project would
not have been a successful I would like to place on record
heartfelt thanks to him.
I also acknowledge with a deep sense of reverence, my
gratitude towards my parents, other faculty members of
the school and friends for their valuable suggestions given
to me in completing the project.
CERTIFICATE
2
This is to certify that Priyanka Joshi of class XII B of Saint
Giri Senior Secondary school has done his project on
“hospital management system” under my supervision. She
has taken interest and has shown at most sincerity in
completion of this project. I certify this project up to my
expectation & as per guidelines issued by CBSE.
TECHNOLOGIES USED
3
• Hardware:
o Computer system
• Software:
o Python 3.12
o MySQL
o Visual Studio Code
o Microsoft Word
o Python modules:
▪ MySQL connector
▪ Date time
4
The Hospital Management System (HMS) is a command-line-
based project designed to streamline and automate the
management of key hospital operations. This system facilitates
the efficient handling of patients, doctors, and appointments,
enabling hospitals to provide better services while reducing
manual effort.
The project leverages Python for its logic and user interface and
MySQL as its backend database for storing and managing the data.
The system allows administrators to perform essential tasks such
as registering patients and doctors, scheduling appointments,
and retrieving relevant information about hospital records
through a simple and intuitive command-line interface.
Key Features:
1. Patient Management:
a. Add and store patient information, including name, age,
gender, and contact details.
b. Retrieve and view a list of all registered patients.
2. Doctor Management:
a. Add doctors with their name, specialization, and
contact details.
b. View a list of available doctors and their specializations.
3. Appointment Scheduling:
5
a. Schedule appointments by assigning a patient to a
doctor on a specified date.
b. Include additional details about the reason for the
appointment.
4. Data Viewing:
a. Retrieve and display all appointments, along with the
associated patient and doctor details.
b. Access comprehensive lists of patients and doctors.
Benefits:
• Improved Efficiency:
The system eliminates manual record-keeping, reducing the
chance of errors and improving data retrieval time.
• Easy Management:
Doctors, patients, and appointments can be added,
managed, and viewed in a centralized database.
• Scalability:
This basic system can be expanded with additional modules
like billing, medical history management, and report
generation.
Future Enhancements:
6
While the current implementation provides basic functionality, it
can be further enhanced with:
1. Database Schema
SQL Schema:
8
2. Python Code for CLI
Here is the Python code to implement the CLI for managing the
hospital system:
9
import mysql.connector
from datetime import datetime
def connect_to_db():
return mysql.connector.connect(
host="localhost",
user="root",
password='JintoPoshi1@3',
database="hospital"
)
conn = connect_to_db()
cursor = conn.cursor()
conn.commit()
10
print(f"Patient '{name}' added successfully!")
cursor.close()
conn.close()
conn = connect_to_db()
cursor = conn.cursor()
conn.commit()
print(f"Doctor '{name}' added successfully!")
cursor.close()
conn.close()
# Schedule an appointment
def schedule_appointment():
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: ")
11
conn = connect_to_db()
cursor = conn.cursor()
conn.commit()
print("Appointment scheduled successfully!")
cursor.close()
conn.close()
query = """
SELECT a.appointment_id, p.name AS patient_name, d.name
AS doctor_name,
a.appointment_date, a.description
FROM appointments a
JOIN patients p ON a.patient_id = p.patient_id
JOIN doctors d ON a.doctor_id = d.doctor_id
"""
cursor.execute(query)
appointments= cursor.fetchall()
print("\nAppointments:")
for appointment in appointments:
12
print(f"ID: {appointment[0]}, Patient:
{appointment[1]}, Doctor: {appointment[2]}")
print(f"Date: {appointment[3]}, Description:
{appointment[4]}")
print("-" * 40)
cursor.close()
conn.close()
print("\nPatients:")
for patient in patients:
print(f"ID: {patient[0]}, Name: {patient[1]}, Age:
{patient[2]}, Gender: {patient[3]}")
print(f"Contact: {patient[4]}")
print("-" * 40)
cursor.close()
conn.close()
print("\nDoctors:")
for doctor in doctors:
print(f"ID: {doctor[0]}, Name: {doctor[1]},
Specialization: {doctor[2]}")
print(f"Contact: {doctor[3]}")
print("-" * 40)
cursor.close()
conn.close()
14
if choice == '1':
add_patient()
elif choice == '2':
add_doctor()
elif choice == '3':
schedule_appointment()
elif choice == '4':
view_appointments()
elif choice == '5':
view_patients()
elif choice == '6':
view_doctors()
elif choice == '7':
print("Exiting the system. Goodbye!")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()
#Output#
1. Adding A Patient
15
2. Adding A Doctor
3. Scheduling An Appointment
16
4. Viewing Appointments
5. Viewing patients
17
6. Viewing doctors
7. Exiting
18
19
BIBLIOGRAPHY
• Google.com
• Class 11th and 12th textbooks
• GitHub
• GeeksforGeeks
• W3schools
• Stackoverflow
20