@extends('layouts.app') @push('styles') @endpush @section('content')

MAM_NAP · ART Care

@php $hasPtConfig = $hasPtConfig ?? false; $isExisting = $hasPtConfig; $patientInfo = $data ?? []; $napId = $napId ?? ($patientInfo['NAP_ID'] ?? null); $formatDisplayDate = function ($value) { if (blank($value)) { return ''; } try { if ($value instanceof \Carbon\CarbonInterface) { return $value->format('d-m-Y'); } return \Illuminate\Support\Carbon::parse($value)->format('d-m-Y'); } catch (\Throwable $e) { return is_string($value) ? $value : ''; } }; $parseDisplayDate = function ($value) { if (blank($value)) { return null; } if ($value instanceof \Carbon\CarbonInterface) { return $value; } $raw = trim((string) $value); try { if (preg_match('/^\d{1,2}[\/-]\d{1,2}[\/-]\d{4}$/', $raw)) { $normalized = str_replace('/', '-', $raw); return \Illuminate\Support\Carbon::createFromFormat('d-m-Y', $normalized); } return \Illuminate\Support\Carbon::parse($raw); } catch (\Throwable $e) { return null; } }; $patientDob = $formatDisplayDate($patientInfo['Date Of Birth'] ?? ($patientInfo['Date of Birth'] ?? ($patientInfo['Date_of_Birth'] ?? ($patientInfo['Dob'] ?? null)))); $autoAddressParts = array_filter([ $patientInfo['Quarter'] ?? null, $patientInfo['Township'] ?? null, $patientInfo['Region'] ?? null, ]); $autoAddress = implode(', ', $autoAddressParts); $regDate = $formatDisplayDate($patientInfo['Reg Date'] ?? null); $visits = $visits ?? collect(); $visitTotal = method_exists($visits, 'total') ? $visits->total() : $visits->count(); $visitPageCount = $visits->count(); $visitHasPages = method_exists($visits, 'hasPages') ? $visits->hasPages() : false; $v = $lastVisit; $vl = $latestViralLoadVisit ?? null; $patientAge = old('age', $patientInfo['Agey'] ?? $patientInfo['Age'] ?? $patientInfo['age'] ?? optional($lastVisit)->age); $patientAgeMonths = old('age_months', $patientInfo['Agem'] ?? null); if (!$patientAge && $patientDob) { try { $dobCarbon = $parseDisplayDate($patientDob); if ($dobCarbon === null) { throw new \RuntimeException('Invalid DOB'); } $patientAge = $dobCarbon->age; $patientAgeMonths = $dobCarbon->diffInMonths(now()) % 12; } catch (\Throwable $e) { $patientAge = null; } } elseif ($patientAge && !$patientAgeMonths && $patientDob) { try { $dobCarbon = $parseDisplayDate($patientDob); if ($dobCarbon === null) { throw new \RuntimeException('Invalid DOB'); } $patientAgeMonths = $dobCarbon->diffInMonths(now()) % 12; } catch (\Throwable $e) { $patientAgeMonths = null; } } $clinicOptions = $clinicOptions ?? []; $selectedClinicId = $selectedClinicId ?? ($patientInfo['Clinic_ID'] ?? null); @endphp
Use this Inner ID when correcting PID, NAP ID, or Fuchia ID.
Pending Queue
Loading pending queue…
@if(session('success'))
{{ session('success') }}
@endif @if(session('info_new_patient'))
{{ session('info_new_patient') }}
@endif @if(session('info'))
{{ session('info') }}
@endif @if($errors->any() && !session('suppress_errors'))
Invalid data, please check fields:
    @foreach($errors->all() as $message)
  • {{ $message }}
  • @endforeach
