r/learnSQL • u/sumiitCodes • 13d ago
Title: Day 75-76 — Combined update: Hospital Management System, adding Billable, Inpatient/Outpatient, and service classes
Progress on my Hospital Management System over the last two days. I added:
- Billable
- Inpatient and Outpatient classes
- PatientService and DoctorService
In DoctorService I wrote methods to search doctors by specialization (case-insensitive), update a doctor's availability (throwing a custom DoctorNotFoundException if the ID doesn't exist), list the departments, and view all doctors.
I followed the advice from earlier comments here: keep the model classes simple, put the logic in separate service classes, and use custom exceptions for errors.
For people who've structured something similar: do you keep the doctor collection inside the service class, or in a separate repository class? I'm not sure whether the service is taking on too much.