

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
One who wants to learn spring boot can try this assignment
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!
➢ Hospital Appointment System
1. Real-world Scenario: You’re building a backend API for a hospital system where:
3. Entities & Relationships ➢ Doctor - id, name, email, mobile, specialization - @ManyToOne with Department - @OneToMany with Appointment ➢ Department - id, name (e.g., "Cardiology", "Orthopedics") - @OneToMany with Doctor ➢ Patient - id, fullName, age, email, mobile - @OneToOne with MedicalHistory - @OneToMany with Appointment ➢ Appointment - id, appointmentDate, appointmentTime - @ManyToOne with Doctor - @ManyToOne with Patient ➢ MedicalHistory - id, bloodGroup, diseases, allergies - @OneToOne with Patient 4. DTO Design Entity Field Hidden in DTO Reason DoctorDTO No mobile/email exposed Privacy PatientDTO Hide medical history Use separate MedicalHistoryDTO AppointmentDTO Show doctor name, patient name, date & time
19 June 2025 13: New Section 1 Page 1
AppointmentDTO Show doctor name, patient name, date & time MedicalHistoryDTO Separate call only if required
5. Handle the Exception if some id not fount then through a customer exception : Use RestControllerAdvise + Exception handler (for hadling the exception) and create one more class to show error response ( like date and time , error name , error message , and error status);
6. REST Endpoints POST /doctors Add a doctor (with department ID) POST /patients Add a patient with medical history POST /appointments Create appointment (pass doctorId, patientId, date, time) GET /appointments/patient/{id} View all appointments for a patient GET /appointments/doctor/{id} View all appointments for a doctor ➢ Use ModelMapper Map:
➢ Sample JSON: Create Appointment json { "doctorId": 3, "patientId": 10, "appointmentDate": "2025- 06 - 25", "appointmentTime": "15:30" } New Section 1 Page 2