CHANGE_TPA_API_LIST_THE_MISMATCH_TPA_DATA
This commit is contained in:
parent
890ea3b4be
commit
eb94b6b1ea
@ -17,6 +17,7 @@ class Acl
|
|||||||
'#^/getVerifiedPosUserData#' => ['public' => true],
|
'#^/getVerifiedPosUserData#' => ['public' => true],
|
||||||
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID]],
|
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
'#^/getEmployeeActiveOrInactivePolicy#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
'#^/getEmployeeActiveOrInactivePolicy#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
||||||
|
'#^/sheet#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
||||||
'#^/sendextraparam#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
'#^/sendextraparam#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
||||||
'#^/test/testingquerys#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
'#^/test/testingquerys#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
||||||
'#^/test/viewrfq#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
'#^/test/viewrfq#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
||||||
|
|||||||
@ -6915,6 +6915,31 @@ class ClientController extends AdminController
|
|||||||
// $res = $medi_assist->MediAssistGetBenefDetails(['policy_no' => '97000034240400000030', 'file_id' => 389, 'return_type' => 'job', 'client_policy_id' => 6192 ]);
|
// $res = $medi_assist->MediAssistGetBenefDetails(['policy_no' => '97000034240400000030', 'file_id' => 389, 'return_type' => 'job', 'client_policy_id' => 6192 ]);
|
||||||
// dd($res);
|
// dd($res);
|
||||||
|
|
||||||
|
// // 1. Dummy JSON data create panrom (Temp file)
|
||||||
|
// $tempJsonFile = tempnam(sys_get_temp_dir(), 'test_vidal_');
|
||||||
|
// $dummyData = [
|
||||||
|
// [
|
||||||
|
// 'empNo' => 'EMP001',
|
||||||
|
// 'name' => 'John Doe',
|
||||||
|
// 'dob' => '01/01/1990',
|
||||||
|
// 'relationship' => 'Self',
|
||||||
|
// 'gender' => 'Male',
|
||||||
|
// 'enrollmentId' => 'TPA123',
|
||||||
|
// 'age' => 34
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// file_put_contents($tempJsonFile, json_encode($dummyData));
|
||||||
|
|
||||||
|
// $inputArray = [
|
||||||
|
// 'file_id' => 10,
|
||||||
|
// 'json_file_path' => $tempJsonFile
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $vidalController = new VidalApiController();
|
||||||
|
// $res = $vidalController->saveVidalAPIData($inputArray);
|
||||||
|
// dd($res);
|
||||||
|
|
||||||
$employeeController = new EmployeeController();
|
$employeeController = new EmployeeController();
|
||||||
// $response = $employeeController->getEmployeeEcardFromTmpFolderAndZipToS3(json_decode('{"batch_no":2,"last_emp_policy_id":"13218","folder_name":"bulk_ecards_IOCL-77448855996699885555_2026-02-05_09-32-22","processed_in_this_batch_data_count":7,"pdf_count":0,"hr_id":"1"}', true));
|
// $response = $employeeController->getEmployeeEcardFromTmpFolderAndZipToS3(json_decode('{"batch_no":2,"last_emp_policy_id":"13218","folder_name":"bulk_ecards_IOCL-77448855996699885555_2026-02-05_09-32-22","processed_in_this_batch_data_count":7,"pdf_count":0,"hr_id":"1"}', true));
|
||||||
// $response = $employeeController->bulkEcardDownloadAsZipFromS3(json_decode('{"client_policy_id":"6066","hr_id":"1"}', true));
|
// $response = $employeeController->bulkEcardDownloadAsZipFromS3(json_decode('{"client_policy_id":"6066","hr_id":"1"}', true));
|
||||||
|
|||||||
@ -3730,7 +3730,7 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fallback if gender missing (better to throw error)
|
// fallback if gender missing (better to throw error)
|
||||||
throw new Exception("Gender required to map 'Spouse'");
|
throw new \Exception("Gender required to map 'Spouse'");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $map[$key] ?? '';
|
return $map[$key] ?? '';
|
||||||
@ -4057,8 +4057,7 @@ class EmployeeController extends AdminController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function reconcileDbWithTpa(array $db, array $tpaRows): array
|
||||||
function reconcileDbWithTpa(array $db, array $tpaRows): array
|
|
||||||
{
|
{
|
||||||
// Name normalization
|
// Name normalization
|
||||||
$normalizeName = function ($name) {
|
$normalizeName = function ($name) {
|
||||||
@ -4112,12 +4111,7 @@ class EmployeeController extends AdminController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportVariationReportExcel(array $notInTPA, array $notInNhance, array $reviewNeeded, string $filename = 'employee_review.xlsx')
|
||||||
function exportVariationReportExcel(
|
|
||||||
array $notInTPA,
|
|
||||||
array $notInNhance,
|
|
||||||
array $reviewNeeded,
|
|
||||||
string $filename = 'employee_review.xlsx')
|
|
||||||
{
|
{
|
||||||
|
|
||||||
function setCell($sheet, int $col, int $row, $value)
|
function setCell($sheet, int $col, int $row, $value)
|
||||||
@ -4317,7 +4311,7 @@ class EmployeeController extends AdminController
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bulkGenerateEcardAndStoreinS3(array $params = [])
|
public function bulkGenerateEcardAndStoreinS3(array $params = [])
|
||||||
{
|
{
|
||||||
$request = \Config\Services::request();
|
$request = \Config\Services::request();
|
||||||
$isCli = is_cli();
|
$isCli = is_cli();
|
||||||
|
|||||||
@ -753,7 +753,7 @@ class FhplApiController extends BaseController
|
|||||||
$response = call_third_party_api($url,'POST',$headers,$body);
|
$response = call_third_party_api($url,'POST',$headers,$body);
|
||||||
|
|
||||||
if(!empty($response['data'])){
|
if(!empty($response['data'])){
|
||||||
log_message('error', 'FHPL - Sync TPA Claims | Exception thrown while calling GetTPA_ClaimsDetails API: ' . json_encode($errorData));
|
log_message('error', 'FHPL - Sync TPA Claims | Exception thrown while calling GetTPA_ClaimsDetails API: ' . json_encode($response ?? []));
|
||||||
$finalResult = array_merge($finalResult,$response['data']);
|
$finalResult = array_merge($finalResult,$response['data']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -790,6 +790,52 @@ class FhplApiController extends BaseController
|
|||||||
return ['status'=>true,'total'=>count($finalResult)];
|
return ['status'=>true,'total'=>count($finalResult)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveFhplAPIData($array)
|
||||||
|
{
|
||||||
|
$file_id = $array['file_id'];
|
||||||
|
$json = file_get_contents($array['json_file_path']);
|
||||||
|
$records = json_decode($json, true);
|
||||||
|
|
||||||
|
// log_message('error','FHPL - saveFhplAPIData' . json_encode($array));//die();
|
||||||
|
$file_model = new BatchFileModel();
|
||||||
|
$file_info = $file_model->where('id', $file_id)->find();
|
||||||
|
|
||||||
|
$tpaApiDataModel = new TpaApiDataModel();
|
||||||
|
|
||||||
|
//deactivate old data
|
||||||
|
$tpaApiDataModel->set('is_active', 0)->where('file_id', $file_id)->update();
|
||||||
|
|
||||||
|
//covert tpa data to our model data
|
||||||
|
$mappedRows = [];
|
||||||
|
|
||||||
|
foreach ($records as $row) {
|
||||||
|
|
||||||
|
$mappedRows[] = [
|
||||||
|
'file_id' => $file_id, // ← pass from controller
|
||||||
|
'emp_code' => trim($row['EMPLOYEE_ID'] ?? ''),
|
||||||
|
|
||||||
|
'name' => trim($row['EMPLOYEE_NAME'] ?? ''),
|
||||||
|
'dob' => !empty($row['DATE_OF_BIRTH'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $row['DATE_OF_BIRTH']))) : null,
|
||||||
|
|
||||||
|
'relation' => trim(strtolower($row['RELATION'] ?? '')),
|
||||||
|
'gender' => format_gender_v2($row['GENDER'] ?? null),
|
||||||
|
'self' => strtolower($row['RELATION'] ?? '') === 'self' ? 1 : 0,
|
||||||
|
|
||||||
|
'tpa_id' => trim($row['TPA_TPADETAIL_ID'] ?? null),
|
||||||
|
'age' => is_numeric($row['AGE'] ?? null) ? (int) $row['AGE'] : null,
|
||||||
|
|
||||||
|
'is_active' => 1,
|
||||||
|
'created_by' => $file_info[0]['created_by'] ?? null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// log_message('error','FHPL - COUNT' . count($mappedRows));
|
||||||
|
$result = $tpaApiDataModel->insertBatchWithChunkLog($mappedRows,500,('FILE_ID_'.$file_id));
|
||||||
|
// unlink($file_array['json_file_path']); // delete temp json file
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -814,4 +814,48 @@ class HealthIndiaApiController extends BaseController
|
|||||||
'inserted' => $insertedCount
|
'inserted' => $insertedCount
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveHealthIndiaAPIData($array)
|
||||||
|
{
|
||||||
|
$file_id = $array['file_id'];
|
||||||
|
$json = file_get_contents($array['json_file_path']);
|
||||||
|
$records = json_decode($json, true);
|
||||||
|
// log_message('error','HEALTH_INDIA - saveHealthIndiaAPIData' . json_encode($array));//die();
|
||||||
|
$file_model = new BatchFileModel();
|
||||||
|
$file_info = $file_model->where('id', $file_id)->find();
|
||||||
|
|
||||||
|
$tpaApiDataModel = new TpaApiDataModel();
|
||||||
|
|
||||||
|
//deactivate old data
|
||||||
|
$tpaApiDataModel->set('is_active', 0)->where('file_id', $file_id)->update();
|
||||||
|
|
||||||
|
//covert tpa data to our model data
|
||||||
|
$mappedRows = [];
|
||||||
|
|
||||||
|
foreach ($records as $row) {
|
||||||
|
|
||||||
|
$mappedRows[] = [
|
||||||
|
'file_id' => $file_id, // ← pass from controller
|
||||||
|
'emp_code' => trim($row['employeeCode'] ?? ''),
|
||||||
|
|
||||||
|
'name' => trim($row['insured_Name'] ?? ''),
|
||||||
|
'dob' => !empty($row['dateOfBirth'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $row['dateOfBirth']))) : null,
|
||||||
|
|
||||||
|
'relation' => map_relationship(trim($row['relation'] ?? null)),
|
||||||
|
'gender' => strtoupper($row['gender'] ?? null),
|
||||||
|
'self' => map_relationship(trim($row['relation'] ?? null)) === 'self' ? 1 : 0,
|
||||||
|
|
||||||
|
'tpa_id' => trim($row['memberId'] ?? null),
|
||||||
|
'age' => is_numeric($row['age'] ?? null) ? (int) $row['age'] : null,
|
||||||
|
|
||||||
|
'is_active' => 1,
|
||||||
|
'created_by' => $file_info[0]['created_by'] ?? null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
// log_message('error','HEALTH_INDIA - COUNT' . count($mappedRows));
|
||||||
|
// print_rr($mappedRows);//die();
|
||||||
|
$result = $tpaApiDataModel->insertBatchWithChunkLog($mappedRows,500,('FILE_ID_'.$file_id));
|
||||||
|
// unlink($file_array['json_file_path']); // delete temp json file
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -191,14 +191,26 @@ class JobWorker extends AdminController
|
|||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\VidalApiController',
|
'handler' => 'App\Controllers\VidalApiController',
|
||||||
],
|
],
|
||||||
|
'saveVidalAPIData' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\VidalApiController',
|
||||||
|
],
|
||||||
'FhplGetBenefDetails' => [
|
'FhplGetBenefDetails' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\FhplApiController',
|
'handler' => 'App\Controllers\FhplApiController',
|
||||||
],
|
],
|
||||||
|
'saveFhplAPIData' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\FhplApiController',
|
||||||
|
],
|
||||||
'HealthIndiaGetBenefDetails' => [
|
'HealthIndiaGetBenefDetails' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\HealthIndiaApiController',
|
'handler' => 'App\Controllers\HealthIndiaApiController',
|
||||||
],
|
],
|
||||||
|
'saveHealthIndiaAPIData' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\HealthIndiaApiController',
|
||||||
|
],
|
||||||
'bdsDumpExcelFileFormatValidation' => [
|
'bdsDumpExcelFileFormatValidation' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\PolicyTransactionController',
|
'handler' => 'App\Controllers\PolicyTransactionController',
|
||||||
@ -207,22 +219,23 @@ class JobWorker extends AdminController
|
|||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\PolicyTransactionController',
|
'handler' => 'App\Controllers\PolicyTransactionController',
|
||||||
],
|
],
|
||||||
'initiateWellnessOnboardJob' => [
|
'initiateWellnessOnboardJob' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\EmployeeController',
|
'handler' => 'App\Controllers\EmployeeController',
|
||||||
], 'saveMediAssitAPIData' => [
|
],
|
||||||
|
'saveMediAssitAPIData' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\MediAssistApiController',
|
'handler' => 'App\Controllers\MediAssistApiController',
|
||||||
],
|
],
|
||||||
'bulkGenerateEcardAndStoreinS3' => [
|
'bulkGenerateEcardAndStoreinS3' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\EmployeeController',
|
'handler' => 'App\Controllers\EmployeeController',
|
||||||
],
|
],
|
||||||
'bulkEcardDownloadAsZipFromS3' => [
|
'bulkEcardDownloadAsZipFromS3' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\EmployeeController',
|
'handler' => 'App\Controllers\EmployeeController',
|
||||||
],
|
],
|
||||||
'getEmployeeEcardFromTmpFolderAndZipToS3' => [
|
'getEmployeeEcardFromTmpFolderAndZipToS3' => [
|
||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\EmployeeController',
|
'handler' => 'App\Controllers\EmployeeController',
|
||||||
]
|
]
|
||||||
|
|||||||
@ -955,8 +955,54 @@ class VidalApiController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveVidalAPIData($array)
|
||||||
|
{
|
||||||
|
$file_id = $array['file_id'];
|
||||||
|
$json = file_get_contents($array['json_file_path']);
|
||||||
|
$records = json_decode($json, true);
|
||||||
|
|
||||||
|
// log_message('error','FHPL - saveFhplAPIData' . json_encode($array));//die();
|
||||||
|
$file_model = new BatchFileModel();
|
||||||
|
// $file_model = model(BatchFileModel::class);
|
||||||
|
$file_info = $file_model->where('id', $file_id)->find();
|
||||||
|
|
||||||
|
// $tpaApiDataModel = new TpaApiDataModel();
|
||||||
|
$tpaApiDataModel = model(TpaApiDataModel::class);
|
||||||
|
|
||||||
|
|
||||||
|
//deactivate old data
|
||||||
|
$tpaApiDataModel->set('is_active', 0)->where('file_id', $file_id)->update();
|
||||||
|
|
||||||
|
//covert tpa data to our model data
|
||||||
|
$mappedRows = [];
|
||||||
|
|
||||||
|
foreach ($records as $row) {
|
||||||
|
|
||||||
|
$mappedRows[] = [
|
||||||
|
'file_id' => $file_id, // ← pass from controller
|
||||||
|
'emp_code' => trim($row['empNo'] ?? ''),
|
||||||
|
|
||||||
|
'name' => trim($row['name'] ?? ''),
|
||||||
|
'dob' => !empty($row['dob'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $row['dob']))) : null,
|
||||||
|
|
||||||
|
'relation' => trim(strtolower($row['relationship'] ?? '')),
|
||||||
|
'gender' => format_gender_v2($row['gender'] ?? null),
|
||||||
|
'self' => strtolower($row['relationship'] ?? '') === 'self' ? 1 : 0,
|
||||||
|
|
||||||
|
'tpa_id' => trim($row['enrollmentId'] ?? null),
|
||||||
|
'age' => is_numeric($row['age'] ?? null) ? (int) $row['age'] : null,
|
||||||
|
|
||||||
|
'is_active' => 1,
|
||||||
|
'created_by' => $file_info[0]['created_by'] ?? null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// log_message('error','FHPL - COUNT' . count($mappedRows));
|
||||||
|
$result = $tpaApiDataModel->insertBatchWithChunkLog($mappedRows,500,('FILE_ID_'.$file_id));
|
||||||
|
// unlink($file_array['json_file_path']); // delete temp json file
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1161,7 +1161,46 @@ if (!function_exists('clear_cd_balance_session')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('format_gender_v2')) {
|
||||||
|
function format_gender_v2($gender) {
|
||||||
|
if (empty($gender)) return null;
|
||||||
|
|
||||||
|
$g = strtoupper(trim($gender));
|
||||||
|
|
||||||
|
// Direct-ah check pannuvom
|
||||||
|
if (str_starts_with($g, 'M')) return 'M'; // Male, M
|
||||||
|
if (str_starts_with($g, 'F')) return 'F'; // Female, F
|
||||||
|
|
||||||
|
// Others, Transgender, O - ivatrai 'O' ena return seiyum
|
||||||
|
if (str_starts_with($g, 'O') || str_starts_with($g, 'T')) {
|
||||||
|
return 'O';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $g; // Vera ethuvum illaiyengil original-aiye return pannum
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('map_relationship')) {
|
||||||
|
/**
|
||||||
|
* Employee -> self, WIFE -> spouse ena maatri return seiyum.
|
||||||
|
*/
|
||||||
|
function map_relationship($relation) {
|
||||||
|
if (empty($relation)) return '';
|
||||||
|
|
||||||
|
// Case prechanai varaamal irukka lowercase-kku maatri check seivom
|
||||||
|
$r = strtolower(trim($relation));
|
||||||
|
|
||||||
|
if ($r == 'employee') {
|
||||||
|
return 'self';
|
||||||
|
}
|
||||||
|
else if ($r == 'wife') {
|
||||||
|
return 'spouse';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Matra anaithu relationship-um iruppathu polave (Original-aga) return aagum
|
||||||
|
return $relation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user