diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 69bf3571..10b4f4ef 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -682,7 +682,8 @@ $routes->group("employeeRest", ['filter' => ['appSignature'] ], function ($route // get insurer and policy type $routes->get("getPolicyTypeAndInsurer", "EmployeeRestController::getPolicyTypeAndInsurer"); - + $routes->get("downloadCdSplitUpFile", "EmployeeRestController::downloadCdSplitUpFile"); + $routes->get("getExcelFileErrors/(:any)", "EmployeeController::getExcelFileErrors/$1"); }); $routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index c16c20eb..64d011ea 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -6614,6 +6614,8 @@ class ClientController extends AdminController public function sendextraparam() { + // $cd = $this->view_Deposit(2, 'rest', ['client_id' => 58, 'cd_ac_pk' => 94]); + // dd($cd); // $return = db_connect()->table('jobs')->where('id', 1677)->get()->getRowArray(); // $return = $this->updatePolicyTransactionDataWhileClinetPolicyUpdate(json_decode($data['payload'], true)); // dd($return); diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 8d75b095..eb95e8be 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -2195,6 +2195,7 @@ class EmpDataServiceController extends BaseController 'event_name' => $file['event_type'], 'policy_name' => $policy_name['policy_name'], 'user_id' => $user_id, + 'file_id' => $file_id, ]]); $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ @@ -3378,6 +3379,7 @@ class EmpDataServiceController extends BaseController 'event_name' => $file['event_type'], 'policy_name' => $policy_name['policy_name'], 'user_id' => $user_id, + 'file_id' => $file_id, ]]); $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ @@ -3889,6 +3891,7 @@ class EmpDataServiceController extends BaseController 'event_name' => $file['event_type'], 'policy_name' => $policy_name['policy_name'], 'user_id' => $user_id, + 'file_id' => $file_id, ]]); $r = Jobs::addJob(['job_name' => 'makeEntryForBDSPolicyTransaction', 'payload' => [ @@ -4373,7 +4376,8 @@ class EmpDataServiceController extends BaseController 'updated_by' => $arrayData['user_id'], 'event_name' => $arrayData['event_name'], 'is_active' => 1, - 'cd_ac_pk' => $cd_ac_pk['cd_ac_pk'] + 'cd_ac_pk' => $cd_ac_pk['cd_ac_pk'], + 'file_id' => $arrayData['file_id'], ]; $response = DepositHelper::saveDeposit($data, $arrayData['user_id']); @@ -4510,7 +4514,8 @@ class EmpDataServiceController extends BaseController 'updated_by' => $arrayData['user_id'], 'event_name' => $arrayData['event_name'], 'is_active' => 1, - 'cd_ac_pk' => $policy_data['cd_ac_pk'] + 'cd_ac_pk' => $policy_data['cd_ac_pk'], + 'file_id' => $arrayData['file_id'], ]; DepositHelper::saveDeposit($data, $arrayData['user_id']); @@ -4540,7 +4545,8 @@ class EmpDataServiceController extends BaseController 'updated_by' => $arrayData['user_id'], 'event_name' => $arrayData['event_name'], 'is_active' => 1, - 'cd_ac_pk' => $policy_data['cd_ac_pk'] + 'cd_ac_pk' => $policy_data['cd_ac_pk'], + 'file_id' => $arrayData['file_id'], ]; DepositHelper::saveDeposit($data, $arrayData['user_id']); @@ -4652,7 +4658,8 @@ class EmpDataServiceController extends BaseController 'updated_by' => $arrayData['user_id'], 'event_name' => $arrayData['event_name'], 'is_active' => 1, - 'cd_ac_pk' => $insurer_id['cd_ac_pk'] + 'cd_ac_pk' => $insurer_id['cd_ac_pk'], + 'file_id' => $arrayData['file_id'], ]; $response = DepositHelper::saveDeposit($data, $arrayData['user_id']); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index f18b0a1a..e60cc86a 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -40,6 +40,7 @@ use App\Models\HRAccessControlModel; use App\Models\InsurerModel; use App\Models\HrFileUploadModel; use App\Models\EmployeeRetailPolicy; +use App\Models\BatchFileModel; @@ -100,6 +101,7 @@ class EmployeeRestController extends AdminController protected $hrFileUploadModel; protected $ticketMailTemplateModel; protected $employeeRetailPolicy; + protected $batchFileModel; public function __construct() @@ -134,6 +136,7 @@ class EmployeeRestController extends AdminController $this->insurerModel = new InsurerModel(); $this->hrFileUploadModel = new HrFileUploadModel(); $this->ticketMailTemplateModel = new TicketMailTemplateModel(); + $this->batchFileModel = new BatchFileModel(); } @@ -5379,6 +5382,35 @@ class EmployeeRestController extends AdminController return $claim_status_data_id; } + public function downloadCdSplitUpFile() + { + try { + + $file_id = $this->request->getGet('id'); + + // Find record + $record = $this->batchFileModel->where('id', $file_id)->first();; + if (!$record) { + $data['message'] = 'File record not found'; + return view('errors/404', $data); + } + + $uploadPath = WRITEPATH . 'uploads/import_excel/'; + $filePath = $uploadPath . $record['file_name']; + + if (!file_exists($filePath)) { + // return $this->failNotFound("File not found on server"); + $data['message'] = 'The Physical File Not Found'; + return view('errors/404', $data); + } + + // Force file download + return $this->response->download($filePath, null)->setFileName($record['file_name']); + } catch (\Exception $e) { + $data['message'] = 'File record not found'; + return view('errors/404', $data); + } + } } diff --git a/app/Libraries/TPAClaimsImportServices/MediAssistClaimImportService.php b/app/Libraries/TPAClaimsImportServices/MediAssistClaimImportService.php index 7326567d..a582a067 100644 --- a/app/Libraries/TPAClaimsImportServices/MediAssistClaimImportService.php +++ b/app/Libraries/TPAClaimsImportServices/MediAssistClaimImportService.php @@ -49,7 +49,7 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService ["excel_column" => ["col_name" => "intimation_id", "col_index" => 30], "db_column" => "intimation_id"], ["excel_column" => ["col_name" => "intimation_date", "col_index" => 31], "db_column" => "intimation_date"], ["excel_column" => ["col_name" => "settled_date", "col_index" => 32], "db_column" => "settled_date"], - ["excel_column" => ["col_name" => "ClaimSource", "col_index" => 33], "db_column" => "claim_source"], + ["excel_column" => ["col_name" => "ClaimSource", "col_index" => 33], "db_column" => "ClaimSource"], ["excel_column" => ["col_name" => "claim_mode_of_rcpt", "col_index" => 34], "db_column" => "claim_mode_of_rcpt"], ["excel_column" => ["col_name" => "claim_type", "col_index" => 35], "db_column" => "claim_type"], ["excel_column" => ["col_name" => "claim_sub_type", "col_index" => 36], "db_column" => "claim_sub_type"], @@ -72,16 +72,16 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService ["excel_column" => ["col_name" => "hospital_state", "col_index" => 53], "db_column" => "hospital_state"], ["excel_column" => ["col_name" => "hospital_pincode", "col_index" => 54], "db_column" => "hospital_pincode"], ["excel_column" => ["col_name" => "hospital_address", "col_index" => 55], "db_column" => "hospital_address"], - ["excel_column" => ["col_name" => "Clinic_DoctorName_Hospital", "col_index" => 56], "db_column" => "clinic_doctorname_hospital"], - ["excel_column" => ["col_name" => "OPD_pincode", "col_index" => 57], "db_column" => "opd_pincode"], - ["excel_column" => ["col_name" => "payable_amount_OPD_Consultation", "col_index" => 58], "db_column" => "payable_amount_opd_consultation"], - ["excel_column" => ["col_name" => "payable_amount_Dental", "col_index" => 59], "db_column" => "payable_amount_dental"], - ["excel_column" => ["col_name" => "payable_amount_Diagnostics", "col_index" => 60], "db_column" => "payable_amount_diagnostics"], - ["excel_column" => ["col_name" => "payable_amount_Other", "col_index" => 61], "db_column" => "payable_amount_other"], - ["excel_column" => ["col_name" => "payable_amount_Pharmacy", "col_index" => 62], "db_column" => "payable_amount_pharmacy"], - ["excel_column" => ["col_name" => "payable_amount_Vaccination", "col_index" => 63], "db_column" => "payable_amount_vaccination"], - ["excel_column" => ["col_name" => "payable_amount_Miscellaneous_Charges", "col_index" => 64], "db_column" => "payable_amount_miscellaneous_charges"], - ["excel_column" => ["col_name" => "payable_amount_Health_Checkup", "col_index" => 65], "db_column" => "payable_amount_health_checkup"], + ["excel_column" => ["col_name" => "Clinic_DoctorName_Hospital", "col_index" => 56], "db_column" => "Clinic_DoctorName_Hospital"], + ["excel_column" => ["col_name" => "OPD_pincode", "col_index" => 57], "db_column" => "OPD_pincode"], + ["excel_column" => ["col_name" => "payable_amount_OPD_Consultation", "col_index" => 58], "db_column" => "payable_amount_OPD_Consultation"], + ["excel_column" => ["col_name" => "payable_amount_Dental", "col_index" => 59], "db_column" => "payable_amount_Dental"], + ["excel_column" => ["col_name" => "payable_amount_Diagnostics", "col_index" => 60], "db_column" => "payable_amount_Diagnostics"], + ["excel_column" => ["col_name" => "payable_amount_Other", "col_index" => 61], "db_column" => "payable_amount_Other"], + ["excel_column" => ["col_name" => "payable_amount_Pharmacy", "col_index" => 62], "db_column" => "payable_amount_Pharmacy"], + ["excel_column" => ["col_name" => "payable_amount_Vaccination", "col_index" => 63], "db_column" => "payable_amount_Vaccination"], + ["excel_column" => ["col_name" => "payable_amount_Miscellaneous_Charges", "col_index" => 64], "db_column" => "payable_amount_Miscellaneous_Charges"], + ["excel_column" => ["col_name" => "payable_amount_Health_Checkup", "col_index" => 65], "db_column" => "payable_amount_Health_Checkup"], ["excel_column" => ["col_name" => "deduction_amount_copay", "col_index" => 66], "db_column" => "deduction_amount_copay"], ["excel_column" => ["col_name" => "deduction_amount_excess_ailment", "col_index" => 67], "db_column" => "deduction_amount_excess_ailment"], ["excel_column" => ["col_name" => "deduction_amount_excess_policy", "col_index" => 68], "db_column" => "deduction_amount_excess_policy"], @@ -153,6 +153,7 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService // Payment 'utr_no' => 'utr_details', + 'claim_type' => 'tpa_claim_type', ]; protected $statusMapping = [ @@ -166,7 +167,6 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService 'Cashless Document Awaited' => 3, ]; - /** * ABSTRACT FUNCTIONs */ @@ -177,9 +177,8 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService } $builder = $this->db->table('claims_dump_medi_assist'); - $builder->insertBatch($data); + return $builder->insertBatch($data); - return true; } diff --git a/app/Models/ClientDepositModel.php b/app/Models/ClientDepositModel.php index 8a61b204..7aa4ff7b 100755 --- a/app/Models/ClientDepositModel.php +++ b/app/Models/ClientDepositModel.php @@ -30,6 +30,7 @@ class ClientDepositModel extends Model "cd_ac_pk", "record_date", "policy_transaction_id", + "file_id", ]; diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index fa7672ec..e9cf38d9 100755 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -303,6 +303,8 @@ class ClientPolicyModel extends Model $caseSql = ""; } + $url = base_url('employeeRest/downloadCdSplitUpFile?id='); + // Fetch the deposit data based on client and insurer IDs $query = $this->db->table('cash_deposit') ->select('cash_deposit.*') @@ -312,6 +314,12 @@ class ClientPolicyModel extends Model // ->select('policies.name as policy_name') ->select('policy_type.policy_type') ->select('user_profiles.first_name as username') + ->select("CASE + WHEN cash_deposit.file_id IS NOT NULL AND cash_deposit.file_id != '' + THEN CONCAT(" . $this->db->escape($url) . ", cash_deposit.file_id) + ELSE NULL + END AS split_up_url", + false) ->select($caseSql) ->join('user_profiles', 'user_profiles.id = cash_deposit.created_by', 'left') ->join('insurers', 'insurers.id = cash_deposit.insurer_id', 'left') @@ -337,7 +345,10 @@ class ClientPolicyModel extends Model } $query->orderBy('cash_deposit.id', 'DESC'); - return $query->get()->getResult(); + $data = $query->get()->getResult(); + + dd($data); + return $data; }