Import Claim Request
This commit is contained in:
@@ -19,7 +19,7 @@ class ClaimRequestController extends Controller
|
|||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
* @return Renderable
|
* @return Renderable
|
||||||
*/
|
*/
|
||||||
private static $code_prefix = 'CP';
|
private static $code_prefix = 'CLAIM';
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('client::index');
|
return view('client::index');
|
||||||
@@ -224,10 +224,6 @@ class ClaimRequestController extends Controller
|
|||||||
|
|
||||||
public static function getNextCode()
|
public static function getNextCode()
|
||||||
{
|
{
|
||||||
// $last_number = ClaimRequest::max('code');
|
|
||||||
// $next_number = empty($last_number) ? 1 : ((int) explode('-', $last_number)[2] + 1);
|
|
||||||
// return self::makeCode($next_number);
|
|
||||||
|
|
||||||
$last_numeric_code = ClaimRequest::select(DB::raw('MAX(CAST(SUBSTRING_INDEX(code, "-", -1) AS SIGNED)) as max_numeric_code'))
|
$last_numeric_code = ClaimRequest::select(DB::raw('MAX(CAST(SUBSTRING_INDEX(code, "-", -1) AS SIGNED)) as max_numeric_code'))
|
||||||
->whereRaw('SUBSTRING_INDEX(code, "-", -1) REGEXP "^[0-9]+$"')
|
->whereRaw('SUBSTRING_INDEX(code, "-", -1) REGEXP "^[0-9]+$"')
|
||||||
->value('max_numeric_code');
|
->value('max_numeric_code');
|
||||||
@@ -247,8 +243,14 @@ class ClaimRequestController extends Controller
|
|||||||
{
|
{
|
||||||
// Pastikan $next_number adalah integer positif
|
// Pastikan $next_number adalah integer positif
|
||||||
$next_number = max(1, (int) $next_number);
|
$next_number = max(1, (int) $next_number);
|
||||||
|
$requestLogData = RequestLog::where('id', $request_log_id)->first();
|
||||||
|
$organization = Organization::where(['id' => $requestLogData->organization_id, 'type' => 'hospital'])->first('code');
|
||||||
|
$provideCode = $organization ? $organization->code : '';
|
||||||
|
$member = Member::with('currentCorporate')->where(['id' => $requestLogData->member_id])->first();
|
||||||
|
$sparator = '.';
|
||||||
|
$date = date('ymd');
|
||||||
// Menghasilkan kode dengan format yang diinginkan
|
// Menghasilkan kode dengan format yang diinginkan
|
||||||
return self::$code_prefix . '-' . str_pad($next_number, 5, '0', STR_PAD_LEFT);
|
return self::$code_prefix . $sparator. 'H' . $sparator. $provideCode . $sparator. $date. $sparator . $member->currentPolicy->code . $sparator. $member->member_id . $sparator. str_pad($next_number, 6, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,7 +276,6 @@ class ClaimRequestController extends Controller
|
|||||||
$date = date('ymd');
|
$date = date('ymd');
|
||||||
// Menghasilkan kode dengan format yang diinginkan
|
// Menghasilkan kode dengan format yang diinginkan
|
||||||
return self::$code_prefix . $sparator. 'H' . $sparator. $provideCode . $sparator. $date. $sparator . $member->currentPolicy->code . $sparator. $member->member_id . $sparator. str_pad($next_number, 5, '0', STR_PAD_LEFT);
|
return self::$code_prefix . $sparator. 'H' . $sparator. $provideCode . $sparator. $date. $sparator . $member->currentPolicy->code . $sparator. $member->member_id . $sparator. str_pad($next_number, 5, '0', STR_PAD_LEFT);
|
||||||
return self::$code_prefix . '.' . str_pad($next_number, 6, '0', STR_PAD_LEFT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_claim_requests(Request $request)
|
public function get_claim_requests(Request $request)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use App\Models\Member;
|
|||||||
|
|
||||||
class ClaimRequestController extends Controller
|
class ClaimRequestController extends Controller
|
||||||
{
|
{
|
||||||
private static $code_prefix = 'CRQ-C';
|
private static $code_prefix = 'CLAIM';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
@@ -429,6 +429,7 @@ class ClaimRequestController extends Controller
|
|||||||
$import = new ImportService();
|
$import = new ImportService();
|
||||||
$import->read($fileRead);
|
$import->read($fileRead);
|
||||||
$import->write($fileWrite, 'xsls');
|
$import->write($fileWrite, 'xsls');
|
||||||
|
|
||||||
foreach ($import->sheetsIterator() as $sheetIndex => $sheet) {
|
foreach ($import->sheetsIterator() as $sheetIndex => $sheet) {
|
||||||
if ($sheetIndex == 1) { // Rename First Sheet to Writer
|
if ($sheetIndex == 1) { // Rename First Sheet to Writer
|
||||||
$firstWriterSheet = $import->writer->getCurrentSheet();
|
$firstWriterSheet = $import->writer->getCurrentSheet();
|
||||||
@@ -445,6 +446,8 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
$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
|
||||||
@@ -465,21 +468,20 @@ class ClaimRequestController extends Controller
|
|||||||
}
|
}
|
||||||
try { // Process the Row Data
|
try { // Process the Row Data
|
||||||
$claimRequestService = new ClaimRequestService();
|
$claimRequestService = new ClaimRequestService();
|
||||||
|
|
||||||
$claimRequestService->handleClaimRequestRow($row_data);
|
$claimRequestService->handleClaimRequestRow($row_data);
|
||||||
|
|
||||||
// Write Success Result to File
|
// Write Success Result to File
|
||||||
// $import->read($fileRead);
|
// $import->read($fileRead);
|
||||||
// $import->write($fileWrite, 'xsls');
|
// $import->write($fileWrite, 'xsls');
|
||||||
$result_headers = array_merge($row_data, ['Ingest Code' =>200, 'Ingest Note' => 'Success']);
|
$result_headers = array_merge($row_data, ['Ingest Code' =>200, 'Ingest Note' => 'Success']);
|
||||||
|
// Mengambil tanggal dari objek DateTime
|
||||||
|
$dateSubmission = Helper::dateParser($result_headers['date_submission']); // Format tanggal sesuai kebutuhan
|
||||||
|
// Mengubah nilai date_submission menjadi string tanggal
|
||||||
|
$result_headers['date_submission'] = $dateSubmission;
|
||||||
$import->addArrayToRow($result_headers, $sheet->getName());
|
$import->addArrayToRow($result_headers, $sheet->getName());
|
||||||
|
|
||||||
} 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, [
|
$import->addArrayToRow(array_merge($row_data, [
|
||||||
'Ingest Code' => $e->getCode(),
|
'Ingest Code' => $e->getCode(),
|
||||||
'Ingest Note' => $e->getMessage(),
|
'Ingest Note' => $e->getMessage(),
|
||||||
@@ -620,10 +622,6 @@ class ClaimRequestController extends Controller
|
|||||||
|
|
||||||
public static function getNextCode()
|
public static function getNextCode()
|
||||||
{
|
{
|
||||||
// $last_number = ClaimRequest::max('code');
|
|
||||||
// $next_number = empty($last_number) ? 1 : ((int) explode('-', $last_number)[2] + 1);
|
|
||||||
// return self::makeCode($next_number);
|
|
||||||
|
|
||||||
$last_numeric_code = ClaimRequest::select(DB::raw('MAX(CAST(SUBSTRING_INDEX(code, "-", -1) AS SIGNED)) as max_numeric_code'))
|
$last_numeric_code = ClaimRequest::select(DB::raw('MAX(CAST(SUBSTRING_INDEX(code, "-", -1) AS SIGNED)) as max_numeric_code'))
|
||||||
->whereRaw('SUBSTRING_INDEX(code, "-", -1) REGEXP "^[0-9]+$"')
|
->whereRaw('SUBSTRING_INDEX(code, "-", -1) REGEXP "^[0-9]+$"')
|
||||||
->value('max_numeric_code');
|
->value('max_numeric_code');
|
||||||
@@ -641,11 +639,17 @@ class ClaimRequestController extends Controller
|
|||||||
|
|
||||||
public static function makeCode($next_number)
|
public static function makeCode($next_number)
|
||||||
{
|
{
|
||||||
// Pastikan $next_number adalah integer positif
|
// Pastikan $next_number adalah integer positif
|
||||||
$next_number = max(1, (int) $next_number);
|
$next_number = max(1, (int) $next_number);
|
||||||
|
$requestLogData = RequestLog::where('id', $request_log_id)->first();
|
||||||
// Menghasilkan kode dengan format yang diinginkan
|
$organization = Organization::where(['id' => $requestLogData->organization_id, 'type' => 'hospital'])->first('code');
|
||||||
return self::$code_prefix . '-' . str_pad($next_number, 5, '0', STR_PAD_LEFT);
|
$provideCode = $organization ? $organization->code : '';
|
||||||
|
$member = Member::with('currentCorporate')->where(['id' => $requestLogData->member_id])->first();
|
||||||
|
$sparator = '.';
|
||||||
|
$date = date('ymd');
|
||||||
|
// Menghasilkan kode dengan format yang diinginkan
|
||||||
|
return self::$code_prefix . $sparator. 'H' . $sparator. $provideCode . $sparator. $date. $sparator . $member->currentPolicy->code . $sparator. $member->member_id . $sparator. str_pad($next_number, 6, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function requestFiles(Request $request, $claim_id)
|
public function requestFiles(Request $request, $claim_id)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
class Helper
|
class Helper
|
||||||
{
|
{
|
||||||
@@ -426,4 +427,20 @@ class Helper
|
|||||||
ini_set('memory_limit', '256M');
|
ini_set('memory_limit', '256M');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dateParser($date_from_row) {
|
||||||
|
if ($date_from_row instanceof DateTime) {
|
||||||
|
return $date_from_row->format('Y-m-d');
|
||||||
|
} else if ($date_from_row != null) {
|
||||||
|
if (strtotime($date_from_row)){
|
||||||
|
return date('Y-m-d', strtotime($date_from_row));
|
||||||
|
} else {
|
||||||
|
// throw new ImportRowException(__('Format Date Invalid'), 0, null, $date_from_row);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// throw new ImportRowException(__('Format Date Invalid'), 0, null, $date_from_row);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,69 +52,27 @@ class ClaimRequest extends Model
|
|||||||
];
|
];
|
||||||
|
|
||||||
public static $doc_headers_to_field_map = [
|
public static $doc_headers_to_field_map = [
|
||||||
"PAYOR ID" => "payor_id",
|
"Code" => "code",
|
||||||
"CORPORATE ID" => "corporate_id",
|
"Date Submission" => "date_submission",
|
||||||
"POLICY NUMBER" => "policy_number",
|
"Total Billing" => "total_billing",
|
||||||
"MEMBER ID" => "member_id",
|
"Benefit Code" => "benefit_code",
|
||||||
"MEMBER NAME" => "member_name",
|
"Amt Incurred" => "amount_incurred",
|
||||||
"RECORD TYPE (P/D)" => "record_type",
|
"Amt Approved" => "amount_apporve",
|
||||||
"BENEFIT CODE" => "benefit_code",
|
"Amt Not Approved" => "amount_not_apporve",
|
||||||
"BENEFIT DESC" => "benefit_desc",
|
"Excess Paid" => "excess_paid",
|
||||||
"CLAIM TYPE" => "claim_type",
|
"QC" => "qc",
|
||||||
"CLAIM PROCESS STATUS" => "status",
|
|
||||||
"CLIENT CLAIM ID" => "client_claim_id",
|
|
||||||
"REFERENCE NO" => "reference_no",
|
|
||||||
"ADMEDIKA CLAIM ID" => "admika_claim_id",
|
|
||||||
"PROVIDER CODE" => "provider_code",
|
|
||||||
"ADMISSION DATE" => "admission_date",
|
|
||||||
"DISCUTRGE DATE" => "discutrge_date",
|
|
||||||
"DURATION DAYS" => "duration_days",
|
|
||||||
"COVERAGE TYPE" => "coverage_type",
|
|
||||||
"PLAN ID" => "plan_id",
|
|
||||||
"DIAGNOSIS CODE" => "diagnosis_code",
|
|
||||||
"DIAGNOSIS DESC" => "diagnosis_desc",
|
|
||||||
"TOT AMT INCURRED" => "tot_amt_insurred",
|
|
||||||
"TOT AMT APPROVED" => "tot_amt_approved",
|
|
||||||
"TOT AMT NOT APPROVED" => "tot_amt_not_approved",
|
|
||||||
"TOT EXCESS PAID" => "tot_excess_paid",
|
|
||||||
"REMARKS" => "remarks",
|
|
||||||
"SECONDARY DIAGNOSIS CODE" => "secondary_diagnosis",
|
|
||||||
"APPROVED DATE" => "approved_date",
|
|
||||||
"APPROVED BY" => "approved_by",
|
|
||||||
"DATE RECEIVED" => "data_received",
|
|
||||||
"HOSPITAL INVOICE DATE" => "hospital_invoice_date",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $listing_doc_headers = [
|
public static $listing_doc_headers = [
|
||||||
"PAYOR ID",
|
"Code",
|
||||||
"CORPORATE ID",
|
"Date Submission",
|
||||||
"POLICY NUMBER",
|
"Total Billing",
|
||||||
"MEMBER ID",
|
"Benefit Code",
|
||||||
"MEMBER NAME",
|
"Amt Incurred",
|
||||||
"RECORD TYPE (P/D)",
|
"Amt Approved",
|
||||||
"CLAIM TYPE",
|
"Amt Not Approved",
|
||||||
"CLAIM PROCESS STATUS",
|
"Excess Paid",
|
||||||
"CLIENT CLAIM ID",
|
"QC",
|
||||||
"REFERENCE NO",
|
|
||||||
"ADMEDIKA CLAIM ID",
|
|
||||||
"PROVIDER CODE",
|
|
||||||
"ADMISSION DATE",
|
|
||||||
"DISCUTRGE DATE",
|
|
||||||
"DURATION DAYS",
|
|
||||||
"COVERAGE TYPE",
|
|
||||||
"PLAN ID",
|
|
||||||
"DIAGNOSIS CODE",
|
|
||||||
"DIAGNOSIS DESC",
|
|
||||||
"TOT AMT INCURRED",
|
|
||||||
"TOT AMT APPROVED",
|
|
||||||
"TOT AMT NOT APPROVED",
|
|
||||||
"TOT EXCESS PAID",
|
|
||||||
"REMARKS",
|
|
||||||
"SECONDARY DIAGNOSIS CODE",
|
|
||||||
"APPROVED DATE",
|
|
||||||
"APPROVED BY",
|
|
||||||
"DATE RECEIVED",
|
|
||||||
"HOSPITAL INVOICE DATE",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ use App\Events\ClaimApproved;
|
|||||||
use App\Events\ClaimRequested;
|
use App\Events\ClaimRequested;
|
||||||
use App\Models\Claim;
|
use App\Models\Claim;
|
||||||
use App\Models\ClaimRequest;
|
use App\Models\ClaimRequest;
|
||||||
|
use App\Models\RequestLog;
|
||||||
|
use App\Models\Benefit;
|
||||||
|
use App\Models\RequestLogBenefit;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Models\Icd;
|
use App\Models\Icd;
|
||||||
@@ -20,6 +23,7 @@ use Str;
|
|||||||
|
|
||||||
class ClaimRequestService{
|
class ClaimRequestService{
|
||||||
|
|
||||||
|
private static $code_prefix = 'CLAIM';
|
||||||
public static function storeClaimRequest($row = null, $code, $member, $paymentType, $serviceCode, $requestLogID = null, $submissionDate = null, $status = 'requested', $organization_code = null)
|
public static function storeClaimRequest($row = null, $code, $member, $paymentType, $serviceCode, $requestLogID = null, $submissionDate = null, $status = 'requested', $organization_code = null)
|
||||||
{
|
{
|
||||||
// try {
|
// try {
|
||||||
@@ -36,20 +40,49 @@ class ClaimRequestService{
|
|||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
if ($status == 'submission'){
|
||||||
|
$claimManagement = 1;
|
||||||
|
$submissionDateClaimManagement = $submissionDate;
|
||||||
|
$submissionByClaimManagement = auth()->user()->id;
|
||||||
|
$statusClaim = 'received';
|
||||||
|
} else {
|
||||||
|
$claimManagement = 0;
|
||||||
|
$submissionDateClaimManagement = null;
|
||||||
|
$submissionByClaimManagement = null;
|
||||||
|
$statusClaim = null;
|
||||||
|
}
|
||||||
|
|
||||||
$claimRequestData = [
|
$claimRequestData = [
|
||||||
'code' => $code,
|
'code' => $code,
|
||||||
'request_log_id' => $requestLogID ?? 0,
|
'request_log_id' => $requestLogID ?? 0,
|
||||||
'member_id' => $member->id,
|
'member_id' => $member->id,
|
||||||
'submission_date' => $submissionDate ?? now(),
|
'submission_date' => $submissionDate ?? now(),
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
|
'claim_management' => $claimManagement,
|
||||||
|
'status_claim_management' => $statusClaim,
|
||||||
|
'submission_date_claim_management' => $submissionDateClaimManagement,
|
||||||
|
'submission_by_claim_management' => $submissionByClaimManagement,
|
||||||
'payment_type' => $paymentType,
|
'payment_type' => $paymentType,
|
||||||
'service_code' => $serviceCode,
|
'service_code' => $serviceCode,
|
||||||
'policy_id' => $member->currentPolicy->id ?? null,
|
'policy_id' => $member->currentPolicy->id ?? null,
|
||||||
'organization_id' => $organization ? $organization->id : 0,
|
'organization_id' => $organization ? $organization->id : 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
$claimRequest = ClaimRequest::create($claimRequestData);
|
$claimRequest = ClaimRequest::updateOrCreate(['request_log_id' => $requestLogID],$claimRequestData);
|
||||||
|
$benefitData = Benefit::where('code', $row['benefit_code'])->first();
|
||||||
|
$requestLogData = RequestLogBenefit::updateOrCreate(
|
||||||
|
[
|
||||||
|
'request_log_id' => $requestLogID,
|
||||||
|
'benefit_id' => $benefitData->id,
|
||||||
|
],[
|
||||||
|
'request_log_id' => $requestLogID,
|
||||||
|
'benefit_id' => $benefitData->id,
|
||||||
|
'amount_incurred' => $row['amount_incurred'],
|
||||||
|
'amount_approved' => $row['amount_apporve'],
|
||||||
|
'amount_not_approved' => $row['amount_not_apporve'],
|
||||||
|
'excess_paid' => $row['excess_paid'],
|
||||||
|
]);
|
||||||
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
|
|
||||||
return $claimRequest;
|
return $claimRequest;
|
||||||
@@ -60,8 +93,6 @@ class ClaimRequestService{
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function storeClaimManagement($row, $member, $claim_request_id){
|
public static function storeClaimManagement($row, $member, $claim_request_id){
|
||||||
try {
|
try {
|
||||||
$organization = 0;
|
$organization = 0;
|
||||||
@@ -130,26 +161,49 @@ class ClaimRequestService{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function validatePlanRow($row)
|
|
||||||
{
|
|
||||||
if (empty($row['member_id'])) {
|
|
||||||
throw new ImportRowException(__('Member ID Required'), 0, null, $row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handleClaimRequestRow($row)
|
public function handleClaimRequestRow($row)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$member = Member::where('member_id', $row['member_id'])->with(['currentPlan'])->first();
|
$requestLog = RequestLog::where('code', $row['code'])->first();
|
||||||
if(!$member){
|
if(!$requestLog){
|
||||||
throw new ImportRowException(__('Member Tidak ditemukan'), 0, null, $row);
|
throw new ImportRowException(__('LOG Tidak ditemukan'), 0, null, $row);
|
||||||
};
|
};
|
||||||
$code = $row['client_claim_id'];
|
|
||||||
$organization_id = $row['provider_code'];
|
if ($requestLog->status != 'approved' && $requestLog != 'approved'){
|
||||||
$submissionDate = Helper::formatDateDB($row['admission_date']);
|
throw new ImportRowException(__('Request LOG / Final LOG Belum di Approved'), 0, null, $row);
|
||||||
$paymentType = $row['claim_type'];
|
}
|
||||||
$status = $row['status'];
|
$organization = Organization::where('id', $requestLog->organization_id)->first();
|
||||||
$serviceCode = $row['coverage_type'];
|
|
||||||
|
// Create Code
|
||||||
|
$last_numeric_code = ClaimRequest::select(DB::raw('MAX(CAST(SUBSTRING_INDEX(code, ".", -1) AS SIGNED)) as max_numeric_code'))
|
||||||
|
->whereRaw('SUBSTRING_INDEX(code, ".", -1) REGEXP "^[0-9]+$"')
|
||||||
|
->value('max_numeric_code');
|
||||||
|
// $next_number = 1;
|
||||||
|
if ($last_numeric_code) {
|
||||||
|
// // Jika ada kode sebelumnya, pecah kode dan tambahkan 1 ke angka terakhir
|
||||||
|
// $parts = explode('-', $last_code);
|
||||||
|
// $last_number = (int) end($parts);
|
||||||
|
$next_number = $last_numeric_code + 1;
|
||||||
|
} else {
|
||||||
|
$next_number = 1;
|
||||||
|
}
|
||||||
|
// make code
|
||||||
|
$member = Member::with('currentCorporate')->where(['id' => $requestLog->member_id])->first();
|
||||||
|
$sparator = '.';
|
||||||
|
$date = date('ymd');
|
||||||
|
// 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 = $row['client_claim_id'];
|
||||||
|
// dd($row['date_submission']);
|
||||||
|
$submissionDate = Helper::dateParser($row['date_submission']);
|
||||||
|
$paymentType = $requestLog->payment_type;
|
||||||
|
if ($row['qc'] == 'Y'){
|
||||||
|
$status = 'submission';
|
||||||
|
} else {
|
||||||
|
$status = 'requested';
|
||||||
|
}
|
||||||
|
$serviceCode = $requestLog->service_code;
|
||||||
|
|
||||||
$newClaimRequest = $this->storeClaimRequest(
|
$newClaimRequest = $this->storeClaimRequest(
|
||||||
row: $row,
|
row: $row,
|
||||||
@@ -157,26 +211,21 @@ class ClaimRequestService{
|
|||||||
member: $member,
|
member: $member,
|
||||||
paymentType: $paymentType,
|
paymentType: $paymentType,
|
||||||
serviceCode: $serviceCode,
|
serviceCode: $serviceCode,
|
||||||
|
requestLogID: $requestLog->id,
|
||||||
submissionDate: $submissionDate,
|
submissionDate: $submissionDate,
|
||||||
status: $status,
|
status: $status,
|
||||||
organization_code: $organization_id
|
organization_code: $organization->code
|
||||||
);
|
);
|
||||||
|
|
||||||
$newlyCreatedID = $newClaimRequest->id;
|
$newlyCreatedID = $newClaimRequest->id;
|
||||||
|
// $newClaimManangement = $this->storeClaimManagement($row, $member, $newlyCreatedID);
|
||||||
$newClaimManangement = $this->storeClaimManagement($row, $member, $newlyCreatedID);
|
// ClaimRequested::dispatch($newClaimRequest);
|
||||||
ClaimRequested::dispatch($newClaimRequest);
|
// // Log History
|
||||||
// Log History
|
// $newClaimRequest->histories()->create([
|
||||||
$newClaimRequest->histories()->create([
|
// 'title' => 'New Claim Requested',
|
||||||
'title' => 'New Claim Requested',
|
// 'description' => "Claim Requested for Member : {$member->member_id} - ({$member->full_name})",
|
||||||
'description' => "Claim Requested for Member : {$member->member_id} - ({$member->full_name})",
|
// 'type' => 'info',
|
||||||
'type' => 'info',
|
// 'system_origin' => 'import-internal-aso'
|
||||||
'system_origin' => 'import-internal-aso'
|
// ]);
|
||||||
]);
|
|
||||||
|
|
||||||
$claim_request_data = $row;
|
|
||||||
$this->validatePlanRow($claim_request_data);
|
|
||||||
|
|
||||||
return $newClaimRequest;
|
return $newClaimRequest;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
|
|||||||
Reference in New Issue
Block a user