DB restructure, print page
This commit is contained in:
+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