Before a few renames

This commit is contained in:
Jason Jordan
2026-03-19 00:42:27 -04:00
parent 011ee91707
commit 3300819ed5
46 changed files with 994 additions and 467 deletions
+4 -1
View File
@@ -66,16 +66,19 @@ class EmployersController < ApplicationController
# redirect_to resources_url, notice: 'Resource was successfully destroyed.' # redirect_to resources_url, notice: 'Resource was successfully destroyed.'
end end
# API Methods # API Methods
def import def import
word_doc = params[:employer][:import_from_word] word_doc = params[:employer][:import_from_word]
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile) if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
@employer = BenefitsWordDocProcessor.new(word_doc.tempfile).call @employer = BenefitsWordDocProcessor.new(word_doc.tempfile).call
@employer.save
redirect_to employer_path(@employer.slug), notice: 'Employer Imported'
else else
@employer = Employer.new @employer = Employer.new
render :new
end end
render :new
end end
private private
@@ -6,20 +6,20 @@ module IdCard
def edit def edit
@employer = Employer.find_by(slug: params[:employer_id]) @employer = Employer.find_by(slug: params[:employer_id])
if @employer.id_card_enabled? if @employer.id_card_enabled?
@setup = @employer.id_card_configuration @configuration = @employer.id_card_configuration
else else
@setup = @employer.create_id_card_configuration @configuration = @employer.create_id_card_configuration
end end
render :edit render :edit
end end
def update def update
setup_params = IdCard::Configuration.permitted_params(params) setup_params = IdCard::Configuration.permitted_params(params)
@setup = IdCard::Configuration.find(params[:id]) @configuration = IdCard::Configuration.find(params[:id])
if @setup.update(setup_params) if @configuration.update(setup_params)
puts "sucess" puts "sucess"
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Configuration was successfully updated.' redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Configuration was successfully updated.'
else else
puts "fail" puts "fail"
render :edit, status: :unprocessable_entity render :edit, status: :unprocessable_entity
@@ -30,8 +30,8 @@ module IdCard
def general def general
provider_defaults = IdCard::ProviderSection.defaults provider_defaults = IdCard::ProviderSection.defaults
@provider_options = provider_defaults.map { |p| ["Default #{p.title}", p.id] }.concat(provider_defaults.map { |p| ["New #{p.title}", "new|#{p.id}"] }) @provider_options = provider_defaults.map { |p| ["Default #{p.title}", p.id] }.concat(provider_defaults.map { |p| ["New #{p.title}", "new|#{p.id}"] })
if @setup.provider_section_id.present? && provider_defaults.map(&:id).exclude?(@setup.provider_section_id) if @configuration.provider_section_id.present? && provider_defaults.map(&:id).exclude?(@configuration.provider_section_id)
@provider_options.insert(0, ["#{@employer.name} Custom", @setup.provider_section_id]) @provider_options.insert(0, ["#{@employer.name} Custom", @configuration.provider_section_id])
end end
@rx_options = IdCard::RxSection.all @rx_options = IdCard::RxSection.all
@fairos_rx_id = IdCard::RxSection.find_by(title: "FairosRx").id @fairos_rx_id = IdCard::RxSection.find_by(title: "FairosRx").id
@@ -45,7 +45,7 @@ module IdCard
params[:id_card_configuration]["provider_section_id"] = new_provider_section.id params[:id_card_configuration]["provider_section_id"] = new_provider_section.id
end end
general_params = IdCard::Configuration.permitted_params(params) general_params = IdCard::Configuration.permitted_params(params)
if @setup.update(general_params) if @configuration.update(general_params)
puts "sucess" puts "sucess"
redirect_to employer_path(@employer.slug), notice: 'ID Card Configuration was successfully updated.' redirect_to employer_path(@employer.slug), notice: 'ID Card Configuration was successfully updated.'
else else
@@ -61,9 +61,9 @@ module IdCard
def update_plans def update_plans
plans_params = IdCard::Plan.permitted_params(params) plans_params = IdCard::Plan.permitted_params(params)
if @setup.update(plans_params) if @configuration.update(plans_params)
puts "sucess" puts "sucess"
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Plans successfully updated.' redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Plans successfully updated.'
else else
puts "fail" puts "fail"
render :plans, status: :unprocessable_entity render :plans, status: :unprocessable_entity
@@ -77,9 +77,9 @@ module IdCard
def update_field_exceptions def update_field_exceptions
field_exceptions_params = IdCard::FieldException.permitted_params(params) field_exceptions_params = IdCard::FieldException.permitted_params(params)
if @setup.update(field_exceptions_params) if @configuration.update(field_exceptions_params)
puts "sucess" puts "sucess"
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Exceptions successfully updated.' redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Exceptions successfully updated.'
else else
puts "fail" puts "fail"
render :field_exceptions, status: :unprocessable_entity render :field_exceptions, status: :unprocessable_entity
@@ -100,9 +100,9 @@ module IdCard
def set_employer_and_setup def set_employer_and_setup
@employer = Employer.find_by(slug: params[:employer_id]) @employer = Employer.find_by(slug: params[:employer_id])
if @employer.id_card_configuration.present? if @employer.id_card_configuration.present?
@setup = @employer.id_card_configuration @configuration = @employer.id_card_configuration
else else
@setup = @employer.create_id_card_configuration @configuration = @employer.create_id_card_configuration
end end
end end
+110
View File
@@ -0,0 +1,110 @@
module IdCard
class PrintController < ApplicationController
# View Methods
def index
@employer_configs = IdCard::Configuration.active.to_a
@queue_counts = EmployerCards::GetQueuedCounts.new().call
add_queued_count_to_card_configuration
@queued = @employer_configs.select { |config| config.queued_card_count > 0 }.sort_by { |config| config.pl_plan_key.to_i }
@not_queued = @employer_configs.select { |config| config.queued_card_count == 0 }.sort_by { |config| config.pl_plan_key.to_i }
render :index
end
# API Methods
def print_all_queued
@queue_members = EmployerCards::GetQueuedCards.new().call
cards_pdf = IdCardPrinter::QueuedCardsGenerator.new(@queue_members).call
if cards_pdf.is_a?(CombinePDF::PDF)
send_data cards_pdf.to_pdf,
filename: "queued_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
else
cards_pdf.rewind
send_data cards_pdf.read,
filename: "queued_cards_#{Date.today}.zip",
type: 'application/zip',
disposition: 'attachment'
end
end
def print_queued_by_employer
pl_plan_key = params[:id].to_s
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
@queue_members = EmployerCards::GetQueuedCards.new(pl_plan_key).call
cards_pdf = IdCardPrinter::QueuedCardsGenerator.new(@queue_members).call
send_data cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_queued_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_sample
pl_plan_key = params[:id].to_s
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
sample_cards_pdf = IdCardPrinter::SampleCardsGenerator.new(@employer).call
send_data sample_cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_print
pl_plan_key = params[:id].to_s
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "PrintCard").call
send_data cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_mobile_display
pl_plan_key = params[:id].to_s
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
send_data cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_full_page
pl_plan_key = params[:id].to_s
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
cards_pdf.rewind
send_data cards_pdf.sysread,
filename: "#{@employer.name.parameterize(separator: "_")}_full_page_cards_#{Date.today}.zip",
type: 'application/zip',
disposition: 'attachment'
end
private
def add_queued_count_to_card_configuration
@queue_counts.each do |qc|
match = @employer_configs.find { |config| config.pl_plan_key == qc["PLPlanKey"] }
if match.present?
match.queued_card_count = qc["QueuedCardsCount"]
end
end
end
end
end
@@ -0,0 +1,49 @@
module IdCard
class PrintDataController < ApplicationController
def generate_sample
@employer = Employer.find_by(slug: params[:employer_slug])
sample_cards_pdf = IdCardPrinter::SampleCardsGenerator.new(@employer).call
send_data sample_cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_print
@employer = Employer.find_by(slug: params[:employer_slug])
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "PrintCard").call
send_data cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_mobile_display
@employer = Employer.find_by(slug: params[:employer_slug])
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
send_data cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_full_page
@employer = Employer.find_by(slug: params[:employer_slug])
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
cards_pdf.rewind
send_data cards_pdf.sysread,
filename: "#{@employer.name.parameterize(separator: "_")}_full_page_cards_#{Date.today}.zip",
type: 'application/zip',
disposition: 'attachment'
end
end
end
@@ -1,32 +0,0 @@
module IdCard
class PrinterController < ApplicationController
# View Methods
def index
@employer_configurations = IdCard::Configuration.active.to_a.sort_by { |config| config.pl_plan_key.to_i }
add_queued_count_to_card_configuration
render :index
end
# API Methods
def print_queued
@queue_counts = EmployerCards::GetQueuedCards.new().call
end
private
def add_queued_count_to_card_configuration
@queue_counts = EmployerCards::GetQueuedCounts.new().call
@queue_counts.each do |qc|
match = @employer_configurations.find { |configuration| configuration.pl_plan_key == qc["PLPlanKey"] }
if match.present?
match.queued_card_count = qc["QueuedCardsCount"]
end
end
end
end
end
@@ -1,48 +0,0 @@
class SampleIdCardsController < ApplicationController
def generate_sample
@employer = Employer.find_by(slug: params[:employer_slug])
sample_cards_pdf = SampleCardGenerator.new(@employer).call
send_data sample_cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_print
@employer = Employer.find_by(slug: params[:employer_slug])
sample_cards_pdf = EmployerCardsGenerator.new(@employer, "PrintCard").call
send_data sample_cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_mobile_display
@employer = Employer.find_by(slug: params[:employer_slug])
sample_cards_pdf = EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
send_data sample_cards_pdf.to_pdf,
filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf",
type: "application/pdf",
disposition: 'attachment'
end
def generate_full_page
@employer = Employer.find_by(slug: params[:employer_slug])
sample_cards_pdf = EmployerCardsGenerator.new(@employer, "FullPageCard").call
sample_cards_pdf.rewind
send_data sample_cards_pdf.sysread,
filename: "#{@employer.name.parameterize(separator: "_")}_full_page_cards_#{Date.today}.zip",
type: 'application/zip',
disposition: 'attachment'
end
end
@@ -0,0 +1,16 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = [ "selector", "link" ]
static values = { urlTemplate: String } // Pass template like "/users/:id/edit"
update() {
console.log("## ## %%")
const selectedId = this.selectorTarget.value
// Replace placeholder with selected ID
const newUrl = this.urlTemplateValue.replace(":id", selectedId)
// Update the link href
this.linkTarget.href = newUrl
}
}
@@ -0,0 +1,31 @@
module EmployerAutomation
extend ActiveSupport::Concern
# included do
# # Code in this block becomes instance methods or class macros (like scopes, validations, associations) in the including class.
# scope :visible, -> { where(visible: true) }
# scope :invisible, -> { where(visible: false) }
# validates :status, inclusion: { in: %w(visible invisible), message: "%{value} is not a valid status" }
# end
# class_methods do
# # Methods in this block become class methods of the including class.
# def count_all_visible
# visible.count
# end
# end
# Any other methods defined here become instance methods automatically.
def up_to_date?
self.pl_plan_key.present? &&
self.company_pb_entity_key.present? &&
self.plan_id.present? &&
self.group_number.present? &&
self.effect_date.present?
end
def sync_with_vhcs
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active' And PLPlanKey = 57"
plan_header = VhcsRecord.connection.select_all(sql_query).first
end
end
+7 -6
View File
@@ -46,14 +46,15 @@ class Employer < ApplicationRecord
false false
end end
# def name_to_logo_filename(extension) def name_to_logo_filename(extension)
# self.employer_trim_name(self.name).titleize.gsub(/\s+/, '').concat('Logo').concat(extension.downcase) self.employer_trim_name(self.name).titleize.gsub(/[^a-zA-Z]/, '').concat('Logo').concat(extension.downcase)
# end end
def employer_trim_name(name) def employer_trim_name(name = nil)
regex_source = Regexp.union(["health", "plan", "the", "inc", "llc"]).source employer_name = name.present? ? name : self.name
regex_source = Regexp.union(["health ", "plan", "the", "inc", "llc"]).source
case_insensitive_regex = Regexp.new(regex_source, "i") case_insensitive_regex = Regexp.new(regex_source, "i")
name.gsub(case_insensitive_regex, "").squish employer_name.gsub(case_insensitive_regex, "").gsub(/[^[:alpha:][:space:]]/, "").squish
end end
def self.permitted_params(params) def self.permitted_params(params)
+3 -3
View File
@@ -1,15 +1,15 @@
module IdCard module IdCard
class EmployerLogo < ApplicationRecord class EmployerLogo < ApplicationRecord
before_save :calculate_aspect_ratio, if: :image_data_changed? before_validation :calculate_aspect_ratio, if: :image_data_changed?
private private
def calculate_aspect_ratio def calculate_aspect_ratio
image_io = StringIO.new(image_data) image_io = StringIO.new(self.image_data)
width, height = FastImage.size(image_io) width, height = FastImage.size(image_io)
image_ratio = width.to_f / height image_ratio = width.to_f / height
if image_ratio if image_ratio
aspect_ratio = image_ratio.round(2) self.aspect_ratio = image_ratio.round(2)
end end
end end
end end
+1 -1
View File
@@ -7,7 +7,7 @@ module IdCard
class << self class << self
def medcost def medcost
defaults.where("filename LIKE ?", "%Medcost%") defaults.where("filename LIKE ?", "%MedCost%")
end end
def cigna def cigna
+1
View File
@@ -47,6 +47,7 @@ module IdCard
def permitted_params(params) def permitted_params(params)
params.require(:id_card_configuration).permit( params.require(:id_card_configuration).permit(
plans_attributes: [ plans_attributes: [
:id,
:title, :title,
:pb_product_key, :pb_product_key,
:pl_plan_key, :pl_plan_key,
+1 -1
View File
@@ -1,5 +1,5 @@
class Member < ApplicationRecord class Member < ApplicationRecord
belongs_to :plan belongs_to :id_card_plan, class_name: 'IdCard::Plan', optional: true
belongs_to :employer belongs_to :employer
@@ -3,6 +3,7 @@ module BenefitsWordDoc
def initialize(employer, word_doc_section) def initialize(employer, word_doc_section)
@employer = employer @employer = employer
@card_config = @employer.id_card_configuration
@word_doc_section = word_doc_section @word_doc_section = word_doc_section
end end
@@ -27,6 +28,7 @@ module BenefitsWordDoc
end end
end end
end end
@card_config.rx_group_number = @employer.group_number
@employer @employer
end end
@@ -3,6 +3,7 @@ module BenefitsWordDoc
def initialize(employer, word_doc) def initialize(employer, word_doc)
@employer = employer @employer = employer
@card_config = @employer.id_card_configuration
@word_doc = word_doc @word_doc = word_doc
end end
@@ -40,7 +41,7 @@ module BenefitsWordDoc
# @employer.single_card_template = "FairosRxIDCard" # @employer.single_card_template = "FairosRxIDCard"
# end # end
@employer.id_card_configuration.employer_logo = logo @card_config.employer_logo = logo
end end
end end
@employer @employer
@@ -3,6 +3,7 @@ module BenefitsWordDoc
def initialize(employer, word_doc_section) def initialize(employer, word_doc_section)
@employer = employer @employer = employer
@card_config = @employer.id_card_configuration
@word_doc_section = word_doc_section @word_doc_section = word_doc_section
end end
@@ -19,7 +20,7 @@ module BenefitsWordDoc
if line.match?(/cigna/i) if line.match?(/cigna/i)
break "Cigna" break "Cigna"
elsif line.match?(/medcost/i) elsif line.match?(/medcost/i)
break "Medcost" break "MedCost"
end end
end end
@@ -28,11 +29,11 @@ module BenefitsWordDoc
# end # end
if network if network
@employer.id_card_configuration.network_provider = network @card_config.network_provider = network
@employer.id_card_configuration.network_logo = IdCard::NetworkLogo logo_name = "#{network}Logo.png"
provider_code = network_provider == "Cigna" ? "5" : "2" @card_config.network_logo = IdCard::NetworkLogo.find_by(filename: logo_name)
@employer.card_provider = CardProvider.find_by(provider_code: provider_code) @card_config.provider_section = IdCard::ProviderSection.find_by(title: network)
@employer.card_rx = CardRx.find_by(web_url: "www.FairosRx.com") @card_config.rx_section = IdCard::RxSection.find_by(title: "FairosRx")
end end
@@ -3,6 +3,7 @@ module BenefitsWordDoc
def initialize(employer, word_doc_section) def initialize(employer, word_doc_section)
@employer = employer @employer = employer
@card_config = @employer.id_card_configuration
@word_doc_section = word_doc_section @word_doc_section = word_doc_section
end end
@@ -11,12 +12,12 @@ module BenefitsWordDoc
plans_indexes = @word_doc_section.each_index.select { |index| @word_doc_section[index].match?(/\d*\.?\d+k/i) } plans_indexes = @word_doc_section.each_index.select { |index| @word_doc_section[index].match?(/\d*\.?\d+k/i) }
plans_indexes.each do |plan_index| plans_indexes.each do |plan_index|
new_plan = @employer.build_plan_with_default_benefits(title: @word_doc_section[plan_index]) new_plan = @card_config.plans.build(title: @word_doc_section[plan_index])
plan_lines = @word_doc_section.slice(plan_index + 1, 14) plan_lines = @word_doc_section.slice(plan_index + 1, 14)
plan_lines.each_with_index do |line, i| plan_lines.each_with_index do |line, i|
field_mapping = mapping_array[i] field_mapping = mapping_array[i]
if line.match(/:.*/) if line.match(/(?<=:).+/)
field_value = line.match(/:.*/)[0].strip field_value = line.match(/(?<=:).+/)[0].strip
else else
field_regex = field_mapping[:doc_to_employer_regex] field_regex = field_mapping[:doc_to_employer_regex]
if line.match(field_regex) if line.match(field_regex)
@@ -6,6 +6,7 @@ class BenefitsWordDocProcessor
@employer = employer @employer = employer
else else
@employer = Employer.new @employer = Employer.new
@employer.build_id_card_configuration
end end
end end
@@ -1,7 +1,7 @@
module EmployerCards module EmployerCards
class GetQueuedCards class GetQueuedCards
def initialize(pl_plan_keys) def initialize(pl_plan_keys = nil)
if pl_plan_keys if pl_plan_keys
@employer_pl_plan_keys = pl_plan_keys @employer_pl_plan_keys = pl_plan_keys
else else
@@ -1,93 +0,0 @@
module IdCardPrinter
class DataFormatter
def initialize(employer)
@employer = employer
end
def call
@sample_card = SampleIdCard.new()
set_employer_fields()
set_generic_fields()
set_rx_fields()
set_network_fields()
# set_dependent_fields()
sample_cards = set_plan_fields()
sample_cards.each(&:save!)
end
private
def set_employer_fields
selected_attributes = {
employer_name: @employer.name,
group_number: @employer.group_number.present? ? @employer.group_number : "999999",
medical_eff_date: @employer.effective_date
}
@sample_card.assign_attributes(selected_attributes)
end
def set_plan_fields
plans_sample_cards = []
@employer.id_card_configuration.plans.each do |plan|
plan_sample_card = @sample_card.dup
plan_name = plan.title.split(/(?<=\d[kK])/).first
plan_sample_card.family_id = plan_name
plan.plan_benefits.each do |bene|
plan_sample_card["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc
plan_sample_card["benefit_#{bene.sequence}".to_sym] = bene.benefit
end
plans_sample_cards.push(plan_sample_card)
end
plans_sample_cards
end
def set_generic_fields
selected_attributes = {
full_name: "JANE DOE",
primary_mb_member_key: "888888",
rx_group: @employer.group_number.present? ? @employer.group_number : "999999"
}
@sample_card.assign_attributes(selected_attributes)
end
def set_network_fields
selected_attributes = @employer.id_card_configuration.provider_section.attributes.with_indifferent_access.slice(
:provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :provider_line_6,
:provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :provider_line_12,
:claim_to_1, :claim_to_2, :claim_to_3, :claim_to_4, :claim_to_5, :claim_to_6,
:claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12
)
if @employer.network_provider == "Cigna"
@sample_card.provider_code = "5"
end
@sample_card.assign_attributes(selected_attributes)
end
def set_rx_fields
# fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
selected_attributes = @employer.id_card_configuration.rx_section.attributes.with_indifferent_access.slice(
:customer_service,
:web_url
)
@sample_card.assign_attributes(selected_attributes)
end
def set_dependent_fields
@sample_card.dependent_1 = "John Doe"
@sample_card.dependent_2 = "Molly Doe"
@sample_card.dependent_3 = "Jonathan Doe"
@sample_card.dependent_4 = "Calvin Doe"
@sample_card.dependent_5 = "Richard Doe"
@sample_card.dependent_6 = "Jannet Doe"
@sample_card.dependent_7 = "Longername Doe"
@sample_card.dependent_8 = "Robbert Doe"
end
end
end
@@ -1,17 +1,38 @@
module IdCardPrinter module IdCardPrinter
class EmployerCardsGenerator class EmployerCardsGenerator
def initialize(pl_plan_key, layout, zip=false) def initialize(employer, layout, zip=false)
@pl_plan_key = pl_plan_key @employer = employer
@layout = layout @layout = layout
@zip = zip @zip = zip
end end
def call def call
IdCard::PrintData.where(pl_plan_key: @pl_plan_key).destroy_all IdCard::PrintData.where(pl_plan_key: @employer.pl_plan_key).destroy_all
EmployerCards::DataFormatter.new(@pl_plan_key).call IdCardPrinter::EmployerDataFormatter.new(@employer).call
IdCardPrinter::PdfProcessor.new(@pl_plan_key, @layout, @zip).call pdf_array = IdCardPrinter::PdfProcessor.new(@employer, @layout, @zip).call
group_pdfs = combine_pdfs(pdf_array)
group_pdfs
end
private
def combine_pdfs(pdf_array)
if @zip
group_cards_pdf = Zip::OutputStream.write_buffer do |zio|
pdf_array.each do |file|
zio.put_next_entry(file[:name])
zio.write(file[:data])
end
end
else
group_cards_pdf = CombinePDF.new
pdf_array.each { |pdf| group_cards_pdf << pdf }
end
group_cards_pdf
end end
end end
end end
@@ -0,0 +1,169 @@
module IdCardPrinter
class EmployerDataFormatter
def initialize(employer, member_keys = nil)
@employer = employer
@card_config = @employer.id_card_configuration
if member_keys
@members = @employer.members.where(pb_entity_key: member_keys).order(:name)
else
@members = @employer.members.order(:name)
end
end
def call
@base_card = IdCard::PrintData.new()
@employer_cards = []
set_common_fields
set_member_fields
set_plan_fields
@employer_cards.each(&:save!)
end
private
def set_common_fields
employer_attributes = {
employer_name: @card_config.print_name,
pl_plan_key: @card_config.pl_plan_key,
group_number: @employer.group_number,
rx_group: @card_config.rx_group_number,
network_provider: @card_config.network_provider
}
rx_attributes = @card_config.rx_section.attributes.with_indifferent_access.slice(
:customer_service,
:web_url
)
provider_attributes = @card_config.provider_section.attributes.with_indifferent_access.slice(
:provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :provider_line_6,
:provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :provider_line_12,
:claim_to_1, :claim_to_2, :claim_to_3, :claim_to_4, :claim_to_5, :claim_to_6,
:claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12
)
selected_attributes = employer_attributes.merge(rx_attributes).merge(provider_attributes)
@base_card.assign_attributes(selected_attributes)
end
def set_common_fields_old
employer_attributes = {
employer_name: @card_config.print_name,
group_number: @employer.group_number,
rx_group: @card_config.rx_group_number
}
rx_attributes = @card_config.rx_section.attributes.with_indifferent_access.slice(
:customer_service,
:web_url
)
provider_attributes = @card_config.provider_section.attributes.with_indifferent_access.slice(
:provider_code, :provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :provider_line_6,
:provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :provider_line_12,
:claim_to_1, :claim_to_2, :claim_to_3, :claim_to_4, :claim_to_5, :claim_to_6,
:claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12
)
selected_attributes = employer_attributes.merge(rx_attributes).merge(provider_attributes)
@employer_cards.each do |card|
card.assign_attributes(selected_attributes)
end
end
def set_plan_fields
@card_config.plans.each do |plan|
selected_attributes = {}
plan.plan_benefits.each do |bene|
selected_attributes["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc
selected_attributes["benefit_#{bene.sequence}".to_sym] = bene.benefit
end
@employer_cards.find_all { |card| card.plan_id == plan.id.to_s }.each do |card|
card.assign_attributes(selected_attributes)
end
end
end
def set_member_fields
@group_dependents = Vhcs::VwmbMember.where(pl_plan_key: @employer.pl_plan_key)
@members.each do |me|
effect_date = determine_eff_date(me)
if effect_date
member_card = @base_card.dup
member_attributes = {
full_name: me.id_card_display_name,
full_name_last_name_first: me.name,
primary_mb_member_key: me.pb_entity_key,
family_id: me.family_id,
plan_id: me.id_card_plan_id,
medical_eff_date: effect_date.strftime("%m/%d/%Y")
}
dependent_attributes = get_dependent_fields(me)
if dependent_attributes.present?
selected_attributes = member_attributes.merge(dependent_attributes)
else
selected_attributes = member_attributes
end
member_card.assign_attributes(selected_attributes)
@employer_cards.push(member_card)
end
end
end
# def set_network_fields
# selected_attributes = @employer.card_provider.attributes.with_indifferent_access.slice(
# :provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :provider_line_6,
# :provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :provider_line_12,
# :claim_to_1, :claim_to_2, :claim_to_3, :claim_to_4, :claim_to_5, :claim_to_6,
# :claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12
# )
# @employer_cards.all do |card|
# card.assign_attributes(selected_attributes)
# end
# end
# def set_rx_fields
# # fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
# selected_attributes = @employer.card_rx.attributes.with_indifferent_access.slice(
# :customer_service,
# :web_url
# )
# @employer_cards.all do |card|
# card.assign_attributes(selected_attributes)
# end
# end
def determine_eff_date(member)
participation = Vhcs::PbProductParticipation.joins('INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', member.pb_entity_key).last
in_effect = participation.in_effect
out_of_effect = participation.out_of_effect
if in_effect <= (Date.today + 90.days) && (out_of_effect - 1.day) > Date.today && out_of_effect > in_effect
in_effect
else
false
end
end
def get_dependent_fields(member)
dependent_attributes = {}
dependents = @group_dependents.where(family_id: member.family_id).where.not(pb_entity_key: member.pb_entity_key)
dependents.each do |dep|
dependent_name = dep.first_name + ' ' + dep.last_name
dependent_attributes["dependent_#{dep.sequence_number - 1}".to_sym] = dependent_name
end
dependent_attributes
end
end
end
@@ -3,9 +3,9 @@ module IdCardPrinter
def initialize(pl_plan_key, family_id, layout) def initialize(pl_plan_key, family_id, layout)
@pl_plan_key = pl_plan_key @pl_plan_key = pl_plan_key
@card_config = IdCard::Configuration.find_by(pl_plan_key: pl_plan_key)
@family_id = family_id @family_id = family_id
@layout = layout @layout = layout
@card_config = IdCard::Configuration.find_by(pl_plan_key: pl_plan_key)
end end
def call def call
@@ -0,0 +1,38 @@
module IdCardPrinter
class MemberCardsGenerator
def initialize(member_keys, layout)
@member_keys = Array.wrap(member_keys)
@employer = employer
@layout = layout
@zip = zip
end
def call
IdCard::PrintData.where(mb_member_key: @employer.pl_plan_key).destroy_all
IdCardPrinter::EmployerDataFormatter.new(@employer).call
pdf_array = IdCardPrinter::PdfProcessor.new(@employer, @layout, @zip).call
group_pdfs = combine_pdfs(pdf_array)
group_pdfs
end
private
def combine_pdfs(pdf_array)
if @zip
group_cards_pdf = Zip::OutputStream.write_buffer do |zio|
pdf_array.each do |file|
zio.put_next_entry(file[:name])
zio.write(file[:data])
end
end
else
group_cards_pdf = CombinePDF.new
pdf_array.each { |pdf| group_cards_pdf << pdf }
end
end
end
end
+23 -18
View File
@@ -1,40 +1,45 @@
module IdCardPrinter module IdCardPrinter
class PdfProcessor class PdfProcessor
def initialize(pl_plan_key, layout, zip) def initialize(employer, layout, zip = false)
@pl_plan_key = pl_plan_key @employer = employer
@employer_card_config = Employer.find_by(pl_plan_key: pl_plan_key).id_card_configuration @card_config = @employer.id_card_configuration
@layout = layout @layout = layout
@zip = zip @zip = zip
end end
def call def call
# if @zip
# group_cards_pdf_array = []
# else
# group_cards_pdf = CombinePDF.new
# end
group_cards_pdf_array = [] group_cards_pdf_array = []
IdCard::PrintData.where(pl_plan_key: @pl_plan_key).each do |card| IdCard::PrintData.where(pl_plan_key: @employer.pl_plan_key).each do |card|
url = IdCardPrinter::JasperUrlGenerator.new(@pl_plan_key, card.family_id, @layout).call url = IdCardPrinter::JasperUrlGenerator.new(@employer.pl_plan_key, card.family_id, @layout).call
puts url puts url
card_pdf = IdCardPrinter::JasperPdfGenerator.new(url).call card_pdf = IdCardPrinter::JasperPdfGenerator.new(url).call
if @zip if @zip
card_filename = "#{card.name.gsub(", ", "_")}_digital_card_#{Date.today}.pdf" card_filename = "#{card.full_name_last_name_first.gsub(", ", "_")}_digital_card_#{Date.today}.pdf"
group_cards_pdf_array << { name: card_filename, data: card_pdf.to_pdf } group_cards_pdf_array << { name: card_filename, data: card_pdf.to_pdf }
else else
group_cards_pdf_array << card_pdf group_cards_pdf_array << card_pdf
end end
end end
if @zip # if @zip
group_cards_pdf = Zip::OutputStream.write_buffer do |zio| # group_cards_pdf = Zip::OutputStream.write_buffer do |zio|
group_cards_pdf_array.each do |file| # group_cards_pdf_array.each do |file|
zio.put_next_entry(file[:name]) # zio.put_next_entry(file[:name])
zio.write(file[:data]) # zio.write(file[:data])
end # end
end # end
else # # else
todays_date = DateTime.current.strftime('%Y%m%d%H%M%S') # # todays_date = DateTime.current.strftime('%Y%m%d%H%M%S')
group_cards_pdf.save("tmp/#{@employer.name}_print_cards_#{todays_date}.pdf") # # group_cards_pdf.save("tmp/#{@employer.name}_print_cards_#{todays_date}.pdf")
end # end
group_cards_pdf group_cards_pdf_array
end end
end end
end end
@@ -0,0 +1,61 @@
module IdCardPrinter
class QueuedCardsGenerator
def initialize(employer_member_keys)
@employer_member_keys = Array.wrap(employer_member_keys)
@layout = 'PrintCard'
@pl_plan_keys = @employer_member_keys.map { |emk| emk["PlanKey"].to_s }
end
def call
white_card_array = []
blue_card_array = []
IdCard::PrintData.where(pl_plan_key: @pl_plan_keys).destroy_all
@employer_member_keys.each do |emk|
employer = Employer.find_by(pl_plan_key: emk["PlanKey"])
member_keys = emk["MemberKeys"].split(", ").map(&:to_i)
IdCardPrinter::EmployerDataFormatter.new(employer, member_keys).call
if emk["PlanKey"] == "3"
blue_card_array = IdCardPrinter::PdfProcessor.new(employer, @layout).call
else
white_card_array = IdCardPrinter::PdfProcessor.new(employer, @layout).call
end
end
combine_pdfs(blue_card_array, white_card_array)
end
private
def combine_pdfs(blue_cards, white_cards)
if blue_cards.present? && white_cards.present?
combined_pdfs = []
blue_filename = "queued_blue_cards_#{Date.today}.pdf"
combined_pdfs << { name: blue_filename, data: blue_cards.to_pdf }
white_filename = "queued_white_cards_#{Date.today}.pdf"
combined_pdfs << { name: white_filename, data: white_cards.to_pdf }
output_file = zip_cards(combined_pdfs)
elsif blue_cards.present?
output_file = CombinePDF.new
blue_cards.each { |pdf| output_file << pdf }
elsif white_cards.present?
output_file = CombinePDF.new
white_cards.each { |pdf| output_file << pdf }
end
output_file
end
def zip_cards(pdf_array)
Zip::OutputStream.write_buffer do |zio|
pdf_array.each do |file|
zio.put_next_entry(file[:name])
zio.write(file[:data])
end
end
end
end
end
@@ -0,0 +1,15 @@
module IdCardPrinter
class SampleCardsGenerator
def initialize(employer)
@employer = employer
end
def call
IdCard::PrintData.where(employer_name: @employer.name).destroy_all
IdCardPrinter::SampleDataFormatter.new(@employer).call
IdCardPrinter::SamplePdfProcessor.new(@employer).call
end
end
end
@@ -0,0 +1,96 @@
module IdCardPrinter
class SampleDataFormatter
def initialize(employer)
@employer = employer
@card_config = @employer.id_card_configuration
end
def call
@base_card = IdCard::PrintData.new(sample: true)
set_employer_fields()
set_sample_fields()
set_rx_fields()
set_network_fields()
set_dependent_fields()
sample_cards = set_plan_fields()
sample_cards.each(&:save!)
end
private
def set_employer_fields
selected_attributes = {
employer_name: @employer.name,
group_number: @employer.group_number.present? ? @employer.group_number : "999999",
medical_eff_date: @employer.effective_date
}
@base_card.assign_attributes(selected_attributes)
end
def set_plan_fields
plans_base_cards = []
@card_config.plans.each do |plan|
@base_card.sample_key = @card_config.print_name.titleize.split.map(&:first).push(plan.id).join
plan_base_card = @base_card.dup
plan_name = plan.title.split(/(?<=\d[kK])/).first
plan.plan_benefits.each do |bene|
plan_base_card["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc
plan_base_card["benefit_#{bene.sequence}".to_sym] = bene.benefit
end
plan_base_card.sample_plan_title = plan_name
plans_base_cards.push(plan_base_card)
end
plans_base_cards
end
def set_sample_fields
selected_attributes = {
full_name: "JANE DOE",
primary_mb_member_key: "888888",
rx_group: @employer.group_number.present? ? @employer.group_number : "999999"
}
@base_card.assign_attributes(selected_attributes)
end
def set_network_fields
selected_attributes = @card_config.provider_section.attributes.with_indifferent_access.slice(
:provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :provider_line_6,
:provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :provider_line_12,
:claim_to_1, :claim_to_2, :claim_to_3, :claim_to_4, :claim_to_5, :claim_to_6,
:claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12
)
# if @card_config.network_provider == "Cigna"
# @base_card.provider_code = "5"
# end
@base_card.network_provider = @card_config.network_provider
@base_card.assign_attributes(selected_attributes)
end
def set_rx_fields
# fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
selected_attributes = @card_config.rx_section.attributes.with_indifferent_access.slice(
:customer_service,
:web_url
)
@base_card.assign_attributes(selected_attributes)
end
def set_dependent_fields
@base_card.dependent_1 = "John Doe"
# @base_card.dependent_2 = "Molly Doe"
# @base_card.dependent_3 = "Jonathan Doe"
# @base_card.dependent_4 = "Calvin Doe"
# @base_card.dependent_5 = "Richard Doe"
# @base_card.dependent_6 = "Jannet Doe"
# @base_card.dependent_7 = "Longername Doe"
# @base_card.dependent_8 = "Robbert Doe"
end
end
end
@@ -1,9 +1,10 @@
module SampleCard module IdCardPrinter
class JasperUrlGenerator class SampleJasperUrlGenerator
def initialize(employer, plan_name) def initialize(employer, sample_key, sample_title)
@plan_name = plan_name @sample_key = sample_key
@employer = employer @sample_title = sample_title
@card_config = employer.id_card_configuration
end end
def call def call
@@ -14,23 +15,6 @@ module SampleCard
private private
def determine_card_template
# if @network_logos.length > 1
# member_geographic_info = Vhcs::PbEntityAddress.joins("INNER JOIN vwMBMember ON PBEntityAddress.PBEntityKey = vwMBMember.PBEntityKey AND PBEntityAddress.AddressTypeID = 1137").where("vwMBMember.FamilyID = ?", @family_id).first
# @network_logos.where.not(default: true).each do |pnl|
# if member_geographic_info[pnl.exception_type] == pnl.exception_value
# return pnl.net_logo
# end
# end
# end
# @network_logos.find_by(default: true).net_logo
# if @employer.single_card_template.include?("Half")
# "FairosRxSampleIDCard-Half-Display"
# else
# "FairosRxSampleIDCard-Display"
# end
end
def determine_network_logo def determine_network_logo
# if @network_logos.length > 1 # if @network_logos.length > 1
# member_geographic_info = Vhcs::PbEntityAddress.joins("INNER JOIN vwMBMember ON PBEntityAddress.PBEntityKey = vwMBMember.PBEntityKey AND PBEntityAddress.AddressTypeID = 1137").where("vwMBMember.FamilyID = ?", @family_id).first # member_geographic_info = Vhcs::PbEntityAddress.joins("INNER JOIN vwMBMember ON PBEntityAddress.PBEntityKey = vwMBMember.PBEntityKey AND PBEntityAddress.AddressTypeID = 1137").where("vwMBMember.FamilyID = ?", @family_id).first
@@ -41,7 +25,7 @@ module SampleCard
# end # end
# end # end
# @network_logos.find_by(default: true).net_logo # @network_logos.find_by(default: true).net_logo
@employer.default_network_logo @card_config.network_logo.filename
end end
# http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF # http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF
# http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF # http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF
@@ -50,7 +34,7 @@ module SampleCard
host: '10.41.1.115', host: '10.41.1.115',
port: 8080, port: 8080,
path: '/trunk/IdCardsServlet', path: '/trunk/IdCardsServlet',
query: "reportConn=BrittonConnect&cardTemplate=FairosRxIDCard&printType=SampleCard&family_id=#{@plan_name}&employer_logo=#{@employer.employer_logo_filename}&network_logo=#{determine_network_logo}&FileType=PDF" query: "reportConn=BrittonConnect&cardTemplate=#{@card_config.card_template}&printType=SampleCard&sample_key=#{@sample_key}&sample_plan_title=#{@sample_title}&employer_logo=#{@card_config.employer_logo.filename}&network_logo=#{determine_network_logo}&FileType=PDF"
} }
end end
@@ -0,0 +1,25 @@
module IdCardPrinter
class SamplePdfProcessor
def initialize(employer)
@employer = employer
@card_config = @employer.id_card_configuration
end
def call
group_cards_pdf = CombinePDF.new
IdCard::PrintData.where(employer_name: @employer.name).each do |card|
url = IdCardPrinter::SampleJasperUrlGenerator.new(@employer, card.sample_key, card.sample_plan_title).call
puts url
card_pdf = IdCardPrinter::JasperPdfGenerator.new(url).call
group_cards_pdf << card_pdf
end
# todays_date = DateTime.current.strftime('%Y%m%d%H%M%S')
# group_cards_pdf.save("tmp/#{@employer.name}_print_cards_#{todays_date}.pdf")
group_cards_pdf
end
end
end
+1 -1
View File
@@ -23,7 +23,7 @@
<% @employers.active.each_with_index do |emp, index| %> <% @employers.active.each_with_index do |emp, index| %>
<% item_color_index = @color_index == 0 ? 0 : @color_index % plan_colors.length %> <% item_color_index = @color_index == 0 ? 0 : @color_index % plan_colors.length %>
<div class="w-1/2 flex text-2xl text-platinum font-bold px-4 py-4 ml-10 space-x-4 rounded-lg border-l-5 border-b-2 <%= "border-#{plan_colors[item_color_index]}" %>"> <div class="w-1/2 flex text-2xl text-platinum font-bold px-4 py-4 ml-10 space-x-4 rounded-lg border-l-5 border-b-2 <%= "border-#{plan_colors[item_color_index]}" %>">
<%= link_to emp.name, employer_path(emp.slug), class: "hover:text-#{plan_colors[item_color_index]}" %> <%= link_to "(#{emp.pl_plan_key}) - #{emp.name}", employer_path(emp.slug), class: "hover:text-#{plan_colors[item_color_index]}" %>
<div> <div>
<%= "(#{emp.members.count} Members)" %> <%= "(#{emp.members.count} Members)" %>
</div> </div>
+39 -27
View File
@@ -53,7 +53,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="flex flex-col space-y w-[23%]"> <div class="flex flex-col space-y w-[23%] mb-5">
<% module_color = IdCard::Configuration::MODULE_COLOR %> <% module_color = IdCard::Configuration::MODULE_COLOR %>
<div class="w-full flex flex-none items-center justify-between"> <div class="w-full flex flex-none items-center justify-between">
<h3 class="flex-none font-bold text-2xl text-<%= module_color %>">ID Card Module</h3> <h3 class="flex-none font-bold text-2xl text-<%= module_color %>">ID Card Module</h3>
@@ -61,39 +61,51 @@
</div> </div>
<div class="grow flex flex-col w-full border-l-4 border-b-4 border-<%= module_color %> rounded-xl pl-2 pb-2"> <div class="grow flex flex-col w-full border-l-4 border-b-4 border-<%= module_color %> rounded-xl pl-2 pb-2">
<% if @employer.id_card_enabled? %> <% if @employer.id_card_enabled? %>
<div class="grow-1 flex flex-col items-center w-full"> <div class="grow-1 flex flex-col items-center w-full">
<div class="w-full flex flex-col items-center my-3"> <div class="w-full flex flex-col items-center my-3">
<div class="font-bold text-lg text-bronze"> <div class="font-bold text-lg text-bronze">
Setup Setup
</div>
<span class="block w-full h-0.5 bg-copper mt-[-4]"></span>
</div>
<div class="flex flex-col items-center space-y-6 w-full">
<%= link_to "General", general_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<%= link_to "Plans", plans_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<%= link_to 'Exceptions (Optional)', field_exceptions_employer_id_card_configuration_index_path(employer_id: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
</div> </div>
<span class="block w-full h-0.5 bg-copper mt-[-4]"></span>
</div> </div>
<div class="grow-1 flex flex-col items-center w-full"> <div class="flex flex-col items-center space-y-6 w-full">
<div class="w-full flex flex-col items-center my-3"> <%= link_to "General", general_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<div class="font-bold text-lg text-bronze"> <%= link_to "Plans", plans_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
Actions <%= link_to 'Exceptions (Optional)', field_exceptions_employer_id_card_configuration_index_path(employer_id: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
</div>
<span class="block w-full h-0.5 bg-copper mt-[-4]"></span>
</div>
<div class="flex flex-col items-center space-y-6 w-full">
<%= link_to 'Generate Sample Cards', generate_sample_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<%= link_to 'Generate Group Cards (for print)', generate_print_id_card_print_data_path(employer_slug: @employer.slug ),data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<%= link_to 'Generate Group Cards (for display)', generate_mobile_display_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<%= link_to 'Generate Group Cards (for download)', generate_full_page_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
</div>
</div> </div>
</div>
<div class="grow-1 flex flex-col items-center w-full">
<div class="w-full flex flex-col items-center my-3">
<div class="font-bold text-lg text-bronze">
Actions
</div>
<span class="block w-full h-0.5 bg-copper mt-[-4]"></span>
</div>
<div class="flex flex-col items-center space-y-6 w-full">
<%= link_to 'Generate Sample Cards', generate_sample_id_card_print_path(@employer.pl_plan_key), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<%= link_to 'Generate Group Cards (for print)', generate_print_id_card_print_path(@employer.pl_plan_key),data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<%= link_to 'Generate Group Cards (for display)', generate_mobile_display_id_card_print_path(@employer.pl_plan_key), data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<%= link_to 'Generate Group Cards (for download)', generate_full_page_id_card_print_path(@employer.pl_plan_key), data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
</div>
</div>
<div class="grow-1 flex flex-col items-center w-full">
<div class="w-full flex flex-col items-center my-3">
<div class="font-bold text-lg text-bronze">
Admin
</div>
<span class="block w-full h-0.5 bg-copper mt-[-4]"></span>
</div>
<div class="flex flex-col items-center space-y-6 w-full">
<%= link_to 'Sync Employer with VHCS', generate_sample_id_card_print_path(@employer.pl_plan_key), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
<%= link_to 'Sync Members with VHCS', generate_print_id_card_print_path(@employer.pl_plan_key),data: { turbo: false }, class: "flex justify-center items-center w-full #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-#{module_color} hover:bg-deepcove border-2 border-#{module_color} text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %>
</div>
</div>
<% else %> <% else %>
<%= link_to "Enable ID Card", general_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full h-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-4 border-atmosphere text-platinum text-xl font-bold px-3 rounded-md mt-3 transition duration-100" %> <%= link_to "Enable ID Card", general_employer_id_card_configuration_index_path(employer_id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full h-full cursor-pointer bg-#{module_color} hover:bg-deepcove border-4 border-atmosphere text-platinum text-xl font-bold px-3 rounded-md mt-3 transition duration-100" %>
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="flex flex-col space-y w-[23%]"> <div class="flex flex-col space-y w-[23%] mb-5">
<div class="w-full flex items-center"> <div class="w-full flex items-center">
<h3 class="flex-none font-bold text-2xl text-cobalt-vivid">Claims Check Module</h3> <h3 class="flex-none font-bold text-2xl text-cobalt-vivid">Claims Check Module</h3>
<div class="grow h-[1px] mt-2 ml-1 bg-bronze"></div> <div class="grow h-[1px] mt-2 ml-1 bg-bronze"></div>
@@ -106,7 +118,7 @@
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="flex flex-col space-y w-[23%]"> <div class="flex flex-col space-y w-[23%] mb-5">
<div class="w-full flex items-center"> <div class="w-full flex items-center">
<h3 class="flex-none font-bold text-2xl text-verdigris-vivid">FairosRx Eligibility Module</h3> <h3 class="flex-none font-bold text-2xl text-verdigris-vivid">FairosRx Eligibility Module</h3>
<div class="grow h-[1px] mt-2 ml-1 bg-bronze"></div> <div class="grow h-[1px] mt-2 ml-1 bg-bronze"></div>
@@ -5,9 +5,11 @@
<div class="pl-1 w-full"> <div class="pl-1 w-full">
<%= plan_fields.text_field :pb_product_key, label: { text: "Plan Product Key" }, class: "w-full" %> <%= plan_fields.text_field :pb_product_key, label: { text: "Plan Product Key" }, class: "w-full" %>
</div> </div>
<%= plan_fields.hidden_field :id %>
<% else %>
<div class="pl-1 pb-2 w-full">
<%= f.select :template_id, options_from_collection_for_select(@plan_templates, :id, :title), { prompt: "Select Plan Template", class: "w-full" }, { data: { action: "benefits-template-picker#fetchData" }} %>
</div>
<% end %> <% end %>
<div class="pl-1 pb-2 w-full">
<%= f.select :template_id, options_from_collection_for_select(@plan_templates, :id, :title), { prompt: "Select Plan Template", class: "w-full" }, { data: { action: "benefits-template-picker#fetchData" }} %>
</div>
@@ -17,7 +17,7 @@
</div> </div>
<div class="flex space-x-10"> <div class="flex space-x-10">
<div class="w-full"> <div class="w-full">
<%= f.select :network_provider, options_for_select(["Cigna", "Medcost", "Other"], @configuration.network_provider), { label: { text: "Provider Network" }, include_blank: "Select", class: "w-full" }, data: { provider_update_target: "providerNetworkField", action: "change->provider-update#syncDefaults" } %> <%= f.select :network_provider, options_for_select(["Cigna", "MedCost", "Other"], @configuration.network_provider), { label: { text: "Provider Network" }, include_blank: "Select", class: "w-full" }, data: { provider_update_target: "providerNetworkField", action: "change->provider-update#syncDefaults" } %>
</div> </div>
<div class="w-full"> <div class="w-full">
<%= f.select :card_template, options_for_select([["FairosRx", "FairosRxIDCard"], ["Tandemloc", "TandemlocIDCard"], ["smART", "SmartIDCard"], ["QRCode (Healthbus)", "QRCodeIDCard"]], @configuration.card_template || "FairosRxIDCard" ), { label: { text: "Card Template" }, include_blank: "Select", class: "w-full" } %> <%= f.select :card_template, options_for_select([["FairosRx", "FairosRxIDCard"], ["Tandemloc", "TandemlocIDCard"], ["smART", "SmartIDCard"], ["QRCode (Healthbus)", "QRCodeIDCard"]], @configuration.card_template || "FairosRxIDCard" ), { label: { text: "Card Template" }, include_blank: "Select", class: "w-full" } %>
@@ -8,7 +8,7 @@
<div class="w-full flex my-8" data-controller="add-plan" data-add-plan-form-color-value="<%= IdCard::Configuration::FORM_COLORS.to_json %>" > <div class="w-full flex my-8" data-controller="add-plan" data-add-plan-form-color-value="<%= IdCard::Configuration::FORM_COLORS.to_json %>" >
<div class="flex flex-wrap w-full" data-add-plan-target="container"> <div class="flex flex-wrap w-full" data-add-plan-target="container">
<% @configuration.plans.each_with_index do |plan, index| %> <% @configuration.plans.each_with_index do |plan, index| %>
<%= f.fields_for :plans, plan, child_index: index do |plan_fields| %> <%= f.fields_for :plans, plan do |plan_fields| %>
<div class="inline-flex flex-col justify-end pr-6 w-1/4 relative pl-1 plan-item" data-controller="benefits-template-picker"> <div class="inline-flex flex-col justify-end pr-6 w-1/4 relative pl-1 plan-item" data-controller="benefits-template-picker">
<div class="absolute left-0 top-[2%] h-[98%] border-l-4 <%= "border-#{IdCard::Configuration::FORM_COLORS[index]}" %> "></div> <div class="absolute left-0 top-[2%] h-[98%] border-l-4 <%= "border-#{IdCard::Configuration::FORM_COLORS[index]}" %> "></div>
<div class="font-bold text-2xl <%= "text-#{IdCard::Configuration::FORM_COLORS[index]}" %> -ml-[6px] z-2 w-full"> <div class="font-bold text-2xl <%= "text-#{IdCard::Configuration::FORM_COLORS[index]}" %> -ml-[6px] z-2 w-full">
+67
View File
@@ -0,0 +1,67 @@
<div class="bg-deepcove h-full w-full flex flex-col justify-start font-bold">
<div class="w-full flex flex-col items-center mb-3">
<div class="text-5xl text-platinum">
ID Card Printer
</div>
<span class="block w-full h-0.5 bg-copper"></span>
</div>
<div class="w-full items-start flex">
<div class="w-1/2 flex flex-col">
<% @queued.each do |qu| %>
<div class="w-full flex items-center justify-between text-lg text-platinum my-1">
<div class="flex flex-none">
<%= qu.pl_plan_key %> -
<%= qu.employer.name %>
(
<div class="mx-1 text-bronze">
<%= qu.queued_card_count %>
</div>
)
</div>
<div class="grow h-[1px] mx-1 bg-cobalt-vivid"></div>
<div class="flex flex-none items-center text-xs">
<%= link_to print_queued_by_employer_id_card_print_path(qu.pl_plan_key), data: { turbo: false }, class: "flex h-7 w-14 transition duration-100" do %>
<%= icon "printer", library: "lucide", class: "h-full w-full text-center text-platinum bg-atmosphere hover:bg-deepcove border-2 border-atmosphere rounded-md p-0.5" %>
<% end %>
</div>
</div>
<% end %>
<% @not_queued.each_with_index do |nq, i| %>
<% if i == 0 %>
<div class="w-full h-[2px] mx-1 bg-verdigris-vivid my-5"></div>
<% end %>
<div class="w-full flex items-center justify-between text-lg text-platinum my-1">
<div class="flex flex-none">
<%= nq.pl_plan_key %> -
<%= nq.employer.name %>
(
<div class="mx-1 text-bluetang">
<%= nq.queued_card_count %>
</div>
)
</div>
<div class="grow h-[1px] mx-1 bg-cobalt-vivid"></div>
<div class="flex flex-none items-center text-xs">
<%= link_to print_queued_by_employer_id_card_print_path(nq.pl_plan_key), data: { turbo: false }, class: "flex h-7 w-14 transition duration-100 pointer-events-none opacity-50 cursor-not-allowed" do %>
<%= icon "printer", library: "lucide", class: "h-full w-full text-center text-platinum bg-atmosphere hover:bg-deepcove border-2 border-atmosphere rounded-md p-0.5" %>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="w-1/2 flex flex-col">
<div class="w-full flex justify-center items-center text-center text-2xl">
<%= link_to "Print All Queued", print_all_queued_id_card_print_index_path, data: { turbo: false }, class: "flex justify-center items-center w-1/2 h-15 text-platinum bg-cobalt-vivid hover:bg-deepcove border-2 border-cobalt-vivid rounded-lg p-2" %>
</div>
<div class="w-full flex flex-col justify-center items-center text-center mt-15 text-2xl" data-controller="link-updater" data-link-updater-url-template-value="<%= generate_print_id_card_print_path(':id') %>">
<div class="w-full flex justify-center text-platinum">Print ALL Cards for Group</div>
<div class="w-1/2 flex justify-center text-lg font-medium">
<%= select_tag "employer_select", options_for_select(Employer.all.pluck(:name, :pl_plan_key)), include_blank: "Select Group", data: { action: "change->link-updater#update", link_updater_target: "selector" }, class: "w-full rounded-lg rounded-r-none #{TailwindFormBuilder::SELECT_FIELD_STYLE}" %>
<%= link_to "#", class: 'w-1/4 h-11 bg-cobalt-vivid hover:bg-deepcove border-2 border-cobalt-vivid text-platinum font-bold px-3 rounded-r-lg h-10 transition duration-100', data: { turbo: false, link_updater_target: "link" } do %>
<%= icon "printer", library: "lucide", class: "h-full w-full text-center text-platinum rounded-md p-0.5" %>
<% end %>
</div>
</div>
</div>
</div>
</div>
-34
View File
@@ -1,34 +0,0 @@
<div class="bg-deepcove h-full w-full flex flex-col justify-start font-bold">
<div class="w-full flex flex-col items-center mb-3">
<div class="text-5xl text-platinum">
ID Card Printer
</div>
<span class="block w-full h-0.5 bg-copper"></span>
</div>
<div class="w-full items-start flex">
<div class="w-1/2 flex flex-col">
<% @employer_configurations.each do |es| %>
<div class="w-full flex items-center justify-between text-lg text-platinum my-1">
<div class="flex flex-none">
<%= es.pl_plan_key %> -
<%= es.employer.name %>
(
<div class="mx-1 text-<%= es.queued_card_count > 0 ? "bronze" : "bluetang" %>">
<%= es.queued_card_count %>
</div>
)
</div>
<div class="grow h-[1px] mx-1 bg-cobalt-vivid"></div>
<div class="flex flex-none items-center text-xs">
<%= link_to general_employer_id_card_configuration_index_path(employer_id: es.employer.slug), class: "flex h-7 w-14 transition duration-100 #{es.queued_card_count > 0 ? "" : "pointer-events-none opacity-50 cursor-not-allowed" }" do %>
<%= icon "printer", library: "lucide", class: "h-full w-full text-center text-platinum bg-atmosphere hover:bg-deepcove border-2 border-atmosphere rounded-md p-0.5" %>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="w-1/2 flex justify-center items-center text-center text-2xl">
<%= link_to "Print All Queued", id_card_printer_index_path, class: "flex justify-center items-center w-1/2 h-15 text-platinum bg-cobalt-vivid hover:bg-deepcove border-2 border-cobalt-vivid rounded-lg p-2" %>
</div>
</div>
</div>
+17 -17
View File
@@ -19,25 +19,25 @@ services:
- PGID=100 - PGID=100
tty: true tty: true
stdin_open: true stdin_open: true
depends_on: # depends_on:
db: # db:
condition: service_healthy # condition: service_healthy
# redis: # redis:
# condition: service_started # condition: service_started
db: # db:
build: # build:
context: . # context: .
dockerfile: Dockerfile.db # dockerfile: Dockerfile.db
volumes: # volumes:
- ./mssql-data:/var/opt/mssql # - ./mssql-data:/var/opt/mssql
ports: # ports:
- "1434:1434" # - "1434:1434"
healthcheck: # healthcheck:
test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-Usa", "-PBr1tt0nPassw0rd", "-Q", "select 1"] # test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-Usa", "-PBr1tt0nPassw0rd", "-Q", "select 1"]
interval: 10s # interval: 10s
timeout: 3s # timeout: 3s
retries: 10 # retries: 10
start_period: 10s # start_period: 10s
# redis: # redis:
# image: redis # image: redis
# volumes: # volumes:
+11 -10
View File
@@ -22,16 +22,17 @@ default: &default
development: development:
baclight: baclight:
<<: *default <<: *default
host: db # host: db
database: baclight_dev # database: baclight_dev
username: sa # username: sa
password: Br1tt0nPassw0rd # password: Br1tt0nPassw0rd
# host: 10.41.82.73 #Dev
# port: 1433 host: 10.41.82.73 #Dev
# database: BrittonConnect port: 1433
# username: BSTI database: BrittonConnect
# password: BSTIBOY username: BSTI
# tds_version: 7.3 password: BSTIBOY
tds_version: 7.3
vhcs: vhcs:
<<: *default <<: *default
# host: 10.41.82.72 #Prod # host: 10.41.82.72 #Prod
+17 -6
View File
@@ -12,15 +12,26 @@ Rails.application.routes.draw do
resources :network_logos do resources :network_logos do
get 'image', on: :member get 'image', on: :member
end end
resources :printer, only: [:index] resources :print, only: [:index] do
resources :print_data do
collection do collection do
get 'generate_sample' get :print_all_queued
get 'generate_print' end
get 'generate_mobile_display' member do
get 'generate_full_page' get :generate_sample
get :generate_print
get :generate_mobile_display
get :generate_full_page
get :print_queued_by_employer
end end
end end
# resources :print_data do
# collection do
# get 'generate_sample'
# get 'generate_print'
# get 'generate_mobile_display'
# get 'generate_full_page'
# end
# end
get 'plans/:id/get_plan_benefits', to: 'plans#get_plan_benefits' get 'plans/:id/get_plan_benefits', to: 'plans#get_plan_benefits'
end end
# resources :employer_setup # resources :employer_setup
@@ -1,16 +1,16 @@
class CreateIdCardPrintData < ActiveRecord::Migration[7.0] class CreateIdCardPrintData < ActiveRecord::Migration[7.0]
def change def change
create_table :id_card_print_data do |t| create_table :id_card_print_data do |t|
t.string :full_name
t.string :full_name_last_name_first t.string :full_name_last_name_first
t.string :family_id
t.string :primary_mb_member_key
t.string :employer_name t.string :employer_name
t.string :pl_plan_key t.string :pl_plan_key
t.string :group_number t.string :group_number
t.string :primary_mb_member_key
t.string :family_id
t.string :full_name
t.string :rx_group t.string :rx_group
t.string :medical_eff_date t.string :medical_eff_date
t.string :provider_code t.string :network_provider
t.string :provider_line_1 t.string :provider_line_1
t.string :provider_line_2 t.string :provider_line_2
t.string :provider_line_3 t.string :provider_line_3
@@ -74,6 +74,9 @@ class CreateIdCardPrintData < ActiveRecord::Migration[7.0]
t.string :benefit_13 t.string :benefit_13
t.string :benefit_desc_14 t.string :benefit_desc_14
t.string :benefit_14 t.string :benefit_14
t.boolean :sample, default: false
t.string :sample_key
t.string :sample_plan_title
t.timestamps t.timestamps
end end
+2 -1
View File
@@ -2,11 +2,12 @@ class CreateMembers < ActiveRecord::Migration[7.2]
def change def change
create_table :members do |t| create_table :members do |t|
t.string :name t.string :name
t.string :id_card_display_name
t.string :family_id t.string :family_id
t.integer :mb_member_key t.integer :mb_member_key
t.integer :pb_entity_key t.integer :pb_entity_key
t.integer :pl_plan_key t.integer :pl_plan_key
t.string :id_card_display_name
t.string :division
t.belongs_to :employer, foreign_key: true t.belongs_to :employer, foreign_key: true
t.belongs_to :id_card_plan, null: true, foreign_key: true t.belongs_to :id_card_plan, null: true, foreign_key: true
+9 -5
View File
@@ -110,16 +110,16 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
end end
create_table "id_card_print_data", force: :cascade do |t| create_table "id_card_print_data", force: :cascade do |t|
t.string "full_name"
t.string "full_name_last_name_first" t.string "full_name_last_name_first"
t.string "family_id"
t.string "primary_mb_member_key"
t.string "employer_name" t.string "employer_name"
t.string "pl_plan_key" t.string "pl_plan_key"
t.string "group_number" t.string "group_number"
t.string "primary_mb_member_key"
t.string "family_id"
t.string "full_name"
t.string "rx_group" t.string "rx_group"
t.string "medical_eff_date" t.string "medical_eff_date"
t.string "provider_code" t.string "network_provider"
t.string "provider_line_1" t.string "provider_line_1"
t.string "provider_line_2" t.string "provider_line_2"
t.string "provider_line_3" t.string "provider_line_3"
@@ -183,6 +183,9 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
t.string "benefit_13" t.string "benefit_13"
t.string "benefit_desc_14" t.string "benefit_desc_14"
t.string "benefit_14" t.string "benefit_14"
t.boolean "sample", default: false
t.string "sample_key"
t.string "sample_plan_title"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
@@ -246,11 +249,12 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
create_table "members", force: :cascade do |t| create_table "members", force: :cascade do |t|
t.string "name" t.string "name"
t.string "id_card_display_name"
t.string "family_id" t.string "family_id"
t.integer "mb_member_key" t.integer "mb_member_key"
t.integer "pb_entity_key" t.integer "pb_entity_key"
t.integer "pl_plan_key" t.integer "pl_plan_key"
t.string "id_card_display_name"
t.string "division"
t.bigint "employer_id" t.bigint "employer_id"
t.bigint "id_card_plan_id" t.bigint "id_card_plan_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
+85 -95
View File
@@ -5,11 +5,21 @@ def determine_id_card_templates(pl_plan_key)
when 2 when 2
"SmartIDCard" "SmartIDCard"
when 3 when 3
"TPAIDCardTan" "TandemlocIDCard"
when 56 when 56
"HealthBusIDCard" "QRCodeIDCard"
else else
"FairosIDCard" "FairosRxIDCard"
end
end
def determine_id_card_rx(pl_plan_key)
pl_plan_key = pl_plan_key.to_i
if pl_plan_key == 56
"TheHealthBus"
else
"FairosRx"
end end
end end
@@ -37,95 +47,18 @@ def determine_id_card_network(pl_plan_key)
end end
def determine_network_logos(pl_plan_key) puts "[**** IMPORT ID CARD TABLES ****]"
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( ## SET UP DEFAULT LEVEL360 PLANS FOR PLAN PICKER
# 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",
# "INNInd Ded",
# "INNFamily Ded",
# "OONInd Ded",
# "OONFamily Ded",
# "Co-Insurance",
# "INNInd OOP",
# "INNFamily OOP",
# "OONInd OOP",
# "OONFamily 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") # temp_1 = IdCardBenefitsTemplate.create(title: "Rebekah's Template")
# (1..14).each do |seq| # (1..14).each do |seq|
# IdCardBenefit.create(sequence: seq, benefit: "greatest hits vol #{seq}", id_card_benefits_template: temp_1) # IdCardBenefit.create(sequence: seq, benefit: "greatest hits vol #{seq}", id_card_benefits_template: temp_1)
# end # end
##---------------- Provider/Claims Setup------------------------------------
# historical_id_card_docs = Dir['tmp/*.docx'] puts "Importing Card Provider/Claims Information"
# 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"] default_provider_codes = ["5", "2"]
needed_codes_mapping = { needed_codes_mapping = {
"0": "MedCost VA Plus Network", "0": "MedCost VA Plus Network",
@@ -148,9 +81,13 @@ vhcs_cp.each do |vhcs|
end end
attributes_hash[:title] = needed_codes_mapping[vhcs.provider_code] attributes_hash[:title] = needed_codes_mapping[vhcs.provider_code]
puts "-- #{attributes_hash[:title]}"
IdCard::ProviderSection.find_or_create_by(attributes_hash) IdCard::ProviderSection.find_or_create_by(attributes_hash)
end end
##---------------- Rx info Setup------------------------------------
puts "Importing Card Rx Information"
Vhcs::HlrxCrosRef.all.each do |vhcs| 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) 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/, '') title = rx.web_url.gsub(/^www\./, '').gsub(/\.com\Z/, '')
@@ -158,36 +95,89 @@ Vhcs::HlrxCrosRef.all.each do |vhcs|
title = title.capitalize title = title.capitalize
end end
puts "-- #{title}"
rx.title = title rx.title = title
rx.save rx.save
end end
["CignaLogo.png", "MedCostLogo.png"].each do |logo_upload| ##---------------- Network Logos Setup------------------------------------
puts "Importing Network Logos"
folder_path = Rails.root.join('logo_files', 'network')
file_names = Dir.children(folder_path)
default_network_logos = ["CignaLogo.png", "MedCostLogo.png"]
file_names.each do |logo_upload|
puts "-- #{logo_upload}"
new_logo = ImageProcessor.new("logo_files/network/#{logo_upload}", "Network").call new_logo = ImageProcessor.new("logo_files/network/#{logo_upload}", "Network").call
new_logo.default = true if default_network_logos.include?(logo_upload)
new_logo.default = true
end
new_logo.active = true new_logo.active = true
new_logo.save new_logo.save
end end
##---------------- Active Employer Logo Setup------------------------------------
puts "Importing Employer Logos"
folder_path = Rails.root.join('logo_files', 'employer')
file_names = Dir.children(folder_path)
file_names.each do |logo_upload|
puts "-- #{logo_upload}"
new_logo = ImageProcessor.new("logo_files/employer/#{logo_upload}", "Employer").call
new_logo.active = true
new_logo.save
end
##---------------- Import Employer/Member Setup------------------------------------
puts "[**** IMPORT EMPLOYERS ****]"
Rake::Task["employer:vhcs_sync_all"].invoke
# 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
puts "[**** UPDATE EMPLOYER ID CARDS CONFIGS ****]"
IdCard::Configuration.all.each do |config| IdCard::Configuration.all.each do |config|
config.card_template = determine_id_card_templates(config.pl_plan_key) config.card_template = determine_id_card_templates(config.pl_plan_key)
network_information = determine_id_card_network(config.pl_plan_key) network_information = determine_id_card_network(config.pl_plan_key)
config.network_provider = network_information[:provider] config.network_provider = network_information[:provider]
ps_id = IdCard::ProviderSection.find_by(title: network_information[:provider_section]).id ps = IdCard::ProviderSection.find_by(title: network_information[:provider_section])
config.provider_section_id = ps_id config.provider_section_id = ps.id
nl_id = IdCard::NetworkLogo.find_by(filename: network_information[:network_logo]).id nl = IdCard::NetworkLogo.find_by(filename: network_information[:network_logo])
config.network_logo_id = nl_id config.network_logo_id = nl.id
employer_name = configuration.employer.name rx_title = determine_id_card_rx(config.pl_plan_key)
logo_name = employer_name.titleize.gsub(' ', '') rs = IdCard::RxSection.find_by(title: rx_title)
config.rx_section_id = rs.id
logo = IdCard::EmployerLogo.where("filename LIKE ?", "%#{logo_name}%") employer_name = config.employer.employer_trim_name
if logo name_segments = employer_name.titleize.split
config.employer_logo_id = logo.first.id name_segments.each do |segment|
logo = IdCard::EmployerLogo.where("filename LIKE ?", "%#{segment}%")
if logo&.first
config.employer_logo = logo.first
break
end
end end
config.active = true
config.save
end end
# 15, 18, 19, 20, 13, 21 # 15, 18, 19, 20, 13, 21
+16 -4
View File
@@ -30,7 +30,7 @@ namespace :employer do
card_print_name = Vhcs::PbEntity.find_by(company_pb_entity_key: em.company_pb_entity_key).last_name card_print_name = Vhcs::PbEntity.find_by(company_pb_entity_key: em.company_pb_entity_key).last_name
id_card_configuration.print_name = em.employer_trim_name(card_print_name) id_card_configuration.print_name = em.employer_trim_name(card_print_name)
id_card_configuration.active = true em.active = true
# em.default_network_logo = determine_network_logos(em.pl_plan_key) # em.default_network_logo = determine_network_logos(em.pl_plan_key)
end end
@@ -75,9 +75,21 @@ namespace :employer do
card_display_name = Vhcs::PbEntity.find_by(pb_entity_key: me.pb_entity_key).full_name card_display_name = Vhcs::PbEntity.find_by(pb_entity_key: me.pb_entity_key).full_name
me.id_card_display_name = card_display_name me.id_card_display_name = card_display_name
plan_pb_product_key = Vhcs::PbProduct.joins('INNER JOIN "PBProductAvailability" ON "PBProductAvailability"."PBProductKey" = "PBProduct"."PBProductKey" INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."PBProductAvailabilityKey" = "PBProductAvailability"."PBProductAvailabilityKey" INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', me.pb_entity_key).first.pb_product_key if me.pl_plan_key == '16'
if plan = Plan.find_by(pb_product_key: plan_pb_product_key) division = Vhcs::PbEntity.joins('
me.plan = plan INNER JOIN "PBAffiliation" ON "PBAffiliation"."ParentPBEntityKey" = "PBEntity"."PBEntityKey"
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."PBAffiliationKey" = "PBAffiliation"."PBAffiliationKey"
INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
').where('"PBCoveredEntities"."PBEntityKey" = ?', me.pb_entity_key).uniq.first.last_name
me.division = division
end
pb_product = Vhcs::PbProduct.joins('INNER JOIN "PBProductAvailability" ON "PBProductAvailability"."PBProductKey" = "PBProduct"."PBProductKey" INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."PBProductAvailabilityKey" = "PBProductAvailability"."PBProductAvailabilityKey" INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', me.pb_entity_key).first
if pb_product
plan_pb_product_key = pb_product.pb_product_key
if plan = IdCard::Plan.find_by(pb_product_key: plan_pb_product_key)
me.id_card_plan = plan
end
end end
end end
puts "Employer #{employer.name} (#{i}/#{vw_mb_members_count}) members imported" puts "Employer #{employer.name} (#{i}/#{vw_mb_members_count}) members imported"