wip history
This commit is contained in:
parent
dce7af78b9
commit
19865fc178
38
app/Http/Controllers/Staff/StudyHistoryController.php
Normal file
38
app/Http/Controllers/Staff/StudyHistoryController.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Staff;
|
||||||
|
|
||||||
|
use App\Http\Controllers\HashidControllerBase;
|
||||||
|
use App\Http\Requests\StudyHistoryRequest;
|
||||||
|
use App\Models\Enums\Permission;
|
||||||
|
use App\Models\StudyDetails;
|
||||||
|
|
||||||
|
class StudyHistoryController extends HashidControllerBase
|
||||||
|
{
|
||||||
|
public function view()
|
||||||
|
{
|
||||||
|
abort_unless(auth()->user()->can(Permission::StudyHistoryView) || auth()->user()->isAdmin(), 403);
|
||||||
|
$this->decodeKeys();
|
||||||
|
$details = StudyDetails::where('study_id', $this->key)->first();
|
||||||
|
|
||||||
|
return view('staff.history.view', compact('details'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
abort_unless(auth()->user()->can(Permission::StudyHistoryEdit) || auth()->user()->isAdmin(), 403);
|
||||||
|
$this->decodeKeys();
|
||||||
|
$details = StudyDetails::where('study_id', $this->key)->first();
|
||||||
|
|
||||||
|
return view('staff.history.edit', compact('details'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save(StudyHistoryRequest $request)
|
||||||
|
{
|
||||||
|
abort_unless(auth()->user()->can(Permission::StudyHistoryEdit) || auth()->user()->isAdmin(), 403);
|
||||||
|
$this->decodeKeys();
|
||||||
|
$details = StudyDetails::where('study_id', $this->key)->first();
|
||||||
|
|
||||||
|
return redirect()->route('staff.history.show', $this->key);
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\Enums\Permission;
|
||||||
use App\Models\Enums\ReportStatus;
|
use App\Models\Enums\ReportStatus;
|
||||||
use App\Models\Enums\StudyLevelStatus;
|
use App\Models\Enums\StudyLevelStatus;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
@ -57,4 +58,18 @@ public function scopeUnlocked($query)
|
|||||||
{
|
{
|
||||||
return $query->where('is_locked', false);
|
return $query->where('is_locked', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHistoryLink(): string
|
||||||
|
{
|
||||||
|
$user = auth()->user();
|
||||||
|
if ($user->may(Permission::StudyHistoryEdit)) {
|
||||||
|
return route('staff.history.edit', _h($this->id));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->may(Permission::StudyHistoryView)) {
|
||||||
|
return route('staff.history.view', _h($this->id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return '#';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ protected function casts()
|
|||||||
return [
|
return [
|
||||||
'properties' => 'array',
|
'properties' => 'array',
|
||||||
'series' => 'array',
|
'series' => 'array',
|
||||||
|
'assignment_log' => 'array',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
use App\Models\Enums\Permission;
|
||||||
|
use App\Models\Enums\UserRole;
|
||||||
use Database\Factories\UserFactory;
|
use Database\Factories\UserFactory;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
@ -85,4 +87,14 @@ public function scopeActive($query)
|
|||||||
{
|
{
|
||||||
return $query->where('is_active', true);
|
return $query->where('is_active', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isAdmin(): bool
|
||||||
|
{
|
||||||
|
return $this->hasRole(UserRole::Admin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function may(Permission $perm): bool
|
||||||
|
{
|
||||||
|
return $this->hasRole(UserRole::Admin) || $this->can($perm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
42
resources/views/staff/history/edit.blade.php
Normal file
42
resources/views/staff/history/edit.blade.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<x-app-layout>
|
||||||
|
<x-slot name="header">
|
||||||
|
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||||
|
{{ __('History') }}
|
||||||
|
</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>Clinical History</h5>
|
||||||
|
<div class="p-4 border-gray-100">
|
||||||
|
{{ $details->clinical_history }}
|
||||||
|
</div>
|
||||||
|
<x-section-border />
|
||||||
|
|
||||||
|
<h5>surgical_history</h5>
|
||||||
|
<div class="p-4 border-gray-100">
|
||||||
|
{{ $details->surgical_history }}
|
||||||
|
</div>
|
||||||
|
<x-section-border />
|
||||||
|
|
||||||
|
<h5>lab_results</h5>
|
||||||
|
<div class="p-4 border-gray-100">
|
||||||
|
{{ $details->lab_results }}
|
||||||
|
</div>
|
||||||
|
<x-section-border />
|
||||||
|
|
||||||
|
<h5>clinical_diagnosis</h5>
|
||||||
|
<div class="p-4 border-gray-100">
|
||||||
|
{{ $details->clinical_diagnosis }}
|
||||||
|
</div>
|
||||||
|
<x-section-border />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</x-app-layout>
|
42
resources/views/staff/history/view.blade.php
Normal file
42
resources/views/staff/history/view.blade.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<x-app-layout>
|
||||||
|
<x-slot name="header">
|
||||||
|
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||||
|
{{ __('History 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>Clinical History</h5>
|
||||||
|
<div class="p-4 border-gray-100">
|
||||||
|
{{ $details->clinical_history }}
|
||||||
|
</div>
|
||||||
|
<x-section-border/>
|
||||||
|
|
||||||
|
<h5>surgical_history</h5>
|
||||||
|
<div class="p-4 border-gray-100">
|
||||||
|
{{ $details->surgical_history }}
|
||||||
|
</div>
|
||||||
|
<x-section-border/>
|
||||||
|
|
||||||
|
<h5>lab_results</h5>
|
||||||
|
<div class="p-4 border-gray-100">
|
||||||
|
{{ $details->lab_results }}
|
||||||
|
</div>
|
||||||
|
<x-section-border/>
|
||||||
|
|
||||||
|
<h5>clinical_diagnosis</h5>
|
||||||
|
<div class="p-4 border-gray-100">
|
||||||
|
{{ $details->clinical_diagnosis }}
|
||||||
|
</div>
|
||||||
|
<x-section-border/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</x-app-layout>
|
@ -63,8 +63,10 @@ class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-
|
|||||||
<tr>
|
<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->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">{{ $study->patient_id }}</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900"><a
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
||||||
href="{{ route('studies.details', _h($study->id)) }}">{{ $study->patient_name }}</a>
|
<a href="{{ $study->getHistoryLink() }}">
|
||||||
|
{{ $study->patient_name }}
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->patient_sex }}</td>
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->patient_sex }}</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->patient_birthdate }}</td>
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->patient_birthdate }}</td>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
use App\Http\Controllers\Radiologist\ReportWriteController;
|
use App\Http\Controllers\Radiologist\ReportWriteController;
|
||||||
use App\Http\Controllers\SocialLoginController;
|
use App\Http\Controllers\SocialLoginController;
|
||||||
use App\Http\Controllers\Staff\StudiesController;
|
use App\Http\Controllers\Staff\StudiesController;
|
||||||
|
use App\Http\Controllers\Staff\StudyHistoryController;
|
||||||
use App\Http\Controllers\System\SyncOrthancController;
|
use App\Http\Controllers\System\SyncOrthancController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
@ -33,6 +34,16 @@
|
|||||||
Route::get('{hashid}/details', [StudiesController::class, 'details'])->name('details');
|
Route::get('{hashid}/details', [StudiesController::class, 'details'])->name('details');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::group(['as' => 'staff.'], function () {
|
||||||
|
|
||||||
|
Route::group(['prefix' => 'history', 'as' => 'history.'], function () {
|
||||||
|
Route::get('{hashid}', [StudyHistoryController::class, 'view'])->name('view');
|
||||||
|
Route::get('{hashid}/edit', [StudyHistoryController::class, 'edit'])->name('edit');
|
||||||
|
Route::post('{hashid}', [StudyHistoryController::class, 'save'])->name('save');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['prefix' => 'shares', 'as' => 'shares.'], function () {
|
Route::group(['prefix' => 'shares', 'as' => 'shares.'], function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user