Merge remote-tracking branch 'origin/staging' into origin/production
This commit is contained in:
@@ -34,6 +34,7 @@ class RequestLogService
|
||||
"Total Billing" => "total_billing",
|
||||
"Amount Approval" => "amount_approval",
|
||||
"Amount Not Approval" => "amount_not_approval",
|
||||
"Final Billing" => "final_billing",
|
||||
"QC 1" => "status_final_log",
|
||||
"Ingestion Code" => "ingestion_code", // TODO I think this should not be here because if user uploading result then ingestion code and status will be filled
|
||||
"Ingestion Status" => "ingestion_status",
|
||||
@@ -54,6 +55,7 @@ class RequestLogService
|
||||
"total_billing" => "Total Billing",
|
||||
"amount_approval" => "Amount Approval",
|
||||
"amount_not_approval" => "Amount Not Approval",
|
||||
"final_billing" => "Final Billing",
|
||||
"status_final_log" => "QC 1" ,
|
||||
"ingestion_code" => "Ingestion Code",
|
||||
"ingestion_status" => "Ingestion Status",
|
||||
@@ -73,6 +75,7 @@ class RequestLogService
|
||||
"Total Billing",
|
||||
"Amount Approval",
|
||||
"Amount Not Approval",
|
||||
"Final Billing",
|
||||
"QC 1",
|
||||
"Ingestion Code",
|
||||
"Ingestion Status",
|
||||
@@ -92,6 +95,7 @@ class RequestLogService
|
||||
"Total Billing",
|
||||
"Amount Approval",
|
||||
"Amount Not Approval",
|
||||
"Final Billing",
|
||||
"QC 1",
|
||||
"Ingestion Code",
|
||||
"Ingestion Status",
|
||||
@@ -102,7 +106,11 @@ class RequestLogService
|
||||
if ($date_from_row instanceof DateTime) {
|
||||
return $date_from_row->format('Y-m-d');
|
||||
} else if ($date_from_row != null) {
|
||||
return date('Y-m-d', strtotime($date_from_row));
|
||||
if (strtotime($date_from_row)){
|
||||
return date('Y-m-d', strtotime($date_from_row));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -134,6 +142,12 @@ class RequestLogService
|
||||
'member_id' => $row['member_id'],
|
||||
]), 0, null, $row);
|
||||
}
|
||||
|
||||
$dateSubmission = $this->dateParser($row['submission_date']);
|
||||
if (!$dateSubmission){
|
||||
throw new ImportRowException(__('Format Date Invalid'), 0, null, $row);
|
||||
}
|
||||
|
||||
// Membuat singkatan dari nama rumah sakit
|
||||
$singkatan = "";
|
||||
$words = explode(' ', $row['organization_id']);
|
||||
@@ -169,7 +183,14 @@ class RequestLogService
|
||||
];
|
||||
|
||||
$code = $this->makeCode($row['code'], $data);
|
||||
$status = $row['status_final_log'] == 'Y' ? 'approved' : 'requested';
|
||||
if ($row['status_final_log'] == 'Y'){
|
||||
$status = 'approved';
|
||||
} else if ($row['status_final_log'] == 'C'){
|
||||
$status = 'canceled';
|
||||
} else {
|
||||
$status = 'requested';
|
||||
}
|
||||
|
||||
$service = Service::where('name', $row['service'])->first();
|
||||
if ($service){
|
||||
$serviceCode = $service->code;
|
||||
@@ -187,40 +208,67 @@ 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['final_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_approved' => $row['amount_approval'],
|
||||
'amount_not_approved' => $row['amount_not_approval'],
|
||||
'excess_paid' => $row['amount_not_approval'],
|
||||
'amount_incurred' => ($row['amount_approval'] ? $row['amount_approval'] : 0) + ($row['amount_not_approval'] ? $row['amount_not_approval'] : 0) ,
|
||||
'amount_approved' => $row['amount_approval'] ?? 0,
|
||||
'amount_not_approved' => $row['amount_not_approval'] ?? 0,
|
||||
'excess_paid' => $row['amount_not_approval'] ?? 0,
|
||||
'created_by' => auth()->user()->id,
|
||||
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user