26 lines
668 B
PHP
26 lines
668 B
PHP
<?php
|
|
|
|
namespace App\Domain\Patient\Actions;
|
|
|
|
use App\Domain\Patient\Contracts\PatientRepositoryInterface;
|
|
use App\Domain\Patient\DTO\PatientData;
|
|
use Illuminate\Support\Collection;
|
|
|
|
readonly class GetDepartmentJournalPatientAction
|
|
{
|
|
public function __construct(
|
|
private PatientRepositoryInterface $patientRepository
|
|
) {}
|
|
|
|
public function execute(int $departmentId): ?Collection
|
|
{
|
|
$patients = $this->patientRepository->getCurrentByDepartmentId($departmentId);
|
|
|
|
if ($patients && $patients->count() > 0) {
|
|
return $patients->map(fn ($patient) => PatientData::fromMis($patient));
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|