0% found this document useful (0 votes)
21 views39 pages

HMS Sourcecode1

The document outlines a project on a Hospital Management System, detailing its need, advantages, and modules, as well as providing an overview of Python and MySQL technologies used. It emphasizes the importance of minimizing paperwork, improving patient care, and enhancing administrative control through a computerized system. Additionally, it includes system requirements, source code examples, and acknowledgments for support received during the project development.

Uploaded by

kannabiran172
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views39 pages

HMS Sourcecode1

The document outlines a project on a Hospital Management System, detailing its need, advantages, and modules, as well as providing an overview of Python and MySQL technologies used. It emphasizes the importance of minimizing paperwork, improving patient care, and enhancing administrative control through a computerized system. Additionally, it includes system requirements, source code examples, and acknowledgments for support received during the project development.

Uploaded by

kannabiran172
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Contents

1. Acknowledgement ..................................................................................................................... 1
2. About Python .......................................................................................................................... ...1
3. Overview of MySQL ..................................................................................................................2
4. System Requirements .............................................................................................................. 3
5. Hardware and Software Required ..........................................................................................4
6. Hospital ......................................................................................................................................5
7. Hospital Management System ..................................................................................................5
8. Need of Hospital Management System ................................................................................... 5
9. Introduction .............................................................................................................................. 6
10. Existing System ........................................................................................................................ 6
11. Disadvantages of Existing System ........................................................................................... 7
12. Advantages of Hospital Management System ....................................................................... 7
13. Module List .............................................................................................................................. 7
14. Source Code .............................................................................................................................. 8
14.1 Patient Management Module ..................................................................................... 10
14.2 Appointment Booking Module ....................................................................................12
14.3 Doctor Login Module .................................................................................................. 14
14.4 Reception Menu ........................................................................................................... 15
14.5 Admin Panel ................................................................................................................ 16
14.7 Billing & Payment Module ....................................................................................... . 21
14.8 Main Menu Program .................................................................................................. 24
15. Database Design ...................................................................................................................... 26
16. Output Screens ........................................................................................................................ 29
17. Conclusion ................................................................................................................................. 37
18. References .................................................................................................................................. 38

0
Acknowledgment

We would like to express our heartfelt gratitude to our Correspondent Madam Mrs. Padmapriya .R and our Technical Guide
Mrs. Bhuvaneswari .V.K for granting us this invaluable opportunity to work on our project under the guidance of Maharishi
International School, managed by the Sri Sri Ravishankar Vidya Mandir Trust. Your continuous guidance, motivation, and
mentorship have been a source of great inspiration to us throughout the completion of this project.

Your valuable suggestions and constant encouragement helped us to explore the topic in depth and develop a clear
understanding of the subject. The confidence and enthusiasm you instilled in us enabled us to overcome the various
challenges we faced during the process. We sincerely appreciate your patience, time, and efforts in reviewing our work and
providing insightful feedback that helped us improve our performance.

We are also profoundly thankful to our Principal, Teachers, and School Management for their unwavering support,
provision of facilities, and encouragement at every stage of this project. Their efforts in maintaining a positive and
resourceful learning environment have been instrumental in our success. The school’s belief in our potential motivated us to
strive for excellence, work collaboratively, and meet our deadlines effectively.

We extend our sincere thanks to our parents and friends for their moral support, cooperation, and continuous
encouragement, which helped us stay focused and determined throughout. We also appreciate all those who directly or
indirectly contributed to the successful completion of this project.

Finally, we feel proud and privileged to have had this wonderful opportunity, which not only enriched our knowledge but
also strengthened our research, analytical, and teamwork skills. This experience has truly been a stepping stone in our
academic growth and personal development.

