DB restructure, print page
This commit is contained in:
@@ -43,6 +43,7 @@ class CreateIdCardProviderSections < ActiveRecord::Migration[7.2]
|
||||
t.string :precert_4
|
||||
t.string :precert_5
|
||||
t.string :precert_6
|
||||
t.boolean :default, default: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class CreateIdCardRxSections < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :id_card_rx_sections do |t|
|
||||
t.string :title
|
||||
t.string :help_desk
|
||||
t.string :customer_service
|
||||
t.string :web_url
|
||||
|
||||
@@ -5,6 +5,7 @@ class CreateIdCardNetworkLogos < ActiveRecord::Migration[7.2]
|
||||
t.binary :image_data
|
||||
t.string :content_type
|
||||
t.float :aspect_ratio
|
||||
t.boolean :default, default: false
|
||||
t.boolean :active, default: false
|
||||
|
||||
t.timestamps
|
||||
|
||||
+3
-2
@@ -1,10 +1,11 @@
|
||||
class CreateIdCardSetups < ActiveRecord::Migration[7.2]
|
||||
class CreateIdCardConfigurations < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :id_card_setups do |t|
|
||||
create_table :id_card_configurations do |t|
|
||||
t.string :print_name
|
||||
t.string :network_provider
|
||||
t.string :card_template
|
||||
t.string :rx_group_number
|
||||
t.string :pl_plan_key
|
||||
t.boolean :active, default: false
|
||||
t.belongs_to :employer, null: false, foreign_key: true
|
||||
t.belongs_to :employer_logo, null: true, foreign_key: { to_table: :id_card_employer_logos }
|
||||
@@ -5,7 +5,7 @@ class CreateIdCardPlans < ActiveRecord::Migration[7.2]
|
||||
t.integer :pb_product_key
|
||||
t.string :pl_plan_key
|
||||
t.boolean :template
|
||||
t.belongs_to :setup, null: true, foreign_key: { to_table: :id_card_setups }
|
||||
t.belongs_to :configuration, null: true, foreign_key: { to_table: :id_card_configurations }
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
class CreateIdCardExceptions < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :id_card_exceptions do |t|
|
||||
t.string :type
|
||||
t.string :value
|
||||
t.belongs_to :setup, null: false, foreign_key: { to_table: :id_card_setups }
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
class CreateIdCardFieldExceptions < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :id_card_field_exceptions do |t|
|
||||
t.string :exception_type
|
||||
t.string :exception_value
|
||||
t.belongs_to :configuration, null: false, foreign_key: { to_table: :id_card_configurations }
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
class CreateIdCardExceptionItems < ActiveRecord::Migration[7.2]
|
||||
class CreateIdCardFieldExceptionItems < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :id_card_exception_items do |t|
|
||||
create_table :id_card_field_exception_items do |t|
|
||||
t.string :field_name
|
||||
t.string :field_value
|
||||
t.belongs_to :exception, null: false, foreign_key: { to_table: :id_card_exceptions }
|
||||
t.belongs_to :field_exception, null: false, foreign_key: { to_table: :id_card_field_exceptions }
|
||||
t.belongs_to :network_logo, null: true, foreign_key: { to_table: :id_card_network_logos }
|
||||
t.belongs_to :provider_section, null: true, foreign_key: { to_table: :id_card_provider_sections }
|
||||
|
||||
+17
-13
@@ -34,26 +34,26 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "id_card_exception_items", force: :cascade do |t|
|
||||
create_table "id_card_field_exception_items", force: :cascade do |t|
|
||||
t.string "field_name"
|
||||
t.string "field_value"
|
||||
t.bigint "exception_id", null: false
|
||||
t.bigint "field_exception_id", null: false
|
||||
t.bigint "network_logo_id"
|
||||
t.bigint "provider_section_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["exception_id"], name: "index_id_card_exception_items_on_exception_id"
|
||||
t.index ["network_logo_id"], name: "index_id_card_exception_items_on_network_logo_id"
|
||||
t.index ["provider_section_id"], name: "index_id_card_exception_items_on_provider_section_id"
|
||||
t.index ["field_exception_id"], name: "index_id_card_field_exception_items_on_field_exception_id"
|
||||
t.index ["network_logo_id"], name: "index_id_card_field_exception_items_on_network_logo_id"
|
||||
t.index ["provider_section_id"], name: "index_id_card_field_exception_items_on_provider_section_id"
|
||||
end
|
||||
|
||||
create_table "id_card_exceptions", force: :cascade do |t|
|
||||
t.string "type"
|
||||
t.string "value"
|
||||
create_table "id_card_field_exceptions", force: :cascade do |t|
|
||||
t.string "exception_type"
|
||||
t.string "exception_value"
|
||||
t.bigint "setup_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["setup_id"], name: "index_id_card_exceptions_on_setup_id"
|
||||
t.index ["setup_id"], name: "index_id_card_field_exceptions_on_setup_id"
|
||||
end
|
||||
|
||||
create_table "id_card_network_logos", force: :cascade do |t|
|
||||
@@ -61,6 +61,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
|
||||
t.binary "image_data"
|
||||
t.string "content_type"
|
||||
t.float "aspect_ratio"
|
||||
t.boolean "default", default: false
|
||||
t.boolean "active", default: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
@@ -208,11 +209,13 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
|
||||
t.string "precert_4"
|
||||
t.string "precert_5"
|
||||
t.string "precert_6"
|
||||
t.boolean "default", default: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "id_card_rx_sections", force: :cascade do |t|
|
||||
t.string "title"
|
||||
t.string "help_desk"
|
||||
t.string "customer_service"
|
||||
t.string "web_url"
|
||||
@@ -225,6 +228,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
|
||||
t.string "network_provider"
|
||||
t.string "card_template"
|
||||
t.string "rx_group_number"
|
||||
t.string "pl_plan_key"
|
||||
t.boolean "active", default: false
|
||||
t.bigint "employer_id", null: false
|
||||
t.bigint "employer_logo_id"
|
||||
@@ -255,10 +259,10 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
|
||||
t.index ["id_card_plan_id"], name: "index_members_on_id_card_plan_id"
|
||||
end
|
||||
|
||||
add_foreign_key "id_card_exception_items", "id_card_exceptions", column: "exception_id"
|
||||
add_foreign_key "id_card_exception_items", "id_card_network_logos", column: "network_logo_id"
|
||||
add_foreign_key "id_card_exception_items", "id_card_provider_sections", column: "provider_section_id"
|
||||
add_foreign_key "id_card_exceptions", "id_card_setups", column: "setup_id"
|
||||
add_foreign_key "id_card_field_exception_items", "id_card_field_exceptions", column: "field_exception_id"
|
||||
add_foreign_key "id_card_field_exception_items", "id_card_network_logos", column: "network_logo_id"
|
||||
add_foreign_key "id_card_field_exception_items", "id_card_provider_sections", column: "provider_section_id"
|
||||
add_foreign_key "id_card_field_exceptions", "id_card_setups", column: "setup_id"
|
||||
add_foreign_key "id_card_plan_benefits", "id_card_plans", column: "plan_id"
|
||||
add_foreign_key "id_card_plans", "id_card_setups", column: "setup_id"
|
||||
add_foreign_key "id_card_setups", "employers"
|
||||
|
||||
+66
-53
@@ -103,9 +103,10 @@ end
|
||||
# IdCardBenefit.create(sequence: i + 1, benefit_desc: bene, id_card_benefits_template: default)
|
||||
# end
|
||||
|
||||
# temp_2 = IdCardBenefitsTemplate.create(title: "Jason's Template")
|
||||
# (1..14).each do |seq|
|
||||
# IdCardBenefit.create(sequence: seq, benefit: "#{seq} hit wonder", id_card_benefits_template: temp_2)
|
||||
# temp_2 = IdCard::Plan.create(title: "Jason's Template", template: true)
|
||||
# temp_2.plan_benefits.each do |bene|
|
||||
# bene.benefit = "#{bene.sequence} hit wonder"
|
||||
# bene.save
|
||||
# end
|
||||
|
||||
# temp_1 = IdCardBenefitsTemplate.create(title: "Rebekah's Template")
|
||||
@@ -202,65 +203,77 @@ plan_headers.each do |ph|
|
||||
end
|
||||
end
|
||||
|
||||
# Vhcs::HlidCardProvider.all.each do |vhcs|
|
||||
# CardProvider.find_or_create_by(provider_code: vhcs.provider_code) do |cp|
|
||||
# cp.provider_line_1 = vhcs.provider_line_1
|
||||
# cp.provider_line_2 = vhcs.provider_line_2
|
||||
# cp.provider_line_3 = vhcs.provider_line_3
|
||||
# cp.provider_line_4 = vhcs.provider_line_4
|
||||
# cp.provider_line_5 = vhcs.provider_line_5
|
||||
# cp.provider_line_6 = vhcs.provider_line_6
|
||||
# cp.provider_line_7 = vhcs.provider_line_7
|
||||
# cp.provider_line_8 = vhcs.provider_line_8
|
||||
# cp.provider_line_9 = vhcs.provider_line_9
|
||||
# cp.provider_line_10 = vhcs.provider_line_10
|
||||
# cp.provider_line_11 = vhcs.provider_line_11
|
||||
# cp.provider_line_12 = vhcs.provider_line_12
|
||||
base_cp_provider_codes = ["5", "2"]
|
||||
needed_codes = %w(M T A I 8 7 1 6 3 P C V Y Z)
|
||||
# provider_code_map = {}
|
||||
vhcs_cp = Vhcs::HlidCardProvider.where(provider_code: base_cp_provider_codes).to_a + Vhcs::HlidCardProvider.where(provider_code: needed_codes).order(:provider_code).to_a
|
||||
vhcs_cp.each do |vhcs|
|
||||
attributes_hash = vhcs.attributes.except(:provider_code, :group_number)
|
||||
attributes_hash.delete_if { |key, value| !key.to_s.include?("_") }
|
||||
existing_cp = IdCard::ProviderSection.find_by(attributes_hash)
|
||||
|
||||
# cp.claim_to_1 = vhcs.claim_to_1
|
||||
# cp.claim_to_2 = vhcs.claim_to_2
|
||||
# cp.claim_to_3 = vhcs.claim_to_3
|
||||
# cp.claim_to_4 = vhcs.claim_to_4
|
||||
# cp.claim_to_5 = vhcs.claim_to_5
|
||||
# cp.claim_to_6 = vhcs.claim_to_6
|
||||
# cp.claim_to_7 = vhcs.claim_to_7
|
||||
# cp.claim_to_8 = vhcs.claim_to_8
|
||||
# cp.claim_to_9 = vhcs.claim_to_9
|
||||
# cp.claim_to_10 = vhcs.claim_to_10
|
||||
# cp.claim_to_11 = vhcs.claim_to_11
|
||||
# cp.claim_to_12 = vhcs.claim_to_12
|
||||
if existing_cp
|
||||
existing_cp.title = existing_cp.title.concat(vhcs.provider_code)
|
||||
existing_cp.save
|
||||
else
|
||||
title = case
|
||||
when vhcs.provider_line_1 == "PO Box 188061"
|
||||
"Cigna #{vhcs.provider_code}"
|
||||
when vhcs.provider_line_1.present?
|
||||
"#{vhcs.provider_line_1} #{vhcs.provider_code}"
|
||||
else
|
||||
"Medcost #{vhcs.provider_code}"
|
||||
end
|
||||
|
||||
# cp.mail_to = vhcs.mail_to
|
||||
# cp.mail_to_2 = vhcs.mail_to_2
|
||||
if base_cp_provider_codes.include?(vhcs.provider_code)
|
||||
attributes_hash[:default] = true
|
||||
end
|
||||
attributes_hash[:title] = title
|
||||
attributes_hash[:provider_code] = vhcs.provider_code
|
||||
|
||||
# cp.contact_line_1 = vhcs.contact_line_1
|
||||
# cp.contact_line_2 = vhcs.contact_line_2
|
||||
# cp.contact_line_3 = vhcs.contact_line_3
|
||||
IdCard::ProviderSection.find_or_create_by(attributes_hash)
|
||||
end
|
||||
|
||||
# cp.group_number = vhcs.group_number
|
||||
# cp.rx_group_id = vhcs.rx_group_id
|
||||
# cp.rx_contact = vhcs.rx_contact
|
||||
end
|
||||
|
||||
# cp.provider_lookup_1 = vhcs.provider_lookup_1
|
||||
# cp.provider_lookup_2 = vhcs.provider_lookup_2
|
||||
base_cp_provider_codes = ["5", "2"]
|
||||
needed_codes = %w(M T A I 8 7 1 6 3 P C V Y Z)
|
||||
# provider_code_map = {}
|
||||
vhcs_cp = Vhcs::HlidCardProvider.where(provider_code: base_cp_provider_codes).to_a + Vhcs::HlidCardProvider.where(provider_code: needed_codes).order(:provider_code).to_a
|
||||
vhcs_cp.each do |vhcs|
|
||||
attributes_hash = vhcs.attributes.except(:provider_code)
|
||||
attributes_hash.delete_if { |key, value| !key.to_s.include?("_") }
|
||||
existing_cp = IdCard::ProviderSection.find_by(attributes_hash)
|
||||
|
||||
# cp.precert_1 = vhcs.precert_1
|
||||
# cp.precert_2 = vhcs.precert_2
|
||||
# cp.precert_3 = vhcs.precert_3
|
||||
# cp.precert_4 = vhcs.precert_4
|
||||
# cp.precert_5 = vhcs.precert_5
|
||||
# cp.precert_6 = vhcs.precert_6
|
||||
|
||||
# end
|
||||
# end
|
||||
if existing_cp
|
||||
existing_cp
|
||||
# if provider_code_map[existing_cp.provider_code]
|
||||
# provider_code_map[existing_cp.provider_code].push(vhcs.provider_code)
|
||||
# else
|
||||
# provider_code_map[existing_cp.provider_code] = [vhcs.provider_code]
|
||||
# end
|
||||
else
|
||||
attributes_hash[:provider_code] = vhcs.provider_code
|
||||
IdCard::ProviderSection.find_or_create_by(attributes_hash)
|
||||
end
|
||||
end
|
||||
|
||||
Vhcs::HlrxCrosRef.all.each do |vhcs|
|
||||
rx = CardRx.find_or_create_by(help_desk: vhcs.help_desk, customer_service: vhcs.customer_service, web_url: vhcs.web_url)
|
||||
emp = Employer.find_by(pl_plan_key: vhcs.pl_plan_key)
|
||||
if emp.present?
|
||||
emp.card_rx = rx
|
||||
emp.save
|
||||
rx = IdCard::RxSection.find_or_create_by(help_desk: vhcs.help_desk, customer_service: vhcs.customer_service, web_url: vhcs.web_url)
|
||||
title = rx.web_url.gsub(/^www\./, '').gsub(/\.com\Z/, '')
|
||||
unless title.match?(/\A[A-Z]/)
|
||||
title = title.capitalize
|
||||
end
|
||||
|
||||
rx.title = title
|
||||
rx.save
|
||||
end
|
||||
|
||||
["CignaLogo.png", "MedCostLogo.png"].each do |logo_upload|
|
||||
new_logo = ImageProcessor.new("logo_files/network/#{logo_upload}", "Network").call
|
||||
new_logo.default = true
|
||||
new_logo.active = true
|
||||
new_logo.save
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user