Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
75e59c1313
@ -446,6 +446,9 @@ class ApiServiceController extends BaseController
|
||||
if ($tpaID == $this->medi_assist_primary_key) { // MediAssist
|
||||
$mediAssistController = new MediAssistApiController();
|
||||
return $mediAssistController->IRSubmission($claimId);
|
||||
}else if ($tpaID == $this->vidal_primary_key) { // Vidal
|
||||
$vidalApiController = new VidalApiController();
|
||||
return $vidalApiController->IRSubmission($claimId);
|
||||
}else{
|
||||
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
|
||||
}
|
||||
|
||||
@ -85,6 +85,8 @@ class FhplApiController extends BaseController
|
||||
cp.policy_no as policyNo,
|
||||
e.emp_code as memberId,
|
||||
tn.note as disease,
|
||||
cf.id as fileId,
|
||||
cf.url as filePath,
|
||||
cf.url as filePath
|
||||
')
|
||||
->join('employees e', 'e.id = tm.emp_id', 'left')
|
||||
@ -102,6 +104,7 @@ class FhplApiController extends BaseController
|
||||
}
|
||||
|
||||
// Build absolute file path
|
||||
$file_id = $data['fileId'] ?? null;
|
||||
$filename = basename($data['filePath']);
|
||||
$pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename;
|
||||
|
||||
@ -182,6 +185,18 @@ class FhplApiController extends BaseController
|
||||
'tpa_claim_push_reference_no' => $fhplClaimNo,
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
// Update claim files table that file is sent to tpa for this claim
|
||||
if(!empty($file_id)){
|
||||
|
||||
$this->db->table('claim_files')
|
||||
->where('id', $file_id)
|
||||
->update([ 'is_file_sent_to_tpa' => 1 ]);
|
||||
|
||||
log_message('error','HEALTH_INDIA - Claim Push | Updating claim_files table for file_id: '.$file_id);
|
||||
}else{
|
||||
log_message('error','HEALTH_INDIA - Claim Push | No file_id found to update claim_files table.');
|
||||
}
|
||||
|
||||
log_message('error', 'FHPL - Claim Push SUCCESS | claimId: '.$claimId.' | claimNO: '.$fhplClaimNo);
|
||||
return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response];
|
||||
|
||||
@ -105,6 +105,7 @@ class HealthIndiaApiController extends BaseController
|
||||
cp.policy_no as policyNumber,
|
||||
e.emp_code as employeeCode,
|
||||
tn.note as disease,
|
||||
cf.id as fileId,
|
||||
cf.url as filePath,
|
||||
tm.claim_type as claimType,
|
||||
tm.claim_type as benefitType
|
||||
@ -130,6 +131,7 @@ class HealthIndiaApiController extends BaseController
|
||||
}
|
||||
|
||||
// Build absolute file path
|
||||
$file_id = $data['fileId'] ?? null;
|
||||
$filename = basename($data['filePath']);
|
||||
$pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename;
|
||||
|
||||
@ -231,6 +233,18 @@ class HealthIndiaApiController extends BaseController
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
// Update claim files table that file is sent to tpa for this claim
|
||||
if(!empty($file_id)){
|
||||
|
||||
$this->db->table('claim_files')
|
||||
->where('id', $file_id)
|
||||
->update([ 'is_file_sent_to_tpa' => 1 ]);
|
||||
|
||||
log_message('error','HEALTH_INDIA - Claim Push | Updating claim_files table for file_id: '.$file_id);
|
||||
}else{
|
||||
log_message('error','HEALTH_INDIA - Claim Push | No file_id found to update claim_files table.');
|
||||
}
|
||||
|
||||
log_message('error', 'HEALTH_INDIA - Claim Push SUCCESS | claimId: ' . $claimId . ' | CCN: ' . $ccn . ' | CCN_EXT: ' . $ccnExt);
|
||||
return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response];
|
||||
} else {
|
||||
|
||||
@ -42,8 +42,9 @@ class MediAssistApiController extends BaseController
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
];
|
||||
|
||||
$file_id = null;
|
||||
|
||||
//Prepare body data
|
||||
|
||||
// Fetch the data from DB
|
||||
$data = $this->db->table('ticket_master tm')
|
||||
->select('
|
||||
@ -59,6 +60,7 @@ class MediAssistApiController extends BaseController
|
||||
tm.tpa_no as memberId,
|
||||
tn.note as disease,
|
||||
tn.note as reasonForHospitalization,
|
||||
cf.id as fileId,
|
||||
cf.url as fileName,
|
||||
cf.url as filePath
|
||||
')
|
||||
@ -83,6 +85,7 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
if ($fileDir) {
|
||||
$downloadUrl = base_url('fileDownload?file_path=').$fileDir;
|
||||
$file_id = $data['fileId'] ?? null;
|
||||
} else {
|
||||
$downloadUrl = '';
|
||||
}
|
||||
@ -152,10 +155,23 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
log_message('error','MEDI_ASSIST - Claim Push SUCCESS | claimId: '.$claimId.' | claimReferenceNo: '.$claimRef);
|
||||
|
||||
// Update claim reference number in ticket_master
|
||||
$this->db->table('ticket_master')
|
||||
->where('id',$claimId)
|
||||
->update([ 'tpa_claim_push_reference_no' => $claimRef ]);
|
||||
|
||||
// Update claim files table that file is sent to tpa for this claim
|
||||
if(!empty($file_id)){
|
||||
|
||||
$this->db->table('claim_files')
|
||||
->where('id', $file_id)
|
||||
->update([ 'is_file_sent_to_tpa' => 1 ]);
|
||||
|
||||
log_message('error','MEDI_ASSIST - Claim Push | Updating claim_files table for file_id: '.$file_id);
|
||||
}else{
|
||||
log_message('error','MEDI_ASSIST - Claim Push | No file_id found to update claim_files table.');
|
||||
}
|
||||
|
||||
return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response];
|
||||
|
||||
} else {
|
||||
@ -695,12 +711,14 @@ class MediAssistApiController extends BaseController
|
||||
$fileData = $this->db->table('claim_files f')
|
||||
->where('f.ticket_id', $claimId)
|
||||
->where('f.docs_for_ir', 1)
|
||||
->where('f.file_type', 2) // PDF
|
||||
->where('f.file_type', 2)
|
||||
->where('f.is_file_sent_to_tpa', 0)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
|
||||
$Attachments = [];
|
||||
$tpaSentFileIds = [];
|
||||
|
||||
if (count($fileData)) {
|
||||
foreach ($fileData as $file) {
|
||||
@ -722,6 +740,9 @@ class MediAssistApiController extends BaseController
|
||||
"AttachmentName" => $filename,
|
||||
"AttachmentPath" => $downloadUrl
|
||||
];
|
||||
|
||||
$tpaSentFileIds[] = $file['id']; // Collect file IDs to update later
|
||||
|
||||
} else {
|
||||
log_message('error',"MEDI_ASSIST - IR Submission Missing File URL → file_id={$file['id']}");
|
||||
}
|
||||
@ -768,6 +789,18 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
log_message('error',"MEDI_ASSIST - IR Submission SUCCESS → ClaimID={$ticket['ClaimID']}");
|
||||
|
||||
// 6. UPDATE FILES AS SENT TO TPA
|
||||
if(count($tpaSentFileIds) > 0){
|
||||
|
||||
$this->db->table('claim_files')
|
||||
->whereIn('id', $tpaSentFileIds)
|
||||
->update(['is_file_sent_to_tpa' => 1]);
|
||||
|
||||
log_message('error',"MEDI_ASSIST - IR Submission | Updating claim_files for file IDs: " . implode(', ', $tpaSentFileIds));
|
||||
} else {
|
||||
log_message('error',"MEDI_ASSIST - IR Submission | No files to update as sent to TPA");
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => true,
|
||||
'message' => 'IR Submitted successfully',
|
||||
|
||||
@ -156,6 +156,7 @@ class VidalApiController extends BaseController
|
||||
e.emp_code as memberId,
|
||||
tn.note as disease,
|
||||
tn.note as reasonForHospitalization,
|
||||
cf.id as cfFileId,
|
||||
cf.url as fileName,
|
||||
cf.url as filePath,
|
||||
pt.policy_type as typeOfClaim,
|
||||
@ -195,6 +196,7 @@ class VidalApiController extends BaseController
|
||||
}
|
||||
|
||||
$fileId = $upload['fileId'];
|
||||
$tpa_sent_file_id = $data['cfFileId'] ?? null;
|
||||
// $url = 'https://devapigw.vidalhealthtpa.com/partner-integration/api/claims/submit';
|
||||
$url = getenv('VIDAL_API_BASE_URL').'/claims/submit';
|
||||
$method = 'POST';
|
||||
@ -299,6 +301,18 @@ class VidalApiController extends BaseController
|
||||
->where('id',$claimId)
|
||||
->update([ 'tpa_claim_push_reference_no' => $claimInwardNO , 'tpa_claim_id' => $claimNO , 'claim_number' => $claimNO ]);
|
||||
|
||||
// Update claim files table that file is sent to tpa for this claim
|
||||
if(!empty($tpa_sent_file_id)){
|
||||
|
||||
$this->db->table('claim_files')
|
||||
->where('id', $tpa_sent_file_id)
|
||||
->update([ 'is_file_sent_to_tpa' => 1 ]);
|
||||
|
||||
log_message('error','MEDI_ASSIST - Claim Push | Updating claim_files table for file_id: '.$tpa_sent_file_id);
|
||||
}else{
|
||||
log_message('error','MEDI_ASSIST - Claim Push | No file_id found to update claim_files table.');
|
||||
}
|
||||
|
||||
return ['status' => true, 'message' => 'Claim Push SUCCESS'];
|
||||
|
||||
} else {
|
||||
@ -1664,7 +1678,8 @@ class VidalApiController extends BaseController
|
||||
$fileData = $this->db->table('claim_files f')
|
||||
->where('f.ticket_id', $claimId)
|
||||
->where('f.docs_for_ir', 1)
|
||||
->where('f.file_type', 2) // PDF
|
||||
->where('f.file_type', 2)
|
||||
->where('f.is_file_sent_to_tpa', 0)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
@ -1679,6 +1694,7 @@ class VidalApiController extends BaseController
|
||||
|
||||
// 3. UPLOAD FILES TO VIDAL
|
||||
$fileIdList = [];
|
||||
$tpaSentFileIds = [];
|
||||
|
||||
foreach ($fileData as $file) {
|
||||
|
||||
@ -1702,6 +1718,7 @@ class VidalApiController extends BaseController
|
||||
}
|
||||
|
||||
$fileIdList[] = $upload['fileId']; // deeplink URL
|
||||
$tpaSentFileIds[] = $file['id']; // local file ID for updating
|
||||
}
|
||||
|
||||
if (empty($fileIdList)) {
|
||||
@ -1757,6 +1774,18 @@ class VidalApiController extends BaseController
|
||||
|
||||
log_message('error', "VIDAL - IR Submission SUCCESS → ClaimNO={$ticket['claimNO']}");
|
||||
|
||||
// 6. UPDATE FILES AS SENT TO TPA
|
||||
if(count($tpaSentFileIds) > 0){
|
||||
|
||||
$this->db->table('claim_files')
|
||||
->whereIn('id', $tpaSentFileIds)
|
||||
->update(['is_file_sent_to_tpa' => 1]);
|
||||
|
||||
log_message('error',"VIDAL - IR Submission | Updating claim_files for file IDs: " . implode(', ', $tpaSentFileIds));
|
||||
} else {
|
||||
log_message('error',"VIDAL - IR Submission | No files to update as sent to TPA");
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => true,
|
||||
'message' => 'IR Submitted successfully',
|
||||
|
||||
@ -692,6 +692,7 @@ class VoloApiController extends BaseController
|
||||
tm.claim_amount as requestedAmount,
|
||||
tm.tpa_no as memberId,
|
||||
cp.policy_no as policyNo,
|
||||
cf.id as fileId,
|
||||
cf.url as filePath
|
||||
')
|
||||
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
|
||||
@ -710,6 +711,7 @@ class VoloApiController extends BaseController
|
||||
return ['status' => false, 'message' => 'Claim Push FAILED | File Missing'];
|
||||
}
|
||||
|
||||
$file_id = $data['fileId'] ?? null;
|
||||
$filename = basename($data['filePath']);
|
||||
$pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename;
|
||||
if (!is_readable($pdfPath)) {
|
||||
@ -781,6 +783,18 @@ class VoloApiController extends BaseController
|
||||
]);
|
||||
log_message('error', 'VOLO - Claim Push SUCCESS | claimId: ' . $claimId . ' | ref: ' . $ref);
|
||||
|
||||
// Update claim files table that file is sent to tpa for this claim
|
||||
if(!empty($file_id)){
|
||||
|
||||
$this->db->table('claim_files')
|
||||
->where('id', $file_id)
|
||||
->update([ 'is_file_sent_to_tpa' => 1 ]);
|
||||
|
||||
log_message('error','VOLO - Claim Push | Updating claim_files table for file_id: '.$file_id);
|
||||
}else{
|
||||
log_message('error','VOLO - Claim Push | No file_id found to update claim_files table.');
|
||||
}
|
||||
|
||||
return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response];
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ class ClaimFilesModel extends Model
|
||||
'file_name',
|
||||
'mime_type',
|
||||
'docs_for_ir',
|
||||
'is_file_sent_to_tpa',
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
Loading…
Reference in New Issue
Block a user