MERGE_UAT_BUG_FIXES

This commit is contained in:
Ubuntu 2026-07-21 15:46:52 +05:30
commit 00481c1c2d
4 changed files with 107 additions and 92 deletions

View File

@ -629,6 +629,7 @@ class MediAssistApiController extends BaseController
"RETURNED" => 14, "RETURNED" => 14,
"UNDER PROCESS - TPA" => 61, "UNDER PROCESS - TPA" => 61,
"DENIAL REVIEW AWAITED" => 66, "DENIAL REVIEW AWAITED" => 66,
"Pre-Auth Processed" => 9,
]; ];
$updateArray = [ $updateArray = [
@ -1197,6 +1198,7 @@ class MediAssistApiController extends BaseController
"RETURNED" => 14, "RETURNED" => 14,
"UNDER PROCESS - TPA" => 61, "UNDER PROCESS - TPA" => 61,
"DENIAL REVIEW AWAITED" => 66, "DENIAL REVIEW AWAITED" => 66,
"Pre-Auth Processed" => 9,
]; ];
$updateArray = [ $updateArray = [
@ -1328,6 +1330,7 @@ class MediAssistApiController extends BaseController
"RETURNED" => 14, "RETURNED" => 14,
"UNDER PROCESS - TPA" => 61, "UNDER PROCESS - TPA" => 61,
"DENIAL REVIEW AWAITED" => 66, "DENIAL REVIEW AWAITED" => 66,
"Pre-Auth Processed" => 9,
]; ];
foreach ($TicketData as $ticket) { foreach ($TicketData as $ticket) {
@ -1616,67 +1619,106 @@ class MediAssistApiController extends BaseController
$relationship = 'self'; $relationship = 'self';
} }
$ticket = $this->db->table('ticket_master tm')->select("tm.id") $claimNumber = $value['tpA_CLAIM_NO'] ?? null;
->where('tm.policy_no', $value['policY_NUMBER'])
->where('tm.emp_code', $value['employeE_NO'])
->where('tm.claim_amount', $value['estimateD_CLAIM_AMOUNT'])
->where('tm.doa', $this->mediDate($value['datE_OF_ADMISSION'] ?? null))
// ->where('tm.claim_number', $value['tpA_CLAIM_NO'])
->get()
->getRowArray();
if(!$ticket) // Same TPA claim number → update existing ticket (avoid duplicate when amount/dates change)
{ $ticket = null;
if (!empty($claimNumber)) {
$ticket = $this->db->table('ticket_master tm')->select("tm.id")
->where('tm.claim_number', $claimNumber)
->where('tm.claim_created_by', 'TPA')
->get()
->getRowArray();
}
// VALID STATUS LIST // VALID STATUS LIST
$validStatuses = [ $validStatuses = [
"Claim Received" => 1, "Claim Received" => 1,
"In Progress" => 5, "In Progress" => 5,
"Processed" => 11, "Processed" => 11,
"Claim Paid" => 11, "Claim Paid" => 11,
"Denied" => 13, "Denied" => 13,
"Cancelled" => 13, "Cancelled" => 13,
"Information Awaited" => 4, "Information Awaited" => 4,
"Confirmation Awaited" => 4, "Confirmation Awaited" => 4,
"Information Awaited Reminder" => 4, "Information Awaited Reminder" => 4,
"Information Awaited Final Reminder" => 4, "Information Awaited Final Reminder" => 4,
"Insurer Concurrence Awaited" => 7, "Insurer Concurrence Awaited" => 7,
"Closed" => 12, "Closed" => 12,
"Physical Documents Awaited" => 9, "Physical Documents Awaited" => 9,
"Processed - Payment Initiated" => 10, "Processed - Payment Initiated" => 10,
"Processed - Transaction Failed" => 10, "Processed - Transaction Failed" => 10,
"Processed - Account Details Updated" => 10, "Processed - Account Details Updated" => 10,
"Processed - Debit Note Raised With Insurer for Payment"=> 10, "Processed - Debit Note Raised With Insurer for Payment"=> 10,
"Processed - Payment Initiated by Insurer" => 10, "Processed - Payment Initiated by Insurer" => 10,
"Payment - Refunded to Insurer" => 14, "Payment - Refunded to Insurer" => 14,
"Processed - Processing Payment" => 10, "Processed - Processing Payment" => 10,
"Processed - Physical Documents Awaited" => 9, "Processed - Physical Documents Awaited" => 9,
"Pre-Auth Processed" => 8,
// Extra Mappings (based on your DB list)
// Extra Mappings (based on your DB list) "NON ID" => 1,
"NON ID" => 1, "ID NOT GENERATED" => 2,
"ID NOT GENERATED" => 2, "CDA" => 3,
"CDA" => 3, "REJECTED" => 8,
"REJECTED" => 8, "APPROVED" => 9,
"APPROVED" => 9, "PAYMENT INITIATED" => 10,
"PAYMENT INITIATED" => 10, "SETTLED" => 11,
"SETTLED" => 11, "RETURNED" => 14,
"RETURNED" => 14, "UNDER PROCESS - TPA" => 61,
"UNDER PROCESS - TPA" => 61, "DENIAL REVIEW AWAITED" => 66,
"DENIAL REVIEW AWAITED" => 66, "Pre-Auth Processed" => 9,
];
$currentStatus = trim($value['claim_Current_Status'] ?? '');
$claimStatusId = $validStatuses[$currentStatus] ?? null;
if (!$claimStatusId) {
log_message('error','MEDI_ASSIST - Sync TPA Claims | Unknown Claim Status: '.$currentStatus);
continue;
}
if ($ticket) {
// Update existing TPA claim with latest sync data
$updateData = [
'claim_status_id' => $claimStatusId,
'tpa_claim_status' => $currentStatus,
'tpa_claim_id' => $claimNumber,
'claim_amount' => $value['estimateD_CLAIM_AMOUNT']
?? $value['finaL_BILL_AMOUNT']
?? null,
'approved_amount' => $value['claiM_APPROVED_AMOUNT'] ?? null,
'doa' => $this->mediDate($value['datE_OF_ADMISSION'] ?? null),
'dod' => $this->mediDate($value['datE_OF_DISCHARGE'] ?? null),
'raised_date' => $this->mediDate($value['claiM_REGISTERED_DATE'] ?? null),
'approved_date' => $this->mediDate($value['approved_Date'] ?? null),
'settled_date' => $this->mediDate($value['paiD_DATE'] ?? null),
'hospital_name' => $value['hospitaL_NAME'] ?? null,
'hospital_address' => $value['hospitaL_ADDRESS'] ?? null,
'hospital_state' => $value['hospitaL_STATE'] ?? null,
'hospital_city' => $value['hospitaL_CITY'] ?? null,
'hospital_pin_code' => $value['hosP_PINCODE'] ?? null,
'utr_details' => $value['banK_CHEQUE_NO'] ?? null,
'settle_letter' => $value['settlement_LetterLink'] ?? null,
'tpa_claim_type' => $value['typE_OF_CLAIM'] ?? null,
'tpa_ailments' => ($value['ailment'] ?? '') . ' - ' . ($value['ailmenT_DESC'] ?? ''),
'tpa_claim_push_reference_no' => $value['clM_COMP_REFNO'] ?? null,
'updated_at' => date('Y-m-d H:i:s'),
'last_updated_by' => 'API',
]; ];
$currentStatus = trim($value['claim_Current_Status'] ?? ''); $this->db->table('ticket_master')->where('id', $ticket['id'])->update($updateData);
$claimStatusId = $validStatuses[$currentStatus] ?? null; log_message(
'error',
'MEDI_ASSIST - Sync TPA Claims | Existing claim updated | TicketID: '.$ticket['id'].' | Claim: '.$claimNumber
);
if (!$claimStatusId) { } else {
log_message('error','MEDI_ASSIST - Sync TPA Claims | Unknown Claim Status: '.$currentStatus);
continue;
}
$clientpolicy = $this->db->table('client_policy cp') $clientpolicy = $this->db->table('client_policy cp')
->select(" ->select("
@ -1710,15 +1752,13 @@ class MediAssistApiController extends BaseController
->get() ->get()
->getRowArray(); ->getRowArray();
$claimData = [ $claimData = [
// Core // Core
'ticket_type_id' => 1, 'ticket_type_id' => 1,
'claim_status_id' => $claimStatusId, 'claim_status_id' => $claimStatusId,
'policy_no' => $value['policY_NUMBER'] ?? null, 'policy_no' => $value['policY_NUMBER'] ?? null,
'claim_number' => $value['tpA_CLAIM_NO'] ?? null, 'claim_number' => $claimNumber,
'tpa_claim_id' => $value['tpA_CLAIM_NO'] ?? null, 'tpa_claim_id' => $claimNumber,
// local promary id // local promary id
'tpa_id' => $clientpolicy['tpa_id'] ?? null, 'tpa_id' => $clientpolicy['tpa_id'] ?? null,
@ -1770,19 +1810,18 @@ class MediAssistApiController extends BaseController
'tpa_ailments' => ($value['ailment'] ?? '') . ' - ' . ($value['ailmenT_DESC'] ?? ''), 'tpa_ailments' => ($value['ailment'] ?? '') . ' - ' . ($value['ailmenT_DESC'] ?? ''),
'claim_created_by' => 'TPA', 'claim_created_by' => 'TPA',
'tpa_claim_push_reference_no' => $value['clM_COMP_REFNO'] ?? null, 'tpa_claim_push_reference_no' => $value['clM_COMP_REFNO'] ?? null,
]; ];
$this->db->table('ticket_master')->insert($claimData); $this->db->table('ticket_master')->insert($claimData);
log_message( log_message(
'error', 'error',
'MEDI_ASSIST - Sync TPA Claims | New claim created | Policy: '.$claimData['policy_no'].' | Claim: '.$claimData['claim_number'] 'MEDI_ASSIST - Sync TPA Claims | New claim created | Policy: '.$claimData['policy_no'].' | Claim: '.$claimData['claim_number']
); );
} }
} }

