Перевод на DDD
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user