Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2026-04-20 15:44:41 +05:30
commit 75e59c1313
7 changed files with 112 additions and 3 deletions

View File

@ -446,6 +446,9 @@ class ApiServiceController extends BaseController
if ($tpaID == $this->medi_assist_primary_key) { // MediAssist if ($tpaID == $this->medi_assist_primary_key) { // MediAssist
$mediAssistController = new MediAssistApiController(); $mediAssistController = new MediAssistApiController();
return $mediAssistController->IRSubmission($claimId); return $mediAssistController->IRSubmission($claimId);
}else if ($tpaID == $this->vidal_primary_key) { // Vidal
$vidalApiController = new VidalApiController();
return $vidalApiController->IRSubmission($claimId);
}else{ }else{
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}"); log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
} }

View File

@ -85,6 +85,8 @@ class FhplApiController extends BaseController
cp.policy_no as policyNo, cp.policy_no as policyNo,
e.emp_code as memberId, e.emp_code as memberId,
tn.note as disease, tn.note as disease,
cf.id as fileId,
cf.url as filePath,
cf.url as filePath cf.url as filePath
') ')
->join('employees e', 'e.id = tm.emp_id', 'left') ->join('employees e', 'e.id = tm.emp_id', 'left')
@ -102,6 +104,7 @@ class FhplApiController extends BaseController
} }
// Build absolute file path // Build absolute file path
$file_id = $data['fileId'] ?? null;
$filename = basename($data['filePath']); $filename = basename($data['filePath']);
$pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename; $pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename;
@ -182,6 +185,18 @@ class FhplApiController extends BaseController
'tpa_claim_push_reference_no' => $fhplClaimNo, 'tpa_claim_push_reference_no' => $fhplClaimNo,
'updated_at' => date('Y-m-d H:i:s') '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); log_message('error', 'FHPL - Claim Push SUCCESS | claimId: '.$claimId.' | claimNO: '.$fhplClaimNo);
return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response]; return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response];

View File

