DB restructure, print page

This commit is contained in:
Jason Jordan
2026-03-13 08:47:13 -04:00
parent 6a068243f4
commit 8c885b3e76
73 changed files with 1362 additions and 325 deletions
+13 -9
View File
@@ -3,7 +3,7 @@ namespace :employer do
desc "TODO"
# rake employer:vhcs_sync_all
task vhcs_sync_all: :environment do
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active' AND PLPlanKey = 65"
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active'"
plan_headers = VhcsRecord.connection.select_all(sql_query)
plan_headers.each do |ph|
@@ -13,28 +13,32 @@ namespace :employer do
em.plan_id = ph['PlanId'].strip.to_i
id_card_templates = determine_id_card_templates(em.pl_plan_key)
em.single_card_template = id_card_templates[:single_card_template]
em.multiple_card_template = id_card_templates[:multiple_card_template]
# id_card_templates = determine_id_card_templates(em.pl_plan_key)
# em.single_card_template = id_card_templates[:single_card_template]
# em.multiple_card_template = id_card_templates[:multiple_card_template]
id_card_setup = em.build_id_card_setup(pl_plan_key: em.pl_plan_key)
plan_code = Vhcs::HlPlanCode.find_by(plan_key: em.pl_plan_key)
em.group_number = plan_code.group_number
em.rx_group_number = plan_code.medical_number
id_card_setup.rx_group_number = plan_code.medical_number
em.effective_date = plan_code.effect_date.strftime("%m/%d/%Y")
pb_company_plan = Vhcs::PbCompanyPlans.find_by(pl_plan_key: em.pl_plan_key)
em.company_pb_entity_key = pb_company_plan.company_pb_entity_key
card_display_name = Vhcs::PbEntity.find_by(company_pb_entity_key: em.company_pb_entity_key).last_name
em.id_card_display_name = em.employer_trim_name(card_display_name)
card_print_name = Vhcs::PbEntity.find_by(company_pb_entity_key: em.company_pb_entity_key).last_name
id_card_setup.print_name = em.employer_trim_name(card_print_name)
em.default_network_logo = determine_network_logos(em.pl_plan_key)
id_card_setup.active = true
# em.default_network_logo = determine_network_logos(em.pl_plan_key)
end
vhcs_plans = Vhcs::PbProduct.where(company_pb_entity_key: import_employer.company_pb_entity_key)
vhcs_plans.each do |vp|
puts "~~ Importing #{vp.short_description}"
import_plan = import_employer.plans.find_or_create_by!(pb_product_key: vp.pb_product_key) do |pl|
import_plan = import_employer.id_card_setup.plans.find_or_create_by!(pb_product_key: vp.pb_product_key) do |pl|
pl.title = vp.short_description
end
vhcs_plan_benefits = Vhcs::HlEgglestonCardBenefit.where(plan_id: import_plan.pb_product_key)