# Appointment Service

This service is responsible for managing appointments.

## Methods

### `countCompletedAppointments(patientId: string, clinicBranchId?: string, excludeClinic: boolean = true): Promise<number>`

Counts the number of completed appointments for a given patient.

- `patientId`: The ID of the patient.
- `clinicBranchId` (optional): The ID of a clinic branch to filter by.
- `excludeClinic` (optional, default: `true`):
  - If `true`, it counts appointments _outside_ the specified `clinicBranchId`.
  - If `false`, it counts appointments _only within_ the specified `clinicBranchId`.

If `clinicBranchId` is not provided, it counts all completed appointments for the patient across all clinics.
