This commit is contained in:
Dr Masroor Ehsan 2025-01-12 13:17:35 +06:00
parent bfbed52332
commit c6bb55862c
18 changed files with 313 additions and 230 deletions

View File

@ -7,6 +7,7 @@
use App\Http\Requests\StoreReportRequest; use App\Http\Requests\StoreReportRequest;
use App\Models\Study; use App\Models\Study;
use App\Services\Report\ReportManager; use App\Services\Report\ReportManager;
use App\Services\Report\StampService;
class ReportController extends HashidControllerBase class ReportController extends HashidControllerBase
{ {
@ -80,9 +81,17 @@ public function view(string $uuid)
{ {
ReportManager::ensureDownloadAccess(); ReportManager::ensureDownloadAccess();
$manager = ReportManager::fromReport($uuid); $manager = ReportManager::fromReport($uuid);
$title = 'View Report'; $title = 'Report Quick View ' . $manager->getStudy()->getPatientDemographic();
$report = $manager->getReport(); $report = $manager->getReport();
if ($report->isFinalized()) {
$stamper = new StampService($report->read_by_id);
$signature = $stamper->hasSignatureImage() ? $stamper->signatureImageUrl() : null;
$notice = null;
} else {
$signature = null;
$notice = 'This is a preliminary radiology interpretation that has not been finalized or approved by a radiologist. It is not intended for diagnostic purposes.';
}
return view('staff.reports.viewer.html-report', compact('report', 'title')); return view('staff.reports.viewer.html-report', compact('report', 'title', 'signature', 'notice'));
} }
} }

View File

@ -126,6 +126,11 @@ public function canEdit(User|int|null $user = null): bool
return false; return false;
} }
public function isFinalized(): bool
{
return $this->report_status->value >= ReportStatus::Finalized->value;
}
/** /**
* @return array<string, string> * @return array<string, string>
*/ */

View File

@ -7,8 +7,8 @@
use App\Models\StudyReport; use App\Models\StudyReport;
use app\Services\Export\Formats\HtmlExport; use app\Services\Export\Formats\HtmlExport;
use app\Services\Export\Formats\PdfExport; use app\Services\Export\Formats\PdfExport;
use app\Services\Export\Formats\Word2007Export;
use app\Services\Export\Formats\Word2003Export; use app\Services\Export\Formats\Word2003Export;
use app\Services\Export\Formats\Word2007Export;
final readonly class Exporters final readonly class Exporters
{ {

View File

@ -21,7 +21,7 @@ public static function make(int $study_id, ?StudyReport $report = null): static
public static function fromReport(string $uuid): static public static function fromReport(string $uuid): static
{ {
$report = StudyReport::accession($uuid)->select(['id', 'study_id', 'file_path', 'created_at'])->firstOrFail(); $report = StudyReport::accession($uuid)->firstOrFail();
return static::make($report->study_id, $report); return static::make($report->study_id, $report);
} }

View File

@ -25,4 +25,9 @@ public function signatureImagePath(): string
{ {
return Storage::disk('public')->path($this->user->radiologistProfile?->signature_image_path); return Storage::disk('public')->path($this->user->radiologistProfile?->signature_image_path);
} }
public function signatureImageUrl(): string
{
return Storage::disk('public')->url($this->user->radiologistProfile?->signature_image_path);
}
} }

View File

@ -1,23 +1,24 @@
@extends('staff.reports.viewer.layout') @extends('staff.reports.viewer.layout')
@section('content') @section('content')
<header class="py-4"> <div class="container container-main">
<div class="container">
<div class="p-2 p-lg-2 bg-light rounded-3"> @isset($notice)
<div class="text-center"> <section class="pt-4" name="notice">
<h6 class="text-muted"> <div class="container-md px-md-3">
{{ $report->study->modality }} Report <div class="alert alert-warning" role="alert">
</h6> <h5 class="alert-heading d-flex align-items-center">
<h3> <span class="alert-icon rounded"><i
{{ $report->study->study_description }} class="fa-solid fs-4 fa-circle-radiation me-2"></i></span>Notice
</h3> </h5>
<hr>
<p class="mb-0">{{ $notice }}</p>
</div> </div>
</div> </div>
</div> </section>
</header> @endisset
<section class="pt-4" name="patient"> <section class="pt-4" name="patient">
<div class="container">
<div class="mx-2"> <div class="mx-2">
<table class="table table-bordered border-gray"> <table class="table table-bordered border-gray">
<tr> <tr>
@ -42,14 +43,45 @@
</tr> </tr>
</table> </table>
</div> </div>
</div>
</section> </section>
<header class="py-2">
<div class="p-2 bg-light rounded-1">
<div class="text-center">
<h6 class="text-muted">
{{ $report->study->modality }} Report
</h6>
<h3>
{{ $report->study->study_description }}
</h3>
</div>
</div>
</header>
<section class="pt-4" name="report"> <section class="pt-4" name="report">
<div class="container px-lg-3"> <div class="px-lg-3">
<div class="border-dark mb-8"> <div class="border-dark mb-8">
{!! $report->getContent() !!} {!! $report->getContent() !!}
</div> </div>
</div> </div>
</section> </section>
@isset($signature)
<section class="pt-4" name="signature">
<div class="px-lg-3">
<img src="{{ $signature }}">
</div>
</section>
@endisset
</div>
@endsection @endsection
@push('footer')
<footer class="footer">
<div class="container">
<span class="text-muted">
{{ config('app.name') }} &copy; {{ now()->year }} Dr. Masroor Ehsan
</span>
</div>
</footer>
@endpush