ABOUT PYTHON:
Python isn’t just a programming language—it’s a story of simplicity turning into power. Created in 1991 by Guido van
Rossum, Python was designed to make coding feel natural, almost like writing plain English. Its unique use of indentation
instead of symbols makes programs look neat and logical, earning it the title of one of the most beginner-friendly languages.
But don’t mistake simplicity for weakness. Python is powerful—supporting multiple styles of programming (procedural,
object-oriented, functional) and handling everything from small scripts to artificial intelligence systems.
Being dynamically typed with automatic memory management, it frees developers from technical clutter so they can
focus on solving real problems.
Often called a “batteries included” language, Python ships with a huge standard library for everyday tasks, and its
ecosystem goes even further: NumPy and Pandas for data science, Django and Flask for web apps, TensorFlow and
PyTorch for AI, and countless more.
Python’s journey has milestones too. Python 2 introduced list comprehensions and better garbage collection in 2000.
Then came Python 3 in 2008—a bold step forward, though not backward-compatible. Developers slowly made the leap, and
by 2020, Python 2 officially retired, leaving Python 3 as the future.
1
Today, Python is everywhere—powering web platforms, analyzing medical data, driving machine learning, securing
networks, building games, and even running IoT devices. Behind it stands a massive global community and the Python
Software Foundation, ensuring it keeps evolving.
In short, Python is more than code—it’s a bridge between human thinking and machine logic, a language that keeps
reshaping technology while staying friendly to learners and experts alike.

OVERVIEW OF MySQL:
MySQL is one of the most widely recognized and reliable technologies in the modern data ecosystem. It is an open-
source relational database management system (RDBMS) that uses Structured Query Language (SQL) to manage and
organize data. MySQL is known for its speed, efficiency, and ability to handle large datasets, making it one of the most
popular choices for developers, organizations, and enterprises across the globe.
Often described as the backbone of many web applications, MySQL powers well-known platforms such as Facebook,
Twitter, YouTube, and countless websites built on content management systems like WordPress and Joomla. Its versatility
allows it to be used in small-scale applications as well as enterprise-level systems.
A major advantage of MySQL is that even beginners who are new to relational databases can quickly build secure,
scalable, and powerful storage systems. MySQL supports a wide range of operations—from creating and managing
databases to handling transactions and enforcing data integrity. Its client-server architecture, compatibility across multiple
platforms (Windows, Linux, macOS), and support for multiple programming languages (Python, Java, PHP, C++) make it
one of the most flexible database systems available.

Some key benefits of MySQL include:


Open Source – Freely available under the GNU GPL license with enterprise support options.
High Performance – Optimized for fast query processing and handling concurrent users.
Reliability – Ensures data integrity, transaction safety, and crash recovery.
Scalability – Efficiently manages anything from small projects to massive enterprise datasets.
Security – Offers user authentication, access controls, and encryption to protect sensitive information.

Common Queries in MySQL:


Query

Operation

Create Database:
Used to create a new database for storing tables and records.

Select/Use Database:
Activates a specific database so tables and queries can be executed inside it.
2
Create:
Creates objects like tables, views, procedures, and functions.

Alter:
Modifies existing database objects, such as adding, deleting, or updating columns in a table.

Update:
Modifies existing records in a table by changing their values.

Delete:
Removes records from a table based on specified conditions

Drop:
Permanently deletes a database, table, or view from the system.

System Requirements:
Before working with Python and MySQL together, certain hardware and software requirements need to be met. The
following are the minimum system specifications required for smooth execution:
Operating System: Windows 7, 8, 10 or higher (also works on Linux and macOS).
Processor: Dual Core 1.4 GHz or higher.
RAM: Minimum 1 GB (2 GB or more recommended for better performance).
Hard Disk Space: At least 750 MB of free space.
Software Requirements:
Python 3.7.0 or later
MySQL 5.5 or later
MySQL Connector or PyMySQL library for Python integration
These requirements ensure that the system can run both Python and MySQL smoothly, allowing developers to create
efficient database-driven applications.

3
HARDWARE AND SOFTWARE REQUIRED

HARDWARE

[Link]
[Link] PHONE

SOFTWARE
[Link] (latest version)
[Link]
[Link] CONNECTOR

4
HOSPITAL

A hospital is a health care institution providing patient treatment with specialized staff and equipment. Hospital are
usually funded by public sector by health organizations (for profit or non-profit), by health insurance companies, or by

departments (e.g. , surgery, and urgent care etc).

HOSPITAL MANAGEMENT SYSTEM

A hospital management system is an information system that manages the aspects of a hospital. This may include the
administrative, financial, and medical processing. It is an integrated end-to-end Hospital Management System that
provides relevant information across the hospital to support effective decision making for patient care, hospital
administration and critical financial accounting, In a seamless flow. This program can look after Inpatients, OPD patients,
records, database treatment, status illness, billing etc. it also maintains their hospital info such as ward id, Doctor in charge,
Department administering etc.

NEED OF HOSPITAL MANAGEMENT SYSTEM

1. Minimized documentation and no duplication of records.


