feat: add Indonesian log type mapping and color chips to report

This commit is contained in:
Iqbal
2026-05-11 15:01:44 +07:00
parent d96e439b2a
commit 80204a7abb
2 changed files with 46 additions and 24 deletions

View File

@@ -87,6 +87,7 @@ class PrimayanMedicareController extends Controller
'claim_requests.status',
'claim_requests.created_at as request_date',
'claim_requests.service_code',
'request_logs.log_type',
'claims.code as claim_code',
'request_logs.code as log_code',
DB::raw('COALESCE(log_amounts.total_incurred, claims.amount_incurred, 0) as amount_incurred'),
@@ -200,6 +201,7 @@ class PrimayanMedicareController extends Controller
'claim_requests.status',
'claim_requests.created_at as request_date',
'claim_requests.service_code',
'request_logs.log_type',
'claims.code as claim_code',
'request_logs.code as log_code',
DB::raw('COALESCE(log_amounts.total_incurred, claims.amount_incurred, 0) as amount_incurred'),
@@ -252,6 +254,7 @@ class PrimayanMedicareController extends Controller
'Plan',
'Benefit',
'Service',
'Tipe LOG',
'Provider',
'Request Date',
'Amount Incurred',
@@ -262,7 +265,7 @@ class PrimayanMedicareController extends Controller
];
$sheet->fromArray($headers, null, 'A1');
$sheet->getStyle('A1:Q1')->applyFromArray([
$sheet->getStyle('A1:R1')->applyFromArray([
'font' => [
'bold' => true,
],
@@ -273,9 +276,15 @@ class PrimayanMedicareController extends Controller
$rowIndex = 2;
$no = 1;
$logTypeMap = [
'reference' => 'Rujukan',
'prescription' => 'Resep',
'consultation' => 'Konsultasi',
];
foreach ($results as $item) {
$serviceCode = $item->service_code ?? '-';
$serviceName = $serviceCodeMap[$serviceCode] ?? $serviceCode;
$logTypeName = $logTypeMap[$item->log_type] ?? $item->log_type ?? '-';
$rowData = [
$no++,
@@ -289,13 +298,14 @@ class PrimayanMedicareController extends Controller
$item->gender ?? '-',
$item->plan_code ?? '-',
$item->benefit_name ?? $item->benefit_desc ?? '-',
$serviceName,
$item->service_code ?? '-',
$logTypeName,
$item->provider_name ?? '-',
$item->request_date ?? '-',
$item->amount_incurred ?? 0,
$item->amount_approved ?? 0,
$item->amount_not_approved ?? 0,
$item->excess_paid ?? 0,
(int)($item->amount_incurred ?? 0),
(int)($item->amount_approved ?? 0),
(int)($item->amount_not_approved ?? 0),
(int)($item->excess_paid ?? 0),
$item->status ?? '-',
];
@@ -303,7 +313,7 @@ class PrimayanMedicareController extends Controller
$rowIndex++;
}
foreach (range('A', 'Q') as $col) {
foreach (range('A', 'R') as $col) {
$sheet->getColumnDimension($col)->setAutoSize(true);
}

View File

@@ -41,6 +41,18 @@ const statusColors: Record<string, 'default' | 'primary' | 'secondary' | 'error'
declined: 'error',
};
const logTypeMap: Record<string, string> = {
reference: 'Rujukan',
prescription: 'Resep',
consultation: 'Konsultasi',
};
const logTypeColors: Record<string, 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'> = {
reference: 'secondary',
prescription: 'warning',
consultation: 'info',
};
export default function List() {
const [searchParams, setSearchParams] = useSearchParams();
const [providers, setProviders] = useState<any[]>([]);
@@ -266,18 +278,6 @@ export default function List() {
function Row(props: { row: any }) {
const { row } = props;
const serviceCodeMap: Record<string, string> = {
'OP': 'Outpatient',
'IP': 'Inpatient',
'DE': 'Dental',
'MA': 'Maternal',
'GL': 'Optical',
'MCU': 'Medical Check Up',
'MEDIVAC': 'Medical Emergency Evacuation',
};
const serviceName = serviceCodeMap[row.service_code] || row.service_code || '-';
return (
<TableRow>
<TableCell align="left">
@@ -287,7 +287,18 @@ export default function List() {
</TableCell>
<TableCell align="left">{row.member_name ?? '-'}</TableCell>
<TableCell align="left">{row.member_number ?? '-'}</TableCell>
<TableCell align="left">{serviceName}</TableCell>
<TableCell align="left">{row.service_code ?? '-'}</TableCell>
<TableCell align="left">
{row.log_type ? (
<Chip
label={logTypeMap[row.log_type] ?? row.log_type}
color={logTypeColors[row.log_type] ?? 'default'}
size="small"
/>
) : (
'-'
)}
</TableCell>
<TableCell align="left">{row.provider_name ?? '-'}</TableCell>
<TableCell align="left">{row.request_date ?? '-'}</TableCell>
<TableCell align="right">{fNumber(parseInt(row.amount_incurred ?? 0))}</TableCell>
@@ -362,6 +373,7 @@ export default function List() {
<TableCell style={headStyle} align="left">Nama Member</TableCell>
<TableCell style={headStyle} align="left">Member ID</TableCell>
<TableCell style={headStyle} align="left">Service</TableCell>
<TableCell style={headStyle} align="left">Tipe LOG</TableCell>
<TableCell style={headStyle} align="left">Provider</TableCell>
<TableCell style={headStyle} align="left">Tanggal Request</TableCell>
<TableCell style={headStyle} align="right">Amount Incurred</TableCell>
@@ -373,7 +385,7 @@ export default function List() {
{dataTableIsLoading ? (
<TableBody>
<TableRow>
<TableCell colSpan={10} align="center">
<TableCell colSpan={11} align="center">
Loading
</TableCell>
</TableRow>
@@ -381,7 +393,7 @@ export default function List() {
) : dataTableData.data.length === 0 ? (
<TableBody>
<TableRow>
<TableCell colSpan={10} align="center">
<TableCell colSpan={11} align="center">
No Data
</TableCell>
</TableRow>