GWM : health india integration

This commit is contained in:
Gowtham M 2026-02-13 17:58:36 +05:30
parent 77e6016fd3
commit 29a50dd077
6 changed files with 95 additions and 46 deletions

View File

@ -65,7 +65,7 @@ class Filters extends BaseConfig
'before' => [
'HttpRequestLog' => ['except' => 'cli/*'],
'Cors',
'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob','getCommission']],
// 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob','getCommission']],
'SecurityInputFilter' => ['except' => ['/client/notification/create','/ticket/crud_mail_template/*','test_mail','leads/sendMail'] ],
'GlobalPostFileUploadGuard'
// 'csrf',

View File

@ -783,10 +783,10 @@ $routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
//Third party - testing route
$routes->get('FhplGetBenefDetails','FhplApiController::FhplGetBenefDetails');
$routes->get('EcardRequest','FhplApiController::EcardRequest');
$routes->get('EcardRequest','HealthIndiaApiController::EcardRequest');
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
$routes->get('VidalGetBenefDetails','VidalApiController::VidalGetBenefDetails');
$routes->get('ClaimDetail','FhplApiController::ClaimDetail');
$routes->get('ClaimDetail','HealthIndiaApiController::ClaimDetail');
$routes->get('SubmitClaim','HealthIndiaApiController::SubmitClaim');
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');

View File

