update import request log

This commit is contained in:
Linksehat Staging Server
2024-01-12 15:23:32 +07:00
parent 13699a3f03
commit 118aae8e6d

View File

@@ -40,7 +40,7 @@ class RequestLogService
]; ];
public $field_to_doc_headers_map = [ public $field_to_doc_headers_map = [
"submission_date" => "Date Of Request", "submission_date" => "Date Of Request",
"submission_date" => "Date Addmission", "submission_date" => "Date Addmission",
"member_id" => "Member ID Peserta", "member_id" => "Member ID Peserta",
@@ -56,7 +56,7 @@ class RequestLogService
"amount_not_approval" => "Amount Not Approval", "amount_not_approval" => "Amount Not Approval",
"status_final_log" => "QC 1" , "status_final_log" => "QC 1" ,
"ingestion_code" => "Ingestion Code", "ingestion_code" => "Ingestion Code",
"ingestion_status" => "Ingestion Status", "ingestion_status" => "Ingestion Status",
]; ];
public $result_doc_headers = [ public $result_doc_headers = [
@@ -73,7 +73,7 @@ class RequestLogService
"Total Billing", "Total Billing",
"Amount Approval", "Amount Approval",
"Amount Not Approval", "Amount Not Approval",
"QC 1", "QC 1",
"Ingestion Code", "Ingestion Code",
"Ingestion Status", "Ingestion Status",
]; ];
@@ -92,7 +92,7 @@ class RequestLogService
"Total Billing", "Total Billing",
"Amount Approval", "Amount Approval",
"Amount Not Approval", "Amount Not Approval",
"QC 1", "QC 1",
"Ingestion Code", "Ingestion Code",
"Ingestion Status", "Ingestion Status",
]; ];
@@ -153,13 +153,13 @@ class RequestLogService
$organization_id = DB::table('organizations') $organization_id = DB::table('organizations')
->insertGetId([ ->insertGetId([
'name' => $row['organization_id'], 'name' => $row['organization_id'],
'code' => $kodeOrganisasi, 'code' => $kodeOrganisasi,
'type' => 'hospital', 'type' => 'hospital',
'created_at' => now(), 'created_at' => now(),
'created_by' => auth()->user()->id 'created_by' => auth()->user()->id
]); ]);
} }
$data = [ $data = [
'source' => 'H', 'source' => 'H',
'provideCode' => $kodeOrganisasi , 'provideCode' => $kodeOrganisasi ,
@@ -177,8 +177,6 @@ class RequestLogService
$serviceCode = 'Unk'; $serviceCode = 'Unk';
} }
$benefit = Benefit::where('code', $row['benefit_id'])->first();
$requestLog = RequestLog::updateOrCreate( $requestLog = RequestLog::updateOrCreate(
[ [
'code' => $code 'code' => $code
@@ -190,7 +188,7 @@ class RequestLogService
'discharge_date' => $row['submission_date'], 'discharge_date' => $row['submission_date'],
'payment_type' => 'cashless', 'payment_type' => 'cashless',
'status' => $status, 'status' => $status,
'status_final_log' => $status, 'status_final_log' => $row['status_final_log'] == 'Y' ? 1 : 0,
'final_log' =>$row['status_final_log'] == 'Y' ? 1 : 0, 'final_log' =>$row['status_final_log'] == 'Y' ? 1 : 0,
'import_system' =>TRUE, 'import_system' =>TRUE,
'catatan' => $row['catatan'], 'catatan' => $row['catatan'],
@@ -200,20 +198,24 @@ class RequestLogService
'approved_final_log_at' => $row['approved_final_log_at'], 'approved_final_log_at' => $row['approved_final_log_at'],
]); ]);
$requestLogBenefit = RequestLogBenefit::updateOrCreate( $benefit = Benefit::where('code', $row['benefit_id'])->first();
[ if ($benefit) { // jika tidak ada benefit nya maka belum ngisi benefit nya
'request_log_id' => $requestLog->id, RequestLogBenefit::updateOrCreate(
], [
[ 'request_log_id' => $requestLog->id,
'request_log_id' => $requestLog->id, ],
'benefit_id' => $benefit->id, [
'amount_incurred' => $row['total_billing'], 'request_log_id' => $requestLog->id,
'amount_approved' => $row['amount_approval'], 'benefit_id' => $benefit->id,
'amount_not_approved' => $row['amount_not_approval'], 'amount_incurred' => $row['total_billing'],
'excess_paid' => $row['amount_not_approval'], 'amount_approved' => $row['amount_approval'],
'created_by' => auth()->user()->id, 'amount_not_approved' => $row['amount_not_approval'],
'excess_paid' => $row['amount_not_approval'],
'created_by' => auth()->user()->id,
]);
}
]);
// Commit transaksi // Commit transaksi
DB::commit(); DB::commit();
@@ -259,7 +261,7 @@ class RequestLogService
return $cells; return $cells;
} }
public function makeCode($next_number, $data) public function makeCode($next_number, $data)
{ {
$sparator = '.'; $sparator = '.';