FEAT_NETWORK_HOSPITAL_LINK_FOR_HR
This commit is contained in:
parent
83eac29e70
commit
b4de45df16
@ -1677,19 +1677,55 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
$responseData = [
|
||||
'level_1' => $level_1,
|
||||
'level_2' => $level_2,
|
||||
];
|
||||
|
||||
$tpaNetworkHospitals = $this->getTpaNetworkHospitalsByClientId($client_id);
|
||||
|
||||
if (! empty($tpaNetworkHospitals)) {
|
||||
$responseData['tpa_network_hospitals'] = $tpaNetworkHospitals;
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'data' => [
|
||||
'level_1' => $level_1,
|
||||
'level_2' => $level_2,
|
||||
],
|
||||
'data' => $responseData,
|
||||
], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
private function getTpaNetworkHospitalsByClientId($client_id)
|
||||
{
|
||||
$tpaRecords = $this->clientPolicyModel
|
||||
->select('tpa.name as tpa_name, tpa.network_hospitals')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
->where('MD5(client_policy.client_id)', $client_id)
|
||||
->where('client_policy.is_active', 1)
|
||||
->where('tpa.is_active', 1)
|
||||
->where('tpa.network_hospitals IS NOT NULL', null, false)
|
||||
->where('tpa.network_hospitals !=', '')
|
||||
->groupBy('tpa.id')
|
||||
->findAll();
|
||||
|
||||
$tpaNetworkHospitals = [];
|
||||
|
||||
foreach ($tpaRecords as $tpaRecord) {
|
||||
$tpaName = trim((string) ($tpaRecord['tpa_name'] ?? ''));
|
||||
$networkHospitals = trim((string) ($tpaRecord['network_hospitals'] ?? ''));
|
||||
|
||||
if ($tpaName !== '' && $networkHospitals !== '') {
|
||||
$tpaNetworkHospitals[$tpaName] = $networkHospitals;
|
||||
}
|
||||
}
|
||||
|
||||
return $tpaNetworkHospitals;
|
||||
}
|
||||
|
||||
public function getAddOnPolicy()
|
||||
{
|
||||
try {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user