wip
This commit is contained in:
parent
0d81629027
commit
0ef547bb7f
@ -56,13 +56,14 @@ public function create()
|
|||||||
{
|
{
|
||||||
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove]), 403);
|
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove]), 403);
|
||||||
$this->decodeKeys();
|
$this->decodeKeys();
|
||||||
$study = Study::findOrFail($this->key);
|
$study = Study::select(['id', 'patient_name', 'patient_id', 'patient_sex', 'patient_birthdate', 'study_description'])->findOrFail($this->key);
|
||||||
if (! $study->canEditReport()) {
|
if (! $study->canEditReport()) {
|
||||||
return redirect()->back()->with('error', 'Report is already approved.');
|
return redirect()->back()->with('error', 'Report is already approved.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$report = StudyReport::where('study_id', $study->id)
|
$report = StudyReport::forStudy($study)
|
||||||
->where('report_status', ReportStatus::Preliminary->value)
|
->where('report_status', ReportStatus::Preliminary->value)
|
||||||
|
->select(['id', 'accession_number', 'file_path'])
|
||||||
->latest()
|
->latest()
|
||||||
->first();
|
->first();
|
||||||
$close = false;
|
$close = false;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
use App\Domain\Report\ExportFormat;
|
use App\Domain\Report\ExportFormat;
|
||||||
use App\Domain\Report\ReportStatus;
|
use App\Domain\Report\ReportStatus;
|
||||||
use App\Services\Report\ReportStorage;
|
use App\Services\Report\ReportStorage;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
|
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
@ -28,6 +29,13 @@ public function approver(): BelongsTo
|
|||||||
return $this->belongsTo(User::class, 'approved_by_id');
|
return $this->belongsTo(User::class, 'approved_by_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeForStudy(Builder $query, Study|int $study): Builder
|
||||||
|
{
|
||||||
|
$query->where('study_id', $study instanceof Study ? $study->id : $study);
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
public function setStatus(ReportStatus $status, User|int|null $user = null): void
|
public function setStatus(ReportStatus $status, User|int|null $user = null): void
|
||||||
{
|
{
|
||||||
$user_id = me($user)->id;
|
$user_id = me($user)->id;
|
||||||
|
@ -13,8 +13,21 @@
|
|||||||
<link rel="stylesheet" href="{{ asset('ck.css') }}">
|
<link rel="stylesheet" href="{{ asset('ck.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body @if ($close) onload="window.close()" @endif>
|
<body @if ($close) onload="window.close()" @endif>
|
||||||
<div class="py-4">
|
<div class="py-4 px-12">
|
||||||
<p class="text-center">HEADER</p>
|
<table class="table table-sm table-bordered">
|
||||||
|
<tr>
|
||||||
|
<td>Patient Name</td>
|
||||||
|
<td class="fw-semibold">{{ $study->patient_name }}</td>
|
||||||
|
<td>Patient Sex</td>
|
||||||
|
<td class="fw-semibold">{{ $study->patient_sex }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>ID</td>
|
||||||
|
<td class="fw-semibold">{{ $study->patient_id }}</td>
|
||||||
|
<td>Description</td>
|
||||||
|
<td class="fw-semibold">{{ $study->study_description }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="container-fluid px-4 mb-4">
|
<div class="container-fluid px-4 mb-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Loading…
Reference in New Issue
Block a user