Note - Double Click to Copy Code Contact Us!

Clinic Management System using Python

Tech Doubility
Clinic Management System Project using Python


  1. class Patient:
  2. def __init__(self, name, age, gender, address, phone_number):
  3. self.name = name
  4. self.age = age
  5. self.gender = gender
  6. self.address = address
  7. self.phone_number = phone_number
  8.  
  9.  
  10. class Appointment:
  11. def __init__(self, patient, date, time):
  12. self.patient = patient
  13. self.date = date
  14. self.time = time
  15.  
  16.  
  17. class ClinicManagementSystem:
  18. def __init__(self):
  19. self.patients = []
  20. self.appointments = []
  21.  
  22. def add_patient(self, name, age, gender, address, phone_number):
  23. patient = Patient(name, age, gender, address, phone_number)
  24. self.patients.append(patient)
  25. print("Patient added successfully.")
  26.  
  27. def schedule_appointment(self, patient_name, date, time):
  28. patient = next((p for p in self.patients if p.name == patient_name), None)
  29. if patient:
  30. appointment = Appointment(patient, date, time)
  31. self.appointments.append(appointment)
  32. print("Appointment scheduled successfully.")
  33. else:
  34. print("Patient not found.")
  35.  
  36. def view_appointments(self):
  37. if self.appointments:
  38. for appointment in self.appointments:
  39. print(f"Patient: {appointment.patient.name}")
  40. print(f"Date: {appointment.date}")
  41. print(f"Time: {appointment.time}")
  42. print("----------------------")
  43. else:
  44. print("No appointments found.")
  45.  
  46. def view_patients(self):
  47. if self.patients:
  48. for patient in self.patients:
  49. print(f"Name: {patient.name}")
  50. print(f"Age: {patient.age}")
  51. print(f"Gender: {patient.gender}")
  52. print(f"Address: {patient.address}")
  53. print(f"Phone Number: {patient.phone_number}")
  54. print("----------------------")
  55. else:
  56. print("No patients found.")
  57.  
  58.  
  59. # Usage example
  60. clinic = ClinicManagementSystem()
  61.  
  62. # Add patients
  63. clinic.add_patient("John Doe", 30, "Male", "123 Main St", "123-456-7890")
  64. clinic.add_patient("Jane Smith", 25, "Female", "456 Elm St", "987-654-3210")
  65.  
  66. # Schedule appointments
  67. clinic.schedule_appointment("John Doe", "2023-06-12", "10:00 AM")
  68. clinic.schedule_appointment("Jane Smith", "2023-06-15", "2:30 PM")
  69.  
  70. # View patients and appointments
  71. clinic.view_patients()
  72. clinic.view_appointments()
  73.  
In this example, we have three classes: Patient, Appointment, and ClinicManagementSystem. The Patient class represents the patient information, the Appointment class represents an appointment with a patient, and the ClinicManagementSystem class is responsible for managing patients and appointments.

You can create patients using the add_patient method, schedule appointments using the schedule_appointment method, and view the list of patients and appointments using the view_patients and view_appointments methods, respectively.

Note that this is a simplified implementation and may not include all the features and error handling that a real clinic management system would have. It's meant to serve as a starting point for your project. You can expand upon this code by adding more functionality as per your requirements

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.