Files
hpt_inventory/resources/views/shared/test_result_4_deletable.blade.php
2026-06-10 16:42:20 +07:00

961 lines
57 KiB
PHP

<div class=" A4-portrait report-container">
<div class="psample-result active" id="presult-1">
<title>Result</title>
<meta name="viewport" content="width=device-width, initial-scale=.5, maximum-scale=12.0, minimum-scale=.25, user-scalable=yes">
<link rel="stylesheet" href="{{url(env("APP_URL").'storage/assets/libs/lightgallery/lightgallery.css')}}" >
<style>
.A4-portrait {
margin: 0;
display: flex;
justify-content: center; /* center horizontally */
}
.report-container {
background: white;
padding: 20px;
border-radius: 10px;
}
@font-face {
font-family: 'KhmerOS_muollight';
src: url('{{url(env("APP_URL").'storage/assets/fonts/KhmerOS_muollight.ttf')}}');
display:swap;
}
@php
$configures = collect($labConfigures);
$fontNameHeader = ($configures->where('atrribute_code', 'FONT_NAME_FOR_RESULT_HEADER')->pluck('assigned_attribute_value')->first());
$fontSizeHeader = ($configures->where('atrribute_code', 'FONT_SIZE_FOR_RESULT_HEADER')->pluck('assigned_attribute_value')->first());
$resultColorHeader = ($configures->where('atrribute_code', 'COLOR_FOR_RESULT_HEADER')->pluck('assigned_attribute_value')->first());
$fontName = ($configures->where('atrribute_code', 'FONT_NAME_FOR_RESULT')->pluck('assigned_attribute_value')->first());
$fontSize = ($configures->where('atrribute_code', 'FONT_SIZE_FOR_RESULT')->pluck('assigned_attribute_value')->first());
$resultColor = ($configures->where('atrribute_code', 'COLOR_FOR_RESULT')->pluck('assigned_attribute_value')->first());
$lineHeight = ($configures->where('atrribute_code', 'LINE_HEIGHT_FOR_RESULT_HEADER')->pluck('assigned_attribute_value')->first());
@endphp
@if(!empty($lineHeight))
p{
line-height 0 !important;
}
._department-sample-info tr
,.line-height_{
line-height: {{$lineHeight}} !important;
}
@endif
@font-face {
font-family: 'result_font';
}
@font-face {
font-family: 'label_header_font';
}
.result-page-color{
color: {{empty($resultColor) ? '#000' : $resultColor}};
}
.patient-info tr td{
font-family: "{{(App::isLocale('en') ? (empty($fontNameHeader) ? 'Times New Roman':$fontNameHeader) : 'Khmer OS Siemreap')}}";
font-size:15px !important;
}
.header-label-title-color{
color: {{empty($resultColorHeader) ? '#0000ff' : $resultColorHeader}};
font-family: '{{(empty($fontNameHeader) ? 'Times New Roman':$fontNameHeader)}}';
}
.header-label-font{
font-family: "{{(App::isLocale('en') ? (empty($fontNameHeader) ? 'Times New Roman':$fontNameHeader) : 'Khmer OS Siemreap')}}";
}
.result-font, .name{
font-family: '{{empty($fontName) ? 'Times New Roman': $fontName }}';
}
._department-sample-info tr td{
padding-top: 0px !important;
padding-bottom: 0px !important;
}
.result-font-size{
font-size: {{empty($fontSize) ? '13pt' : $fontSize}};
}
.KhmerOS {
font-family: 'SourceSerifPro-Regular', 'KhmerOS', 'serif';
}
.KhmerMoulLight {
font-family: 'SourceSerifPro-Regular', 'KhmerOS_muollight', 'serif';
}
.tacteng {
font-family: Tacteng !important;
}
.sourceserifpro-bold {
font-family: '{{empty($fontName) ? 'Times New Roman': $fontName }}';
font-weight: bold;
}
page[size="A4"] {
background: white;
width: 21cm;
display: block;
margin: 10px auto;
margin-left: 0cm !important;
box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
padding: 0cm 1cm 1cm 1cm;
/*font-family: 'result_font';*/
font-family: '{{empty($fontName) ? 'Times New Roman': $fontName }}';
font-size: 12pt;
line-height: 23px;
page-break-after: always;
}
page[size="A4"], th, td {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
page[size="A4"] table {
border-spacing: 0px !important;
border-collapse: collapse !important;
}
table th, table td {
text-align: left;
}
table td {
font-weight: normal;
}
table.patient-info, table.department-sample-info {
border: 1px solid #7a7a7a;
line-height: 18px;
padding: 3px;
}
table.patient-info td, table.patient-info th {
vertical-align: top;
}
table.department-sample-info {
background-color: #ebebeb;
}
table.test-result {
font-family: 'SourceSerifPro-Regular', 'serif';
}
table.test-result tr th {
border-bottom: 1px solid black;
}
table.test-result tr th:not(:last-child), table.test-result tr td:not(:last-child) {
padding-right: .2cm;
}
table.test-result tr:first-child + tr td {
padding-top: 5px;
}
p.value-pair {
position: relative;
width: 100%;
margin: 0;
}
p.value-pair:before {
/*content: '';*/
content: none;
display: block;
position: absolute;
width: 100%;
bottom: .25rem;
height: 0;
line-height: 0;
border-bottom: 2px dotted #858585;
}
p.value-pair .name {
background: none;
z-index: 1;
position: relative;
padding-right: 5px;
}
p.value-pair .value {
background: white;
z-index: 1;
right: 0;
position: absolute;
padding-left: 5px;
font-weight: bold;
}
.out-of-range {
font-family: 'SourceSerifPro-Bold', 'serif';
font-weight: bold;
font-size: 12pt;
}
.text-center {
text-align: center;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-top {
vertical-align: top;
}
.text-bottom {
vertical-align: bottom;
}
.text-middle {
vertical-align: middle;
}
.text-bold {
font-weight: bold;
}
.text-no-wrap {
white-space: nowrap;
}
table.test-result {
line-height: 16px;
}
#footer {
line-height: 17px;
}
#footer .laboratory-address td {
border-top: 1px solid black;
padding-top: 10px;
}
#footer .result-footer-signature td {
vertical-align: top;
padding-bottom: 0px;
}
@page {
margin: 1cm 1cm 0;
}
@media print {
@page {
margin-top: 1cm;
margin-left: 0.2cm !important;
margin-bottom: 0cm;
@bottom-left {
content: content
}
}
body,
page[size="A4"] {
margin-left: 0cm !important;
padding-right: 0cm !important;
box-shadow: none;
background-color: transparent;
}
body .sample-result .sample-type{
page-break-inside: avoid;
}
#footer {
display: block;
position: fixed;
bottom: 0px;
padding-bottom: 0px !important;
}
#footer .result-footer-signature td {
vertical-align: top;
padding-bottom: 0px;
}
@if(Auth::id()==1)
#footer .page{
counter-increment:listCounter;
}
#footer .page:after{
content: counter(listCounter);
}
@endif
table .tname{
width:360px !important;
}
._department-sample-info tr td{
padding-top: 0px !important;
padding-bottom: 0px !important;
}
}
table .tname{
width:360px !important;
}
/*table ._department-sample-info tr th:first-child, table ._department-sample-info tr td:first-child{
width:390px !important;
}*/
#print_invoice_modal .table-inv th, .table-inv td {
/*border: 1px solid black;*/
/*border-collapse: collapse;*/
}
.abnormal{
font-weight: {{$labSettings->abnormal_result_font_weight==1?'bold':'normal'}} !important;
color: {{$labSettings->abnormal_text_color}} !important;
font-size: {{empty($fontSize) ? '13pt' : $fontSize}};
}
.patient-info{
font-family: "{{(App::isLocale('en') ? (empty($fontNameHeader) ? 'Time New Roman' : 'label_header_font' ): 'Khmer OS Siemreap')}}";
font-size: {{empty($fontSizeHeader) ? '13pt' : $fontSizeHeader}};
}
#footer{
font-family: "{{(App::isLocale('en') ? 'Times New Roman' : 'Khmer OS Siemreap')}}";
}
.font-changable-base-on-localize{
font-family: "{{(App::isLocale('en') ? (empty($fontNameHeader) ? 'Times New Roman':$fontNameHeader) : 'Khmer OS Siemreap')}}";
}
</style>
<input type="hidden" name="verify" id="verify" value="">
<input type="hidden" name="patient_sample_id" id="patient_sample_id" value="4353911">
<page size="A4">
<table border="0" width="100%">
<thead>
<tr id="def-logo">
<th style="width:100%" class="text-center">
@if(!empty($samplePhysician->logo))
<img width="98%" height="140px" class="rounded-0" src="{{ url(env("APP_URL").'storage/images/physician/'.$samplePhysician->logo) }}" />
@else
<table width="100%">
<tr>
<td style="width:120px; vertical-align: top;" class="text-center">
<img src="{{url(env("APP_URL").'storage/images/avatars/labs/'.$labSettings->logo)}}" alt="Logo" style="width: 120px;">
</td>
<td class="text-center">
<p style="line-height: 13px !important; font-size: 15pt; font-weight: bold; color: #0000ff;" class="KhmerMoulLight py-1">{{$labSettings->name_kh}}</p>
<p style="line-height: 13px !important; font-size: 13.5pt; font-weight: bold; color: #0000ff; font-family: 'Times New Roman';" class="text-uppercase py-1">{{$labSettings->name_en}}</p>
</td>
<td style="width:120px" >&nbsp;</td>
</tr>
</table>
@endif
</th>
</tr>
<tr id="dyn-logo" style="display:none;">
<th style="width:100%" class="text-center">
@if(!empty($labSettings->alternative_logo))
<img width="98%" height="140px" class="rounded-0" src="{{ url(env("APP_URL").'storage/images/avatars/labs/alternative_logo/'.$labSettings->alternative_logo) }}" />
@endif
</th>
</tr>
<tr>
<td class="text-top text-center" style="padding-top:0" valign="top">
<div style="font-size: 13.5pt; text-transform: uppercase; font-weight: bold;" class="header-label-title-color header-label-font">{{__('sample.print_title')}}</div>
</td>
</tr>
<tr>
<th style="padding-bottom: 10px !important;">
@if($labSettings->result_header_id==1)
<table width="100%" border="0" class="patient-info">
<tbody>
<tr>
<td class="header-label-title-color font-changable-base-on-localize" width="20%" style=" padding-top:1px; line-height:20px; font-weight:bold;">{{__('sample.table_patient_name')}}</td>
<td width="30%" style="padding-top:1px; line-height:20px; font-size: 12pt !important;" align="left">: {{$sample->patient->name_en}}</td>
<td class="header-label-title-color" width="25%" style="padding-left:0.7cm; padding-top:1px; line-height:20px; font-weight:bold;">{{__('sample.form_sample_number')}}</td>
<td width="25%" style="padding-top:1px; line-height:20px;" align="left">: {{$sample->sample_number}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="line-height:20px; font-weight:bold;">{{__('sample.form_patient_age')}}</td>
<td width="30%" style="line-height:20px;" align="left">: {{\App\Helpers\Helpers::getAge($sample->patient->dob, $sample->admission_date)}} <b class="header-label-title-color" style="margin-left:30px;">{{__('sample.form_patient_gender')}}</b> : {{\App\Helpers\Helpers::getGender($sample->patient->gender)}}</td>
<td class="header-label-title-color" width="25%" style="padding-left:0.7cm; line-height:20px; font-weight:bold;">{{__('sample.table_sample_source')}}</td>
<td width="25%" style="line-height:20px;" align="left">: {{@$sample->sample_source->name_en}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="line-height:20px; font-weight:bold;">{{__('patient.table_phon')}}</td>
<td width="30%" style="line-height:20px;" align="left">: {{$sample->patient->phone_number}}</td>
<td class="header-label-title-color" width="25%" style="padding-left:0.7cm; line-height:20px; font-weight:bold;">{{__('sample.requested_date')}}</td>
<td width="25%" style="line-height:20px;" align="left">: {{date('d-M-Y H:i',strtotime($sample->collected_date))}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="padding-bottom:1px; line-height:20px; font-weight:bold;">{{__('sample.form_patient_address')}}</td>
<td width="30%" style="padding-bottom:1px; line-height:20px;" align="left">: {{\App\Helpers\Helpers::getPatientAddress($sample->patient)}}</td>
<td class="header-label-title-color" width="25%" style="padding-left:0.7cm; padding-bottom:1px;line-height:20px; font-weight:bold;">{{__('sample.physician_name')}}</td>
<td width="25%" style="padding-bottom:1px; line-height:20px;" align="left">: {{explode("-",@$samplePhysician->name_en)[0]}}</td>
</tr>
</tbody>
</table>
@elseif($labSettings->result_header_id==2)
<table width="100%" border="0" class="patient-info">
<tbody>
<tr>
<td class="header-label-title-color font-changable-base-on-localize" width="20%" style="padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.table_patient_name')}}</td>
<td width="30%" style="padding-top:2px; line-height:20px; font-size: 12pt !important;" align="left">: {{$sample->patient->name_en}}</td>
<td class="header-label-title-color" width="25%" style="padding-left:0.7cm; padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.form_sample_number')}}</td>
<td width="25%" style="padding-top:2px; line-height:20px;" align="left">: {{$sample->sample_number}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="line-height:20px; font-weight:bold;">{{__('sample.form_patient_age')}}</td>
<td width="30%" style="line-height:20px;" align="left">: {{\App\Helpers\Helpers::getAge($sample->patient->dob, $sample->admission_date)}} <b class="header-label-title-color" style=" margin-left:40px;">{{__('sample.form_patient_gender')}}</b> : {{\App\Helpers\Helpers::getGender($sample->patient->gender)}}</td>
<td class="header-label-title-color" width="25%" style="padding-left:0.7cm; line-height:20px; font-weight:bold;">{{__('sample.requested_date')}}</td>
<td width="25%" style="line-height:20px;" align="left">: {{date('d-M-Y H:i',strtotime($sample->collected_date))}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('sample.form_patient_address')}}</td>
<td width="30%" style="padding-bottom:2px; line-height:20px;" align="left">: {{\App\Helpers\Helpers::getPatientAddress($sample->patient)}}</td>
<td class="header-label-title-color" width="25%" style="padding-left:0.7cm; padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('sample.physician_name')}}</td>
<td width="25%" style="padding-bottom:2px; line-height:20px;" align="left">: {{$samplePhysician->name_en}}</td>
</tr>
</tbody>
</table>
@elseif($labSettings->result_header_id==3)
<table width="100%" border="0" class="patient-info">
<tbody>
<tr>
<td width="20%" style="padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.table_patient_name')}}</td>
<td width="30%" style="padding-top:2px; line-height:20px; font-size: 12pt !important;" align="left">: {{$sample->patient->name_en}}</td>
<td width="25%" style="padding-left:0.7cm; padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.form_sample_number')}}</td>
<td width="25%" style="padding-top:2px; line-height:20px;" align="left">: {{$sample->sample_number}}</td>
</tr>
<tr>
<td width="20%" style="line-height:20px; font-weight:bold;">{{__('sample.form_patient_age')}}</td>
<td width="30%" style="line-height:20px;" align="left">: {{\App\Helpers\Helpers::getAge($sample->patient->dob, $sample->admission_date)}} <b style=" margin-left:40px;">{{__('sample.form_patient_gender')}}</b> : {{\App\Helpers\Helpers::getGender($sample->patient->gender)}}</td>
<td width="25%" style="padding-left:0.7cm; line-height:20px; font-weight:bold;">{{__('sample.requested_date')}}</td>
<td width="25%" style="line-height:20px;" align="left">: {{date('d-M-Y H:i',strtotime($sample->collected_date))}}</td>
</tr>
<tr>
<td width="20%" style="padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('patient.table_phon')}}</td>
<td width="30%" style="padding-bottom:2px; line-height:20px;" align="left">: {{$sample->patient->phone_number}}</td>
<td width="25%" style="padding-left:0.7cm; padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('sample.request_by')}}</td>
<td width="25%" style="padding-bottom:2px; line-height:20px;" align="left">: {!!$samplePhysician->name_en!!}</td>
</tr>
</tbody>
</table>
@elseif($labSettings->result_header_id==4)
<table width="100%" border="0" class="patient-info">
<tbody>
<tr>
<td class="header-label-title-color font-changable-base-on-localize" width="20%" style="padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.table_patient_name')}}</td>
<td width="30%" style="padding-top:2px; line-height:20px; font-size: 12pt !important;" align="left">: {{$sample->patient->name_en}}</td>
<td class="header-label-title-color" width="25%" style="line-height:20px; font-weight:bold;">{{__('sample.form_patient_age')}}</td>
<td width="25%" style="line-height:20px;" align="left">: {{\App\Helpers\Helpers::getAge($sample->patient->dob, $sample->admission_date)}} , <b class="header-label-title-color">{{__('sample.form_patient_gender')}}</b> : {{\App\Helpers\Helpers::getGender($sample->patient->gender)}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="line-height:20px; font-weight:bold;">{{__('sample.requested_date')}}</td>
<td width="30%" style="line-height:20px;" align="left">: {{date('d-M-Y H:i',strtotime($sample->collected_date))}}</td>
<td class="header-label-title-color" width="25%" style="padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.form_sample_number')}}</td>
<td width="25%" style="padding-top:2px; line-height:20px;" align="left">: {{$sample->sample_number}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('sample.physician_name')}}</td>
<td width="30%" style="padding-bottom:2px; line-height:20px;" align="left">: {!!$samplePhysician->name_en!!}</td>
<td class="header-label-title-color" width="25%" style="padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('sample.table_sample_source')}}</td>
<td width="25%" style="line-height:20px;" align="left">: {{@$sample->sample_source->name_en}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('patient.table_phon')}}</td>
<td width="30%" style="padding-bottom:2px; line-height:20px;" align="left">: {{$sample->patient->phone_number}}</td>
<td class="header-label-title-color" width="25%" style="padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('sample.form_patient_address')}}</td>
<td width="25%" style="padding-bottom:2px; line-height:20px;" align="left">: {{\App\Helpers\Helpers::getPatientAddress($sample->patient)}}</td>
</tbody>
</table>
@elseif($labSettings->result_header_id==5)
<table width="100%" border="0" class="patient-info">
<tbody>
<tr>
<td width="20%" style="padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.table_patient_name')}}</td>
<td width="30%" style="padding-top:2px; line-height:20px; font-size: 12pt !important;" align="left">: {{$sample->patient->name_en}}</td>
<td width="25%" style="padding-left:0.7cm; padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.table_patient_code')}}</td>
<td width="25%" style="padding-top:2px; line-height:20px;" align="left">: {{$sample->patient->patient_uuid}}</td>
</tr>
<tr>
<td width="20%" style="line-height:20px; font-weight:bold;">{{__('sample.form_patient_age')}}</td>
<td width="30%" style="line-height:20px;" align="left">: {{\App\Helpers\Helpers::getAge($sample->patient->dob, $sample->admission_date)}} <b style=" margin-left:40px;">{{__('sample.form_patient_gender')}}</b> : {{\App\Helpers\Helpers::getGender($sample->patient->gender)}}</td>
<td width="25%" style="padding-left:0.7cm; line-height:20px; font-weight:bold;">{{__('sample.requested_date')}}</td>
<td width="25%" style="line-height:20px;" align="left">: {{date('d-M-Y H:i',strtotime($sample->collected_date))}}</td>
</tr>
<tr>
<td width="20%" style="padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('patient.table_phon')}}</td>
<td width="30%" style="padding-bottom:2px; line-height:20px;" align="left">: {{$sample->patient->phone_number}}</td>
<td width="25%" rowspan="2" style="padding-left:0.7cm; padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('sample.request_by')}}</td>
<td width="25%" rowspan="2" style="padding-bottom:2px; line-height:20px;" align="left">: {!!$samplePhysician->name_en!!}</td>
</tr>
<tr>
<td width="20%" style="line-height:20px; font-weight:bold;">{{__('sample.form_sample_number')}}</td>
<td width="30%" style="line-height:20px;" align="left">: {{$sample->sample_number}}</td>
</tr>
</tbody>
</table>
@elseif($labSettings->result_header_id==6)
<table width="100%" border="0" class="patient-info">
<tbody>
<tr>
<td class="header-label-title-color font-changable-base-on-localize" width="20%" style="padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.table_patient_name')}}</td>
<td width="30%" style="padding-top:2px; line-height:20px; font-size: 12pt !important;" align="left">: {{$sample->patient->name_en}}</td>
<td class="header-label-title-color" width="25%" style="line-height:20px; font-weight:bold;">{{__('sample.form_patient_age')}}</td>
<td width="25%" style="line-height:20px;" align="left">: {{\App\Helpers\Helpers::getAge($sample->patient->dob, $sample->admission_date)}} , <b class="header-label-title-color">{{__('sample.form_patient_gender')}}</b> : {{\App\Helpers\Helpers::getGender($sample->patient->gender)}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="line-height:20px; font-weight:bold;">{{__('sample.requested_date')}}</td>
<td width="30%" style="line-height:20px;" align="left">: {{date('d-M-Y H:i',strtotime($sample->collected_date))}}</td>
<td class="header-label-title-color" width="25%" style="padding-top:2px; line-height:20px; font-weight:bold;">{{__('sample.form_sample_number')}}</td>
<td width="25%" style="padding-top:2px; line-height:20px;" align="left">: {{$sample->sample_number}}</td>
</tr>
<tr>
<td class="header-label-title-color" width="20%" style="padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('sample.physician_name')}}</td>
<td width="30%" style="padding-bottom:2px; line-height:20px;" align="left">: {!!$samplePhysician->name_en!!}</td>
<td class="header-label-title-color" width="25%" style="padding-bottom:2px; line-height:20px; font-weight:bold;">{{__('sample.form_patient_address')}}</td>
<td width="25%" style="padding-bottom:2px; line-height:20px;" align="left">: {{\App\Helpers\Helpers::getPatientAddress($sample->patient)}}</td>
</tr>
</tbody>
</table>
@else
<table width="100%" style="border-collapse: collapse;border-top: 2px solid #000000;border-bottom: 2px solid #000000;">
<tbody>
<tr>
<td class="header-label-title-color font-changable-base-on-localize" width="13%" style="padding-top:2px; line-height:20px;">{{__('ឈ្មោះ/Name')}}</td>
<td class="header-label-title-color font-changable-base-on-localize" width="19%" style="padding-top:2px; line-height:20px; font-size: 12pt !important;" align="left">: {{$sample->patient->name_en}}</td>
<td class="header-label-title-color font-changable-base-on-localize" width="15%" style="line-height:20px;">{{__('អាយុ/Age')}}</td>
<td class="header-label-title-color font-changable-base-on-localize" width="21%" style="line-height:20px;" align="left">: {{\App\Helpers\Helpers::getAge($sample->patient->dob, $sample->admission_date)}}</td>
<td class="header-label-title-color font-changable-base-on-localize" width="13%" style="line-height:20px;">{{__('ភេទ/Sex')}}</td>
<td class="header-label-title-color font-changable-base-on-localize" width="20%" style="line-height:20px;" align="left">: {{$sample->patient->gender==1 ? 'Male':'Female'}}</td>
</tr>
<tr>
<td class="header-label-title-color font-changable-base-on-localize" style="line-height:20px;">{{__('Patient ID')}}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="line-height:20px;" align="left">: {{$sample->patient->patient_uuid}}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="padding-top:2px; line-height:20px;">{{__('Lab ID')}}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="padding-top:2px; line-height:20px;" align="left">: {{$sample->sample_number}}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="padding-bottom:2px; line-height:20px;">{{__('ទូរស័ព្ទ/Phone')}}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="padding-bottom:2px; line-height:20px;" align="left">: {{$sample->patient->phone_number}}</td>
</tr>
<tr>
<td class="header-label-title-color font-changable-base-on-localize" style="padding-bottom:2px; line-height:20px;">{{__('Requested By')}}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="padding-bottom:2px; line-height:20px;" align="left">: {!!$samplePhysician->name_en!!}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="padding-bottom:2px; line-height:20px;">{{__('Requested Date')}}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="line-height:20px;" align="left">: {{date('d-M-Y H:i',strtotime($sample->collected_date))}}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="padding-bottom:2px; line-height:20px;">{{__('Analysis Date')}}</td>
<td class="header-label-title-color font-changable-base-on-localize" style="padding-bottom:2px; line-height:20px;" align="left">: {{date('d-M-Y H:i');}}</td>
</tr>
</tbody>
</table>
@endif
</th>
</tr>
</thead>
<tfoot>
<tr>
<td width="100%">
<table width="100%" border="0">
<tbody><tr>
<td colspan="4" style="/*height: 240px;*/ height: 100px;">&nbsp;</td>
</tr>
</tbody></table>
</td>
</tr>
</tfoot>
<tbody class="sample-result" id="sample-result-print" style="font-size: 12pt;">
<!-- Comment -->
</tbody>
<!-- Note -->
</table>
<table id="footer" width="100%" border="0" style="margin-top:0px !important;">
<tbody>
<tr style="height:40px !important;"><td colspan="3">&nbsp;<br></td></tr>
<tr>
<td class="text-center text-no-wrap" style="width: 6.7cm"></td>
<td style="width: 6.3cm"></td>
<td class="text-center text-no-wrap result-font" style="width: 6.7cm; font-size:15px">
{{__('sample.report_date')}} : {{date('d-M-Y H:i')}} </td>
</tr>
<tr class="result-footer-signature" id="def-signature">
<td class="text-center text-no-wrap result-font" style="font-size:15px" valign="bottom">
{{__('sample.verify_by')}}
<br>
@if(!empty($labSettings->verify_label))
<img id="signature-preview" style="width: 200px !important;" src="{{url(env("APP_URL").'storage/images/avatars/labs/'.$labSettings->verify_label)}}">
@else
<br>
@endif
</td>
<td class="text-center text-no-wrap">
</td>
<td class="text-center text-no-wrap result-font" style="font-size:15px">
{{__('sample.lab_technician')}} <br>
@if(!empty(\App\Helpers\Helpers::getPrinterSignature($sample->id)))
<img id="signature-preview" style="width: 120px !important;" src="{{url(env("APP_URL").'storage/images/signature')}}/{{\App\Helpers\Helpers::getPrinterSignature($sample->id)}}">
@else
<br>
<p style="text-transform: capitalize;">{{$labSettings->technician_label}}</p>
@endif
<span class="page" style="position:fixed; bottom:12px; right: 10px; font-weight:bold;"></span>
</td>
</tr>
<tr class="result-footer-signature" id="dyn-signature" style="display:none;">
<td class="text-center text-no-wrap result-font" style="font-size:15px" valign="bottom">
{{__('sample.verify_by')}} .
<br>
@if(!empty($labSettings->alter_verify_sign))
<img style="width: 200px !important;" src="{{url(env("APP_URL").'storage/images/avatars/labs/'.$labSettings->alter_verify_sign)}}">
@else
<br>
@endif
</td>
<td class="text-center text-no-wrap">
</td>
<td class="text-center text-no-wrap result-font" style="font-size:15px">
{{__('sample.lab_technician')}} .<br>
@if(!empty($labSettings->alter_labtech_sign))
<!--<img id="signature-preview" style="width: 120px !important;" src="{{url(env("APP_URL").'storage/images/signature')}}/{{\App\Helpers\Helpers::getPrinterSignature($sample->id)}}">-->
<img style="width: 200px !important;" src="{{url(env("APP_URL").'storage/images/avatars/labs/'.$labSettings->alter_labtech_sign)}}">
@else
<br>
<p style="text-transform: capitalize;">{{$labSettings->technician_label}}</p>
@endif
<span class="page" style="position:fixed; bottom:12px; right: 10px; font-weight:bold;"></span>
</td>
</tr>
@if($labSettings->show_result_footer==1)
<tr>
<td colspan="3" id="footer_line" class="result-page-color result-font" style="text-align:center; border-top:1px solid #000 !important; padding-top:0px; letter-spacing: -0.5px !important;">
@if($sample->lab_id!=22)
<span style="line-height: 10px !important; font-size:12px">{{ app()->getLocale()=='kh' ? $labSettings->address_kh : $labSettings->address_en}} <br>
{{$labSettings->phone_number}} {{$labSettings->email}}</span><br>
@endif
</td>
</tr>
@endif
</tbody></table>
</page>
</div>
</div>
@include('layout.common_script')
<script>
var patient_base_url = "{{url('patient')}}";
var get_refs_base_url = "{{url('shared')}}";
var sample_base_url = "{{url('sample')}}"
var is_auto_generate_sample_number = 0;
let sample_id = {{\Route::current()->parameter('id')}};
let invoice_id = "{{($sample->invoice) ? $sample->invoice->id : 0}}";
let invoice_code = "{{($sample->invoice) ? $sample->invoice->invoice_code : 0}}";
let first_prev_sample_id = {{$firstPrvSampleId}};
let previous_sample_date = "{{$firstPrvSampleDate}}";
let testSamples = [];
let antibiotic_results = []
//$('#print_preview_modal').on('show.bs.modal', function (event) {
$.ajax({
url: get_refs_base_url + '/test-items/' + sample_id +'/'+first_prev_sample_id,
type: "GET",
dataType: "json",
success: function (response) {
if(response.success){
$('#sample-result-print').empty()
let res = response.data
antibiotic_results = res.antibiotic_results
for (var i in res.sample_tests){
let heading = {"sample": res.sample, "department": res.sample_tests[i].department_name}
let samples_list = res.sample_tests[i].samples;
for(var j in samples_list){
renderPrintTestItemDepartmentRow(samples_list[j], heading,'sample-result-print')
var tests = samples_list[j].tests
var sampleTest = list_to_tree(tests)
sampleTest.map(parent => {
renderPrintTestItemRow(parent, '0' ,'test-dep-'+samples_list[j].sample_type_id,' sample-result-print')
if(parent.children.length){
var children = parent.children
children.map(function (child) {
renderPrintTestItemRow(child, '1' ,'test-dep-'+samples_list[j].sample_type_id,' sample-result-print')
if(child.children.length){
var grandchildren = child.children
grandchildren.map(function (grandchild) {
renderPrintTestItemRow(grandchild, '1' ,'test-dep-'+samples_list[j].sample_type_id,' sample-result-print')
})
}
});
}
})
}
}
} else{
antibiotic_results = []
}
}
});
//})
function manipulateTableHeading(department, sample_type, sample_number, requester, collected_date, received_date, sample_tests) {
let tableData = '<table width="100%" border="0" class="_department-sample-info" style="border-collapse: collapse;"><thead>\n' +
'<tr style="background: #7ccb7f; border:1px solid #4a4a4a;">\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 48%"><div style="width:370px !important; float:left;">Test Name</div></th>\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 17%;">Result</th>\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 11%;">Units</th>\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 20%; text-align: center">Ref. Ranges</th>\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 4%;"></th>\n' +
' </tr>\n'+
' <tr>' +
' <td class="sourceserifpro-bold result-font-size result-page-color" colspan="5" style="text-align: center;">'+sample_type+'</td>' +
' </tr>\n' +
'</thead>\n' +
' <tbody id="test-dep-'+sample_tests.sample_type_id+'"></tbody>'+
' </thead>' +
' </table>'
return tableData;
}
function renderPrintTestItemDepartmentRow(sample_tests, department_heading, wrapperId)
{
let tableData = manipulateTableHeading(department_heading.department, sample_tests.sample_type_name, department_heading.sample.sample_number, department_heading.sample.requested_by.name_en, department_heading.sample.collected_date, department_heading.sample.received_date, sample_tests)
var tr = document.createElement('TR');
tr.setAttribute('class', 'sample-type');
tr.insertCell(0).innerHTML = tableData;
tr.cells[0].style.paddingTop = '0px'
tr.cells[0].style.paddingBottom = '0px'
$('#'+wrapperId).append(tr);
}
function renderPrintTestItemRow(sample_tests, level, closet_parent_id)
{
if(sample_tests.is_show == 1) {
let IsAbnormal = computeRefRange(sample_tests);
console.log(sample_tests.test_name + ' = > ' + IsAbnormal, sample_tests)
let tr = document.createElement('TR');
tr.setAttribute('valign', 'top')
tr.insertCell(0).innerHTML = '' + (sample_tests.field_type == 0 ? '<b class="sourceserifpro-bold result-font-size line-height">' + sample_tests.test_name + '</b>' : '<p class="value-pair line-height"><span style="'+(sample_tests.is_bold==1 ? ' font-weight:bold;' :'' )+'" class="name result-font-size line-height">' + sample_tests.test_name + '</span> </p>') + '';
if(["2","3"].includes(sample_tests.field_type)){
tr.insertCell(1).innerHTML = (sample_tests.field_type == 0 ? '' : '') + manipulatePrintOrganismResult(sample_tests)
tr.cells[1].colSpan=4
tr.cells[1].classList.add('result-font-size','line-height')
}else{
if(sample_tests.unit_sign.trim()!='' || (["0.0","0.00","0"].includes(sample_tests.sign))){
tr.insertCell(1).innerHTML = ''+ (sample_tests.field_type == 0 ? '' : ':') + manipulatePrintOrganismResult(sample_tests) +'</span>';
tr.insertCell(2).innerHTML = '<span class="name line-height" style="font-size: 10.5pt !important;">'+sample_tests.unit_sign + '</span>';
tr.insertCell(3).innerHTML = '<span class="name line-height result-font_" style="font-size: 10.5pt !important;">'+ sample_tests.ref_range +'</span>';
tr.insertCell(4).innerHTML = (IsAbnormal.trim() !='' ? '<span class="abnormal line-height">Abnormal</span>' : (sample_tests.test_result!='' ? 'Normal': ''));
tr.cells[4].style.textAlign = 'right'
}
else{
tr.insertCell(1).innerHTML = ''+ (sample_tests.field_type == 0 ? '' : ':') + manipulatePrintOrganismResult(sample_tests) +'</span>';
tr.cells[1].colSpan=4
tr.cells[1].classList.add('result-font-size')
}
}
tr.cells[0].style.paddingLeft = (5 * level * 2.5) + 'px'
tr.cells[0].style.width="370px";
if(IsAbnormal.trim()!='' && sample_tests.test_result!=''){
//tr.cells[1].classList.add('abnormal')
tr.cells[1].childNodes[1].classList.add('abnormal')
}
if (sample_tests.field_type == 0) {
tr.cells[0].classList.add('pl-' + (level * 2))
}
$('#' + closet_parent_id).append(tr);
if(sample_tests.description!=""){
renderPrintTestItemDescriptionRow(sample_tests, level, closet_parent_id);
}
if(sample_tests.comment!=""){
renderPrintTestItemCommentRow(sample_tests, level, closet_parent_id);
}
}
}
function renderPrintTestItemDescriptionRow(sample_tests, level, closet_parent_id)
{
if(sample_tests.is_show == 1) {
let tr = document.createElement('TR');
tr.setAttribute('valign', 'top');
tr.insertCell(0).innerHTML = (sample_tests.description!=="" ? '<p class="pl-4 pt-2 line-height">'+sample_tests.description+'</p>' : '');
tr.cells[0].style.paddingLeft = (5 * level * 5) + 'px'
tr.cells[0].colSpan=5
if (sample_tests.field_type == 0) {
tr.cells[0].classList.add('pl-' + (level * 2))
}
$('#' + closet_parent_id).append(tr);
}
}
function renderPrintTestItemCommentRow(sample_tests, level, closet_parent_id)
{
if(sample_tests.is_show == 1) {
let tr = document.createElement('TR');
tr.setAttribute('valign', 'top');
tr.insertCell(0).innerHTML = (sample_tests.comment!=="" ? '<div style="padding-left: 15px; float:left; font-weight:bold; line-height">Comment: </div><div style="padding-left:85px; margin-top: 0px; margin-left:10px;">'+sample_tests.comment+'</div>' : '');
tr.cells[0].style.paddingLeft = (5 * 0) + 'px'
tr.cells[0].colSpan=5
if (sample_tests.field_type == 0) {
tr.cells[0].classList.add('pl-' + (0 * 2))
}
$('#' + closet_parent_id).append(tr);
}
}
function manipulatePrintOrganismPreviousResult(sample_tests) {
if(sample_tests.field_type == 0){
return ''
} else if(["2","3"].includes(sample_tests.field_type)){
let orgCount = 0;
return (sample_tests.prev_org_results.length<1 ? ': Pending' : sample_tests.prev_org_results.map(function (value) {
let anti_text =''
orgCount+=1;
antibiotic_results.map(function (anti) {
if(anti.organism_id == value.organism_id && anti.test_organism_id == value.test_organism_id && anti.sensitive!=''){
anti_text+= '<p class="value-pair" style="width: 90% !important; position: relative;"><span class="name" style="padding-left: 10px; '+(anti.sensitive=='R' ? 'font-weight:bold':'')+'"> - '+anti.name_en+'</span> <span class="name" style="float: right; '+(anti.sensitive=='R' ? 'font-weight:bold':'')+'">'+anti.sensitive+'</span></p>';
}
});
if(anti_text!=''){
return '<p class="value-pair" style="width: 90% !important; position: relative; margin-top:2px !important;"> <span class="name" style="">'+(orgCount==1?': ':'&nbsp;&nbsp;') +'</span>'+ ((value.is_bold==1) ? '<span class="abnormal name">' + value.organism_name +'</span>' : '<span class="name">' + value.organism_name + '</span>') +' <span class="name" style="float: right;"> '+ (value.quantity_name !=null ? value.quantity_name : '')+'</span> </p>' + anti_text;
}
else{
return '' +((value.is_bold==1) ? '<span class="abnormal">'+ value.organism_name+'</span>' : value.organism_name) +' '+ (value.quantity_name !=null ? value.quantity_name : '') +'</br>'
}
}).join(' '))
} else{
return '<span class="name" style="font-size:10.5pt;"> ' + (sample_tests.prev_result && sample_tests.prev_result.length<1 ? 'Pending' : sample_tests.prev_result) + '</span>'
}
}
function computeRefRange(sample_tests) {
if(sample_tests.min_ref_val=='' || sample_tests.max_ref_val=='' || sample_tests.test_result=='' || sample_tests.ref_range == '') return ''
else if(["-"].includes(sample_tests.sign)){
if(parseFloat(sample_tests.test_result.toLowerCase().replace('>','').replace('<','').replace('positive','').replace('negative','')) > parseFloat(sample_tests.max_ref_val.replace(",", ""))) return 'H';
if(parseFloat(sample_tests.test_result.toLowerCase().replace('>','').replace('<','').replace('positive','').replace('negative','')) < parseFloat(sample_tests.min_ref_val.replace(",", ""))) return 'L';
else return ''
}else if(["<=","Neg <", "Neg<","","<"].includes(sample_tests.sign)){
if(parseFloat(sample_tests.test_result.toLowerCase().replace('>','').replace('<','').replace('positive','').replace('negative','')) > parseFloat(sample_tests.max_ref_val.replace(",", ""))) return 'H';
else return ''
}else if([">",">=",""].includes(sample_tests.sign)){
if(parseFloat(sample_tests.test_result.toLowerCase().replace('>','').replace('<','').replace('positive','').replace('negative','')) < parseFloat(sample_tests.max_ref_val.replace(",", ""))){ return 'L'; }
else { return ''; }
}
else if(["0.0"].includes(sample_tests.sign)){
if(parseFloat(sample_tests.test_result.toLowerCase().replace('>','').replace('<','').replace('positive','').replace('negative','')) > parseFloat(sample_tests.max_ref_val.replace(",", ""))) return 'H';
if(parseFloat(sample_tests.test_result.toLowerCase().replace('>','').replace('<','').replace('positive','').replace('negative','')) < parseFloat(sample_tests.min_ref_val.replace(",", ""))) return 'L';
else return ''
}
else return ''
}
function manipulatePrintOrganismResult(sample_tests) {
if(sample_tests.field_type == 0){
return ''
} else if(["2","3"].includes(sample_tests.field_type)){
let orgCount = 0;
return (sample_tests.org_results.length<1 ? 'Pending' : sample_tests.org_results.map(function (value) {
let anti_text =''
orgCount+=1;
antibiotic_results.map(function (anti) {
if(anti.organism_id == value.organism_id && anti.test_organism_id == value.test_organism_id && anti.sensitive!=''){
anti_text+= '<p class="value-pair line-height" style="width: 90% !important; position: relative;"><span class="name" style="padding-left: 10px; '+(anti.sensitive=='R' ? 'font-weight:bold':'')+'"> - '+anti.name_en+'</span> <span class="name" style="float: right; '+(anti.sensitive=='R' ? 'font-weight:bold':'')+'">'+anti.sensitive+'</span></p>';
}
});
if(anti_text!=''){
return '<p class="value-pair line-height" style="width: 90% !important; position: relative; margin-top:2px !important;"> <span class="name result-font">'+(orgCount==1?'':'&nbsp;&nbsp;') +'</span>'+ ((value.is_bold==1) ? '<span class="abnormal name " style="font-size:11pt !important;">' + value.organism_name +'</span>' : '<span class="name" style="font-size:11pt !important;">' + value.organism_name + '</span>') +' <span class="name" style="float: right;"> '+ (value.quantity_name !=null ? value.quantity_name : '')+'</span> </p>' + anti_text;
}
else{
return ((value.is_bold==1) ? '<span class="abnormal line-height">'+ value.organism_name+'</span>' : value.organism_name) +' '+ (value.quantity_name !=null ? value.quantity_name : '') +'</br>'
}
}).join(' '))
} else if(sample_tests.field_type == 1){
return '<span class="name result-font line-height" style="font-size:11pt !important;"> ' + (sample_tests.test_result.length<1 ? 'Pending' : sample_tests.test_result) + '</span>'
}
else{
if(sample_tests.field_type == 5) return '<span class="name result-font line-height" style="font-size:11pt !important;"> ' + (sample_tests.test_result.length<1 ? 'Pending' : 'See attachement') + '</span>'
return '<span class="name result-font line-height" style="font-size:11pt !important;"> ' + (sample_tests.test_result.length<1 ? 'Pending' : sample_tests.test_result) + '</span>'
}
}
</script>