Antropometri
:
@if ($appointment->physicalExamResult->height)
@endif
@if ($appointment->physicalExamResult->weight)
@endif
@if ($appointment->physicalExamResult->bmi)
@endif
@if ($appointment->physicalExamResult->waist_circumference)
@endif
{{ $appointment->physicalExamResult->height }}cm
Tinggi Badan
{{ $appointment->physicalExamResult->weight }}kg
Berat Badan
{{
number_format(
$appointment->physicalExamResult->bmi,
2,
)
}}
@php
$bmi = $appointment->physicalExamResult->bmi;
$bmiCategory = '';
if ($bmi < 18.5) {
$bmiCategory = 'Underweight';
} elseif ($bmi < 23) {
$bmiCategory = 'Normal';
} elseif ($bmi < 25) {
$bmiCategory = 'Overweight';
} elseif ($bmi < 30) {
$bmiCategory = 'Obesitas I';
} else {
$bmiCategory = 'Obesitas II';
}
@endphp
{{ $bmiCategory }}
IMT
{{ $appointment->physicalExamResult->waist_circumference }}cm
@php
// Interpretasi lingkar perut dan risiko
$waist = (float) $appointment->physicalExamResult->waist_circumference;
$gender = $appointment->patient ? $appointment->patient->gender : 'male';
$waistNote = '';
if ($gender === 'male') {
if ($waist < 90) {
$waistNote = 'Normal';
} else {
$waistNote = 'Beresiko';
}
} else {
if ($waist < 80) {
$waistNote = 'Normal';
} else {
$waistNote = 'Beresiko';
}
}
@endphp
{{ $waistNote }}
Lingkar Perut
Tanda Vital
:
@if ($appointment->physicalExamResult->general_appearance || $appointment->physicalExamResult->consciousness_level)
@if ($appointment->physicalExamResult->blood_pressure_systolic &&
$appointment->physicalExamResult->blood_pressure_diastolic)
@endif
@if ($appointment->physicalExamResult->heart_rate)
@endif
@if ($appointment->physicalExamResult->respiratory_rate)
@endif
@if ($appointment->physicalExamResult->body_temperature)
@endif
{{ $appointment->physicalExamResult->blood_pressure_systolic }}/{{ $appointment->physicalExamResult->blood_pressure_diastolic }}mmHg
@php
// Klasifikasi tekanan darah
$sys = (int) $appointment->physicalExamResult->blood_pressure_systolic;
$dia = (int) $appointment->physicalExamResult->blood_pressure_diastolic;
$bpCat = '';
if ($sys >= 140 || $dia >= 90) {
$bpCat = 'Hipertensi';
} else {
$bpCat = 'Normal';
}
@endphp
{{ $bpCat }}
Tekanan Darah
{{ $appointment->physicalExamResult->heart_rate }}x/m
@php
// Interpretasi nadi
$hr = (int) $appointment->physicalExamResult->heart_rate;
$hrCat = '';
if ($hr < 60) {
$hrCat = 'Bradikardi';
} elseif ($hr > 100) {
$hrCat = 'Takikardi';
} else {
$hrCat = 'Normal';
}
@endphp
{{ $hrCat }}
Nadi
{{ $appointment->physicalExamResult->respiratory_rate }}x/m
@php
// Interpretasi respirasi
$rr = (int) $appointment->physicalExamResult->respiratory_rate;
$rrCat = '';
if ($rr < 12) {
$rrCat = 'Bradipnea';
} elseif ($rr > 24) {
$rrCat = 'Takipnea';
} else {
$rrCat = 'Normal';
}
@endphp
{{ $rrCat }}
Respirasi
{{
number_format(
$appointment->physicalExamResult->body_temperature,
1,
)
}}°C
@php
// Klasifikasi suhu tubuh
$t = (float) $appointment->physicalExamResult->body_temperature;
$tCat = '';
if ($t > 42.0) {
$tCat = 'Hipertermi';
} elseif ($t >= 40.0 && $t <= 42.0) {
$tCat = 'Hiperpireksis';
} elseif ($t >= 38.0 && $t < 40.0) {
$tCat = 'Febris';
} elseif ($t >= 37.0 && $t < 38.0) {
$tCat = 'Sub Febris';
} elseif ($t >= 36.6 && $t <= 37.2) {
$tCat = 'Normal';
} elseif ($t < 36.0) {
$tCat = 'Hipotermi';
} else {
$tCat = 'Normal';
}
@endphp
{{ $tCat }}
Suhu
Keadaan Umum & Kesadaran
:
@endif
@if ($appointment->visusResult)
@if ($appointment->physicalExamResult->general_appearance)
@endif
@if ($appointment->physicalExamResult->consciousness_level)
@endif
@if (!$appointment->physicalExamResult->general_appearance && !$appointment->physicalExamResult->consciousness_level)
@endif
{{ $appointment->physicalExamResult->general_appearance }}
Keadaan Umum
{{ $appointment->physicalExamResult->consciousness_level }}
Kesadaran
-
Tidak ada data
Pemeriksaan Mata
:
@endif
@endif
@endif
@if ($physicalData && is_array($physicalData))
@php
// Fungsi: menentukan apakah nilai visus lebih buruk dari 6/6
// Mengembalikan true jika pembilang < penyebut (contoh: 6/9, 6/12)
// Termasuk kasus khusus non-numerik seperti "1/tak terhingga" atau simbol ∞
if (!function_exists('isAbnormalVisionValue')) {
function isAbnormalVisionValue($value)
{
if (!is_string($value) || trim($value) === '') {
return false;
}
$val = trim(strtolower($value));
if (strpos($val, 'tak') !== false || strpos($val, '∞') !== false) {
return true;
}
if (preg_match('/(\d+)\/(\d+)/', $value, $m)) {
$num = (int) $m[1];
$den = (int) $m[2];
return $num < $den; // lebih buruk dari 6/6
}
return false;
}
}
// Fungsi: menentukan abnormal untuk teks umum (bukan rasio visus)
if (!function_exists('isAbnormalText')) {
function isAbnormalText($value)
{
if (!is_string($value)) {
return false;
}
$trimmed = trim($value);
if ($trimmed === '' || $trimmed === '-') {
return false;
}
// Placeholder yang tidak dianggap abnormal
if (preg_match('/belum diperiksa|tidak diperiksa|tidak dilakukan/i', $trimmed)) {
return false;
}
// Nilai dianggap normal jika mengandung kata "normal" atau "negatif"
if (preg_match('/normal/i', $trimmed) || preg_match('/negatif/i', $trimmed)) {
return false;
}
// Kata kunci umum abnormal
if (preg_match('/parsial|partial|total|defek|terbatas|abnormal/i', $trimmed)) {
return true;
}
// Default: selain normal/negatif dianggap abnormal
return true;
}
}
// Fungsi: menentukan apakah nilai near vision abnormal
// Interpretasi: Dalam Batas Normal = normal; Presbiopia Ringan/Sedang/Berat = abnormal
// Nilai Jaeger: J20-J25 = normal, J30 ke atas = abnormal; Tidak Dapat di Evaluasi = abnormal
if (!function_exists('isAbnormalNearVision')) {
function isAbnormalNearVision($value)
{
if (!is_string($value) || trim($value) === '') {
return false;
}
$val = trim($value);
if (stripos($val, 'Dalam Batas Normal') !== false) {
return false;
}
if (stripos($val, 'Presbiopia') !== false) {
return true;
}
if (stripos($val, 'Tidak Dapat di Evaluasi') !== false) {
return true;
}
if (preg_match('/J(\d+)/', $val, $m)) {
$num = (int) $m[1];
return $num >= 30;
}
return false;
}
}
$leftUncorrected = $appointment->visusResult->left_eye_uncorrected ?? null;
$rightUncorrected = $appointment->visusResult->right_eye_uncorrected ?? null;
$leftCorrected = $appointment->visusResult->left_eye_corrected ?? null;
$rightCorrected = $appointment->visusResult->right_eye_corrected ?? null;
$isLeftUncorrectedAbn = isAbnormalVisionValue($leftUncorrected);
$isRightUncorrectedAbn = isAbnormalVisionValue($rightUncorrected);
$isLeftCorrectedAbn = isAbnormalVisionValue($leftCorrected);
$isRightCorrectedAbn = isAbnormalVisionValue($rightCorrected);
$nearLeftUncorrected = $appointment->visusResult->near_vision_left_uncorrected ?? null;
$nearRightUncorrected = $appointment->visusResult->near_vision_right_uncorrected ?? null;
$nearLeftCorrected = $appointment->visusResult->near_vision_left_corrected ?? null;
$nearRightCorrected = $appointment->visusResult->near_vision_right_corrected ?? null;
$isNearLeftUncorrectedAbn = isAbnormalNearVision($nearLeftUncorrected);
$isNearRightUncorrectedAbn = isAbnormalNearVision($nearRightUncorrected);
$isNearLeftCorrectedAbn = isAbnormalNearVision($nearLeftCorrected);
$isNearRightCorrectedAbn = isAbnormalNearVision($nearRightCorrected);
$vfLeft = $appointment->visusResult->visual_field_left ?? null;
$vfRight = $appointment->visusResult->visual_field_right ?? null;
$colorVision = $appointment->visusResult->color_vision ?? null;
$isVfLeftAbn = isAbnormalText($vfLeft);
$isVfRightAbn = isAbnormalText($vfRight);
$isColorVisionAbn = isAbnormalText($colorVision);
@endphp
@if ($nearLeftUncorrected)
@endif
@if ($nearRightUncorrected)
@endif
@if ($appointment->visusResult->visual_field_left)
@endif
@if ($appointment->visusResult->visual_field_right)
@endif
@if ($appointment->visusResult->color_vision)
@endif
@if ($appointment->visusResult->interpretation)
@endif
{{ $leftUncorrected ?: '-' }}
Tanpa Kacamata
Mata Kiri
{{ $rightUncorrected ?: '-' }}
Tanpa Kacamata
Mata Kanan
{{ $leftCorrected ?: '-' }}
Dengan Kacamata
Mata Kiri
{{ $rightCorrected ?: '-' }}
Dengan Kacamata
Mata Kanan
{{ $nearLeftUncorrected }}
Visus Dekat Tanpa Kacamata
Mata Kiri
{{ $nearRightUncorrected }}
Visus Dekat Tanpa Kacamata
Mata Kanan
{{ $nearLeftCorrected ?: '-' }}
Visus Dekat Dengan Kacamata
Mata Kiri
{{ $nearRightCorrected ?: '-' }}
Visus Dekat Dengan Kacamata
Mata Kanan
{{ $appointment->visusResult->visual_field_left }}
Lapang Pandang Kiri
{{ $appointment->visusResult->visual_field_right }}
Lapang Pandang Kanan
{{ $appointment->visusResult->color_vision }}
Buta Warna
{{ $appointment->visusResult->interpretation }}
Interpretasi
@php
// Get system names from helper
$systemNames = \App\Helpers\PhysicalExamHelper::getSystemNamesForPdf();
// Group systems for 2-column layout - same order as process.blade.php
$layoutRows = [
'row1' => ['left' => 'head_neck', 'right' => 'chest_lungs'],
'row2' => ['left' => 'heart', 'right' => 'abdomen'],
'row3' => ['left' => 'extremities', 'right' => 'skin_nails'],
'row4' => ['full' => 'special'],
];
// Helper function untuk membersihkan duplikasi dan mendapatkan display value
if (!function_exists('getCleanDisplayValue')) {
function getCleanDisplayValue($fieldValue, $detailValue)
{
$displayValue = $fieldValue;
// Jika nilai adalah "Abnormal", "Ket. Lain", atau "Ada", gunakan detail value
if (
(strtolower(trim($fieldValue)) === 'abnormal' ||
stripos($fieldValue, 'ket. lain') !== false ||
stripos($fieldValue, 'keterangan lain') !== false ||
strtolower(trim($fieldValue)) === 'ada') &&
!empty($detailValue)
) {
$displayValue = $detailValue;
}
// Bersihkan duplikasi internal
return \App\Helpers\PhysicalExamHelper::cleanDuplicateText($displayValue);
}
}
@endphp
@endif
@if ($appointment->physicalExamResult->notes)
|
@php
$systemKey = $layoutRows['row1']['left'];
$systemInfo = $systemNames[$systemKey];
@endphp
{{ $systemInfo['name'] }}
@if (isset($physicalData[$systemKey]) &&
is_array($physicalData[$systemKey]) &&
!empty(array_filter($physicalData[$systemKey])))
@foreach ($fieldOrder[$systemKey] as $fieldKey)
@if (isset($physicalData[$systemKey][$fieldKey]) &&
!empty($physicalData[$systemKey][$fieldKey]))
{{ \App\Helpers\PhysicalExamHelper::getFieldLabel($fieldKey) }}:
@php
$fieldValue = $physicalData[$systemKey][$fieldKey];
$detailValue = $physicalData[$systemKey][$fieldKey . '_detail'] ?? null;
// Gunakan helper function untuk mendapatkan display value bersih dari duplikasi
$displayValue = getCleanDisplayValue($fieldValue, $detailValue);
@endphp
@php
$colorClass = \App\Helpers\PhysicalExamHelper::getPdfSpecialValueClass($fieldValue, $fieldKey);
$styleColor = '';
if ($colorClass === 'black') {
$styleColor = 'color: #000000;';
} elseif ($colorClass === 'green') {
$styleColor = 'color: #28a745;';
} elseif ($colorClass === 'red') {
$styleColor = 'color: #dc3545;';
}
@endphp
{{ $displayValue }}
@if (isset($physicalData[$systemKey][$fieldKey . '_detail']) &&
!empty($physicalData[$systemKey][$fieldKey . '_detail']) &&
stripos($fieldValue, 'keterangan lain') !== false)
@endif
@endforeach
@else
{{ $physicalData[$systemKey][$fieldKey . '_detail'] }}
@endif
-
Tidak ada pemeriksaan
@endif
|
@php
$systemKey = $layoutRows['row1']['right'];
$systemInfo = $systemNames[$systemKey];
@endphp
{{ $systemInfo['name'] }}
@if (isset($physicalData[$systemKey]) &&
is_array($physicalData[$systemKey]) &&
!empty(array_filter($physicalData[$systemKey])))
@foreach ($fieldOrder[$systemKey] as $fieldKey)
@if (isset($physicalData[$systemKey][$fieldKey]) &&
!empty($physicalData[$systemKey][$fieldKey]))
{{ \App\Helpers\PhysicalExamHelper::getFieldLabel($fieldKey) }}:
@php
$fieldValue = $physicalData[$systemKey][$fieldKey];
$detailValue = $physicalData[$systemKey][$fieldKey . '_detail'] ?? null;
// Gunakan helper function untuk mendapatkan display value bersih dari duplikasi
$displayValue = getCleanDisplayValue($fieldValue, $detailValue);
@endphp
@php
$colorClass = \App\Helpers\PhysicalExamHelper::getPdfSpecialValueClass($fieldValue, $fieldKey);
$styleColor = '';
if ($colorClass === 'black') {
$styleColor = 'color: #000000;';
} elseif ($colorClass === 'green') {
$styleColor = 'color: #28a745;';
} elseif ($colorClass === 'red') {
$styleColor = 'color: #dc3545;';
}
@endphp
{{ $displayValue }}
@if (isset($physicalData[$systemKey][$fieldKey . '_detail']) &&
!empty($physicalData[$systemKey][$fieldKey . '_detail']) &&
stripos($fieldValue, 'keterangan lain') !== false)
@endif
@endforeach
@else
{{ $physicalData[$systemKey][$fieldKey . '_detail'] }}
@endif
-
Tidak ada pemeriksaan
@endif
|
|
@php
$systemKey = $layoutRows['row2']['left'];
$systemInfo = $systemNames[$systemKey];
@endphp
{{ $systemInfo['name'] }}
@if (isset($physicalData[$systemKey]) &&
is_array($physicalData[$systemKey]) &&
!empty(array_filter($physicalData[$systemKey])))
@foreach ($fieldOrder[$systemKey] as $fieldKey)
@if (isset($physicalData[$systemKey][$fieldKey]) &&
!empty($physicalData[$systemKey][$fieldKey]))
{{ \App\Helpers\PhysicalExamHelper::getFieldLabel($fieldKey) }}:
@php
$fieldValue = $physicalData[$systemKey][$fieldKey];
$detailValue = $physicalData[$systemKey][$fieldKey . '_detail'] ?? null;
// Gunakan helper function untuk mendapatkan display value bersih dari duplikasi
$displayValue = getCleanDisplayValue($fieldValue, $detailValue);
@endphp
@php
$colorClass = \App\Helpers\PhysicalExamHelper::getPdfSpecialValueClass($fieldValue, $fieldKey);
$styleColor = '';
if ($colorClass === 'black') {
$styleColor = 'color: #000000;';
} elseif ($colorClass === 'green') {
$styleColor = 'color: #28a745;';
} elseif ($colorClass === 'red') {
$styleColor = 'color: #dc3545;';
}
@endphp
{{ $displayValue }}
@if (isset($physicalData[$systemKey][$fieldKey . '_detail']) &&
!empty($physicalData[$systemKey][$fieldKey . '_detail']) &&
stripos($fieldValue, 'keterangan lain') !== false)
@endif
@endforeach
@else
{{ $physicalData[$systemKey][$fieldKey . '_detail'] }}
@endif
-
Tidak ada pemeriksaan
@endif
|
@php
$systemKey = $layoutRows['row2']['right'];
$systemInfo = $systemNames[$systemKey];
@endphp
{{ $systemInfo['name'] }}
@if (isset($physicalData[$systemKey]) &&
is_array($physicalData[$systemKey]) &&
!empty(array_filter($physicalData[$systemKey])))
@foreach ($fieldOrder[$systemKey] as $fieldKey)
@if (isset($physicalData[$systemKey][$fieldKey]) &&
!empty($physicalData[$systemKey][$fieldKey]))
{{ \App\Helpers\PhysicalExamHelper::getFieldLabel($fieldKey) }}:
@php
$fieldValue = $physicalData[$systemKey][$fieldKey];
$detailValue = $physicalData[$systemKey][$fieldKey . '_detail'] ?? null;
// Gunakan helper function untuk mendapatkan display value bersih dari duplikasi
$displayValue = getCleanDisplayValue($fieldValue, $detailValue);
@endphp
@php
$colorClass = \App\Helpers\PhysicalExamHelper::getPdfSpecialValueClass($fieldValue, $fieldKey);
$styleColor = '';
if ($colorClass === 'black') {
$styleColor = 'color: #000000;';
} elseif ($colorClass === 'green') {
$styleColor = 'color: #28a745;';
} elseif ($colorClass === 'red') {
$styleColor = 'color: #dc3545;';
}
@endphp
{{ $displayValue }}
@if (isset($physicalData[$systemKey][$fieldKey . '_detail']) &&
!empty($physicalData[$systemKey][$fieldKey . '_detail']) &&
stripos($fieldValue, 'keterangan lain') !== false)
@endif
@endforeach
@else
{{ $physicalData[$systemKey][$fieldKey . '_detail'] }}
@endif
-
Tidak ada pemeriksaan
@endif
|
|
@php
$systemKey = $layoutRows['row3']['left'];
$systemInfo = $systemNames[$systemKey];
@endphp
{{ $systemInfo['name'] }}
@if (isset($physicalData[$systemKey]) &&
is_array($physicalData[$systemKey]) &&
!empty(array_filter($physicalData[$systemKey])))
@foreach ($fieldOrder[$systemKey] as $fieldKey)
@if (isset($physicalData[$systemKey][$fieldKey]) &&
!empty($physicalData[$systemKey][$fieldKey]))
{{ \App\Helpers\PhysicalExamHelper::getFieldLabel($fieldKey) }}:
@php
$fieldValue = $physicalData[$systemKey][$fieldKey];
$detailValue = $physicalData[$systemKey][$fieldKey . '_detail'] ?? null;
// Gunakan helper function untuk mendapatkan display value bersih dari duplikasi
$displayValue = getCleanDisplayValue($fieldValue, $detailValue);
@endphp
@php
$colorClass = \App\Helpers\PhysicalExamHelper::getPdfSpecialValueClass($fieldValue, $fieldKey);
$styleColor = '';
if ($colorClass === 'black') {
$styleColor = 'color: #000000;';
} elseif ($colorClass === 'green') {
$styleColor = 'color: #28a745;';
} elseif ($colorClass === 'red') {
$styleColor = 'color: #dc3545;';
}
@endphp
{{ $displayValue }}
@if (isset($physicalData[$systemKey][$fieldKey . '_detail']) &&
!empty($physicalData[$systemKey][$fieldKey . '_detail']) &&
stripos($fieldValue, 'keterangan lain') !== false)
@endif
@endforeach
@else
{{ $physicalData[$systemKey][$fieldKey . '_detail'] }}
@endif
-
Tidak ada pemeriksaan
@endif
|
@php
$systemKey = $layoutRows['row3']['right'];
$systemInfo = $systemNames[$systemKey];
@endphp
{{ $systemInfo['name'] }}
@if (isset($physicalData[$systemKey]) &&
is_array($physicalData[$systemKey]) &&
!empty(array_filter($physicalData[$systemKey])))
@foreach ($fieldOrder[$systemKey] as $fieldKey)
@if (isset($physicalData[$systemKey][$fieldKey]) &&
!empty($physicalData[$systemKey][$fieldKey]))
{{ \App\Helpers\PhysicalExamHelper::getFieldLabel($fieldKey) }}:
@php
$fieldValue = $physicalData[$systemKey][$fieldKey];
$detailValue = $physicalData[$systemKey][$fieldKey . '_detail'] ?? null;
// Gunakan helper function untuk mendapatkan display value bersih dari duplikasi
$displayValue = getCleanDisplayValue($fieldValue, $detailValue);
@endphp
@php
$colorClass = \App\Helpers\PhysicalExamHelper::getPdfSpecialValueClass($fieldValue, $fieldKey);
$styleColor = '';
if ($colorClass === 'black') {
$styleColor = 'color: #000000;';
} elseif ($colorClass === 'green') {
$styleColor = 'color: #28a745;';
} elseif ($colorClass === 'red') {
$styleColor = 'color: #dc3545;';
}
@endphp
{{ $displayValue }}
@if (isset($physicalData[$systemKey][$fieldKey . '_detail']) &&
!empty($physicalData[$systemKey][$fieldKey . '_detail']) &&
stripos($fieldValue, 'keterangan lain') !== false)
@endif
@endforeach
@else
{{ $physicalData[$systemKey][$fieldKey . '_detail'] }}
@endif
-
Tidak ada pemeriksaan
@endif
|
@php
$systemKey = $layoutRows['row4']['full'];
$systemInfo = $systemNames[$systemKey];
@endphp
{{ $systemInfo['name'] }}
@if (isset($physicalData[$systemKey]) &&
is_array($physicalData[$systemKey]) &&
!empty(array_filter($physicalData[$systemKey])))
@foreach ($fieldOrder[$systemKey] as $fieldKey)
@if (isset($physicalData[$systemKey][$fieldKey]) &&
!empty($physicalData[$systemKey][$fieldKey]))
{{ $fieldLabels[$fieldKey] ?? ucwords(str_replace('_', ' ', $fieldKey)) }}:
@php
$fieldValue = $physicalData[$systemKey][$fieldKey];
$detailValue = $physicalData[$systemKey][$fieldKey . '_detail'] ?? null;
// Gunakan helper function untuk mendapatkan display value bersih dari duplikasi
$displayValue = getCleanDisplayValue($fieldValue, $detailValue);
// Get color class using helper method
$colorClass = \App\Helpers\PhysicalExamHelper::getPdfSpecialValueClass($fieldValue, $fieldKey);
$styleColor = '';
if ($colorClass === 'black') {
$styleColor = 'color: #000000;';
} elseif ($colorClass === 'green') {
$styleColor = 'color: #28a745;';
} elseif ($colorClass === 'red') {
$styleColor = 'color: #dc3545;';
}
@endphp
{{ $displayValue }}
@if (isset($physicalData[$systemKey][$fieldKey . '_detail']) &&
!empty($physicalData[$systemKey][$fieldKey . '_detail']) &&
stripos($fieldValue, 'keterangan lain') !== false)
@endif
@endforeach
@else
{{ $physicalData[$systemKey][$fieldKey . '_detail'] }}
@endif
-
Tidak ada pemeriksaan
@endif
CATATAN PEMERIKSAAN
{{ $appointment->physicalExamResult->notes }}
KESIMPULAN PEMERIKSAAN FISIK:
@php
$physicalConclusion = '';
$abnormalFindings = [];
// Check for abnormal findings from physical examination using helper
if ($physicalData && is_array($physicalData)) {
$abnormalFindings = \App\Helpers\PhysicalExamHelper::getAbnormalFindings($physicalData);
}
// Check vital signs for abnormal values
$vitalAbnormal = [];
if (
$appointment->physicalExamResult->blood_pressure_systolic &&
$appointment->physicalExamResult->blood_pressure_diastolic
) {
$systolic = $appointment->physicalExamResult->blood_pressure_systolic;
$diastolic = $appointment->physicalExamResult->blood_pressure_diastolic;
if ($systolic >= 140 || $diastolic >= 90 || $systolic < 90 || $diastolic < 60) {
$vitalAbnormal[] = "Tekanan darah: {$systolic}/{$diastolic} mmHg (Hipertensi)";
}
}
if ($appointment->physicalExamResult->bmi) {
$bmi = $appointment->physicalExamResult->bmi;
// Abnormal jika <18.5 (Underweight), 23.0–24.9 (Overweight), 25.0–29.9 (Obesitas I), ≥30 (Obesitas II)
if ($bmi < 18.5) {
$vitalAbnormal[] = 'IMT: ' . number_format($bmi, 2) . ' (Berat badan kurang)';
} elseif ($bmi < 23) {
// Normal, tidak dimasukkan
} elseif ($bmi < 25) {
$vitalAbnormal[] = 'IMT: ' . number_format($bmi, 2) . ' (Overweight)';
} elseif ($bmi < 30) {
$vitalAbnormal[] = 'IMT: ' . number_format($bmi, 2) . ' (Obesitas I)';
} else {
$vitalAbnormal[] = 'IMT: ' . number_format($bmi, 2) . ' (Obesitas II)';
}
}
// Check waist circumference for abnormal values
if ($appointment->physicalExamResult->waist_circumference) {
$waist = $appointment->physicalExamResult->waist_circumference;
$gender = $appointment->patient ? $appointment->patient->gender : 'male';
if (($gender === 'male' && $waist > 90) || ($gender === 'female' && $waist > 80)) {
$vitalAbnormal[] = "Lingkar Perut: {$waist} cm";
}
}
// Check general condition and consciousness level
if ($appointment->physicalExamResult->general_appearance) {
$generalAppearance = trim($appointment->physicalExamResult->general_appearance);
// Based on the form options: 'Baik', 'Sedang', 'Buruk'
$normalAppearanceTerms = ['baik', 'sehat', 'normal', 'tampak sehat', 'dalam batas normal'];
$isNormalAppearance = false;
// 'Baik' is considered normal, 'Sedang' and 'Buruk' are abnormal
if (stripos($generalAppearance, 'baik') !== false) {
$isNormalAppearance = true;
} else {
foreach ($normalAppearanceTerms as $term) {
if (stripos($generalAppearance, $term) !== false) {
$isNormalAppearance = true;
break;
}
}
}
if (!$isNormalAppearance && strlen($generalAppearance) > 2) {
$vitalAbnormal[] = 'Keadaan umum: ' . $generalAppearance;
}
}
if ($appointment->physicalExamResult->consciousness_level) {
$consciousnessLevel = trim($appointment->physicalExamResult->consciousness_level);
// Based on the form options: 'Compos Mentis', 'Somnolen', 'Sopor', 'Koma'
// Only 'Compos Mentis' is normal, others are abnormal
$normalConsciousnessTerms = ['compos mentis', 'composmentis', 'cm'];
$isNormalConsciousness = false;
foreach ($normalConsciousnessTerms as $term) {
if (stripos($consciousnessLevel, $term) !== false) {
$isNormalConsciousness = true;
break;
}
}
if (!$isNormalConsciousness && strlen($consciousnessLevel) > 2) {
$vitalAbnormal[] = 'Kesadaran: ' . $consciousnessLevel;
}
}
$allAbnormal = array_merge($abnormalFindings, $vitalAbnormal);
// Bersihkan duplikasi pada setiap item dalam array
$allAbnormal = array_map(function ($item) {
return \App\Helpers\PhysicalExamHelper::cleanDuplicateText($item);
}, $allAbnormal);
// Hapus duplikat yang identik
$allAbnormal = array_unique($allAbnormal);
if (count($allAbnormal) > 0) {
$physicalConclusion = implode(";\n", $allAbnormal) . '.';
} else {
$physicalConclusion = 'Pemeriksaan fisik dalam batas normal.';
}
@endphp
{{ $physicalConclusion }}
Dokter Pemeriksa
@php
$signatureImageData = null;
$signatureMimeType = 'png';
$doctorName = 'Dokter Pemeriksa';
$doctorPosition = 'Dokter Umum';
if (!$isGeneralAccount && $examinerDoctor && $examinerDoctor->signature_image) {
$signaturePath = storage_path('app/public/' . $examinerDoctor->signature_image);
if (file_exists($signaturePath)) {
try {
$signatureImageData = base64_encode(file_get_contents($signaturePath));
$imageType = pathinfo($signaturePath, PATHINFO_EXTENSION);
$signatureMimeType = $imageType === 'jpg' ? 'jpeg' : strtolower($imageType);
$doctorName = $examinerDoctor->employee->full_name ?? 'Dokter Pemeriksa';
$doctorPosition = $examinerDoctor->employee->position->name ?? 'Dokter Umum';
} catch (Exception $e) {
$signatureImageData = null;
}
}
}
if (!$isGeneralAccount && !$signatureImageData && $examinerUser && stripos($examinerUser->name, 'Said') !== false) {
$signaturePath = public_path('assets/images/ttd/dr.said.jpg');
if (file_exists($signaturePath)) {
try {
$signatureImageData = base64_encode(file_get_contents($signaturePath));
$signatureMimeType = 'jpeg';
$doctorName = 'dr. Said. M. Bin. Smith. MAP';
$doctorPosition = 'Dokter Umum';
} catch (Exception $e) {
$signatureImageData = null;
}
}
}
if (!$isGeneralAccount && !$signatureImageData && $examinerUser && stripos($examinerUser->name, 'Zakia') !== false) {
$signaturePath = public_path('assets/images/ttd/dr.zakia.jpg');
if (file_exists($signaturePath)) {
try {
$signatureImageData = base64_encode(file_get_contents($signaturePath));
$signatureMimeType = 'jpeg';
$doctorName = 'dr. Zakia Alaydrus';
$doctorPosition = 'Dokter Umum';
} catch (Exception $e) {
$signatureImageData = null;
}
}
}
if (!$isGeneralAccount && !$signatureImageData) {
$signaturePath = public_path('assets/images/ttd/dr.said.jpg');
if (file_exists($signaturePath)) {
try {
$signatureImageData = base64_encode(file_get_contents($signaturePath));
$signatureMimeType = 'jpeg';
$doctorName = 'dr. Said. M. Bin. Smith. MAP';
$doctorPosition = 'Dokter Umum';
} catch (Exception $e) {
$signatureImageData = null;
}
}
}
@endphp
@if (isset($qr_image) && $qr_image)
@endif
{{ $doctorName }}
@elseif ($signatureImageData)