wip
This commit is contained in:
parent
90d46b32f7
commit
5d56d24ea6
40
app/Http/Controllers/StudyMetadataController.php
Normal file
40
app/Http/Controllers/StudyMetadataController.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\StudyMetadataUpdateRequest;
|
||||
use App\Models\Enums\Permission;
|
||||
use App\Models\Study;
|
||||
|
||||
class StudyMetadataController extends HashidControllerBase
|
||||
{
|
||||
public function view()
|
||||
{
|
||||
abort_unless(auth()->user()->may(Permission::StudyMetadataView), 403);
|
||||
$this->decodeKeys();
|
||||
$study = Study::find($this->key);
|
||||
|
||||
return view('staff.meta.view', compact('study'));
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
abort_unless(auth()->user()->may(Permission::StudyMetadataEdit), 403);
|
||||
$this->decodeKeys();
|
||||
$study = Study::find($this->key);
|
||||
|
||||
return view('staff.meta.edit', compact('study'));
|
||||
}
|
||||
|
||||
public function save(StudyMetadataUpdateRequest $request)
|
||||
{
|
||||
abort_unless(auth()->user()->may(Permission::StudyMetadataEdit), 403);
|
||||
$this->decodeKeys();
|
||||
$study = Study::find($this->key);
|
||||
$payload = array_trim_strings($request->validated());
|
||||
$study->update($payload);
|
||||
|
||||
// return redirect()->route('staff.history.view', _h($this->key));
|
||||
return redirect()->route('staff.meta.view', $study->hash);
|
||||
}
|
||||
}
|
39
app/Http/Requests/StudyMetadataUpdateRequest.php
Normal file
39
app/Http/Requests/StudyMetadataUpdateRequest.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StudyMetadataUpdateRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'patient_id' => ['nullable'],
|
||||
'patient_name' => ['required'],
|
||||
'patient_sex' => ['nullable'],
|
||||
'patient_birthdate' => ['nullable', 'date'],
|
||||
'study_id' => ['nullable'],
|
||||
'accession_number' => ['nullable'],
|
||||
'study_description' => ['nullable'],
|
||||
'body_part_examined' => ['nullable'],
|
||||
'station_name' => ['nullable'],
|
||||
'operators_name' => ['nullable'],
|
||||
'manufacturer' => ['nullable'],
|
||||
'manufacturer_model_name' => ['nullable'],
|
||||
'referring_physician_name' => ['nullable'],
|
||||
'study_modality' => ['nullable'],
|
||||
'study_date' => ['required', 'date'],
|
||||
'receive_date' => ['required', 'date'],
|
||||
'assigned_physician_id' => ['nullable', 'exists:users,id'],
|
||||
'referring_physician_id' => ['nullable', 'exists:users,id'],
|
||||
'access_flags' => ['required', 'integer'],
|
||||
'access_password' => ['nullable'],
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
@ -75,4 +75,19 @@ public function getHistoryLink(): string
|
||||
|
||||
return '#';
|
||||
}
|
||||
|
||||
public function getMetadataLink(): string
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->may(Permission::StudyMetadataEdit)) {
|
||||
return route('staff.meta.edit', $this->hash);
|
||||
}
|
||||
|
||||
if ($user->may(Permission::StudyMetadataView)) {
|
||||
return route('staff.meta.view', $this->hash);
|
||||
}
|
||||
|
||||
return '#';
|
||||
}
|
||||
}
|
||||
|
28
resources/views/staff/meta/edit.blade.php
Normal file
28
resources/views/staff/meta/edit.blade.php
Normal file
@ -0,0 +1,28 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __('Metadata View') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div>
|
||||
<div class="max-w-7xl mx-auto py-10 sm:px-6 lg:px-8">
|
||||
|
||||
<div class="mt-10 sm:mt-0">
|
||||
<h4>Clinical Information</h4>
|
||||
|
||||
<h5>patient_name</h5>
|
||||
<div class="p-4 border-gray-100">
|
||||
{{ $study->patient_name }}
|
||||
</div>
|
||||
<x-section-border/>
|
||||
|
||||
@if(may(\App\Models\Enums\Permission::StudyMetadataEdit))
|
||||
<a class="btn btn-sm" href="{{ route('staff.meta.edit', $study->hash) }}">Edit</a>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
28
resources/views/staff/meta/view.blade.php
Normal file
28
resources/views/staff/meta/view.blade.php
Normal file
@ -0,0 +1,28 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __('Metadata View') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div>
|
||||
<div class="max-w-7xl mx-auto py-10 sm:px-6 lg:px-8">
|
||||
|
||||
<div class="mt-10 sm:mt-0">
|
||||
<h4>Clinical Information</h4>
|
||||
|
||||
<h5>patient_name</h5>
|
||||
<div class="p-4 border-gray-100">
|
||||
{{ $study->patient_name }}
|
||||
</div>
|
||||
<x-section-border/>
|
||||
|
||||
@if(may(\App\Models\Enums\Permission::StudyMetadataEdit))
|
||||
<a class="btn btn-sm" href="{{ route('staff.meta.edit', $study->hash) }}">Edit</a>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
@ -62,7 +62,11 @@ class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-
|
||||
@foreach($studies as $study)
|
||||
<tr>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->accession_number }}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->patient_id }}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
||||
<a href="{{ $study->getMetadataLink() }}">
|
||||
{{ $study->patient_id }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
||||
<a href="{{ $study->getHistoryLink() }}">
|
||||
{{ $study->patient_name }}
|
||||
|
@ -5,6 +5,7 @@
|
||||
use App\Http\Controllers\SocialLoginController;
|
||||
use App\Http\Controllers\Staff\StudiesController;
|
||||
use App\Http\Controllers\Staff\StudyHistoryController;
|
||||
use App\Http\Controllers\StudyMetadataController;
|
||||
use App\Http\Controllers\System\SyncOrthancController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
@ -42,6 +43,12 @@
|
||||
Route::post('{hashid}', [StudyHistoryController::class, 'save'])->name('save');
|
||||
});
|
||||
|
||||
Route::group(['prefix' => 'meta', 'as' => 'meta.'], function () {
|
||||
Route::get('{hashid}', [StudyMetadataController::class, 'view'])->name('view');
|
||||
Route::get('{hashid}/edit', [StudyMetadataController::class, 'edit'])->name('edit');
|
||||
Route::post('{hashid}', [StudyMetadataController::class, 'save'])->name('save');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user