@php $appointment = $appointment ?? null; $physicalExamResult = $physicalExamResult ?? ($appointment->physicalExamResult ?? null); @endphp {{--
Visus : @if($appointment && $appointment->visusResult) @php $leftEye = $appointment->visusResult->left_eye_uncorrected ?: $appointment->visusResult->left_eye_corrected; $rightEye = $appointment->visusResult->right_eye_uncorrected ?: $appointment->visusResult->right_eye_corrected; // Check if visus is normal (6/6 for both eyes) $isNormalVision = ($leftEye == '6/6' || $leftEye == '6/6') && ($rightEye == '6/6' || $rightEye == '6/6'); @endphp @if($isNormalVision && $leftEye == '6/6' && $rightEye == '6/6') Dalam batas normal @else @if($leftEye) Mata Kiri: {{ $leftEye }} @endif @if($leftEye && $rightEye), @endif @if($rightEye) Mata Kanan: {{ $rightEye }} @endif @endif @if($appointment->visusResult->interpretation)
Interpretasi: {{ $appointment->visusResult->interpretation }} @endif @if($appointment->visusResult->notes)
Catatan: {{ $appointment->visusResult->notes }} @endif @else Data pemeriksaan visus tidak tersedia @endif
--}} {{--
Buta Warna : @if($appointment && $appointment->visusResult && $appointment->visusResult->color_vision) {{ $appointment->visusResult->color_vision }} @else Negatif @endif
--}} @if ($physicalExamResult) @php // Function to get abnormal physical exam description with specific details if (!function_exists('getAbnormalPhysicalDescriptionSummary')) { function getAbnormalPhysicalDescriptionSummary($field, $value, $patient = null) { if (empty($value) || $value === '-' || $value === '') { return null; } // Check IMT -> tampilkan kategori (Underweight/Normal/Overweight/Obesitas I/II) if ($field === 'bmi' && is_numeric($value)) { $bmi = (float) $value; $category = null; if ($bmi < 18.5) { $category = 'Underweight'; } elseif ($bmi < 23) { $category = null; // Normal, tidak ditampilkan di summary } elseif ($bmi < 25) { $category = 'Overweight'; } elseif ($bmi < 30) { $category = 'Obesitas I'; } else { $category = 'Obesitas II'; } if ($category) { return "IMT: {$category} ({$bmi})"; } } // Check Blood Pressure if ($field === 'blood_pressure' && $value) { // Parse blood pressure (format: "120/80") if (preg_match('/(\d+)\/(\d+)/', $value, $matches)) { $systolic = (int) $matches[1]; $diastolic = (int) $matches[2]; if ($systolic >= 140 || $diastolic >= 90) { return "Tekanan darah tinggi ({$value} mmHg)"; } } } // Check Heart Rate if ($field === 'heart_rate' && is_numeric($value)) { $hr = (int) $value; if ($hr < 60) { return "Denyut jantung lambat ({$hr} bpm)"; } elseif ($hr > 100) { return "Denyut jantung cepat ({$hr} bpm)"; } } // Check Respiratory Rate if ($field === 'respiratory_rate' && is_numeric($value)) { $rr = (int) $value; if ($rr < 12) { return "Laju pernapasan lambat ({$rr}/menit)"; } elseif ($rr > 24) { return "Laju pernapasan cepat ({$rr}/menit)"; } } // Check Body Temperature if ($field === 'body_temperature' && is_numeric($value)) { $temp = (float) $value; if ($temp < 36.0) { return "Suhu badan rendah ({$temp}°C)"; } elseif ($temp > 37.2) { return "Suhu badan tinggi ({$temp}°C)"; } } // Check Waist Circumference (for metabolic risk) if ($field === 'waist_circumference' && is_numeric($value)) { $waist = (int) $value; $gender = $patient ? $patient->gender : 'male'; if ($gender === 'male' && $waist > 90) { return "Lingkar perut ({$waist} cm)"; } elseif ($gender === 'female' && $waist > 80) { return "Lingkar perut ({$waist} cm)"; } } // Check Vision (if less than 6/6 or 20/20) if ( in_array($field, [ 'vision_left_uncorrected', 'vision_right_uncorrected', 'vision_left_corrected', 'vision_right_corrected', ]) ) { // If vision is less than 6/6 or 20/20, it's considered abnormal if (preg_match('/(\d+)\/(\d+)/', $value, $matches)) { $numerator = (int) $matches[1]; $denominator = (int) $matches[2]; if ($numerator < $denominator) { return "Penglihatan menurun ({$value})"; } } } // Check Color Vision if ($field === 'color_vision') { if (!in_array(strtolower($value), ['normal', 'tidak ada', 'tidak buta warna'])) { return "Gangguan penglihatan warna ({$value})"; } } // Menggunakan pendekatan yang sama seperti di result_detail.blade.php // Daftar nilai normal yang spesifik $normalValues = [ 'Dalam Batas Normal', 'Simetris Normal', 'Vesikuler', 'Tidak Ada', 'Datar', 'Tidak Teraba', 'Reguler', 'Compos Mentis', 'Baik', 'Normal', 'Tidak Ditemukan', 'Tidak Tampak', 'Bersih', 'Jernih', 'Teratur', 'Kuat', 'Tidak Dilakukan', 'Negatif Normal', 'Dalam Batas', 'Sehat', 'Normal Limits', 'WOL', 'Clear', 'Good', 'Strong', 'Tidak Terdengar', 'Tidak Membesar', 'Tidak Nyeri', 'Tidak Ada Kelainan', 'Tidak Ada Gangguan', 'Tidak Ada Masalah', 'Tidak Ada Gejala', 'Tidak Ada Tanda', 'Tidak Ada Indikasi', 'Tidak Ada Bukti', 'Tidak Ada Manifestasi', 'Tidak Ada Keluhan', 'Tidak Ada Kelainan Fisik', 'Tidak Ada Kelainan Organik', 'Tidak Ada Kelainan Fungsional', 'Tidak Ada Kelainan Struktural', 'Negatif', 'Tidak Ditemukan Kelainan', ]; // Daftar nilai abnormal yang spesifik (seperti di process.blade.php) $abnormalValues = ['Abnormal', 'Ada', 'Irreguler', 'Distensi', 'Teraba', 'Positif']; $valueTrimmed = trim($value); // Cek apakah nilai adalah nilai normal if (in_array($valueTrimmed, $normalValues)) { return null; // Nilai normal, tidak abnormal } // Cek apakah nilai adalah "Ket. Lain" - ini perlu ditampilkan dengan detail if (stripos($valueTrimmed, 'ket. lain') !== false || stripos($valueTrimmed, 'keterangan lain') !== false) { return null; // Akan ditangani di bagian lain dengan detail value } // Cek apakah nilai adalah nilai abnormal yang spesifik if (in_array($valueTrimmed, $abnormalValues)) { return null; // Nilai abnormal spesifik, tidak perlu ditampilkan di summary } // Jika nilai bukan normal dan bukan abnormal spesifik, maka kemungkinan besar abnormal // Return nilai asli untuk ditampilkan return $value; } } $physicalAbnormal = []; $patient = $appointment ? $appointment->patient : null; // Check vital signs and anthropometry - hanya tampilkan yang benar-benar abnormal $vitalFields = [ 'bmi' => 'IMT', 'blood_pressure' => 'Tekanan Darah', 'heart_rate' => 'Denyut Jantung', 'respiratory_rate' => 'Laju Pernapasan', 'body_temperature' => 'Suhu Badan', 'waist_circumference' => 'Lingkar Perut', ]; foreach ($vitalFields as $field => $label) { $value = $physicalExamResult->$field; // Cek apakah nilai abnormal berdasarkan kriteria medis $isAbnormal = false; $abnormalDescription = ''; if ($field === 'bmi' && is_numeric($value)) { $bmi = (float) $value; // Tampilkan kategori IMT; Normal tidak ditampilkan if ($bmi < 18.5) { $isAbnormal = true; $abnormalDescription = "IMT Underweight ({$bmi})"; } elseif ($bmi < 23) { // Normal: tidak ditampilkan } elseif ($bmi < 25) { $isAbnormal = true; $abnormalDescription = "IMT Overweight ({$bmi})"; } elseif ($bmi < 30) { $isAbnormal = true; $abnormalDescription = "IMT Obesitas I ({$bmi})"; } else { $isAbnormal = true; $abnormalDescription = "IMT Obesitas II ({$bmi})"; } } elseif ($field === 'blood_pressure' && $value) { // Parse blood pressure (format: "120/80") if (preg_match('/(\d+)\/(\d+)/', $value, $matches)) { $systolic = (int) $matches[1]; $diastolic = (int) $matches[2]; if ($systolic >= 140 || $diastolic >= 90) { $isAbnormal = true; $abnormalDescription = "Tekanan darah tinggi ({$value} mmHg)"; } } } elseif ($field === 'heart_rate' && is_numeric($value)) { $hr = (int) $value; if ($hr < 60 || $hr > 100) { $isAbnormal = true; $abnormalDescription = $hr < 60 ? "Denyut jantung lambat ({$hr} bpm)" : "Denyut jantung cepat ({$hr} bpm)"; } } elseif ($field === 'respiratory_rate' && is_numeric($value)) { $rr = (int) $value; if ($rr < 12 || $rr > 24) { $isAbnormal = true; $abnormalDescription = $rr < 12 ? "Laju pernapasan lambat ({$rr}/menit)" : "Laju pernapasan cepat ({$rr}/menit)"; } } elseif ($field === 'body_temperature' && is_numeric($value)) { $temp = (float) $value; if ($temp < 36.0 || $temp > 37.2) { $isAbnormal = true; $abnormalDescription = $temp < 36.0 ? "Suhu badan rendah ({$temp}°C)" : "Suhu badan tinggi ({$temp}°C)"; } } elseif ($field === 'waist_circumference' && is_numeric($value)) { $waist = (int) $value; $gender = $patient ? $patient->gender : 'male'; if (($gender === 'male' && $waist > 90) || ($gender === 'female' && $waist > 80)) { $isAbnormal = true; $abnormalDescription = "Lingkar perut ({$waist} cm)"; } } if ($isAbnormal && $abnormalDescription) { $physicalAbnormal[] = $abnormalDescription; } } // Check vision tests $visionFields = [ 'vision_left_uncorrected' => 'Visus Kiri Tanpa Koreksi', 'vision_right_uncorrected' => 'Visus Kanan Tanpa Koreksi', 'vision_left_corrected' => 'Visus Kiri Dengan Koreksi', 'vision_right_corrected' => 'Visus Kanan Dengan Koreksi', 'color_vision' => 'Buta Warna', ]; foreach ($visionFields as $field => $label) { $value = $physicalExamResult->$field; $abnormalDescription = getAbnormalPhysicalDescriptionSummary($field, $value, $patient); if ($abnormalDescription) { $physicalAbnormal[] = $abnormalDescription; } } // Check detailed physical examination using the same logic as result_detail.blade.php if ($physicalExamResult->physical_examination_data) { $examData = \App\Helpers\PhysicalExamHelper::processExamData($physicalExamResult->physical_examination_data); foreach ($examData as $system => $findings) { if (is_array($findings)) { foreach ($findings as $part => $result) { if ($result && trim($result) !== '' && !str_ends_with($part, '_detail')) { // Menggunakan logika yang sama seperti di result_detail.blade.php $isNormalValue = in_array($result, [ 'Dalam Batas Normal', 'Simetris Normal', 'Vesikuler', 'Tidak Ada', 'Datar', 'Tidak Teraba', 'Reguler', 'Compos Mentis', 'Baik', 'Normal', 'Tidak Ditemukan', 'Tidak Tampak', 'Bersih', 'Jernih', 'Teratur', 'Kuat', 'Tidak Dilakukan', 'Negatif Normal', 'Dalam Batas', 'Sehat', 'Normal Limits', 'WOL', 'Clear', 'Good', 'Strong', 'Tidak Terdengar', 'Tidak Membesar', 'Tidak Nyeri', 'Tidak Ada Kelainan', 'Tidak Ada Gangguan', 'Tidak Ada Masalah', 'Tidak Ada Gejala', 'Tidak Ada Tanda', 'Tidak Ada Indikasi', 'Tidak Ada Bukti', 'Tidak Ada Manifestasi', 'Tidak Ada Keluhan', 'Tidak Ada Kelainan Fisik', 'Tidak Ada Kelainan Organik', 'Tidak Ada Kelainan Fungsional', 'Tidak Ada Kelainan Struktural', 'Negatif', 'Tidak Ditemukan Kelainan', ]); $isAbnormalFlag = strtolower(trim($result)) === 'abnormal'; $detailValue = $findings[$part . '_detail'] ?? null; // Jika bukan nilai normal, maka kemungkinan abnormal if (!$isNormalValue) { $fieldName = \App\Helpers\PhysicalExamHelper::getFieldLabel($part); $displayResult = $result; // Jika nilai adalah "Abnormal", gunakan detail value if ($isAbnormalFlag && $detailValue) { $displayResult = $detailValue; } elseif ( stripos($result, 'ket. lain') !== false || stripos($result, 'keterangan lain') !== false ) { // Jika nilai adalah "Ket. Lain", gunakan detail value if ($detailValue && !empty(trim($detailValue))) { $displayResult = $detailValue; } else { $displayResult = $result; } } else { // Jika nilai adalah "Ada" dan ada detail value, gunakan detail value if (strtolower(trim($result)) === 'ada' && $detailValue && !empty(trim($detailValue))) { $displayResult = $detailValue; } else { // Jika bukan "Abnormal" atau "Ket. Lain", tampilkan nilai asli $displayResult = $result; } } // Bersihkan duplikasi internal menggunakan helper $displayResult = \App\Helpers\PhysicalExamHelper::cleanDuplicateText($displayResult); $physicalAbnormal[] = $fieldName . ': ' . $displayResult; } } } } } } // Add notes if any and not normal if ($physicalExamResult->notes) { $notes = trim($physicalExamResult->notes); $abnormalDescription = getAbnormalPhysicalDescriptionSummary('notes', $notes, $patient); if ($abnormalDescription && strlen($notes) > 5) { $physicalAbnormal[] = 'Catatan: ' . $abnormalDescription; } } // Remove duplicates and empty entries $physicalAbnormal = array_unique(array_filter($physicalAbnormal)); @endphp
Pemeriksaan Fisik : @if (count($physicalAbnormal) > 0) @foreach ($physicalAbnormal as $index => $note) @if ($index > 0) , @endif {{ $note }} @endforeach @else Dalam batas normal @endif
@else
Pemeriksaan Fisik : Dalam batas normal
@endif