@extends('layouts.app') @section('title', 'Diagnosis Report') @section('content')

Diagnosis Report

{{ $from->format('d M Y') }} | {{ $to->format('d M Y') }}

{{ $structuredCount ?? 0 }} consultations with ICD-10 codes @if(($legacyCount ?? 0) > 0) {{ $legacyCount }} legacy free-text @endif
@php $exportType = 'diagnosis'; @endphp @include('reports._date-filter') @if(($legacyCount ?? 0) > 0)
{{ $legacyCount }} consultation(s) in this period still use free-text diagnosis. Ask clinicians to use the ICD-10 picker going forward | free-text entries are not linkable to MOH reports or analytics.
@endif
@php $total = array_sum($diagCounts); $i = 1; @endphp @forelse($diagCounts as $diag => $count) @php $isIcd = str_starts_with($diag, '['); $pct = $total > 0 ? round($count / $total * 100, 1) : 0; @endphp @empty @endforelse @if($total > 0) @endif
# Diagnosis Count Share
{{ $i++ }} @if($isIcd) {{-- Structured ICD-10 entry --}} @php preg_match('/\[([A-Z]\d+[\w\.]*)\]\s+(.+)/', $diag, $m); $code = $m[1] ?? ''; $desc = $m[2] ?? $diag; @endphp
{{ $code }} {{ $desc }}
@else {{-- Legacy free-text --}}
free-text {{ $diag }}
@endif
{{ $count }}
{{ $pct }}%
No diagnoses recorded for this period.
Total {{ $total }}
@endsection