@extends('layouts.medical_report_pdf')
@section('title')
{{'medical_report_'.$invoice['barcode'].'_'.date('d-m-Y_H-i',strtotime($invoice['created_at'])).'.pdf'}}
@endsection
@section('content')
@if(count($data['custom_tests']))
@php
$count_custom_tests=0;
@endphp
@foreach($data['custom_tests'] as $custom_test)
@php
$count_custom_tests++;
@endphp
@include('pdf.custom_reports.v1.'.$custom_test['test']['custom_name'])
@if(count($data['custom_tests'])>$count_custom_tests)
@endif
@endforeach
@if(count($data['categories']))
@endif
@endif
@php
$count_categories=0;
@endphp
@if(count($data['categories']))
@foreach($data['categories'] as $category)
@php
$count_categories++;
$count_category_test=0;
@endphp
@foreach($category['main_tests'] as $main_test)
@php
$count_category_test++;
@endphp
|
|
@if($count_category_test==1)
|
{{$category['name']}}
|
@endif
|
|
|
{{$main_test['test']['name']}}
|
|
| Test |
Result |
Status |
Unit |
Reference range |
@if(count($main_test['childs']))
@foreach($main_test["childs"] as $test)
@foreach($test["results"] as $result)
@if(isset($result['component']))
@if($result['component']['title'])
@php
$next_title=\App\Models\InvoiceTestResult::where('invoice_test_id',$result['invoice_test_id'])
->where('id','>',$result['id'])
->where('title',true)
->first();
if(isset($next_title))
{
$next_tests=\App\Models\InvoiceTestResult::where('invoice_test_id',$result['invoice_test_id'])
->whereBetween('id',[$result['id'],$next_title['id']])
->where(function($query){
$query->where('result','!=','')
->orWhere('note','!=','');
})
->where('title',false)
->count();
}
else{
$next_tests=\App\Models\InvoiceTestResult::where('invoice_test_id',$result['invoice_test_id'])
->where('id','>',$result['id'])
->where(function($query){
$query->where('result','!=','')
->orWhere('note','!=','');
})
->where('title',false)
->count();
}
@endphp
@if($next_tests)
|
{{$result['component']['name']}}
|
@endif
@elseif(!$result['component']['title'])
@if(isset($result["result"])||isset($result["note"]))
| {{$result["component"]["result_report_name"]}} |
{{$result['degree']}} {{$result["result"]}}
@if($result['confirmed'])
Confirmed
@endif
@if(isset($result['note']))
{!! $result['note_html'] !!}
@endif
|
@include('pdf.partials.status',['result'=>$result])
|
{{$result["unit"]}} |
@include('pdf.partials.medical_report_reference_range',['result'=>$result])
|
@endif
@endif
@endif
@endforeach
@endforeach
@else
@foreach($main_test["results"] as $result)
@if(isset($result['component']))
@if($result['component']['title'])
@php
$next_title=\App\Models\InvoiceTestResult::where('invoice_test_id',$result['invoice_test_id'])
->where('id','>',$result['id'])
->where('title',true)
->first();
if(isset($next_title))
{
$next_tests=\App\Models\InvoiceTestResult::where('invoice_test_id',$result['invoice_test_id'])
->whereBetween('id',[$result['id'],$next_title['id']])
->where(function($query){
$query->where('result','!=','')
->orWhere('note','!=','');
})
->where('title',false)
->count();
}
else{
$next_tests=\App\Models\InvoiceTestResult::where('invoice_test_id',$result['invoice_test_id'])
->where('id','>',$result['id'])
->where(function($query){
$query->where('result','!=','')
->orWhere('note','!=','');
})
->where('title',false)
->count();
}
@endphp
@if($next_tests)
|
{{$result['component']['name']}}
|
@endif
@elseif(!$result['component']['title'])
@if(isset($result["result"])||isset($result["note"]))
| {{$result["component"]["result_report_name"]}} |
{{$result['degree']}} {{$result["result"]}}
@if($result['confirmed'])
Confirmed
@endif
@if(isset($result['note']))
{!! $result['note_html'] !!}
@endif
|
@include('pdf.partials.status',['result'=>$result])
|
{{$result["unit"]}} |
@include('pdf.partials.medical_report_reference_range',['result'=>$result])
|
@endif
@endif
@endif
@endforeach
@endif
@if(!empty($main_test['comment']))
@endif
@if($medical_report_settings['history']['template']==1&&$main_test['show_history'])
|
@include('pdf.partials.test_history',['test'=>$main_test])
|
@endif
@endforeach
@endforeach
@endif
@if((count($data['custom_tests'])&&count($data['alone_tests']))||(count($data['categories'])&&count($data['alone_tests'])))
@endif
@php
$count_alone=0;
@endphp
@foreach($data['alone_tests'] as $test)
@php
$count_alone++;
@endphp
|
|
{{$test['test']['name']}}
|
|
| Test |
Result |
Status |
Unit |
Reference range |
@foreach($test["results"] as $result)
@if(isset($result['component']))
@if($result['component']['title'])
@php
$next_title=\App\Models\InvoiceTestResult::where('invoice_test_id',$result['invoice_test_id'])
->where('id','>',$result['id'])
->where('title',true)
->first();
if(isset($next_title))
{
$next_tests=\App\Models\InvoiceTestResult::where('invoice_test_id',$result['invoice_test_id'])
->whereBetween('id',[$result['id'],$next_title['id']])
->where(function($query){
$query->where('result','!=','')
->orWhere('note','!=','');
})
->where('title',false)
->count();
}
else{
$next_tests=\App\Models\InvoiceTestResult::where('invoice_test_id',$result['invoice_test_id'])
->where('id','>',$result['id'])
->where(function($query){
$query->where('result','!=','')
->orWhere('note','!=','');
})
->where('title',false)
->count();
}
@endphp
@if($next_tests)
|
{{$result['component']['name']}}
|
@endif
@elseif(!$result['component']['title'])
@if(isset($result["result"])||isset($result["note"]))
| {{$result["component"]["result_report_name"]}} |
{{$result['degree']}} {{$result["result"]}}
@if($result['confirmed'])
Confirmed
@endif
@if(isset($result['note']))
{!! $result['note_html'] !!}
@endif
|
@include('pdf.partials.status',['result'=>$test])
|
{{$result["unit"]}} |
@include('pdf.partials.medical_report_reference_range',['result'=>$result])
|
@endif
@endif
@endif
@endforeach
@if(!empty($test['comment']))
@endif
@if($medical_report_settings['history']['template']==1&&$test['allow_history'])
|
@include('pdf.partials.test_history',['test'=>$test])
|
@endif
@if($count_alone
@endif
@endforeach
@if((count($data['cultures'])&&count($data['alone_tests']))||(count($data['cultures'])&&count($data['categories']))||(count($data['cultures'])&&count($data['custom_tests'])))
@endif
@php
$count_cultures=0;
@endphp
@if(count($data['cultures']))
@foreach($data['cultures'] as $culture)
@php
$count_cultures++;
@endphp
|
|
{{$culture['culture']['name']}}
|
|
@if(count($culture['report_culture_options']))
@php
$count_options=1;
@endphp
@foreach($culture['report_culture_options'] as $culture_option)
@if($count_options%2>0)
@endif
|
{{$culture_option['name']}} :
|
@include('pdf.partials.culture_option_result',['culture_option'=>$culture_option])
|
|
@if($count_options%2>0)
@endif
@php
$count_options++;
@endphp
@endforeach
@endif
@include('pdf.partials.culture_'.$medical_report_settings['culture_format'])
@if(!empty($culture['comment']))
@endif
@if($count_cultures
@endif
@endforeach
@endif
@endsection