2. Reduced paper work.
3. Improved patient care
4. Better Administration Control
5. Faster information flow between various departments
6. Smart Revenue Management
7. Effective billing of various services
8. Exact stock information
5
INTRODUCATION

The project Hospital Management System includes registration of patients, storing their details into the system. The
software has the facility to give a unique id for every patient and stores the details of every patient and the staff
automatically. It includes a search facility to know the current status of each room. User can search availability of a
doctor and the details of a patient using the id. The Hospital Management System can be entered using a username and
password. 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 “HOSPITAL MANAGEMENT SYSTEM” is to
computerize the Front Office Management of Hospital 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.

EXISTING SYSTEM

 In today’s world if someone wants to book a Doctor’s Appointment we need to call in clinic or personally
go to that place and book the appointment.

6
 This consumes precious time of the patient. Also if the doctor cancels his /her schedule, the patient does not
come to know about it unless he/she goes to the clinic.

DISADVANTAGES OF EXISTING SYSTEM

1. Lack of privacy
2. Risk in the management of the data.
3. Less security
4. Less user-friendly
5. Accuracy nor guaranteed 6. Not in reach of distant users.
7. There is no storage and automation if users have some enquiry.

ADVANTAGES OF HOSPITAL MANAGEMENT SYSTEM

1. Less paperwork
2. Costs Reduction
3. Improves patient’s experience
4. Improve data security
5. Better collaboration & Communication
6. Analytic anytime anywhere

MODULE LIST

o Reception
 Add new patient
 Get patient details
 Update patient
 Delete patient
 Back to main menu

o Admin panel
 Add new staff
 Get staff details
 Update staff
 Delete staff
 Add doctor
 Update doctor

7
 Back to main menu

o Doctor login
 Appointment detail

o Book appointment
 Book appointment
 Return to main menu

o Billing & Payments


 Generate new bill
 Update payment status
 View patient bill
 Back to main menu

o Exit

8
SOURCE CODE

import [Link]

from datetime import datetime, date

# ---------- DATABASE CONNECTION ----------

def connect_db():