View File

@ -435,10 +435,6 @@ class DigitExecutorService
protected function vehicleRowFromInput(array $input, int $quoteId): array protected function vehicleRowFromInput(array $input, int $quoteId): array
{ {
$plate = strtoupper(preg_replace('/\s+/', '', (string) ($input['license_plate_number'] ?? ''))); $plate = strtoupper(preg_replace('/\s+/', '', (string) ($input['license_plate_number'] ?? '')));
$authority = $input['registration_authority'] ?? null;
if (!$authority && strlen($plate) >= 4) {
$authority = substr($plate, 0, 4);
}
return [ return [
'quote_id' => $quoteId, 'quote_id' => $quoteId,
@ -449,7 +445,6 @@ class DigitExecutorService
'engine_number' => $input['engine_number'] ?? null, 'engine_number' => $input['engine_number'] ?? null,
'manufacture_date' => $input['manufacture_date'] ?? date('Y-m-d'), 'manufacture_date' => $input['manufacture_date'] ?? date('Y-m-d'),
'registration_date' => $input['registration_date'] ?? date('Y-m-d'), 'registration_date' => $input['registration_date'] ?? date('Y-m-d'),
'registration_authority' => $authority,
'idv' => $input['idv'] ?? 0, 'idv' => $input['idv'] ?? 0,
]; ];
} }

