update import
This commit is contained in:
@@ -446,8 +446,9 @@ class ClaimRequestController extends Controller
|
|||||||
$result_headers = array_merge($result_headers, ['Ingest Code', 'Ingest Note']);
|
$result_headers = array_merge($result_headers, ['Ingest Code', 'Ingest Note']);
|
||||||
|
|
||||||
$import->addArrayToRow($result_headers);
|
$import->addArrayToRow($result_headers);
|
||||||
|
$imported_claim_data = 0;
|
||||||
|
$failed_claim_data = [];
|
||||||
|
|
||||||
$doc_headers_indexes = [];
|
$doc_headers_indexes = [];
|
||||||
foreach ($sheet->getRowIterator() as $index => $row) {
|
foreach ($sheet->getRowIterator() as $index => $row) {
|
||||||
if ($index == 1) { // First Row Must be Header
|
if ($index == 1) { // First Row Must be Header
|
||||||
@@ -477,15 +478,19 @@ class ClaimRequestController extends Controller
|
|||||||
$dateSubmission = Helper::dateParser($result_headers['date_submission']); // Format tanggal sesuai kebutuhan
|
$dateSubmission = Helper::dateParser($result_headers['date_submission']); // Format tanggal sesuai kebutuhan
|
||||||
// Mengubah nilai date_submission menjadi string tanggal
|
// Mengubah nilai date_submission menjadi string tanggal
|
||||||
$result_headers['date_submission'] = $dateSubmission;
|
$result_headers['date_submission'] = $dateSubmission;
|
||||||
|
// dd($result_headers);
|
||||||
$import->addArrayToRow($result_headers, $sheet->getName());
|
$import->addArrayToRow($result_headers, $sheet->getName());
|
||||||
|
$imported_claim_data++;
|
||||||
} catch (ImportRowException $e) {
|
} catch (ImportRowException $e) {
|
||||||
// Write Data Validation Error to File
|
// Write Data Validation Error to File
|
||||||
// $import->read($fileRead);
|
// $import->read($fileRead);
|
||||||
// $import->write($fileWrite, 'xsls');
|
// $import->write($fileWrite, 'xsls');
|
||||||
$import->addArrayToRow(array_merge($row_data, [
|
$new_claim_data = $import->addArrayToRow(array_merge($row_data, [
|
||||||
'Ingest Code' => $e->getCode(),
|
'Ingest Code' => $e->getCode(),
|
||||||
'Ingest Note' => $e->getMessage(),
|
'Ingest Note' => $e->getMessage(),
|
||||||
]), $sheet->getName());
|
]), $sheet->getName());
|
||||||
|
|
||||||
|
$failed_claim_data[] = ['row_number' => $index, 'error' => $e->getMessage(),'data' => $new_claim_data];
|
||||||
}
|
}
|
||||||
// catch (\Exception $e) {
|
// catch (\Exception $e) {
|
||||||
// // throw new \Exception($e);
|
// // throw new \Exception($e);
|
||||||
@@ -504,14 +509,14 @@ class ClaimRequestController extends Controller
|
|||||||
$import->reader->close();
|
$import->reader->close();
|
||||||
Storage::delete('temp/' . $file_name);
|
Storage::delete('temp/' . $file_name);
|
||||||
$import->writer->close();
|
$import->writer->close();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// 'total_successed_row' => $imported_plan_data,
|
|
||||||
// 'total_failed_row' => count($failed_plan_data),
|
|
||||||
// 'failed_row' => $failed_plan_data,
|
|
||||||
'result_file' => [
|
'result_file' => [
|
||||||
'url' => Storage::disk('public')->url('temp/result-' . $file_name),
|
'url' => Storage::disk('public')->url('temp/result-' . $file_name),
|
||||||
'name' => 'result-' . $file_name,
|
'name' => 'result-' . $file_name,
|
||||||
|
'total_successed_row' => $imported_claim_data,
|
||||||
|
'total_failed_row' => count($failed_claim_data),
|
||||||
|
'failed_row' => $failed_claim_data,
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,23 +52,27 @@ class ClaimRequestService{
|
|||||||
$statusClaim = null;
|
$statusClaim = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$claimRequestData = [
|
if($row['total_billing']) {
|
||||||
'code' => $code,
|
$data = [
|
||||||
'request_log_id' => $requestLogID ?? 0,
|
'code' => $code,
|
||||||
'member_id' => $member->id,
|
'request_log_id' => $requestLogID ?? 0,
|
||||||
'submission_date' => $submissionDate ?? now(),
|
'member_id' => $member->id,
|
||||||
'status' => $status,
|
'submission_date' => $submissionDate ?? now(),
|
||||||
'claim_management' => $claimManagement,
|
'status' => $status,
|
||||||
'status_claim_management' => $statusClaim,
|
'claim_management' => $claimManagement,
|
||||||
'submission_date_claim_management' => $submissionDateClaimManagement,
|
'status_claim_management' => $statusClaim,
|
||||||
'submission_by_claim_management' => $submissionByClaimManagement,
|
'submission_date_claim_management' => $submissionDateClaimManagement,
|
||||||
'payment_type' => $paymentType,
|
'submission_by_claim_management' => $submissionByClaimManagement,
|
||||||
'service_code' => $serviceCode,
|
'payment_type' => $paymentType,
|
||||||
'policy_id' => $member->currentPolicy->id ?? null,
|
'service_code' => $serviceCode,
|
||||||
'organization_id' => $organization ? $organization->id : 0,
|
'policy_id' => $member->currentPolicy->id ?? null,
|
||||||
];
|
'organization_id' => $organization ? $organization->id : 0,
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$data = [];
|
||||||
|
}
|
||||||
|
$claimRequest = ClaimRequest::updateOrCreate(['request_log_id' => $requestLogID],$data);
|
||||||
|
|
||||||
$claimRequest = ClaimRequest::updateOrCreate(['request_log_id' => $requestLogID],$claimRequestData);
|
|
||||||
if (count($row)>0){
|
if (count($row)>0){
|
||||||
$benefitData = Benefit::where('code', $row['benefit_code'])->first();
|
$benefitData = Benefit::where('code', $row['benefit_code'])->first();
|
||||||
$requestLogData = RequestLogBenefit::updateOrCreate(
|
$requestLogData = RequestLogBenefit::updateOrCreate(
|
||||||
@@ -194,9 +198,6 @@ class ClaimRequestService{
|
|||||||
$date = date('ymd');
|
$date = date('ymd');
|
||||||
// Menghasilkan kode dengan format yang diinginkan
|
// Menghasilkan kode dengan format yang diinginkan
|
||||||
$code = 'CLAIM' . $sparator. 'I' . $sparator. $organization->code . $sparator. $date. $sparator . $member->currentPolicy->code . $sparator. $member->member_id . $sparator. str_pad($next_number, 5, '0', STR_PAD_LEFT);
|
$code = 'CLAIM' . $sparator. 'I' . $sparator. $organization->code . $sparator. $date. $sparator . $member->currentPolicy->code . $sparator. $member->member_id . $sparator. str_pad($next_number, 5, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
// $code = $row['client_claim_id'];
|
|
||||||
// dd($row['date_submission']);
|
|
||||||
$submissionDate = Helper::dateParser($row['date_submission']);
|
$submissionDate = Helper::dateParser($row['date_submission']);
|
||||||
$paymentType = $requestLog->payment_type;
|
$paymentType = $requestLog->payment_type;
|
||||||
if ($row['qc'] == 'Y'){
|
if ($row['qc'] == 'Y'){
|
||||||
@@ -205,7 +206,6 @@ class ClaimRequestService{
|
|||||||
$status = 'requested';
|
$status = 'requested';
|
||||||
}
|
}
|
||||||
$serviceCode = $requestLog->service_code;
|
$serviceCode = $requestLog->service_code;
|
||||||
|
|
||||||
$newClaimRequest = $this->storeClaimRequest(
|
$newClaimRequest = $this->storeClaimRequest(
|
||||||
row: $row,
|
row: $row,
|
||||||
code: $code,
|
code: $code,
|
||||||
@@ -218,15 +218,6 @@ class ClaimRequestService{
|
|||||||
organization_code: $organization->code
|
organization_code: $organization->code
|
||||||
);
|
);
|
||||||
$newlyCreatedID = $newClaimRequest->id;
|
$newlyCreatedID = $newClaimRequest->id;
|
||||||
// $newClaimManangement = $this->storeClaimManagement($row, $member, $newlyCreatedID);
|
|
||||||
// ClaimRequested::dispatch($newClaimRequest);
|
|
||||||
// // Log History
|
|
||||||
// $newClaimRequest->histories()->create([
|
|
||||||
// 'title' => 'New Claim Requested',
|
|
||||||
// 'description' => "Claim Requested for Member : {$member->member_id} - ({$member->full_name})",
|
|
||||||
// 'type' => 'info',
|
|
||||||
// 'system_origin' => 'import-internal-aso'
|
|
||||||
// ]);
|
|
||||||
return $newClaimRequest;
|
return $newClaimRequest;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
|
|||||||
@@ -366,14 +366,32 @@ export default function List() {
|
|||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
{importResult && (
|
{importResult && (
|
||||||
|
// <Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
||||||
|
// <Box sx={{ color: 'text.secondary' }}>
|
||||||
|
// Last Import Result Report :{' '}
|
||||||
|
// <a href={importResult.result_file?.url ?? '#'}>
|
||||||
|
// {importResult.result_file?.name ?? '-'}
|
||||||
|
// </a>
|
||||||
|
// </Box>
|
||||||
|
// </Stack>
|
||||||
|
|
||||||
<Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
<Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
||||||
<Box sx={{ color: 'text.secondary' }}>
|
<Box sx={{ color: 'text.secondary' }}>
|
||||||
Last Import Result Report :{' '}
|
Last Import Result :{' '}
|
||||||
|
<Box sx={{ color: 'success.main', display: 'inline' }}>
|
||||||
|
{importResult.result_file?.total_success_row ?? 0}
|
||||||
|
</Box>{' '}
|
||||||
|
Row Processed,{' '}
|
||||||
|
<Box sx={{ color: 'error.main', display: 'inline' }}>
|
||||||
|
{importResult.result_file?.total_failed_row}
|
||||||
|
</Box>{' '}
|
||||||
|
Failed, Report :{' '}
|
||||||
<a href={importResult.result_file?.url ?? '#'}>
|
<a href={importResult.result_file?.url ?? '#'}>
|
||||||
{importResult.result_file?.name ?? '-'}
|
{importResult.result_file?.name ?? '-'}
|
||||||
</a>
|
</a>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user