@include('layouts.header_pdf_print')
{{ __('investigations.lab_result_details') }}
@php $invs_results = DB::table('investigation_results')->where('investigation_id', $ordered_investigation->investigation_id) ->where('patient_id', $ordered_investigation->patient_id) ->where('episode_id', $ordered_investigation->episode_id) ->first(); $user_id = $invs_results ? $invs_results->created_by : $ordered_investigation->request_received_by; $performed_at = $invs_results ? streamline_date_time($invs_results->created_at) : "N/A"; @endphp
{{ __('investigations.patient_number') }} {{ $patient->number}} {{ __('investigations.lab_number') }} {{ $ordered_investigation->lab_number ?? $ordered_investigation->id }}
{{ __('investigations.patient_names') }} {{ ucwords($patient->first_name) }} {{ ucwords($patient->last_name) }} {{ __('investigations.hospital_unit') }} @if($ordered_investigation->inpatient == 1) {{ get_ward_name($ordered_investigation->patient_id, $ordered_investigation->episode_id) }} @else OPD @endif
{{ __('investigations.age') }} @php $dob = get_name($ordered_investigation->patient_id, 'id', 'date_of_birth', 'patients'); @endphp {{ get_patients_age($dob, $ordered_investigation->created_at) }} {{ __('investigations.requested') }} {{ streamline_date_time($ordered_investigation->created_at) }}
{{ __('investigations.gender') }} {{ get_name($ordered_investigation->patient_id, 'id', 'gender', 'patients') == 1 ? "Male" : "Female" }} {{ __('investigations.received') }} {{ streamline_date_time($ordered_investigation->request_received_date) }}
{{ __('investigations.patient_category') }} {{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }} {{ __('investigations.performed_at') }} {{ $performed_at }}
{{ __('investigations.residence') }} {{ patient_residence($patient->id) }} {{ __('investigations.doctor') }} @php $created_by = Streamline\Models\User::find($ordered_investigation->created_by); if ($ordered_investigation->ordered_by) { $ordered_by_name = $ordered_investigation->ordered_by; } elseif ($created_by && $created_by->hasRole('Doctors')) { $ordered_by_name = get_full_name($ordered_investigation->created_by, 'id', 'first_name', 'last_name', 'users'); } else { $ordered_by_name = __('investigations.self_request'); } @endphp {{ $ordered_by_name }} {{--{{ getDNS1DBarcodePNG($ordered_investigation->id) }}  {{ sprintf("%04u", $ordered_investigation->id) }}--}}
@foreach($investigation_ids as $record) @endforeach
{{ __('investigations.tests') }}
{{ get_name($record, 'id', 'name', 'investigations') }}
@php $records = explode(",", $ordered_investigation->specimen); $status_array = explode(",", $ordered_investigation->specimen_status); @endphp @for($i = 0; $i < count($records); $i++) @endfor
{{ __('investigations.specimens') }}
{{ get_name($records[$i], 'id', 'name', 'laboratory_specimens') }} @if ($status_array[$i] == 1) {{ __('investigations.taken') }} @elseif ($status_array[$i] == 2) {{ __('investigations.not_taken') }} @elseif ($status_array[$i] == 3) {{ __('investigations.rejected') }} @endif

{{ __('investigations.test_results') }}
@foreach($results as $result) @if($result['type'] == 0) @elseif($result['type'] == 1) @php $specialised_results = \Streamline\Models\InvestigationSpecialisedResult::where('id', $result['result'])->first(); if($specialised_results){ $variable_id_array = explode(',', $specialised_results->specialised_variable_id); $variable_value_array = explode(',', $specialised_results->value); $variable_comment_array = explode(',', $specialised_results->comment); } @endphp @if($specialised_results) @for($i = 0; $i < count($variable_id_array); $i++) @endfor @endif @endif @endforeach @if(count($results) < 1) @endif
{{ __('investigations.investigation_name') }} {{ __('investigations.results') }} {{ __('investigations.normal_ranges') }} {{ __('investigations.unit') }} {{ __('investigations.comment') }}
{{ $result['name'] }} {!! nl2br(e($result['result'])) !!} {{ $result['range'] }} @if(get_name($result['units'], 'id', 'name', 'unit_of_measure') != "N/A") {{ get_name($result['units'], 'id', 'name', 'unit_of_measure') }} @endif {!! nl2br(e($result['comment'])) !!}
{{ $result['name'] }}
{{ get_name($variable_id_array[$i], 'id', 'name', 'investigation_specialised_variables') }} {!! nl2br(e($variable_value_array[$i])) !!} @if(get_name($variable_id_array[$i], 'id', 'range_type', 'investigation_specialised_variables') == 1) {{ get_dynamic_normal_range_specialized($variable_id_array[$i], get_patient_age_group($patient->id), get_name($patient->id, 'id', 'gender', 'patients')) }} @else {{ get_name($variable_id_array[$i], 'id', 'normal_ranges', 'investigation_specialised_variables') }} @endif @if(get_name(get_name($variable_id_array[$i], 'id', 'units', 'investigation_specialised_variables'), 'id', 'name', 'unit_of_measure') != "N/A") {{ get_name(get_name($variable_id_array[$i], 'id', 'units', 'investigation_specialised_variables'), 'id', 'name', 'unit_of_measure') }} @endif {!! nl2br(e($variable_comment_array[$i])) !!}

{{ __('investigations.no_results_available') }}


@php $counter=0; $auth=''; if(!empty($results)) { foreach($results as $result) if ($result['authenticated'] == '1') $counter++; if($counter == count($results)) $auth='1'; } @endphp @if (is_add_lab_stamp_feature_enabled() && !empty($hospitalInfo->lab_stamp) && $auth =='1')
{{ __('investigations.performed_by') }} : can('hide-performed-by-on-lab-results-print-out')) style="display: none;" @endif>{{ get_full_name($user_id, 'id', 'first_name', 'last_name', 'users') }}
{{ __('investigations.verified_by') }} : ............................................................
{{ $hospitalInfo->name}} stamp
@else
{{ __('investigations.performed_by') }} : can('hide-performed-by-on-lab-results-print-out')) style="display: none;" @endif>{{ get_full_name($user_id, 'id', 'first_name', 'last_name', 'users') }}
{{ __('investigations.verified_by') }} : ............................................................
@endif