@php function getDateDifference($date1, $date2) { $datetime1 = new \DateTime($date1); $datetime2 = new \DateTime($date2); return $datetime1->diff($datetime2)->y; } $currentDate = $Package->COLLECTION_TIME ?? date('Y-m-d H:i:s'); $Age = getDateDifference($Package->DATE_OF_BIRTH, $currentDate) + 1; $LabCategoryPackageGroups = \App\Models\ENDUSERLABORDERPACKAGERESULT::where('END_USER_PACKAGE_ID', $Package->ID) ->with('Option', 'Result', 'Result.NormalOption')->get()->groupBy('Result.PARENT_ID'); $withOutGroup = $LabCategoryPackageGroups[""]; unset($LabCategoryPackageGroups[""]); $normalColor = 'color: #78C938;'; // Color for normal results $abnormalColor = 'color: #DD3444;'; // Color for abnormal results $blackColor = 'color: #000;'; $HEMODIS = []; $HEMODISComment = []; @endphp
Test Name
Result
Reference Range
Unit
@foreach($withOutGroup as $LabCategoryPackageResult) @if (!empty($LabCategoryPackageResult->Option))
{!! $LabCategoryPackageResult->Result->NAME_EN, 300 !!}
{!! $LabCategoryPackageResult->Option->NAME_EN, 300 !!}
@elseif (!empty($LabCategoryPackageResult->MULTIPLE_OPTION_ID)) @php $ResultOptions = new \App\Models\LABCATEGORYPACKAGERESULTOPTIONS(); $Multiple = explode(",", $LabCategoryPackageResult->MULTIPLE_OPTION_ID); $Multiple = $ResultOptions->whereIn('ID', $Multiple)->get(); $arr = []; @endphp @if (!empty($Multiple)) @foreach ($Multiple as $item) @php $arr[] = $item->NAME_EN; @endphp @endforeach @php $str = implode(", ", $arr); @endphp
@if ($key != 0)
{!! $LabCategoryPackageResult->Result->NAME_EN !!}
@endif
{!! $str !!}
@endif @elseif (!empty($LabCategoryPackageResult->RESULT))
{!! $LabCategoryPackageResult->Result->NAME_EN !!}
@if ($LabCategoryPackageResult->Result->CODE == 'NOP') @if ($Age > 0.709589) @php $LabCategoryPackageResult->Result->MAX_NORMAL = 41.9; @endphp @else @php $LabCategoryPackageResult->Result->MAX_NORMAL = 109; @endphp @endif @endif @php if($LabCategoryPackageResult->Result->NAME_EN == 'Comment') { $normalColor = $abnormalColor = $blackColor; } $DecimalResult = $LabCategoryPackageResult->RESULT; $symbol = null; @endphp @if (preg_match('/[\'^£$%&*()}{@#~?><>,>=|=_+¬-]/', $DecimalResult)) @if (str_contains($DecimalResult, '>=')) @php $symbol = '>='; @endphp @elseif (str_contains($DecimalResult, '>')) @php $symbol = '>'; $DecimalResult = (float)filter_var($DecimalResult, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) + 0.01; @endphp @elseif (str_contains($DecimalResult, '<=')) @php $symbol = '<='; @endphp @elseif (str_contains($DecimalResult, '<')) @php $symbol = '<'; $DecimalResult = (float)filter_var($DecimalResult, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) - 0.01; @endphp @endif @endif @if (!empty($symbol)) @if ($DecimalResult >= $LabCategoryPackageResult->Result->MIN_NORMAL && $DecimalResult <= $LabCategoryPackageResult->Result->MAX_NORMAL)
{{ $DecimalResult }}
@else
{{ $DecimalResult }}
@endif @else @if ($LabCategoryPackageResult->RESULT >= $LabCategoryPackageResult->Result->MIN_NORMAL && $LabCategoryPackageResult->RESULT <= $LabCategoryPackageResult->Result->MAX_NORMAL) @if ($LabCategoryPackageResult->Result->TYPE == 'TEXTAREA')
{!! $LabCategoryPackageResult->RESULT !!}
@else
{!! $LabCategoryPackageResult->RESULT !!}
@endif @else @if ($LabCategoryPackageResult->Result->TYPE == 'TEXTAREA')
{!! $LabCategoryPackageResult->RESULT !!}
@else
{!! $LabCategoryPackageResult->RESULT !!}
@endif @endif @endif @if($LabCategoryPackageResult->Result->CODE == 'NTSH')

