@php $Name = $Package->NAME; $Category = $Package->lABCATEGORYPACKAGE->NAME_EN; $Description = $Package->lABCATEGORYPACKAGE->SMART_DESC_AR; $ProfileID = $Profile->ID; $color=''; $Groups=[]; // Result codes that have a dedicated block below. Anything else falls through // to the generic renderer at the end of the loop instead of being dropped. $HandledCodes = [ 'VISO','SODOR','SAC','HTH','TTT','HTT','MXD','SPRB','SCD','SCA','SPCD','SV','SPH','SLI', 'SAD','SPT','SRT','SPCS','TSC','SCE','SPCM','SPWB','SPCC','SPEC','BACT','GAGG','TAGG', 'TMOT','SHN','SHH','SMPD','SCYD','STAD','SHD','SIF','SGA','SGB','SGC','SGD','SAB','SABC', 'SVIT','SDD', ]; // The reference range exactly as the lab configured it in the manager // (PROFILE_ENABLE_RESULT), copied onto the order row when the test is built. $ConfiguredReference = function ($row) { if (!empty($row->REFERENCE_RANGE_TEXT)) return $row->REFERENCE_RANGE_TEXT; $min = $row->MIN_NORMAL ?? $row->Result->MIN_NORMAL; $max = $row->MAX_NORMAL ?? $row->Result->MAX_NORMAL; if (!is_null($min) && !is_null($max) && $max >= $min) return $min . ' - ' . $max; if (!is_null($min)) return '≥ ' . $min; if (!is_null($max)) return '≤ ' . $max; return '--'; }; // Profiles whose dedicated blocks below must follow the configured range // instead of the hardcoded wording those blocks were written with. $UseConfiguredReference = in_array($ProfileID, [78,77]); @endphp