wip
This commit is contained in:
parent
648f28090c
commit
1b3de1aacb
@ -42,11 +42,15 @@ abstract class WorklistBase implements IUserStudyLister
|
|||||||
public function setRadiologist(int $radiologist_id): self
|
public function setRadiologist(int $radiologist_id): self
|
||||||
{
|
{
|
||||||
$this->radiologist_id = $radiologist_id;
|
$this->radiologist_id = $radiologist_id;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setStudyStatus(StudyLevelStatus $status): self
|
public function setStudyStatus(StudyLevelStatus $status): self
|
||||||
{
|
{
|
||||||
$this->studyStatus = $status;
|
$this->studyStatus = $status;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyRadiologist(Builder $query): Builder
|
private function applyRadiologist(Builder $query): Builder
|
||||||
@ -55,7 +59,7 @@ private function applyRadiologist(Builder $query): Builder
|
|||||||
$rad = $this->radiologist_id;
|
$rad = $this->radiologist_id;
|
||||||
$query = $query->where(function ($query) use ($rad) {
|
$query = $query->where(function ($query) use ($rad) {
|
||||||
$query->Where('assigned_physician_id', '=', $rad);
|
$query->Where('assigned_physician_id', '=', $rad);
|
||||||
$query->orWhere('reading_physician_id', '=', $rad);
|
$query->orWhere('reporting_physician_id', '=', $rad);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +96,8 @@ private function applyReportStatus(Builder $query): Builder
|
|||||||
public function setReportStatus(ReportStatus $status): self
|
public function setReportStatus(ReportStatus $status): self
|
||||||
{
|
{
|
||||||
$this->reportStatus = $status;
|
$this->reportStatus = $status;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function reportCompleteQuery(Builder $query): Builder
|
protected static function reportCompleteQuery(Builder $query): Builder
|
||||||
@ -120,6 +126,7 @@ public function query(?int $user_id = null): Builder
|
|||||||
{
|
{
|
||||||
$query = $this->buildQuery($user_id);
|
$query = $this->buildQuery($user_id);
|
||||||
$query = $this->applySort($query);
|
$query = $this->applySort($query);
|
||||||
|
$query = $this->applyRadiologist($query);
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
use App\DAL\Studies\WorklistFactory;
|
use App\DAL\Studies\WorklistFactory;
|
||||||
use App\Models\Study;
|
use App\Models\Study;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Yajra\DataTables\EloquentDataTable;
|
use Yajra\DataTables\EloquentDataTable;
|
||||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||||
@ -20,12 +22,34 @@ class WorklistDataTable extends DataTable
|
|||||||
*
|
*
|
||||||
* @param QueryBuilder $query Results from query() method.
|
* @param QueryBuilder $query Results from query() method.
|
||||||
*/
|
*/
|
||||||
|
// const DATE_FORMAT = 'DD.MM.YYYY HH:mm';
|
||||||
|
const DATE_FORMAT = 'DD MMM HH:mm';
|
||||||
|
|
||||||
public function dataTable(QueryBuilder $query): EloquentDataTable
|
public function dataTable(QueryBuilder $query): EloquentDataTable
|
||||||
{
|
{
|
||||||
return (new EloquentDataTable($query))
|
return (new EloquentDataTable($query))
|
||||||
->addColumn('action', 'worklist.action')
|
->addColumn('action', 'worklist.action')
|
||||||
|
->editColumn('reader', function ($study) {
|
||||||
|
if ($study->readingPhysician == null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<img class="rounded-circle me-4" height="24px" width="24px" src="'.Storage::url($study->readingPhysician->profile_photo_path).'"></img>'.$study->readingPhysician->display_name;
|
||||||
|
})
|
||||||
|
->editColumn('images', function (Study $study) {
|
||||||
|
return $study->numInstances().'<br /><small class="text-muted mt-2">'.human_filesize($study->disk_size).'</small>';
|
||||||
|
})
|
||||||
|
->editColumn('study_date', function ($data) {
|
||||||
|
return Carbon::parse($data->study_date)->isoFormat(self::DATE_FORMAT);
|
||||||
|
})
|
||||||
|
->editColumn('reported_at', function ($data) {
|
||||||
|
return Carbon::parse($data->reported_at)->isoFormat(self::DATE_FORMAT);
|
||||||
|
})
|
||||||
|
->editColumn('received_at', function ($data) {
|
||||||
|
return Carbon::parse($data->received_at)->isoFormat(self::DATE_FORMAT);
|
||||||
|
})
|
||||||
->orderColumn('patient_name', 'patient_name $1')
|
->orderColumn('patient_name', 'patient_name $1')
|
||||||
->rawColumns(['priority_icon', 'report_status_led'])
|
->rawColumns(['priority_icon', 'report_status_led', 'images', 'reader'])
|
||||||
->setRowId('id');
|
->setRowId('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +105,7 @@ public function html(): HtmlBuilder
|
|||||||
public function getColumns(): array
|
public function getColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::checkbox(''),
|
// Column::checkbox(''),
|
||||||
Column::make('priority_icon')
|
Column::make('priority_icon')
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
->orderable(false)
|
->orderable(false)
|
||||||
@ -107,9 +131,10 @@ public function getColumns(): array
|
|||||||
Column::make('reported_at')->searchable(false)->title('Reported'),
|
Column::make('reported_at')->searchable(false)->title('Reported'),
|
||||||
|
|
||||||
Column::make('study_description'),
|
Column::make('study_description'),
|
||||||
Column::make('reporting_physician_id'),
|
Column::make('reader')
|
||||||
|
->title('Reader'),
|
||||||
// Column::make('body_part_examined'),
|
// Column::make('body_part_examined'),
|
||||||
Column::make('num_instances')
|
Column::make('images')
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
->orderable(false)
|
->orderable(false)
|
||||||
->addClass('text-center')
|
->addClass('text-center')
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
use App\Models\Traits\HashableId;
|
use App\Models\Traits\HashableId;
|
||||||
use App\Services\Pacs\PacsUrlGen;
|
use App\Services\Pacs\PacsUrlGen;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
|
|
||||||
@ -108,6 +109,11 @@ public function numInstances(): string
|
|||||||
return "{$this->image_count} / {$this->series_count}";
|
return "{$this->image_count} / {$this->series_count}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function readingPhysician(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'reporting_physician_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function getReportStatusLedAttribute(): string
|
public function getReportStatusLedAttribute(): string
|
||||||
{
|
{
|
||||||
$color = match ($this->report_status) {
|
$color = match ($this->report_status) {
|
||||||
@ -194,6 +200,9 @@ public function allowed(): array
|
|||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
return array_merge(parent::toArray(), [
|
return array_merge(parent::toArray(), [
|
||||||
|
'disk_size_human' => human_filesize($this->disk_size),
|
||||||
|
'reader_name' => $this->readingPhysician?->display_name,
|
||||||
|
'reader_photo' => $this->readingPhysician?->profile_photo_url,
|
||||||
'report_status_led' => $this->getReportStatusLedAttribute(),
|
'report_status_led' => $this->getReportStatusLedAttribute(),
|
||||||
'priority_icon' => $this->getPriorityIcon(),
|
'priority_icon' => $this->getPriorityIcon(),
|
||||||
'sex_age' => $this->sexAge(),
|
'sex_age' => $this->sexAge(),
|
||||||
|
@ -72,3 +72,15 @@ function may(BackedEnum|iterable|string $perm): bool
|
|||||||
return auth()->user()->can($perm);
|
return auth()->user()->can($perm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! function_exists('human_filesize')) {
|
||||||
|
function human_filesize(int $bytes, $dec = 0): string
|
||||||
|
{
|
||||||
|
$size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||||
|
$factor = floor((strlen($bytes) - 1) / 3);
|
||||||
|
if ($factor == 0) {
|
||||||
|
$dec = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf("%.{$dec}f %s", $bytes / (1024 ** $factor), $size[$factor]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BIN
resources/imgs/ct.png
Normal file
BIN
resources/imgs/ct.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 688 B |
BIN
resources/imgs/mg.png
Normal file
BIN
resources/imgs/mg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 648 B |
BIN
resources/imgs/mr.png
Normal file
BIN
resources/imgs/mr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/imgs/us.png
Normal file
BIN
resources/imgs/us.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 737 B |
BIN
resources/imgs/xr.png
Normal file
BIN
resources/imgs/xr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 788 B |
Loading…
Reference in New Issue
Block a user