System Flow Diagram (Paper-ready)

Actors: Receptionist, Doctor

1) Login Flow
Receptionist/Doctor -> enters email/password -> POST /api/auth/login -> Backend validates credentials -> returns JWT token -> Frontend stores token -> navigates to Dashboard

2) Receptionist Dashboard
Receptionist selects section:

2.1 Patient Management
- Add Patient -> POST /api/patients
- Update Patient -> PUT /api/patients/:id
- Delete Patient -> DELETE /api/patients/:id
- View all -> GET /api/patients

2.2 Appointment Management
- Create appointment -> POST /api/appointments
  (select patient + doctor + date + time)
- Update appointment -> PUT /api/appointments/:id
- Cancel appointment -> POST /api/appointments/:id/cancel
- View all -> GET /api/appointments

2.3 Reports (Receptionist view)
Receptionist selects StartDate and EndDate
- Click Generate -> GET /api/reports?startDate=&endDate=
Backend filters APPOINTMENTS by date range
Backend computes totals:
  total_appointments, total_completed, total_cancelled, patients_attended
Frontend renders filtered records + totals

3) Doctor Dashboard
3.1 View assigned appointments
Doctor -> GET /api/appointments/assigned
Backend returns appointments where appointments.doctor_id matches logged-in user

3.2 Medical report management
Doctor selects an appointment -> enters diagnosis + prescription + report_date
- Click Save Report -> POST /api/reports
Backend checks appointment belongs to doctor
Backend upserts into MEDICAL_REPORTS table (by appointment_id)
Backend sets appointment.status = completed
Frontend shows success

