CHANGE_GET_TPA_IDAND_CHANGE_GET_ECARD_URL
This commit is contained in:
parent
e19852fd81
commit
4cc2b8913d
@ -62,13 +62,13 @@ class ApiServiceController extends BaseController
|
||||
$policy_no = $payload['policy_no'] ?? null;
|
||||
|
||||
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||
->where('employee_polices.employee_id',$id)
|
||||
->where('employee_polices.client_policy_id',$client_policy_id)
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||
->where('employee_polices.employee_id',$id)
|
||||
->where('employee_polices.client_policy_id',$client_policy_id)
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
|
||||
|
||||
|
||||
@ -78,21 +78,24 @@ class ApiServiceController extends BaseController
|
||||
{
|
||||
if($employee_policy[0]['tpa_primary_id'] == 2)//Medi assist
|
||||
{
|
||||
$mediAssistController = new MediAssistApiController();
|
||||
$data['eCardDownload'] = $mediAssistController->EcardRequest( $emp_code, $policy_no );
|
||||
$mediAssistController = new MediAssistApiController();
|
||||
$data['eCardDownload'] = $mediAssistController->EcardRequest( $emp_code, $policy_no );
|
||||
}else{
|
||||
$data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'].'/1';
|
||||
$data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'].'/1';
|
||||
}
|
||||
$data['message'] = "E-card generated";
|
||||
|
||||
} else {
|
||||
$data['eCardDownload'] = null;
|
||||
$data['eCardDownload'] = null;
|
||||
$data['message'] = "E-card not generated";
|
||||
}
|
||||
}else{
|
||||
$data['eCardDownload'] = null;
|
||||
$data['eCardDownload'] = null;
|
||||
$data['message'] = "E-card not generated";
|
||||
}
|
||||
|
||||
|
||||
return $this->respond(['status' => true,'message' => '','data' => $data]);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => '', 'data' => $data]);
|
||||
|
||||
} catch(\Exception $e){
|
||||
|
||||
@ -103,24 +106,38 @@ class ApiServiceController extends BaseController
|
||||
public function getTPAID()
|
||||
{
|
||||
|
||||
$tpa_id = $this->request->getPost('tpa_id');
|
||||
$policy_no = $this->request->getPost('policy_no');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$branch_id = $this->request->getPost('client_branch_id');
|
||||
$policy_id = $this->request->getPost('client_policy_id');
|
||||
log_message('error', "getTPAID payloads :" . json_encode($this->request->getPost() ?? []));
|
||||
$tpa_id = $this->request->getPost('tpa_id') ?? null;
|
||||
$policy_no = $this->request->getPost('policy_no') ?? null;
|
||||
$client_id = $this->request->getPost('client_id') ?? null;
|
||||
$branch_id = $this->request->getPost('client_branch_id') ?? null;
|
||||
$policy_id = $this->request->getPost('client_policy_id') ?? null;
|
||||
|
||||
$fileModel = new FileModel();
|
||||
$filesData = $fileModel->where('is_active', 1)->where('action', 'api')->countAllResults();
|
||||
$filesData = $fileModel->where('is_active', 1)->where('action', 'api')->where('status', 'inprogress')->countAllResults();
|
||||
|
||||
if($filesData > 0){
|
||||
return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA not found ','data' => [] ]);
|
||||
log_message('error', "Already the TPA GetBenefDetails job inprocess");
|
||||
return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA initiation is in progress.','data' => [] ]);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'file_name' => "API",
|
||||
'action' => "api",
|
||||
'status' => "inprogress",
|
||||
'client_id' => $client_id,
|
||||
'policy_id' => $policy_id,
|
||||
'client_branch_id'=> $branch_id,
|
||||
];
|
||||
|
||||
if ($tpa_id == 2) // MediAssist
|
||||
{
|
||||
|
||||
$mediAssistController = new MediAssistApiController();
|
||||
$mediAssistController->GetBenefDetails( [ 'polict_no' => $policy_no ] );
|
||||
$file_id = $fileModel->insert($data);
|
||||
log_message('error', "Files table inserted successfully, File id : {$file_id}");
|
||||
// $mediAssistController = new MediAssistApiController();
|
||||
// $mediAssistController->GetBenefDetails( [ 'polict_no' => $policy_no, 'file_id' =>$file_id ] );
|
||||
$r = Jobs::addJob(['job_name' => 'GetBenefDetails', 'payload' => ['polict_no' => $policy_no, 'file_id' => $file_id]]);
|
||||
log_message('error', "GetBenefDetails job pushed successfully.");
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
|
||||
|
||||
|
||||
@ -175,6 +175,10 @@ class JobWorker extends AdminController
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||
],
|
||||
'GetBenefDetails' => [
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\MediAssistApiController',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
use App\Models\FileModel;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
|
||||
class MediAssistApiController extends BaseController
|
||||
@ -297,6 +297,16 @@ class MediAssistApiController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
// update file table status after the tpa id successfully updated
|
||||
if(isset($requestData['file_id']) && !empty($requestData['file_id'])){
|
||||
$file_model = new FileModel();
|
||||
$file_model->where('id', $requestData['file_id'])->set('status', 'success')->update();
|
||||
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
|
||||
}else{
|
||||
log_message('error', "Failed to update file table status.");
|
||||
}
|
||||
|
||||
|
||||
log_message('error', "GetBenefDetails completed. Total fetched={$totalCount}, updated={$updated}");
|
||||
|
||||
return $this->response->setJSON([
|
||||
|
||||
Loading…
Reference in New Issue
Block a user