wip
This commit is contained in:
parent
18be22aafc
commit
5cbbe38ae8
@ -73,19 +73,42 @@ public function create()
|
||||
{
|
||||
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove]), 403);
|
||||
$this->decodeKeys();
|
||||
$study = Study::select(['id', 'patient_name', 'patient_id', 'patient_sex', 'patient_birthdate', 'study_description', 'report_status', 'study_status'])->findOrFail($this->key);
|
||||
$study = Study::select(['id', 'patient_name', 'patient_id', 'patient_sex', 'patient_birthdate', 'study_description', 'report_status', 'study_status', 'dicomServer'])->findOrFail($this->key);
|
||||
if (! $study->canEditReport()) {
|
||||
return redirect()->back()->with('error', 'Report is already approved.');
|
||||
return view('content.pages.notice', [
|
||||
'color' => 'warning',
|
||||
'title' => 'Read Completed',
|
||||
'heading' => 'Read Completed',
|
||||
'message' => 'Reading has been completed already.',
|
||||
]);
|
||||
}
|
||||
|
||||
if (! $study->canObtainLock()) {
|
||||
return view('content.pages.notice', [
|
||||
'color' => 'warning',
|
||||
'title' => 'Study Locked',
|
||||
'heading' => 'Study Locked',
|
||||
'message' => 'Study is locked by another user.',
|
||||
]);
|
||||
}
|
||||
|
||||
if ($study->isUnlocked()) {
|
||||
$study->lockStudy();
|
||||
audit()
|
||||
->on($study)
|
||||
->did(Activity::Study_Lock)
|
||||
->log();
|
||||
}
|
||||
|
||||
// todo: study_status: Read in Progress
|
||||
|
||||
$report = StudyReport::forStudy($study)
|
||||
->where('report_status', ReportStatus::Preliminary->value)
|
||||
->select(['id', 'accession_number', 'file_path'])
|
||||
->latest()
|
||||
->first();
|
||||
$close = false;
|
||||
|
||||
return view('staff.reports.create', compact('study', 'report', 'close'));
|
||||
return view('staff.reports.create', compact('study', 'report'));
|
||||
}
|
||||
|
||||
public function edit(string $uuid)
|
||||
|
@ -404,6 +404,14 @@ public function isLockedBy(User|int|null $user = null): bool
|
||||
return $this->locking_physician_id === me($user)->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if study has been locked by the given user or is unlocked. Returns false if the study was locked by another user.
|
||||
*/
|
||||
public function canObtainLock(User|int|null $user = null): bool
|
||||
{
|
||||
return $this->isUnlocked() || $this->isLockedBy($user);
|
||||
}
|
||||
|
||||
public function setReportStatus(ReportStatus $status, User|int|null $user = null): void
|
||||
{
|
||||
$user_id = me($user)->id;
|
||||
|
46
resources/views/content/pages/notice.blade.php
Normal file
46
resources/views/content/pages/notice.blade.php
Normal file
@ -0,0 +1,46 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
crossorigin="anonymous">
|
||||
<title>{{ $title }}</title>
|
||||
<style>
|
||||
body {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 50px;
|
||||
}
|
||||
|
||||
.alert-coupon {
|
||||
border: 1px dashed;
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-size: 20px;
|
||||
line-height: 1.5;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="alert alert-{{ $color }} alert-coupon">
|
||||
<h4>{{ $heading }}</h4>
|
||||
<p>{{ $message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>SAVE</title>
|
||||
<title>{{ $study->getPatientDemographic() }}</title>
|
||||
|
||||
@vite([
|
||||
'resources/assets/vendor/scss/core.scss',
|
||||
@ -18,13 +18,13 @@
|
||||
<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>
|
||||
<td>Age / Sex</td>
|
||||
<td class="fw-semibold">{{ $study->sexAge() }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td class="fw-semibold">{{ $study->patient_id }}</td>
|
||||
<td>Description</td>
|
||||
<td>Study</td>
|
||||
<td class="fw-semibold">{{ $study->study_description }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user