From 0d636aff709b231e11f176f3af558d7ff29ee865 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Mon, 23 Feb 2026 14:20:33 +0530 Subject: [PATCH] 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'),