@ -64,6 +64,10 @@ class ApiServiceController extends BaseController
{ // fhpl
$fhplApiController = new FhplApiController;
return $fhplApiController->SubmitClaim($claimId);
}else if ($tpaID == $this->health_india_primary_key)
{ // health india
$healthIndiaApiController = new HealthIndiaApiController;
return $healthIndiaApiController->SubmitClaim($claimId);
}else{
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
}
@ -145,6 +149,12 @@ class ApiServiceController extends BaseController
$fhplApiController = new FhplApiController;
$data['eCardDownload'] = $fhplApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] );
}else if($employee_policy[0]['tpa_primary_id'] == $this->health_india_primary_key)// health india
{
$healthIndiaApiController = new HealthIndiaApiController;
$data['eCardDownload'] = $healthIndiaApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] );
}else{
if($type == "download"){
@ -292,6 +302,17 @@ class ApiServiceController extends BaseController
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
}else if ($tpa_id == $this->health_india_primary_key) // health india
{
$file_id = $fileModel->insert($data);
log_message('error', "Files table inserted successfully, File id : {$file_id}");
// $healthIndiaApiController = new HealthIndiaApiController;
// $healthIndiaApiController->HealthIndiaGetBenefDetails( [ 'polict_no' => $policy_no, 'file_id' =>$file_id ] );
$r = Jobs::addJob(['job_name' => 'HealthIndiaGetBenefDetails', 'payload' => ['policy_no' => $policy_no, 'file_id' => $file_id, 'client_policy_id' => $policy_id, 'return_type' => 'job']]);
log_message('error', "HealthIndiaGetBenefDetails job pushed successfully.");
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
}else{
return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA not found ','data' => [] ]);
}
@ -328,6 +349,12 @@ class ApiServiceController extends BaseController
$res = $fhplApiController->ClaimDetail($claimId);
return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]);
}else if ($tpaID == $this->health_india_primary_key) { // health india
$healthIndiaApiController = new HealthIndiaApiController;
$res = $healthIndiaApiController->ClaimDetail($claimId);
return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]);
}else{
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
$message = "This TPA has no API service enabled";

View File

@ -79,7 +79,7 @@ class HealthIndiaApiController extends BaseController
]);
}
public function SubmitClaim($claimId = 515)
public function SubmitClaim($claimId = 729)
{
helper('api');
@ -205,7 +205,7 @@ class HealthIndiaApiController extends BaseController
$response = call_third_party_api($url, 'POST', $headers, $body);
dd($response);
// dd($response);
log_message('error', 'TPA CLAIM PUSH HEALTH_INDIA RESPONSE | claimId: ' . $claimId . ' | response: ' . json_encode($response));
@ -239,7 +239,7 @@ class HealthIndiaApiController extends BaseController
return;
}
public function ClaimDetail($claimId = null)
public function ClaimDetail($claimId = 729)
{
helper('api');
@ -284,6 +284,8 @@ class HealthIndiaApiController extends BaseController
$response = call_third_party_api($url, 'POST', $headers, $body);
// dd($response);
log_message('error', 'CLAIM STATUS HEALTH_INDIA | claimId: ' . $claimId . ' | Response: ' . json_encode($response));
if (empty($response['data']['result'][0])) {
@ -368,9 +370,9 @@ class HealthIndiaApiController extends BaseController
$url = getenv('HEALTH_INDIA_BASE_URL') . "/Member/GetMemberEcard";
$body = [
"policY_NUMBER" => $policyNo,
"employeE_CODE" => $employeeId,
"membeR_ID" => $memberId
"policY_NUMBER" => $policyNo ,//'141600_POLICY_AWAITED',
"employeE_CODE" => $employeeId,//'DECP000',
"membeR_ID" => $memberId//'19662410E',
];
$headers = [
@ -416,8 +418,8 @@ class HealthIndiaApiController extends BaseController
try {
helper('api');
$policyNo = $requestData['policy_no'] ?? '141600_POLICY_AWAITED';
$client_policy_id = $requestData['client_policy_id'] ?? 6473;
$policyNo = $requestData['policy_no'] ?? null; //'141600_POLICY_AWAITED';
$client_policy_id = $requestData['client_policy_id'] ?? null; // 6473;
@ -442,24 +444,24 @@ class HealthIndiaApiController extends BaseController
log_message('error', "TPA ID PULL HEALTH_INDIA | called for policy_no: {$policyNo}, client_policy_id: {$client_policy_id}");
// Fetch file download dates
// $batchFiles = $this->db->table('batch_files f')
// ->select("f.created_at")
// ->where('f.client_policy_id', $client_policy_id)
// ->where('f.insurer_or_tpa', 'tpa')
// ->where('f.actions', 'export')
// ->get()
// ->getResultArray();
$batchFiles = $this->db->table('batch_files f')
->select("f.created_at")
->where('f.client_policy_id', $client_policy_id)
->where('f.insurer_or_tpa', 'tpa')
->where('f.actions', 'export')
->get()
->getResultArray();
// if (empty($batchFiles)) {
// log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request');
// if ($function_calling_type == "job") {
// return ['status' => false, 'message' => 'batchFiles not found'];
// } else {
// return $this->respond(['status' => false, 'message' => 'batchFiles not found']);
// }
// }
if (empty($batchFiles)) {
log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request');
if ($function_calling_type == "job") {
return ['status' => false, 'message' => 'batchFiles not found'];
} else {
return $this->respond(['status' => false, 'message' => 'batchFiles not found']);
}
}
// Generate Health India Token
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
@ -489,9 +491,9 @@ class HealthIndiaApiController extends BaseController
$response = call_third_party_api($url, 'POST', $headers, $body);
dd($response);
// dd($response);
log_message('error', "TPA ID PULL HEALTH_INDIA | API Response: " . json_encode($response));
log_message('error', "TPA ID PULL HEALTH_INDIA | API Response Received ");
if (($response['status'] ?? false) !== true) {
log_message('error', 'HEALTH_INDIA API FAILED | response: ' . json_encode($response));
@ -560,11 +562,22 @@ class HealthIndiaApiController extends BaseController
$employeePolicyModel = new EmployeePolicyModel();
$employeePolicyData = $employeePolicyModel
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employee_polices.tpa_id IS NULL')
->findAll();
$employeePolicyData = $employeePolicyModel
->select('
employees.*,
employee_polices.id as emp_policy_id,
employee_polices.client_policy_id,
')
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.is_active', 1)
->where('employee_polices.status', 'active')
->where('employees.is_active', 1)
->where('employees.emp_status', 'active')
->where('employee_polices.tpa_id IS NULL')
->where('employee_polices.client_policy_id', $client_policy_id)
->findAll();
// echo (string) $employeePolicyModel->db->getLastQuery();
// dd($employeePolicyData);
$updated = 0;
$batch_file_success = 'success';
@ -575,10 +588,15 @@ class HealthIndiaApiController extends BaseController
foreach ($allMembers as $m) {
// Match based on: employee name, employee code, and relation
if($m['relation'] == 'Employee') { $relation = 'self'; }
else if($m['relation'] == 'WIFE') { $relation = 'spouse'; }
else { $relation = $m['relation']; }
if (
strtolower(trim($policy['name'])) === strtolower(trim($m['insured_Name'] ?? '')) &&
($policy['emp_code'] ?? '') == ($m['employeeCode'] ?? '') &&
strtolower($policy['relationship']) === strtolower($m['relation'] ?? '')
strtolower($policy['relationship']) === strtolower($relation ?? '')
) {
$hasMatchForThisPolicy = true;

View File

@ -121,29 +121,29 @@ class ICICILombardController extends AdminController
$body = [
"PolicyNumber" => "4016/PPN/A/O/53185987/00/000",
"CDBGAccountNumber" => "CD-MUM-0026",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440021",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440022",
"MemberDetails" => [
[
"MemberEmpId" => "EMPID3625564",
"MemberEmpId" => "EMPID3625565",
"DOJ" => "21-MAR-2019",
"InsuredName" => "Jeeva",
"InsuredName" => "sanjeev",
"DOB" => "7-JUL-1993",
"Relationship" => "SELF",
"Gender" => "MALE",
"DOC" => '18-Nov-2025',
"DOC" => '25-Jan-2026',
"SumInsured" => "500000",
"EmailId" => "Jeeva@GMAIL.COM",
"EmailId" => "sanjeev@GMAIL.COM",
"FlagStatus" => "A"
],
[
"MemberEmpId" => "EMPID3625564",
"MemberEmpId" => "EMPID3625565",
"DOJ" => "21-MAR-2019",
"InsuredName" => "Muthu",
"InsuredName" => "bhavya",
"DOB" => "8-AUG-1970",
"Relationship" => "MOTHER",
"Gender" => "FEMALE",
"DOC" => '18-Nov-2025',
"EmailId" => "Muthu@GMAIL.COM",
"DOC" => '25-Jan-2026',
"EmailId" => "bhavya@GMAIL.COM",
"FlagStatus" => "A"
],
]
@ -180,8 +180,8 @@ class ICICILombardController extends AdminController
$body = [
"PolicyNumber" => "4016/PPN/A/O/53185987/00/000",
"BatchId" => "3727144",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440021"
"BatchId" => "3728144",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440022"
];
$response = call_third_party_api($url, 'POST', $headers, $body, true);
@ -215,7 +215,7 @@ class ICICILombardController extends AdminController
$body = [
"PolicyNumber" => "4016/PPN/A/O/53185987/00/000",
"IMID" => "201580517901",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440020"
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440022"
];
$response = call_third_party_api($url, 'POST', $headers, $body, true);

View File

@ -195,6 +195,10 @@ class JobWorker extends AdminController
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\FhplApiController',
],
'HealthIndiaGetBenefDetails' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\HealthIndiaApiController',
],
'bdsDumpExcelFileFormatValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\PolicyTransactionController',