@endif
@if(session('highlight_pid')) @endif @if(session('highlight_inner_id')) @endif @php $duplicateMatches = session('duplicate_matches', []); $duplicateIdentifier = session('duplicate_identifier'); $hasDuplicateMatches = !empty($duplicateMatches); @endphp
@foreach($duplicateMatches as $match) @php $clinicName = $clinicOptions[$match['clinic_id'] ?? ''] ?? ($match['clinic_id'] ?? '—'); @endphp @endforeach
Inner ID NAP ID PID Fuchia ID Name Clinic Action
{{ $match['id'] ?? '—' }} {{ $match['nap_id'] ?? '—' }} {{ $match['pid'] ?? '—' }} {{ $match['fuchia_id'] ?? '—' }} {{ $match['name'] ?? '—' }} {{ $clinicName }} Load
@csrf {{-- hidden base ids --}}
{{-- TAB 1 --}}
Patient Demographics
@if($pid && !$hasPtConfig && ($patientInfo['DB_Location'] ?? null))
This patient was loaded from another database. Click Save Patient to store the demographics in MAM_NAP · PtConfigs before recording visits.
@endif
@error('patient_name')
{{ $message }}
@enderror
@error('pid')
{{ $message }}
@enderror
@error('nap_id')
{{ $message }}
@enderror
@error('clinic_id')
{{ $message }}
@enderror
@php $oldFuchia = old('fuchia_id'); $fuchiaValue = ($oldFuchia !== null && $oldFuchia !== '') ? $oldFuchia : ($patientInfo['FuchiaID'] ?? ($patientInfo['fuchia_id'] ?? '')); @endphp @error('fuchia_id')
{{ $message }}
@enderror
date
@error('reg_date')
{{ $message }}
@enderror
@error('age')
{{ $message }}
@enderror
@error('age_months')
{{ $message }}
@enderror
date
@error('patient_dob')
{{ $message }}
@enderror
@php $oldGender = old('patient_gender'); $selectedGender = ($oldGender !== null && $oldGender !== '') ? trim($oldGender) : trim($patientInfo['Gender'] ?? ''); $selectedCompare = strtolower($selectedGender); $selectedReason = old('reason_of_ref', optional($v)->reason_of_ref); @endphp @error('patient_gender')
{{ $message }}
@enderror
@php $receptionTownships = [ 'Insein','MingalarDon','Hmawbi','Hlegu','Taikkyi','Htantabin','Shwepyithar','Hlaingtharya', 'Thingangyun','Yankin','South Okkalapa','North Okkalapa','Thaketa','Dawbon','Tamwe','Pazundaung', 'Botahtaung','Dagon Myothit (South)','Dagon Myothit (North)','Dagon Myothit (East)', 'Dagon Myothit (Seikkan)','Mingalartaungnyunt','Thanlyin','Kyauktan','Thongwa','Kayan','Twantay', 'Kawhmu','Kungyangon','Dala','Seikgyikanaungto','Cocokyun','Kyauktada','Pabedan','Lanmadaw', 'Latha','Ahlone','Kyeemyindaing','Sanchaung','Hlaing','Kamaryut','Mayangone','Dagon','Bahan','Seikkan' ]; $selectedTownship = trim(old('patient_township', $patientInfo['Township'] ?? '')); @endphp @php if ($selectedTownship && !in_array($selectedTownship, $receptionTownships, true)) { array_unshift($receptionTownships, $selectedTownship); } @endphp @error('patient_township')
{{ $message }}
@enderror @error('patient_gender')
{{ $message }}
@enderror @error('patient_township')
{{ $message }}
@enderror
@php $mainRiskOptions = ['HS','MSM','SW','IDU','Blood Transfusion','Mother to child','Unknown']; $selectedRisk = old('patient_main_risk'); if ($selectedRisk === null || $selectedRisk === '') { $selectedRisk = trim($patientInfo['Main Risk'] ?? ''); } $selectedRisk = trim((string)$selectedRisk); @endphp @error('patient_main_risk')
{{ $message }}
@enderror
date
date
date
date
@php $selectedStatus = old('patient_status', optional($v)->patient_status); @endphp
art_regime_changed) ? 'checked' : '' }} >
{{-- row --}}
{{-- Hidden backup: merged into Visit & Patient UI --}} {{-- Hidden backup: merged into Visit & Patient UI --}} {{-- TAB 4 --}}
Follow-up history
Select a visit to edit or delete.
{{ $visitTotal }} visits
@if(($pid || $napId) && $visitTotal)
@forelse($visits as $visit) @php $visitPayload = [ 'visit_id' => $visit->visit_id, 'visit_date' => $formatDisplayDate($visit->visit_date), 'age' => $visit->age, 'sex' => $visit->sex, 'main_risk' => $visit->main_risk, 'art_started_date' => $formatDisplayDate($visit->art_started_date), 'art_regime' => $visit->art_regime, 'art_regime_changed' => (bool) $visit->art_regime_changed, 'patient_status' => $visit->patient_status, 'fp_service' => (bool)$visit->fp_service, 'fp_condom' => (bool)$visit->fp_condom, 'fp_oc_pills' => (bool)$visit->fp_oc_pills, 'fp_depo' => (bool)$visit->fp_depo, 'prevention_commodities_provided' => (bool)$visit->prevention_commodities_provided, 'prevention_condom' => (bool)$visit->prevention_condom, 'prevention_ns' => (bool)$visit->prevention_ns, 'sti_patient_type' => $visit->sti_patient_type, 'sti_visit_type' => $visit->sti_visit_type, 'sti_complaint' => $visit->sti_complaint, 'sti_syphilis_rdt_result' => $visit->sti_syphilis_rdt_result, 'sti_syphilis_rpr_result' => $visit->sti_syphilis_rpr_result, 'sti_syphilis_rpr_qual' => $visit->sti_syphilis_rpr_qual, 'sti_presumptive_gc_ct_rx' => $visit->sti_presumptive_gc_ct_rx, 'sti_syphilis_rx' => $visit->sti_syphilis_rx, 'sti_service' => (bool)$visit->sti_service, 'counseling_service' => (bool)$visit->counseling_service, 'hepc_tx' => (bool)$visit->hepc_tx, 'oi_tb' => (bool)$visit->oi_tb, 'oi_mac' => (bool)$visit->oi_mac, 'oi_crypto' => (bool)$visit->oi_crypto, 'oi_cmv' => (bool)$visit->oi_cmv, 'oi_pcp' => (bool)$visit->oi_pcp, 'oi_toxo' => (bool)$visit->oi_toxo, 'oi_penic' => (bool)$visit->oi_penic, 'oi_pml' => (bool)$visit->oi_pml, 'oi_other' => (bool)$visit->oi_other, 'oi_other_specify' => $visit->oi_other_specify, 'next_appointment_date' => $formatDisplayDate($visit->next_appointment_date), 'refer_to_mam' => (bool)$visit->refer_to_mam, 'reason_of_ref' => $visit->reason_of_ref, 'transfer_out_center' => $visit->transfer_out_center, 'vl_test_date' => $formatDisplayDate($visit->vl_test_date), 'vl_copies_ml' => $visit->vl_copies_ml, 'vl_result' => $visit->vl_result, 'remarks' => $visit->remarks, ]; @endphp @empty @endforelse
Visit Date Next Appointment Date Visit ID ART Regime VL Result Actions
{{ $formatDisplayDate($visit->visit_date) }} {{ $formatDisplayDate($visit->next_appointment_date) ?: '—' }} {{ $visit->visit_id }} {{ $visit->art_regime ?? '—' }} {{ $visit->vl_copies_ml ?: ($visit->vl_result ?? '—') }}
No visits on this page.
@if($visitHasPages)
{{ $visits->links() }}
@endif @else
No visits recorded yet.
@endif
{{-- TAB 5 --}}
Export Follow-up data
@php $exportType = old('export_type', 'followup'); @endphp
date
date
NAP ID Fuchia ID General ID Appointment Date Status Unplan Visited Unplan Visited Date
Missed List: Chosen dates အတွင်းရှိ appointments များထံမှ appointment day နေ့တွင် visit မလာသည့် လူနာများကို ပြသပါသည်။ လူနာသည် appointment day မဟုတ်ပဲ different day တစ်နေ့မှာ လာခဲ့ပါက Unplan column တွင် TRUE ဟုပြပြီး၊ visit date ကိုလည်း ပြပေးပါသည်။
Appointment List: Chosen dates အတွင်းရှိ appointments များအားလုံးကို grid format ဖြင့် ပြသထားပါသည်။ Appointment day မဟုတ်ဘဲ ±7 days အတွင်း closest visit တစ်ခုရှိပါက ထို visit date ကို Unplan columns တွင် ပြသပေးပါသည်။
{{-- TAB 6 --}}
Import legacy Excel data
Upload Microsoft Excel files exported from legacy tools.
Patient (PtConfig) Import
Download template

Columns supported: Clinic_ID, Inner ID, Pid, NAP_ID, Fuchia_ID, Name, Gender, Date_of_Birth, Phone, Township, Address, Main_Risk, Notes, Reg_Date.

Follow-up Visits Import
Download template

Accepts exports generated from this page. Ensure PID and Visit Date columns are filled.

{{-- tab-content --}}
@csrf
@csrf
@csrf
@foreach($visits as $visit)
@csrf
@endforeach @endsection @push('scripts') @endpush