GWM : code merge

This commit is contained in:
Gowtham M 2025-12-20 11:36:06 +05:30
parent 66ed0a898c
commit 782ba26f1a
3 changed files with 202 additions and 34 deletions

View File

@ -762,7 +762,7 @@ $routes->get('claimStatus','VidalApiController::claimStatus');
$routes->get('EcardRequest','MediAssistApiController::EcardRequest');
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
$routes->get('GetBenefDetails','MediAssistApiController::GetBenefDetails');
$routes->get('ClaimDetail','MediAssistApiController::ClaimDetail');
$routes->get('ClaimDetail','VidalApiController::ClaimDetail');
$routes->get('SubmitClaim','MediAssistApiController::SubmitClaim');
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');

View File

@ -722,6 +722,155 @@ class MediAssistApiController extends BaseController
}
public function ClaimStatusUpdate()
{
helper('api');
$url = getenv('MEDI_ASSIST_API_BASE_URL_CLAIMSTATUS');
$method = 'POST';
$headers = [
'Content-Type: application/json',
'Username:' . getenv('MEDI_ASSIST_API_USERNAME'),
'Password:' . getenv('MEDI_ASSIST_API_PASSWORD'),
];
// Fetch ticket master details
$TicketData = $this->db->table('ticket_master tm')
->select("
tm.id,
tm.tpa_no as memberId,
tm.tpa_claim_push_reference_no as claimRefNo,
cp.policy_no as policyNo,
cp.policy_start_date as startDate,
cp.policy_end_date as endDate,
e.emp_code as employeeCode
")
->join('employees e', 'e.id = tm.emp_id', 'left')
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
->get()
->getRowArray();
if (!$TicketData) {
return $this->response->setJSON(['status' => false,'message' => 'Claims not found' ]);
}
foreach ($TicketData as $key => $ticket)
{
$claimId = $ticket['id'];
if (!$ticket) {
return $this->response->setJSON(['status' => false,'message' => 'Invalid Claim ID' ]);
}
// REQUEST BODY
if($ticket['claimRefNo'] != null)
{
$body = [
"policyNo" => $ticket['policyNo'] ?? "",
"startDate" => "",
"endDate" => "",
"employeeCode" => $ticket['employeeCode'] ?? "",
"memberID" => "",
"claimNo" => "",
"claimRefNo" => $ticket['claimRefNo'] ?? "",
];
}else{
$body = [
"policyNo" => $ticket['policyNo'] ?? "",
"startDate" => "",
"endDate" => "",
"employeeCode" => $ticket['employeeCode'] ?? "",
"memberID" => "",
"claimNo" => "",
"claimRefNo" => "",
];
}
// CALL API
$response = call_third_party_api($url, $method, $headers, $body);
if ($response['status'] != true || empty($response['data']['claimsData'][0])) {
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
return $this->response->setJSON(['status' => false,'message' => 'API call failed.','data' => $response]);
}
// Extract claim status
$claimData = $response['data']['claimsData'][0];
$currentStatus = $claimData['claim_Current_Status'] ?? '';
$tpa_claim_no = $claimData['tpA_CLAIM_NO'] ?? '';
// VALID STATUS LIST
$validStatuses = [
"Claim Received" => 1,
"In Progress" => 5,
"Processed" => 11,
"Claim Paid" => 11,
"Denied" => 13,
"Cancelled" => 13,
"Information Awaited" => 4,
"Confirmation Awaited" => 4,
"Information Awaited Reminder" => 4,
"Information Awaited Final Reminder" => 4,
"Insurer Concurrence Awaited" => 6,
"Closed" => 12,
"Physical Documents Awaited" => 9,
"Processed - Payment Initiated" => 10,
"Processed - Transaction Failed" => 10,
"Processed - Account Details Updated" => 10,
"Processed - Debit Note Raised With Insurer for Payment"=> 10,
"Processed - Payment Initiated by Insurer" => 10,
"Payment - Refunded to Insurer" => 14,
"Processed - Processing Payment" => 10,
"Processed - Physical Documents Awaited" => 9,
// Extra Mappings (based on your DB list)
"NON ID" => 1,
"ID NOT GENERATED" => 2,
"CDA" => 3,
"REJECTED" => 8,
"APPROVED" => 9,
"PAYMENT INITIATED" => 10,
"SETTLED" => 11,
"RETURNED" => 14,
"UNDER PROCESS - TPA" => 61,
"DENIAL REVIEW AWAITED" => 66,
];
// Maping tpa claim status with local claim Status
if (isset($validStatuses[$currentStatus]))
{
$updateArray = ['claim_status_id' => $validStatuses[$currentStatus] , 'tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
}else{
$updateArray = ['tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
}
// UPDATE ticket_master
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
// LOG UPDATE
log_message('info', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
}
return $this->response->setJSON([
'status' => true,
'message' => 'Claim status updated.',
'updated_status' => $currentStatus,
'api_response' => $response
]);
}

View File

@ -400,6 +400,58 @@ class VidalApiController extends BaseController
return ['status' => 'success','data' => $decryptedData["redirectUrl"]];
}
public function ClaimDetail($claimId = null)
{
helper('api');
$url = getenv('VIDAL_API_BASE_URL').'/claims/claim-dependent-info';
$method = 'POST';
$headers = [
'Content-Type: application/json',
'Ocp-Apim-Subscription-Key:' .getenv('VIDAL_API_SUBSCRIPTION_KEY').'',
];
// Fetch ticket master details
$ticket = $this->db->table('ticket_master tm')
->select("
tm.id,
tm.tpa_no as memberId,
tm.tpa_claim_push_reference_no as claimRefNo,
cp.policy_no as policyNo,
cp.policy_start_date as startDate,
cp.policy_end_date as endDate,
e.emp_code as employeeCode
")
->join('employees e', 'e.id = tm.emp_id', 'left')
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
->where('tm.id', $claimId)
->get()
->getRowArray();
$body = [
'empNO' => "",
'tpaCardID' => "",
'claimID' => "BLR-0284-CL-9349459",
'emailID' => "",
'mobileNO' => "",
];
$response = call_third_party_api($url, $method, $headers, $body);
if($response['status'] != true){
return $this->response->setJSON([
'status' => false,
'message' => 'failed.',
'data' => $response
]);
}
return $this->response->setJSON($response);
}
//----------yet to start only submit claim given
@ -452,40 +504,7 @@ class VidalApiController extends BaseController
}
public function claimStatus ($claimId = null)
{
helper('api');
$url = getenv('VIDAL_API_BASE_URL').'/claims/claim-dependent-info';
$method = 'POST';
$headers = [
'Content-Type: application/json',
'Ocp-Apim-Subscription-Key:' .getenv('VIDAL_API_SUBSCRIPTION_KEY').'',
];
$body = [
'empNO' => "",
'tpaCardID' => "",
'claimID' => "BLR-0284-CL-9349459",
'emailID' => "",
'mobileNO' => "",
];
$response = call_third_party_api($url, $method, $headers, $body);
if($response['status'] != true){
return $this->response->setJSON([
'status' => false,
'message' => 'failed.',
'data' => $response
]);
}
return $this->response->setJSON($response);
}
public function hospitalNetwork(){