@php $patient = $appointment->patient; // Get latest additional data $latestHealth = $patient->healthQuestionnaires()->latest()->first(); $latestWork = $patient->workActivities()->latest()->first(); $latestFamily = $patient->familyHealthHistories()->latest()->first(); $latestLifestyle = $patient->lifestyleData()->latest()->first(); // Get existing vital signs data for THIS appointment (not the latest one) $existingVitalSigns = $appointment->physicalExamResult; // Check if vital signs data is actually filled (not just exists) $hasVitalSignsData = false; if ($existingVitalSigns) { // Check if at least one vital sign field is filled with meaningful data $hasVitalSignsData = (!empty($existingVitalSigns->blood_pressure_systolic) && $existingVitalSigns->blood_pressure_systolic > 0) || (!empty($existingVitalSigns->blood_pressure_diastolic) && $existingVitalSigns->blood_pressure_diastolic > 0) || (!empty($existingVitalSigns->heart_rate) && $existingVitalSigns->heart_rate > 0) || (!empty($existingVitalSigns->respiratory_rate) && $existingVitalSigns->respiratory_rate > 0) || (!empty($existingVitalSigns->body_temperature) && $existingVitalSigns->body_temperature > 0) || (!empty($existingVitalSigns->height) && $existingVitalSigns->height > 0) || (!empty($existingVitalSigns->weight) && $existingVitalSigns->weight > 0) || (!empty($existingVitalSigns->waist_circumference) && $existingVitalSigns->waist_circumference > 0); } // Check if any additional data exists $hasAdditionalData = $latestHealth || $latestWork || $latestFamily || $latestLifestyle || $hasVitalSignsData || $patient->signature_path; @endphp @if ($hasAdditionalData)
Data Tambahan Pasien
@if ($patient->company || $patient->job_position || $patient->occupation || $latestWork)
Informasi Kerja
@if ($patient->company)
Perusahaan:
{{ $patient->company->name }}
@endif @if ($patient->job_position)
Jabatan:
{{ $patient->job_position }}
@endif @if ($latestWork)
Tahun Mulai Bekerja:
{{ $latestWork->work_start_year ?? '-' }}
@if ($latestWork->hobby)
Hobi:
{{ $latestWork->hobby }}
@endif @php $workActivities = [ 'operates_moving_equipment' => 'Sopir / mengoperasikan peralatan bergerak (mobil, crane, alat lainnya)', 'works_at_height' => 'Bekerja di ketinggian (tangga, Lift, eskalator)', 'works_in_office' => 'Bekerja di perkantoran', 'works_in_noisy_place' => 'Bekerja di tempat bising', 'works_in_dusty_place' => 'Bekerja di tempat berdebu', 'needs_color_accuracy' => 'Perlu keakuratan warna, kode lampu warna', 'is_catering_staff' => 'Staff Catering (seluruh personal yang mengelola makanan)', 'handles_dangerous_materials' => 'Berhubungan dengan bahan yang berpotensi membahayakan', ]; $activeActivities = []; foreach ($workActivities as $field => $label) { if ($latestWork->$field) { $activeActivities[] = $label; } } @endphp @if (count($activeActivities) > 0)
Aktivitas Kerja Khusus:
@foreach ($activeActivities as $activity) {{ $activity }} @endforeach
@endif @endif
Data Tersedia
@endif @if ($latestHealth)
Riwayat Kesehatan
@php $healthConditions = []; // Check all health conditions from the form if ($latestHealth->has_head_injury) { $healthConditions[] = 'Cedera Kepala'; } if ($latestHealth->has_seizure) { $healthConditions[] = 'Ayan'; } if ($latestHealth->has_vision_disorder) { $healthConditions[] = 'Gangguan Penglihatan'; } if ($latestHealth->has_hearing_disorder) { $healthConditions[] = 'Gangguan Pendengaran'; } if ($latestHealth->has_ear_nose_throat_problem) { $healthConditions[] = 'Masalah Pada Telinga, Hidung'; } if ($latestHealth->has_ear_problem_4weeks) { $healthConditions[] = 'Masalah Telinga > 4 Minggu'; } if ($latestHealth->has_womens_health_issue) { $healthConditions[] = 'Masalah Kewanitaan'; } if ($latestHealth->has_chronic_skin_problem) { $healthConditions[] = 'Penyakit Kulit Menahun'; } if ($latestHealth->has_chronic_diarrhea_issue) { $healthConditions[] = 'Diare Kronis'; } if ($latestHealth->has_appetite_loss_4weeks) { $healthConditions[] = 'Nafsu Makan Menurun > 4 mgg'; } if ($latestHealth->has_gastritis_ulcer) { $healthConditions[] = 'Gastritis / Radang Lambung'; } if ($latestHealth->has_yellow_fever_hepatitis) { $healthConditions[] = 'Sakit Kuning / Hepatitis'; } if ($latestHealth->has_chronic_cough_issue) { $healthConditions[] = 'Batuk Kronis'; } if ($latestHealth->has_hemorrhoids_issue) { $healthConditions[] = 'Ambeien / Hemoroid'; } if ($latestHealth->has_chronic_abdominal_pain) { $healthConditions[] = 'Nyeri Perut Kronis'; } if ($latestHealth->has_sexual_transmitted_disease) { $healthConditions[] = 'Penyakit Kelamin'; } if ($latestHealth->has_diabetes_mellitus) { $healthConditions[] = 'Kencing Manis / Diabetes'; } if ($latestHealth->has_asthma_shortness) { $healthConditions[] = 'Asma / Sesak Napas'; } if ($latestHealth->has_allergy_issue) { $healthConditions[] = 'Alergi'; } if ($latestHealth->has_tuberculosis) { $healthConditions[] = 'TB Paru'; } if ($latestHealth->has_mental_health_problem) { $healthConditions[] = 'Masalah Kejiwaan'; } if ($latestHealth->has_hypertension_issue) { $healthConditions[] = 'Tekanan Darah Tinggi'; } if ($latestHealth->has_heart_chest_pain) { $healthConditions[] = 'Nyeri Dada / Jantung'; } if ($latestHealth->has_malaria_disease) { $healthConditions[] = 'Malaria'; } if ($latestHealth->has_surgical_operation) { $healthConditions[] = 'Operasi Pembedahan'; } if ($latestHealth->has_abnormal_weight_change) { $healthConditions[] = 'Perubahan BB tdk normal'; } if ($latestHealth->has_back_pain_4weeks) { $healthConditions[] = 'Nyeri Pinggang > 4 mgg'; } if ($latestHealth->has_typhoid_fever) { $healthConditions[] = 'Demam Thyfoid'; } if ($latestHealth->has_joint_swelling_pain) { $healthConditions[] = 'Bengkak / Nyeri pd sendi'; } if ($latestHealth->has_kidney_stone_disease) { $healthConditions[] = 'Kencing Batu / Ginjal'; } @endphp @if (count($healthConditions) > 0)
Kondisi Kesehatan:
@foreach ($healthConditions as $condition) {{ $condition }} @endforeach
@else
Kondisi Kesehatan:
Tidak ada riwayat penyakit
@endif @if ($latestHealth->other_chronic_diseases)
Penyakit Lainnya:
{{ $latestHealth->other_chronic_diseases }}
@endif
Data Tersedia
@endif @if ($latestFamily)
Riwayat Keluarga
@php $familyConditions = []; $familyDetails = []; // Check for diabetes in family if ( $latestFamily->father_diabetes === 'Ya' || $latestFamily->mother_diabetes === 'Ya' || $latestFamily->siblings_diabetes === 'Ya' || $latestFamily->others_diabetes === 'Ya' ) { $familyConditions[] = 'Diabetes'; } // Check for hypertension in family if ( $latestFamily->father_hypertension === 'Ya' || $latestFamily->mother_hypertension === 'Ya' || $latestFamily->siblings_hypertension === 'Ya' || $latestFamily->others_hypertension === 'Ya' ) { $familyConditions[] = 'Hipertensi'; } // Check for other diseases in family if ( $latestFamily->father_other_diseases || $latestFamily->mother_other_diseases || $latestFamily->siblings_other_diseases || $latestFamily->others_other_diseases ) { $otherDiseases = []; if ($latestFamily->father_other_diseases) { $otherDiseases[] = 'Bapak: ' . $latestFamily->father_other_diseases; } if ($latestFamily->mother_other_diseases) { $otherDiseases[] = 'Ibu: ' . $latestFamily->mother_other_diseases; } if ($latestFamily->siblings_other_diseases) { $otherDiseases[] = 'Saudara: ' . $latestFamily->siblings_other_diseases; } if ($latestFamily->others_other_diseases) { $otherDiseases[] = 'Lain-lain: ' . $latestFamily->others_other_diseases; } if (!empty($otherDiseases)) { $familyConditions[] = 'Penyakit Lainnya'; $familyDetails['other_diseases'] = implode(', ', $otherDiseases); } } @endphp @if (count($familyConditions) > 0)
Riwayat Keluarga:
@foreach ($familyConditions as $condition) {{ $condition }} @endforeach
@if (isset($familyDetails['other_diseases']))
Detail Penyakit Lainnya:
{{ $familyDetails['other_diseases'] }}
@endif @else
Riwayat Keluarga:
Tidak ada riwayat penyakit keluarga
@endif
Data Tersedia
@endif @if ($latestLifestyle)
Gaya Hidup
Merokok:
@if ($latestLifestyle->is_smoker) Ya @if ($latestLifestyle->smoking_amount) ({{ $latestLifestyle->smoking_amount }}) @endif @else Tidak @endif
Konsumsi Alkohol:
@if ($latestLifestyle->consumes_alcohol) Ya @if ($latestLifestyle->alcohol_frequency) ({{ $latestLifestyle->alcohol_frequency }}) @endif @else Tidak @endif
@if ($latestLifestyle->medications_consumed)
Obat yang Dikonsumsi:
{{ $latestLifestyle->medications_consumed }}
@endif
Data Tersedia
@endif @if ($hasVitalSignsData)
Tanda Vital & Antropometri
@if ($existingVitalSigns->blood_pressure_systolic && $existingVitalSigns->blood_pressure_diastolic)
Tekanan Darah: @php $sys = (int) $existingVitalSigns->blood_pressure_systolic; $dia = (int) $existingVitalSigns->blood_pressure_diastolic; $bpCat = ''; $bpClass = ''; if ($sys >= 140 || $dia >= 90) { $bpCat = 'Hipertensi'; $bpClass = 'bg-danger'; } else { $bpCat = 'Normal'; $bpClass = 'bg-success'; } @endphp
{{ $existingVitalSigns->blood_pressure_systolic }}/{{ $existingVitalSigns->blood_pressure_diastolic }} mmHg @if ($bpCat) {{ $bpCat }} @endif
@endif @if ($existingVitalSigns->heart_rate)
Nadi: @php $hr = (int) $existingVitalSigns->heart_rate; $hrCat = ''; $hrClass = ''; if ($hr < 60) { $hrCat = 'Bradikardi'; $hrClass = 'bg-warning'; } elseif ($hr > 100) { $hrCat = 'Takikardi'; $hrClass = 'bg-danger'; } else { $hrCat = 'Normal'; $hrClass = 'bg-success'; } @endphp
{{ $existingVitalSigns->heart_rate }} x/m {{ $hrCat }}
@endif @if ($existingVitalSigns->respiratory_rate)
Respirasi: @php $rr = (int) $existingVitalSigns->respiratory_rate; $rrCat = ''; $rrClass = ''; if ($rr < 12) { $rrCat = 'Bradipnea'; $rrClass = 'bg-warning'; } elseif ($rr > 24) { $rrCat = 'Takipnea'; $rrClass = 'bg-danger'; } else { $rrCat = 'Normal'; $rrClass = 'bg-success'; } @endphp
{{ $existingVitalSigns->respiratory_rate }} x/m {{ $rrCat }}
@endif @if ($existingVitalSigns->body_temperature)
Suhu: @php $t = (float) $existingVitalSigns->body_temperature; $tCat = ''; $tClass = ''; if ($t > 42.0) { $tCat = 'Hipertermi'; $tClass = 'bg-danger'; } elseif ($t >= 40.0 && $t <= 42.0) { $tCat = 'Hiperpireksis'; $tClass = 'bg-danger'; } elseif ($t >= 38.0 && $t < 40.0) { $tCat = 'Febris'; $tClass = 'bg-warning'; } elseif ($t >= 37.0 && $t < 38.0) { $tCat = 'Sub Febris'; $tClass = 'bg-info'; } elseif ($t >= 36.6 && $t <= 37.2) { $tCat = 'Normal'; $tClass = 'bg-success'; } elseif ($t < 36.0) { $tCat = 'Hipotermi'; $tClass = 'bg-primary'; } else { $tCat = 'Normal'; $tClass = 'bg-success'; } @endphp
{{ number_format($existingVitalSigns->body_temperature, 1) }} °C @if ($tCat) {{ $tCat }} @endif
@endif @if ($existingVitalSigns->height && $existingVitalSigns->weight)
Tinggi/Berat:
{{ $existingVitalSigns->height }} cm / {{ $existingVitalSigns->weight }} kg
@endif @if ($existingVitalSigns->bmi)
IMT: @php $bmi = $existingVitalSigns->bmi; if ($bmi < 18.5) { $bmi_status = 'Underweight'; $bmi_class = 'bg-info'; } elseif ($bmi < 23) { $bmi_status = 'Normal'; $bmi_class = 'bg-success'; } elseif ($bmi < 25) { $bmi_status = 'Overweight'; $bmi_class = 'bg-warning'; } elseif ($bmi < 30) { $bmi_status = 'Obesitas I'; $bmi_class = 'bg-danger'; } else { $bmi_status = 'Obesitas II'; $bmi_class = 'bg-danger'; } @endphp
{{ $existingVitalSigns->bmi }} kg/m² {{ $bmi_status }}
@endif @if ($existingVitalSigns->waist_circumference)
Lingkar Perut: @php $waist = $existingVitalSigns->waist_circumference; $gender = $patient && $patient->gender ? $patient->gender : 'male'; if ($gender === 'male') { $waist_normal = $waist < 90; $waist_status = $waist_normal ? 'Normal' : 'Beresiko'; } else { $waist_normal = $waist < 80; $waist_status = $waist_normal ? 'Normal' : 'Beresiko'; } $waist_class = $waist_normal ? 'bg-success' : 'bg-warning'; @endphp
{{ $existingVitalSigns->waist_circumference }} cm {{ $waist_status }}
@endif
Data Tersedia
@endif @if ($patient->signature_path)
Tanda Tangan
Tanda tangan pasien
Tanda Tangan Tersimpan
@endif
@endif