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\Models\Study;
use App\Services\Report\ReportManager;
use App\Services\Report\StampService;
class ReportController extends HashidControllerBase
{
@ -80,9 +81,17 @@ public function view(string $uuid)
{
ReportManager::ensureDownloadAccess();
$manager = ReportManager::fromReport($uuid);
$title = 'View Report';
$title = 'Report Quick View ' . $manager->getStudy()->getPatientDemographic();
$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;
}
public function isFinalized(): bool
{
return $this->report_status->value >= ReportStatus::Finalized->value;
}
/**
* @return array<string, string>
*/

View File

@ -7,8 +7,8 @@
use App\Models\StudyReport;
use app\Services\Export\Formats\HtmlExport;
use app\Services\Export\Formats\PdfExport;
use app\Services\Export\Formats\Word2007Export;
use app\Services\Export\Formats\Word2003Export;
use app\Services\Export\Formats\Word2007Export;
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
{
$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);
}

View File

@ -25,4 +25,9 @@ public function signatureImagePath(): string
{
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')
@section('content')
<header class="py-4">
<div class="container">
<div class="p-2 p-lg-2 bg-light rounded-3">
<div class="text-center">
<h6 class="text-muted">
{{ $report->study->modality }} Report
</h6>
<h3>
{{ $report->study->study_description }}
</h3>
<div class="container container-main">
@isset($notice)
<section class="pt-4" name="notice">
<div class="container-md px-md-3">
<div class="alert alert-warning" role="alert">
<h5 class="alert-heading d-flex align-items-center">
<span class="alert-icon rounded"><i
class="fa-solid fs-4 fa-circle-radiation me-2"></i></span>Notice
</h5>
<hr>
<p class="mb-0">{{ $notice }}</p>
</div>
</div>
</div>
</header>
</section>
@endisset
<section class="pt-4" name="patient">
<div class="container">
<div class="mx-2">
<table class="table table-bordered border-gray">
<tr>
@ -42,14 +43,45 @@
</tr>
</table>
</div>
</div>
</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">
<div class="container px-lg-3">
<div class="px-lg-3">
<div class="border-dark mb-8">
{!! $report->getContent() !!}
</div>
</div>
</section>
@isset($signature)
<section class="pt-4" name="signature">
<div class="px-lg-3">
<img src="{{ $signature }}">
</div>
</section>
@endisset
</div>
@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 http-equiv="X-UA-Compatible" content="IE=edge">
<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.gstatic.com" crossorigin>
<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>
<style>
body {
@ -15,19 +19,47 @@
width: 100%;
font-family: "Inter", serif;
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>
@stack('header')
</head>
<body>
<nav class="navbar navbar-light bg-light">
<nav class="navbar navbar-light bg-light">
<div class="container px-lg-2">
<span class="navbar-brand fw-semibold">{{ config('app.name') }}</span>
</div>
</nav>
</nav>
@yield('content')
@yield('content')
@stack('footer')
@stack('footer')
</body>
</html>

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
*
@ -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;
}
}