CS Prject
CS Prject
Project Report
IN
COMPUTER SCIENCE FOR CLASS XII
(2024-2025)
Submitted in partial fulfillment of the requirement cbse ,Delhi
BY:
Enrollment No:
UNDER THE GUIDANCE OF
MS. S. KRUTHIK KSHAMA
BHAARATH PUBLIC SCHOOL – CBSE
(Senior Secondary School), PALANI
1
BHAARATH PUBLIC SCHOOL – CBSE
(Senior Secondary School)
PALANI
COMPUTER SCIENCE
2024 – 2025
BONAFIDE CERTIFICATE
This is to certify that this project entitled “HOSPITAL
MANAGEMENT SYSTEM” is a record bonafide work carried
out By R.Tameemul Rahman in COMPUTER SCIENCE
prescribed by BHAARATH PUBLIC SCHOOL-CBSE(Senior
Secondary School), PALANI.
ROLL NUMBER: DATE:
2
ACKNOWLEDGMENT
3
SERIAL NO. CONTENTS PAGE NO.
1 Introduction 5
2 System 6
Requirements
3 Flow Chart 7
4 Project 20
Description
5 Source Code 21
Output 32
6 Screenshots
7 Conclusion 45
8 Bibliography 46
TABLE OF CONTENT
4
1.INTRODUCTION:
Managing a hospital's day-to-day operations requires handling a vast amount
of data related to patients, doctors, appointments, billing, and more. To
streamline these processes, we've developed a Hospital Management
System using Python and MySQL. This system serves as a comprehensive
solution to manage and organize critical information efficiently, ensuring that
healthcare providers can focus more on patient care rather than
administrative tasks. The system is designed to be user-friendly and offers a
robust database backend powered by MySQL, coupled with Python for
seamless integration and interaction. By leveraging CRUD (Create, Read,
Update, Delete) operations, this system allows for the efficient management
of all essential hospital functions. The core features include patient
management, doctor scheduling, appointment booking, and billing
processes.
5
2.SYSTEM REQUIREMENTS
2.1 SOFTWARE REQUIREMENTS
PLATFORM: windows 7 and above
SOFTWARE: python 3.7 and Above
2.2 HARDWARE REQUIREMENTS
PROCESSOR: Pentium-IV
RAM: 1gb
HARD DISK: 40gb
6
3.FLOW CHART
7
8
9
10
11
12
13
14
15
16
17
18
STOP
19
4.Project Description:
The Hospital Management System is a Python-based
application integrated with MySQL to streamline
hospital operations, including patient care, doctor
management, appointment scheduling, and billing.
Designed for efficiency and accuracy, the system
automates key processes, ensuring seamless data
management and improved healthcare services.
Modules used
1. Patient Management: Add, view, update, and delete patient
records with complete details like name, age, and disease.
2. Doctor Management: Maintain doctor profiles, including
specialization, availability, and contact details.
3. Appointment Scheduling: Link patients to doctors, ensuring no
scheduling conflicts and organized workflows.
4. Billing System: Generate bills for patients, detailing treatments,
costs, and payment statuses.
5. Search & Filter: Search patients by disease or check doctor
availability for specific dates.
20
5.SOURCE CODE
import pymysql
from datetime import datetime
# Menu functions
21
def add_patient(connection):
name = input("Enter patient name: ")
age = int(input("Enter patient age: "))
gender = input("Enter gender (Male/Female): ")
disease = input("Enter disease: ")
admission_date = input("Enter admission date (YYYY-MM-
DD): ")
query = f"""
INSERT INTO Patients (name, age, gender, disease,
admission_date)
VALUES ('{name}', {age}, '{gender}', '{disease}',
'{admission_date}');
"""
execute_query(connection, query)
print("Patient added successfully.")
def view_patients(connection):
query = "SELECT * FROM Patients;"
results = execute_read_query(connection, query)
print("\nPatient Records:")
22
for row in results:
print(row)
def add_doctor(connection):
name = input("Enter doctor name: ")
specialization = input("Enter specialization: ")
phone = input("Enter phone number: ")
query = f"""
INSERT INTO Doctors (name, specialization, phone)
VALUES ('{name}', '{specialization}', '{phone}');
"""
execute_query(connection, query)
print("Doctor added successfully.")
def view_doctors(connection):
query = "SELECT * FROM Doctors;"
results = execute_read_query(connection, query)
print("\nDoctor Records:")
for row in results:
print(row)
23
def schedule_appointment(connection):
patient_id = int(input("Enter patient ID: "))
doctor_id = int(input("Enter doctor ID: "))
appointment_date = input("Enter appointment date (YYYY-
MM-DD): ")
appointment_time = input("Enter appointment time
(HH:MM): ")
reason = input("Enter reason for appointment: ")
query = f"""
INSERT INTO Appointments (patient_id, doctor_id,
appointment_date, appointment_time, reason)
VALUES ({patient_id}, {doctor_id}, '{appointment_date}',
'{appointment_time}', '{reason}');
"""
execute_query(connection, query)
print("Appointment scheduled successfully.")
def add_billing_record(connection):
patient_id = int(input("Enter patient ID: "))
total_amount = float(input("Enter total amount: "))
24
billing_date = input("Enter billing date (YYYY-MM-DD): ")
query = f"""
INSERT INTO Billing (patient_id, total_amount, billing_date)
VALUES ({patient_id}, {total_amount}, '{billing_date}');
"""
execute_query(connection, query)
print("Billing record added successfully.")
def generate_bill(connection):
patient_id = int(input("Enter patient ID: "))
query = f"SELECT * FROM Billing WHERE patient_id =
{patient_id};"
results = execute_read_query(connection, query)
print("\nBilling Details:")
for row in results:
print(row)
def update_patient(connection):
patient_id = int(input("Enter patient ID to update: "))
name = input("Enter new name: ")
25
age = int(input("Enter new age: "))
gender = input("Enter new gender (Male/Female): ")
disease = input("Enter new disease: ")
admission_date = input("Enter new admission date (YYYY-
MM-DD): ")
discharge_date = input("Enter new discharge date (YYYY-
MM-DD): ")
query = f"""
UPDATE Patients
SET name = '{name}', age = {age}, gender = '{gender}',
disease = '{disease}',
admission_date = '{admission_date}', discharge_date =
'{discharge_date}'
WHERE patient_id = {patient_id};
"""
execute_query(connection, query)
print("Patient updated successfully.")
def delete_patient(connection):
patient_id = int(input("Enter patient ID to delete: "))
26
query = f"DELETE FROM Patients WHERE patient_id =
{patient_id};"
execute_query(connection, query)
print("Patient deleted successfully.")
def search_patients_by_disease(connection):
disease = input("Enter disease to search for: ")
query = f"SELECT * FROM Patients WHERE disease =
'{disease}';"
results = execute_read_query(connection, query)
print("\nPatients with specified disease:")
for row in results:
print(row)
def check_appointment_availability(connection):
doctor_id = int(input("Enter doctor ID: "))
query = f"SELECT * FROM Appointments WHERE doctor_id
= {doctor_id};"
results = execute_read_query(connection, query)
print("\nAppointments for Doctor ID", doctor_id)
for row in results:
27
print(row)
# Main function
28
def main():
connection = create_connection()
if not connection:
return
while True:
print("\nHospital Management System")
print("1. Add Patient")
print("2. View Patients")
print("3. Add Doctor")
print("4. View Doctors")
print("5. Schedule Appointment")
print("6. Add Billing Record")
print("7. Generate Bill")
print("8. Update Patient")
print("9. Delete Patient")
print("10. Search Patients by Disease")
print("11. Check Appointment Availability")
print("12. Exit")
31
6.OUTPUT SCREENSHOTS
STARTING THE INTERFACE :
32
6.1 ADDING PATIENT
33
6.2 VIEW PATIENTS
34
6.3 ADD DOCTOR
35
6.4 VIEW DOCTORS
36
6.5 SCHEDULE APPOINTMENT
37
6.6 ADD BILLING RECORD
38
6.7 GENERATE BILL
39
6. 8 UPDATE PATIENT
40
6.9 DELETE PATIENT
41
6.10 SEARCH PATIENTS BY DISEASE
42
6.11CHECK APPOINTMENT AVAILABILITY
43
6.12 EXIT
44
7.CONCLUSION
The Hospital Management System project demonstrates a comprehensive
solution for efficiently managing hospital operations, including patient and
doctor records, appointment scheduling, and billing processes. By integrating
a MySQL database with Python's functionality, this system ensures data
integrity, accessibility, and streamlined workflows. The project emphasizes
user-friendly design, error handling, and scalability, making it adaptable for
real-world applications. This endeavor showcases the potential of technology
to enhance healthcare management, ensuring better organization and
improved patient care.
45
8.BIBLIOGRAPHY
Computer science with python by Sumita Arora
https://www.geeksforgeeks.org/sleep-in-python/
https://en.wikipedia.org/
https://www.cbse.gov.in/
46
47