claim type mapped to all TPA claim push : GWM

This commit is contained in:
Gowtham M 2026-02-23 14:20:33 +05:30
parent 44efa7467a
commit 0d636aff70
3 changed files with 34 additions and 16 deletions

View File

@ -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']);
}
}

View File

@ -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'])),

View File

@ -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'),