@ -105,6 +105,7 @@ class HealthIndiaApiController extends BaseController
cp.policy_no as policyNumber, cp.policy_no as policyNumber,
e.emp_code as employeeCode, e.emp_code as employeeCode,
tn.note as disease, tn.note as disease,
cf.id as fileId,
cf.url as filePath, cf.url as filePath,
tm.claim_type as claimType, tm.claim_type as claimType,
tm.claim_type as benefitType tm.claim_type as benefitType
@ -130,6 +131,7 @@ class HealthIndiaApiController extends BaseController
} }
// Build absolute file path // Build absolute file path
$file_id = $data['fileId'] ?? null;
$filename = basename($data['filePath']); $filename = basename($data['filePath']);
$pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename; $pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename;
@ -231,6 +233,18 @@ class HealthIndiaApiController extends BaseController
'updated_at' => date('Y-m-d H:i:s') '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); log_message('error', 'HEALTH_INDIA - Claim Push SUCCESS | claimId: ' . $claimId . ' | CCN: ' . $ccn . ' | CCN_EXT: ' . $ccnExt);
return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response]; return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response];
} else { } else {

View File

@ -42,8 +42,9 @@ class MediAssistApiController extends BaseController
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'', 'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
]; ];
$file_id = null;
//Prepare body data //Prepare body data
// Fetch the data from DB // Fetch the data from DB
$data = $this->db->table('ticket_master tm') $data = $this->db->table('ticket_master tm')
->select(' ->select('
@ -59,6 +60,7 @@ class MediAssistApiController extends BaseController
tm.tpa_no as memberId, tm.tpa_no as memberId,
tn.note as disease, tn.note as disease,
tn.note as reasonForHospitalization, tn.note as reasonForHospitalization,
cf.id as fileId,
cf.url as fileName, cf.url as fileName,
cf.url as filePath cf.url as filePath
') ')
@ -83,6 +85,7 @@ class MediAssistApiController extends BaseController
if ($fileDir) { if ($fileDir) {
$downloadUrl = base_url('fileDownload?file_path=').$fileDir; $downloadUrl = base_url('fileDownload?file_path=').$fileDir;
$file_id = $data['fileId'] ?? null;
} else { } else {
$downloadUrl = ''; $downloadUrl = '';
} }
@ -152,10 +155,23 @@ class MediAssistApiController extends BaseController
log_message('error','MEDI_ASSIST - Claim Push SUCCESS | claimId: '.$claimId.' | claimReferenceNo: '.$claimRef); log_message('error','MEDI_ASSIST - Claim Push SUCCESS | claimId: '.$claimId.' | claimReferenceNo: '.$claimRef);
// Update claim reference number in ticket_master
$this->db->table('ticket_master') $this->db->table('ticket_master')
->where('id',$claimId) ->where('id',$claimId)
->update([ 'tpa_claim_push_reference_no' => $claimRef ]); ->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]; return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response];
} else { } else {
@ -695,12 +711,14 @@ class MediAssistApiController extends BaseController
$fileData = $this->db->table('claim_files f') $fileData = $this->db->table('claim_files f')
->where('f.ticket_id', $claimId) ->where('f.ticket_id', $claimId)
->where('f.docs_for_ir', 1) ->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() ->get()
->getResultArray(); ->getResultArray();
$Attachments = []; $Attachments = [];
$tpaSentFileIds = [];
if (count($fileData)) { if (count($fileData)) {
foreach ($fileData as $file) { foreach ($fileData as $file) {
@ -722,6 +740,9 @@ class MediAssistApiController extends BaseController
"AttachmentName" => $filename, "AttachmentName" => $filename,
"AttachmentPath" => $downloadUrl "AttachmentPath" => $downloadUrl
]; ];
$tpaSentFileIds[] = $file['id']; // Collect file IDs to update later
} else { } else {
log_message('error',"MEDI_ASSIST - IR Submission Missing File URL → file_id={$file['id']}"); 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']}"); 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 [ return [
'status' => true, 'status' => true,
'message' => 'IR Submitted successfully', 'message' => 'IR Submitted successfully',

View File

@ -156,6 +156,7 @@ class VidalApiController extends BaseController
e.emp_code as memberId, e.emp_code as memberId,
tn.note as disease, tn.note as disease,
tn.note as reasonForHospitalization, tn.note as reasonForHospitalization,
cf.id as cfFileId,
cf.url as fileName, cf.url as fileName,
cf.url as filePath, cf.url as filePath,
pt.policy_type as typeOfClaim, pt.policy_type as typeOfClaim,
@ -195,6 +196,7 @@ class VidalApiController extends BaseController
} }
$fileId = $upload['fileId']; $fileId = $upload['fileId'];
$tpa_sent_file_id = $data['cfFileId'] ?? null;
// $url = 'https://devapigw.vidalhealthtpa.com/partner-integration/api/claims/submit'; // $url = 'https://devapigw.vidalhealthtpa.com/partner-integration/api/claims/submit';
$url = getenv('VIDAL_API_BASE_URL').'/claims/submit'; $url = getenv('VIDAL_API_BASE_URL').'/claims/submit';
$method = 'POST'; $method = 'POST';
@ -299,6 +301,18 @@ class VidalApiController extends BaseController
->where('id',$claimId) ->where('id',$claimId)
->update([ 'tpa_claim_push_reference_no' => $claimInwardNO , 'tpa_claim_id' => $claimNO , 'claim_number' => $claimNO ]); ->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']; return ['status' => true, 'message' => 'Claim Push SUCCESS'];
} else { } else {
@ -1664,7 +1678,8 @@ class VidalApiController extends BaseController
$fileData = $this->db->table('claim_files f') $fileData = $this->db->table('claim_files f')
->where('f.ticket_id', $claimId) ->where('f.ticket_id', $claimId)
->where('f.docs_for_ir', 1) ->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() ->get()
->getResultArray(); ->getResultArray();
@ -1679,6 +1694,7 @@ class VidalApiController extends BaseController
// 3. UPLOAD FILES TO VIDAL // 3. UPLOAD FILES TO VIDAL
$fileIdList = []; $fileIdList = [];
$tpaSentFileIds = [];
foreach ($fileData as $file) { foreach ($fileData as $file) {
@ -1702,6 +1718,7 @@ class VidalApiController extends BaseController
} }
$fileIdList[] = $upload['fileId']; // deeplink URL $fileIdList[] = $upload['fileId']; // deeplink URL
$tpaSentFileIds[] = $file['id']; // local file ID for updating
} }
if (empty($fileIdList)) { if (empty($fileIdList)) {
@ -1757,6 +1774,18 @@ class VidalApiController extends BaseController
log_message('error', "VIDAL - IR Submission SUCCESS → ClaimNO={$ticket['claimNO']}"); 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 [ return [
'status' => true, 'status' => true,
'message' => 'IR Submitted successfully', 'message' => 'IR Submitted successfully',

View File

@ -692,6 +692,7 @@ class VoloApiController extends BaseController
tm.claim_amount as requestedAmount, tm.claim_amount as requestedAmount,
tm.tpa_no as memberId, tm.tpa_no as memberId,
cp.policy_no as policyNo, cp.policy_no as policyNo,
cf.id as fileId,
cf.url as filePath cf.url as filePath
') ')
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left') ->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']; return ['status' => false, 'message' => 'Claim Push FAILED | File Missing'];
} }
$file_id = $data['fileId'] ?? null;
$filename = basename($data['filePath']); $filename = basename($data['filePath']);
$pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename; $pdfPath = WRITEPATH . 'uploads/claim_files/' . $filename;
if (!is_readable($pdfPath)) { if (!is_readable($pdfPath)) {
@ -781,6 +783,18 @@ class VoloApiController extends BaseController
]); ]);
log_message('error', 'VOLO - Claim Push SUCCESS | claimId: ' . $claimId . ' | ref: ' . $ref); 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]; return ['status' => true, 'message' => 'Claim Push SUCCESS', 'response' => $response];
} }

View File

@ -24,6 +24,7 @@ class ClaimFilesModel extends Model
'file_name', 'file_name',
'mime_type', 'mime_type',
'docs_for_ir', 'docs_for_ir',
'is_file_sent_to_tpa',
]; ];
// Callbacks // Callbacks