FIX_ISSUE
This commit is contained in:
parent
018209de30
commit
1987a94e8a
@ -6380,6 +6380,8 @@ class ClientController extends AdminController
|
|||||||
// $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 54]); //mediassist
|
// $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 54]); //mediassist
|
||||||
// $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 48]); //vidal
|
// $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 48]); //vidal
|
||||||
// $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 54]); //mediassist
|
// $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 54]); //mediassist
|
||||||
|
|
||||||
|
// $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 4]); //abhi
|
||||||
// dd($response);
|
// dd($response);
|
||||||
|
|
||||||
// ---------- TICKET CONTROLLER --------------------------------------------------------------------------------
|
// ---------- TICKET CONTROLLER --------------------------------------------------------------------------------
|
||||||
@ -7760,180 +7762,6 @@ class ClientController extends AdminController
|
|||||||
$combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id ,$pre_client_data['id']);
|
$combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id ,$pre_client_data['id']);
|
||||||
return $combinedHrAccessData;
|
return $combinedHrAccessData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do not remove this commented items
|
|
||||||
// public function constructHrAccessData($data, $client_id , $pre_client_id)
|
|
||||||
// {
|
|
||||||
// // print_rr($data);die;
|
|
||||||
|
|
||||||
// $preHrs = $data['pre_hr_data'];
|
|
||||||
// $postHrs = $data['post_hr_data'];
|
|
||||||
// $hrAccessTableData = $data['hr_access_table_data'];
|
|
||||||
// $merged = [];
|
|
||||||
|
|
||||||
// // Merge based on mobile and email
|
|
||||||
// foreach ($postHrs as $post) {
|
|
||||||
// $found = false;
|
|
||||||
// foreach ($preHrs as $index => $pre) {
|
|
||||||
|
|
||||||
// if ( trim($post['hr_mobile']) == trim($pre['hr_mobile']) && trim($post['hr_mail']) == trim($pre['hr_mail']) ) {
|
|
||||||
|
|
||||||
// $merged[] = [
|
|
||||||
// 'pre_hr_id' => $pre['pre_hr_id'],
|
|
||||||
// 'post_hr_id' => $post['post_hr_id'],
|
|
||||||
// 'hr_name' => $post['hr_name'],
|
|
||||||
// 'hr_mobile' => $post['hr_mobile'],
|
|
||||||
// 'hr_mail' => $post['hr_mail'],
|
|
||||||
// 'pre_branch_id' => $pre['pre_branch_id'] ?? null,
|
|
||||||
// 'post_branch_id' => $post['post_branch_id'] ?? null,
|
|
||||||
// 'post_branch_name' => $post['post_branch_name'] ?? null
|
|
||||||
// ];
|
|
||||||
// unset($preHrs[$index]); // remove matched pre_hr
|
|
||||||
// $found = true;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (!$found) {
|
|
||||||
// $merged[] = [
|
|
||||||
// 'pre_hr_id' => null,
|
|
||||||
// 'post_hr_id' => $post['post_hr_id'],
|
|
||||||
// 'hr_name' => $post['hr_name'],
|
|
||||||
// 'hr_mobile' => $post['hr_mobile'],
|
|
||||||
// 'hr_mail' => $post['hr_mail'],
|
|
||||||
// 'pre_branch_id' => $pre['pre_branch_id'] ?? null,
|
|
||||||
// 'post_branch_id' => $post['post_branch_id'] ?? null ,
|
|
||||||
// 'post_branch_name' => $post['post_branch_name'] ?? null
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Remaining preHrs (not matched)
|
|
||||||
// foreach ($preHrs as $pre) {
|
|
||||||
|
|
||||||
// foreach ($merged as $value) {
|
|
||||||
// if ( trim($pre['hr_mobile']) == trim($value['hr_mobile']) && trim($pre['hr_mail']) == trim($value['hr_mail']) ) {
|
|
||||||
// continue 2; // Skip adding this pre_hr as it's already matched
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $merged[] = [
|
|
||||||
// 'pre_hr_id' => $pre['pre_hr_id'],
|
|
||||||
// 'post_hr_id' => null,
|
|
||||||
// 'hr_name' => $pre['hr_name'],
|
|
||||||
// 'hr_mobile' => $pre['hr_mobile'],
|
|
||||||
// 'hr_mail' => $pre['hr_mail'],
|
|
||||||
// 'pre_branch_id' => $pre['pre_branch_id'] ?? null,
|
|
||||||
// 'post_branch_id' => $post['post_branch_id'] ?? null ,
|
|
||||||
// 'post_branch_name' => $post['post_branch_name'] ?? null
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // dd($merged);
|
|
||||||
|
|
||||||
// $result = [];
|
|
||||||
|
|
||||||
// if (empty($hrAccessTableData)) {
|
|
||||||
|
|
||||||
// // No access data — fill result with hr data and other fields as null
|
|
||||||
// foreach ($merged as $hr) {
|
|
||||||
// $result[] = [
|
|
||||||
// 'hr_access_table_pk' => null,
|
|
||||||
// 'post_client_id' => $client_id ?? null,
|
|
||||||
// 'pre_hr_id' => $hr['pre_hr_id'] ?? null,
|
|
||||||
// 'post_hr_id' => $hr['post_hr_id'] ?? null,
|
|
||||||
// 'allowed_pre_modules' => [],
|
|
||||||
// 'allowed_post_modules' => [],
|
|
||||||
// 'allowed_pre_policies' => [],
|
|
||||||
// 'allowed_active_policies' => [],
|
|
||||||
// 'allowed_cd' => [],
|
|
||||||
// 'hr_name' => $hr['hr_name'] ?? null,
|
|
||||||
// 'hr_mobile' => $hr['hr_mobile'] ?? null,
|
|
||||||
// 'hr_mail' => $hr['hr_mail'] ?? null,
|
|
||||||
// 'pre_branch_id' => $hr['pre_branch_id'] ?? null,
|
|
||||||
// 'post_branch_id' => $hr['post_branch_id'] ?? null ,
|
|
||||||
// 'post_branch_name' => $hr['post_branch_name'] ?? null ,
|
|
||||||
// 'pre_client_id' => $pre_client_id ?? null
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // First create a map of HR data by post_hr_id for quick lookup
|
|
||||||
// $hrMap = [];
|
|
||||||
// foreach ($merged as $hr) {
|
|
||||||
// $hrMap[$hr['post_hr_id']] = $hr;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Process access data first
|
|
||||||
// foreach ($hrAccessTableData as $access) {
|
|
||||||
// $post_hr_id = $access['post_hr_id'];
|
|
||||||
|
|
||||||
// // Check if this HR exists in our merged data
|
|
||||||
// if (isset($hrMap[$post_hr_id])) {
|
|
||||||
// $hr = $hrMap[$post_hr_id];
|
|
||||||
// $temp_arr_key = $hr['hr_mobile'] . $hr['hr_mail'];
|
|
||||||
|
|
||||||
// // Parse allowed modules
|
|
||||||
// $allowed_modules = json_decode($access['allowed_modules'], true) ?? null;
|
|
||||||
// $allowed_pre_modules = $allowed_modules['pre'] ?? [];
|
|
||||||
// $allowed_post_modules = $allowed_modules['post'] ?? [];
|
|
||||||
|
|
||||||
// $result[$temp_arr_key] = [
|
|
||||||
// 'hr_access_table_pk' => $access['id'] ?? null,
|
|
||||||
// 'post_client_id' => $access['post_client_id'] ?? null,
|
|
||||||
// 'pre_hr_id' => $hr['pre_hr_id'] ?? null,
|
|
||||||
// 'post_hr_id' => $hr['post_hr_id'] ?? null,
|
|
||||||
// 'allowed_pre_modules' => $allowed_pre_modules,
|
|
||||||
// 'allowed_post_modules' => $allowed_post_modules,
|
|
||||||
// 'allowed_pre_policies' => json_decode($access['allowed_pre_policies'], true) ?? [],
|
|
||||||
// 'allowed_active_policies' => json_decode($access['allowed_active_policies'], true) ?? [],
|
|
||||||
// 'allowed_cd' => json_decode($access['allowed_cd'], true) ?? [],
|
|
||||||
// 'hr_name' => $hr['hr_name'],
|
|
||||||
// 'hr_mobile' => $hr['hr_mobile'],
|
|
||||||
// 'hr_mail' => $hr['hr_mail'],
|
|
||||||
// 'pre_branch_id' => $hr['pre_branch_id'] ?? null,
|
|
||||||
// 'post_branch_id' => $hr['post_branch_id'] ?? null ,
|
|
||||||
// 'post_branch_name' => $hr['post_branch_name'] ?? null ,
|
|
||||||
// 'pre_client_id' => $pre_client_id ?? null
|
|
||||||
// ];
|
|
||||||
|
|
||||||
// // Remove from map so we know it's been processed
|
|
||||||
// unset($hrMap[$post_hr_id]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Now process any remaining HRs that didn't have access records
|
|
||||||
// foreach ($hrMap as $hr) {
|
|
||||||
// $temp_arr_key = $hr['hr_mobile'] . $hr['hr_mail'];
|
|
||||||
|
|
||||||
// $result[$temp_arr_key] = [
|
|
||||||
// 'hr_access_table_pk' => null,
|
|
||||||
// 'post_client_id' => $client_id ?? null,
|
|
||||||
// 'pre_hr_id' => $hr['pre_hr_id'] ?? null,
|
|
||||||
// 'post_hr_id' => $hr['post_hr_id'] ?? null,
|
|
||||||
// 'allowed_pre_modules' => [],
|
|
||||||
// 'allowed_post_modules' => [],
|
|
||||||
// 'allowed_pre_policies' => [],
|
|
||||||
// 'allowed_active_policies' => [],
|
|
||||||
// 'allowed_cd' => [],
|
|
||||||
// 'hr_name' => $hr['hr_name'] ?? null,
|
|
||||||
// 'hr_mobile' => $hr['hr_mobile'] ?? null,
|
|
||||||
// 'hr_mail' => $hr['hr_mail'] ?? null,
|
|
||||||
// 'pre_branch_id' => $hr['pre_branch_id'] ?? null,
|
|
||||||
// 'post_branch_id' => $hr['post_branch_id'] ?? null ,
|
|
||||||
// 'post_branch_name' => $hr['post_branch_name'] ?? null ,
|
|
||||||
// 'pre_client_id' => $pre_client_id ?? null
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// $resultData['hr_access_data'] = array_values($result);
|
|
||||||
// $resultData['pre_policy_data'] = $data['pre_policy_data'];
|
|
||||||
// $resultData['post_policy_data'] = $data['post_policy_data'];
|
|
||||||
// $resultData['post_cd_data'] = $data['post_cd_data'];
|
|
||||||
|
|
||||||
// return $resultData;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function constructHrAccessData($data, $client_id , $pre_client_id)
|
public function constructHrAccessData($data, $client_id , $pre_client_id)
|
||||||
{
|
{
|
||||||
@ -8189,7 +8017,180 @@ class ClientController extends AdminController
|
|||||||
];
|
];
|
||||||
return ['status' => 'failed', 'code' => 500, 'message' => $th->getMessage(), 'error_data' => $errorData];
|
return ['status' => 'failed', 'code' => 500, 'message' => $th->getMessage(), 'error_data' => $errorData];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function constructHrAccessData_OLD($data, $client_id , $pre_client_id)
|
||||||
|
{
|
||||||
|
// print_rr($data);die;
|
||||||
|
|
||||||
|
$preHrs = $data['pre_hr_data'];
|
||||||
|
$postHrs = $data['post_hr_data'];
|
||||||
|
$hrAccessTableData = $data['hr_access_table_data'];
|
||||||
|
$merged = [];
|
||||||
|
|
||||||
|
// Merge based on mobile and email
|
||||||
|
foreach ($postHrs as $post) {
|
||||||
|
$found = false;
|
||||||
|
foreach ($preHrs as $index => $pre) {
|
||||||
|
|
||||||
|
if ( trim($post['hr_mobile']) == trim($pre['hr_mobile']) && trim($post['hr_mail']) == trim($pre['hr_mail']) ) {
|
||||||
|
|
||||||
|
$merged[] = [
|
||||||
|
'pre_hr_id' => $pre['pre_hr_id'],
|
||||||
|
'post_hr_id' => $post['post_hr_id'],
|
||||||
|
'hr_name' => $post['hr_name'],
|
||||||
|
'hr_mobile' => $post['hr_mobile'],
|
||||||
|
'hr_mail' => $post['hr_mail'],
|
||||||
|
'pre_branch_id' => $pre['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $post['post_branch_id'] ?? null,
|
||||||
|
'post_branch_name' => $post['post_branch_name'] ?? null
|
||||||
|
];
|
||||||
|
unset($preHrs[$index]); // remove matched pre_hr
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found) {
|
||||||
|
$merged[] = [
|
||||||
|
'pre_hr_id' => null,
|
||||||
|
'post_hr_id' => $post['post_hr_id'],
|
||||||
|
'hr_name' => $post['hr_name'],
|
||||||
|
'hr_mobile' => $post['hr_mobile'],
|
||||||
|
'hr_mail' => $post['hr_mail'],
|
||||||
|
'pre_branch_id' => $pre['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $post['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $post['post_branch_name'] ?? null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remaining preHrs (not matched)
|
||||||
|
foreach ($preHrs as $pre) {
|
||||||
|
|
||||||
|
foreach ($merged as $value) {
|
||||||
|
if ( trim($pre['hr_mobile']) == trim($value['hr_mobile']) && trim($pre['hr_mail']) == trim($value['hr_mail']) ) {
|
||||||
|
continue 2; // Skip adding this pre_hr as it's already matched
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$merged[] = [
|
||||||
|
'pre_hr_id' => $pre['pre_hr_id'],
|
||||||
|
'post_hr_id' => null,
|
||||||
|
'hr_name' => $pre['hr_name'],
|
||||||
|
'hr_mobile' => $pre['hr_mobile'],
|
||||||
|
'hr_mail' => $pre['hr_mail'],
|
||||||
|
'pre_branch_id' => $pre['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $post['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $post['post_branch_name'] ?? null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($merged);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
if (empty($hrAccessTableData)) {
|
||||||
|
|
||||||
|
// No access data — fill result with hr data and other fields as null
|
||||||
|
foreach ($merged as $hr) {
|
||||||
|
$result[] = [
|
||||||
|
'hr_access_table_pk' => null,
|
||||||
|
'post_client_id' => $client_id ?? null,
|
||||||
|
'pre_hr_id' => $hr['pre_hr_id'] ?? null,
|
||||||
|
'post_hr_id' => $hr['post_hr_id'] ?? null,
|
||||||
|
'allowed_pre_modules' => [],
|
||||||
|
'allowed_post_modules' => [],
|
||||||
|
'allowed_pre_policies' => [],
|
||||||
|
'allowed_active_policies' => [],
|
||||||
|
'allowed_cd' => [],
|
||||||
|
'hr_name' => $hr['hr_name'] ?? null,
|
||||||
|
'hr_mobile' => $hr['hr_mobile'] ?? null,
|
||||||
|
'hr_mail' => $hr['hr_mail'] ?? null,
|
||||||
|
'pre_branch_id' => $hr['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $hr['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $hr['post_branch_name'] ?? null ,
|
||||||
|
'pre_client_id' => $pre_client_id ?? null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// First create a map of HR data by post_hr_id for quick lookup
|
||||||
|
$hrMap = [];
|
||||||
|
foreach ($merged as $hr) {
|
||||||
|
$hrMap[$hr['post_hr_id']] = $hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process access data first
|
||||||
|
foreach ($hrAccessTableData as $access) {
|
||||||
|
$post_hr_id = $access['post_hr_id'];
|
||||||
|
|
||||||
|
// Check if this HR exists in our merged data
|
||||||
|
if (isset($hrMap[$post_hr_id])) {
|
||||||
|
$hr = $hrMap[$post_hr_id];
|
||||||
|
$temp_arr_key = $hr['hr_mobile'] . $hr['hr_mail'];
|
||||||
|
|
||||||
|
// Parse allowed modules
|
||||||
|
$allowed_modules = json_decode($access['allowed_modules'], true) ?? null;
|
||||||
|
$allowed_pre_modules = $allowed_modules['pre'] ?? [];
|
||||||
|
$allowed_post_modules = $allowed_modules['post'] ?? [];
|
||||||
|
|
||||||
|
$result[$temp_arr_key] = [
|
||||||
|
'hr_access_table_pk' => $access['id'] ?? null,
|
||||||
|
'post_client_id' => $access['post_client_id'] ?? null,
|
||||||
|
'pre_hr_id' => $hr['pre_hr_id'] ?? null,
|
||||||
|
'post_hr_id' => $hr['post_hr_id'] ?? null,
|
||||||
|
'allowed_pre_modules' => $allowed_pre_modules,
|
||||||
|
'allowed_post_modules' => $allowed_post_modules,
|
||||||
|
'allowed_pre_policies' => json_decode($access['allowed_pre_policies'], true) ?? [],
|
||||||
|
'allowed_active_policies' => json_decode($access['allowed_active_policies'], true) ?? [],
|
||||||
|
'allowed_cd' => json_decode($access['allowed_cd'], true) ?? [],
|
||||||
|
'hr_name' => $hr['hr_name'],
|
||||||
|
'hr_mobile' => $hr['hr_mobile'],
|
||||||
|
'hr_mail' => $hr['hr_mail'],
|
||||||
|
'pre_branch_id' => $hr['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $hr['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $hr['post_branch_name'] ?? null ,
|
||||||
|
'pre_client_id' => $pre_client_id ?? null
|
||||||
|
];
|
||||||
|
|
||||||
|
// Remove from map so we know it's been processed
|
||||||
|
unset($hrMap[$post_hr_id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now process any remaining HRs that didn't have access records
|
||||||
|
foreach ($hrMap as $hr) {
|
||||||
|
$temp_arr_key = $hr['hr_mobile'] . $hr['hr_mail'];
|
||||||
|
|
||||||
|
$result[$temp_arr_key] = [
|
||||||
|
'hr_access_table_pk' => null,
|
||||||
|
'post_client_id' => $client_id ?? null,
|
||||||
|
'pre_hr_id' => $hr['pre_hr_id'] ?? null,
|
||||||
|
'post_hr_id' => $hr['post_hr_id'] ?? null,
|
||||||
|
'allowed_pre_modules' => [],
|
||||||
|
'allowed_post_modules' => [],
|
||||||
|
'allowed_pre_policies' => [],
|
||||||
|
'allowed_active_policies' => [],
|
||||||
|
'allowed_cd' => [],
|
||||||
|
'hr_name' => $hr['hr_name'] ?? null,
|
||||||
|
'hr_mobile' => $hr['hr_mobile'] ?? null,
|
||||||
|
'hr_mail' => $hr['hr_mail'] ?? null,
|
||||||
|
'pre_branch_id' => $hr['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $hr['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $hr['post_branch_name'] ?? null ,
|
||||||
|
'pre_client_id' => $pre_client_id ?? null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$resultData['hr_access_data'] = array_values($result);
|
||||||
|
$resultData['pre_policy_data'] = $data['pre_policy_data'];
|
||||||
|
$resultData['post_policy_data'] = $data['post_policy_data'];
|
||||||
|
$resultData['post_cd_data'] = $data['post_cd_data'];
|
||||||
|
|
||||||
|
return $resultData;
|
||||||
|
}
|
||||||
|
|
||||||
public function saveHrAccessData()
|
public function saveHrAccessData()
|
||||||
{
|
{
|
||||||
@ -8854,17 +8855,6 @@ class ClientController extends AdminController
|
|||||||
return $default_templates_inserted ? true : false;
|
return $default_templates_inserted ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function downloadClientKycDocs_2()
|
|
||||||
// {
|
|
||||||
|
|
||||||
// $file = WRITEPATH . 'uploads/client_kyc_documents/' . $file_name; // Example file path
|
|
||||||
|
|
||||||
// if (file_exists($file)) {
|
|
||||||
// return $this->response->download($file, null)->setFileName($file_name);
|
|
||||||
// } else {
|
|
||||||
// return "File not found.";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
public function downloadClientKycDocs_2($file_name = null)
|
public function downloadClientKycDocs_2($file_name = null)
|
||||||
{
|
{
|
||||||
if (!$file_name) {
|
if (!$file_name) {
|
||||||
|
|||||||
@ -86,10 +86,6 @@ class AbhiClaimImportService extends BaseTpaClaimImportService
|
|||||||
|
|
||||||
// Employee / Member details
|
// Employee / Member details
|
||||||
'member_code' => 'emp_code',
|
'member_code' => 'emp_code',
|
||||||
'relation' => 'relationship',
|
|
||||||
|
|
||||||
// Policy / Claim identifiers
|
|
||||||
'policy_number' => 'policy_no',
|
|
||||||
'abhi_claim_no' => 'claim_number',
|
'abhi_claim_no' => 'claim_number',
|
||||||
|
|
||||||
// Dates
|
// Dates
|
||||||
@ -428,41 +424,31 @@ class AbhiClaimImportService extends BaseTpaClaimImportService
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$relation = strtolower($relation);
|
// trim removes whitespace, strtolower handles case sensitivity
|
||||||
|
$relation = strtolower(trim($relation));
|
||||||
|
|
||||||
if (str_contains($relation, 'self')) {
|
// Mapping specific keywords to standardized outputs
|
||||||
return 'self';
|
// ORDER MATTERS: Specific phrases (in-law) must come before general ones (father)
|
||||||
|
$map = [
|
||||||
|
'father-in-law' => ['father in law', 'father-in-law', 'fil'],
|
||||||
|
'mother-in-law' => ['mother in law', 'mother-in-law', 'mil'],
|
||||||
|
'father' => ['father', 'papa', 'dad'],
|
||||||
|
'mother' => ['mother', 'mom', 'mummy'],
|
||||||
|
'spouse' => ['spouse', 'wife', 'husband', 'hubby'],
|
||||||
|
'daughter' => ['daughter', 'daug'],
|
||||||
|
'son' => ['son'],
|
||||||
|
'self' => ['self', 'employee', 'main'],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($map as $standard => $keywords) {
|
||||||
|
foreach ($keywords as $keyword) {
|
||||||
|
if (str_contains($relation, $keyword)) {
|
||||||
|
return $standard;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_contains($relation, 'spouse') || str_contains($relation, 'wife') || str_contains($relation, 'husband')) {
|
return null;
|
||||||
return 'spouse';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($relation, 'daughter')) {
|
|
||||||
return 'daughter';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($relation, 'son')) {
|
|
||||||
return 'son';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($relation, 'father in law') || str_contains($relation, 'father-in-law')) {
|
|
||||||
return 'father-in-law';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($relation, 'mother in law') || str_contains($relation, 'mother-in-law')) {
|
|
||||||
return 'mother-in-law';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($relation, 'father')) {
|
|
||||||
return 'father';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($relation, 'mother')) {
|
|
||||||
return 'mother';
|
|
||||||
}
|
|
||||||
|
|
||||||
return null; // unmatched case
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -274,20 +274,6 @@ abstract class BaseTpaClaimImportService
|
|||||||
*/
|
*/
|
||||||
protected function getTpaClaimDumpData(string $table, array $params): array
|
protected function getTpaClaimDumpData(string $table, array $params): array
|
||||||
{
|
{
|
||||||
$tpaClaimDumpDataCount = $this->db
|
|
||||||
->table($table)
|
|
||||||
->where('is_active', 1)
|
|
||||||
->where('file_id', $params['file_id'])
|
|
||||||
->where('ticket_id IS NULL')
|
|
||||||
->where('master_reject_reason IS NULL')
|
|
||||||
->countAllResults();
|
|
||||||
|
|
||||||
$batch_size = 100;
|
|
||||||
$total_batch = (int) ceil($tpaClaimDumpDataCount / $batch_size);
|
|
||||||
$batch_no = isset($params['batch_no']) ? (int) $params['batch_no'] : null;
|
|
||||||
$last_emp_id = (int) ($params['last_emp_id'] ?? 0);
|
|
||||||
|
|
||||||
|
|
||||||
return $this->db
|
return $this->db
|
||||||
->table($table)
|
->table($table)
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
@ -296,7 +282,6 @@ abstract class BaseTpaClaimImportService
|
|||||||
->where('master_reject_reason IS NULL')
|
->where('master_reject_reason IS NULL')
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -141,12 +141,8 @@ class FhplClaimImportService extends BaseTpaClaimImportService
|
|||||||
// Claim / Reference
|
// Claim / Reference
|
||||||
'claim_id' => 'claim_number',
|
'claim_id' => 'claim_number',
|
||||||
|
|
||||||
// Policy
|
|
||||||
'policy_no' => 'policy_no',
|
|
||||||
|
|
||||||
// Employee / Member
|
// Employee / Member
|
||||||
'employee_id' => 'emp_code',
|
'employee_id' => 'emp_code',
|
||||||
'relationship' => 'relationship',
|
|
||||||
|
|
||||||
// Claim Dates
|
// Claim Dates
|
||||||
'admission_date' => 'doa',
|
'admission_date' => 'doa',
|
||||||
|
|||||||
@ -81,7 +81,6 @@ class IciciClaimImportService extends BaseTpaClaimImportService
|
|||||||
|
|
||||||
// Employee / Member
|
// Employee / Member
|
||||||
'employee_member_id' => 'emp_code',
|
'employee_member_id' => 'emp_code',
|
||||||
'relation_group' => 'relationship',
|
|
||||||
|
|
||||||
// Claim
|
// Claim
|
||||||
'claim_number' => 'claim_number',
|
'claim_number' => 'claim_number',
|
||||||
|
|||||||
@ -116,10 +116,8 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
|
|||||||
|
|
||||||
// Employee / Beneficiary details
|
// Employee / Beneficiary details
|
||||||
'pribenef_employee_code' => 'emp_code',
|
'pribenef_employee_code' => 'emp_code',
|
||||||
'benef_relation' => 'relationship',
|
|
||||||
|
|
||||||
// Policy / Claim identifiers
|
// Policy / Claim identifiers
|
||||||
'policy_no' => 'policy_no',
|
|
||||||
'claim_id' => 'claim_number',
|
'claim_id' => 'claim_number',
|
||||||
'event_id' => 'tpa_no',
|
'event_id' => 'tpa_no',
|
||||||
'claim_pre_auths' => 'tpa_claim_push_reference_no',
|
'claim_pre_auths' => 'tpa_claim_push_reference_no',
|
||||||
|
|||||||
@ -60,10 +60,8 @@ class RcareClaimImportService extends BaseTpaClaimImportService
|
|||||||
|
|
||||||
// Employee / Member
|
// Employee / Member
|
||||||
'employee_member_id' => 'emp_code',
|
'employee_member_id' => 'emp_code',
|
||||||
'relation' => 'relationship',
|
|
||||||
|
|
||||||
// Policy
|
// Policy
|
||||||
'policy_number' => 'policy_no',
|
|
||||||
'policy_start_date' => 'date_of_incep',
|
'policy_start_date' => 'date_of_incep',
|
||||||
|
|
||||||
// Claim Dates
|
// Claim Dates
|
||||||
|
|||||||
@ -314,7 +314,6 @@ class VidalClaimImportService extends BaseTpaClaimImportService
|
|||||||
protected $ticketMasterMapping = [
|
protected $ticketMasterMapping = [
|
||||||
|
|
||||||
// Policy / Claim identifiers
|
// Policy / Claim identifiers
|
||||||
'insurer_policy_number' => 'policy_no',
|
|
||||||
'insurer_claim_number' => 'claim_number',
|
'insurer_claim_number' => 'claim_number',
|
||||||
'tpa_claim_number' => 'tpa_claim_id',
|
'tpa_claim_number' => 'tpa_claim_id',
|
||||||
|
|
||||||
|
|||||||
@ -93,6 +93,7 @@ class TicketMasterModel extends Model
|
|||||||
'required_docs',
|
'required_docs',
|
||||||
'policy_transaction_id',
|
'policy_transaction_id',
|
||||||
'tpa_claim_type',
|
'tpa_claim_type',
|
||||||
|
'claim_dump_ref_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user