Hypothyroidism: >40

Questionable: 20-40

Normal: <20

@elseif($LabCategoryPackageResult->Result->CODE == 'G6PD')

Deficient: < 2.0

Normal: > 2.0

@elseif($LabCategoryPackageResult->Result->CODE == 'GALT')

Deficient: < / = 2.6

2.7-3.4: Questionable

Normal: > 3.4

@elseif($LabCategoryPackageResult->Result->CODE == 'NBTD')

Deficient: <44

Questionable: 20-40

Normal: > 49.2

@elseif($LabCategoryPackageResult->Result->CODE == 'NOP')
@if($LabCategoryPackageResult->Result->MAX_NORMAL == 109)

Normal: <109

Questionable: 109-180

CAH: >180

@else

Normal: <42

Questionable: 42-90

CAH: >90

@endif
@elseif($LabCategoryPackageResult->Result->CODE == 'BTNDASE')

Deficient: <44

Questionable: 44.5-49.2

Normal: > 49.2

@elseif($LabCategoryPackageResult->Result->CODE == 'N17P')

Gestational age > 37 weeks:

Normal: <42

Questionable: 42-90

CAH: >90

Gestational age < 37 weeks:

Normal: <109

Questionable: 109-180

CAH: >180

@elseif($LabCategoryPackageResult->Result->TYPE != 'TEXTAREA')

{{ $LabCategoryPackageResult->Result->MIN_NORMAL }} - {{ $LabCategoryPackageResult->Result->MAX_NORMAL }}

