update request log service
This commit is contained in:
@@ -140,47 +140,25 @@ class RequestLogService{
|
||||
}
|
||||
}
|
||||
|
||||
public function handleClaimRequestRow($row)
|
||||
public function handleRequestLogRow($row)
|
||||
{
|
||||
try {
|
||||
$member = Member::where('member_id', $row['member_id'])->with(['currentPlan'])->first();
|
||||
if(!$member){
|
||||
throw new ImportRowException(__('Member Tidak ditemukan'), 0, null, $row);
|
||||
$requestLog = RequestLog::where('id', $row['id'])->first();
|
||||
if(!$requestLog){
|
||||
throw new ImportRowException(__('Request LOG Tidak ditemukan'), 0, null, $row);
|
||||
};
|
||||
$code = $row['client_claim_id'];
|
||||
$organization_id = $row['provider_code'];
|
||||
$submissionDate = Helper::formatDateDB($row['admission_date']);
|
||||
$paymentType = $row['claim_type'];
|
||||
$status = $row['status'];
|
||||
$serviceCode = $row['coverage_type'];
|
||||
|
||||
$newClaimRequest = $this->storeClaimRequest(
|
||||
row: $row,
|
||||
code: $code,
|
||||
member: $member,
|
||||
paymentType: $paymentType,
|
||||
serviceCode: $serviceCode,
|
||||
submissionDate: $submissionDate,
|
||||
status: $status,
|
||||
organization_code: $organization_id
|
||||
);
|
||||
|
||||
$newlyCreatedID = $newClaimRequest->id;
|
||||
$status = RequestLog::$status;
|
||||
|
||||
$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'
|
||||
if (!array_key_exists($row['status'], $status)){
|
||||
throw new ImportRowException(__('Status Request LOG Tidak ditemukan'), 0, null, $row);
|
||||
}
|
||||
|
||||
// Update Request LOG Status & Link with Claim
|
||||
$requestLog->update([
|
||||
'status' => $row['status']
|
||||
]);
|
||||
|
||||
$claim_request_data = $row;
|
||||
$this->validatePlanRow($claim_request_data);
|
||||
|
||||
return $newClaimRequest;
|
||||
$requestLog->save();
|
||||
return $requestLog;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user