View File

@ -4,10 +4,14 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css"
integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg=="
crossorigin="anonymous" referrerpolicy="no-referrer"/>
<title>{{ $title }}</title> <title>{{ $title }}</title>
<style> <style>
body { body {
@ -15,6 +19,34 @@
width: 100%; width: 100%;
font-family: "Inter", serif; font-family: "Inter", serif;
font-optical-sizing: auto; font-optical-sizing: auto;
background: #edf1f5;
}
.container-main {
margin-top: 30px;
margin-bottom: 10px;
padding: 8px 8px 30px 8px;
background: #fff;
border: 1px solid #d3cfcf;
border-radius: 8px;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
-webkit-box-shadow: 0 0 14px rgba(0, 0, 0, .1);
-moz-box-shadow: 0 0 14px rgba(0, 0, 0, .1);
box-shadow: 0 0 14px rgba(0, 0, 0, .1);
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 40px;
line-height: 40px;
background-color: #f5f5f5;
}
.footer p, span {
text-align: center;
font-size: 12px;
} }
</style> </style>
@stack('header') @stack('header')

View File

@ -155,72 +155,6 @@ public function replaceChartsWithImages($source){
} }
} }
/**
* To add support of sys_get_temp_dir for PHP versions under 5.2.1
*
* @access protected
* @return string
*/
protected function getTempDirPath()
{
if ($this->phpdocxconfig['settings']['temp_path']) {
return $this->phpdocxconfig['settings']['temp_path'];
}
if (!function_exists('sys_get_temp_dir')) {
function sys_get_temp_dir()
{
if ($temp = getenv('TMP')) {
return $temp;
}
if ($temp = getenv('TEMP')) {
return $temp;
}
if ($temp = getenv('TMPDIR')) {
return $temp;
}
$temp = tempnam(__FILE__, '');
if (file_exists($temp)) {
unlink($temp);
return dirname($temp);
}
return null;
}
} else {
return sys_get_temp_dir();
}
}
/**
*
*/
protected function getTemplateImage($name, $id)
{
$templateImage = '<pic:pic xmlns:r="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<pic:nvPicPr>
<pic:cNvPr id="0" name="' . $name .'"/>
<pic:cNvPicPr/>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="' . $id . '"/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</pic:blipFill>
<pic:spPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="4876800" cy="3657600"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
</pic:spPr>
</pic:pic>';
return $templateImage;
}
/** /**
* Transform all documents supported by OpenOffice * Transform all documents supported by OpenOffice
* *
@ -341,4 +275,70 @@ public function transformDocument($source, $target, $options = array())
} }
} }
/**
* To add support of sys_get_temp_dir for PHP versions under 5.2.1
*
* @access protected
* @return string
*/
protected function getTempDirPath()
{
if ($this->phpdocxconfig['settings']['temp_path']) {
return $this->phpdocxconfig['settings']['temp_path'];
}
if (!function_exists('sys_get_temp_dir')) {
function sys_get_temp_dir()
{
if ($temp = getenv('TMP')) {
return $temp;
}
if ($temp = getenv('TEMP')) {
return $temp;
}
if ($temp = getenv('TMPDIR')) {
return $temp;
}
$temp = tempnam(__FILE__, '');
if (file_exists($temp)) {
unlink($temp);
return dirname($temp);
}
return null;
}
} else {
return sys_get_temp_dir();
}
}
/**
*
*/
protected function getTemplateImage($name, $id)
{
$templateImage = '<pic:pic xmlns:r="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<pic:nvPicPr>
<pic:cNvPr id="0" name="' . $name .'"/>
<pic:cNvPicPr/>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="' . $id . '"/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</pic:blipFill>
<pic:spPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="4876800" cy="3657600"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
</pic:spPr>
</pic:pic>';
return $templateImage;
}
} }