Compare commits
3 Commits
a7228b8a61
...
ef908dd4bd
Author | SHA1 | Date | |
---|---|---|---|
ef908dd4bd | |||
19a501c2e2 | |||
49b4341227 |
@ -627,7 +627,7 @@ private function generateActionButtons(Study $study): string
|
||||
foreach (WorklistGuard::worklistButtons($study) as $button) {
|
||||
switch ($button) {
|
||||
case WorklistButton::StudyMetadata:
|
||||
$btns[] = $this->renderImageLink($study->hash, 'info.png', 'show-study', 'Info');
|
||||
$btns[] = $this->renderImageLink($study->hash, $study->hasHistory() ? 'info-green.png' : 'info.png', 'show-study', 'Info');
|
||||
break;
|
||||
case WorklistButton::Assign:
|
||||
$btns[] = $this->renderImageLink($study->hash, 'assign.png', 'show-assign', 'Assign');
|
||||
|
@ -9,12 +9,13 @@
|
||||
use App\Models\StudyDetails;
|
||||
use App\Services\AuditTrail\Activity;
|
||||
use App\Services\SessionHelper;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class HistoryController extends HashidControllerBase
|
||||
{
|
||||
public function view()
|
||||
{
|
||||
abort_unless(auth()->user()->may(Permission::StudyHistoryView), 403);
|
||||
abort_unless(may(Permission::StudyHistoryView), 403);
|
||||
$this->decodeKeys();
|
||||
$details = StudyDetails::historyOnly($this->key);
|
||||
$study = Study::findOrFail($this->key);
|
||||
@ -25,7 +26,7 @@ public function view()
|
||||
public function edit()
|
||||
{
|
||||
// SessionHelper::setIntendedUrl();
|
||||
abort_unless(auth()->user()->may(Permission::StudyHistoryEdit), 403);
|
||||
abort_unless(may(Permission::StudyHistoryEdit), 403);
|
||||
$this->decodeKeys();
|
||||
$details = StudyDetails::historyOnly($this->key);
|
||||
$study = Study::findOrFail($this->key);
|
||||
@ -35,12 +36,13 @@ public function edit()
|
||||
|
||||
public function save(StudyHistoryRequest $request)
|
||||
{
|
||||
abort_unless(auth()->user()->may(Permission::StudyHistoryEdit), 403);
|
||||
abort_unless(may(Permission::StudyHistoryEdit), 403);
|
||||
$this->decodeKeys();
|
||||
$details = StudyDetails::historyOnly($this->key);
|
||||
$payload = array_trim_strings($request->validated());
|
||||
unset($payload['study_id']);
|
||||
$details->update($payload);
|
||||
Cache::forget("study.has_history.{$this->key}");
|
||||
|
||||
audit()
|
||||
->did(Activity::Study_History_Edit)
|
||||
|
@ -12,12 +12,13 @@
|
||||
use App\Services\Pacs\PacsUrlGen;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
@ -28,7 +29,6 @@ class Study extends BaseModel implements HasMedia
|
||||
use HasDepartment;
|
||||
use HashableId;
|
||||
use HasOrganization;
|
||||
use HasTimestamps;
|
||||
use InteractsWithMedia;
|
||||
|
||||
public const string MEDIA_COLLECTION = 'attachments';
|
||||
@ -543,4 +543,16 @@ protected function casts(): array
|
||||
'patient_birthdate' => 'immutable_date',
|
||||
];
|
||||
}
|
||||
|
||||
public function hasHistory(): bool
|
||||
{
|
||||
return Cache::remember("study.has_history.{$this->id}",
|
||||
now()->addMinutes(15),
|
||||
function () {
|
||||
return DB::table('study_details')
|
||||
->where('study_id', $this->id)
|
||||
->whereNotNull('clinical_history')
|
||||
->exists();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 902 B After Width: | Height: | Size: 1.9 KiB |
BIN
resources/imgs/info-green.png
Normal file
BIN
resources/imgs/info-green.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 915 B After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in New Issue
Block a user