From 4766e33be2f0b383c35162baa62065850eb97635 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Mon, 23 Feb 2026 11:45:01 +0530 Subject: [PATCH 1/2] vidal submit api : GWM --- app/Config/Routes.php | 2 +- app/Controllers/VidalApiController.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6f3b70ca..43d45fac 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -788,7 +788,7 @@ $routes->get('EcardRequest','HealthIndiaApiController::EcardRequest'); $routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork'); $routes->get('VidalGetBenefDetails','VidalApiController::VidalGetBenefDetails'); $routes->get('ClaimDetail','VidalApiController::ClaimDetail'); -$routes->get('SubmitClaim','HealthIndiaApiController::SubmitClaim'); +$routes->get('SubmitClaim','VidalApiController::SubmitClaim'); $routes->get('IntimateClaim','MediAssistApiController::IntimateClaim'); $routes->get('IRSubmission','MediAssistApiController::IRSubmission'); $routes->get('ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate'); diff --git a/app/Controllers/VidalApiController.php b/app/Controllers/VidalApiController.php index e3923d71..dfa1635c 100644 --- a/app/Controllers/VidalApiController.php +++ b/app/Controllers/VidalApiController.php @@ -7,6 +7,7 @@ use App\Models\EmployeePolicyModel; use App\Models\TpaApiDataModel; use App\Controllers\BaseController; +use App\Controllers\TicketController; use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\API\ResponseTrait; @@ -15,13 +16,18 @@ class VidalApiController extends BaseController use ResponseTrait; protected $db; protected $vidal_primary_key; + protected $claim_type_array; public function __construct() { $this->db = \Config\Database::connect(); $this->vidal_primary_key = getenv('VIDAL_PRIMARY_KEY_CONSTANT'); + + $this->claim_type_array = new TicketController(); } + + function uploadFileToVidal($filePath,$filename) { @@ -115,6 +121,8 @@ class VidalApiController extends BaseController public function SubmitClaim ($claimId = null) //515 { + + // dd($claim_type_array = $this->ticketController->claimType); helper('api'); // Fetch the data from DB @@ -132,6 +140,7 @@ class VidalApiController extends BaseController tm.hospital_pin_code as hospitalPinCode, tm.hospital_phone_no as hospitalPhoneNo, tm.claim_amount as requestedAmount, + tm.claim_type, tm.tpa_no as dependentUniqueId, cp.policy_no as policyNo, e.emp_code as memberId, @@ -189,7 +198,7 @@ class VidalApiController extends BaseController 'policyNo' => $data['policyNo'], 'dependentUniqueId' => $data['dependentUniqueId'], 'typeOfClaim' => "Main hospitalization claim", - 'claimSubType' => "OPD", + 'claimSubType' => null, // "OPD", 'requestedAmount' => $data['requestedAmount'], 'ailmentType' => "Non covid", 'admissionDate' => change_date_format($data['admissionDate'], 'Y-m-d', 'd-m-Y'), From 0d636aff709b231e11f176f3af558d7ff29ee865 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Mon, 23 Feb 2026 14:20:33 +0530 Subject: [PATCH 2/2] claim type mapped to all TPA claim push : GWM --- app/Controllers/FhplApiController.php | 2 +- app/Controllers/HealthIndiaApiController.php | 25 ++++++++++++-------- app/Controllers/VidalApiController.php | 23 ++++++++++++++---- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/app/Controllers/FhplApiController.php b/app/Controllers/FhplApiController.php index 83786a81..861b0fdc 100644 --- a/app/Controllers/FhplApiController.php +++ b/app/Controllers/FhplApiController.php @@ -753,7 +753,7 @@ class FhplApiController extends BaseController $response = call_third_party_api($url,'POST',$headers,$body); 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']); } } diff --git a/app/Controllers/HealthIndiaApiController.php b/app/Controllers/HealthIndiaApiController.php index 8a27eff1..b14a1e3c 100644 --- a/app/Controllers/HealthIndiaApiController.php +++ b/app/Controllers/HealthIndiaApiController.php @@ -3,6 +3,7 @@ namespace App\Controllers; use App\Controllers\BaseController; +use App\Controllers\TicketController; use App\Models\BatchFileModel; use App\Models\EmployeePolicyModel; use App\Models\TpaApiDataModel; @@ -18,11 +19,15 @@ class HealthIndiaApiController extends BaseController use ResponseTrait; protected $db; protected $healthIndiaTpaId; + protected $claim_type_array; public function __construct() { $this->db = \Config\Database::connect(); $this->healthIndiaTpaId = getenv('HEALTH_INDIA_PRIMARY_KEY_CONSTANT'); + + $this->ticketController = new TicketController(); + $this->claim_type_array = $this->ticketController->claimType; } public function generateAuthToken() @@ -147,25 +152,25 @@ class HealthIndiaApiController extends BaseController $token = $tokenResponse['data']['result'][0]['access_token']; // Map claim type: Reimbursement or Cashless - $claimTypeMap = [ - 'reimbursement' => 'Reimbursement', - 'cashless' => 'Cashless', - ]; - $mappedClaimType = $claimTypeMap[strtolower($data['claimType'] ?? 'reimbursement')] ?? 'Reimbursement'; - // Map benefit type: IPD or OPD + // Map claim_type to benefit type (IPD / OPD) + $claimTypeValue = $this->claim_type_array[1][$data['claim_type'] ?? null] ?? null; + $benefitTypeMap = [ - 'ipd' => 'IPD', - 'opd' => 'OPD', + 'Main Hospitalization' => 'IPD', + 'Pre / Post' => 'IPD', + 'ReOpen' => 'IPD', + 'OPD' => 'OPD', ]; - $mappedBenefitType = $benefitTypeMap[strtolower($data['benefitType'] ?? 'ipd')] ?? 'IPD'; + + $mappedBenefitType = $benefitTypeMap[$claimTypeValue] ?? 'IPD'; // Build Health India Claim Submission Request (API Section 5) $body = [ "policY_NUMBER" => $data['policyNumber'], "employeE_CODE" => $data['employeeCode'], "membeR_ID" => $data['memberId'], - "claiM_TYPE" => $mappedClaimType, + "claiM_TYPE" => 'Reimbursement', "benefiT_TYPE" => $mappedBenefitType, "claimeD_AMOUNT" => (string) $data['claimedAmount'], "datE_OF_ADMISSION" => date('Y-m-d', strtotime($data['admissionDate'])), diff --git a/app/Controllers/VidalApiController.php b/app/Controllers/VidalApiController.php index dfa1635c..75525cd0 100644 --- a/app/Controllers/VidalApiController.php +++ b/app/Controllers/VidalApiController.php @@ -23,7 +23,8 @@ class VidalApiController extends BaseController $this->db = \Config\Database::connect(); $this->vidal_primary_key = getenv('VIDAL_PRIMARY_KEY_CONSTANT'); - $this->claim_type_array = new TicketController(); + $this->ticketController = new TicketController(); + $this->claim_type_array = $this->ticketController->claimType; } @@ -121,8 +122,6 @@ class VidalApiController extends BaseController public function SubmitClaim ($claimId = null) //515 { - - // dd($claim_type_array = $this->ticketController->claimType); helper('api'); // Fetch the data from DB @@ -194,11 +193,25 @@ class VidalApiController extends BaseController 'Ocp-Apim-Subscription-Key:' .getenv('VIDAL_API_SUBSCRIPTION_KEY').'', ]; + $typeOfClaim = "Main hospitalization claim"; + $allowedSubTypes = [ + 'Hospitalization', + 'OPD', + 'Health check-up', + 'Dental benefit', + 'Day care', + 'Domiciliary' + ]; + $mappedSubType = $this->claim_type_array[1][$data['claim_type'] ?? null] ?? null; + $claimSubType = in_array($mappedSubType, $allowedSubTypes, true) + ? $mappedSubType + : 'Hospitalization'; // safe default + $body = [ 'policyNo' => $data['policyNo'], 'dependentUniqueId' => $data['dependentUniqueId'], - 'typeOfClaim' => "Main hospitalization claim", - 'claimSubType' => null, // "OPD", + 'typeOfClaim' => $typeOfClaim, + 'claimSubType' => $claimSubType, 'requestedAmount' => $data['requestedAmount'], 'ailmentType' => "Non covid", 'admissionDate' => change_date_format($data['admissionDate'], 'Y-m-d', 'd-m-Y'),