0% found this document useful (0 votes)
14 views3 pages

Hospital Management System Code

Hospital management system project for class 12

Uploaded by

Tanish
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)
14 views3 pages

Hospital Management System Code

Hospital management system project for class 12

Uploaded by

Tanish
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
You are on page 1/ 3

Hospital Management System Code

import time

# Dictionaries to store data


patients = {}
doctors = {}
bills = {}

# Function to add a patient


def add_patient():
patient_id = input("Enter Patient ID: ")
name = input("Enter Patient Name: ")
age = input("Enter Age: ")
gender = input("Enter Gender (M/F): ")
illness = input("Enter Illness: ")
room = input("Enter Room Number: ")
patients[patient_id] = {"Name": name, "Age": age, "Gender": gender, "Illness": illness,
"Room": room}
print("Patient added successfully!")

# Function to view patient details


def view_patients():
if patients:
for pid, details in patients.items():
print(f"ID: {pid}, Name: {details['Name']}, Age: {details['Age']}, Gender:
{details['Gender']}, Illness: {details['Illness']}, Room: {details['Room']}")
else:
print("No patient records available.")

# Function to discharge a patient


def discharge_patient():
patient_id = input("Enter Patient ID to discharge: ")
if patient_id in patients:
del patients[patient_id]
print("Patient discharged successfully!")
else:
print("Patient ID not found!")

# Function to add a doctor


def add_doctor():
doctor_id = input("Enter Doctor ID: ")
name = input("Enter Doctor Name: ")
specialization = input("Enter Specialization: ")
contact = input("Enter Contact Number: ")
availability = input("Enter Availability (Yes/No): ")
doctors[doctor_id] = {"Name": name, "Specialization": specialization, "Contact": contact,
"Availability": availability}
print("Doctor added successfully!")

# Function to view doctor details


def view_doctors():
if doctors:
for did, details in doctors.items():
print(f"ID: {did}, Name: {details['Name']}, Specialization: {details['Specialization']},
Contact: {details['Contact']}, Availability: {details['Availability']}")
else:
print("No doctor records available.")

# Function to generate a bill


def generate_bill():
patient_id = input("Enter Patient ID: ")
if patient_id in patients:
days = int(input("Enter Number of Days Admitted: "))
daily_charge = float(input("Enter Daily Charges: "))
total = days * daily_charge
bills[patient_id] = {"Days": days, "Daily Charge": daily_charge, "Total": total}
print(f"Bill generated! Total Amount: {total}")
else:
print("Patient ID not found!")

# Function to view all bills


def view_bills():
if bills:
for pid, details in bills.items():
print(f"Patient ID: {pid}, Days: {details['Days']}, Daily Charge: {details['Daily
Charge']}, Total: {details['Total']}")
else:
print("No bills available.")

# Main menu
def main():
while True:
print("\nHospital Management System")
print("1. Add Patient")
print("2. View Patients")
print("3. Discharge Patient")
print("4. Add Doctor")
print("5. View Doctors")
print("6. Generate Bill")
print("7. View Bills")
print("8. Exit")
choice = input("Enter your choice: ")

if choice == "1":
add_patient()
elif choice == "2":
view_patients()
elif choice == "3":
discharge_patient()
elif choice == "4":
add_doctor()
elif choice == "5":
view_doctors()
elif choice == "6":
generate_bill()
elif choice == "7":
view_bills()
elif choice == "8":
print("Exiting system... Saving data.")
time.sleep(1)
break
else:
print("Invalid choice! Please try again.")

# Run the program


if __name__ == "__main__":
main()

You might also like