@else
@endif @if ($LabCategoryPackageResult->Result->UNIT && $LabCategoryPackageResult->Result->TYPE != 'TEXTAREA')
{!! $LabCategoryPackageResult->Result->UNIT !!}
@else
@endif
@endif @endforeach @php $counter = 0; @endphp
Diseases
Result
Reference Range
Unit
@foreach ($LabCategoryPackageGroups as $LabCategoryPackageGroup) @php $Nonremarkable = false; if($counter == 2) { $counter = 0; } @endphp {{-- @if($counter == 0)--}} {{-- --}} {{-- @endif--}}
@php $firstResult = $LabCategoryPackageGroup[0]->Result->DESC_EN; $fontSize = strlen($firstResult) > 30 ? '11px' : '14px'; $counter++; @endphp @foreach ($LabCategoryPackageGroup as $key => $LabCategoryPackageResult) @if($LabCategoryPackageResult->Result->CODE == 'HEMODIS') @php $HEMODIS = $LabCategoryPackageResult; @endphp @continue @endif @if($LabCategoryPackageResult->Result->CODE == 'UpNormalComm') @php $HEMODISComment = $LabCategoryPackageResult; @endphp @continue @endif @php $resultName = $LabCategoryPackageResult->Result->NAME_EN; $resultOption = $LabCategoryPackageResult->Option->NAME_EN ?? null; $unit = $LabCategoryPackageResult->Result->UNIT ?? '--'; $resultValue = $LabCategoryPackageResult->RESULT; // Determine text color if ($LabCategoryPackageResult->Option->IS_NORMAL ?? false) { $color = 'rgb(120,201,38)'; // Normal $Nonremarkable = true; } else { $color = 'rgb(221,52,68)'; // Abnormal } @endphp @if(!empty($resultOption))
{{ $firstResult, 32 }}
{{ $resultOption }}
@if ($key != 0)
{{ $resultName }}
@else
@endif
{{ $unit }}
@elseif(!empty($LabCategoryPackageResult->MULTIPLE_OPTION_ID)) @php $Multiple = explode(",", $LabCategoryPackageResult->MULTIPLE_OPTION_ID); $resultOptions = \App\Models\LABCATEGORYPACKAGERESULTOPTIONS::whereIn('ID', $Multiple)->get(); $optionNames = $resultOptions->pluck('NAME_EN')->toArray(); $optionsString = implode(", ", $optionNames); @endphp
@if ($key != 0)
{{ $resultName }}
@endif @if(str_contains($resultName, 'Recommendation') || str_contains($resultName, 'Additional'))
{{ $optionsString, 480 }}
@else
{{ $optionsString, 480 }}
@endif
{{ $unit }}
@elseif(!empty($resultValue) && !$Nonremarkable)
@if ($key != 0)
{{ $resultName == 'Comment' ? '* '.$resultName : $resultName }}
@endif @if ($resultValue >= $LabCategoryPackageResult->Result->MIN_NORMAL && $resultValue <= $LabCategoryPackageResult->Result->MAX_NORMAL)
{{ $resultValue }}
@elseif($resultName == 'Comment')
{{ $resultValue }}
@else
{{ $resultValue }}
@endif @if($LabCategoryPackageResult->Result->TYPE != 'TEXTAREA')
{{ $LabCategoryPackageResult->Result->MIN_NORMAL . ' - ' . $LabCategoryPackageResult->Result->MAX_NORMAL }}
@else
@endif @if($resultName != 'Comment')
{{ $unit }}
@else
@endif
@elseif(!empty($LabCategoryPackageResult->RESULT) && $Nonremarkable && $LabCategoryPackageResult->Result->TYPE == 'TEXTAREA')
@if($key != 0) {!! e($LabCategoryPackageResult->Result->NAME_EN) !!} @endif @php $setLabel = false; $addPage = strlen($LabCategoryPackageResult->RESULT); // Simulating the line wrap if ($addPage > 225) { // Simulate "adding a new page" or starting a new section $setLabel = true; } @endphp
{!! e($LabCategoryPackageResult->RESULT) !!}
@if($setLabel)
{!! e($LabCategoryPackageResult->Result->NAME_EN) !!}
@endif @else @continue @endif @endforeach
@endforeach
@if(!empty($HEMODIS)) @if(!empty($HEMODISComment) && !$HEMODIS->Option->IS_NORMAL) @endif
Disorder Result
Hemoglobin Disorders @if(!empty($HEMODIS->Option->NAME_EN)) Option->IS_NORMAL) style="color:green" @else style="color: red" @endif> {{$HEMODIS->Option->NAME_EN}} @endif
Abnormal Comment: {{$HEMODISComment->RESULT}}
Comment: Recommended to be repeated after the age of 1 year to monitor the switching of HbF to HbA Disorders screened for: Sickle Cell Disease (Hb S/S) (Hb S/C) Thalassemia (Hb S/A) Other Hb Variants (e.g. Hb C, D, E)
@endif
@include('pdf.integrated_report.components.analysis_tests.layout.comment')
Sample Type: Dried Blood Spot (DBS) on Special Filter Card
Methodology: Amino acids, Organic acids, and Fatty acids were screened using the Qsight 210MD Triple Quadrupole LC-MS/MS system (Perkin Elmer) using NeoBase Non-derivatized MSMS kit (Perkin Elmer). TSH, GALT, Biotinidase, and 17 OH progesterone were analyzed on VICTOR™2D Fluorometer (Perkin Elmer) @if(!empty($HEMODIS)) & FEIA Fluorometer (LabSystems), and Hemoglobin disorders were screened using Variant nbs (BIO-RAD). @endif
Limitation:

- Laboratory findings in this report represent “screening” results and are intended to identify newborns at risk for the screened disorders only and/or in need of more confirmatory testing.
- This test might not reveal inborn error of metabolism or endocrinal disorders screened for if the newborn is on therapy that keeps the measured markers within the normal reference range. Medical examination is mandatory if any symptoms of such diseases appear.
- The results are valid only if the sample is collected at least 24 hours after birth and the newborn has not received blood transfusion prior to sample collection.
- Unremarkable results refer to marker(s) that are measured in the DBS specimen and fall within the normal reference interval, however, results should be clinically correlated with factors such as age, nutrition, birth weight, prematurity, health status, and treatments at the time of DBS sampling.

References:

1) Clinical Laboratory Standard Institute, NBS01-AD7:2021- Blood Collection on Filter paper for Newborn Screening Programs; Approved Standard- Seventh Edition, July 2021.
2) Clinical Laboratory Standard Institute, NBS04-ED2: 2017, New born screening by Tandem Mass Spectrometry; Approved guidelines, July 2017.
3) American College of Medical Genetics (ACMG) ACT Sheets and Confirmatory Algorithms.