Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2025-12-09 16:43:30 +05:30
commit 39e47e7f12
2 changed files with 98 additions and 128 deletions

View File

@ -219,6 +219,32 @@ class ApiServiceController extends BaseController
}
}
// get Claim details
public function getClaimStatus()
{
$claimId = $this->request->getGet('claim_id');
$data = $this->db->table('ticket_master tm')
->select('tm.id,tm.tpa_id ')->where('tm.id', $claimId)->get()->getRowArray(); // single record
if($data){
$tpaID = $data['tpa_id'];
if ($tpaID == $this->medi_assist_primary_key) { // MediAssist
$mediAssistController = new MediAssistApiController();
return $mediAssistController->ClaimDetail($claimId);
}else{
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
}
}
}
public function getWellnessUrl()
{
@ -314,7 +340,7 @@ class ApiServiceController extends BaseController
}
}
function getSSORedirectUrl($email = 'user@example.com')
function getSSORedirectUrl($email = 'test@getvisitapp.com')
{
log_message('info', "SSO: Starting authentication for email: $email");

View File

@ -455,7 +455,7 @@ class MediAssistApiController extends BaseController
}
}
public function ClaimDetail($claimId = 585)
public function ClaimDetail($claimId = null) // 585 this id for test
{
helper('api');
@ -490,22 +490,38 @@ class MediAssistApiController extends BaseController
}
// REQUEST BODY
$body = [
"policyNo" => $ticket['policyNo'] ?? "",
"startDate" => $ticket['startDate'] ?? "",
"endDate" => $ticket['endDate'] ?? "",
"employeeCode" => $ticket['employeeCode'] ?? "",
"memberID" => $ticket['memberId'] ?? "",
"claimNo" => "",
"claimRefNo" => $ticket['claimRefNo'] ?? "",
];
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" => "",
];
}
// dd($body);
// $body = [
// "policyNo" => "97000063250400000031",
// "startDate" => "",
// "endDate" => "",
// "startDate" => "31/08/2025",
// "endDate" => "01/09/2025",
// "employeeCode" => "CITPL120193",
// "memberID" => "",
// "claimNo" => "",
@ -531,42 +547,54 @@ class MediAssistApiController extends BaseController
// VALID STATUS LIST
$validStatuses = [
"Claim Received",
"In Progress",
"Processed",
"Claim Paid",
"Denied",
"Cancelled",
"Information Awaited",
"Confirmation Awaited",
"Information Awaited Reminder",
"Information Awaited Final Reminder",
"Insurer Concurrence Awaited",
"Closed",
"Physical Documents Awaited",
"Processed - Payment Initiated",
"Processed - Transaction Failed",
"Processed - Account Details Updated",
"Processed - Debit Note Raised With Insurer for Payment",
"Processed - Payment Initiated by Insurer",
"Payment - Refunded to Insurer",
"Processed - Processing Payment",
"Processed - Physical Documents Awaited",
"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,
];
// Validate Status
if (!in_array($currentStatus, $validStatuses)) {
log_message('error', "Invalid claim status received: $currentStatus for ticket ID: $claimId");
$currentStatus = "Unknown";
// Maping tpa claim status with local claim Status
if (isset($validStatuses[$currentStatus]))
{
$updateArray = ['claim_status_id' => $validStatuses[$currentStatus] , 'tpa_claim_status' => $currentStatus , 'updated_at' => date('Y-m-d H:i:s')];
}else{
$updateArray = ['tpa_claim_status' => $currentStatus , 'updated_at' => date('Y-m-d H:i:s')];
}
// UPDATE ticket_master
$this->db->table('ticket_master')
->where('id', $claimId)
->update([
'tpa_claim_status' => $currentStatus,
'updated_at' => date('Y-m-d H:i:s')
]);
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
// LOG UPDATE
log_message('info', "Updated ticket ID $claimId with claim status: $currentStatus");
@ -579,90 +607,6 @@ class MediAssistApiController extends BaseController
]);
}
// public function ClaimDetail2 ($claimId = null)
// {
// 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 the data from DB
// $data = $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.id as empId,
// 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(); // single record
// $body = [
// "policyNo" => "97000063250400000031",
// "startDate" => "",
// "endDate" => "",
// "employeeCode" => "CITPL120193",
// "memberID" => "",
// "claimNo" => "",
// "claimRefNo" => "HOSP4078102577_16092025111030"
// ];
// $response = call_third_party_api($url, $method, $headers, $body);
// if($response['status'] != true){
// return $this->response->setJSON([
// 'status' => false,
// 'message' => 'failed.',
// 'data' => $response
// ]);
// }
// $claimStatuses = [
// "Claim Received",
// "In Progress",
// "Processed",
// "Claim Paid",
// "Denied",
// "Cancelled",
// "Information Awaited",
// "Confirmation Awaited",
// "Information Awaited Reminder",
// "Information Awaited Final Reminder",
// "Insurer Concurrence Awaited",
// "Closed",
// "Physical Documents Awaited",
// "Processed - Payment Initiated",
// "Processed - Transaction Failed",
// "Processed - Account Details Updated",
// "Processed - Debit Note Raised With Insurer for Payment",
// "Processed - Payment Initiated by Insurer",
// "Payment - Refunded to Insurer",
// "Processed - Processing Payment",
// "Processed - Physical Documents Awaited",
// ];
// return $this->response->setJSON($response);
// }
public function IRSubmission ($claimId = null)
{