wip
This commit is contained in:
parent
a55224fe73
commit
b493f2742b
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
use App\DAL\Studies\WorklistFactory;
|
use App\DAL\Studies\WorklistFactory;
|
||||||
use App\Models\Study;
|
use App\Models\Study;
|
||||||
use App\Models\User;
|
|
||||||
use App\Services\ACL\WorklistButton;
|
use App\Services\ACL\WorklistButton;
|
||||||
use App\Services\ACL\WorklistColumn;
|
use App\Services\ACL\WorklistColumn;
|
||||||
use App\Services\ACL\WorklistGuard;
|
use App\Services\ACL\WorklistGuard;
|
||||||
@ -121,6 +120,7 @@ public function getColumns(): array
|
|||||||
->width('18px')
|
->width('18px')
|
||||||
->title('');
|
->title('');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WorklistColumn::ReportStatus:
|
case WorklistColumn::ReportStatus:
|
||||||
$columns[] = Column::make($col->value)
|
$columns[] = Column::make($col->value)
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
@ -132,14 +132,16 @@ public function getColumns(): array
|
|||||||
->width('18px')
|
->width('18px')
|
||||||
->title('');
|
->title('');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WorklistColumn::History:
|
case WorklistColumn::History:
|
||||||
$columns[] = Column::make($col->value)
|
$columns[] = Column::make($col->value)
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
->orderable(false)
|
->orderable(false)
|
||||||
->addClass('text-center')
|
->addClass('text-center')
|
||||||
->width('20px')
|
->width('16px')
|
||||||
->title('');
|
->title('');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WorklistColumn::PatientSexAge:
|
case WorklistColumn::PatientSexAge:
|
||||||
$columns[] = Column::make($col->value)
|
$columns[] = Column::make($col->value)
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
@ -147,25 +149,31 @@ public function getColumns(): array
|
|||||||
->addClass('text-center')
|
->addClass('text-center')
|
||||||
->title('Age');
|
->title('Age');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WorklistColumn::StudyDate:
|
case WorklistColumn::StudyDate:
|
||||||
$columns[] = Column::make($col->value)->searchable(false)->title('Scan Dt');
|
$columns[] = Column::make($col->value)->searchable(false)->title('Scanned');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WorklistColumn::ReceiveDate:
|
case WorklistColumn::ReceiveDate:
|
||||||
$columns[] = Column::make($col->value)->searchable(false)->title('Received');
|
$columns[] = Column::make($col->value)->searchable(false)->title('Received');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WorklistColumn::ReportDate:
|
case WorklistColumn::ReportDate:
|
||||||
$columns[] = Column::make($col->value)->searchable(false)->title('Read At');
|
$columns[] = Column::make($col->value)->searchable(false)->title('Read At');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WorklistColumn::AssignedPhysician:
|
case WorklistColumn::AssignedPhysician:
|
||||||
$columns[] = Column::make($col->value)
|
$columns[] = Column::make($col->value)
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
->title('Assigned');
|
->title('Rad');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WorklistColumn::ReadingPhysician:
|
case WorklistColumn::ReadingPhysician:
|
||||||
$columns[] = Column::make($col->value)
|
$columns[] = Column::make($col->value)
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
->title('Read By');
|
->title('Read By');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WorklistColumn::ActionButtons:
|
case WorklistColumn::ActionButtons:
|
||||||
case WorklistColumn::ViewerButtons:
|
case WorklistColumn::ViewerButtons:
|
||||||
case WorklistColumn::ReportButtons:
|
case WorklistColumn::ReportButtons:
|
||||||
@ -174,12 +182,26 @@ public function getColumns(): array
|
|||||||
->orderable(false)
|
->orderable(false)
|
||||||
->exportable(false)
|
->exportable(false)
|
||||||
->printable(false)
|
->printable(false)
|
||||||
->width(60)
|
// ->width(60)
|
||||||
->addClass('text-center p-0 ps-2')
|
->addClass('p-0 ps-2')
|
||||||
->title('');
|
->title('');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WorklistColumn::PatientId:
|
||||||
|
$columns[] = Column::make($col->value)->title('ID');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WorklistColumn::PatientName:
|
||||||
|
$columns[] = Column::make($col->value)->title('Patient');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WorklistColumn::StudyDescription:
|
||||||
|
$columns[] = Column::make($col->value)->title('Study');
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$columns[] = Column::make($col->value)->title(Str::title($col->value));
|
// dd(Str::slug($col->value, '-'));
|
||||||
|
$columns[] = Column::make($col->value)->title($this->columTitle($col->value));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,6 +209,11 @@ public function getColumns(): array
|
|||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function columTitle(string $str): string
|
||||||
|
{
|
||||||
|
return Str::of($str)->slug()->replace('-', ' ')->title()->toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the filename for export.
|
* Get the filename for export.
|
||||||
*/
|
*/
|
||||||
@ -201,12 +228,19 @@ protected function filename(): string
|
|||||||
return Str::slug(implode(' ', $parts), '_');
|
return Str::slug(implode(' ', $parts), '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function physicianColumn(?User $user, Carbon|CarbonImmutable|null $dt): ?string
|
private function physicianColumn(Study $study): ?string
|
||||||
{
|
{
|
||||||
|
$user = $study->readingPhysician;
|
||||||
if ($user === null) {
|
if ($user === null) {
|
||||||
|
if ($study->assigned_at !== null) {
|
||||||
|
return '<img src="' . asset('imgs/checklist.png') . '" data-bs-toggle="tooltip" data-bs-placement="right" title="Assigned at ' . $study->assigned_at->format(self::DATE_FORMAT_LONG) . '">';
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dt = $study->read_at;
|
||||||
|
|
||||||
return Blade::render('staff.worklist.partials._radiologist-listing',
|
return Blade::render('staff.worklist.partials._radiologist-listing',
|
||||||
[
|
[
|
||||||
'avatar_url' => $user->avatar(),
|
'avatar_url' => $user->avatar(),
|
||||||
@ -227,14 +261,20 @@ private function renderCustomColumns(): array
|
|||||||
foreach (WorklistGuard::worklistColumns() as $col) {
|
foreach (WorklistGuard::worklistColumns() as $col) {
|
||||||
switch ($col) {
|
switch ($col) {
|
||||||
case WorklistColumn::PatientName:
|
case WorklistColumn::PatientName:
|
||||||
$columns[$col->value] = fn (Study $study) => $study->sanitizedPatientName();
|
$columns[$col->value] = static function (Study $study) {
|
||||||
|
if (me()->isRadiologist()) {
|
||||||
|
return $study->sanitizedPatientName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<a target="_blank" href="' . route('staff.history.edit', $study->hash) . '">' . $study->sanitizedPatientName() . '</a>';
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case WorklistColumn::StudyDescription:
|
case WorklistColumn::StudyDescription:
|
||||||
$columns[$col->value] = fn (Study $study) => $study->sanitizedStudyDescription();
|
$columns[$col->value] = static fn (Study $study) => $study->sanitizedStudyDescription();
|
||||||
break;
|
break;
|
||||||
case WorklistColumn::AssignedPhysician:
|
case WorklistColumn::AssignedPhysician:
|
||||||
$columns[$col->value] = function (Study $study) {
|
$columns[$col->value] = static function (Study $study) {
|
||||||
if ($study->assigned_at != null) {
|
if ($study->assigned_at !== null) {
|
||||||
return '<img src="' . asset('imgs/checklist.png') . '" data-bs-toggle="tooltip" data-bs-placement="right" title="' . $study->assigned_at->format(self::DATE_FORMAT_LONG) . '">';
|
return '<img src="' . asset('imgs/checklist.png') . '" data-bs-toggle="tooltip" data-bs-placement="right" title="' . $study->assigned_at->format(self::DATE_FORMAT_LONG) . '">';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +282,7 @@ private function renderCustomColumns(): array
|
|||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case WorklistColumn::ReadingPhysician:
|
case WorklistColumn::ReadingPhysician:
|
||||||
$columns[$col->value] = fn (Study $study) => $this->physicianColumn($study->readingPhysician, $study->read_at);
|
$columns[$col->value] = fn (Study $study) => $this->physicianColumn($study);
|
||||||
break;
|
break;
|
||||||
case WorklistColumn::Series:
|
case WorklistColumn::Series:
|
||||||
$columns[$col->value] = fn (Study $study) => Blade::render(
|
$columns[$col->value] = fn (Study $study) => Blade::render(
|
||||||
@ -309,6 +349,21 @@ private function renderButton(string $data_id, string $fa_icon, string $data_cla
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function renderImageLink(string $data_id, string $img_src, string $data_class, string $text, string $url = '#', bool $blank = false, int $width = 18): string
|
||||||
|
{
|
||||||
|
return Blade::render('staff.worklist.partials._image-link',
|
||||||
|
[
|
||||||
|
'data_id' => $data_id,
|
||||||
|
'url' => $url,
|
||||||
|
'img_src' => asset('imgs/' . $img_src),
|
||||||
|
'data_class' => $data_class,
|
||||||
|
'text' => $text,
|
||||||
|
'blank' => $blank,
|
||||||
|
'width' => $width,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private function generateViewerButtons(Study $study): string
|
private function generateViewerButtons(Study $study): string
|
||||||
{
|
{
|
||||||
$btns = [];
|
$btns = [];
|
||||||
@ -332,19 +387,16 @@ private function generateViewerButtons(Study $study): string
|
|||||||
private function generateActionButtons(Study $study): string
|
private function generateActionButtons(Study $study): string
|
||||||
{
|
{
|
||||||
$btns = [];
|
$btns = [];
|
||||||
foreach (WorklistGuard::worklistButtons() as $button) {
|
foreach (WorklistGuard::worklistButtons($study) as $button) {
|
||||||
switch ($button) {
|
switch ($button) {
|
||||||
case WorklistButton::StudyMetadata:
|
case WorklistButton::StudyMetadata:
|
||||||
$btns[] = $this->renderButton($study->hash, 'fa-circle-info', 'showStudy btn-outline-facebook', 'Info');
|
$btns[] = $this->renderImageLink($study->hash, 'info.png', 'showStudy', 'Info');
|
||||||
break;
|
break;
|
||||||
case WorklistButton::History:
|
case WorklistButton::Assign:
|
||||||
$btns[] = $this->renderButton($study->hash, 'fa-pen-to-square', 'btn-outline-primary', 'Edit', route('staff.history.edit', $study->hash), true);
|
$btns[] = $this->renderImageLink($study->hash, 'assign.png', 'show-assign', 'Assign');
|
||||||
break;
|
break;
|
||||||
case WorklistButton::Notes:
|
case WorklistButton::Notes:
|
||||||
$btns[] = $this->renderButton($study->hash, 'fa-user-doctor', 'btn-outline-youtube show-assign', 'Assign');
|
$btns[] = $this->renderImageLink($study->hash, 'chat.png', 'show-notes', 'Chat');
|
||||||
break;
|
|
||||||
case WorklistButton::Attachment:
|
|
||||||
$btns[] = $this->renderButton($study->hash, 'fa-edit', 'btn-outline-secondary', 'ED', route('staff.meta.edit', $study->hash), true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,27 @@ public function setReportStatus(ReportStatus $status, User|int|null $user = null
|
|||||||
public function canEditReport(): bool
|
public function canEditReport(): bool
|
||||||
{
|
{
|
||||||
// todo: check if the study disallows reporting
|
// todo: check if the study disallows reporting
|
||||||
return $this->report_status->value < ReportStatus::Finalized->value;
|
return $this->isActive() && $this->reportStatusBefore(ReportStatus::Finalized);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reportStatusBefore(ReportStatus $checkpoint): bool
|
||||||
|
{
|
||||||
|
return $this->report_status->value < $checkpoint->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canEditMetadata(): bool
|
||||||
|
{
|
||||||
|
return $this->isActive() && $this->reportStatusBefore(ReportStatus::Finalized);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canAssignRad(): bool
|
||||||
|
{
|
||||||
|
if ($this->isLocked()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->isActive() && $this->reportStatusBefore(ReportStatus::Preliminary);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasReports(): bool
|
public function hasReports(): bool
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Services\ACL;
|
namespace App\Services\ACL;
|
||||||
|
|
||||||
|
use App\Models\Study;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
@ -14,16 +15,16 @@ public static function worklistColumns(User|int|null $usr = null): Collection
|
|||||||
WorklistColumn::Priority,
|
WorklistColumn::Priority,
|
||||||
WorklistColumn::ReportStatus,
|
WorklistColumn::ReportStatus,
|
||||||
WorklistColumn::ActionButtons,
|
WorklistColumn::ActionButtons,
|
||||||
|
// WorklistColumn::AssignedPhysician,
|
||||||
WorklistColumn::PatientId,
|
WorklistColumn::PatientId,
|
||||||
WorklistColumn::PatientName,
|
WorklistColumn::PatientName,
|
||||||
WorklistColumn::PatientSexAge,
|
WorklistColumn::PatientSexAge,
|
||||||
WorklistColumn::StudyDate,
|
WorklistColumn::StudyDate,
|
||||||
WorklistColumn::ReceiveDate,
|
WorklistColumn::ReceiveDate,
|
||||||
WorklistColumn::StudyDescription,
|
WorklistColumn::StudyDescription,
|
||||||
WorklistColumn::AssignedPhysician,
|
|
||||||
WorklistColumn::ReadingPhysician,
|
WorklistColumn::ReadingPhysician,
|
||||||
WorklistColumn::ReportDate,
|
WorklistColumn::ReportDate,
|
||||||
WorklistColumn::History,
|
// WorklistColumn::History,
|
||||||
WorklistColumn::Modality,
|
WorklistColumn::Modality,
|
||||||
WorklistColumn::Series,
|
WorklistColumn::Series,
|
||||||
WorklistColumn::ReportButtons,
|
WorklistColumn::ReportButtons,
|
||||||
@ -47,18 +48,26 @@ public static function worklistColumns(User|int|null $usr = null): Collection
|
|||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function worklistButtons(?int $user_id = null): Collection
|
public static function worklistButtons(Study $study, User|int|null $usr = null): Collection
|
||||||
{
|
{
|
||||||
$user = $user_id !== null ? User::findOrFail($user_id) : auth()->user();
|
$user = me($usr);
|
||||||
|
if ($user->isRadiologist()) {
|
||||||
|
return collect([
|
||||||
|
WorklistButton::StudyMetadata,
|
||||||
|
WorklistButton::Notes,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$buttons = collect([
|
$buttons = collect([
|
||||||
WorklistButton::StudyMetadata,
|
WorklistButton::StudyMetadata,
|
||||||
WorklistButton::History,
|
WorklistButton::History,
|
||||||
WorklistButton::Notes,
|
WorklistButton::Notes,
|
||||||
WorklistButton::Attachment,
|
|
||||||
WorklistButton::Assign,
|
|
||||||
WorklistButton::Report,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($study->canAssignRad()) {
|
||||||
|
$buttons->push(WorklistButton::Assign);
|
||||||
|
}
|
||||||
|
|
||||||
return $buttons;
|
return $buttons;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,6 @@
|
|||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Run the migrations
|
|
||||||
*/
|
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('modalities', static function (Blueprint $table) {
|
Schema::create('modalities', static function (Blueprint $table) {
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Run the migrations
|
|
||||||
*/
|
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('procedures', static function (Blueprint $table) {
|
Schema::create('procedures', static function (Blueprint $table) {
|
||||||
|
Loading…
Reference in New Issue
Block a user