wip
This commit is contained in:
parent
b54e2e4ba3
commit
03862c5460
@ -5,7 +5,7 @@
|
|||||||
use App\Models\Study;
|
use App\Models\Study;
|
||||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||||
|
|
||||||
final class AdminStudyLister extends UserStudyListerBase
|
final class AdminWorklist extends WorklistBase
|
||||||
{
|
{
|
||||||
protected function buildQuery(?int $user_id = null): Builder
|
protected function buildQuery(?int $user_id = null): Builder
|
||||||
{
|
{
|
@ -5,7 +5,7 @@
|
|||||||
use App\Models\Study;
|
use App\Models\Study;
|
||||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||||
|
|
||||||
final class RadiologistStudyLister extends UserStudyListerBase
|
final class RadiologistWorklist extends WorklistBase
|
||||||
{
|
{
|
||||||
protected function buildQuery(?int $user_id = null): Builder
|
protected function buildQuery(?int $user_id = null): Builder
|
||||||
{
|
{
|
@ -5,7 +5,7 @@
|
|||||||
use App\Models\Study;
|
use App\Models\Study;
|
||||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||||
|
|
||||||
final class ReferrerStudyLister extends UserStudyListerBase
|
final class ReferrerWorklist extends WorklistBase
|
||||||
{
|
{
|
||||||
protected function buildQuery(?int $user_id = null): Builder
|
protected function buildQuery(?int $user_id = null): Builder
|
||||||
{
|
{
|
@ -5,7 +5,7 @@
|
|||||||
use App\Models\Study;
|
use App\Models\Study;
|
||||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||||
|
|
||||||
final class TechnicianStudyLister extends UserStudyListerBase
|
final class TechnicianWorklist extends WorklistBase
|
||||||
{
|
{
|
||||||
protected function buildQuery(?int $user_id = null): Builder
|
protected function buildQuery(?int $user_id = null): Builder
|
||||||
{
|
{
|
@ -6,7 +6,7 @@
|
|||||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||||
|
|
||||||
abstract class UserStudyListerBase implements IUserStudyLister
|
abstract class WorklistBase implements IUserStudyLister
|
||||||
{
|
{
|
||||||
private ?int $pageSize = null;
|
private ?int $pageSize = null;
|
||||||
|
|
@ -5,7 +5,7 @@
|
|||||||
use App\Models\Enums\UserRole;
|
use App\Models\Enums\UserRole;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
final readonly class UserStudyListerFactory
|
final readonly class WorklistFactory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@ -15,10 +15,10 @@ public static function getLister(): IUserStudyLister
|
|||||||
$role = auth()->user()->roles()->first()->name;
|
$role = auth()->user()->roles()->first()->name;
|
||||||
|
|
||||||
return match (UserRole::from($role)) {
|
return match (UserRole::from($role)) {
|
||||||
UserRole::Admin => new AdminStudyLister,
|
UserRole::Admin => new AdminWorklist,
|
||||||
UserRole::Technician => new TechnicianStudyLister,
|
UserRole::Technician => new TechnicianWorklist,
|
||||||
UserRole::Radiologist => new RadiologistStudyLister,
|
UserRole::Radiologist => new RadiologistWorklist,
|
||||||
UserRole::ReferringDoctor => new ReferrerStudyLister,
|
UserRole::ReferringDoctor => new ReferrerWorklist,
|
||||||
default => throw new Exception("Unknown user role: $role"),
|
default => throw new Exception("Unknown user role: $role"),
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Staff;
|
namespace App\Http\Controllers\Staff;
|
||||||
|
|
||||||
use App\DAL\Studies\UserStudyListerFactory;
|
use App\DAL\Studies\WorklistFactory;
|
||||||
use App\Http\Controllers\HashidControllerBase;
|
use App\Http\Controllers\HashidControllerBase;
|
||||||
use App\Models\Study;
|
use App\Models\Study;
|
||||||
use App\Services\AuditTrail\Activity;
|
use App\Services\AuditTrail\Activity;
|
||||||
@ -11,7 +11,7 @@ class StudiesController extends HashidControllerBase
|
|||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$studies = UserStudyListerFactory::getLister()->all();
|
$studies = WorklistFactory::getLister()->all();
|
||||||
|
|
||||||
return view('staff.studies.index', compact('studies'));
|
return view('staff.studies.index', compact('studies'));
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Staff;
|
namespace App\Http\Controllers\Staff;
|
||||||
|
|
||||||
use App\DAL\Studies\UserStudyListerFactory;
|
use App\DAL\Studies\WorklistFactory;
|
||||||
use App\Http\Controllers\HashidControllerBase;
|
use App\Http\Controllers\HashidControllerBase;
|
||||||
use App\Presenters\StudyPresenter;
|
use App\Presenters\StudyPresenter;
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ class WorklistController extends HashidControllerBase
|
|||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$studies = StudyPresenter::pagination(UserStudyListerFactory::getLister()->all());
|
$studies = StudyPresenter::pagination(WorklistFactory::getLister()->all());
|
||||||
|
|
||||||
return view('staff.worklist.index', compact('studies'));
|
return view('staff.worklist.index', compact('studies'));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user