Skip to content

Instantly share code, notes, and snippets.

@polodev
Last active March 3, 2022 05:54
Show Gist options
  • Save polodev/37aa6c688393ec35346b6e94c48ce579 to your computer and use it in GitHub Desktop.
Save polodev/37aa6c688393ec35346b6e94c48ce579 to your computer and use it in GitHub Desktop.
<?php
namespace App\Libraries;
// one year period
const pragati_health_insurance_plans = [
['plan' => 'pragati_health_insurance_plan_1', 'title' => 'Pragati Health Insurance - Plan 1', 'self_price' => 'p1_s', 'couple_price' => 'p1_c', 'child_price' => 'p1_x'],
['plan' => 'pragati_health_insurance_plan_2', 'title' => 'Pragati Health Insurance - Plan 2', 'self_price' => 'p2_s', 'couple_price' => 'p2_c', 'child_price' => 'p2_x'],
];
const pragati_health_adult_prices = [
['min_age' => 18, 'max_age' => 18, 'p1_s' => 10785, 'p1_c' => 10785, 'p2_s' => 18275, 'p2_c' => 18275],
['min_age' => 19, 'max_age' => 19, 'p1_s' => 10785, 'p1_c' => 10785, 'p2_s' => 18275, 'p2_c' => 18275],
['min_age' => 20, 'max_age' => 20, 'p1_s' => 10785, 'p1_c' => 10785, 'p2_s' => 18275, 'p2_c' => 18275],
['min_age' => 21, 'max_age' => 21, 'p1_s' => 12785, 'p1_c' => 12785, 'p2_s' => 24275, 'p2_c' => 24275],
['min_age' => 22, 'max_age' => 22, 'p1_s' => 12785, 'p1_c' => 12785, 'p2_s' => 24275, 'p2_c' => 24275],
['min_age' => 23, 'max_age' => 23, 'p1_s' => 12790, 'p1_c' => 12790, 'p2_s' => 24285, 'p2_c' => 24285],
['min_age' => 24, 'max_age' => 24, 'p1_s' => 12790, 'p1_c' => 12790, 'p2_s' => 24285, 'p2_c' => 24285],
['min_age' => 25, 'max_age' => 25, 'p1_s' => 12790, 'p1_c' => 12790, 'p2_s' => 24285, 'p2_c' => 24285],
['min_age' => 26, 'max_age' => 26, 'p1_s' => 12800, 'p1_c' => 12800, 'p2_s' => 24305, 'p2_c' => 24305],
['min_age' => 27, 'max_age' => 27, 'p1_s' => 12800, 'p1_c' => 12800, 'p2_s' => 24305, 'p2_c' => 24305],
['min_age' => 28, 'max_age' => 28, 'p1_s' => 12805, 'p1_c' => 12805, 'p2_s' => 24315, 'p2_c' => 24315],
['min_age' => 29, 'max_age' => 29, 'p1_s' => 12810, 'p1_c' => 12810, 'p2_s' => 24325, 'p2_c' => 24325],
['min_age' => 30, 'max_age' => 30, 'p1_s' => 12820, 'p1_c' => 12820, 'p2_s' => 24345, 'p2_c' => 24345],
['min_age' => 31, 'max_age' => 31, 'p1_s' => 14830, 'p1_c' => 14830, 'p2_s' => 25365, 'p2_c' => 25365],
['min_age' => 32, 'max_age' => 32, 'p1_s' => 14845, 'p1_c' => 14845, 'p2_s' => 25395, 'p2_c' => 25395],
['min_age' => 33, 'max_age' => 33, 'p1_s' => 14865, 'p1_c' => 14865, 'p2_s' => 25435, 'p2_c' => 25435],
['min_age' => 34, 'max_age' => 34, 'p1_s' => 14890, 'p1_c' => 14890, 'p2_s' => 25485, 'p2_c' => 25485],
['min_age' => 35, 'max_age' => 35, 'p1_s' => 14925, 'p1_c' => 14925, 'p2_s' => 25555, 'p2_c' => 25555],
['min_age' => 36, 'max_age' => 36, 'p1_s' => 14970, 'p1_c' => 14970, 'p2_s' => 25645, 'p2_c' => 25645],
['min_age' => 37, 'max_age' => 37, 'p1_s' => 15025, 'p1_c' => 15025, 'p2_s' => 25755, 'p2_c' => 25755],
['min_age' => 38, 'max_age' => 38, 'p1_s' => 15100, 'p1_c' => 15100, 'p2_s' => 25905, 'p2_c' => 25905],
['min_age' => 39, 'max_age' => 39, 'p1_s' => 15185, 'p1_c' => 15185, 'p2_s' => 26075, 'p2_c' => 26075],
['min_age' => 40, 'max_age' => 40, 'p1_s' => 15300, 'p1_c' => 15300, 'p2_s' => 26305, 'p2_c' => 26305],
['min_age' => 41, 'max_age' => 41, 'p1_s' => 24430, 'p1_c' => 24430, 'p2_s' => 38565, 'p2_c' => 38565],
['min_age' => 42, 'max_age' => 42, 'p1_s' => 24585, 'p1_c' => 24585, 'p2_s' => 38875, 'p2_c' => 38875],
['min_age' => 43, 'max_age' => 43, 'p1_s' => 24770, 'p1_c' => 24770, 'p2_s' => 39245, 'p2_c' => 39245],
['min_age' => 44, 'max_age' => 44, 'p1_s' => 24990, 'p1_c' => 24990, 'p2_s' => 39685, 'p2_c' => 39685],
['min_age' => 45, 'max_age' => 45, 'p1_s' => 25245, 'p1_c' => 25245, 'p2_s' => 40195, 'p2_c' => 40195],
['min_age' => 46, 'max_age' => 46, 'p1_s' => 25525, 'p1_c' => 25525, 'p2_s' => 40755, 'p2_c' => 40755],
['min_age' => 47, 'max_age' => 47, 'p1_s' => 25845, 'p1_c' => 25845, 'p2_s' => 41395, 'p2_c' => 41395],
['min_age' => 48, 'max_age' => 48, 'p1_s' => 26205, 'p1_c' => 26205, 'p2_s' => 42115, 'p2_c' => 42115],
['min_age' => 49, 'max_age' => 49, 'p1_s' => 26605, 'p1_c' => 26605, 'p2_s' => 42915, 'p2_c' => 42915],
['min_age' => 50, 'max_age' => 50, 'p1_s' => 27040, 'p1_c' => 27040, 'p2_s' => 43785, 'p2_c' => 43785],
['min_age' => 51, 'max_age' => 51, 'p1_s' => 34520, 'p1_c' => 34520, 'p2_s' => 58745, 'p2_c' => 58745],
['min_age' => 52, 'max_age' => 52, 'p1_s' => 35045, 'p1_c' => 35045, 'p2_s' => 59795, 'p2_c' => 59795],
['min_age' => 53, 'max_age' => 53, 'p1_s' => 35625, 'p1_c' => 35625, 'p2_s' => 60955, 'p2_c' => 60955],
['min_age' => 54, 'max_age' => 54, 'p1_s' => 36250, 'p1_c' => 36250, 'p2_s' => 62205, 'p2_c' => 62205],
['min_age' => 55, 'max_age' => 55, 'p1_s' => 36945, 'p1_c' => 36945, 'p2_s' => 63595, 'p2_c' => 63595],
['min_age' => 56, 'max_age' => 56, 'p1_s' => 46700, 'p1_c' => 46700, 'p2_s' => 78105, 'p2_c' => 78105],
['min_age' => 57, 'max_age' => 57, 'p1_s' => 47525, 'p1_c' => 47525, 'p2_s' => 79755, 'p2_c' => 79755],
['min_age' => 58, 'max_age' => 58, 'p1_s' => 48430, 'p1_c' => 48430, 'p2_s' => 81565, 'p2_c' => 81565],
['min_age' => 59, 'max_age' => 59, 'p1_s' => 49425, 'p1_c' => 49425, 'p2_s' => 83555, 'p2_c' => 83555],
['min_age' => 60, 'max_age' => 60, 'p1_s' => 50510, 'p1_c' => 50510, 'p2_s' => 85725, 'p2_c' => 85725],
];
const pragati_health_child_prices = [
['p1_x' => 10785, 'p2_x' => 18275],
];
// one year period
const green_delta_health_insurance_plans = [
['plan' => 'green_delta_health_insurance_plan_1', 'title' => 'Green Delta Health Insurance - Plan 1', 'self_price' => 'p1_s', 'couple_price' => 'p1_c', 'child_price' => 'p1_x'],
['plan' => 'green_delta_health_insurance_plan_2', 'title' => 'Green Delta Health Insurance - Plan 2', 'self_price' => 'p2_s', 'couple_price' => 'p2_c', 'child_price' => 'p2_x'],
['plan' => 'green_delta_health_insurance_plan_3', 'title' => 'Green Delta Health Insurance - Plan 3', 'self_price' => 'p3_s', 'couple_price' => 'p3_c', 'child_price' => 'p3_x'],
];
const green_delta_health_adult_prices = [
['min_age' => 18, 'max_age' => 35, 'p1_s' => 809, 'p1_c' => 1478, 'p2_s' => 1618, 'p2_c' => 2956, 'p3_s' => 2086, 'p3_c' => 3860],
['min_age' => 36, 'max_age' => 45, 'p1_s' => 991, 'p1_c' => 1861, 'p2_s' => 1982, 'p2_c' => 3722, 'p3_s' => 2608, 'p3_c' => 4824],
['min_age' => 46, 'max_age' => 50, 'p1_s' => 1404, 'p1_c' => 2643, 'p2_s' => 2808, 'p2_c' => 5286, 'p3_s' => 3652, 'p3_c' => 6758],
['min_age' => 51, 'max_age' => 55, 'p1_s' => 2026, 'p1_c' => 3757, 'p2_s' => 4052, 'p2_c' => 7514, 'p3_s' => 5218, 'p3_c' => 9650],
['min_age' => 56, 'max_age' => 60, 'p1_s' => 2852, 'p1_c' => 5287, 'p2_s' => 5704, 'p2_c' => 10574, 'p3_s' => 7304, 'p3_c' => 13514],
];
const green_delta_health_child_prices = [
['p1_x' => 678, 'p2_x' => 1356, 'p3_x' => 1774],
];
// for one year period
const pragati_life_hospital_cash_plans = [
['id' => 1, 'plan' => 'pragati_life_hospital_cash_bronze', 'title' => 'Hospital Cash - Bronze by Pragati Life', 'provider' => 'Pragati Life Insurance Limited', 'adults' => 2, 'children' => 0, 'child_min_age' => 7, 'child_max_age' => 215, 'age_type' => 'months', 'coverage' => 77000, 'floater' => false, 'active' => true, ],
['id' => 2, 'plan' => 'pragati_life_hospital_cash_silver', 'title' => 'Hospital Cash - Silver by Pragati Life', 'provider' => 'Pragati Life Insurance Limited', 'adults' => 2, 'children' => 1, 'child_min_age' => 7, 'child_max_age' => 215, 'age_type' => 'months', 'coverage' => 115000, 'floater' => true, 'active' => true, ],
['id' => 3, 'plan' => 'pragati_life_hospital_cash_gold', 'title' => 'Hospital Cash - Gold by Pragati Life', 'provider' => 'Pragati Life Insurance Limited', 'adults' => 2, 'children' => 2, 'child_min_age' => 7, 'child_max_age' => 215, 'age_type' => 'months', 'coverage' => 405000, 'floater' => true, 'active' => true, ],
];
// for one year period
const pragati_life_hospital_cash_prices = [
['plan_id' => 1, 'min_age' => 18, 'max_age' => 64, 'one_adult' => 1399, 'two_adult' => 2798, 'one_adult_one_child' => null, 'one_adult_two_child' => null, 'two_adult_one_child' => null, 'two_adult_two_child' => null, ],
['plan_id' => 2, 'min_age' => 18, 'max_age' => 64, 'one_adult' => 2399, 'two_adult' => 3499, 'one_adult_one_child' => 3499, 'one_adult_two_child' => null, 'two_adult_one_child' => null, 'two_adult_two_child' => null, ],
['plan_id' => 3, 'min_age' => 18, 'max_age' => 64, 'one_adult' => 3799, 'two_adult' => 5499, 'one_adult_one_child' => 5499, 'one_adult_two_child' => 5899, 'two_adult_one_child' => 5899, 'two_adult_two_child' => 5899, ],
];
// for one year period
const biker_bima = [
['min_age' => 18, 'max_age' => 70, 'price' => 299],
];
const biker_bima_pro = [
['min_age' => 18, 'max_age' => 70, 'price' => 599],
];

