MERGE_TEST_BUG_FIXES
This commit is contained in:
commit
15dff5e87b
@ -629,6 +629,7 @@ class MediAssistApiController extends BaseController
|
||||
"RETURNED" => 14,
|
||||
"UNDER PROCESS - TPA" => 61,
|
||||
"DENIAL REVIEW AWAITED" => 66,
|
||||
"Pre-Auth Processed" => 9,
|
||||
];
|
||||
|
||||
$updateArray = [
|
||||
@ -1197,6 +1198,7 @@ class MediAssistApiController extends BaseController
|
||||
"RETURNED" => 14,
|
||||
"UNDER PROCESS - TPA" => 61,
|
||||
"DENIAL REVIEW AWAITED" => 66,
|
||||
"Pre-Auth Processed" => 9,
|
||||
];
|
||||
|
||||
$updateArray = [
|
||||
@ -1328,6 +1330,7 @@ class MediAssistApiController extends BaseController
|
||||
"RETURNED" => 14,
|
||||
"UNDER PROCESS - TPA" => 61,
|
||||
"DENIAL REVIEW AWAITED" => 66,
|
||||
"Pre-Auth Processed" => 9,
|
||||
];
|
||||
|
||||
foreach ($TicketData as $ticket) {
|
||||
@ -1616,67 +1619,106 @@ class MediAssistApiController extends BaseController
|
||||
$relationship = 'self';
|
||||
}
|
||||
|
||||
$ticket = $this->db->table('ticket_master tm')->select("tm.id")
|
||||
->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();
|
||||
$claimNumber = $value['tpA_CLAIM_NO'] ?? null;
|
||||
|
||||
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
|
||||
$validStatuses = [
|
||||
// VALID STATUS LIST
|
||||
$validStatuses = [
|
||||
|
||||
"Claim Received" => 1,
|
||||
"In Progress" => 5,
|
||||
"Processed" => 11,
|
||||
"Claim Paid" => 11,
|
||||
"Denied" => 13,
|
||||
"Cancelled" => 13,
|
||||
|
||||
"Information Awaited" => 4,
|
||||
"Confirmation Awaited" => 4,
|
||||
"Information Awaited Reminder" => 4,
|
||||
"Information Awaited Final Reminder" => 4,
|
||||
"Insurer Concurrence Awaited" => 7,
|
||||
"Closed" => 12,
|
||||
|
||||
"Physical Documents Awaited" => 9,
|
||||
"Processed - Payment Initiated" => 10,
|
||||
"Processed - Transaction Failed" => 10,
|
||||
"Processed - Account Details Updated" => 10,
|
||||
"Processed - Debit Note Raised With Insurer for Payment"=> 10,
|
||||
"Processed - Payment Initiated by Insurer" => 10,
|
||||
"Payment - Refunded to Insurer" => 14,
|
||||
"Processed - Processing Payment" => 10,
|
||||
"Processed - Physical Documents Awaited" => 9,
|
||||
"Pre-Auth Processed" => 8,
|
||||
|
||||
// Extra Mappings (based on your DB list)
|
||||
"NON ID" => 1,
|
||||
"ID NOT GENERATED" => 2,
|
||||
"CDA" => 3,
|
||||
"REJECTED" => 8,
|
||||
"APPROVED" => 9,
|
||||
"PAYMENT INITIATED" => 10,
|
||||
"SETTLED" => 11,
|
||||
"RETURNED" => 14,
|
||||
"UNDER PROCESS - TPA" => 61,
|
||||
"DENIAL REVIEW AWAITED" => 66,
|
||||
"Claim Received" => 1,
|
||||
"In Progress" => 5,
|
||||
"Processed" => 11,
|
||||
"Claim Paid" => 11,
|
||||
"Denied" => 13,
|
||||
"Cancelled" => 13,
|
||||
|
||||
"Information Awaited" => 4,
|
||||
"Confirmation Awaited" => 4,
|
||||
"Information Awaited Reminder" => 4,
|
||||
"Information Awaited Final Reminder" => 4,
|
||||
"Insurer Concurrence Awaited" => 7,
|
||||
"Closed" => 12,
|
||||
|
||||
"Physical Documents Awaited" => 9,
|
||||
"Processed - Payment Initiated" => 10,
|
||||
"Processed - Transaction Failed" => 10,
|
||||
"Processed - Account Details Updated" => 10,
|
||||
"Processed - Debit Note Raised With Insurer for Payment"=> 10,
|
||||
"Processed - Payment Initiated by Insurer" => 10,
|
||||
"Payment - Refunded to Insurer" => 14,
|
||||
"Processed - Processing Payment" => 10,
|
||||
"Processed - Physical Documents Awaited" => 9,
|
||||
|
||||
// Extra Mappings (based on your DB list)
|
||||
"NON ID" => 1,
|
||||
"ID NOT GENERATED" => 2,
|
||||
"CDA" => 3,
|
||||
"REJECTED" => 8,
|
||||
"APPROVED" => 9,
|
||||
"PAYMENT INITIATED" => 10,
|
||||
"SETTLED" => 11,
|
||||
"RETURNED" => 14,
|
||||
"UNDER PROCESS - TPA" => 61,
|
||||
"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) {
|
||||
log_message('error','MEDI_ASSIST - Sync TPA Claims | Unknown Claim Status: '.$currentStatus);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
||||
$clientpolicy = $this->db->table('client_policy cp')
|
||||
->select("
|
||||
@ -1710,15 +1752,13 @@ class MediAssistApiController extends BaseController
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
|
||||
|
||||
$claimData = [
|
||||
// Core
|
||||
'ticket_type_id' => 1,
|
||||
'claim_status_id' => $claimStatusId,
|
||||
'policy_no' => $value['policY_NUMBER'] ?? null,
|
||||
'claim_number' => $value['tpA_CLAIM_NO'] ?? null,
|
||||
'tpa_claim_id' => $value['tpA_CLAIM_NO'] ?? null,
|
||||
'claim_number' => $claimNumber,
|
||||
'tpa_claim_id' => $claimNumber,
|
||||
|
||||
// local promary id
|
||||
'tpa_id' => $clientpolicy['tpa_id'] ?? null,
|
||||
@ -1770,19 +1810,18 @@ class MediAssistApiController extends BaseController
|
||||
'tpa_ailments' => ($value['ailment'] ?? '') . ' - ' . ($value['ailmenT_DESC'] ?? ''),
|
||||
'claim_created_by' => 'TPA',
|
||||
'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(
|
||||
'error',
|
||||
'MEDI_ASSIST - Sync TPA Claims | New claim created | Policy: '.$claimData['policy_no'].' | Claim: '.$claimData['claim_number']
|
||||
);
|
||||
log_message(
|
||||
'error',
|
||||
'MEDI_ASSIST - Sync TPA Claims | New claim created | Policy: '.$claimData['policy_no'].' | Claim: '.$claimData['claim_number']
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -435,10 +435,6 @@ class DigitExecutorService
|
||||
protected function vehicleRowFromInput(array $input, int $quoteId): array
|
||||
{
|
||||
$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 [
|
||||
'quote_id' => $quoteId,
|
||||
@ -449,7 +445,6 @@ class DigitExecutorService
|
||||
'engine_number' => $input['engine_number'] ?? null,
|
||||
'manufacture_date' => $input['manufacture_date'] ?? date('Y-m-d'),
|
||||
'registration_date' => $input['registration_date'] ?? date('Y-m-d'),
|
||||
'registration_authority' => $authority,
|
||||
'idv' => $input['idv'] ?? 0,
|
||||
];
|
||||
}
|
||||
|
||||
@ -18,30 +18,11 @@ class MotorQuoteModel extends Model
|
||||
'previous_insurer_code', 'previous_policy_expiry_date', 'external_policy_number',
|
||||
'is_ncb_transfer', 'start_date', 'end_date', 'pincode',
|
||||
'coverage_details', 'premium', 'idv', 'status',
|
||||
'created_by', 'updated_by', 'created_at', 'updated_at',
|
||||
'created_at', 'updated_at',
|
||||
];
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'created_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
|
||||
{
|
||||
|
||||
@ -15,7 +15,7 @@ class MotorVehicleModel extends Model
|
||||
protected $allowedFields = [
|
||||
'quote_id', 'is_vehicle_new', 'vehicle_maincode', 'license_plate_number',
|
||||
'vehicle_identification_number', 'engine_number', 'manufacture_date',
|
||||
'registration_date', 'registration_authority',
|
||||
'registration_date',
|
||||
'idv', 'default_idv', 'minimum_idv', 'maximum_idv',
|
||||
];
|
||||
protected $useTimestamps = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user