feat: add patient appointment interface and endpoints
- Introduced `PatientAppointment` interface to define appointment structure. - Implemented `findByUserAndDoctorIds` method in `AppointmentRepository` to retrieve appointments for a user filtered by doctor IDs. - Added `acceptedDoctorIdsByClinic` method in `ClinicDoctorInvitationRepository` to get accepted doctor IDs for a clinic. - Created new endpoint in `PatientController` to fetch appointments for a patient, ensuring only relevant doctors' appointments are displayed.
This commit is contained in:
@@ -46,6 +46,26 @@ class ClinicDoctorInvitationRepository extends ServiceEntityRepository
|
||||
->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* شناسهٔ پزشکانی که دعوت پذیرفتهشده در این کلینیک دارند.
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
public function acceptedDoctorIdsByClinic(int $clinicId): array
|
||||
{
|
||||
$rows = $this->createQueryBuilder('i')
|
||||
->select('IDENTITY(i.doctor) AS doctorId')
|
||||
->where('i.clinic = :clinicId')
|
||||
->andWhere('i.status = :accepted')
|
||||
->andWhere('i.doctor IS NOT NULL')
|
||||
->setParameter('clinicId', $clinicId)
|
||||
->setParameter('accepted', ClinicDoctorInvitation::STATUS_ACCEPTED)
|
||||
->getQuery()
|
||||
->getScalarResult();
|
||||
|
||||
return array_map(static fn(array $r) => (int) $r['doctorId'], $rows);
|
||||
}
|
||||
|
||||
public function save(ClinicDoctorInvitation $invitation): void
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
Reference in New Issue
Block a user