196 lines
6.0 KiB
Ruby
196 lines
6.0 KiB
Ruby
def determine_id_card_templates(pl_plan_key)
|
||
pl_plan_key = pl_plan_key.to_i
|
||
|
||
case pl_plan_key
|
||
when 2
|
||
"SmartIDCard"
|
||
when 3
|
||
"TPAIDCardTan"
|
||
when 56
|
||
"HealthBusIDCard"
|
||
else
|
||
"FairosIDCard"
|
||
end
|
||
end
|
||
|
||
def determine_id_card_network(pl_plan_key)
|
||
pl_plan_key = pl_plan_key.to_i
|
||
|
||
cigna_groups = [13,20,39,48,49,51,53,54,56,58,60,61,62,65,67,68]
|
||
medcost_groups = [4,5,16,23,33,55,57,59,63,66]
|
||
old_cigna_groups = [19,21]
|
||
smart_medcost = [2]
|
||
tan_medcost = [3]
|
||
|
||
case
|
||
when cigna_groups.include?(pl_plan_key)
|
||
{ provider: "Cigna", network_logo: "CignaLogo.png", provider_section: "Cigna" }
|
||
when medcost_groups.include?(pl_plan_key)
|
||
{ provider: "MedCost", network_logo: "MedcostLogo.png", provider_section: "MedCost" }
|
||
when old_cigna_groups.include?(pl_plan_key)
|
||
{ provider: "Cigna", network_logo: "CignaLogo.png", provider_section: "Cigna (Beam/Stevens)" }
|
||
when smart_medcost.include?(pl_plan_key)
|
||
{ provider: "MedCost", network_logo: "MedcostLogo.png", provider_section: "MedCost (smART)" }
|
||
when tan_medcost.include?(pl_plan_key)
|
||
{ provider: "MedCost", network_logo: "MedcostLogo.png", provider_section: "MedCost (Tandemloc)" }
|
||
end
|
||
|
||
end
|
||
|
||
def determine_network_logos(pl_plan_key)
|
||
pl_plan_key = pl_plan_key.to_i
|
||
exception_logos = []
|
||
if [4, 5, 16, 23, 33, 55, 57, 63].include?(pl_plan_key)
|
||
default_net_logo_image = 'Logo_MC_PMS.png'
|
||
elsif [15, 18, 19, 20, 13, 21].include?(pl_plan_key)
|
||
default_net_logo_image = 'CignaLogo.png'
|
||
elsif [62].include?(pl_plan_key)
|
||
default_net_logo_image = 'CignaLogo.png'
|
||
else
|
||
default_net_logo_image = 'CignaLogo.png'
|
||
|
||
|
||
# exception_logos << ProviderNetworkLogo.new(
|
||
# exception_type: 'zip',
|
||
# exception_value: '49420',
|
||
# net_logo: 'CignaPHLogo.jpg'
|
||
# )
|
||
|
||
# exception_logos << ProviderNetworkLogo.new(
|
||
# exception_type: 'zip',
|
||
# exception_value: '48167',
|
||
# net_logo: 'CignaPHLogo.jpg'
|
||
# )
|
||
|
||
# exception_logos << ProviderNetworkLogo.new(
|
||
# exception_type: 'zip',
|
||
# exception_value: '55419',
|
||
# net_logo: 'CignaHPLogo.jpg'
|
||
# )
|
||
|
||
# exception_logos << ProviderNetworkLogo.new(
|
||
# exception_type: 'zip',
|
||
# exception_value: '55379',
|
||
# net_logo: 'CignaHPLogo.jpg'
|
||
# )
|
||
end
|
||
end
|
||
|
||
# benefit_descriptions = ["Primary Visit",
|
||
# "Specialist Visit",
|
||
# "Urgent Care",
|
||
# "INN–Ind Ded",
|
||
# "INN–Family Ded",
|
||
# "OON–Ind Ded",
|
||
# "OON–Family Ded",
|
||
# "Co-Insurance",
|
||
# "INN–Ind OOP",
|
||
# "INN–Family OOP",
|
||
# "OON–Ind OOP",
|
||
# "OON–Family OOP",
|
||
# "Emergency Room",
|
||
# "Preventive Care"]
|
||
|
||
# default = IdCardBenefitsTemplate.create(title: "BLANK")
|
||
# benefit_descriptions.each_with_index do |bene, i|
|
||
# IdCardBenefit.create(sequence: i + 1, benefit_desc: bene, id_card_benefits_template: default)
|
||
# end
|
||
|
||
# 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")
|
||
# (1..14).each do |seq|
|
||
# IdCardBenefit.create(sequence: seq, benefit: "greatest hits vol #{seq}", id_card_benefits_template: temp_1)
|
||
# end
|
||
|
||
|
||
# historical_id_card_docs = Dir['tmp/*.docx']
|
||
# historical_id_card_docs.each do |card_doc|
|
||
# puts card_doc
|
||
# BenefitsWordDocProcessor.new(card_doc).call
|
||
# end
|
||
|
||
# acentria = Carrier.find_or_create_by!(name: 'Acentria')
|
||
|
||
# mcswain_broker = Broker.find_or_create_by!(name: 'Tom McSwain') do |mc|
|
||
# mc.carrier = acentria
|
||
# end
|
||
|
||
# mcswain_employers = HebWeb::BrokerXRef.where(pl_plan_key: 99).pluck(:employer_pl_plan_key)
|
||
|
||
|
||
# Imports employers and members from VHCS
|
||
# use rake tasks
|
||
|
||
default_provider_codes = ["5", "2"]
|
||
needed_codes_mapping = {
|
||
"0": "MedCost VA Plus Network",
|
||
"2": "MedCost",
|
||
"3": "AHA Preferred",
|
||
"5": "Cigna",
|
||
"6": "Cigna (Beam/Stevens)",
|
||
A: "AHA",
|
||
M: "MedCost (smART)",
|
||
T: "MedCost (Tandemloc)"
|
||
}.stringify_keys
|
||
needed_codes = needed_codes_mapping.keys
|
||
vhcs_cp = Vhcs::HlidCardProvider.where(provider_code: needed_codes)
|
||
vhcs_cp.each do |vhcs|
|
||
attributes_hash = vhcs.attributes.except(:provider_code, :group_number)
|
||
attributes_hash.delete_if { |key, value| !key.to_s.include?("_") }
|
||
|
||
if default_provider_codes.include?(vhcs.provider_code)
|
||
attributes_hash[:default] = true
|
||
end
|
||
attributes_hash[:title] = needed_codes_mapping[vhcs.provider_code]
|
||
|
||
IdCard::ProviderSection.find_or_create_by(attributes_hash)
|
||
end
|
||
|
||
Vhcs::HlrxCrosRef.all.each do |vhcs|
|
||
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
|
||
|
||
IdCard::Configuration.all.each do |config|
|
||
config.card_template = determine_id_card_templates(config.pl_plan_key)
|
||
|
||
network_information = determine_id_card_network(config.pl_plan_key)
|
||
config.network_provider = network_information[:provider]
|
||
ps_id = IdCard::ProviderSection.find_by(title: network_information[:provider_section]).id
|
||
config.provider_section_id = ps_id
|
||
nl_id = IdCard::NetworkLogo.find_by(filename: network_information[:network_logo]).id
|
||
config.network_logo_id = nl_id
|
||
|
||
employer_name = configuration.employer.name
|
||
logo_name = employer_name.titleize.gsub(' ', '')
|
||
|
||
logo = IdCard::EmployerLogo.where("filename LIKE ?", "%#{logo_name}%")
|
||
if logo
|
||
config.employer_logo_id = logo.first.id
|
||
end
|
||
end
|
||
|
||
# 15, 18, 19, 20, 13, 21
|
||
|
||
|
||
|
||
|