CHANGE_Vidal_api_and_ticketing_system_scaffold - VADIVEL J 2025-08-13
This commit is contained in:
parent
f766def3d7
commit
2c75657d5a
@ -614,7 +614,7 @@ $routes->post("retrieveWebhookDataClaim","ClientWebHooksController::pullData_cla
|
||||
|
||||
|
||||
|
||||
//Third party Api Call
|
||||
//Third party ICICILombard Api Call
|
||||
|
||||
$routes->get('generateAuthToken','ICICILombardController::generateAuthToken');
|
||||
$routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBatch');
|
||||
@ -623,3 +623,14 @@ $routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
|
||||
|
||||
$routes->get('testTracelog','TestBusinessController::a');
|
||||
$routes->get("claimView", "EmployeeRestController::claimView");
|
||||
|
||||
//Third party Vidal Api Call
|
||||
|
||||
$routes->post('hospitalNetwork','VidalApiController::hospitalNetwork');
|
||||
$routes->post('eCardService','VidalApiController::eCardService');
|
||||
$routes->post('claimStatusCheck','VidalApiController::claimStatusCheck');
|
||||
$routes->post('newClaim','VidalApiController::newClaim');
|
||||
$routes->post('enrollment','VidalApiController::enrollment');
|
||||
|
||||
|
||||
$routes->post("ticketCreation", "ThzController::ticketCreation");
|
||||
67
app/ControllerCleaners/ThzControllerCleaner.php
Normal file
67
app/ControllerCleaners/ThzControllerCleaner.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\ControllerCleaners;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
|
||||
use App\Models\ThzMasterModel;
|
||||
use App\Models\ThzMasterNotesModel;
|
||||
|
||||
class ThzControllerCleaner extends BaseController
|
||||
{
|
||||
|
||||
protected $thzMasterModel;
|
||||
protected $thzMasterNotesModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->thzMasterModel = new ThzMasterModel();
|
||||
$this->thzMasterNotesModel = new ThzMasterNotesModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function ticketCreation($data){
|
||||
|
||||
if(empty($data)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$cleanedData = $data;
|
||||
|
||||
return $cleanedData;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function ticketList($data){
|
||||
|
||||
if(empty($data)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$cleanedData = $data;
|
||||
|
||||
return $cleanedData;
|
||||
|
||||
}
|
||||
|
||||
public function ticketConversation($data){
|
||||
|
||||
if(empty($data)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$cleanedData = $data;
|
||||
|
||||
return $cleanedData;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
168
app/Controllers/ThzController.php
Normal file
168
app/Controllers/ThzController.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
|
||||
use App\Models\ThzMasterModel;
|
||||
use App\Models\ThzMasterNotesModel;
|
||||
use App\ControllerCleaners\ThzControllerCleaner;
|
||||
|
||||
class ThzController extends BaseController
|
||||
{
|
||||
|
||||
protected $thzMasterModel;
|
||||
protected $thzMasterNotesModel;
|
||||
|
||||
protected $thzControllerCleaner;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->thzMasterModel = new ThzMasterModel();
|
||||
$this->thzMasterNotesModel = new ThzMasterNotesModel();
|
||||
$this->thzControllerCleaner = new ThzControllerCleaner();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function ticketCreation(){
|
||||
|
||||
$data = $this->request->getJSON(true);
|
||||
|
||||
$cleanedData = $this->thzControllerCleaner->ticketCreation($data);
|
||||
|
||||
if ($cleanedData === false) {
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given']));
|
||||
}
|
||||
|
||||
$result = $this->thzMasterModel->insert($cleanedData);
|
||||
|
||||
return $this->response->setJSON((['status' => 'success', 'message' => 'Ticket created successfully']));
|
||||
|
||||
}
|
||||
|
||||
public function ticketList(){
|
||||
|
||||
$data = $this->request->getJson(true);
|
||||
|
||||
$cleanedData = $this->thzControllerCleaner->ticketList($data);
|
||||
|
||||
if( $cleanedData === false ) {
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given']));
|
||||
}
|
||||
|
||||
$id = $cleanedData['id'] ?? null;
|
||||
|
||||
if (empty($id)) {
|
||||
$result = $this->thzMasterModel->findAll();
|
||||
}
|
||||
|
||||
$result = $this->thzMasterModel->where('id',$id)->findAll();
|
||||
|
||||
if(empty($result)){
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']));
|
||||
}
|
||||
|
||||
return $this->response->setJSON((['status' => 'success', 'data' => $result]));
|
||||
|
||||
}
|
||||
|
||||
public function ticketConversationSave(){
|
||||
|
||||
$data = $this->request->getJson(true);
|
||||
|
||||
$cleanedData = $this->thzControllerCleaner->ticketList($data);
|
||||
|
||||
if( $cleanedData === false ) {
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given']));
|
||||
}
|
||||
|
||||
$result = $this->thzMasterNotesModel->insert($data);
|
||||
|
||||
if(empty($result)){
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']));
|
||||
}
|
||||
|
||||
return $this->response->setJSON((['status' => 'success', 'data' => $result]));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function ticketListForUser(){
|
||||
|
||||
$data = $this->request->getJson(true);
|
||||
|
||||
$cleanedData = $this->thzControllerCleaner->ticketList($data);
|
||||
|
||||
if( $cleanedData === false ) {
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given']));
|
||||
}
|
||||
|
||||
$result = $this->thzMasterNotesModel->insert($data);
|
||||
|
||||
if(empty($result)){
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']));
|
||||
}
|
||||
|
||||
return $this->response->setJSON((['status' => 'success', 'data' => $result]));
|
||||
|
||||
}
|
||||
|
||||
public function conversationListForUserPerTicket(){
|
||||
|
||||
$data = $this->request->getJson(true);
|
||||
|
||||
$cleanedData = $this->thzControllerCleaner->ticketList($data);
|
||||
|
||||
if( $cleanedData === false ) {
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given']));
|
||||
}
|
||||
|
||||
$thz_id = $cleanedData['thz_id'] ?? null;
|
||||
|
||||
$result = $this->thzMasterNotesModel->conversationListForUserPerTicket($thz_id);
|
||||
|
||||
if(empty($result)){
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']));
|
||||
}
|
||||
|
||||
return $this->response->setJSON((['status' => 'success', 'data' => $result]));
|
||||
|
||||
}
|
||||
|
||||
public function ticketListForAssignedStaff(){
|
||||
|
||||
}
|
||||
|
||||
public function conversationListForAssignedStaffPerTicket(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************** PRIVATE FUNCTIONS ********************************************************/
|
||||
|
||||
|
||||
private function checkGeneralUserOrEmployee($data){
|
||||
|
||||
if($data['empcode']){
|
||||
return $data['empcode'];
|
||||
} elseif ($data['mobile']) {
|
||||
return $data['mobile'];
|
||||
} elseif ($data['email']) {
|
||||
return $data['email'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
214
app/Controllers/VidalApiController.php
Normal file
214
app/Controllers/VidalApiController.php
Normal file
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
|
||||
class VidalApiController extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function hospitalNetwork(){
|
||||
|
||||
$postData = $this->request->getJSON(true);
|
||||
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('VIDAL_API_BASE_URL').'/hospitalnetwork';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Authorization:'. getenv('VIDAL_API_KEY').'',
|
||||
'username:'. getenv('VIDAL_API_USERNAME').'',
|
||||
'password:'. getenv('VIDAL_API_PASSWORD').'',
|
||||
'policynumber:'. $postData['policyNo'] ?? '',
|
||||
];
|
||||
|
||||
|
||||
|
||||
$body = [];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Token generation failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
|
||||
public function eCardService(){
|
||||
|
||||
$postData = $this->request->getJSON(true);
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('VIDAL_API_BASE_URL').'/ecardservice';
|
||||
$method = 'POST';
|
||||
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Authorization:'.getenv('VIDAL_API_KEY').'',
|
||||
'username:' .getenv('VIDAL_API_USERNAME').'',
|
||||
'password:' .getenv('VIDAL_API_PASSWORD').'',
|
||||
'PolicyNo:' .$postData['PolicyNo'] ?? '',
|
||||
'enrollmentNo:' .$postData['enrollmentNo'] ?? '',
|
||||
];
|
||||
|
||||
$body = [
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Token generation failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
|
||||
public function claimStatusCheck(){
|
||||
|
||||
$postData = $this->request->getJSON(true);
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('VIDAL_API_BASE_URL').'/claimpreauthservice';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Authorization:' .getenv('VIDAL_API_KEY').'',
|
||||
'username:' .getenv('VIDAL_API_USERNAME').'',
|
||||
'password:' .getenv('VIDAL_API_PASSWORD').'',
|
||||
'PolicyNo:' .$postData['policyNo'] ?? '',
|
||||
'enrollmentNo:' .$postData['enrollmentNo'] ?? '',
|
||||
'empNo:' .$postData['empNo'] ?? '',
|
||||
'startdate:' .$postData['startdate'] ?? '',
|
||||
'enddate:' .$postData['enddate'] ?? '',
|
||||
'tpaclaimNo:' .$postData['tpaclaimNo'] ?? ''
|
||||
];
|
||||
|
||||
$body = [];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Token generation failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
|
||||
public function newClaim(){
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('VIDAL_API_BASE_URL').'/submitClaim';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: multipart/form-data',
|
||||
'Authorization:' .getenv('VIDAL_API_KEY').'',
|
||||
];
|
||||
|
||||
$body = [
|
||||
'username:' .getenv('VIDAL_API_USERNAME').'',
|
||||
'password:' .getenv('VIDAL_API_PASSWORD').'',
|
||||
'PolicyNo:' .$postData['policyNo'] ?? '',
|
||||
'enrollmentId:' .$postData['enrollmentId'] ?? '',
|
||||
'typeOfClaim:' .$postData['typeOfClaim'] ?? '',
|
||||
'claimSubType:' .$postData['claimSubType'] ?? '',
|
||||
'requestedAmount:' .$postData['requestedAmount'] ?? '',
|
||||
'ailmentType:' .$postData['ailmentType'] ?? '',
|
||||
'admissionDate:' .$postData['admissionDate'] ?? '',
|
||||
'dischargeDate:' .$postData['dischargeDate'] ?? '',
|
||||
'hospitalName:' .$postData['hospitalName'] ?? '',
|
||||
'empanelmentNo:' .$postData['empanelmentNo'] ?? '',
|
||||
'documentType:' .$postData['documentType'] ?? '',
|
||||
'ailmentName:' .$postData['ailmentName'] ?? '',
|
||||
'hospitalAddress:' .$postData['hospitalAddress'] ?? '',
|
||||
'hospitalState:' .$postData['hospitalState'] ?? '',
|
||||
'hospitalCity:' .$postData['hospitalCity'] ?? '',
|
||||
'hospitalPinCode:' .$postData['hospitalPinCode'] ?? '',
|
||||
'hospitalPhoneNo:' .$postData['hospitalPhoneNo'] ?? ''
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Token generation failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function enrollment(){
|
||||
|
||||
$postData = $this->request->getJSON(true);
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('VIDAL_API_BASE_URL').'/enrollmendataservice';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Authorization:'. getenv('VIDAL_API_KEY').'',
|
||||
'username:' . getenv('VIDAL_API_USERNAME').'',
|
||||
'password:' . getenv('VIDAL_API_PASSWORD').'',
|
||||
'policyNo:' .$postData['policyNo'] ?? '',
|
||||
'startindex:' .$postData['startindex'] ?? '',
|
||||
'endindex:' .$postData['endindex'] ?? ''
|
||||
];
|
||||
|
||||
$body = [
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Token generation failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
42
app/Models/ThzMasterModel.php
Normal file
42
app/Models/ThzMasterModel.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class ThzMasterModel extends Model
|
||||
{
|
||||
protected $table = 'thz_master';
|
||||
protected $primaryKey = 'thz_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['name','mobile','email','empcode','policy_no','ticket_type','subject','message','status','assign_to','created_at','updated_at'];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = false;
|
||||
protected $dateFormat = 'datetime';
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $deletedField = 'deleted_at';
|
||||
|
||||
// Validation
|
||||
protected $validationRules = [];
|
||||
protected $validationMessages = [];
|
||||
protected $skipValidation = false;
|
||||
protected $cleanValidationRules = true;
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = [];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = [];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
}
|
||||
78
app/Models/ThzMasterNotesModel.php
Normal file
78
app/Models/ThzMasterNotesModel.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class ThzMasterNotesModel extends Model
|
||||
{
|
||||
protected $table = 'thz_master_notes';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['thz_id','notes','notes_by','created_by','created_at'];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = false;
|
||||
protected $dateFormat = 'datetime';
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $deletedField = 'deleted_at';
|
||||
|
||||
// Validation
|
||||
protected $validationRules = [];
|
||||
protected $validationMessages = [];
|
||||
protected $skipValidation = false;
|
||||
protected $cleanValidationRules = true;
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = [];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = [];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
public function conversationListForUserPerTicket($thz_id){
|
||||
|
||||
|
||||
if(empty($thz_id)){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT
|
||||
thz_master_notes.id,
|
||||
thz_master_notes.thz_id,
|
||||
thz_master_notes.notes,
|
||||
thz_master_notes.notes_by,
|
||||
thz_master_notes.created_by,
|
||||
thz_master_notes.created_at
|
||||
FROM
|
||||
thz_master_notes
|
||||
|
||||
Join thz_master ON thz_master.thz_id = :thz_id:
|
||||
WHERE
|
||||
thz_master_notes.thz_id = :thz_id:
|
||||
ORDER BY
|
||||
thz_master_notes.created_at DESC
|
||||
";
|
||||
|
||||
$binds = ["thz_id" => $thz_id ];
|
||||
|
||||
$result = $this->db->query($sql,$binds)->getResultArray() ;
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user