VASUNDHARA ENCLAVE
PROJECT FILE
SESSION 2024-2025
NAME: DHRUV ROHILLA
CLASS: XII A
ROLL NO:
SUBJECT: COMPUTE SCIENCE
SUB. CODE: 083
STREAM: PCM
ACKNOWLEDGEMENT
I would like to thank every individual who contributed and
made an effort to complete this project. Because of all these
individuals, I was able to make this project successful with
such ease and excitement.
Firstly, I would like to thank my Computer Science teacher
Mrs. Neeta chauhan whose guidance was invaluable during
the journey of the project. Their Knowledge was the most
important part of this project that facilitated the making of the
project. I am very grateful for the time and effort that they put
into this project.
I would also like to thank my parents without whom I would
not have been able to make this project. Their support and
guidance was invaluable to me during the journey. They
encouraged me and motivated me to work hard on this project
and complete it within the given time range.
I am also extremely grateful to my friends and classmates for
helping me whenever I asked for their help.
DHRUV ROHILLA
CLASS XII-A
CERTIFICATE
It is hereby certified that DHRUV ROHILLA of Class XII has
completed the project titled Mohalla Clinic in the subject of
Computer Science to the satisfaction of Angels Public School.
The project was developed under the guidance of Mrs. Neeta
Chauhan during the academic year 2024-25. The student
demonstrated significant effort, attention to detail, and
adherence to the project timeline, making this work suitable
for evaluation.
DATE:
EXTERNAL SIGNATURE INTRNAL SIGNATURE
Mohalla clinic
The project Mohalla Management System includes
registration of patients, storing their details into the system.
The software has the facility to add doctors and patient and
stores the details of every patient and [Link] also have
facility to add workers and book sessions. User can view
details of doctor,patient and works . And all information saved
to database also. This software also provide the facility to
calculate doctor salary and patient charges as well as. 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
"Mohalla CIinic" is to computerize the Front Office
Management of clinic 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.
FUNCTION USED IN THE PROJECT
• Connect()- to connect with database
• Add Doctor()- to add doctor details
• Add Patient()- to add patient details
• Add Worker()- to add worker details
• Book Session()- to book session of patients
• View Doctor()- to view the details of doctor
• View Patient()- to view the details of patient
• View worker()- to view the details of worker
• Show Doctor Salary()- to show salary of doctor
• Show Patient charges()- to show patient charges
• Main Menu()- back to main menu
CODING
import [Link]
def connect_db():
return [Link](
host="localhost",
user="root",
password="dhruv",
database="hospi11"
)
def add_doctor():
try:
db = connect_db()
cursor = [Link]()
name = input("Enter doctor's name: ")
specialization = input("Enter specialization: ")
phone = input("Enter phone number: ")
if not [Link]():
print("Invalid phone number. Please enter only digits.")
return
salary_input = input("Enter salary: ").replace(",", "")
try:
salary = float(salary_input)
if salary <= 0:
print("Salary must be a positive number.")
return
except ValueError:
print("Invalid salary format. Please enter a valid number.")
return
query = "INSERT INTO Doctors (name, specialization, phone,
salary) VALUES (%s, %s, %s, %s)"
[Link](query, (name, specialization, phone, salary))
[Link]()
print("Doctor added successfully!")
except [Link] as err:
print(f"Error: {err}")
finally:
if db.is_connected():
[Link]()
def add_patient():
db = connect_db()
cursor = [Link]()
name = input("Enter patient's name: ")
diagnosis = input("Enter diagnosis: ")
phone = input("Enter phone number: ")
charges = float(input("Enter charges: "))
query = "INSERT INTO Patients (name, ailment, phone, charges)
VALUES (%s, %s, %s, %s)"
[Link](query, (name, diagnosis, phone, charges))
[Link]()
print("Patient added successfully!")
def add_worker():
db = connect_db()
cursor = [Link]()
name = input("Enter worker's name: ")
role = input("Enter role: ")
phone = input("Enter phone number: ")
salary = float(input("Enter salary: "))
query = "INSERT INTO Workers (name, role, phone, salary)
VALUES (%s, %s, %s, %s)"
[Link](query, (name, role, phone, salary))
[Link]()
print("Worker added successfully!")
def book_session():
db = connect_db()
cursor = [Link]()
print("\n--- Book an Appointment ---")
patient_id = int(input("Enter the patient's ID: "))
[Link]("SELECT name FROM Patients WHERE patient_id
= %s", (patient_id,))
patient = [Link]()
if patient:
patient_name = patient[0]
else:
print("Error: No patient found with that ID.")
return
doctor_id = int(input("Enter the doctor's ID: "))
[Link]("SELECT name FROM Doctors WHERE doctor_id =
%s", (doctor_id,))
doctor = [Link]()
if doctor:
doctor_name = doctor[0]
else:
print("Error: No doctor found with that ID.")
return
appointment_date = input("Enter appointment date (YYYY-MM-DD):
")
appointment_time = input("Enter appointment time (HH:MM in 24-
hour format): ")
query = "INSERT INTO Sessions (patient_id, doctor_id,
session_date, session_time) VALUES (%s, %s, %s, %s)"
[Link](query, (patient_id, doctor_id, appointment_date,
appointment_time))
[Link]()
print("\nAppointment Confirmation")
print(f"Dear {patient_name},")
print(f"Your appointment with Dr. {doctor_name} is scheduled on
{appointment_date} at {appointment_time}.")
print("Thank you for using our hospital management system! We
look forward to serving you.")
def view_doctor():
db = connect_db()
cursor = [Link]()
[Link]("SELECT * FROM Doctors")
for (doctor_id, name, specialization, phone, salary) in cursor:
print(f"ID: {doctor_id}, Name: {name}, Specialization:
{specialization}, Phone: {phone}, Salary: {salary}")
def view_patient():
db = connect_db()
cursor = [Link]()
[Link]("SELECT * FROM Patients")
for (patient_id, name, ailment, phone, charges) in cursor:
print(f"ID: {patient_id}, Name: {name}, Ailment: {ailment}, Phone:
{phone}, Charges: {charges}")
def view_worker():
db = connect_db()
cursor = [Link]()
[Link]("SELECT * FROM Workers")
for (worker_id, name, role, phone, salary) in cursor:
print(f"ID: {worker_id}, Name: {name}, Role: {role}, Phone:
{phone}, Salary: {salary}")
def show_doctor_salary():
db = connect_db()
cursor = [Link]()
print("\n--- View Doctor's Salary ---")
search_choice = input("Would you like to search by (1) Doctor ID or
(2) Doctor Name? Enter 1 or 2: ")
if search_choice == '1':
doctor_id = int(input("Enter the doctor's ID: "))
query = "SELECT name, salary FROM Doctors WHERE doctor_id
= %s"
[Link](query, (doctor_id,))
elif search_choice == '2':
doctor_name = input("Enter the doctor's name: ")
query = "SELECT name, salary FROM Doctors WHERE name =
%s"
[Link](query, (doctor_name,))
else:
print("Invalid choice. Please enter 1 or 2.")
return
result = [Link]()
if result:
doctor_name, salary = result
print(f"\nDoctor Name: {doctor_name}")
print(f"Salary: ₹{salary}")
else:
print("No doctor found with the given information.")
def show_patient_charges():
db = connect_db()
cursor = [Link]()
print("\n--- View Patient's Charges ---")
search_choice = input("Would you like to search by (1) Patient ID or
(2) Patient Name? Enter 1 or 2: ")
if search_choice == '1':
patient_id = int(input("Enter the patient's ID: "))
query = "SELECT name, charges FROM Patients WHERE
patient_id = %s"
[Link](query, (patient_id,))
elif search_choice == '2':
patient_name = input("Enter the patient's name: ")
query = "SELECT name, charges FROM Patients WHERE name
= %s"
[Link](query, (patient_name,))
else:
print("Invalid choice. Please enter 1 or 2.")
return
result = [Link]()
if result:
patient_name, charges = result
print(f"\nPatient Name: {patient_name}")
print(f"Total Charges: ₹{charges}")
else:
print("No patient found with the given information.")
def main_menu():
try:
db = connect_db()
print("connected to the database")
except [Link] as err:
print("error connecting to the datebase")
return
while True:
print("\n--- MOHALLA Clinic ---")
print("1. Add Doctor")
print("2. Add Patient")
print("3. Add Worker")
print("4. Book Session")
print("5. View Doctor Details")
print("6. View Patient Details")
print("7. View Worker Details")
print("8. Calculate Doctor Salary")
print("9. Calculate Patient Charges")
print("10. Exit")
choice = input("Enter your choice: ")
if choice == '1':
add_doctor()
elif choice == '2':
add_patient()
elif choice == '3':
add_worker()
elif choice == '4':
book_session()
elif choice == '5':
view_doctor()
elif choice == '6':
view_patient()
elif choice == '7':
view_worker()
elif choice == '8':
show_doctor_salary()
elif choice == '9':
show_patient_charges()
elif choice == '10':
print("Exiting... Thank you for using the Mohalla Management
System!")
break
else:
print("Invalid choice. Please enter a valid option.")
try:
[Link]()
print("database connection closed.")
except NameError:
print("database was not connected")
main_menu()
DATABASE
import [Link]
def connect_db():
return [Link](
host="localhost",
user="root",
password="dhruv", )
db = connect_db()
cursor = [Link]()
[Link]("CREATE DATABASE hospi11")
[Link]("USE hospi11")
[Link]("""
CREATE TABLE Doctors (
doctor_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
specialization VARCHAR(100),
phone VARCHAR(15),
salary DECIMAL(10, 2)
)
""")
[Link]("""
CREATE TABLE Patients (
patient_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
ailment VARCHAR(100),
phone VARCHAR(15),
charges DECIMAL(10, 2)
)
""")
[Link]("""
CREATE TABLE Workers (
worker_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
role VARCHAR(100),
phone VARCHAR(15),
salary DECIMAL(10, 2)
)
""")
[Link]("""
CREATE TABLE Sessions (
session_id INT AUTO_INCREMENT PRIMARY KEY,
patient_id INT,
doctor_id INT,
session_date DATE,
session_time TIME,
FOREIGN KEY (patient_id) REFERENCES Patients(patient_id),
FOREIGN KEY (doctor_id) REFERENCES Doctors(doctor_id)
)
""")
[Link]()
print("Tables created successfully!")
OUTPUT