wip
This commit is contained in:
parent
97af6b42af
commit
9f9a5b2dd8
@ -34,7 +34,9 @@ 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) {
|
->editColumn('patient_name', fn (Study $study) => $study->sanitizedPatientName())
|
||||||
|
->editColumn('study_description', fn (Study $study) => $study->sanitizedStudyDescription())
|
||||||
|
->editColumn('reader', function (Study $study) {
|
||||||
if ($study->readingPhysician == null) {
|
if ($study->readingPhysician == null) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -44,14 +46,14 @@ public function dataTable(QueryBuilder $query): EloquentDataTable
|
|||||||
->editColumn('images', function (Study $study) {
|
->editColumn('images', function (Study $study) {
|
||||||
return $study->numInstances().'<small class="text-muted ms-2 fw-lighter fs-xsmall">'.human_filesize($study->disk_size).'</small>';
|
return $study->numInstances().'<small class="text-muted ms-2 fw-lighter fs-xsmall">'.human_filesize($study->disk_size).'</small>';
|
||||||
})
|
})
|
||||||
->editColumn('study_date', function ($data) {
|
->editColumn('study_date', function (Study $study) {
|
||||||
return self::dtFormat($data->study_date);
|
return self::dtFormat($study->study_date);
|
||||||
})
|
})
|
||||||
->editColumn('reported_at', function ($data) {
|
->editColumn('reported_at', function (Study $study) {
|
||||||
return self::dtFormat($data->reported_at);
|
return self::dtFormat($study->reported_at);
|
||||||
})
|
})
|
||||||
->editColumn('received_at', function ($data) {
|
->editColumn('received_at', function (Study $study) {
|
||||||
return self::dtFormat($data->received_at);
|
return self::dtFormat($study->received_at);
|
||||||
})
|
})
|
||||||
->orderColumn('patient_name', 'patient_name $1')
|
->orderColumn('patient_name', 'patient_name $1')
|
||||||
->rawColumns(['priority_icon', 'report_status_led', 'images', 'reader'])
|
->rawColumns(['priority_icon', 'report_status_led', 'images', 'reader'])
|
||||||
@ -134,20 +136,19 @@ public function getColumns(): array
|
|||||||
->addClass('text-center')
|
->addClass('text-center')
|
||||||
->title('Age'),
|
->title('Age'),
|
||||||
|
|
||||||
Column::make('study_date')->searchable(false)->title('Study'),
|
|
||||||
Column::make('received_at')->searchable(false)->title('Received'),
|
|
||||||
Column::make('reported_at')->searchable(false)->title('Reported'),
|
|
||||||
|
|
||||||
Column::make('study_description')
|
Column::make('study_description')
|
||||||
->title('Study'),
|
->title('Study'),
|
||||||
Column::make('reader')
|
|
||||||
->title('Read by'),
|
Column::make('study_date')->searchable(false)->title('Scan Dt'),
|
||||||
|
Column::make('reader')->title('Read by'),
|
||||||
|
Column::make('reported_at')->searchable(false)->title('Reported'),
|
||||||
// Column::make('body_part_examined'),
|
// Column::make('body_part_examined'),
|
||||||
Column::make('images')
|
Column::make('images')
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
->orderable(false)
|
->orderable(false)
|
||||||
->addClass('text-center')
|
->addClass('text-center')
|
||||||
->title('Images'),
|
->title('Images'),
|
||||||
|
Column::make('received_at')->searchable(false)->title('Received'),
|
||||||
|
|
||||||
// Column::make('xxx'),
|
// Column::make('xxx'),
|
||||||
Column::computed('action')
|
Column::computed('action')
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
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;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class Study extends BaseModel
|
class Study extends BaseModel
|
||||||
{
|
{
|
||||||
@ -197,6 +198,37 @@ public function allowed(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sanitizedPatientName(): string
|
||||||
|
{
|
||||||
|
$name = preg_replace('/[^[:alnum:][:space:]]/u', ' ', $this->patient_name);
|
||||||
|
|
||||||
|
return Str::of($name)
|
||||||
|
->slug(' ')
|
||||||
|
->title();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sanitizedStudyDescription(): string
|
||||||
|
{
|
||||||
|
$name = preg_replace('/[^[:alnum:][:space:]\/\-\&]/u', ' ', $this->study_description);
|
||||||
|
|
||||||
|
$name = Str::of($name)->title();
|
||||||
|
$lut = [
|
||||||
|
'ct' => 'CT',
|
||||||
|
'mr' => 'MR',
|
||||||
|
'mri' => 'MRI',
|
||||||
|
'hrct' => 'HRCT',
|
||||||
|
'hub' => 'KUB',
|
||||||
|
'ap' => 'AP',
|
||||||
|
'pa' => 'PA',
|
||||||
|
'with' => 'w/',
|
||||||
|
];
|
||||||
|
foreach ($lut as $search => $replace) {
|
||||||
|
$name = preg_replace("/\b$search\b/i", $replace, $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
return array_merge(parent::toArray(), [
|
return array_merge(parent::toArray(), [
|
||||||
|
Loading…
Reference in New Issue
Block a user