View File

@ -18,30 +18,11 @@ class MotorQuoteModel extends Model
'previous_insurer_code', 'previous_policy_expiry_date', 'external_policy_number', 'previous_insurer_code', 'previous_policy_expiry_date', 'external_policy_number',
'is_ncb_transfer', 'start_date', 'end_date', 'pincode', 'is_ncb_transfer', 'start_date', 'end_date', 'pincode',
'coverage_details', 'premium', 'idv', 'status', 'coverage_details', 'premium', 'idv', 'status',
'created_by', 'updated_by', 'created_at', 'updated_at', 'created_at', 'updated_at',
]; ];
protected $useTimestamps = true; protected $useTimestamps = true;
protected $createdField = 'created_at'; protected $createdField = 'created_at';
protected $updatedField = 'updated_at'; protected $updatedField = 'updated_at';
protected $allowCallbacks = true;
protected $beforeInsert = ['setCreatedBy'];
protected $beforeUpdate = ['setUpdatedBy'];
protected function setCreatedBy(array $data): array
{
if (function_exists('get_session_userid')) {
$data['data']['created_by'] = get_session_userid();
}
return $data;
}
protected function setUpdatedBy(array $data): array
{
if (function_exists('get_session_userid')) {
$data['data']['updated_by'] = get_session_userid();
}
return $data;
}
public function getListWithVehicle(array $filters = []): array public function getListWithVehicle(array $filters = []): array
{ {

View File

@ -15,7 +15,7 @@ class MotorVehicleModel extends Model
protected $allowedFields = [ protected $allowedFields = [
'quote_id', 'is_vehicle_new', 'vehicle_maincode', 'license_plate_number', 'quote_id', 'is_vehicle_new', 'vehicle_maincode', 'license_plate_number',
'vehicle_identification_number', 'engine_number', 'manufacture_date', 'vehicle_identification_number', 'engine_number', 'manufacture_date',
'registration_date', 'registration_authority', 'registration_date',
'idv', 'default_idv', 'minimum_idv', 'maximum_idv', 'idv', 'default_idv', 'minimum_idv', 'maximum_idv',
]; ];
protected $useTimestamps = false; protected $useTimestamps = false;