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() 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"); 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'); helper('api');
@ -490,22 +490,38 @@ class MediAssistApiController extends BaseController
} }
// REQUEST BODY // REQUEST BODY
$body = [ if($ticket['claimRefNo'] != null)
"policyNo" => $ticket['policyNo'] ?? "", {
"startDate" => $ticket['startDate'] ?? "", $body = [
"endDate" => $ticket['endDate'] ?? "", "policyNo" => $ticket['policyNo'] ?? "",
"employeeCode" => $ticket['employeeCode'] ?? "", "startDate" => "",
"memberID" => $ticket['memberId'] ?? "", "endDate" => "",
"claimNo" => "", "employeeCode" => $ticket['employeeCode'] ?? "",
"claimRefNo" => $ticket['claimRefNo'] ?? "", "memberID" => "",
]; "claimNo" => "",
"claimRefNo" => $ticket['claimRefNo'] ?? "",
];
}else{
$body = [
"policyNo" => $ticket['policyNo'] ?? "",
"startDate" => "",
"endDate" => "",
"employeeCode" => $ticket['employeeCode'] ?? "",
"memberID" => "",
"claimNo" => "",
"claimRefNo" => "",
];
}
// dd($body); // dd($body);
// $body = [ // $body = [
// "policyNo" => "97000063250400000031", // "policyNo" => "97000063250400000031",
// "startDate" => "", // "startDate" => "31/08/2025",
// "endDate" => "", // "endDate" => "01/09/2025",
// "employeeCode" => "CITPL120193", // "employeeCode" => "CITPL120193",
// "memberID" => "", // "memberID" => "",
// "claimNo" => "", // "claimNo" => "",
@ -531,42 +547,54 @@ class MediAssistApiController extends BaseController
// VALID STATUS LIST // VALID STATUS LIST
$validStatuses = [ $validStatuses = [
"Claim Received", "Claim Received" => 1,
"In Progress", "In Progress" => 5,
"Processed", "Processed" => 11,
"Claim Paid", "Claim Paid" => 11,
"Denied", "Denied" => 13,
"Cancelled", "Cancelled" => 13,
"Information Awaited",
"Confirmation Awaited", "Information Awaited" => 4,
"Information Awaited Reminder", "Confirmation Awaited" => 4,
"Information Awaited Final Reminder", "Information Awaited Reminder" => 4,
"Insurer Concurrence Awaited", "Information Awaited Final Reminder" => 4,
"Closed", "Insurer Concurrence Awaited" => 6,
"Physical Documents Awaited", "Closed" => 12,
"Processed - Payment Initiated",
"Processed - Transaction Failed", "Physical Documents Awaited" => 9,
"Processed - Account Details Updated", "Processed - Payment Initiated" => 10,
"Processed - Debit Note Raised With Insurer for Payment", "Processed - Transaction Failed" => 10,
"Processed - Payment Initiated by Insurer", "Processed - Account Details Updated" => 10,
"Payment - Refunded to Insurer", "Processed - Debit Note Raised With Insurer for Payment"=> 10,
"Processed - Processing Payment", "Processed - Payment Initiated by Insurer" => 10,
"Processed - Physical Documents Awaited", "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)) { // Maping tpa claim status with local claim Status
log_message('error', "Invalid claim status received: $currentStatus for ticket ID: $claimId"); if (isset($validStatuses[$currentStatus]))
$currentStatus = "Unknown"; {
$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 // UPDATE ticket_master
$this->db->table('ticket_master') $this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
->where('id', $claimId)
->update([
'tpa_claim_status' => $currentStatus,
'updated_at' => date('Y-m-d H:i:s')
]);
// LOG UPDATE // LOG UPDATE
log_message('info', "Updated ticket ID $claimId with claim status: $currentStatus"); 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) public function IRSubmission ($claimId = null)
{ {