policybazaar india

https://health.policybazaar.com/product-detail?encenq=TjJ3M1FnMVNpZ2o0M3B3SmNaTkk5YktGeS9ETndxMExGRkxlb0pIZTlOdz0&enquiryid=Mzc4OTczMTQx&pq=health0&profileid=77553246&utm_content=home_v10&term=3

Question:

How can we design our database

plans table

  • id int - (1)
  • title string - (Green Delta Health insurance)
  • slug string - (green-delta-health-insurance)
  • description text - ('this is the long description')
  • othes_column

plan_prices

  • id - int ( 1)
  • plan_id - int - (1) - foreign id
  • min_age - int - (18)
  • max_age - int - (64)
  • one_adult_price - int - (3799)
  • two_adult_price - int - (5499)
  • one_adult_one_child_price - int - (5499)
  • one_adult_two_child_price - int - (5899)
  • two_adult_one_child_price - int - (5999)
  • two_adult_two_child_price - int - (6200)

Currently we are having 6 types of price for each age range in plan_prices table. one_adult_price two_adult_price one_adult_one_child_price one_adult_two_child_price two_adult_one_child_price two_adult_two_child_price. what if there will be more pricing for grandma, grand pa, another kids, father in law, mother in law ?

Problem

Plan is having variation like following

  • Age - currently implemented (Solved Wrong Way (min max age range))

    • 20 - 25years
    • 26 - 30 years
    • 31 - 40 years
    • 41 - 45 years
    • 46 - 50 years
    • 51 - 60 years
    • 61 - 69 years
  • coverage

    • 1 lac coverage
    • 3 lac coverage
    • 5 lac coverage
    • 8 lac coverage
    • 10 lac coverage
  • Policy Period

    • 1 Year
    • 2 Year
    • 3 Year
    • 4 Year
    • 5 Year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment