add validasi import member ship

This commit is contained in:
2023-05-17 09:16:42 +07:00
parent a454461449
commit da68ae3e05
9 changed files with 273 additions and 10 deletions

View File

@@ -174,6 +174,7 @@ class MemberEnrollmentService
"ingestion_code" => "Ingestion Code",
"ingestion_status" => "Ingestion Status",
];
public $result_doc_headers = [
"Record Mode",
"Record Type",
@@ -246,6 +247,78 @@ class MemberEnrollmentService
"Ingestion Status",
];
public $listing_doc_headers = [
// "Record Mode",
"Record Type",
"Payor ID",
"Member ID",
"Mapping ID",
"Link Medis Member ID",
"Corporate ID",
"NIK",
"Division",
"Branch Code",
"Bank Info",
"Language",
"Type of work",
"Race",
"Policy Number",
// "Policy No.",
"Marital Status",
"Relationship",
"Member's Effective Date",
"Member's Expiry Date",
"Faskes FKTP (First Level Provider) or Individual preferred provider",
"Faskes FKRTL (Next Level Provider) or Individual group preferred provider",
"The Right Classes Room of BPJS Participants",
"Name of Faskes",
"Rule BPJSK",
"Internal Use",
"Member Name",
"Address1",
// "Address 1",
"Address2",
"Address3",
"Address4",
"City",
"State",
"Post Code",
"Telephone - Mobile",
"Telephone - Res",
"Telephone - Office",
"NRIC",
"Passport No",
"Passport Country",
"Email",
"Identification Code",
"Date of Birth",
"Sex",
"Internal Use",
"Plan-ID",
"Employment-Status",
"Internal Use",
"Internal Use",
"Internal Use",
"Date Terminated",
"Pre Existing",
"BPJS ID",
"Endorsement Date",
"Remarks",
"Internal Use",
"Member Since",
"Internal Use",
"Policy Inforce",
"Member Suspended",
"Activation Date",
"Internal Use",
"StartNoClaim",
"EndNoClaim",
"Option Mode",
// "Renewal Activation Date",
// "Ingestion Code",
// "Ingestion Status",
];
public function __construct(Member $member)
{
$this->member = $member;
@@ -462,9 +535,13 @@ class MemberEnrollmentService
"members_expire_date" => $row['member_expiry_date'] ?? null,
"activation_date" => $row['activation_date'] ?? null,
"terminated_date" => $row['date_terminated'] ?? null,
"telephone_mobile" => $row['telephone_mobile'] ?? null,
"telephone_res" => $row['telephone_res'] ?? null,
"telephone_office" => $row['telephone_office'] ?? null,
];
$this->validateRow($row);
// $this->validateRow($row);
if (!isset($corporate->currentPolicy) || $corporate->currentPolicy->code != $row['policy_number']) {
throw new ImportRowException(__('enrollment.POLICY_NUMBER_NOT_MATCH', [
'policy_id' => $row['policy_number']
@@ -556,6 +633,7 @@ class MemberEnrollmentService
switch ($row['record_mode']) {
case "1": // New Member
$this->validateRow($row);
$member = Member::query()
->where('member_id', $row['member_id'])
// ->whereHas('employeds', function ($query) use ($corporate) {
@@ -608,11 +686,6 @@ class MemberEnrollmentService
if (!$plan) {
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
}
$this->validateRow($row);
try {
DB::beginTransaction();
@@ -675,6 +748,7 @@ class MemberEnrollmentService
}
break;
case "2": // Member Information Update (Without Replacement Card)
$this->validateRow($row);
$member = Member::query()
->where('member_id', $row['member_id'])
->first();
@@ -686,9 +760,6 @@ class MemberEnrollmentService
'policy_id' => $row['policy_number']
]), 0, null, $row);
}
$this->validateRow($row);
try {
$memberPolicy = MemberPolicy::query()
->where('policy_id', $row['policy_number'])