Update import request log
This commit is contained in:
@@ -187,39 +187,66 @@ class RequestLogService
|
||||
$final_log = 1;
|
||||
}
|
||||
|
||||
if ($row['catatan']){
|
||||
$data = [
|
||||
'code' => $code,
|
||||
'member_id' => $member->id,
|
||||
'submission_date' => $row['submission_date'],
|
||||
'discharge_date' => $row['submission_date'],
|
||||
'payment_type' => 'cashless',
|
||||
'status' => $status,
|
||||
'status_final_log' => $statusFinalLog,
|
||||
'final_log' =>$final_log,
|
||||
'import_system' =>TRUE,
|
||||
// 'catatan' => $row['catatan'],
|
||||
'keterangan' => $row['keterangan'],
|
||||
'policy_id' => $member->currentPolicy->id ?? null,
|
||||
'organization_id' => $organization_id,
|
||||
'diagnosis' => $row['catatan'],
|
||||
'service_code' => $serviceCode,
|
||||
'approved_final_log_at' => $row['approved_final_log_at'],
|
||||
];
|
||||
} else {
|
||||
$data = [
|
||||
'code' => $code,
|
||||
'member_id' => $member->id,
|
||||
'submission_date' => $row['submission_date'],
|
||||
'discharge_date' => $row['submission_date'],
|
||||
'payment_type' => 'cashless',
|
||||
'status' => $status,
|
||||
'status_final_log' => $statusFinalLog,
|
||||
'final_log' =>$final_log,
|
||||
'import_system' =>TRUE,
|
||||
// 'catatan' => $row['catatan'],
|
||||
'keterangan' => $row['keterangan'],
|
||||
'policy_id' => $member->currentPolicy->id ?? null,
|
||||
'organization_id' => $organization_id,
|
||||
'service_code' => $serviceCode,
|
||||
'approved_final_log_at' => $row['approved_final_log_at'],
|
||||
];
|
||||
}
|
||||
|
||||
$requestLog = RequestLog::updateOrCreate(
|
||||
[
|
||||
'code' => $code
|
||||
],
|
||||
[
|
||||
'code' => $code,
|
||||
'member_id' => $member->id,
|
||||
'submission_date' => $row['submission_date'],
|
||||
'discharge_date' => $row['submission_date'],
|
||||
'payment_type' => 'cashless',
|
||||
'status' => $status,
|
||||
'status_final_log' => $statusFinalLog,
|
||||
'final_log' =>$final_log,
|
||||
'import_system' =>TRUE,
|
||||
'catatan' => $row['catatan'],
|
||||
'policy_id' => $member->currentPolicy->id ?? null,
|
||||
'organization_id' => $organization_id,
|
||||
'service_code' => $serviceCode,
|
||||
'approved_final_log_at' => $row['approved_final_log_at'],
|
||||
]);
|
||||
],
|
||||
$data);
|
||||
|
||||
|
||||
if ($benefit) { // jika tidak ada benefit nya maka belum ngisi benefit nya
|
||||
RequestLogBenefit::updateOrCreate(
|
||||
[
|
||||
'request_log_id' => $requestLog->id,
|
||||
],
|
||||
// Delete item
|
||||
if ($row['total_billing']){
|
||||
RequestLogBenefit::where('request_log_id', '=', $requestLog->id)->delete();
|
||||
}
|
||||
|
||||
// Insert Item
|
||||
RequestLogBenefit::create(
|
||||
[
|
||||
'request_log_id' => $requestLog->id,
|
||||
'benefit_id' => $benefit->id,
|
||||
'amount_incurred' => $row['total_billing'],
|
||||
'amount_incurred' => ($row['amount_not_approval'] ? $row['amount_not_approval'] : 0) + $row['amount_approval'] ,
|
||||
'amount_approved' => $row['amount_approval'],
|
||||
'amount_not_approved' => $row['amount_not_approval'],
|
||||
'amount_not_approved' => $row['amount_not_approval'] ?? 0,
|
||||
'excess_paid' => $row['amount_not_approval'],
|
||||
'created_by' => auth()->user()->id,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user