@extends('layouts.medical_report_pdf2')
@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.v2.'.$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']}}
|
Result
|
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'])
->whereHas('component',function($query){
$query->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','!=','');
})
->whereHas('component',function($query){
$query->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','!=','');
})
->whereHas('component',function($query){
$query->where('title',false);
})->count();
}
@endphp
@if($next_tests)
|
{{$result['component']['name']}}
|
@endif
@elseif(!$result['component']['title'])
@if(!empty($result["result"])||!empty($result["note"]))
|
▲ {{$result["component"]["name"]}} :
|
{{$result["result"]}}
@if(!empty($result['note']))
{!! $result['note_html'] !!}
@endif
|
{{$result["component"]["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'])
->whereHas('component',function($query){
$query->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','!=','');
})
->whereHas('component',function($query){
$query->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','!=','');
})
->whereHas('component',function($query){
$query->where('title',false);
})->count();
}
@endphp
@if($next_tests)
|
{{$result['component']['name']}}
|
@endif
@elseif(!$result['component']['title'])
@if(!empty($result["result"])||!empty($result["note"]))
|
▲ {{$result["component"]["name"]}} :
|
{{$result["result"]}}
@if(!empty($result['note']))
{!! $result['note_html'] !!}
@endif
|
{{$result["component"]["unit"]}}
|
@include('pdf.partials.medical_report_reference_range',['result'=>$result])
|
@endif
@endif
@endif
@endforeach
@endif
@if(!empty($main_test['comment']))
@endif
@if($main_test['allow_history'])
|
@include('pdf.partials.test_history',['test'=>$main_test])
|
@endif
@endforeach
@endforeach
@endif
@if(count($data['alone_tests'])&&count($data['categories']))
@endif
@php
$count_alone=0;
@endphp
@foreach($data['alone_tests'] as $test)
@php
$count_alone++;
@endphp
|
|
{{$test['test']['name']}}
|
Result
|
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'])
->whereHas('component',function($query){
$query->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','!=','');
})
->whereHas('component',function($query){
$query->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','!=','');
})
->whereHas('component',function($query){
$query->where('title',false);
})->count();
}
@endphp
@if($next_tests)
|
{{$result['component']['name']}}
|
@endif
@elseif(!$result['component']['title'])
|
▲ {{$result["component"]["name"]}}:
|
{{$result["result"]}}
@if(!empty($result['note']))
{!! $result['note_html'] !!}
@endif
|
{{$result["component"]["unit"]}}
|
@include('pdf.partials.medical_report_reference_range',['result'=>$result])
|
@endif
@endif
@endforeach
@if(!empty($test['comment']))
@endif
@if($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['categories'])||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['culture_option']['value']}} :
|
{{$culture_option['value']}}
|
|
@if($count_options%2>0)
@endif
@php
$count_options++;
@endphp
@endforeach
@endif
@if(count($culture['antibiotics']))
| Sensitive |
Moderate |
Resistant |
@foreach($culture['sensitive_antibiotics'] as $antibiotic)
-
{{$antibiotic['antibiotic']['name']}}
@endforeach
|
@foreach($culture['moderate_antibiotics'] as $antibiotic)
-
{{$antibiotic['antibiotic']['name']}}
@endforeach
|
@foreach($culture['resistant_antibiotics'] as $antibiotic)
-
{{$antibiotic['antibiotic']['name']}}
@endforeach
|
@endif
@if(!empty($culture['comment']))
@endif
@if($count_cultures
@endif
@endforeach
@endif
@endsection