wip
This commit is contained in:
parent
eea5f09387
commit
fa259e31fd
@ -164,7 +164,7 @@ protected function getStudiesQuery(): Builder
|
||||
$q = Study::query();
|
||||
}
|
||||
|
||||
return $q->with(['readingPhysician', 'dicomServer', 'assignedPhysicians', 'reports']);
|
||||
return $q->with(['readingPhysician', 'dicomServer', 'assignedPhysicians', 'reports', 'lockingPhysician']);
|
||||
}
|
||||
|
||||
protected function applySort(Builder $query): Builder
|
||||
|
@ -23,7 +23,7 @@
|
||||
class WorklistDataTable extends DataTable
|
||||
{
|
||||
const DATE_FORMAT_SHORT = 'd.m.Y H:i';
|
||||
const DATE_FORMAT_LONG = 'd/m/Y h:i A';
|
||||
const DATE_FORMAT_LONG = 'h:i A, d-M-Y (D)';
|
||||
|
||||
private static function renderDateColumn(Carbon|CarbonImmutable|null $dt): ?string
|
||||
{
|
||||
@ -281,7 +281,7 @@ private function physicianColumn(Study $study): ?string
|
||||
[
|
||||
'src' => asset('imgs/assigned.png'),
|
||||
'class' => 'msg-icon',
|
||||
'tip' => 'Assigned on ' . $study->assigned_at->format(self::DATE_FORMAT_LONG),
|
||||
'tip' => 'Assigned at ' . $study->assigned_at->format(self::DATE_FORMAT_LONG),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ private function physicianColumn(Study $study): ?string
|
||||
[
|
||||
'src' => asset('imgs/lock.png'),
|
||||
'class' => 'ms-1 msg-icon',
|
||||
'tip' => 'Locked on ' . $study->locked_at->format(self::DATE_FORMAT_LONG),
|
||||
'tip' => sprintf("Locked by %s\n at %s", $study->lockingPhysician?->display_name ?? '', $study->locked_at->format(self::DATE_FORMAT_LONG)),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -318,6 +318,15 @@ private function renderCustomColumns(): array
|
||||
|
||||
foreach (WorklistGuard::worklistColumns() as $col) {
|
||||
switch ($col) {
|
||||
case WorklistColumn::PatientId:
|
||||
$columns[$col->value] = static function (Study $study) {
|
||||
if (me()->isRadiologist() || ! $study->canEditMetadata()) {
|
||||
return $study->patient_id;
|
||||
}
|
||||
|
||||
return '<a target="_blank" href="' . route('staff.meta.edit', $study->hash) . '">' . $study->patient_id . '</a>';
|
||||
};
|
||||
break;
|
||||
case WorklistColumn::PatientName:
|
||||
$columns[$col->value] = static function (Study $study) {
|
||||
if (me()->isRadiologist() || ! $study->canEditMetadata()) {
|
||||
@ -385,12 +394,33 @@ private function renderCustomColumns(): array
|
||||
|
||||
private function generateReportingButtons(Study $study): string
|
||||
{
|
||||
if (me()->isRadiologist() && $study->canEditReport() && ! $study->hasReports()) {
|
||||
// fresh untouched study, can edit report: take the rad directly to the edit page
|
||||
return '<a href="' . route('staff.report.create', $study->hash) . '" target="_blank" class="btn btn-sm btn-outline-light"><i class="fa-light fa-edit"></i></a>';
|
||||
$hasReports = $study->hasReports();
|
||||
$img = $hasReports ? 'report.png' : 'inbox.png';
|
||||
|
||||
if (me()->isRadiologist()) {
|
||||
if ($study->isLocked() && ! $study->isLockedBy()) {
|
||||
// study was locked by someone else
|
||||
return Blade::render('_partials._img-tooltip',
|
||||
[
|
||||
'src' => asset('imgs/lock.png'),
|
||||
'class' => 'msg-icon',
|
||||
'tip' => 'Study has been locked',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($study->canEditReport() && ! $hasReports) {
|
||||
// fresh untouched study, go directly to the edit page
|
||||
return $this->renderImageLink(
|
||||
$study->hash, $img, '', 'Report', route('staff.report.create', $study->hash), true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->renderButton($study->hash, 'fa-eye', 'show-reports btn-outline', 'R');
|
||||
// fallback: show popup with report history
|
||||
return $this->renderImageLink(
|
||||
$study->hash, $img, 'show-reports', 'Report'
|
||||
);
|
||||
}
|
||||
|
||||
private function renderButton(string $data_id, string $fa_icon, string $data_class, string $text, string $url = '#', bool $blank = false): string
|
||||
|
@ -133,6 +133,11 @@ public function readingPhysician(): BelongsTo
|
||||
return $this->belongsTo(User::class, 'reading_physician_id');
|
||||
}
|
||||
|
||||
public function lockingPhysician(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'locking_physician_id');
|
||||
}
|
||||
|
||||
public function assignedPhysicians(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'study_assignments');
|
||||
|
Loading…
Reference in New Issue
Block a user