return [Link](

host="localhost",

user="root",

password="Keerthi@*123",

database="hospital"

# ---------- AUTO-ID GENERATOR ----------

def generate_new_id(table_name):

conn = connect_db()

cursor = [Link]()

id_column = {

"patients": "patient_id",

"staff": "staff_id",

"doctors": "doctor_id"

}[table_name]

digit_length = {

"patients": 4,

"staff": 3,

"doctors": 3

}[table_name]

[Link](f"SELECT {id_column} FROM {table_name} ORDER BY {id_column} DESC LIMIT 1")


9
result = [Link]()

if result and result[0].isdigit():

last_id = int(result[0])

new_id = f"{last_id + 1:0{digit_length}d}"

else:

new_id = "001"

[Link]()

[Link]()

return new_id

# ---------- PATIENT MANAGEMENT ----------

def add_patient():

conn = connect_db()

cursor = [Link]()

patient_id = generate_new_id("patients")

print(f"Auto-generated Patient ID: {patient_id}")

name = input("Enter Patient Name: ")

age = input("Enter Age: ")

gender = input("Enter Gender: ")

phone = input("Enter Phone Number: ")

[Link]("""

INSERT INTO patients (patient_id, name, age, gender, phone)

VALUES (%s, %s, %s, %s, %s)

""", (patient_id, name, age, gender, phone))

[Link]()

print("Patient added successfully!")

[Link]()

[Link]()

10
def get_patient_details():

conn = connect_db()

cursor = [Link]()

patient_id = input("Enter Patient ID: ")

[Link]("SELECT * FROM patients WHERE patient_id = %s", (patient_id,))

patient = [Link]()

if patient:

print(f"ID: {patient[0]}, Name: {patient[1]}, Age: {patient[2]}, Gender: {patient[3]}, Phone: {patient[4]}")

else:

print("Patient not found.")

[Link]()

[Link]()

def update_patient():

conn = connect_db()

cursor = [Link]()

patient_id = input("Enter Patient ID to Update: ")

name = input("Enter New Name: ")

age = input("Enter New Age: ")

gender = input("Enter New Gender: ")

phone = input("Enter New Phone Number: ")

[Link]("""

UPDATE patients SET name=%s, age=%s, gender=%s, phone=%s

WHERE patient_id=%s

""", (name, age, gender, phone, patient_id))

[Link]()

print("Patient updated successfully!")

11
[Link]()

[Link]()

def delete_patient():

conn = connect_db()

cursor = [Link]()

patient_id = input("Enter Patient ID to Delete: ")

[Link]("DELETE FROM patients WHERE patient_id = %s", (patient_id,))

[Link]()

print("Patient deleted successfully!")

[Link]()

[Link]()

# ---------- APPOINTMENT BOOKING ----------

def book_appointment():

while True:

print("\n--- Appointment Booking ---")

print("1. Book Appointment")

print("2. Return to Main Menu")

choice = input("Enter your choice: ")

if choice == '1':

conn = connect_db()

cursor = [Link]()

name = input("Enter Patient Name: ")

specializations = [

12
"Cardiology", "Neurology", "Orthopedics", "Pediatrics",

"Gynecology", "Dermatology", "Oncology", "ENT",

"Urology", "Psychiatry", "Diabetes"

print("\n--- Specializations ---")

for idx, spec in enumerate(specializations, start=1):

print(f"{idx}. {spec}")

try:

spec_choice = int(input("Choose specialization number: "))

specialization = specializations[spec_choice - 1]

except (ValueError, IndexError):

print("Invalid specialization choice.")

continue

[Link]("SELECT doctor_id, name FROM doctors WHERE specialty = %s", (specialization,))

doctors = [Link]()

if not doctors:

print("No doctors available for this specialization.")

[Link]()

continue

print("\n--- Available Doctors ---")

for idx, doc in enumerate(doctors, start=1):

print(f"{idx}. {doc[1]} (Doctor ID: {doc[0]})")

try:

doc_choice = int(input("Select doctor by number: "))

doctor_id = doctors[doc_choice - 1][0]

except (ValueError, IndexError):

print("Invalid doctor choice.")

[Link]()

13
continue

appointment_date = input("Enter appointment date (YYYY-MM-DD): ")

[Link]("""

INSERT INTO appointments (patient_name, specialization, doctor_id, appointment_date)

VALUES (%s, %s, %s, %s)

""", (name, specialization, doctor_id, appointment_date))

[Link]()

[Link]()

print("✅ Appointment booked successfully!")

elif choice == '2':

break

else:

print("Invalid choice.")

# ---------- DOCTOR LOGIN ----------

def doctor_login():

print("\n--- Doctor Login ---")

doctor_id = input("Enter your Doctor ID: ")

password = input("Enter your Password: ")

conn = connect_db()

cursor = [Link]()

[Link]("SELECT * FROM doctors WHERE doctor_id = %s AND password = %s", (doctor_id, password))

doctor = [Link]()

if doctor:

print(f"\n✅ Welcome, {doctor[1]}!")

today = input("Enter the date to check appointments (YYYY-MM-DD): ")

[Link]("""

14
SELECT patient_name FROM appointments

WHERE doctor_id = %s AND appointment_date = %s

""", (doctor_id, today))

appointments = [Link]()

print(f"\n📅 Appointments for {today}:")

if appointments:

for i, appointment in enumerate(appointments, start=1):

print(f"{i}. {appointment[0]}")

else:

print("No appointments found.")

else:

print("❌ Invalid Doctor ID or Password.")

[Link]()

# ---------- RECEPTION MENU ----------

def reception_menu():

while True:

print(" --- Reception Menu --- ")

print(" --------------------------------------------")

print(" | press 1 for Add New Patient |")

print(" --------------------------------------------")

print(" | press 2 for Get Patient Details |")

print(" --------------------------------------------")

print(" | press 3 for Update Patient |")

print(" --------------------------------------------")

print(" | press 4 for Delete Patient |")

print(" --------------------------------------------")

print(" | press 5 for Back to Main Menu |")

print(" --------------------------------------------")

choice = input("Enter your choice: ")

15
if choice == '1':

add_patient()

elif choice == '2':

get_patient_details()

elif choice == '3':

update_patient()

elif choice == '4':

delete_patient()

elif choice == '5':

break

else:

print("Invalid choice. Please try again.")

# ---------- ADMIN PANEL ----------

def admin_login():

attempts = 3

while attempts > 0:

print("\n--- Admin Login ---")

username = input("Enter Username: ")

password = input("Enter Password: ")

conn = connect_db()

cursor = [Link]()

[Link]("SELECT * FROM admins WHERE username = %s AND password = %s", (username, password))

admin = [Link]()

[Link]()

[Link]()

if admin:

print(f"\n✅ Login Successful! Welcome {username}.")

return True # allow access

16
else:

attempts -= 1

print(f"❌ Invalid Username or Password. Attempts left: {attempts}\n")

print("🚫 Too many failed attempts. Access Denied.\n")

return False

def admin_panel():

if not admin_login():

return

while True:

print(" --- Admin Panel --- ")

print(" ----------------------------------------")

print(" | press 1 for Add New Staff |")

print(" ----------------------------------------")

print(" | press 2 for Get Staff Details |")

print(" ----------------------------------------")

print(" | press 3 for Update Staff |")

print(" ----------------------------------------")

print(" | press 4 for Delete Staff |")

print(" ----------------------------------------")

print(" | press 5 for Add Doctor |")

print(" ----------------------------------------")

print(" | press 6 for Update Doctor |")

print(" ----------------------------------------")

print(" | press 7 for Back to Main Menu |")

print(" ----------------------------------------")

choice = input("Enter your choice: ")

if choice == '1': add_staff()

17
elif choice == '2': get_staff_details()

elif choice == '3': update_staff()

elif choice == '4': delete_staff()

elif choice == '5': add_doctor()

elif choice == '6': update_doctor()

elif choice == '7': break

else: print("Invalid choice")

# ---------- ADD DOCTOR ----------

def add_doctor():

conn = connect_db()

cursor = [Link]()

doctor_id = generate_new_id("doctors")

print(f"Auto-generated Doctor ID: {doctor_id}")

name = input("Enter Doctor Name: ")

specialty = input("Enter Specialization: ")

phone = input("Enter Phone Number: ")

experience = int(input("Enter Experience (in years): "))

# Generate password: first 4 letters of name + first 4 digits of phone

clean_name = ''.join([Link]().split()) # remove spaces and lowercase

password = clean_name[:4] + phone[:4]

[Link]("""

INSERT INTO doctors (doctor_id, name, specialty, phone, experience, password)

VALUES (%s, %s, %s, %s, %s, %s)

""", (doctor_id, name, specialty, phone, experience, password))

[Link]()

print(f"Doctor added successfully! Password: {password}")

18
[Link]()

[Link]()

# ---------- UPDATE DOCTOR ----------

def update_doctor():

conn = connect_db()

cursor = [Link]()

doctor_id = input("Enter Doctor ID to Update: ")

name = input("Enter New Name: ")

specialty = input("Enter New Specialization: ")

phone = input("Enter New Phone Number: ")

experience = int(input("Enter New Experience: "))

password = input("Enter New Password: ")

[Link]("""

UPDATE doctors

SET name = %s, specialty = %s, phone = %s, experience = %s, password = %s

WHERE doctor_id = %s

""", (name, specialty, phone, experience, password, doctor_id))

[Link]()

print("Doctor details updated successfully!")

[Link]()

[Link]()

# ---------- STAFF MANAGEMENT ----------

def add_staff():

conn = connect_db()

cursor = [Link]()

staff_id = generate_new_id("staff")

print(f"Auto-generated Staff ID: {staff_id}")

19
name = input("Enter Staff Name: ")

role = input("Enter Role: ")

phone = input("Enter Phone Number: ")

[Link]("""

INSERT INTO staff (staff_id, name, role, phone)

VALUES (%s, %s, %s, %s)

""", (staff_id, name, role, phone))

[Link]()

print("Staff added successfully!")

[Link]()

[Link]()

def get_staff_details():

conn = connect_db()

cursor = [Link]()

staff_id = input("Enter Staff ID: ")

[Link]("SELECT * FROM staff WHERE staff_id = %s", (staff_id,))

staff = [Link]()

if staff:

print(f"ID: {staff[0]}, Name: {staff[1]}, Role: {staff[2]}, Phone: {staff[3]}")

else:

print("Staff not found.")

[Link]()

[Link]()

def update_staff():

conn = connect_db()

cursor = [Link]()

20
staff_id = input("Enter Staff ID to Update: ")

name = input("Enter New Name: ")

role = input("Enter New Role: ")

phone = input("Enter New Phone Number: ")

[Link]("""

UPDATE staff SET name=%s, role=%s, phone=%s

WHERE staff_id=%s

""", (name, role, phone, staff_id))

[Link]()

print("Staff updated successfully!")

[Link]()

[Link]()

def delete_staff():

conn = connect_db()

cursor = [Link]()

staff_id = input("Enter Staff ID to Delete: ")

[Link]("DELETE FROM staff WHERE staff_id = %s", (staff_id,))

[Link]()

print("Staff deleted successfully!")

[Link]()

[Link]()

# ---------- BILLING & PAYMENTS ----------

def generate_bill():

conn = connect_db()

cursor = [Link]()

21
patient_id = input("Enter Patient ID: ")

[Link]("SELECT name FROM patients WHERE patient_id=%s", (patient_id,))

patient = [Link]()

if not patient:

print("❌ Patient not found.")

[Link]()

return

treatment_details = input("Enter Treatment Details: ")

amount = float(input("Enter Amount: "))

insurance_provider = input("Enter Insurance Provider (Leave blank if none): ")

insurance_number = input("Enter Insurance Number (Leave blank if none): ")

[Link]("""

INSERT INTO billing (patient_id, treatment_details, amount, insurance_provider, insurance_number, bill_date)

VALUES (%s, %s, %s, %s, %s, %s)

""", (patient_id, treatment_details, amount, insurance_provider, insurance_number, [Link]()))

[Link]()

print(f"✅ Bill generated successfully for {patient[0]} (Patient ID: {patient_id})")

[Link]()

[Link]()

def update_payment_status():

conn = connect_db()

cursor = [Link]()

bill_id = input("Enter Bill ID: ")

new_status = input("Enter Payment Status (Paid/Unpaid): ").capitalize()

if new_status not in ["Paid", "Unpaid"]:

print("❌ Invalid status. Must be 'Paid' or 'Unpaid'.")

22
[Link]()

return

[Link]("UPDATE billing SET payment_status=%s WHERE bill_id=%s", (new_status, bill_id))

[Link]()

print("✅ Payment status updated successfully!")

[Link]()

[Link]()

def view_bills():

conn = connect_db()

cursor = [Link]()

patient_id = input("Enter Patient ID to view bills: ")

[Link]("""

SELECT bill_id, treatment_details, amount, payment_status, insurance_provider, insurance_number, bill_date

FROM billing WHERE patient_id=%s

""", (patient_id,))

bills = [Link]()

if not bills:

print("❌ No bills found for this patient.")

else:

print("\n--- Bills ---")

for bill in bills:

print(f"""

Bill ID: {bill[0]}

Treatment: {bill[1]}

Amount: ₹{bill[2]}

Status: {bill[3]}

Insurance Provider: {bill[4] or 'N/A'}

Insurance Number: {bill[5] or 'N/A'}

23
Date: {bill[6]}

-------------------------""")

[Link]()

[Link]()

def billing_menu():

while True:

print(" --- Billing & Payments Menu --- | ")

print(" ------------------------------------------------")

print(" | press 1 for Generate New Bill |")

print(" ------------------------------------------------")

print(" | press 2 for Update Payment Status |")

print(" ------------------------------------------------")

print(" | press 3 for View Patient Bills |")

print(" ------------------------------------------------")

print(" | press 4 for Back to Main Menu |")

print(" ------------------------------------------------")

choice = input("Enter your choice: ")

if choice == '1':

generate_bill()

elif choice == '2':

update_payment_status()

elif choice == '3':

view_bills()

elif choice == '4':

break

else:

print("❌ Invalid choice. Please try again.")

# ---------- MAIN MENU ----------

def main():

24
while True:

print(" ===== HOSPITAL SYSTEM MAIN MENU ===== ")

print(" ------------------------------------------------")

print(" | press 1 for Reception |")

print(" ------------------------------------------------")

print(" | press 2 for Admin Panel |")

print(" ------------------------------------------------")

print(" | press 3 for Doctor Login |")

print(" ------------------------------------------------")

print(" | press 4 for Book Appointment |")

print(" ------------------------------------------------")

print(" | press 5 for Billing & Payments |")

print(" ------------------------------------------------")

print(" | press 6 for Exit |")

print(" ------------------------------------------------")

choice = input("Enter your choice: ")

if choice == '1':

reception_menu()

elif choice == '2':

admin_panel()

elif choice == '3':

doctor_login()

elif choice == '4':

book_appointment()

elif choice == '5':

billing_menu()

elif choice == '6':

print("Exiting system. Goodbye!")

break

else:

print("Invalid choice. Try again.")

if __name__ == "__main__":

25
main(

DATABASE

26
27
28
OUTPUT

29
30
31
32
33
34
35
36
37
38

You might also like