dal
This commit is contained in:
parent
6e53c98925
commit
3ac07d8853
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
namespace App\DAL;
|
namespace App\DAL;
|
||||||
|
|
||||||
|
use App\Models\Study;
|
||||||
use Cache;
|
use Cache;
|
||||||
use DB;
|
use DB;
|
||||||
|
use Illuminate\Database\Query\Builder;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
final readonly class Studies
|
final readonly class Studies
|
||||||
{
|
{
|
||||||
@ -15,4 +18,52 @@ public static function getStudyIdByOrthancUuid(string $orthanc_uuid): ?int
|
|||||||
->where('orthanc_uuid', strtolower($orthanc_uuid))
|
->where('orthanc_uuid', strtolower($orthanc_uuid))
|
||||||
->value('id'));
|
->value('id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function assignedQuery(?int $user_id = null): Builder
|
||||||
|
{
|
||||||
|
$user_id = (int) ($user_id ?? auth()->id());
|
||||||
|
|
||||||
|
return Study::active()
|
||||||
|
->where('assigned_physician_id', $user_id)
|
||||||
|
->orderBy('study_priority', 'desc')
|
||||||
|
->orderBy('received_at', 'asc');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAllAssignedStudies(?int $user_id = null): Collection
|
||||||
|
{
|
||||||
|
$user_id = (int) ($user_id ?? auth()->id());
|
||||||
|
$per_page = settings()->get("user.{$user_id}.pagination.per_page", config('app.pagination.per_page'));
|
||||||
|
|
||||||
|
return Study::active()
|
||||||
|
->where('assigned_physician_id', $user_id)
|
||||||
|
->orderBy('study_priority', 'desc')
|
||||||
|
->orderBy('received_at', 'asc')
|
||||||
|
->paginate($per_page);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPendingAssignedStudies(?int $user_id = null): Collection
|
||||||
|
{
|
||||||
|
$user_id = (int) ($user_id ?? auth()->id());
|
||||||
|
$per_page = settings()->get("user.{$user_id}.pagination.per_page", config('app.pagination.per_page'));
|
||||||
|
|
||||||
|
return Study::active()
|
||||||
|
->where('assigned_physician_id', $user_id)
|
||||||
|
->where('report_status', '<', ReportStatus::Finalized->value)
|
||||||
|
->orderBy('study_priority', 'desc')
|
||||||
|
->orderBy('received_at', 'asc')
|
||||||
|
->paginate($per_page);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedAssignedStudies(?int $user_id = null): Collection
|
||||||
|
{
|
||||||
|
$user_id = (int) ($user_id ?? auth()->id());
|
||||||
|
$per_page = settings()->get("user.{$user_id}.pagination.per_page", config('app.pagination.per_page'));
|
||||||
|
|
||||||
|
return Study::active()
|
||||||
|
->where('assigned_physician_id', $user_id)
|
||||||
|
->where('report_status', '=', ReportStatus::Signed->value)
|
||||||
|
->orderBy('study_priority', 'desc')
|
||||||
|
->orderBy('received_at', 'asc')
|
||||||
|
->paginate($per_page);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
"phpoffice/phpword": "^1.3",
|
"phpoffice/phpword": "^1.3",
|
||||||
"propaganistas/laravel-phone": "^5.3",
|
"propaganistas/laravel-phone": "^5.3",
|
||||||
"rap2hpoutre/fast-excel": "^5.5",
|
"rap2hpoutre/fast-excel": "^5.5",
|
||||||
|
"rawilk/laravel-settings": "^3.4",
|
||||||
"sentry/sentry-laravel": "^4.10",
|
"sentry/sentry-laravel": "^4.10",
|
||||||
"spatie/laravel-permission": "^6.10",
|
"spatie/laravel-permission": "^6.10",
|
||||||
"spatie/laravel-settings": "^3.4",
|
|
||||||
"vinkla/hashids": "^12.0",
|
"vinkla/hashids": "^12.0",
|
||||||
"yajra/laravel-datatables-oracle": "^11.1"
|
"yajra/laravel-datatables-oracle": "^11.1"
|
||||||
},
|
},
|
||||||
|
@ -125,6 +125,7 @@
|
|||||||
|
|
||||||
'pagination' => [
|
'pagination' => [
|
||||||
'study_counts' => [5, 10, 25, 50, 100],
|
'study_counts' => [5, 10, 25, 50, 100],
|
||||||
|
'per_page' => env('PAGINATION_PER_PAGE', 25),
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user