204 lines
5.0 KiB
PHP
204 lines
5.0 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use CodeIgniter\API\ResponseTrait;
|
|
|
|
|
|
use App\Models\EmployeePolicyModel;
|
|
|
|
|
|
use App\Controllers\BaseController;
|
|
use App\Controllers\VidalApiController;
|
|
use App\Controllers\ICICILombardController;
|
|
use App\Controllers\MediAssistApiController;
|
|
|
|
class ApiServiceController extends BaseController
|
|
{
|
|
use ResponseTrait;
|
|
// protected $format = 'json';
|
|
protected $db;
|
|
protected $employeePolicyModel;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->db = \Config\Database::connect();
|
|
$this->employeePolicyModel = new EmployeePolicyModel();
|
|
}
|
|
|
|
// Push Claims
|
|
public function pushClaims($claimId)
|
|
{
|
|
|
|
$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 == 2) { // MediAssist
|
|
$mediAssistController = new MediAssistApiController();
|
|
return $mediAssistController->SubmitClaim($claimId);
|
|
}else{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
// E-Card Request
|
|
public function ecardRequest()
|
|
{
|
|
try{
|
|
|
|
$id = $this->request->getPost('id');
|
|
$emp_code = $this->request->getPost('emp_code');
|
|
$client_policy_id = $this->request->getPost('client_policy_id');
|
|
$policy_no = $this->request->getPost('policy_no');
|
|
|
|
$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();
|
|
|
|
|
|
|
|
if(count($employee_policy) > 0)
|
|
{
|
|
if($employee_policy[0]['tpa_id'] != null)
|
|
{
|
|
if($employee_policy[0]['tpa_primary_id'] == 2)//Medi assist
|
|
{
|
|
$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';
|
|
}
|
|
|
|
} else {
|
|
$data['eCardDownload'] = null;
|
|
}
|
|
}else{
|
|
$data['eCardDownload'] = null;
|
|
}
|
|
|
|
|
|
return $this->respond(['status' => true,'message' => '','data' => $data]);
|
|
|
|
} catch(\Exception $e){
|
|
|
|
}
|
|
}
|
|
|
|
// Get TPAID
|
|
public function getTPAID()
|
|
{
|
|
|
|
$tpa_id = $this->request->getPost('tpa_id');
|
|
$policy_no = $this->request->getPost('policy_no');
|
|
|
|
if ($tpa_id == 2) // MediAssist
|
|
{
|
|
|
|
$mediAssistController = new MediAssistApiController();
|
|
$mediAssistController->GetBenefDetails( [ 'polict_no' => $policy_no ] );
|
|
|
|
return $this->respond(['status' => true,'message' => 'Action Triggered','data' => [] ]);
|
|
|
|
}else{
|
|
return $this->respond(['status' => true,'message' => 'TPA not found ','data' => [] ]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get Claims
|
|
public function getClaims($id)
|
|
{
|
|
if ($id == 1) {
|
|
$controller = new VidalApiController();
|
|
} elseif ($id == 2) {
|
|
$controller = new ICICILombardController();
|
|
} elseif ($id == 3) {
|
|
$controller = new MediAssistApiController();
|
|
}
|
|
}
|
|
|
|
// Get UHID
|
|
public function getUhid($id)
|
|
{
|
|
if ($id == 1) {
|
|
$controller = new VidalApiController();
|
|
} elseif ($id == 2) {
|
|
$controller = new ICICILombardController();
|
|
} elseif ($id == 3) {
|
|
$controller = new MediAssistApiController();
|
|
}
|
|
}
|
|
|
|
// Push Enrollment
|
|
public function pushEnrollment($id)
|
|
{
|
|
if ($id == 1) {
|
|
$controller = new VidalApiController();
|
|
} elseif ($id == 2) {
|
|
$controller = new ICICILombardController();
|
|
} elseif ($id == 3) {
|
|
$controller = new MediAssistApiController();
|
|
}
|
|
}
|
|
|
|
// Get Hospital Network
|
|
public function getHospitalNetwork($id)
|
|
{
|
|
if ($id == 1) {
|
|
$controller = new VidalApiController();
|
|
} elseif ($id == 2) {
|
|
$controller = new ICICILombardController();
|
|
} elseif ($id == 3) {
|
|
$controller = new MediAssistApiController();
|
|
}
|
|
}
|
|
}
|