[WIP] Corporate Plan
This commit is contained in:
@@ -8,4 +8,138 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Plan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
"service_code",
|
||||
"corporate_plan_id",
|
||||
"code",
|
||||
"type",
|
||||
"start",
|
||||
"end",
|
||||
"require_referral",
|
||||
"referral_source",
|
||||
"referral_duration",
|
||||
"family_plan",
|
||||
"family_plan_share_rules",
|
||||
"limit_rules",
|
||||
"layer",
|
||||
"layer_conditions",
|
||||
"budget_type",
|
||||
"budget_code",
|
||||
"budget_conditions",
|
||||
"surgery_limit",
|
||||
"non_surgery_limit",
|
||||
"max_claim_limit",
|
||||
"max_claim_count",
|
||||
"area_limit",
|
||||
"limit_shared_plans",
|
||||
"limit_shared_plan_type",
|
||||
"cashless_percentage",
|
||||
"reimbursement_percentage",
|
||||
"digital_percentage",
|
||||
"co_share_m_percentage",
|
||||
"co_share_s_percentage",
|
||||
"co_share_c_percentage",
|
||||
"cashless_deductible",
|
||||
"reimbursement_deductible",
|
||||
"digital_deductible",
|
||||
"co_share_m_deductible",
|
||||
"co_share_s_deductible",
|
||||
"co_share_c_deductible",
|
||||
"co_share_deductible_condition",
|
||||
"msc",
|
||||
"genders",
|
||||
"min_age",
|
||||
"max_age",
|
||||
"rule_of_excess",
|
||||
"max_excess_covered",
|
||||
"prorate_type",
|
||||
"prorate_lookup",
|
||||
"currency",
|
||||
"max_surgery_reinstatement_days",
|
||||
"max_surgery_periode_days",
|
||||
];
|
||||
|
||||
public static $doc_headers_to_field_map = [
|
||||
"Service" => "service_code",
|
||||
"Plan" => "corporate_plan_id",
|
||||
"Customer Plan" => "code",
|
||||
"Plan Type" => "type",
|
||||
"Start Date of Plan" => "start",
|
||||
"End Date of Plan" => "end",
|
||||
"Referral" => "require_referral",
|
||||
"Referral Source" => "referral_source",
|
||||
"Referral Duration" => "referral_duration",
|
||||
"Family Plan" => "family_plan",
|
||||
"Family Sharing Overflow" => "family_plan_share_rules",
|
||||
"Plan Limit" => "limit_rules",
|
||||
"Layer ID" => "layer",
|
||||
"Layer Condition" => "layer_conditions",
|
||||
"Budget Type" => "budget_type",
|
||||
"Budget Code" => "budget_code",
|
||||
"Budget Condition" => "budget_conditions",
|
||||
"Surgery" => "surgery_limit",
|
||||
"Non Surgery" => "non_surgery_limit",
|
||||
"Max/Claim" => "max_claim_limit",
|
||||
"Max Count of Claim" => "max_claim_count",
|
||||
"Area" => "area_limit",
|
||||
"Shared Plan" => "limit_shared_plans",
|
||||
"Shared Plan Type" => "limit_shared_plan_type",
|
||||
"Cashless(%)" => "cashless_percentage",
|
||||
"Reimbursement(%)" => "reimbursement_percentage",
|
||||
"Digital(%)" => "digital_percentage",
|
||||
"CoShareM(%)" => "co_share_m_percentage",
|
||||
"CoShareS(%)" => "co_share_s_percentage",
|
||||
"CoShareC(%)" => "co_share_c_percentage",
|
||||
"Cashless Deductible" => "cashless_deductible",
|
||||
"Reimbursement Deductible" => "reimbursement_deductible",
|
||||
"Digital Deductible" => "digital_deductible",
|
||||
"DeductibleM" => "co_share_m_deductible",
|
||||
"DeductibleS" => "co_share_s_deductible",
|
||||
"DeductibleC" => "co_share_c_deductible",
|
||||
"Co-share & Deductible Condition" => "co_share_deductible_condition",
|
||||
"MSC" => "msc",
|
||||
"Gender" => "genders",
|
||||
"Min Age" => "min_age",
|
||||
"Max Age" => "max_age",
|
||||
"Rule of Excess" => "rule_of_excess",
|
||||
"Max Excess Covered" => "max_excess_covered",
|
||||
"Prorate Type" => "prorate_type",
|
||||
"Prorate Lookup" => "prorate_lookup",
|
||||
"Currency" => "currency",
|
||||
"Reinstatement days for Surgery NonSurgery" => "max_surgery_reinstatement_days",
|
||||
"Max Periode of Surgery Non Surgery" => "max_surgery_periode_days",
|
||||
];
|
||||
|
||||
public function setStartAttribute($value)
|
||||
{
|
||||
return empty($valu) ? null : $value;
|
||||
}
|
||||
|
||||
public function setEndAttribute($value)
|
||||
{
|
||||
return empty($valu) ? null : $value;
|
||||
}
|
||||
|
||||
public function scopeFilter($query, array $filters)
|
||||
{
|
||||
$query->when($filters['search'] ?? false, function ($query, $search) {
|
||||
return $query
|
||||
->where('service_code', 'like', "%" . $search . "%")
|
||||
->orWhere('code', 'like', "%" . $search . "%")
|
||||
->orWhereHas('corporatePlan', function ($query) use ($search) {
|
||||
$query->where('code', 'like', "%" . $search . "%");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public function corporatePlan()
|
||||
{
|
||||
return $this->belongsTo(CorporatePlan::class);
|
||||
}
|
||||
|
||||
// public function Corporate()
|
||||
// {
|
||||
// return $this->belongsTo(Corporate::class);
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user