feat: add Indonesian log type mapping and color chips to report
This commit is contained in:
@@ -87,6 +87,7 @@ class PrimayanMedicareController extends Controller
|
|||||||
'claim_requests.status',
|
'claim_requests.status',
|
||||||
'claim_requests.created_at as request_date',
|
'claim_requests.created_at as request_date',
|
||||||
'claim_requests.service_code',
|
'claim_requests.service_code',
|
||||||
|
'request_logs.log_type',
|
||||||
'claims.code as claim_code',
|
'claims.code as claim_code',
|
||||||
'request_logs.code as log_code',
|
'request_logs.code as log_code',
|
||||||
DB::raw('COALESCE(log_amounts.total_incurred, claims.amount_incurred, 0) as amount_incurred'),
|
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.status',
|
||||||
'claim_requests.created_at as request_date',
|
'claim_requests.created_at as request_date',
|
||||||
'claim_requests.service_code',
|
'claim_requests.service_code',
|
||||||
|
'request_logs.log_type',
|
||||||
'claims.code as claim_code',
|
'claims.code as claim_code',
|
||||||
'request_logs.code as log_code',
|
'request_logs.code as log_code',
|
||||||
DB::raw('COALESCE(log_amounts.total_incurred, claims.amount_incurred, 0) as amount_incurred'),
|
DB::raw('COALESCE(log_amounts.total_incurred, claims.amount_incurred, 0) as amount_incurred'),
|
||||||
@@ -252,6 +254,7 @@ class PrimayanMedicareController extends Controller
|
|||||||
'Plan',
|
'Plan',
|
||||||
'Benefit',
|
'Benefit',
|
||||||
'Service',
|
'Service',
|
||||||
|
'Tipe LOG',
|
||||||
'Provider',
|
'Provider',
|
||||||
'Request Date',
|
'Request Date',
|
||||||
'Amount Incurred',
|
'Amount Incurred',
|
||||||
@@ -262,7 +265,7 @@ class PrimayanMedicareController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
$sheet->fromArray($headers, null, 'A1');
|
$sheet->fromArray($headers, null, 'A1');
|
||||||
$sheet->getStyle('A1:Q1')->applyFromArray([
|
$sheet->getStyle('A1:R1')->applyFromArray([
|
||||||
'font' => [
|
'font' => [
|
||||||
'bold' => true,
|
'bold' => true,
|
||||||
],
|
],
|
||||||
@@ -273,9 +276,15 @@ class PrimayanMedicareController extends Controller
|
|||||||
|
|
||||||
$rowIndex = 2;
|
$rowIndex = 2;
|
||||||
$no = 1;
|
$no = 1;
|
||||||
|
|
||||||
|
$logTypeMap = [
|
||||||
|
'reference' => 'Rujukan',
|
||||||
|
'prescription' => 'Resep',
|
||||||
|
'consultation' => 'Konsultasi',
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($results as $item) {
|
foreach ($results as $item) {
|
||||||
$serviceCode = $item->service_code ?? '-';
|
$logTypeName = $logTypeMap[$item->log_type] ?? $item->log_type ?? '-';
|
||||||
$serviceName = $serviceCodeMap[$serviceCode] ?? $serviceCode;
|
|
||||||
|
|
||||||
$rowData = [
|
$rowData = [
|
||||||
$no++,
|
$no++,
|
||||||
@@ -289,13 +298,14 @@ class PrimayanMedicareController extends Controller
|
|||||||
$item->gender ?? '-',
|
$item->gender ?? '-',
|
||||||
$item->plan_code ?? '-',
|
$item->plan_code ?? '-',
|
||||||
$item->benefit_name ?? $item->benefit_desc ?? '-',
|
$item->benefit_name ?? $item->benefit_desc ?? '-',
|
||||||
$serviceName,
|
$item->service_code ?? '-',
|
||||||
|
$logTypeName,
|
||||||
$item->provider_name ?? '-',
|
$item->provider_name ?? '-',
|
||||||
$item->request_date ?? '-',
|
$item->request_date ?? '-',
|
||||||
$item->amount_incurred ?? 0,
|
(int)($item->amount_incurred ?? 0),
|
||||||
$item->amount_approved ?? 0,
|
(int)($item->amount_approved ?? 0),
|
||||||
$item->amount_not_approved ?? 0,
|
(int)($item->amount_not_approved ?? 0),
|
||||||
$item->excess_paid ?? 0,
|
(int)($item->excess_paid ?? 0),
|
||||||
$item->status ?? '-',
|
$item->status ?? '-',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -303,7 +313,7 @@ class PrimayanMedicareController extends Controller
|
|||||||
$rowIndex++;
|
$rowIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (range('A', 'Q') as $col) {
|
foreach (range('A', 'R') as $col) {
|
||||||
$sheet->getColumnDimension($col)->setAutoSize(true);
|
$sheet->getColumnDimension($col)->setAutoSize(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,18 @@ const statusColors: Record<string, 'default' | 'primary' | 'secondary' | 'error'
|
|||||||
declined: '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() {
|
export default function List() {
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const [providers, setProviders] = useState<any[]>([]);
|
const [providers, setProviders] = useState<any[]>([]);
|
||||||
@@ -266,18 +278,6 @@ export default function List() {
|
|||||||
function Row(props: { row: any }) {
|
function Row(props: { row: any }) {
|
||||||
const { row } = props;
|
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 (
|
return (
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell align="left">
|
<TableCell align="left">
|
||||||
@@ -287,7 +287,18 @@ export default function List() {
|
|||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="left">{row.member_name ?? '-'}</TableCell>
|
<TableCell align="left">{row.member_name ?? '-'}</TableCell>
|
||||||
<TableCell align="left">{row.member_number ?? '-'}</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.provider_name ?? '-'}</TableCell>
|
||||||
<TableCell align="left">{row.request_date ?? '-'}</TableCell>
|
<TableCell align="left">{row.request_date ?? '-'}</TableCell>
|
||||||
<TableCell align="right">{fNumber(parseInt(row.amount_incurred ?? 0))}</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">Nama Member</TableCell>
|
||||||
<TableCell style={headStyle} align="left">Member ID</TableCell>
|
<TableCell style={headStyle} align="left">Member ID</TableCell>
|
||||||
<TableCell style={headStyle} align="left">Service</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">Provider</TableCell>
|
||||||
<TableCell style={headStyle} align="left">Tanggal Request</TableCell>
|
<TableCell style={headStyle} align="left">Tanggal Request</TableCell>
|
||||||
<TableCell style={headStyle} align="right">Amount Incurred</TableCell>
|
<TableCell style={headStyle} align="right">Amount Incurred</TableCell>
|
||||||
@@ -373,7 +385,7 @@ export default function List() {
|
|||||||
{dataTableIsLoading ? (
|
{dataTableIsLoading ? (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={10} align="center">
|
<TableCell colSpan={11} align="center">
|
||||||
Loading
|
Loading
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
@@ -381,7 +393,7 @@ export default function List() {
|
|||||||
) : dataTableData.data.length === 0 ? (
|
) : dataTableData.data.length === 0 ? (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={10} align="center">
|
<TableCell colSpan={11} align="center">
|
||||||
No Data
|
No Data
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|||||||
Reference in New Issue
Block a user