Major features finished
@@ -85,7 +85,11 @@ gem "tailwindcss-rails"
|
|||||||
gem 'docx'
|
gem 'docx'
|
||||||
gem 'httparty'
|
gem 'httparty'
|
||||||
gem 'combine_pdf'
|
gem 'combine_pdf'
|
||||||
|
gem 'pdf-reader'
|
||||||
gem 'rails_icons'
|
gem 'rails_icons'
|
||||||
gem 'fastimage'
|
gem 'fastimage'
|
||||||
gem 'rubyzip', require: 'zip'
|
gem 'rubyzip', require: 'zip'
|
||||||
gem "solid_queue"
|
gem "solid_queue"
|
||||||
|
gem 'image_processing'
|
||||||
|
gem 'whenever', require: false
|
||||||
|
gem 'amatch'
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
Ascii85 (2.0.1)
|
||||||
actioncable (7.2.3)
|
actioncable (7.2.3)
|
||||||
actionpack (= 7.2.3)
|
actionpack (= 7.2.3)
|
||||||
activesupport (= 7.2.3)
|
activesupport (= 7.2.3)
|
||||||
@@ -79,6 +80,10 @@ GEM
|
|||||||
tzinfo (~> 2.0, >= 2.0.5)
|
tzinfo (~> 2.0, >= 2.0.5)
|
||||||
addressable (2.8.9)
|
addressable (2.8.9)
|
||||||
public_suffix (>= 2.0.2, < 8.0)
|
public_suffix (>= 2.0.2, < 8.0)
|
||||||
|
afm (1.0.0)
|
||||||
|
amatch (0.6.0)
|
||||||
|
mize
|
||||||
|
tins (~> 1)
|
||||||
ast (2.4.3)
|
ast (2.4.3)
|
||||||
base64 (0.3.0)
|
base64 (0.3.0)
|
||||||
bcrypt (3.1.22)
|
bcrypt (3.1.22)
|
||||||
@@ -103,6 +108,7 @@ GEM
|
|||||||
regexp_parser (>= 1.5, < 3.0)
|
regexp_parser (>= 1.5, < 3.0)
|
||||||
xpath (~> 3.2)
|
xpath (~> 3.2)
|
||||||
cgi (0.5.1)
|
cgi (0.5.1)
|
||||||
|
chronic (0.10.2)
|
||||||
coderay (1.1.3)
|
coderay (1.1.3)
|
||||||
combine_pdf (1.0.31)
|
combine_pdf (1.0.31)
|
||||||
matrix
|
matrix
|
||||||
@@ -128,11 +134,13 @@ GEM
|
|||||||
et-orbi (1.4.0)
|
et-orbi (1.4.0)
|
||||||
tzinfo
|
tzinfo
|
||||||
fastimage (2.4.1)
|
fastimage (2.4.1)
|
||||||
|
ffi (1.17.4-x86_64-linux-gnu)
|
||||||
fugit (1.12.1)
|
fugit (1.12.1)
|
||||||
et-orbi (~> 1.4)
|
et-orbi (~> 1.4)
|
||||||
raabro (~> 1.4)
|
raabro (~> 1.4)
|
||||||
globalid (1.3.0)
|
globalid (1.3.0)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
|
hashery (2.1.2)
|
||||||
httparty (0.24.2)
|
httparty (0.24.2)
|
||||||
csv
|
csv
|
||||||
mini_mime (>= 1.0.0)
|
mini_mime (>= 1.0.0)
|
||||||
@@ -141,6 +149,9 @@ GEM
|
|||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
icons (0.8.1)
|
icons (0.8.1)
|
||||||
nokogiri (~> 1.16, >= 1.16.4)
|
nokogiri (~> 1.16, >= 1.16.4)
|
||||||
|
image_processing (1.14.0)
|
||||||
|
mini_magick (>= 4.9.5, < 6)
|
||||||
|
ruby-vips (>= 2.0.17, < 3)
|
||||||
importmap-rails (2.2.3)
|
importmap-rails (2.2.3)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
activesupport (>= 6.0.0)
|
activesupport (>= 6.0.0)
|
||||||
@@ -170,10 +181,13 @@ GEM
|
|||||||
marcel (1.1.0)
|
marcel (1.1.0)
|
||||||
matrix (0.4.3)
|
matrix (0.4.3)
|
||||||
method_source (1.1.0)
|
method_source (1.1.0)
|
||||||
|
mini_magick (5.3.1)
|
||||||
|
logger
|
||||||
mini_mime (1.1.5)
|
mini_mime (1.1.5)
|
||||||
minitest (6.0.2)
|
minitest (6.0.2)
|
||||||
drb (~> 2.0)
|
drb (~> 2.0)
|
||||||
prism (~> 1.5)
|
prism (~> 1.5)
|
||||||
|
mize (0.6.1)
|
||||||
msgpack (1.8.0)
|
msgpack (1.8.0)
|
||||||
multi_xml (0.8.1)
|
multi_xml (0.8.1)
|
||||||
bigdecimal (>= 3.1, < 5)
|
bigdecimal (>= 3.1, < 5)
|
||||||
@@ -194,6 +208,12 @@ GEM
|
|||||||
parser (3.3.10.2)
|
parser (3.3.10.2)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
racc
|
racc
|
||||||
|
pdf-reader (2.15.1)
|
||||||
|
Ascii85 (>= 1.0, < 3.0, != 2.0.0)
|
||||||
|
afm (>= 0.2.1, < 2)
|
||||||
|
hashery (~> 2.0)
|
||||||
|
ruby-rc4
|
||||||
|
ttfunk
|
||||||
pp (0.6.3)
|
pp (0.6.3)
|
||||||
prettyprint
|
prettyprint
|
||||||
prettyprint (0.2.0)
|
prettyprint (0.2.0)
|
||||||
@@ -264,6 +284,8 @@ GEM
|
|||||||
erb
|
erb
|
||||||
psych (>= 4.0.0)
|
psych (>= 4.0.0)
|
||||||
tsort
|
tsort
|
||||||
|
readline (0.0.4)
|
||||||
|
reline
|
||||||
regexp_parser (2.11.3)
|
regexp_parser (2.11.3)
|
||||||
reline (0.6.3)
|
reline (0.6.3)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
@@ -321,6 +343,9 @@ GEM
|
|||||||
rubocop (~> 1.81)
|
rubocop (~> 1.81)
|
||||||
ruby-progressbar (1.13.0)
|
ruby-progressbar (1.13.0)
|
||||||
ruby-rc4 (0.1.5)
|
ruby-rc4 (0.1.5)
|
||||||
|
ruby-vips (2.3.0)
|
||||||
|
ffi (~> 1.12)
|
||||||
|
logger
|
||||||
rubyzip (3.2.2)
|
rubyzip (3.2.2)
|
||||||
securerandom (0.4.1)
|
securerandom (0.4.1)
|
||||||
selenium-webdriver (4.41.0)
|
selenium-webdriver (4.41.0)
|
||||||
@@ -347,15 +372,22 @@ GEM
|
|||||||
stimulus-rails (1.3.4)
|
stimulus-rails (1.3.4)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
stringio (3.2.0)
|
stringio (3.2.0)
|
||||||
|
sync (0.5.0)
|
||||||
tailwindcss-rails (4.4.0)
|
tailwindcss-rails (4.4.0)
|
||||||
railties (>= 7.0.0)
|
railties (>= 7.0.0)
|
||||||
tailwindcss-ruby (~> 4.0)
|
tailwindcss-ruby (~> 4.0)
|
||||||
tailwindcss-ruby (4.2.1-x86_64-linux-gnu)
|
tailwindcss-ruby (4.2.1-x86_64-linux-gnu)
|
||||||
thor (1.5.0)
|
thor (1.5.0)
|
||||||
timeout (0.6.1)
|
timeout (0.6.1)
|
||||||
|
tins (1.52.0)
|
||||||
|
bigdecimal
|
||||||
|
mize (~> 0.6)
|
||||||
|
readline
|
||||||
|
sync
|
||||||
tiny_tds (3.4.0-x86_64-linux-gnu)
|
tiny_tds (3.4.0-x86_64-linux-gnu)
|
||||||
bigdecimal (>= 2.0.0)
|
bigdecimal (>= 2.0.0)
|
||||||
tsort (0.2.0)
|
tsort (0.2.0)
|
||||||
|
ttfunk (1.7.0)
|
||||||
turbo-rails (2.0.23)
|
turbo-rails (2.0.23)
|
||||||
actionpack (>= 7.1.0)
|
actionpack (>= 7.1.0)
|
||||||
railties (>= 7.1.0)
|
railties (>= 7.1.0)
|
||||||
@@ -377,6 +409,8 @@ GEM
|
|||||||
base64
|
base64
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
|
whenever (1.1.2)
|
||||||
|
chronic (>= 0.6.3)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
zeitwerk (2.7.5)
|
zeitwerk (2.7.5)
|
||||||
@@ -386,6 +420,7 @@ PLATFORMS
|
|||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
activerecord-sqlserver-adapter
|
activerecord-sqlserver-adapter
|
||||||
|
amatch
|
||||||
bootsnap
|
bootsnap
|
||||||
brakeman
|
brakeman
|
||||||
bundler-audit
|
bundler-audit
|
||||||
@@ -395,8 +430,10 @@ DEPENDENCIES
|
|||||||
docx
|
docx
|
||||||
fastimage
|
fastimage
|
||||||
httparty
|
httparty
|
||||||
|
image_processing
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder
|
jbuilder
|
||||||
|
pdf-reader
|
||||||
pry-rails
|
pry-rails
|
||||||
puma (~> 6.5)
|
puma (~> 6.5)
|
||||||
pundit
|
pundit
|
||||||
@@ -417,6 +454,7 @@ DEPENDENCIES
|
|||||||
turbo-rails
|
turbo-rails
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
web-console
|
web-console
|
||||||
|
whenever
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
ruby 3.4.8p72
|
ruby 3.4.8p72
|
||||||
|
|||||||
@@ -69,6 +69,18 @@ class EmployersController < ApplicationController
|
|||||||
|
|
||||||
# API Methods
|
# API Methods
|
||||||
|
|
||||||
|
def refresh_employer_information
|
||||||
|
@employer = Employer.find(params[:id])
|
||||||
|
@employer.sync_with_vhcs
|
||||||
|
redirect_to employer_path(@employer.slug)
|
||||||
|
end
|
||||||
|
|
||||||
|
def refresh_employer_members_information
|
||||||
|
@employer = Employer.find(params[:id])
|
||||||
|
@employer.sync_members_with_vhcs
|
||||||
|
redirect_to employer_path(@employer.slug)
|
||||||
|
end
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@@ -4,39 +4,31 @@ module IdCard
|
|||||||
# View Methods
|
# View Methods
|
||||||
def index
|
def index
|
||||||
@employer_setups = IdCard::Setup.active.to_a
|
@employer_setups = IdCard::Setup.active.to_a
|
||||||
@queue_counts = IdCardQueueService::GetQueuedCounts.new().call
|
@queue_members = IdCardQueueService::GetQueuedMembers.new().call
|
||||||
add_queued_count_to_card_setup
|
add_queued_count_to_employer_setup(@queue_members)
|
||||||
@queued = @employer_setups.select { |setup| setup.queued_card_count > 0 }.sort_by { |setup| setup.pl_plan_key.to_i }
|
@queued = @employer_setups.select { |setup| setup.queued_card_count > 0 }.sort_by { |setup| setup.print_name }
|
||||||
@not_queued = @employer_setups.select { |setup| setup.queued_card_count == 0 }.sort_by { |setup| setup.pl_plan_key.to_i }
|
@not_queued = @employer_setups.select { |setup| setup.queued_card_count == 0 }.sort_by { |setup| setup.print_name }
|
||||||
render :index
|
render :index
|
||||||
end
|
end
|
||||||
|
|
||||||
# API Methods
|
# API Methods
|
||||||
|
|
||||||
def print_all_queued
|
def print_all_queued
|
||||||
@queue_members = IdCardQueueService::GetQueuedCards.new().call
|
@queue_members = IdCardQueueService::GetQueuedMembers.new().call
|
||||||
cards_pdf = IdCardPrinterService::QueuedCardsGenerator.new(@queue_members).call
|
cards_pdf = IdCardPrinterService::CardsGenerator.new(@queue_members, "PrintCard").call
|
||||||
|
|
||||||
if cards_pdf.is_a?(CombinePDF::PDF)
|
|
||||||
send_data cards_pdf.to_pdf,
|
send_data cards_pdf.to_pdf,
|
||||||
filename: "queued_cards_#{Date.today}.pdf",
|
filename: "all_queued_cards_#{Date.today}.pdf",
|
||||||
type: "application/pdf",
|
type: "application/pdf",
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
else
|
|
||||||
cards_pdf.rewind
|
|
||||||
send_data cards_pdf.read,
|
|
||||||
filename: "queued_cards_#{Date.today}.zip",
|
|
||||||
type: 'application/zip',
|
|
||||||
disposition: 'attachment'
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_queued_by_employer
|
def print_queued_by_employer
|
||||||
pl_plan_key = params[:id].to_s
|
pl_plan_key = params[:id].to_s
|
||||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||||
@queue_members = IdCardQueueService::GetQueuedCards.new(pl_plan_key).call
|
@queue_members = IdCardQueueService::GetQueuedMembers.new(pl_plan_key).call
|
||||||
cards_pdf = IdCardPrinterService::QueuedCardsGenerator.new(@queue_members).call
|
cards_pdf = IdCardPrinterService::CardsGenerator.new(@queue_members, "PrintCard").call
|
||||||
|
|
||||||
send_data cards_pdf.to_pdf,
|
send_data cards_pdf.to_pdf,
|
||||||
filename: "#{@employer.name.parameterize(separator: "_")}_queued_cards_#{Date.today}.pdf",
|
filename: "#{@employer.name.parameterize(separator: "_")}_queued_cards_#{Date.today}.pdf",
|
||||||
@@ -104,7 +96,8 @@ module IdCard
|
|||||||
slug = params[:id]
|
slug = params[:id]
|
||||||
@employer = Employer.find_by(slug: slug)
|
@employer = Employer.find_by(slug: slug)
|
||||||
end
|
end
|
||||||
cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
|
cards_pdf = IdCardPrinterService::CardsGenerator.new(@employer.employer_member_keys, "FullPageCard", true).call
|
||||||
|
# cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
|
||||||
|
|
||||||
cards_pdf.rewind
|
cards_pdf.rewind
|
||||||
send_data cards_pdf.sysread,
|
send_data cards_pdf.sysread,
|
||||||
@@ -117,11 +110,11 @@ module IdCard
|
|||||||
private
|
private
|
||||||
|
|
||||||
|
|
||||||
def add_queued_count_to_card_setup
|
def add_queued_count_to_employer_setup(queued_employer_members)
|
||||||
@queue_counts.each do |qc|
|
queued_employer_members.each do |queued_employer|
|
||||||
match = @employer_setups.find { |setup| setup.pl_plan_key == qc["PLPlanKey"] }
|
match = @employer_setups.find { |setup| setup.pl_plan_key == queued_employer[:pl_plan_key] }
|
||||||
if match.present?
|
if match.present?
|
||||||
match.queued_card_count = qc["QueuedCardsCount"]
|
match.queued_card_count = queued_employer[:member_keys].length
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ export default class extends Controller {
|
|||||||
static targets = ["exceptionItemTemplate", "exceptionItemContainer", "exceptionItem", "exceptionItemButton"]
|
static targets = ["exceptionItemTemplate", "exceptionItemContainer", "exceptionItem", "exceptionItemButton"]
|
||||||
|
|
||||||
connect() {
|
connect() {
|
||||||
if (this.exceptionItemTargets.length > 0) {
|
// if (this.exceptionItemTargets.length > 0) {
|
||||||
const content = this.#newExemptionItem()
|
// const content = this.#newExemptionItem()
|
||||||
this.exceptionItemButtonTarget.insertAdjacentHTML('beforebegin', content);
|
// this.exceptionItemButtonTarget.insertAdjacentHTML('beforebegin', content);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
addExemptionItem(event) {
|
addExemptionItem(event) {
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
class ProcessIdCardDataJob < ApplicationJob
|
|
||||||
queue_as :default
|
|
||||||
|
|
||||||
def perform(member_key, field_exception_ids, has_divisions = false)
|
|
||||||
member = Member.find_by(pb_entity_key: member_key)
|
|
||||||
|
|
||||||
effect_date = determine_eff_date(member)
|
|
||||||
if effect_date
|
|
||||||
member_card = @base_card.dup
|
|
||||||
member_attributes = {
|
|
||||||
full_name: member.id_card_display_name,
|
|
||||||
full_name_last_name_first: member.name,
|
|
||||||
primary_mb_member_key: member.pb_entity_key,
|
|
||||||
family_id: member.family_id,
|
|
||||||
plan_id: member.id_card_plan_id,
|
|
||||||
medical_eff_date: effect_date.strftime("%m/%d/%Y")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependent_attributes = get_dependent_fields(member)
|
|
||||||
if dependent_attributes.present?
|
|
||||||
member_attributes.merge!(dependent_attributes)
|
|
||||||
end
|
|
||||||
|
|
||||||
if has_divisions
|
|
||||||
member_attributes.merge!({employer_name: member.division})
|
|
||||||
end
|
|
||||||
|
|
||||||
if field_exception_ids.present?
|
|
||||||
exceptions_attributes = {}
|
|
||||||
field_exceptions = IdCard::FieldException.where(id: field_exception_ids)
|
|
||||||
member_exception_values = member.id_card_field_exception_values
|
|
||||||
field_exceptions.each do |fe|
|
|
||||||
if member_exception_values[fe.field_type] == fe.field_value
|
|
||||||
fe.field_exception_items.each do |fei|
|
|
||||||
if fei.field_value.present?
|
|
||||||
exceptions_attributes[fei.field_name] = fei.field_value
|
|
||||||
elsif fei.provider_section_id.present?
|
|
||||||
provider_attributes = IdCard::ProviderSection.find(fei.provider_section_id).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
|
|
||||||
)
|
|
||||||
exceptions_attributes.merge!(provider_attributes)
|
|
||||||
elsif fei.network_logo_id.present?
|
|
||||||
exceptions_attributes.merge!(network_logo_id: fei.network_logo_id)
|
|
||||||
exceptions_attributes.merge!(network_logo_filename: fei.network_logo.filename)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
member_attributes.merge!(exceptions_attributes)
|
|
||||||
end
|
|
||||||
|
|
||||||
member_card = IdCard::PrintData.find_by(pl_plan_key: member.pl_plan_key, plan_id: member.id_card_plan_id, primary_mb_member_key: nil).dup
|
|
||||||
member_card.assign_attributes(member_attributes)
|
|
||||||
member_card.save
|
|
||||||
end
|
|
||||||
|
|
||||||
true
|
|
||||||
|
|
||||||
# BatchProcess.increment_counter(:completed_jobs, batch_process_id)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
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 = Vhcs::VwmbMember.where(pl_plan_key: member.pl_plan_key, 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
|
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
class ProcessMemberCardDataJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(member_key, member_card_exceptions_attrs, has_divisions = false, has_dental = false)
|
||||||
|
member = Member.find_by(pb_entity_key: member_key)
|
||||||
|
|
||||||
|
effect_date = determine_eff_date(member)
|
||||||
|
if effect_date
|
||||||
|
member_card = @base_card.dup
|
||||||
|
member_attributes = {
|
||||||
|
full_name: member.id_card_display_name,
|
||||||
|
full_name_last_name_first: member.name,
|
||||||
|
primary_mb_member_key: member.pb_entity_key,
|
||||||
|
family_id: member.family_id,
|
||||||
|
plan_id: member.id_card_plan_id,
|
||||||
|
medical_eff_date: effect_date.strftime("%m/%d/%Y")
|
||||||
|
}
|
||||||
|
|
||||||
|
if member.dependents.present?
|
||||||
|
dependent_attributes = format_dependent_attributes(member)
|
||||||
|
member_attributes.merge!(dependent_attributes)
|
||||||
|
end
|
||||||
|
|
||||||
|
if has_divisions
|
||||||
|
member_attributes.merge!({employer_name: member.division})
|
||||||
|
end
|
||||||
|
|
||||||
|
if member_card_exceptions_attrs.present?
|
||||||
|
# exceptions_attributes = {}
|
||||||
|
# field_exceptions = IdCard::FieldException.where(id: field_exception_ids)
|
||||||
|
# member_exception_values = member.id_card_field_exception_values
|
||||||
|
# field_exceptions.each do |fe|
|
||||||
|
# if fe.exception_values.include?(member_exception_values[fe.exception_type.to_sym])
|
||||||
|
# fe.field_exception_items.each do |fei|
|
||||||
|
# if fei.field_value.present?
|
||||||
|
# exception_eff_date = Date.strptime(fei.field_value, "%m/%d/%Y")
|
||||||
|
# member_eff_date = Date.strptime(member_attributes[:medical_eff_date], "%m/%d/%Y")
|
||||||
|
# if exception_eff_date > member_eff_date
|
||||||
|
# exceptions_attributes[fei.field_name.to_sym] = fei.field_value
|
||||||
|
# end
|
||||||
|
# elsif fei.provider_section_id.present?
|
||||||
|
# provider_attributes = IdCard::ProviderSection.find(fei.provider_section_id).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
|
||||||
|
# )
|
||||||
|
# exceptions_attributes.merge!(provider_attributes)
|
||||||
|
# elsif fei.network_logo_id.present?
|
||||||
|
# exceptions_attributes.merge!(network_logo_filename: fei.network_logo.filename)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
member_attributes.merge!(member_card_exceptions_attrs)
|
||||||
|
end
|
||||||
|
|
||||||
|
if has_dental
|
||||||
|
if member.dental_plan_key
|
||||||
|
member_attributes.merge!({dental_coverage: member.coverage_class.upcase})
|
||||||
|
unless member.id_card_plan_id
|
||||||
|
member_attributes.merge!({group_number: "", medical_eff_date: ""})
|
||||||
|
# dental_plan = IdCard::Plan.find_by(pb_product_key: 1025)
|
||||||
|
if IdCard::Plan.find_by(pb_product_key: member.dental_plan_key).blank?
|
||||||
|
member_attributes.merge!({employer_name: 'COBRA'})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if member.id_card_plan.present? && member.id_card_plan.title.upcase.include?('COBRA')
|
||||||
|
member_attributes.merge!({employer_name: 'COBRA'})
|
||||||
|
end
|
||||||
|
|
||||||
|
if member.id_card_plan_id.present?
|
||||||
|
member_card = IdCard::PrintData.find_by(pl_plan_key: member.pl_plan_key, plan_id: member.id_card_plan_id, primary_mb_member_key: nil).dup
|
||||||
|
else
|
||||||
|
member_card = IdCard::PrintData.where(pl_plan_key: member.pl_plan_key, primary_mb_member_key: nil).first.dup
|
||||||
|
end
|
||||||
|
|
||||||
|
member_card.assign_attributes(member_attributes)
|
||||||
|
member_card.save
|
||||||
|
# if dependent_attributes.present?
|
||||||
|
# dependent_card = member_card.dup
|
||||||
|
# dependent_card.full_name_last_name_first = dependent_card.full_name_last_name_first.concat(" dependent")
|
||||||
|
# dependent_card.save
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
|
true
|
||||||
|
|
||||||
|
# BatchProcess.increment_counter(:completed_jobs, batch_process_id)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def determine_eff_date(member)
|
||||||
|
participation = Vhcs::PbProductParticipation.joins('INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', member.pb_entity_key).order(out_of_effect: :desc).first
|
||||||
|
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 format_dependent_attributes(member)
|
||||||
|
dependent_attributes = {}
|
||||||
|
member.dependents.each_with_index do |dep, index|
|
||||||
|
dependent_attributes["dependent_#{index + 1}".to_sym] = dep
|
||||||
|
end
|
||||||
|
dependent_attributes
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
class UpdateEmployerJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(pl_plan_key, plan_header = {}, full_sync = false)
|
||||||
|
|
||||||
|
unless plan_header.present?
|
||||||
|
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE PLPlanKey = #{pl_plan_key}"
|
||||||
|
plan_header = VhcsRecord.connection.select_all(sql_query).first
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "== Updating #{plan_header['ShortDesc'].strip.titleize} =="
|
||||||
|
|
||||||
|
plan_code = Vhcs::HlPlanCode.find_by(plan_key: plan_header['PLPlanKey'])
|
||||||
|
pb_company_plan = Vhcs::PbCompanyPlans.find_by(pl_plan_key: plan_header['PLPlanKey'])
|
||||||
|
employer = Employer.find_or_create_by!(pl_plan_key: plan_header['PLPlanKey'])
|
||||||
|
full_sync = employer.previously_new_record? || full_sync
|
||||||
|
# id_card_setup = employer.id_card_setup || employer.create_id_card_setup(pl_plan_key: employer.pl_plan_key)
|
||||||
|
# id_card_setup = employer.id_card_setup.find_or_create_by(pl_plan_key: employer.pl_plan_key)
|
||||||
|
|
||||||
|
employer_update_attrs = {}
|
||||||
|
setup_update_attrs = {}
|
||||||
|
|
||||||
|
employer_update_attrs.merge!({
|
||||||
|
plan_id: plan_header['PlanId'].strip.to_i,
|
||||||
|
company_pb_entity_key: pb_company_plan.company_pb_entity_key
|
||||||
|
})
|
||||||
|
|
||||||
|
if plan_code.present?
|
||||||
|
employer_update_attrs.merge!({
|
||||||
|
group_number: plan_code.group_number,
|
||||||
|
effective_date: plan_code.effect_date.strftime("%m/%d/%Y")
|
||||||
|
})
|
||||||
|
setup_update_attrs.merge!({
|
||||||
|
rx_group_number: plan_code.medical_number
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
# id_card_setup = employer.id_card_setup.find_or_create_by(pl_plan_key: employer.pl_plan_key)
|
||||||
|
# employer.name = plan_header['ShortDesc'].strip.titleize
|
||||||
|
# employer.plan_id = plan_header['PlanId'].strip.to_i
|
||||||
|
|
||||||
|
|
||||||
|
# id_card_templates = determine_id_card_templates(employer.pl_plan_key)
|
||||||
|
# employer.single_card_template = id_card_templates[:single_card_template]
|
||||||
|
# employer.multiple_card_template = id_card_templates[:multiple_card_template]
|
||||||
|
|
||||||
|
if full_sync
|
||||||
|
employer_update_attrs.merge!({
|
||||||
|
name: plan_header['ShortDesc'].strip.titleize
|
||||||
|
})
|
||||||
|
setup_update_attrs.merge!({
|
||||||
|
print_name: determine_card_print_name(pb_company_plan.company_pb_entity_key, @pl_plan_key)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
employer.update(employer_update_attrs)
|
||||||
|
# if full_sync
|
||||||
|
# setup_update_attrs.merge!{
|
||||||
|
# print_name: card_print_name
|
||||||
|
# }
|
||||||
|
# end
|
||||||
|
id_card_setup = employer.id_card_setup || employer.create_id_card_setup!(pl_plan_key: employer.pl_plan_key)
|
||||||
|
id_card_setup.update(setup_update_attrs)
|
||||||
|
|
||||||
|
# plan_code = Vhcs::HlPlanCode.find_by(plan_key: employer.pl_plan_key)
|
||||||
|
# employer.group_number = plan_code.group_number
|
||||||
|
# id_card_setup.rx_group_number = plan_code.medical_number
|
||||||
|
# employer.effective_date = plan_code.effect_date.strftime("%m/%d/%Y")
|
||||||
|
|
||||||
|
# pb_company_plan = Vhcs::PbCompanyPlans.find_by(pl_plan_key: employer.pl_plan_key)
|
||||||
|
# employer.company_pb_entity_key = pb_company_plan.company_pb_entity_key
|
||||||
|
|
||||||
|
# card_print_name = Vhcs::PbEntity.where(company_pb_entity_key: employer.company_pb_entity_key, entity_type_id: 1007).last.last_name
|
||||||
|
# id_card_setup.print_name = card_print_name
|
||||||
|
|
||||||
|
# if employer.up_to_date?
|
||||||
|
# employer.active = true
|
||||||
|
# end
|
||||||
|
|
||||||
|
# employer.default_network_logo = determine_network_logos(employer.pl_plan_key)
|
||||||
|
|
||||||
|
# plan_codes = Vhcs::HlEgglestonCardBenefit.where(plan_key: employer.pl_plan_key).pluck(:plan_id).uniq
|
||||||
|
employer_plans = employer.id_card_setup.plans
|
||||||
|
plan_titles = employer_plans.pluck(:title)
|
||||||
|
vhcs_plans = Vhcs::PbProduct.where(company_pb_entity_key: pb_company_plan.company_pb_entity_key, is_active: 255)
|
||||||
|
vhcs_plans.each do |vp|
|
||||||
|
if employer_plans.present? && plan_titles.all?(&:present?) && employer_plans.find_by(pb_product_key: vp.pb_product_key).nil?
|
||||||
|
plan_title_matcher = Amatch::JaroWinkler.new(vp.short_description)
|
||||||
|
closest_title = plan_titles.max_by { |title| plan_title_matcher.match(title) }
|
||||||
|
plan = employer_plans.find_or_create_by(title: closest_title)
|
||||||
|
plan.update(
|
||||||
|
title: vp.short_description,
|
||||||
|
pb_product_key: vp.pb_product_key,
|
||||||
|
pl_plan_key: employer.pl_plan_key
|
||||||
|
)
|
||||||
|
plan_titles.delete(closest_title)
|
||||||
|
elsif employer_plans.blank?
|
||||||
|
employer_plans.create!(
|
||||||
|
pb_product_key: vp.pb_product_key,
|
||||||
|
title: vp.short_description,
|
||||||
|
pl_plan_key: employer.pl_plan_key
|
||||||
|
)
|
||||||
|
# plan.update(
|
||||||
|
# title: vp.short_description,
|
||||||
|
# pl_plan_key: employer.pl_plan_key
|
||||||
|
# )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
employer
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def determine_card_print_name(company_pb_entity_key, pl_plan_key)
|
||||||
|
card_print_names = Vhcs::PbEntity.where(company_pb_entity_key: company_pb_entity_key, entity_type_id: 1007)
|
||||||
|
.where.not("LastName LIKE ? OR LastName LIKE ? OR LastName LIKE ?", "%COBRA%", "Active", ".%").pluck(:last_name)
|
||||||
|
if pl_plan_key == "2"
|
||||||
|
"sm ART"
|
||||||
|
elsif card_print_names.count > 2
|
||||||
|
Employer.employer_trim_name(card_print_names.first)
|
||||||
|
else
|
||||||
|
card_print_names.last
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
class UpdateMemberJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(pb_entity_key, employer_id, has_divisions = false, has_dental = false, vw_mb_member = {})
|
||||||
|
|
||||||
|
unless vw_mb_member.present?
|
||||||
|
vw_mb_member = Vhcs::VwmbMember.find_by(enrollee_type_value_id: 1, pb_entity_key: pb_entity_key).attributes.with_indifferent_access.slice(:mb_member_key, :pb_entity_key, :pl_plan_key, :family_id, :full_name_last_name_first, :social_security_number)
|
||||||
|
end
|
||||||
|
|
||||||
|
pb_products = 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" = ?
|
||||||
|
AND "PBProductParticipation"."InEffect" <= ?
|
||||||
|
AND "PBProductParticipation"."OutOfEffect" > ?',
|
||||||
|
vw_mb_member[:pb_entity_key], 2.month.from_now , 1.day.ago
|
||||||
|
)
|
||||||
|
|
||||||
|
if pb_products.present? && vw_mb_member[:social_security_number].present?
|
||||||
|
member = Member.find_or_create_by!(pb_entity_key: vw_mb_member[:pb_entity_key], employer_id: employer_id)
|
||||||
|
member.name = vw_mb_member[:full_name_last_name_first].titleize
|
||||||
|
member.mb_member_key = vw_mb_member[:mb_member_key]
|
||||||
|
member.family_id = vw_mb_member[:family_id]
|
||||||
|
member.pl_plan_key = vw_mb_member[:pl_plan_key]
|
||||||
|
|
||||||
|
card_display_name = Vhcs::PbEntity.find_by(pb_entity_key: member.pb_entity_key).full_name
|
||||||
|
member.id_card_display_name = card_display_name
|
||||||
|
|
||||||
|
if has_divisions
|
||||||
|
division = Vhcs::PbEntity.joins('
|
||||||
|
INNER JOIN "PBAffiliation" ON "PBAffiliation"."ParentPBEntityKey" = "PBEntity"."PBEntityKey"
|
||||||
|
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."PBAffiliationKey" = "PBAffiliation"."PBAffiliationKey"
|
||||||
|
INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||||
|
').find_by('
|
||||||
|
"PBCoveredEntities"."PBEntityKey" = ?
|
||||||
|
AND "PBProductParticipation"."OutOfEffect" > ?',
|
||||||
|
member.pb_entity_key, 1.day.ago
|
||||||
|
).last_name
|
||||||
|
member.division = division
|
||||||
|
end
|
||||||
|
|
||||||
|
if has_dental
|
||||||
|
medical_pb_product_key = pb_products.where(short_description: "Medical")&.first&.pb_product_key
|
||||||
|
dental_pb_product_key = pb_products.where("ShortDescription LIKE ?", "%Dental%")&.first&.pb_product_key
|
||||||
|
# dental_pb_product_key = pb_products.where(short_description: "Dental")&.first&.pb_product_key
|
||||||
|
if dental_pb_product_key
|
||||||
|
member.dental_plan_key = dental_pb_product_key
|
||||||
|
|
||||||
|
coverage_class = Vhcs::GenLookupTables.joins('
|
||||||
|
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."CoverageTypeCode" = "GEN_LookupTables"."RecordID"
|
||||||
|
INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||||
|
INNER JOIN "PBProductAvailability" ON "PBProductAvailability"."PBProductAvailabilityKey" = "PBProductParticipation"."PBProductAvailabilityKey"
|
||||||
|
INNER JOIN "PBProduct" ON "PBProduct"."PBProductKey" = "PBProductAvailability"."PBProductKey"
|
||||||
|
').find_by('
|
||||||
|
"PBCoveredEntities"."PBEntityKey" = ?
|
||||||
|
AND "PBProductParticipation"."InEffect" <= ?
|
||||||
|
AND "PBProductParticipation"."OutOfEffect" > ?
|
||||||
|
AND "PBProduct"."PBProductKey" = ?',
|
||||||
|
member.pb_entity_key, 1.month.from_now, 1.day.ago, dental_pb_product_key
|
||||||
|
).short_desc
|
||||||
|
member.coverage_class = coverage_class
|
||||||
|
end
|
||||||
|
else
|
||||||
|
medical_pb_product_key = pb_products.first.pb_product_key
|
||||||
|
end
|
||||||
|
if medical_pb_product_key && plan = IdCard::Plan.find_by(pb_product_key: medical_pb_product_key)
|
||||||
|
member.id_card_plan = plan
|
||||||
|
end
|
||||||
|
member.dependents = get_dependent_names_by_sequence(member)
|
||||||
|
# if employer_members_update
|
||||||
|
# member
|
||||||
|
# else
|
||||||
|
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
puts "---- #{member.name}"
|
||||||
|
member.presence
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def get_dependent_names_by_sequence(member)
|
||||||
|
dependents = Vhcs::VwmbMember.joins('
|
||||||
|
INNER JOIN "PBCoveredEntities" ON "PBCoveredEntities"."PBEntityKey" = "vwMBMember"."PBEntityKey"
|
||||||
|
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||||
|
INNER JOIN "PBProductAvailability" ON "PBProductAvailability"."PBProductAvailabilityKey" = "PBProductParticipation"."PBProductAvailabilityKey"
|
||||||
|
INNER JOIN "PBProduct" ON "PBProduct"."PBProductKey" = "PBProductAvailability"."PBProductKey"
|
||||||
|
').where('
|
||||||
|
"EnrolleeTypeKey" != 1044 AND "PLPlanKey" = ? AND "PBProductParticipation"."OutOfEffect" >= ? AND "FamilyID" = ?', member.pl_plan_key, Date.today.strftime("%m/%d/%Y"), member.family_id
|
||||||
|
)
|
||||||
|
if member.pl_plan_key == 3
|
||||||
|
dependents = dependents.where('"PBProduct"."PBProductKey" != 1024')
|
||||||
|
elsif member.pl_plan_key == 2
|
||||||
|
dependents = dependents.where('"PBProduct"."PBProductKey" != 1019')
|
||||||
|
end
|
||||||
|
dependent_names = dependents.order(:sequence_number).map { |dep| dep.first_name + ' ' + dep.last_name}.uniq
|
||||||
|
dependent_names
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class BatchProcess < ApplicationRecord
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,12 +1,36 @@
|
|||||||
module EmployerAutomation
|
module EmployerAutomation
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
# included do
|
included do
|
||||||
# # Code in this block becomes instance methods or class macros (like scopes, validations, associations) in the including class.
|
scope :new_groups, -> {
|
||||||
# scope :visible, -> { where(visible: true) }
|
where(active: false)
|
||||||
# scope :invisible, -> { where(visible: false) }
|
.where.not(pl_plan_key: [nil, ''])
|
||||||
# validates :status, inclusion: { in: %w(visible invisible), message: "%{value} is not a valid status" }
|
}
|
||||||
# end
|
|
||||||
|
scope :with_plans, -> {
|
||||||
|
joins(id_card_setup: :plans).distinct
|
||||||
|
}
|
||||||
|
|
||||||
|
# scope :with_survey_and_no_questions, -> {
|
||||||
|
# joins(:survey) # join has_one
|
||||||
|
# .left_joins(survey: :questions) # join has_many through has_one
|
||||||
|
# .where(questions: { id: nil }) # filter where has_many is empty
|
||||||
|
# }
|
||||||
|
|
||||||
|
scope :missing_keychain_values, -> {
|
||||||
|
new_groups
|
||||||
|
.where(
|
||||||
|
arel_table[:company_pb_entity_key].in([nil, ''])
|
||||||
|
.or(arel_table[:plan_id].in([nil, '']))
|
||||||
|
.or(arel_table[:group_number].in([nil, '']))
|
||||||
|
.or(arel_table[:effective_date].in([nil, '']))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
scope :missing_initial_members, -> {
|
||||||
|
new_groups.with_plans
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
# class_methods do
|
# class_methods do
|
||||||
# # Methods in this block become class methods of the including class.
|
# # Methods in this block become class methods of the including class.
|
||||||
@@ -16,16 +40,20 @@ module EmployerAutomation
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
# Any other methods defined here become instance methods automatically.
|
# Any other methods defined here become instance methods automatically.
|
||||||
def up_to_date?
|
# def up_to_date?
|
||||||
self.pl_plan_key.present? &&
|
# self.pl_plan_key.present? &&
|
||||||
self.company_pb_entity_key.present? &&
|
# self.company_pb_entity_key.present? &&
|
||||||
self.plan_id.present? &&
|
# self.plan_id.present? &&
|
||||||
self.group_number.present? &&
|
# self.group_number.present? &&
|
||||||
self.effect_date.present?
|
# self.effective_date.present?
|
||||||
|
# end
|
||||||
|
|
||||||
|
def sync_members_with_vhcs
|
||||||
|
AutomationService::EmployerMembersUpdate.new(self.pl_plan_key).call
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def sync_with_vhcs
|
def sync_with_vhcs
|
||||||
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active' And PLPlanKey = 57"
|
AutomationService::EmployerUpdate.new(self.pl_plan_key).call
|
||||||
plan_header = VhcsRecord.connection.select_all(sql_query).first
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
module MemberAutomation
|
||||||
|
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.effective_date.present?
|
||||||
|
# end
|
||||||
|
|
||||||
|
def sync_with_vhcs
|
||||||
|
AutomationService::MemberUpdate.new(self.employer.pl_plan_key, self.pb_entity_key).call
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
class Employer < ApplicationRecord
|
class Employer < ApplicationRecord
|
||||||
has_many :members
|
include EmployerAutomation
|
||||||
|
has_many :members, dependent: :destroy
|
||||||
|
accepts_nested_attributes_for :members, allow_destroy: true, reject_if: :all_blank
|
||||||
has_one :id_card_setup, class_name: 'IdCard::Setup', dependent: :destroy
|
has_one :id_card_setup, class_name: 'IdCard::Setup', dependent: :destroy
|
||||||
|
|
||||||
|
|
||||||
scope :active, -> { where(active: true) }
|
scope :active, -> { where(active: true) }
|
||||||
scope :inactive, -> { where(active: false) }
|
scope :inactive, -> { where(active: false) }
|
||||||
|
|
||||||
@@ -9,7 +12,9 @@ class Employer < ApplicationRecord
|
|||||||
|
|
||||||
# before_save :process_employer_logo
|
# before_save :process_employer_logo
|
||||||
# before_save :process_employer_logo, if: :employer_logo_filename_changed?
|
# before_save :process_employer_logo, if: :employer_logo_filename_changed?
|
||||||
before_save :create_slug, if: :new_record?
|
# before_save :create_slug, if: :new_record?
|
||||||
|
before_save :create_slug, if: :will_save_change_to_name?
|
||||||
|
# before_save :set_active_status, unless: :will_save_change_to_active?
|
||||||
# after_save :process_employer_logo, if: :saved_change_to_employer_logo_filename?
|
# after_save :process_employer_logo, if: :saved_change_to_employer_logo_filename?
|
||||||
|
|
||||||
# def process_employer_logo
|
# def process_employer_logo
|
||||||
@@ -35,7 +40,17 @@ class Employer < ApplicationRecord
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
def create_slug
|
def create_slug
|
||||||
self.slug = employer_trim_name(self.name).parameterize
|
self.slug = Employer.employer_trim_name(self.name).parameterize
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_active_status
|
||||||
|
self.active = (
|
||||||
|
self.pl_plan_key.present? &&
|
||||||
|
self.company_pb_entity_key.present? &&
|
||||||
|
self.plan_id.present? &&
|
||||||
|
self.group_number.present? &&
|
||||||
|
self.effective_date.present?
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def id_card_enabled?
|
def id_card_enabled?
|
||||||
@@ -54,12 +69,12 @@ class Employer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def name_to_logo_filename(extension)
|
def name_to_logo_filename(extension)
|
||||||
self.employer_trim_name(self.name).titleize.gsub(/[^a-zA-Z]/, '').concat('Logo').concat(extension.downcase)
|
Employer.employer_trim_name(self.name).titleize.gsub(/[^a-zA-Z]/, '').concat('Logo').concat(extension.downcase)
|
||||||
end
|
end
|
||||||
|
|
||||||
def employer_trim_name(name = nil)
|
def self.employer_trim_name(employer_name)
|
||||||
employer_name = name.present? ? name : self.name
|
# employer_name = name.present? ? name : self.name
|
||||||
regex_source = Regexp.union(["health ", "plan", "the", "inc", "llc"]).source
|
regex_source = Regexp.union(["health ", "plan", "the", "inc", "llc", "group"]).source
|
||||||
case_insensitive_regex = Regexp.new(regex_source, "i")
|
case_insensitive_regex = Regexp.new(regex_source, "i")
|
||||||
employer_name.gsub(case_insensitive_regex, "").gsub(/[^[:alpha:][:space:]]/, "").squish
|
employer_name.gsub(case_insensitive_regex, "").gsub(/[^[:alpha:][:space:]]/, "").squish
|
||||||
end
|
end
|
||||||
@@ -82,21 +97,20 @@ class Employer < ApplicationRecord
|
|||||||
medical_number: self.group_number,
|
medical_number: self.group_number,
|
||||||
dental_number: '',
|
dental_number: '',
|
||||||
plan_key: self.pl_plan_key,
|
plan_key: self.pl_plan_key,
|
||||||
effect_date: self.effective_date
|
effect_date: DateTime.strptime(self.effective_date, "%m/%d/%y")
|
||||||
)
|
)
|
||||||
|
|
||||||
# Replace fairos_info with template like for benefits
|
rx_info = self.id_card_setup.rx_section
|
||||||
fairos_info = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
|
|
||||||
Vhcs::HlrxCrosRef.create!(
|
Vhcs::HlrxCrosRef.create!(
|
||||||
group_no: self.group_number,
|
group_no: self.group_number,
|
||||||
rx_group_id: self.group_number,
|
rx_group_id: self.group_number,
|
||||||
help_desk: fairos_info.help_desk,
|
help_desk: rx_info.help_desk,
|
||||||
customer_service: fairos_info.customer_service,
|
customer_service: rx_info.customer_service,
|
||||||
web_url: fairos_info.web_url,
|
web_url: rx_info.web_url,
|
||||||
pl_plan_key: self.pl_plan_key
|
pl_plan_key: self.pl_plan_key
|
||||||
)
|
)
|
||||||
|
|
||||||
self.plans.each_with_index do |plan, i|
|
self.id_card_setup.plans.each_with_index do |plan, i|
|
||||||
plan.plan_benefits.each do |bene|
|
plan.plan_benefits.each do |bene|
|
||||||
Vhcs::HlEgglestonCardBenefit.create!(
|
Vhcs::HlEgglestonCardBenefit.create!(
|
||||||
plan_id: plan.pb_product_key,
|
plan_id: plan.pb_product_key,
|
||||||
|
|||||||
@@ -1,16 +1,50 @@
|
|||||||
module IdCard
|
module IdCard
|
||||||
class EmployerLogo < ApplicationRecord
|
class EmployerLogo < ApplicationRecord
|
||||||
before_validation :calculate_aspect_ratio, if: :image_data_changed?
|
# before_validation :resize_logo, if: :image_data_changed?
|
||||||
|
# before_validation :calculate_aspect_ratio, if: :image_data_changed?
|
||||||
|
before_validation :process_image, if: :image_data_changed?
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def calculate_aspect_ratio
|
def process_image
|
||||||
image_io = StringIO.new(self.image_data)
|
image = Vips::Image.new_from_buffer(self.image_data, "")
|
||||||
width, height = FastImage.size(image_io)
|
|
||||||
image_ratio = width.to_f / height
|
resized_image = ImageProcessing::Vips
|
||||||
|
.source(image)
|
||||||
|
.resize_to_limit(nil, 400)
|
||||||
|
|
||||||
|
processed_image = resized_image.convert("png").call
|
||||||
|
new_image_data = processed_image.read
|
||||||
|
if new_image_data
|
||||||
|
self.image_data = new_image_data
|
||||||
|
self.filename = File.basename(self.filename, File.extname(self.filename)) + ".png"
|
||||||
|
self.content_type = "image/png"
|
||||||
|
end
|
||||||
|
|
||||||
|
image_ratio = image.width.to_f / image.height
|
||||||
if image_ratio
|
if image_ratio
|
||||||
self.aspect_ratio = image_ratio.round(2)
|
self.aspect_ratio = image_ratio.round(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# def resize_logo
|
||||||
|
# image = Vips::Image.new_from_buffer(self.image_data, "")
|
||||||
|
|
||||||
|
# processed_image = ImageProcessing::Vips
|
||||||
|
# .source(image)
|
||||||
|
# .resize_to_limit(nil, 200)
|
||||||
|
# .call
|
||||||
|
|
||||||
|
# self.image_data = processed_image.read
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def calculate_aspect_ratio
|
||||||
|
# image_io = StringIO.new(self.image_data)
|
||||||
|
# width, height = FastImage.size(image_io)
|
||||||
|
# image_ratio = width.to_f / height
|
||||||
|
# if image_ratio
|
||||||
|
# self.aspect_ratio = image_ratio.round(2)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,19 +4,27 @@ module IdCard
|
|||||||
has_many :field_exception_items, dependent: :destroy
|
has_many :field_exception_items, dependent: :destroy
|
||||||
accepts_nested_attributes_for :field_exception_items, allow_destroy: true, reject_if: :all_blank
|
accepts_nested_attributes_for :field_exception_items, allow_destroy: true, reject_if: :all_blank
|
||||||
|
|
||||||
VALID_TYPES = ['zipcode', 'state', 'family_id']
|
serialize :exception_values, coder: JSON
|
||||||
|
|
||||||
|
VALID_TYPES = ['family_id', 'zipcode', 'state'].freeze
|
||||||
|
|
||||||
|
before_validation :format_exception_values, if: :exception_values_changed?
|
||||||
|
|
||||||
validates :exception_type, inclusion: { in: VALID_TYPES,
|
validates :exception_type, inclusion: { in: VALID_TYPES,
|
||||||
message: "%{value} is not a valid exception type" }
|
message: "%{value} is not a valid exception type" }
|
||||||
|
|
||||||
|
|
||||||
|
def to_card_attrs
|
||||||
|
self.field_exception_items.map(&:card_attrs).reduce({}, :merge)
|
||||||
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
def permitted_params(params)
|
def permitted_params(params)
|
||||||
params.require(:id_card_setup).permit(
|
params.require(:id_card_setup).permit(
|
||||||
field_exceptions_attributes: [
|
field_exceptions_attributes: [
|
||||||
:exception_type,
|
:exception_type,
|
||||||
:exception_value,
|
:exception_values,
|
||||||
:_destroy,
|
:_destroy,
|
||||||
field_exception_items_attributes: [
|
field_exception_items_attributes: [
|
||||||
:field_name,
|
:field_name,
|
||||||
@@ -31,5 +39,13 @@ module IdCard
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def format_exception_values
|
||||||
|
if self.exception_values.is_a?(String)
|
||||||
|
self.exception_values = self.exception_values.split(",").map(&:strip)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,14 +6,30 @@ module IdCard
|
|||||||
|
|
||||||
validate :only_one_exception_field_present
|
validate :only_one_exception_field_present
|
||||||
|
|
||||||
FIELDS_TO_VALIDATE = [:field_value, :card_logo_file_id, :card_provider_id].freeze
|
FIELDS_TO_VALIDATE = [:field_value, :network_logo_id, :provider_section_id].freeze
|
||||||
|
|
||||||
VALID_FIELD_NAMES = ['network_logo', 'provider_section', 'effective_date']
|
VALID_FIELD_NAMES = ['network_logo', 'provider_section', 'medical_eff_date']
|
||||||
|
|
||||||
validates :field_name, inclusion: { in: VALID_FIELD_NAMES,
|
validates :field_name, inclusion: { in: VALID_FIELD_NAMES,
|
||||||
message: "%{value} is not a valid Id Card Field Name" }
|
message: "%{value} is not a valid Id Card Field Name" }
|
||||||
|
|
||||||
|
|
||||||
|
def card_attrs
|
||||||
|
case self.field_name
|
||||||
|
when "network_logo"
|
||||||
|
{"network_logo_filename" => IdCard::NetworkLogo.find(self.network_logo_id).filename}
|
||||||
|
when "provider_section"
|
||||||
|
IdCard::ProviderSection.find(self.provider_section_id).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
|
||||||
|
)
|
||||||
|
when "medical_eff_date"
|
||||||
|
{"medical_eff_date" => self.field_value}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def only_one_exception_field_present
|
def only_one_exception_field_present
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
module IdCard
|
module IdCard
|
||||||
class NetworkLogo < ApplicationRecord
|
class NetworkLogo < ApplicationRecord
|
||||||
before_validation :calculate_aspect_ratio, if: :image_data_changed?
|
# before_validation :resize_logo, if: :image_data_changed?
|
||||||
|
# before_validation :calculate_aspect_ratio, if: :image_data_changed?
|
||||||
|
before_validation :process_image, if: :image_data_changed?
|
||||||
|
|
||||||
scope :defaults, -> { where(default: true) }
|
scope :defaults, -> { where(default: true) }
|
||||||
|
|
||||||
@@ -18,14 +20,46 @@ module IdCard
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def calculate_aspect_ratio
|
def process_image
|
||||||
image_io = StringIO.new(image_data)
|
image = Vips::Image.new_from_buffer(self.image_data, "")
|
||||||
width, height = FastImage.size(image_io)
|
|
||||||
image_ratio = width.to_f / height
|
resized_image = ImageProcessing::Vips
|
||||||
|
.source(image)
|
||||||
|
.resize_to_limit(nil, 400)
|
||||||
|
|
||||||
|
processed_image = resized_image.convert("png").call
|
||||||
|
new_image_data = processed_image.read
|
||||||
|
if new_image_data
|
||||||
|
self.image_data = new_image_data
|
||||||
|
self.filename = File.basename(self.filename, File.extname(self.filename)) + ".png"
|
||||||
|
self.content_type = "image/png"
|
||||||
|
end
|
||||||
|
|
||||||
|
image_ratio = image.width.to_f / image.height
|
||||||
if image_ratio
|
if image_ratio
|
||||||
self.aspect_ratio = image_ratio.round(2)
|
self.aspect_ratio = image_ratio.round(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# def resize_logo
|
||||||
|
# image = Vips::Image.new_from_buffer(self.image_data, "")
|
||||||
|
|
||||||
|
# processed_image = ImageProcessing::Vips
|
||||||
|
# .source(image)
|
||||||
|
# .resize_to_limit(nil, 400)
|
||||||
|
# .call
|
||||||
|
|
||||||
|
# self.image_data = processed_image.read
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def calculate_aspect_ratio
|
||||||
|
# image_io = StringIO.new(image_data)
|
||||||
|
# width, height = FastImage.size(image_io)
|
||||||
|
# image_ratio = width.to_f / height
|
||||||
|
# if image_ratio
|
||||||
|
# self.aspect_ratio = image_ratio.round(2)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
module IdCard
|
module IdCard
|
||||||
class PrintData < ApplicationRecord
|
class PrintData < ApplicationRecord
|
||||||
|
|
||||||
STRING_ATTRIBUTES = %w[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 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 dependent_1 dependent_2 dependent_3 dependent_4 dependent_5 dependent_6 dependent_7 dependent_8]
|
STRING_ATTRIBUTES = %w[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 dependent_1 dependent_2 dependent_3 dependent_4 dependent_5 dependent_6 dependent_7 dependent_8 dental_coverage]
|
||||||
|
|
||||||
before_validation :assign_blank_strings_to_unassigned_params
|
before_validation :assign_blank_strings_to_unassigned_params
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,45 @@ module IdCard
|
|||||||
self.field_exceptions.present?
|
self.field_exceptions.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def field_exceptions_card_attributes_by_member_id(member_array = nil)
|
||||||
|
unless member_array.present?
|
||||||
|
member_array = self.employer.members.pluck(:pb_entity_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
card_fes = self.field_exceptions.includes(:field_exception_items).in_order_of(:exception_type, IdCard::FieldException::VALID_TYPES)
|
||||||
|
# fe_by_value = card_fes.in_order_of(:exception_type, IdCard::FieldException::VALID_TYPES).group_by(&:exception_type)
|
||||||
|
# .transform_values { |fes| fes.map { |fe| [fe.id, fe.exception_values] }.to_h }
|
||||||
|
# .compact_blank
|
||||||
|
|
||||||
|
# field_exception_types = card_fes.pluck(:exception_type).uniq
|
||||||
|
# if field_exception_types.include?("family_id")
|
||||||
|
# members = Member.where(pb_entity_key: member_array)
|
||||||
|
# end
|
||||||
|
# if field_exception_types.intersect?(["state", "zipcode"])
|
||||||
|
# member_addresses = Vhcs::PbEntityAddress.where(pb_entity_key: member_array)
|
||||||
|
# end
|
||||||
|
card_exceptions_map = {}
|
||||||
|
card_fes.each do |fe|
|
||||||
|
if fe.exception_type == "family_id"
|
||||||
|
matches = Member.where(pb_entity_key: member_array, family_id: fe.exception_values).pluck(:pb_entity_key)
|
||||||
|
elsif fe.exception_type == "zipcode"
|
||||||
|
matches = Vhcs::PbEntityAddress.where(pb_entity_key: member_array, zip: fe.exception_values).pluck(:pb_entity_key)
|
||||||
|
elsif fe.exception_type == "state"
|
||||||
|
matches = Vhcs::PbEntityAddress.where(pb_entity_key: member_array, state: fe.exception_values).pluck(:pb_entity_key)
|
||||||
|
end
|
||||||
|
if matches.present?
|
||||||
|
card_exceptions_map[fe.id] = fe.to_card_attrs
|
||||||
|
matches.each do |match|
|
||||||
|
unless card_exceptions_map[match].present?
|
||||||
|
card_exceptions_map[match] = fe.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
card_exceptions_map
|
||||||
|
end
|
||||||
|
|
||||||
def self.permitted_params(params)
|
def self.permitted_params(params)
|
||||||
params.require(:id_card_setup).permit(
|
params.require(:id_card_setup).permit(
|
||||||
:print_name,
|
:print_name,
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
class Member < ApplicationRecord
|
class Member < ApplicationRecord
|
||||||
|
include MemberAutomation
|
||||||
belongs_to :id_card_plan, class_name: 'IdCard::Plan', optional: true
|
belongs_to :id_card_plan, class_name: 'IdCard::Plan', optional: true
|
||||||
belongs_to :employer
|
belongs_to :employer
|
||||||
|
|
||||||
|
serialize :dependents, coder: JSON
|
||||||
|
before_validation :format_dependents, if: :dependents_changed?
|
||||||
|
|
||||||
def id_card_field_exception_values
|
def id_card_field_exception_values
|
||||||
address = Vhcs::PbEntityAddress.find_by(pb_entity_key: self.pb_entity_key)
|
address = Vhcs::PbEntityAddress.find_by(pb_entity_key: self.pb_entity_key)
|
||||||
{
|
{
|
||||||
@@ -11,6 +15,14 @@ class Member < ApplicationRecord
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def format_dependents
|
||||||
|
if self.dependents.is_a?(String)
|
||||||
|
self.dependents = self.dependents.split(",").map(&:strip)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
module Report
|
||||||
|
def self.table_name_prefix
|
||||||
|
"report_"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
class Report::ComparisonError < ApplicationRecord
|
||||||
|
belongs_to :employer_card_comparison, optional: true
|
||||||
|
belongs_to :member_card_comparison, optional: true
|
||||||
|
end
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
module Report
|
||||||
|
class EmployerCardComparison < ApplicationRecord
|
||||||
|
has_many :comparison_errors, dependent: :destroy
|
||||||
|
accepts_nested_attributes_for :comparison_errors, allow_destroy: true, reject_if: :all_blank
|
||||||
|
|
||||||
|
has_many :member_card_comparisons
|
||||||
|
has_many :member_comparison_errors, through: :member_card_comparisons, source: :comparison_errors
|
||||||
|
|
||||||
|
|
||||||
|
def employer_total_errors
|
||||||
|
self.comparison_errors.count + self.member_comparison_errors.count
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
module Report
|
||||||
|
class MemberCardComparison < ApplicationRecord
|
||||||
|
has_many :comparison_errors, dependent: :destroy
|
||||||
|
accepts_nested_attributes_for :comparison_errors, allow_destroy: true, reject_if: :all_blank
|
||||||
|
|
||||||
|
belongs_to :employer_card_comparison, optional: true
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
class Report::OldCardDuplicate < ApplicationRecord
|
||||||
|
end
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
module Vhcs
|
||||||
|
class GenLookupTables < VhcsRecord
|
||||||
|
|
||||||
|
self.table_name = 'GEN_LookupTables'
|
||||||
|
|
||||||
|
alias_attribute :record_id, :RecordID
|
||||||
|
alias_attribute :table_id, :TableID
|
||||||
|
alias_attribute :value_id, :ValueID
|
||||||
|
alias_attribute :company_pb_entity_key, :CompanyPBEntityKey
|
||||||
|
alias_attribute :short_desc, :ShortDesc
|
||||||
|
alias_attribute :long_desc, :LongDesc
|
||||||
|
alias_attribute :is_active, :IsActive
|
||||||
|
alias_attribute :is_default, :IsDefault
|
||||||
|
alias_attribute :is_bit_flag, :IsBitFlag
|
||||||
|
alias_attribute :is_company_specific, :IsCompanySpecific
|
||||||
|
alias_attribute :is_editable, :IsEditable
|
||||||
|
alias_attribute :long_description, :LongDescription
|
||||||
|
alias_attribute :sort_value, :SortValue
|
||||||
|
alias_attribute :system_id_bit_mask, :SystemIDBitMask
|
||||||
|
|
||||||
|
def attributes
|
||||||
|
rails_like = {
|
||||||
|
record_id: self.record_id,
|
||||||
|
table_id: self.table_id,
|
||||||
|
value_id: self.value_id,
|
||||||
|
company_pb_entity_key: self.company_pb_entity_key,
|
||||||
|
short_desc: self.short_desc,
|
||||||
|
long_desc: self.long_desc,
|
||||||
|
is_active: self.is_active,
|
||||||
|
is_default: self.is_default,
|
||||||
|
is_bit_flag: self.is_bit_flag,
|
||||||
|
is_company_specific: self.is_company_specific,
|
||||||
|
is_editable: self.is_editable,
|
||||||
|
long_description: self.long_description,
|
||||||
|
sort_value: self.sort_value,
|
||||||
|
system_id_bit_mask: self.system_id_bit_mask,
|
||||||
|
}
|
||||||
|
super.merge(rails_like)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -5,12 +5,12 @@ module Vhcs
|
|||||||
|
|
||||||
alias_attribute :id, :ID
|
alias_attribute :id, :ID
|
||||||
alias_attribute :facility, :Facility
|
alias_attribute :facility, :Facility
|
||||||
alias_attribute :division, :Division
|
alias_attribute :employer_name, :Division
|
||||||
alias_attribute :full_name, :FullName
|
alias_attribute :full_name, :FullName
|
||||||
alias_attribute :ssn, :SSN
|
alias_attribute :ssn, :SSN
|
||||||
alias_attribute :medical_coverage, :MedicalCoverage
|
alias_attribute :medical_coverage, :MedicalCoverage
|
||||||
alias_attribute :medical_eff_date, :MedicalEffDate
|
alias_attribute :medical_eff_date, :MedicalEffDate
|
||||||
alias_attribute :medical_group_num, :MedicalGroupNum
|
alias_attribute :group_number, :MedicalGroupNum
|
||||||
alias_attribute :dental_coverage, :DentalCoverage
|
alias_attribute :dental_coverage, :DentalCoverage
|
||||||
alias_attribute :dental_eff_date, :DentalEffDate
|
alias_attribute :dental_eff_date, :DentalEffDate
|
||||||
alias_attribute :dental_group_num, :DentalGroupNum
|
alias_attribute :dental_group_num, :DentalGroupNum
|
||||||
@@ -25,8 +25,8 @@ module Vhcs
|
|||||||
alias_attribute :provider_line_7, :ProviderLine7
|
alias_attribute :provider_line_7, :ProviderLine7
|
||||||
alias_attribute :provider_line_8, :ProviderLine8
|
alias_attribute :provider_line_8, :ProviderLine8
|
||||||
alias_attribute :provider_line_9, :ProviderLine9
|
alias_attribute :provider_line_9, :ProviderLine9
|
||||||
alias_attribute :provider_line_1_0, :ProviderLine10
|
alias_attribute :provider_line_10, :ProviderLine10
|
||||||
alias_attribute :provider_line_1_1, :ProviderLine11
|
alias_attribute :provider_line_11, :ProviderLine11
|
||||||
alias_attribute :mail_to, :MailTo
|
alias_attribute :mail_to, :MailTo
|
||||||
alias_attribute :mail_to_2, :MailTo2
|
alias_attribute :mail_to_2, :MailTo2
|
||||||
alias_attribute :claim_to_1, :ClaimTo1
|
alias_attribute :claim_to_1, :ClaimTo1
|
||||||
@@ -38,15 +38,15 @@ module Vhcs
|
|||||||
alias_attribute :claim_to_7, :ClaimTo7
|
alias_attribute :claim_to_7, :ClaimTo7
|
||||||
alias_attribute :claim_to_8, :ClaimTo8
|
alias_attribute :claim_to_8, :ClaimTo8
|
||||||
alias_attribute :claim_to_9, :ClaimTo9
|
alias_attribute :claim_to_9, :ClaimTo9
|
||||||
alias_attribute :claim_to_1_0, :ClaimTo10
|
alias_attribute :claim_to_10, :ClaimTo10
|
||||||
alias_attribute :claim_to_1_1, :ClaimTo11
|
alias_attribute :claim_to_11, :ClaimTo11
|
||||||
alias_attribute :contact_line_1, :ContactLine1
|
alias_attribute :contact_line_1, :ContactLine1
|
||||||
alias_attribute :contact_line_2, :ContactLine2
|
alias_attribute :contact_line_2, :ContactLine2
|
||||||
alias_attribute :contact_line_3, :ContactLine3
|
alias_attribute :contact_line_3, :ContactLine3
|
||||||
alias_attribute :group_number, :GroupNumber
|
alias_attribute :group_number, :GroupNumber
|
||||||
alias_attribute :family_id, :FamilyId
|
alias_attribute :family_id, :FamilyId
|
||||||
alias_attribute :group_no, :GroupNo
|
alias_attribute :group_no, :GroupNo
|
||||||
alias_attribute :rx_group_id, :RXGroupID
|
alias_attribute :rx_group, :RXGroupID
|
||||||
alias_attribute :help_desk, :HelpDesk
|
alias_attribute :help_desk, :HelpDesk
|
||||||
alias_attribute :customer_service, :CustomerService
|
alias_attribute :customer_service, :CustomerService
|
||||||
alias_attribute :web_url, :WebUrl
|
alias_attribute :web_url, :WebUrl
|
||||||
@@ -60,34 +60,34 @@ module Vhcs
|
|||||||
alias_attribute :dependent_6, :Dependent6
|
alias_attribute :dependent_6, :Dependent6
|
||||||
alias_attribute :dependent_7, :Dependent7
|
alias_attribute :dependent_7, :Dependent7
|
||||||
alias_attribute :dependent_8, :Dependent8
|
alias_attribute :dependent_8, :Dependent8
|
||||||
alias_attribute :ben_desc_1, :BenDesc1
|
alias_attribute :benefit_desc_1, :BenDesc1
|
||||||
alias_attribute :ben_1, :Ben1
|
alias_attribute :benefit_1, :Ben1
|
||||||
alias_attribute :ben_desc_2, :BenDesc2
|
alias_attribute :benefit_desc_2, :BenDesc2
|
||||||
alias_attribute :ben_2, :Ben2
|
alias_attribute :benefit_2, :Ben2
|
||||||
alias_attribute :ben_desc_3, :BenDesc3
|
alias_attribute :benefit_desc_3, :BenDesc3
|
||||||
alias_attribute :ben_3, :Ben3
|
alias_attribute :benefit_3, :Ben3
|
||||||
alias_attribute :ben_desc_4, :BenDesc4
|
alias_attribute :benefit_desc_4, :BenDesc4
|
||||||
alias_attribute :ben_4, :Ben4
|
alias_attribute :benefit_4, :Ben4
|
||||||
alias_attribute :ben_desc_5, :BenDesc5
|
alias_attribute :benefit_desc_5, :BenDesc5
|
||||||
alias_attribute :ben_5, :Ben5
|
alias_attribute :benefit_5, :Ben5
|
||||||
alias_attribute :ben_desc_6, :BenDesc6
|
alias_attribute :benefit_desc_6, :BenDesc6
|
||||||
alias_attribute :ben_6, :Ben6
|
alias_attribute :benefit_6, :Ben6
|
||||||
alias_attribute :ben_desc_7, :BenDesc7
|
alias_attribute :benefit_desc_7, :BenDesc7
|
||||||
alias_attribute :ben_7, :Ben7
|
alias_attribute :benefit_7, :Ben7
|
||||||
alias_attribute :ben_desc_8, :BenDesc8
|
alias_attribute :benefit_desc_8, :BenDesc8
|
||||||
alias_attribute :ben_8, :Ben8
|
alias_attribute :benefit_8, :Ben8
|
||||||
alias_attribute :ben_desc_9, :BenDesc9
|
alias_attribute :benefit_desc_9, :BenDesc9
|
||||||
alias_attribute :ben_9, :Ben9
|
alias_attribute :benefit_9, :Ben9
|
||||||
alias_attribute :ben_desc_1_0, :BenDesc10
|
alias_attribute :benefit_desc_10, :BenDesc10
|
||||||
alias_attribute :ben_1_0, :Ben10
|
alias_attribute :benefit_10, :Ben10
|
||||||
alias_attribute :ben_desc_1_1, :BenDesc11
|
alias_attribute :benefit_desc_11, :BenDesc11
|
||||||
alias_attribute :ben_1_1, :Ben11
|
alias_attribute :benefit_11, :Ben11
|
||||||
alias_attribute :ben_desc_1_2, :BenDesc12
|
alias_attribute :benefit_desc_12, :BenDesc12
|
||||||
alias_attribute :ben_1_2, :Ben12
|
alias_attribute :benefit_12, :Ben12
|
||||||
alias_attribute :ben_desc_1_3, :BenDesc13
|
alias_attribute :benefit_desc_13, :BenDesc13
|
||||||
alias_attribute :ben_1_3, :Ben13
|
alias_attribute :benefit_13, :Ben13
|
||||||
alias_attribute :ben_desc_1_4, :BenDesc14
|
alias_attribute :benefit_desc_14, :BenDesc14
|
||||||
alias_attribute :ben_1_4, :Ben14
|
alias_attribute :benefit_14, :Ben14
|
||||||
alias_attribute :pl_plan_key, :PLPlanKey
|
alias_attribute :pl_plan_key, :PLPlanKey
|
||||||
alias_attribute :primary_mb_member_key, :PrimaryMBMemberKey
|
alias_attribute :primary_mb_member_key, :PrimaryMBMemberKey
|
||||||
alias_attribute :ppo_lookup_1, :PPOLookup1
|
alias_attribute :ppo_lookup_1, :PPOLookup1
|
||||||
@@ -103,19 +103,19 @@ module Vhcs
|
|||||||
alias_attribute :ppo_data_2, :PPOData2
|
alias_attribute :ppo_data_2, :PPOData2
|
||||||
alias_attribute :ppo_data_3, :PPOData3
|
alias_attribute :ppo_data_3, :PPOData3
|
||||||
alias_attribute :last_name, :LastName
|
alias_attribute :last_name, :LastName
|
||||||
alias_attribute :provider_line_1_2, :ProviderLine12
|
alias_attribute :provider_line_12, :ProviderLine12
|
||||||
alias_attribute :claim_to_1_2, :ClaimTo12
|
alias_attribute :claim_to_12, :ClaimTo12
|
||||||
|
|
||||||
def attributes
|
def attributes
|
||||||
rails_like = {
|
rails_like = {
|
||||||
id: self.id,
|
id: self.id,
|
||||||
facility: self.facility,
|
facility: self.facility,
|
||||||
division: self.division,
|
employer_name: self.employer_name,
|
||||||
full_name: self.full_name,
|
full_name: self.full_name,
|
||||||
ssn: self.ssn,
|
ssn: self.ssn,
|
||||||
medical_coverage: self.medical_coverage,
|
medical_coverage: self.medical_coverage,
|
||||||
medical_eff_date: self.medical_eff_date,
|
medical_eff_date: self.medical_eff_date,
|
||||||
medical_group_num: self.medical_group_num,
|
group_number: self.group_number,
|
||||||
dental_coverage: self.dental_coverage,
|
dental_coverage: self.dental_coverage,
|
||||||
dental_eff_date: self.dental_eff_date,
|
dental_eff_date: self.dental_eff_date,
|
||||||
dental_group_num: self.dental_group_num,
|
dental_group_num: self.dental_group_num,
|
||||||
@@ -130,8 +130,8 @@ module Vhcs
|
|||||||
provider_line_7: self.provider_line_7,
|
provider_line_7: self.provider_line_7,
|
||||||
provider_line_8: self.provider_line_8,
|
provider_line_8: self.provider_line_8,
|
||||||
provider_line_9: self.provider_line_9,
|
provider_line_9: self.provider_line_9,
|
||||||
provider_line_1_0: self.provider_line_1_0,
|
provider_line_10: self.provider_line_10,
|
||||||
provider_line_1_1: self.provider_line_1_1,
|
provider_line_11: self.provider_line_11,
|
||||||
mail_to: self.mail_to,
|
mail_to: self.mail_to,
|
||||||
mail_to_2: self.mail_to_2,
|
mail_to_2: self.mail_to_2,
|
||||||
claim_to_1: self.claim_to_1,
|
claim_to_1: self.claim_to_1,
|
||||||
@@ -143,15 +143,15 @@ module Vhcs
|
|||||||
claim_to_7: self.claim_to_7,
|
claim_to_7: self.claim_to_7,
|
||||||
claim_to_8: self.claim_to_8,
|
claim_to_8: self.claim_to_8,
|
||||||
claim_to_9: self.claim_to_9,
|
claim_to_9: self.claim_to_9,
|
||||||
claim_to_1_0: self.claim_to_1_0,
|
claim_to_10: self.claim_to_10,
|
||||||
claim_to_1_1: self.claim_to_1_1,
|
claim_to_11: self.claim_to_11,
|
||||||
contact_line_1: self.contact_line_1,
|
contact_line_1: self.contact_line_1,
|
||||||
contact_line_2: self.contact_line_2,
|
contact_line_2: self.contact_line_2,
|
||||||
contact_line_3: self.contact_line_3,
|
contact_line_3: self.contact_line_3,
|
||||||
group_number: self.group_number,
|
group_number: self.group_number,
|
||||||
family_id: self.family_id,
|
family_id: self.family_id,
|
||||||
group_no: self.group_no,
|
group_no: self.group_no,
|
||||||
rx_group_id: self.rx_group_id,
|
rx_group: self.rx_group,
|
||||||
help_desk: self.help_desk,
|
help_desk: self.help_desk,
|
||||||
customer_service: self.customer_service,
|
customer_service: self.customer_service,
|
||||||
web_url: self.web_url,
|
web_url: self.web_url,
|
||||||
@@ -165,34 +165,34 @@ module Vhcs
|
|||||||
dependent_6: self.dependent_6,
|
dependent_6: self.dependent_6,
|
||||||
dependent_7: self.dependent_7,
|
dependent_7: self.dependent_7,
|
||||||
dependent_8: self.dependent_8,
|
dependent_8: self.dependent_8,
|
||||||
ben_desc_1: self.ben_desc_1,
|
benefit_desc_1: self.benefit_desc_1,
|
||||||
ben_1: self.ben_1,
|
benefit_1: self.benefit_1,
|
||||||
ben_desc_2: self.ben_desc_2,
|
benefit_desc_2: self.benefit_desc_2,
|
||||||
ben_2: self.ben_2,
|
benefit_2: self.benefit_2,
|
||||||
ben_desc_3: self.ben_desc_3,
|
benefit_desc_3: self.benefit_desc_3,
|
||||||
ben_3: self.ben_3,
|
benefit_3: self.benefit_3,
|
||||||
ben_desc_4: self.ben_desc_4,
|
benefit_desc_4: self.benefit_desc_4,
|
||||||
ben_4: self.ben_4,
|
benefit_4: self.benefit_4,
|
||||||
ben_desc_5: self.ben_desc_5,
|
benefit_desc_5: self.benefit_desc_5,
|
||||||
ben_5: self.ben_5,
|
benefit_5: self.benefit_5,
|
||||||
ben_desc_6: self.ben_desc_6,
|
benefit_desc_6: self.benefit_desc_6,
|
||||||
ben_6: self.ben_6,
|
benefit_6: self.benefit_6,
|
||||||
ben_desc_7: self.ben_desc_7,
|
benefit_desc_7: self.benefit_desc_7,
|
||||||
ben_7: self.ben_7,
|
benefit_7: self.benefit_7,
|
||||||
ben_desc_8: self.ben_desc_8,
|
benefit_desc_8: self.benefit_desc_8,
|
||||||
ben_8: self.ben_8,
|
benefit_8: self.benefit_8,
|
||||||
ben_desc_9: self.ben_desc_9,
|
benefit_desc_9: self.benefit_desc_9,
|
||||||
ben_9: self.ben_9,
|
benefit_9: self.benefit_9,
|
||||||
ben_desc_1_0: self.ben_desc_1_0,
|
benefit_desc_10: self.benefit_desc_10,
|
||||||
ben_1_0: self.ben_1_0,
|
benefit_10: self.benefit_10,
|
||||||
ben_desc_1_1: self.ben_desc_1_1,
|
benefit_desc_11: self.benefit_desc_11,
|
||||||
ben_1_1: self.ben_1_1,
|
benefit_11: self.benefit_11,
|
||||||
ben_desc_1_2: self.ben_desc_1_2,
|
benefit_desc_12: self.benefit_desc_12,
|
||||||
ben_1_2: self.ben_1_2,
|
benefit_12: self.benefit_12,
|
||||||
ben_desc_1_3: self.ben_desc_1_3,
|
benefit_desc_13: self.benefit_desc_13,
|
||||||
ben_1_3: self.ben_1_3,
|
benefit_13: self.benefit_13,
|
||||||
ben_desc_1_4: self.ben_desc_1_4,
|
benefit_desc_14: self.benefit_desc_14,
|
||||||
ben_1_4: self.ben_1_4,
|
benefit_14: self.benefit_14,
|
||||||
pl_plan_key: self.pl_plan_key,
|
pl_plan_key: self.pl_plan_key,
|
||||||
primary_mb_member_key: self.primary_mb_member_key,
|
primary_mb_member_key: self.primary_mb_member_key,
|
||||||
ppo_lookup_1: self.ppo_lookup_1,
|
ppo_lookup_1: self.ppo_lookup_1,
|
||||||
@@ -208,8 +208,8 @@ module Vhcs
|
|||||||
ppo_data_2: self.ppo_data_2,
|
ppo_data_2: self.ppo_data_2,
|
||||||
ppo_data_3: self.ppo_data_3,
|
ppo_data_3: self.ppo_data_3,
|
||||||
last_name: self.last_name,
|
last_name: self.last_name,
|
||||||
provider_line_1_2: self.provider_line_1_2,
|
provider_line_12: self.provider_line_12,
|
||||||
claim_to_1_2: self.claim_to_1_2,
|
claim_to_12: self.claim_to_12,
|
||||||
}
|
}
|
||||||
super.merge(rails_like)
|
super.merge(rails_like)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,217 @@
|
|||||||
|
module Vhcs
|
||||||
|
class HlidCardsViewEgg < VhcsRecord
|
||||||
|
|
||||||
|
self.table_name = 'HLIDCardsViewEgg'
|
||||||
|
|
||||||
|
alias_attribute :facility, :Facility
|
||||||
|
alias_attribute :division, :Division
|
||||||
|
alias_attribute :full_name, :FullName
|
||||||
|
alias_attribute :ssn, :SSN
|
||||||
|
alias_attribute :medical_coverage, :MedicalCoverage
|
||||||
|
alias_attribute :medical_eff_date, :MedicalEffDate
|
||||||
|
alias_attribute :medical_group_num, :MedicalGroupNum
|
||||||
|
alias_attribute :dental_coverage, :DentalCoverage
|
||||||
|
alias_attribute :dental_eff_date, :DentalEffDate
|
||||||
|
alias_attribute :dental_group_num, :DentalGroupNum
|
||||||
|
alias_attribute :card_type, :CardType
|
||||||
|
alias_attribute :provider_code, :ProviderCode
|
||||||
|
alias_attribute :provider_line_1, :ProviderLine1
|
||||||
|
alias_attribute :provider_line_2, :ProviderLine2
|
||||||
|
alias_attribute :provider_line_3, :ProviderLine3
|
||||||
|
alias_attribute :provider_line_4, :ProviderLine4
|
||||||
|
alias_attribute :provider_line_5, :ProviderLine5
|
||||||
|
alias_attribute :provider_line_6, :ProviderLine6
|
||||||
|
alias_attribute :provider_line_7, :ProviderLine7
|
||||||
|
alias_attribute :provider_line_8, :ProviderLine8
|
||||||
|
alias_attribute :provider_line_9, :ProviderLine9
|
||||||
|
alias_attribute :provider_line_1_0, :ProviderLine10
|
||||||
|
alias_attribute :provider_line_1_1, :ProviderLine11
|
||||||
|
alias_attribute :mail_to, :MailTo
|
||||||
|
alias_attribute :mail_to_2, :MailTo2
|
||||||
|
alias_attribute :claim_to_1, :ClaimTo1
|
||||||
|
alias_attribute :claim_to_2, :ClaimTo2
|
||||||
|
alias_attribute :claim_to_3, :ClaimTo3
|
||||||
|
alias_attribute :claim_to_4, :ClaimTo4
|
||||||
|
alias_attribute :claim_to_5, :ClaimTo5
|
||||||
|
alias_attribute :claim_to_6, :ClaimTo6
|
||||||
|
alias_attribute :claim_to_7, :ClaimTo7
|
||||||
|
alias_attribute :claim_to_8, :ClaimTo8
|
||||||
|
alias_attribute :claim_to_9, :ClaimTo9
|
||||||
|
alias_attribute :claim_to_1_0, :ClaimTo10
|
||||||
|
alias_attribute :claim_to_1_1, :ClaimTo11
|
||||||
|
alias_attribute :contact_line_1, :ContactLine1
|
||||||
|
alias_attribute :contact_line_2, :ContactLine2
|
||||||
|
alias_attribute :contact_line_3, :ContactLine3
|
||||||
|
alias_attribute :group_number, :GroupNumber
|
||||||
|
alias_attribute :family_id, :FamilyId
|
||||||
|
alias_attribute :group_no, :GroupNo
|
||||||
|
alias_attribute :rx_group_id, :RXGroupID
|
||||||
|
alias_attribute :help_desk, :HelpDesk
|
||||||
|
alias_attribute :customer_service, :CustomerService
|
||||||
|
alias_attribute :web_url, :WebUrl
|
||||||
|
alias_attribute :expr_1, :Expr1
|
||||||
|
alias_attribute :line_3, :Line3
|
||||||
|
alias_attribute :dependent_1, :Dependent1
|
||||||
|
alias_attribute :dependent_2, :Dependent2
|
||||||
|
alias_attribute :dependent_3, :Dependent3
|
||||||
|
alias_attribute :dependent_4, :Dependent4
|
||||||
|
alias_attribute :dependent_5, :Dependent5
|
||||||
|
alias_attribute :dependent_6, :Dependent6
|
||||||
|
alias_attribute :dependent_7, :Dependent7
|
||||||
|
alias_attribute :dependent_8, :Dependent8
|
||||||
|
alias_attribute :ben_desc_1, :BenDesc1
|
||||||
|
alias_attribute :ben_1, :Ben1
|
||||||
|
alias_attribute :ben_desc_2, :BenDesc2
|
||||||
|
alias_attribute :ben_2, :Ben2
|
||||||
|
alias_attribute :ben_desc_3, :BenDesc3
|
||||||
|
alias_attribute :ben_3, :Ben3
|
||||||
|
alias_attribute :ben_desc_4, :BenDesc4
|
||||||
|
alias_attribute :ben_4, :Ben4
|
||||||
|
alias_attribute :ben_desc_5, :BenDesc5
|
||||||
|
alias_attribute :ben_5, :Ben5
|
||||||
|
alias_attribute :ben_desc_6, :BenDesc6
|
||||||
|
alias_attribute :ben_6, :Ben6
|
||||||
|
alias_attribute :ben_desc_7, :BenDesc7
|
||||||
|
alias_attribute :ben_7, :Ben7
|
||||||
|
alias_attribute :ben_desc_8, :BenDesc8
|
||||||
|
alias_attribute :ben_8, :Ben8
|
||||||
|
alias_attribute :ben_desc_9, :BenDesc9
|
||||||
|
alias_attribute :ben_9, :Ben9
|
||||||
|
alias_attribute :ben_desc_1_0, :BenDesc10
|
||||||
|
alias_attribute :ben_1_0, :Ben10
|
||||||
|
alias_attribute :ben_desc_1_1, :BenDesc11
|
||||||
|
alias_attribute :ben_1_1, :Ben11
|
||||||
|
alias_attribute :ben_desc_1_2, :BenDesc12
|
||||||
|
alias_attribute :ben_1_2, :Ben12
|
||||||
|
alias_attribute :ben_desc_1_3, :BenDesc13
|
||||||
|
alias_attribute :ben_1_3, :Ben13
|
||||||
|
alias_attribute :ben_desc_1_4, :BenDesc14
|
||||||
|
alias_attribute :ben_1_4, :Ben14
|
||||||
|
alias_attribute :pl_plan_key, :PLPlanKey
|
||||||
|
alias_attribute :mb_member_key, :MBMemberKey
|
||||||
|
alias_attribute :provider_lookup_1, :ProviderLookup1
|
||||||
|
alias_attribute :provider_lookup_2, :ProviderLookup2
|
||||||
|
alias_attribute :precert_1, :Precert1
|
||||||
|
alias_attribute :precert_2, :Precert2
|
||||||
|
alias_attribute :precert_3, :Precert3
|
||||||
|
alias_attribute :precert_4, :Precert4
|
||||||
|
alias_attribute :precert_5, :Precert5
|
||||||
|
alias_attribute :precert_6, :Precert6
|
||||||
|
alias_attribute :miscdata, :MISCDATA
|
||||||
|
alias_attribute :ppodata, :PPODATA
|
||||||
|
alias_attribute :ppodata_2, :PPODATA2
|
||||||
|
alias_attribute :ppodata_3, :PPODATA3
|
||||||
|
alias_attribute :last_name, :LastName
|
||||||
|
alias_attribute :provider_line_1_2, :ProviderLine12
|
||||||
|
alias_attribute :claim_to_1_2, :ClaimTo12
|
||||||
|
|
||||||
|
def attributes
|
||||||
|
rails_like = {
|
||||||
|
facility: self.facility,
|
||||||
|
division: self.division,
|
||||||
|
full_name: self.full_name,
|
||||||
|
ssn: self.ssn,
|
||||||
|
medical_coverage: self.medical_coverage,
|
||||||
|
medical_eff_date: self.medical_eff_date,
|
||||||
|
medical_group_num: self.medical_group_num,
|
||||||
|
dental_coverage: self.dental_coverage,
|
||||||
|
dental_eff_date: self.dental_eff_date,
|
||||||
|
dental_group_num: self.dental_group_num,
|
||||||
|
card_type: self.card_type,
|
||||||
|
provider_code: self.provider_code,
|
||||||
|
provider_line_1: self.provider_line_1,
|
||||||
|
provider_line_2: self.provider_line_2,
|
||||||
|
provider_line_3: self.provider_line_3,
|
||||||
|
provider_line_4: self.provider_line_4,
|
||||||
|
provider_line_5: self.provider_line_5,
|
||||||
|
provider_line_6: self.provider_line_6,
|
||||||
|
provider_line_7: self.provider_line_7,
|
||||||
|
provider_line_8: self.provider_line_8,
|
||||||
|
provider_line_9: self.provider_line_9,
|
||||||
|
provider_line_1_0: self.provider_line_1_0,
|
||||||
|
provider_line_1_1: self.provider_line_1_1,
|
||||||
|
mail_to: self.mail_to,
|
||||||
|
mail_to_2: self.mail_to_2,
|
||||||
|
claim_to_1: self.claim_to_1,
|
||||||
|
claim_to_2: self.claim_to_2,
|
||||||
|
claim_to_3: self.claim_to_3,
|
||||||
|
claim_to_4: self.claim_to_4,
|
||||||
|
claim_to_5: self.claim_to_5,
|
||||||
|
claim_to_6: self.claim_to_6,
|
||||||
|
claim_to_7: self.claim_to_7,
|
||||||
|
claim_to_8: self.claim_to_8,
|
||||||
|
claim_to_9: self.claim_to_9,
|
||||||
|
claim_to_1_0: self.claim_to_1_0,
|
||||||
|
claim_to_1_1: self.claim_to_1_1,
|
||||||
|
contact_line_1: self.contact_line_1,
|
||||||
|
contact_line_2: self.contact_line_2,
|
||||||
|
contact_line_3: self.contact_line_3,
|
||||||
|
group_number: self.group_number,
|
||||||
|
family_id: self.family_id,
|
||||||
|
group_no: self.group_no,
|
||||||
|
rx_group_id: self.rx_group_id,
|
||||||
|
help_desk: self.help_desk,
|
||||||
|
customer_service: self.customer_service,
|
||||||
|
web_url: self.web_url,
|
||||||
|
expr_1: self.expr_1,
|
||||||
|
line_3: self.line_3,
|
||||||
|
dependent_1: self.dependent_1,
|
||||||
|
dependent_2: self.dependent_2,
|
||||||
|
dependent_3: self.dependent_3,
|
||||||
|
dependent_4: self.dependent_4,
|
||||||
|
dependent_5: self.dependent_5,
|
||||||
|
dependent_6: self.dependent_6,
|
||||||
|
dependent_7: self.dependent_7,
|
||||||
|
dependent_8: self.dependent_8,
|
||||||
|
ben_desc_1: self.ben_desc_1,
|
||||||
|
ben_1: self.ben_1,
|
||||||
|
ben_desc_2: self.ben_desc_2,
|
||||||
|
ben_2: self.ben_2,
|
||||||
|
ben_desc_3: self.ben_desc_3,
|
||||||
|
ben_3: self.ben_3,
|
||||||
|
ben_desc_4: self.ben_desc_4,
|
||||||
|
ben_4: self.ben_4,
|
||||||
|
ben_desc_5: self.ben_desc_5,
|
||||||
|
ben_5: self.ben_5,
|
||||||
|
ben_desc_6: self.ben_desc_6,
|
||||||
|
ben_6: self.ben_6,
|
||||||
|
ben_desc_7: self.ben_desc_7,
|
||||||
|
ben_7: self.ben_7,
|
||||||
|
ben_desc_8: self.ben_desc_8,
|
||||||
|
ben_8: self.ben_8,
|
||||||
|
ben_desc_9: self.ben_desc_9,
|
||||||
|
ben_9: self.ben_9,
|
||||||
|
ben_desc_1_0: self.ben_desc_1_0,
|
||||||
|
ben_1_0: self.ben_1_0,
|
||||||
|
ben_desc_1_1: self.ben_desc_1_1,
|
||||||
|
ben_1_1: self.ben_1_1,
|
||||||
|
ben_desc_1_2: self.ben_desc_1_2,
|
||||||
|
ben_1_2: self.ben_1_2,
|
||||||
|
ben_desc_1_3: self.ben_desc_1_3,
|
||||||
|
ben_1_3: self.ben_1_3,
|
||||||
|
ben_desc_1_4: self.ben_desc_1_4,
|
||||||
|
ben_1_4: self.ben_1_4,
|
||||||
|
pl_plan_key: self.pl_plan_key,
|
||||||
|
mb_member_key: self.mb_member_key,
|
||||||
|
provider_lookup_1: self.provider_lookup_1,
|
||||||
|
provider_lookup_2: self.provider_lookup_2,
|
||||||
|
precert_1: self.precert_1,
|
||||||
|
precert_2: self.precert_2,
|
||||||
|
precert_3: self.precert_3,
|
||||||
|
precert_4: self.precert_4,
|
||||||
|
precert_5: self.precert_5,
|
||||||
|
precert_6: self.precert_6,
|
||||||
|
miscdata: self.miscdata,
|
||||||
|
ppodata: self.ppodata,
|
||||||
|
ppodata_2: self.ppodata_2,
|
||||||
|
ppodata_3: self.ppodata_3,
|
||||||
|
last_name: self.last_name,
|
||||||
|
provider_line_1_2: self.provider_line_1_2,
|
||||||
|
claim_to_1_2: self.claim_to_1_2,
|
||||||
|
}
|
||||||
|
super.merge(rails_like)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
module AutomationService
|
||||||
|
class EmployerMembersUpdate
|
||||||
|
|
||||||
|
def initialize(pl_plan_key)
|
||||||
|
@pl_plan_key = pl_plan_key
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
employer = Employer.includes(:id_card_setup).find_by(pl_plan_key: @pl_plan_key)
|
||||||
|
card_setup = employer.id_card_setup
|
||||||
|
puts "-- #{employer.name}"
|
||||||
|
|
||||||
|
# employer_members =[]
|
||||||
|
vw_mb_members = Vhcs::VwmbMember.where(enrollee_type_value_id: 1, pl_plan_key: @pl_plan_key).select(:mb_member_key, :pb_entity_key, :pl_plan_key, :family_id, :full_name_last_name_first, :social_security_number)
|
||||||
|
# vw_mb_members.each do |vw_mb_member|
|
||||||
|
# member = UpdateMemberJob.perform_now(@pb_entity_key, employer.id, card_setup.has_divisions, card_setup.has_dental, true, vw_mb_member)
|
||||||
|
# end
|
||||||
|
# employer.members = employer_members
|
||||||
|
# employer.save
|
||||||
|
|
||||||
|
member_update_futures = vw_mb_members.map do |vw_mb_member|
|
||||||
|
Concurrent::Future.execute do
|
||||||
|
ActiveRecord::Base.connection_pool.with_connection do
|
||||||
|
UpdateMemberJob.perform_now(@pb_entity_key, employer.id, card_setup.has_divisions, card_setup.has_dental, vw_mb_member)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
member_updates = member_update_futures.map(&:value).compact
|
||||||
|
employer.members = member_updates
|
||||||
|
employer.save
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
module AutomationService
|
||||||
|
class EmployerUpdate
|
||||||
|
|
||||||
|
def initialize(pl_plan_key, full_sync = false)
|
||||||
|
@pl_plan_key = pl_plan_key
|
||||||
|
@full_sync = full_sync
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
# employer = Employer.includes(:id_card_setup).find_by(pl_plan_key: @pl_plan_key)
|
||||||
|
# card_setup = employer.id_card_setup
|
||||||
|
UpdateEmployerJob.new.perform(@pl_plan_key, {}, @full_sync)
|
||||||
|
# if employer.present?
|
||||||
|
# employer.save
|
||||||
|
# else
|
||||||
|
# Member.find_by(pb_entity_key: vw_mb_member[:pb_entity_key]).destroy
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# AutomationService::MemberUpdate('13', 337710)
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
module AutomationService
|
||||||
|
class MemberUpdate
|
||||||
|
|
||||||
|
def initialize(pl_plan_key, pb_entity_key)
|
||||||
|
@pl_plan_key = pl_plan_key
|
||||||
|
@pb_entity_key = pb_entity_key
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
employer = Employer.includes(:id_card_setup).find_by(pl_plan_key: @pl_plan_key)
|
||||||
|
card_setup = employer.id_card_setup
|
||||||
|
member = UpdateMemberJob.perform_now(@pb_entity_key, employer.id, card_setup.has_divisions, card_setup.has_dental)
|
||||||
|
if member.present?
|
||||||
|
member.save
|
||||||
|
else
|
||||||
|
Member.find_by(pb_entity_key: vw_mb_member[:pb_entity_key]).destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# AutomationService::MemberUpdate('13', 337710)
|
||||||
@@ -3,7 +3,7 @@ module IdCardPrinterService
|
|||||||
|
|
||||||
def initialize(employers_member_keys)
|
def initialize(employers_member_keys)
|
||||||
# @employer = employer
|
# @employer = employer
|
||||||
@employers_member_keys = employers_member_keys
|
@employers_member_keys = Array.wrap(employers_member_keys)
|
||||||
|
|
||||||
# @employer = Employer.includes(id_card_setup: [:provider_section, :rx_section]).find_by(pl_plan_key: pl_plan_key)
|
# @employer = Employer.includes(id_card_setup: [:provider_section, :rx_section]).find_by(pl_plan_key: pl_plan_key)
|
||||||
# @card_setup = @employer.id_card_setup
|
# @card_setup = @employer.id_card_setup
|
||||||
@@ -41,7 +41,6 @@ module IdCardPrinterService
|
|||||||
group_number: @employer.group_number,
|
group_number: @employer.group_number,
|
||||||
rx_group: @card_setup.rx_group_number,
|
rx_group: @card_setup.rx_group_number,
|
||||||
network_provider: @card_setup.network_provider,
|
network_provider: @card_setup.network_provider,
|
||||||
network_logo_id: @card_setup.network_logo_id,
|
|
||||||
network_logo_filename: @card_setup.network_logo.filename,
|
network_logo_filename: @card_setup.network_logo.filename,
|
||||||
employer_logo_filename: @card_setup.employer_logo.filename
|
employer_logo_filename: @card_setup.employer_logo.filename
|
||||||
}
|
}
|
||||||
@@ -58,7 +57,8 @@ module IdCardPrinterService
|
|||||||
:provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :provider_line_6,
|
: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,
|
: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_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
|
:claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12,
|
||||||
|
:precert_1, :precert_2, :precert_3, :precert_4
|
||||||
)
|
)
|
||||||
|
|
||||||
selected_attributes = employer_attributes.merge(rx_attributes).merge(provider_attributes)
|
selected_attributes = employer_attributes.merge(rx_attributes).merge(provider_attributes)
|
||||||
@@ -83,11 +83,16 @@ module IdCardPrinterService
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_member_cards_async
|
def create_member_cards_async
|
||||||
field_exceptions = @card_setup.field_exceptions.pluck(:id)
|
field_exceptions_map = @card_setup.field_exceptions_card_attributes_by_member_id(@member_keys)
|
||||||
mmember_card_futures = @member_keys.map do |member_key|
|
mmember_card_futures = @member_keys.map do |member_key|
|
||||||
|
member_card_exceptions_attrs = {}
|
||||||
|
member_card_exception_id = field_exceptions_map[member_key]
|
||||||
|
if member_card_exception_id
|
||||||
|
member_card_exceptions_attrs = field_exceptions_map[member_card_exception_id]
|
||||||
|
end
|
||||||
Concurrent::Future.execute do
|
Concurrent::Future.execute do
|
||||||
ActiveRecord::Base.connection_pool.with_connection do
|
ActiveRecord::Base.connection_pool.with_connection do
|
||||||
ProcessIdCardDataJob.perform_now(member_key, field_exceptions, @card_setup.has_divisions)
|
ProcessMemberCardDataJob.perform_now(member_key, member_card_exceptions_attrs, @card_setup.has_divisions, @card_setup.has_dental)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,13 +15,30 @@ module IdCardPrinterService
|
|||||||
IdCard::PrintData.where(pl_plan_key: pl_plan_keys, primary_mb_member_key: nil).destroy_all
|
IdCard::PrintData.where(pl_plan_key: pl_plan_keys, primary_mb_member_key: nil).destroy_all
|
||||||
|
|
||||||
pdf_array = []
|
pdf_array = []
|
||||||
batches = break_into_batches(pl_plan_keys)
|
template_groups = break_up_by_template(pl_plan_keys)
|
||||||
batches.each do |card_template, batch_pl_plan_keys|
|
template_groups.each do |card_template, template_pl_plan_keys|
|
||||||
jasper_batch_id = "#{batch_pl_plan_keys.join('_')}-#{Time.current.utc.to_i}"
|
batch = IdCard::PrintData.where(pl_plan_key: template_pl_plan_keys)
|
||||||
batch = IdCard::PrintData.where(pl_plan_key: batch_pl_plan_keys)
|
# all_template_cards.in_batches(of: 75).each_with_index do |batch, index|
|
||||||
|
jasper_batch_id = "#{template_pl_plan_keys.join('_')}-#{Time.current.utc.to_i}"
|
||||||
|
# binding.pry
|
||||||
batch.update!(jasper_batch_id: jasper_batch_id)
|
batch.update!(jasper_batch_id: jasper_batch_id)
|
||||||
|
if @layout == "PrintCard"
|
||||||
|
add_dependent_cards(batch)
|
||||||
|
end
|
||||||
batch_pdf = IdCardPrinterService::PdfBatchProcessor.new(card_template, jasper_batch_id, @layout).call
|
batch_pdf = IdCardPrinterService::PdfBatchProcessor.new(card_template, jasper_batch_id, @layout).call
|
||||||
pdf_array << batch_pdf
|
pdf_array << batch_pdf
|
||||||
|
# end
|
||||||
|
# jasper_batches = break_into_jasper_batches(group_pl_plan_keys)
|
||||||
|
# jasper_batches.each_with_index do |batch, index|
|
||||||
|
# jasper_batch_id = "#{group_pl_plan_keys.join('_')}-#{index + 1}-#{Time.current.utc.to_i}"
|
||||||
|
# binding.pry
|
||||||
|
# batch.update!(jasper_batch_id: jasper_batch_id)
|
||||||
|
# if @layout == "PrintCard"
|
||||||
|
# add_dependent_cards(batch)
|
||||||
|
# end
|
||||||
|
# batch_pdf = IdCardPrinterService::PdfBatchProcessor.new(card_template, jasper_batch_id, @layout).call
|
||||||
|
# pdf_array << batch_pdf
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
# @employers_member_keys.each do |emk|
|
# @employers_member_keys.each do |emk|
|
||||||
# employer_jasper_batches = IdCard::PrintData.where(pl_plan_key: emk[:pl_plan_key]).pluck(:network_logo_id).uniq
|
# employer_jasper_batches = IdCard::PrintData.where(pl_plan_key: emk[:pl_plan_key]).pluck(:network_logo_id).uniq
|
||||||
@@ -44,18 +61,47 @@ module IdCardPrinterService
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def break_into_batches(pl_plan_keys)
|
def break_up_by_template(pl_plan_keys)
|
||||||
batches_by_card_template = IdCard::Setup.where(pl_plan_key: pl_plan_keys).group_by(&:card_template)
|
batches_by_card_template = IdCard::Setup.where(pl_plan_key: pl_plan_keys).group_by(&:card_template)
|
||||||
.transform_values { |setups| setups.map(&:pl_plan_key) }
|
.transform_values { |setups| setups.map(&:pl_plan_key) }
|
||||||
.compact_blank
|
.compact_blank
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def break_into_jasper_batches(pl_plan_keys)
|
||||||
|
all_cards = IdCard::PrintData.where(pl_plan_key: pl_plan_keys)
|
||||||
|
binding.pry
|
||||||
|
jasper_batches = all_cards.each_slice(75).to_a
|
||||||
|
jasper_batches
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_dependent_cards(batch)
|
||||||
|
batch.where.not(dependent_1: [nil, ""]).find_each do |member_card|
|
||||||
|
dependent_card = member_card.dup
|
||||||
|
dependent_card.update(
|
||||||
|
full_name_last_name_first: member_card.full_name_last_name_first.concat(" dependent")
|
||||||
|
)
|
||||||
|
dependent_card.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def combine_pdfs(pdf_array)
|
def combine_pdfs(pdf_array)
|
||||||
if @zip
|
if @zip
|
||||||
group_cards_pdf = Zip::OutputStream.write_buffer do |zio|
|
group_cards_pdf = Zip::OutputStream.write_buffer do |zio|
|
||||||
pdf_array.each do |file|
|
pdf_file = pdf_array.first
|
||||||
zio.put_next_entry(file[:name])
|
puts "-- CombinePdfPages --"
|
||||||
zio.write(file[:data])
|
puts pdf_file.pages.count
|
||||||
|
pdf_file.pages.reverse.each do |page|
|
||||||
|
page_pdf = CombinePDF.new
|
||||||
|
page_pdf << page
|
||||||
|
page_data = page_pdf.to_pdf
|
||||||
|
full_name_last_name_first = get_watermark_field(page_data)
|
||||||
|
if full_name_last_name_first.present?
|
||||||
|
page_filename = "#{full_name_last_name_first.gsub(", ", "_")}_digital_card_#{Date.today}.pdf"
|
||||||
|
puts "-- Filename --"
|
||||||
|
puts page_filename
|
||||||
|
zio.put_next_entry(page_filename)
|
||||||
|
zio.write(page_data)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -64,5 +110,19 @@ module IdCardPrinterService
|
|||||||
end
|
end
|
||||||
group_cards_pdf
|
group_cards_pdf
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_watermark_field(page_data)
|
||||||
|
watermark_field = ""
|
||||||
|
reader = PDF::Reader.new(StringIO.new(page_data))
|
||||||
|
puts "-- ReaderPages --"
|
||||||
|
puts reader.pages.count
|
||||||
|
page = reader.pages.first
|
||||||
|
if watermark_match = page.text.match(/:WATERMARK:([^:]*):/)
|
||||||
|
watermark_field = page.text.match(/:WATERMARK:([^:]*):/)[1].strip
|
||||||
|
else
|
||||||
|
puts "blank page"
|
||||||
|
end
|
||||||
|
watermark_field
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module IdCardPrinterService
|
|||||||
host: '10.41.1.115',
|
host: '10.41.1.115',
|
||||||
port: 8080,
|
port: 8080,
|
||||||
path: '/trunk/IdCardsServlet',
|
path: '/trunk/IdCardsServlet',
|
||||||
query: "reportConn=BrittonConnect&cardTemplate=#{@card_template}Batch&printType=Batch#{@layout}&jasper_batch_id=#{@jasper_batch_id}&FileType=PDF"
|
query: "reportConn=BrittonConnect&cardTemplate=#{@card_template}&printType=#{@layout}&jasper_batch_id=#{@jasper_batch_id}&FileType=PDF"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ module IdCardPrinterService
|
|||||||
def call
|
def call
|
||||||
|
|
||||||
response = HTTParty.get(@jasper_url)
|
response = HTTParty.get(@jasper_url)
|
||||||
|
# response.body
|
||||||
CombinePDF.parse(response.body)
|
CombinePDF.parse(response.body)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
module IdCardPrinterService
|
||||||
|
class PdfFormatter
|
||||||
|
|
||||||
|
def initialize(pdf_array ,layout, zip=false)
|
||||||
|
@pdf_array = pdf_array
|
||||||
|
@layout = layout
|
||||||
|
@zip = zip
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
|
||||||
|
if @layout == "FullPageCard"
|
||||||
|
pdf_file = @pdf_array.first
|
||||||
|
puts "-- CombinePdfPages --"
|
||||||
|
puts pdf_file.pages.count
|
||||||
|
pdf_file.pages.reverse.each do |page|
|
||||||
|
page_pdf = CombinePDF.new
|
||||||
|
page_pdf << page
|
||||||
|
page_data = page_pdf.to_pdf
|
||||||
|
full_name_last_name_first = get_watermark_field(page_data)
|
||||||
|
if full_name_last_name_first.present?
|
||||||
|
page_filename = "#{full_name_last_name_first.gsub(", ", "_")}_digital_card_#{Date.today}.pdf"
|
||||||
|
group_cards_pdf_array << { name: page_filename, data: page_data }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
group_cards_pdf = Zip::OutputStream.write_buffer do |zio|
|
||||||
|
pdf_file = pdf_array.first
|
||||||
|
puts "-- CombinePdfPages --"
|
||||||
|
puts pdf_file.pages.count
|
||||||
|
pdf_file.pages.reverse.each do |page|
|
||||||
|
page_pdf = CombinePDF.new
|
||||||
|
page_pdf << page
|
||||||
|
page_data = page_pdf.to_pdf
|
||||||
|
full_name_last_name_first = get_watermark_field(page_data)
|
||||||
|
if full_name_last_name_first.present?
|
||||||
|
page_filename = "#{full_name_last_name_first.gsub(", ", "_")}_digital_card_#{Date.today}.pdf"
|
||||||
|
puts "-- Filename --"
|
||||||
|
puts page_filename
|
||||||
|
zio.put_next_entry(page_filename)
|
||||||
|
zio.write(page_data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
group_cards_pdf = CombinePDF.new
|
||||||
|
pdf_array.each { |pdf| group_cards_pdf << pdf }
|
||||||
|
end
|
||||||
|
group_cards_pdf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def get_watermark_field(page_data)
|
||||||
|
watermark_field = ""
|
||||||
|
reader = PDF::Reader.new(StringIO.new(page_data))
|
||||||
|
puts "-- ReaderPages --"
|
||||||
|
puts reader.pages.count
|
||||||
|
page = reader.pages.first
|
||||||
|
if watermark_match = page.text.match(/:WATERMARK:([^:]*):/)
|
||||||
|
watermark_field = page.text.match(/:WATERMARK:([^:]*):/)[1].strip
|
||||||
|
else
|
||||||
|
puts "blank page"
|
||||||
|
end
|
||||||
|
watermark_field
|
||||||
|
end
|
||||||
|
|
||||||
|
def break_into_batches(pl_plan_keys)
|
||||||
|
batches_by_card_template = IdCard::Setup.where(pl_plan_key: pl_plan_keys).group_by(&:card_template)
|
||||||
|
.transform_values { |setups| setups.map(&:pl_plan_key) }
|
||||||
|
.compact_blank
|
||||||
|
end
|
||||||
|
|
||||||
|
def combine_pdfs(pdf_array)
|
||||||
|
if @zip
|
||||||
|
group_cards_pdf = Zip::OutputStream.write_buffer do |zio|
|
||||||
|
pdf_file = pdf_array.first
|
||||||
|
puts "-- CombinePdfPages --"
|
||||||
|
puts pdf_file.pages.count
|
||||||
|
pdf_file.pages.reverse.each do |page|
|
||||||
|
page_pdf = CombinePDF.new
|
||||||
|
page_pdf << page
|
||||||
|
page_data = page_pdf.to_pdf
|
||||||
|
full_name_last_name_first = get_watermark_field(page_data)
|
||||||
|
if full_name_last_name_first.present?
|
||||||
|
page_filename = "#{full_name_last_name_first.gsub(", ", "_")}_digital_card_#{Date.today}.pdf"
|
||||||
|
puts "-- Filename --"
|
||||||
|
puts page_filename
|
||||||
|
zio.put_next_entry(page_filename)
|
||||||
|
zio.write(page_data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
group_cards_pdf = CombinePDF.new
|
||||||
|
pdf_array.each { |pdf| group_cards_pdf << pdf }
|
||||||
|
end
|
||||||
|
group_cards_pdf
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_watermark_field(page_data)
|
||||||
|
watermark_field = ""
|
||||||
|
reader = PDF::Reader.new(StringIO.new(page_data))
|
||||||
|
puts "-- ReaderPages --"
|
||||||
|
puts reader.pages.count
|
||||||
|
page = reader.pages.first
|
||||||
|
if watermark_match = page.text.match(/:WATERMARK:([^:]*):/)
|
||||||
|
watermark_field = page.text.match(/:WATERMARK:([^:]*):/)[1].strip
|
||||||
|
else
|
||||||
|
puts "blank page"
|
||||||
|
end
|
||||||
|
watermark_field
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
module IdCardQueueService
|
module IdCardQueueService
|
||||||
class GetQueuedCards
|
class GetQueuedMembers
|
||||||
|
|
||||||
def initialize(pl_plan_keys = nil)
|
def initialize(pl_plan_keys = nil)
|
||||||
if pl_plan_keys
|
if pl_plan_keys
|
||||||
@@ -10,7 +10,7 @@ module IdCardQueueService
|
|||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
raw_employers_member_keys = CallStoredProc.new('BrittonGetQueuedIdCardMemberKeysTPA', { PLPlanKeys: @employer_pl_plan_keys }).call.to_ary
|
raw_employers_member_keys = CallStoredProc.new('HLGetQueuedIdCardMemberKeysTPA', { PLPlanKeys: @employer_pl_plan_keys }).call.to_ary
|
||||||
|
|
||||||
format_employers_member_keys(raw_employers_member_keys)
|
format_employers_member_keys(raw_employers_member_keys)
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
module ReportsService
|
||||||
|
class CardComparisons
|
||||||
|
|
||||||
|
def initialize(pl_plan_key, member_pb_entity_key = nil)
|
||||||
|
@pl_plan_key = pl_plan_key
|
||||||
|
@member_pb_entity_key = member_pb_entity_key
|
||||||
|
@hlid_ids_compared = []
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
if @member_pb_entity_key
|
||||||
|
IdCard::PrintData.where(primary_mb_member_key: @member_pb_entity_key).destroy_all
|
||||||
|
CallStoredProc.new('HLQueueIDCardByKey', { PBEntityKey: @member_pb_entity_key }).call
|
||||||
|
IdCardPrinterService::CardDataFormatter.new([{pl_plan_key: @pl_plan_key, member_keys: [@member_pb_entity_key]}]).call
|
||||||
|
puts "use ID Cards app for group #{@pl_plan_key}, then press enter."
|
||||||
|
continue = gets
|
||||||
|
|
||||||
|
compare_member_cards(@member_pb_entity_key)
|
||||||
|
else
|
||||||
|
employer_card_comparison = Report::CardComparison.find_or_create_by(member_number: "#{@pl_plan_key}-Group", pl_plan_key: @pl_plan_key)
|
||||||
|
|
||||||
|
AutomationService::EmployerMembersUpdate.new(@pl_plan_key).call
|
||||||
|
employer_member_keys = Employer.find_by(pl_plan_key: @pl_plan_key).employer_member_keys
|
||||||
|
IdCard::PrintData.where(pl_plan_key: @pl_plan_key).destroy_all
|
||||||
|
CallStoredProc.new('HLQueueAllIDCardsByPlan', { PLPlanKey: @pl_plan_key }).call
|
||||||
|
IdCardPrinterService::CardDataFormatter.new(employer_member_keys).call
|
||||||
|
|
||||||
|
puts "use ID Cards app for group #{@pl_plan_key}, then press enter."
|
||||||
|
continue = gets
|
||||||
|
|
||||||
|
IdCard::PrintData.where(pl_plan_key: @pl_plan_key, primary_mb_member_key: nil).destroy_all
|
||||||
|
|
||||||
|
|
||||||
|
# new_cards = IdCard::PrintData.where(pl_plan_key: @pl_plan_key)
|
||||||
|
# add_dependent_cards(new_cards)
|
||||||
|
new_card_member_keys = IdCard::PrintData.where(pl_plan_key: @pl_plan_key).pluck(:primary_mb_member_key).uniq
|
||||||
|
old_card_member_keys = Vhcs::HlidCardEggData.where(pl_plan_key: @pl_plan_key).pluck(:primary_mb_member_key).uniq.map(&:to_s)
|
||||||
|
|
||||||
|
missing_from_new = old_card_member_keys - new_card_member_keys
|
||||||
|
missing_from_old = new_card_member_keys - old_card_member_keys
|
||||||
|
|
||||||
|
if missing_from_new.present? || missing_from_old.present?
|
||||||
|
employer_card_comparison.comparison_errors.new(
|
||||||
|
card_field: "Missing Cards",
|
||||||
|
new_value: missing_from_old.join(', '),
|
||||||
|
old_value: missing_from_new.join(', ')
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# group_errors = []
|
||||||
|
# unless new_card_count == old_card_count
|
||||||
|
# group_errors.push({
|
||||||
|
# employer: @pl_plan_key,
|
||||||
|
# field: 'Card Count Mismatch',
|
||||||
|
# new_value: new_card_count,
|
||||||
|
# old_value: old_card_count
|
||||||
|
# })
|
||||||
|
# end
|
||||||
|
member_keys_array = new_card_member_keys | old_card_member_keys
|
||||||
|
member_keys_array.each do |member_key|
|
||||||
|
compare_member_cards(member_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
failed_cards = Report::CardComparison.where(pl_plan_key: @pl_plan_key, passed: false).where.not(member_number: @pl_plan_key)
|
||||||
|
if failed_cards.empty?
|
||||||
|
employer_card_comparison.passed = true
|
||||||
|
end
|
||||||
|
|
||||||
|
employer_card_comparison.save
|
||||||
|
@hlid_ids_compared
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def compare_member_cards(member_pb_entity_key)
|
||||||
|
member_card_comparison = Report::CardComparison.find_or_create_by(member_number: member_pb_entity_key, pl_plan_key: @pl_plan_key)
|
||||||
|
new_card = IdCard::PrintData.find_by(primary_mb_member_key: member_pb_entity_key)
|
||||||
|
old_card = Vhcs::HlidCardEggData.where(primary_mb_member_key: member_pb_entity_key).first
|
||||||
|
@hlid_ids_compared << old_card.id
|
||||||
|
|
||||||
|
errors = []
|
||||||
|
if new_card.present? && old_card.present?
|
||||||
|
|
||||||
|
# :pl_plan_key, :primary_mb_member_key, :family_id, :full_name, :medical_eff_date, :dental_coverage,
|
||||||
|
# :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,
|
||||||
|
# :precert_1, :precert_2, :precert_3, :precert_4, :customer_service, :web_url, :dependent_1, :dependent_2, :dependent_3,
|
||||||
|
# :dependent_4, :dependent_5, :dependent_6, :dependent_7, :dependent_8, :benefit_desc_1,
|
||||||
|
|
||||||
|
new_card_common = new_card.attributes.with_indifferent_access.except(
|
||||||
|
:id, :created_at, :full_name_last_name_first, :network_provider, :plan_id,
|
||||||
|
:network_logo_filename, :employer_logo_filename, :sample_plan_title, :jasper_batch_id, :updated_at
|
||||||
|
)
|
||||||
|
new_card_common.delete_if { |key, value| key.match?(/[[:upper:]]/) }
|
||||||
|
|
||||||
|
new_card_dependents = new_card.attributes.with_indifferent_access.slice(
|
||||||
|
:dependent_1, :dependent_2, :dependent_3, :dependent_4, :dependent_5, :dependent_6, :dependent_7, :dependent_8
|
||||||
|
)
|
||||||
|
new_card_dependents.delete_if { |key, value| key.match?(/[[:upper:]]/) }
|
||||||
|
|
||||||
|
new_card_dental = new_card[:dental_coverage]
|
||||||
|
new_card_eff_date = new_card[:medical_eff_date]
|
||||||
|
|
||||||
|
# old_card_common = old_card.attributes.except(
|
||||||
|
# :id, :facility, :ssn, :medical_coverage, :dental_eff_date, :dental_group_num, :mail_to, :mail_to_2, :contact_line_1,
|
||||||
|
# :contact_line_2, :contact_line_3, :group_number, :group_no, :help_desk, :expr_1, :line_3, :ppo_lookup_1, :ppo_lookup_2,
|
||||||
|
# :precert_5, :precert_6, :misc_data, :ppo_data, :ppo_data_2, :ppo_data_3, :last_name, :card_type, :provider_code
|
||||||
|
# )
|
||||||
|
old_card_common = old_card.attributes.with_indifferent_access.slice(
|
||||||
|
:employer_name, :full_name, :group_number, :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, :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, :family_id, :rx_group, :customer_service, :web_url, :benefit_desc_1, :benefit_1, :benefit_desc_2, :benefit_2, :benefit_desc_3, :benefit_3,
|
||||||
|
:benefit_desc_4, :benefit_4, :benefit_desc_5, :benefit_5, :benefit_desc_6, :benefit_6, :benefit_desc_7, :benefit_7, :benefit_desc_8, :benefit_8,
|
||||||
|
:benefit_desc_9, :benefit_9, :benefit_desc_10, :benefit_10, :benefit_desc_11, :benefit_11, :benefit_desc_12, :benefit_12, :benefit_desc_13, :benefit_13,
|
||||||
|
:benefit_desc_14, :benefit_14, :pl_plan_key, :primary_mb_member_key, :provider_line_12, :claim_to_12
|
||||||
|
) # :precert_1, :precert_2, :precert_3, :precert_4
|
||||||
|
old_card_common.transform_keys!(division: :employer_name, medical_group_num: :group_number, rx_group_id: :rx_group)
|
||||||
|
|
||||||
|
old_card_dependents = old_card.attributes.with_indifferent_access.slice(
|
||||||
|
:dependent_1, :dependent_2, :dependent_3, :dependent_4, :dependent_5, :dependent_6, :dependent_7, :dependent_8
|
||||||
|
)
|
||||||
|
old_card_dependents.delete_if { |key, value| key.match?(/[[:upper:]]/) }
|
||||||
|
|
||||||
|
old_card_dental = old_card[:dental_coverage]
|
||||||
|
old_card_eff_date = old_card[:medical_eff_date]
|
||||||
|
|
||||||
|
old_card_common.each do |key, value|
|
||||||
|
# if key == :benefit_desc_4
|
||||||
|
# binding.pry
|
||||||
|
# end
|
||||||
|
unless new_card_common[key].to_s.downcase.strip.gsub(/\W/, ' ') == value.to_s.downcase.strip.gsub(/\W/, ' ')
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: key.to_s)
|
||||||
|
comp_error.update!(new_value: new_card_common[key], old_value: value)
|
||||||
|
# errors.push({
|
||||||
|
# member: old_card_common[:primary_mb_member_key],
|
||||||
|
# field: key,
|
||||||
|
# new_value: value,
|
||||||
|
# old_value: new_card_common[key]
|
||||||
|
# })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unless old_card_dependents.values.sort == new_card_dependents.values.sort
|
||||||
|
|
||||||
|
missing_from_new = (old_card_dependents.values - new_card_dependents.values).compact_blank
|
||||||
|
missing_from_old = (new_card_dependents.values - old_card_dependents.values).compact_blank
|
||||||
|
|
||||||
|
# member_card_comparison.comparison_errors.new(
|
||||||
|
# card_field: "Missing Dependent(s)",
|
||||||
|
# new_value: missing_from_old.join(', '),
|
||||||
|
# old_value: missing_from_new.join(', ')
|
||||||
|
# )
|
||||||
|
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: "Missing Dependent(s)")
|
||||||
|
comp_error.update!(new_value: missing_from_old.join(', '), old_value: missing_from_new.join(', '))
|
||||||
|
|
||||||
|
# errors.push({
|
||||||
|
# member: old_card_common[:primary_mb_member_key],
|
||||||
|
# field: 'Missing Dependent(s)',
|
||||||
|
# new_value: new_card_dependents.values,
|
||||||
|
# old_value: old_card_dependents.values
|
||||||
|
# })
|
||||||
|
end
|
||||||
|
|
||||||
|
unless new_card_dental == old_card_dental || (old_card_dental == "NONE" && new_card_dental.empty?)
|
||||||
|
member_card_comparison.comparison_errors.new(
|
||||||
|
card_field: "dental_coverage",
|
||||||
|
new_value: new_card_dental,
|
||||||
|
old_value: old_card_dental
|
||||||
|
)
|
||||||
|
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: "dental_coverage")
|
||||||
|
comp_error.update!(new_value: new_card_dental, old_value: old_card_dental)
|
||||||
|
|
||||||
|
# errors.push({
|
||||||
|
# member: old_card_common[:primary_mb_member_key],
|
||||||
|
# field: :dental_coverage,
|
||||||
|
# new_value: new_card_dental,
|
||||||
|
# old_value: old_card_dental
|
||||||
|
# })
|
||||||
|
end
|
||||||
|
|
||||||
|
unless new_card_eff_date.to_date == old_card_eff_date.to_date
|
||||||
|
# member_card_comparison.comparison_errors.new(
|
||||||
|
# card_field: "medical_eff_date",
|
||||||
|
# new_value: new_card_eff_date,
|
||||||
|
# old_value: old_card_eff_date
|
||||||
|
# )
|
||||||
|
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: "medical_eff_date")
|
||||||
|
comp_error.update!(new_value: new_card_eff_date, old_value: old_card_eff_date)
|
||||||
|
|
||||||
|
# errors.push({
|
||||||
|
# member: old_card_common[:primary_mb_member_key],
|
||||||
|
# field: :medical_eff_date,
|
||||||
|
# new_value: new_card_eff_date,
|
||||||
|
# old_value: old_card_eff_date
|
||||||
|
# })
|
||||||
|
end
|
||||||
|
else
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: "Missing Member")
|
||||||
|
comp_error.update!(new_value: new_card.present?, old_value: old_card.present?)
|
||||||
|
# member_card_comparison.comparison_errors.new(
|
||||||
|
# card_field: "Missing Member",
|
||||||
|
# new_value: new_card.present?,
|
||||||
|
# old_value: old_card.present?
|
||||||
|
# )
|
||||||
|
# errors.push({
|
||||||
|
# member: old_card[:primary_mb_member_key],
|
||||||
|
# field: "Missing Member",
|
||||||
|
# new_value: new_card.present?,
|
||||||
|
# old_value: old_card.present?
|
||||||
|
# })
|
||||||
|
end
|
||||||
|
if member_card_comparison.comparison_errors.empty?
|
||||||
|
member_card_comparison.passed = true
|
||||||
|
end
|
||||||
|
member_card_comparison.save
|
||||||
|
end
|
||||||
|
|
||||||
|
# def add_dependent_cards(batch)
|
||||||
|
# batch.where.not(dependent_1: [nil, ""]).find_each do |member_card|
|
||||||
|
# dependent_card = member_card.dup
|
||||||
|
# dependent_card.update(
|
||||||
|
# full_name_last_name_first: member_card.full_name_last_name_first.concat(" dependent")
|
||||||
|
# )
|
||||||
|
# dependent_card.save
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
module ReportsService
|
||||||
|
class DuplicateOldCards
|
||||||
|
|
||||||
|
def initialize(pl_plan_keys)
|
||||||
|
@pl_plan_keys = Array.wrap(pl_plan_keys)
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
@pl_plan_keys.each do |pl_plan_key|
|
||||||
|
Vhcs::HlidCardEggData.destroy_all
|
||||||
|
clear_out_queue()
|
||||||
|
CallStoredProc.new('HLQueueAllIDCardsByPlan', { PLPlanKey: pl_plan_key }).call
|
||||||
|
puts "---------------------------------------------------------------------------------"
|
||||||
|
puts "---------------------------------------------------------------------------------"
|
||||||
|
puts "use ID Cards app to pull queued for group #{pl_plan_key}, then press enter."
|
||||||
|
puts "---------------------------------------------------------------------------------"
|
||||||
|
puts "---------------------------------------------------------------------------------"
|
||||||
|
continue = gets
|
||||||
|
|
||||||
|
old_cards = Vhcs::HlidCardEggData.where(pl_plan_key: pl_plan_key)
|
||||||
|
old_cards.each do |card|
|
||||||
|
duplicate_card(card)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def duplicate_card(card)
|
||||||
|
unless Report::OldCardDuplicate.exists?(primary_mb_member_key: card.primary_mb_member_key)
|
||||||
|
dup_attrs = card.attributes.with_indifferent_access.slice(
|
||||||
|
:employer_name, :full_name, :group_number, :medical_eff_date, :dental_coverage, :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,:family_id, :rx_group, :customer_service, :web_url, :benefit_desc_1,
|
||||||
|
:benefit_1, :benefit_desc_2, :benefit_2, :benefit_desc_3, :benefit_3, :benefit_desc_4, :benefit_4, :benefit_desc_5, :benefit_5,
|
||||||
|
:benefit_desc_6, :benefit_6, :benefit_desc_7, :benefit_7, :benefit_desc_8, :benefit_8, :benefit_desc_9, :benefit_9, :benefit_desc_10,
|
||||||
|
:benefit_10, :benefit_desc_11, :benefit_11, :benefit_desc_12, :benefit_12, :benefit_desc_13, :benefit_13, :benefit_desc_14, :benefit_14,
|
||||||
|
:dependent_1, :dependent_2, :dependent_3, :dependent_4, :dependent_5, :dependent_6, :dependent_7, :dependent_8, :pl_plan_key, :primary_mb_member_key
|
||||||
|
)
|
||||||
|
Report::OldCardDuplicate.create(dup_attrs)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def clear_out_queue
|
||||||
|
VhcsRecord.connection.execute("
|
||||||
|
UPDATE CLDocument
|
||||||
|
SET DocStatus = 'Printed', PrintDate = GetDate()
|
||||||
|
where DocStatus <> 'Printed'
|
||||||
|
")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
module ReportsService
|
||||||
|
class EmployerCardComparisons
|
||||||
|
|
||||||
|
def initialize(pl_plan_keys)
|
||||||
|
@pl_plan_keys = Array.wrap(pl_plan_keys)
|
||||||
|
@hlid_ids_compared = []
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
@pl_plan_keys.each do |pl_plan_key|
|
||||||
|
employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||||
|
employer_card_comparison = Report::EmployerCardComparison.find_or_create_by(pl_plan_key: pl_plan_key)
|
||||||
|
employer_card_comparison.employer_name = employer.name
|
||||||
|
|
||||||
|
AutomationService::EmployerMembersUpdate.new(pl_plan_key).call
|
||||||
|
employer_member_keys = employer.employer_member_keys
|
||||||
|
IdCard::PrintData.where(pl_plan_key: pl_plan_key).destroy_all
|
||||||
|
IdCardPrinterService::CardDataFormatter.new(employer_member_keys).call
|
||||||
|
IdCard::PrintData.where(pl_plan_key: pl_plan_key, primary_mb_member_key: nil).destroy_all
|
||||||
|
|
||||||
|
new_card_member_keys = IdCard::PrintData.where(pl_plan_key: pl_plan_key).pluck(:primary_mb_member_key).uniq
|
||||||
|
old_card_member_keys = Report::OldCardDuplicate.where(pl_plan_key: pl_plan_key).pluck(:primary_mb_member_key).uniq.map(&:to_s)
|
||||||
|
|
||||||
|
missing_from_new = old_card_member_keys - new_card_member_keys
|
||||||
|
missing_from_old = new_card_member_keys - old_card_member_keys
|
||||||
|
|
||||||
|
if missing_from_new.present? || missing_from_old.present?
|
||||||
|
comp_error = employer_card_comparison.comparison_errors.find_or_create_by(card_field: "Missing Cards")
|
||||||
|
comp_error.update(new_value: missing_from_old.join(', '), old_value: missing_from_new.join(', '))
|
||||||
|
end
|
||||||
|
|
||||||
|
employer_card_comparison.new_cards_count = new_card_member_keys.count
|
||||||
|
employer_card_comparison.old_cards_count = old_card_member_keys.count
|
||||||
|
|
||||||
|
member_keys_array = new_card_member_keys | old_card_member_keys
|
||||||
|
member_keys_array.each do |member_key|
|
||||||
|
compare_member_cards(member_key, pl_plan_key, employer_card_comparison.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
employer_card_comparison.total_errors_count = employer_card_comparison.employer_total_errors
|
||||||
|
if employer_card_comparison.total_errors_count == 0
|
||||||
|
employer_card_comparison.passed = true
|
||||||
|
end
|
||||||
|
|
||||||
|
employer_card_comparison.save
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def compare_member_cards(member_pb_entity_key, pl_plan_key, employer_card_comparison_id)
|
||||||
|
member_card_comparison = Report::MemberCardComparison.find_or_create_by(member_number: member_pb_entity_key, pl_plan_key: pl_plan_key, employer_card_comparison_id: employer_card_comparison_id)
|
||||||
|
new_card = IdCard::PrintData.find_by(primary_mb_member_key: member_pb_entity_key)
|
||||||
|
old_card = Report::OldCardDuplicate.find_by(primary_mb_member_key: member_pb_entity_key)
|
||||||
|
|
||||||
|
current_errors = []
|
||||||
|
if new_card.present? && old_card.present?
|
||||||
|
new_card_common = new_card.attributes.with_indifferent_access.except(
|
||||||
|
:id, :created_at, :full_name_last_name_first, :network_provider, :plan_id,
|
||||||
|
:network_logo_filename, :employer_logo_filename, :sample_plan_title, :jasper_batch_id, :updated_at,
|
||||||
|
:dependent_1, :dependent_2, :dependent_3, :dependent_4, :dependent_5, :dependent_6, :dependent_7, :dependent_8,
|
||||||
|
:precert_1, :precert_2, :precert_3, :precert_4
|
||||||
|
)
|
||||||
|
new_card_common.delete_if { |key, value| key.match?(/[[:upper:]]/) }
|
||||||
|
|
||||||
|
new_card_dependents = new_card.attributes.with_indifferent_access.slice(
|
||||||
|
:dependent_1, :dependent_2, :dependent_3, :dependent_4, :dependent_5, :dependent_6, :dependent_7, :dependent_8
|
||||||
|
)
|
||||||
|
new_card_dependents.delete_if { |key, value| key.match?(/[[:upper:]]/) }
|
||||||
|
|
||||||
|
new_card_dental = new_card[:dental_coverage]
|
||||||
|
new_card_eff_date = new_card[:medical_eff_date]
|
||||||
|
|
||||||
|
old_card_common = old_card.attributes.with_indifferent_access.except(
|
||||||
|
:id, :created_at, :updated_at, :dental_coverage, :medical_eff_date,
|
||||||
|
:dependent_1, :dependent_2, :dependent_3, :dependent_4, :dependent_5, :dependent_6, :dependent_7, :dependent_8,
|
||||||
|
:precert_1, :precert_2, :precert_3, :precert_4
|
||||||
|
)
|
||||||
|
if pl_plan_key = '2'
|
||||||
|
old_card_common.except!(
|
||||||
|
:benefit_desc_1, :benefit_1, :benefit_desc_2, :benefit_2, :benefit_desc_3, :benefit_3,
|
||||||
|
:benefit_desc_4, :benefit_4, :benefit_desc_5, :benefit_5, :benefit_desc_6, :benefit_6, :benefit_desc_7, :benefit_7, :benefit_desc_8, :benefit_8,
|
||||||
|
:benefit_desc_9, :benefit_9, :benefit_desc_10, :benefit_10, :benefit_desc_11, :benefit_11, :benefit_desc_12, :benefit_12, :benefit_desc_13, :benefit_13,
|
||||||
|
:benefit_desc_14, :benefit_14
|
||||||
|
)
|
||||||
|
end
|
||||||
|
old_card_common.delete_if { |key, value| key.match?(/[[:upper:]]/) }
|
||||||
|
|
||||||
|
old_card_dependents = old_card.attributes.with_indifferent_access.slice(
|
||||||
|
:dependent_1, :dependent_2, :dependent_3, :dependent_4, :dependent_5, :dependent_6, :dependent_7, :dependent_8
|
||||||
|
)
|
||||||
|
old_card_dependents.delete_if { |key, value| key.match?(/[[:upper:]]/) }
|
||||||
|
|
||||||
|
old_card_dental = old_card[:dental_coverage]
|
||||||
|
old_card_eff_date = old_card[:medical_eff_date]
|
||||||
|
|
||||||
|
old_card_common.each do |key, value|
|
||||||
|
unless new_card_common[key].to_s.downcase.squish.gsub(/\W/, ' ') == value.to_s.downcase.squish.gsub(/\W/, ' ')
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: key.to_s)
|
||||||
|
comp_error.assign_attributes(new_value: new_card_common[key], old_value: value)
|
||||||
|
current_errors << comp_error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unless old_card_dependents.values.map(&:squish).sort == new_card_dependents.values.map(&:squish).sort
|
||||||
|
missing_from_new = (old_card_dependents.values - new_card_dependents.values).compact_blank
|
||||||
|
missing_from_old = (new_card_dependents.values - old_card_dependents.values).compact_blank
|
||||||
|
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: "Missing Dependent(s)")
|
||||||
|
comp_error.assign_attributes(new_value: missing_from_old.join(', '), old_value: missing_from_new.join(', '))
|
||||||
|
current_errors << comp_error
|
||||||
|
end
|
||||||
|
|
||||||
|
unless (new_card_dental == old_card_dental) || (old_card_dental == "NONE" && new_card_dental.empty?)
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: "dental_coverage")
|
||||||
|
comp_error.assign_attributes(new_value: new_card_dental, old_value: old_card_dental)
|
||||||
|
current_errors << comp_error
|
||||||
|
end
|
||||||
|
|
||||||
|
unless (old_card_eff_date.present?) || (convert_to_date(new_card_eff_date) == convert_to_date(old_card_eff_date))
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: "medical_eff_date")
|
||||||
|
comp_error.assign_attributes(new_value: new_card_eff_date, old_value: old_card_eff_date)
|
||||||
|
current_errors << comp_error
|
||||||
|
end
|
||||||
|
else
|
||||||
|
comp_error = member_card_comparison.comparison_errors.find_or_create_by(card_field: "Missing Member")
|
||||||
|
|
||||||
|
comp_error.assign_attributes(
|
||||||
|
new_value: new_card.presence&.primary_mb_member_key || "Missing",
|
||||||
|
old_value: old_card.presence&.primary_mb_member_key || "Missing"
|
||||||
|
)
|
||||||
|
current_errors << comp_error
|
||||||
|
end
|
||||||
|
member_card_comparison.comparison_errors = current_errors
|
||||||
|
if current_errors.empty?
|
||||||
|
member_card_comparison.passed = true
|
||||||
|
end
|
||||||
|
member_card_comparison.save
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_to_date(string_date)
|
||||||
|
string_date.presence&.then { |s| Date.strptime(s, '%m/%d/%Y') }
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<%= network_fields.select :exception_type, options_for_select(["Zip","State"]), label: { text: "Exception Type" }, prompt: "Select Type", class: "w-full" %>
|
<%= network_fields.select :exception_type, options_for_select(["Zip","State"]), label: { text: "Exception Type" }, prompt: "Select Type", class: "w-full" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<%= network_fields.text_field :exception_value, label: { text: "Exception Value" }, class: "w-full" %>
|
<%= network_fields.text_field :exception_values, label: { text: "Exception Values" }, class: "w-full" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center items-end w-full">
|
<div class="flex justify-center items-end w-full">
|
||||||
|
|||||||
@@ -60,8 +60,8 @@
|
|||||||
<span class="block w-full h-0.5 bg-copper mt-[-4]"></span>
|
<span class="block w-full h-0.5 bg-copper mt-[-4]"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col items-center space-y-6 w-full">
|
<div class="flex flex-col items-center space-y-6 w-full">
|
||||||
<%= link_to 'Sync Employer with VHCS', generate_sample_id_card_print_path(id: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-brightlava hover:bg-deepcove border-2 border-brightlava text-platinum text-lg font-bold px-3 rounded-lg h-10 transition duration-100" %>
|
<%= link_to 'Sync Employer with VHCS', refresh_employer_information_employers_path(id: @employer.id), data: { turbo: false }, class: "flex justify-center items-center w-full cursor-pointer bg-brightlava hover:bg-deepcove border-2 border-brightlava text-platinum text-lg font-bold px-3 rounded-lg h-10 transition duration-100" %>
|
||||||
<%= link_to 'Sync Members with VHCS', generate_print_id_card_print_path(id: @employer.slug),data: { turbo: false }, class: "flex justify-center items-center w-full bg-brightlava hover:bg-deepcove border-2 border-brightlava text-platinum text-lg font-bold px-3 rounded-lg h-10 transition duration-100" %>
|
<%= link_to 'Sync Members with VHCS', refresh_employer_members_information_employers_path(id: @employer.id),data: { turbo: false }, class: "flex justify-center items-center w-full bg-brightlava hover:bg-deepcove border-2 border-brightlava text-platinum text-lg font-bold px-3 rounded-lg h-10 transition duration-100" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
<% @queued.each do |qu| %>
|
<% @queued.each do |qu| %>
|
||||||
<div class="w-full flex items-center justify-between text-lg text-platinum my-1">
|
<div class="w-full flex items-center justify-between text-lg text-platinum my-1">
|
||||||
<div class="flex flex-none">
|
<div class="flex flex-none">
|
||||||
<%= qu.pl_plan_key %> -
|
|
||||||
<%= qu.employer.name %>
|
<%= qu.employer.name %>
|
||||||
(
|
(
|
||||||
<div class="mx-1 text-bronze">
|
<div class="mx-1 text-bronze">
|
||||||
@@ -32,7 +31,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="w-full flex items-center justify-between text-lg text-platinum my-1">
|
<div class="w-full flex items-center justify-between text-lg text-platinum my-1">
|
||||||
<div class="flex flex-none">
|
<div class="flex flex-none">
|
||||||
<%= nq.pl_plan_key %> -
|
|
||||||
<%= nq.employer.name %>
|
<%= nq.employer.name %>
|
||||||
(
|
(
|
||||||
<div class="mx-1 text-verdigris-vivid">
|
<div class="mx-1 text-verdigris-vivid">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="flex flex-col items-start space-y-3 w-[42%] hidden exception-item" data-controller="logo-upload" data-logo-upload-logo-type-value="network">
|
<div class="flex flex-col items-start space-y-3 w-[42%] hidden exception-item" data-controller="logo-upload" data-logo-upload-logo-type-value="network">
|
||||||
<div class="flex w-full">
|
<div class="flex w-full">
|
||||||
<div class="flex flex-col w-full">
|
<div class="flex flex-col w-full">
|
||||||
<%= exception_item_fields.select :network_logo_id, options_for_select(IdCard::NetworkLogo.pluck(:filename, :id)), { include_blank: "Select/Add Network Logo", class: "rounded-r-none flex flex-col" }, data: { exceptions_toggle_target: "dependentField", parent_value: "network_logo", logo_upload_target: "logoIdField", action: "change->logo-upload#setSelectPreview" } %>
|
<%= exception_item_fields.select :network_logo_id, options_for_select(IdCard::NetworkLogo.order(:filename).pluck(:filename, :id), exception_item_fields.object.network_logo_id), { include_blank: "Select/Add Network Logo", class: "rounded-r-none flex flex-col" }, data: { exceptions_toggle_target: "dependentField", parent_value: "network_logo", logo_upload_target: "logoIdField", action: "change->logo-upload#setSelectPreview" } %>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center justify-center self-end cursor-pointer bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-r h-10 transition duration-100">
|
<div class="flex items-center justify-center self-end cursor-pointer bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-r h-10 transition duration-100">
|
||||||
<label for="network_logo_file" class="text-center cursor-pointer">
|
<label for="network_logo_file" class="text-center cursor-pointer">
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<h1 class="text-platinum">ID Card Exceptions:</h1>
|
<h1 class="text-platinum">ID Card Exceptions:</h1>
|
||||||
<h1 class="text-atmosphere">(<%= @employer.name %>)</h1>
|
<h1 class="text-atmosphere">(<%= @employer.name %>)</h1>
|
||||||
</div>
|
</div>
|
||||||
<%= form_with model: @setup, url: update_field_exceptions_employer_id_card_setup_index_path(@employer.slug), local: true, multipart: true do |f| %>
|
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
|
<%= form_with model: @setup, url: update_field_exceptions_employer_id_card_setup_index_path(@employer.slug), local: true, multipart: true do |f| %>
|
||||||
<div class="w-full flex pb-10">
|
<div class="w-full flex pb-10">
|
||||||
<div class="flex flex-wrap w-full justify-start space-y-12 my-8" data-controller="add-exception" data-add-exception-form-color-value="<%= IdCard::Setup::FORM_COLORS.to_json %>">
|
<div class="flex flex-wrap w-full justify-start space-y-12 my-8" data-controller="add-exception" data-add-exception-form-color-value="<%= IdCard::Setup::FORM_COLORS.to_json %>">
|
||||||
<% @setup.field_exceptions.each_with_index do |exc, index| %>
|
<% @setup.field_exceptions.each_with_index do |exc, index| %>
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
<div class="flex flex-col pr-6 w-1/2">
|
<div class="flex flex-col pr-6 w-1/2">
|
||||||
<div class="flex justify-between items-end w-full pb-2">
|
<div class="flex justify-between items-end w-full pb-2">
|
||||||
<div class="w-[48%]">
|
<div class="w-[48%]">
|
||||||
<%= exception_fields.select :exception_type, options_for_select(IdCard::FieldException::VALID_TYPES.map { |type| [type.titleize(keep_id_suffix: true), type] }), { label: { text: "Exception Based On" }, prompt: "Select Type", class: "w-full" }, data: { add_exception_target: "exception" } %>
|
<%= exception_fields.select :exception_type, options_for_select(IdCard::FieldException::VALID_TYPES.map { |type| [type.titleize(keep_id_suffix: true), type]}, exc.exception_type), { label: { text: "Exception Based On" }, prompt: "Select Type", class: "w-full" }, data: { add_exception_target: "exception" } %>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-[48%]">
|
<div class="w-[48%]">
|
||||||
<%= exception_fields.text_field :exception_value, label: { text: "Exception Value" }, class: "w-full" %>
|
<%= exception_fields.text_field :exception_values, value: exc.exception_values.join(', '), label: { text: "Exception Values" }, class: "w-full" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xl text-left font-bold mb-[-4px] z-1 text-platinum">
|
<div class="text-xl text-left font-bold mb-[-4px] z-1 text-platinum">
|
||||||
@@ -62,12 +62,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= button_tag "Add an Exception", class: "cursor-pointer text-lg font-medium py-2 px-4 rounded w-1/2 h-4/5 mt-3 text-[#E0E0E0] rounded-lg border border-[#C2C2C2] hover:shadow-[0_0_10px_3px_#93c5fd]", data: { action: "add-exception#addExemption", add_exception_target: "exceptionButton" } %>
|
<%= button_tag "Add an Exception", class: "cursor-pointer text-lg font-medium py-2 px-4 rounded w-1/2 min-h-[340px] mt-3 text-[#E0E0E0] rounded-lg border border-[#C2C2C2] hover:shadow-[0_0_10px_3px_#93c5fd]", data: { action: "add-exception#addExemption", add_exception_target: "exceptionButton" } %>
|
||||||
<template data-add-exception-target="exceptionTemplate">
|
<template data-add-exception-target="exceptionTemplate">
|
||||||
<%= f.fields_for :field_exceptions, @setup.field_exceptions.build, child_index: 'NEW_RECORD' do |exception_fields| %>
|
<%= f.fields_for :field_exceptions, @setup.field_exceptions.build, child_index: 'NEW_RECORD' do |exception_fields| %>
|
||||||
<div class="flex flex-col pr-6 w-1/2 pl-1">
|
<div class="flex flex-col pr-6 w-1/2 pl-1">
|
||||||
@@ -76,7 +75,7 @@
|
|||||||
<%= exception_fields.select :exception_type, options_for_select(IdCard::FieldException::VALID_TYPES.map { |type| [type.titleize(keep_id_suffix: true), type] }), { label: { text: "Exception Based On" }, prompt: "Select Type", class: "w-full" }, data: { add_exception_target: "exception" } %>
|
<%= exception_fields.select :exception_type, options_for_select(IdCard::FieldException::VALID_TYPES.map { |type| [type.titleize(keep_id_suffix: true), type] }), { label: { text: "Exception Based On" }, prompt: "Select Type", class: "w-full" }, data: { add_exception_target: "exception" } %>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-[48%]">
|
<div class="w-[48%]">
|
||||||
<%= exception_fields.text_field :exception_value, label: { text: "Exception Value" }, class: "w-full" %>
|
<%= exception_fields.text_field :exception_values, label: { text: "Exception Values" }, class: "w-full" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xl text-left font-bold mb-[-4px] z-1 text-platinum">
|
<div class="text-xl text-left font-bold mb-[-4px] z-1 text-platinum">
|
||||||
@@ -114,6 +113,6 @@
|
|||||||
<div class="py-8">
|
<div class="py-8">
|
||||||
<%= f.submit "Submit Network" %>
|
<%= f.submit "Submit Network" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ Rails.application.routes.draw do
|
|||||||
resources :employers do
|
resources :employers do
|
||||||
collection do
|
collection do
|
||||||
post 'import'
|
post 'import'
|
||||||
|
get 'refresh_employer_information'
|
||||||
|
get 'refresh_employer_members_information'
|
||||||
end
|
end
|
||||||
namespace :id_card do
|
namespace :id_card do
|
||||||
resources :setup, only: [:index, :update, :destroy] do
|
resources :setup, only: [:index, :update, :destroy] do
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
set :output, "./log/cron_log.log"
|
||||||
|
|
||||||
|
every 1.day, at: ['6:00 am', '6:00 pm'] do
|
||||||
|
rake "employer_automation:employer_members_update"
|
||||||
|
end
|
||||||
|
|
||||||
|
every '0,15,30,45 7-18 * * 1-5' do
|
||||||
|
rake "employer_automation:employer_update"
|
||||||
|
end
|
||||||
@@ -9,6 +9,7 @@ class CreateIdCardSetups < ActiveRecord::Migration[7.2]
|
|||||||
t.string :pl_plan_key
|
t.string :pl_plan_key
|
||||||
t.boolean :active, default: false
|
t.boolean :active, default: false
|
||||||
t.boolean :has_divisions, default: false
|
t.boolean :has_divisions, default: false
|
||||||
|
t.boolean :has_dental, default: false
|
||||||
t.belongs_to :employer, null: false, foreign_key: true
|
t.belongs_to :employer, null: false, foreign_key: true
|
||||||
t.belongs_to :employer_logo, null: true, foreign_key: { to_table: :id_card_employer_logos }
|
t.belongs_to :employer_logo, null: true, foreign_key: { to_table: :id_card_employer_logos }
|
||||||
t.belongs_to :network_logo, null: true, foreign_key: { to_table: :id_card_network_logos }
|
t.belongs_to :network_logo, null: true, foreign_key: { to_table: :id_card_network_logos }
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class CreateIdCardPrintData < ActiveRecord::Migration[7.0]
|
|||||||
t.string :full_name
|
t.string :full_name
|
||||||
t.string :rx_group
|
t.string :rx_group
|
||||||
t.string :medical_eff_date
|
t.string :medical_eff_date
|
||||||
|
t.string :dental_coverage
|
||||||
t.string :network_provider
|
t.string :network_provider
|
||||||
t.string :provider_line_1
|
t.string :provider_line_1
|
||||||
t.string :provider_line_2
|
t.string :provider_line_2
|
||||||
@@ -74,11 +75,12 @@ 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.integer :network_logo_id
|
t.string :precert_1
|
||||||
|
t.string :precert_2
|
||||||
|
t.string :precert_3
|
||||||
|
t.string :precert_4
|
||||||
t.string :network_logo_filename
|
t.string :network_logo_filename
|
||||||
t.string :employer_logo_filename
|
t.string :employer_logo_filename
|
||||||
t.boolean :sample, default: false
|
|
||||||
t.string :sample_key
|
|
||||||
t.string :sample_plan_title
|
t.string :sample_plan_title
|
||||||
t.string :jasper_batch_id
|
t.string :jasper_batch_id
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ class CreateMembers < ActiveRecord::Migration[7.2]
|
|||||||
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 :id_card_display_name
|
||||||
|
t.string :coverage_class
|
||||||
t.string :division
|
t.string :division
|
||||||
|
t.string :dental_plan_key
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class CreateIdCardFieldExceptions < ActiveRecord::Migration[7.2]
|
|||||||
def change
|
def change
|
||||||
create_table :id_card_field_exceptions do |t|
|
create_table :id_card_field_exceptions do |t|
|
||||||
t.string :exception_type
|
t.string :exception_type
|
||||||
t.string :exception_value
|
t.string :exception_values
|
||||||
t.belongs_to :setup, null: false, foreign_key: { to_table: :id_card_setups }
|
t.belongs_to :setup, null: false, foreign_key: { to_table: :id_card_setups }
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
class CreateReportEmployerCardComparisons < ActiveRecord::Migration[7.2]
|
||||||
|
def change
|
||||||
|
create_table :report_employer_card_comparisons do |t|
|
||||||
|
t.string :employer_name
|
||||||
|
t.string :pl_plan_key
|
||||||
|
t.integer :new_cards_count
|
||||||
|
t.integer :old_cards_count
|
||||||
|
t.integer :total_errors_count
|
||||||
|
t.boolean :passed, default: false
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
class CreateReportMemberCardComparisons < ActiveRecord::Migration[7.2]
|
||||||
|
def change
|
||||||
|
create_table :report_member_card_comparisons do |t|
|
||||||
|
t.integer :member_number
|
||||||
|
t.string :pl_plan_key
|
||||||
|
t.boolean :passed, default: false
|
||||||
|
t.belongs_to :employer_card_comparison, null: true, foreign_key: { to_table: :report_employer_card_comparisons }
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
class CreateReportComparisonErrors < ActiveRecord::Migration[7.2]
|
||||||
|
def change
|
||||||
|
create_table :report_comparison_errors do |t|
|
||||||
|
t.string :card_field
|
||||||
|
t.string :new_value
|
||||||
|
t.string :old_value
|
||||||
|
t.boolean :disabled, default: false
|
||||||
|
t.belongs_to :employer_card_comparison, null: true, foreign_key: { to_table: :report_employer_card_comparisons }
|
||||||
|
t.belongs_to :member_card_comparison, null: true, foreign_key: { to_table: :report_member_card_comparisons }
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
class CreateReportOldCardDuplicates < ActiveRecord::Migration[7.2]
|
||||||
|
def change
|
||||||
|
create_table :report_old_card_duplicates do |t|
|
||||||
|
t.string :employer_name
|
||||||
|
t.string :full_name
|
||||||
|
t.string :group_number
|
||||||
|
t.string :medical_eff_date
|
||||||
|
t.string :dental_coverage
|
||||||
|
t.string :provider_line_1
|
||||||
|
t.string :provider_line_2
|
||||||
|
t.string :provider_line_3
|
||||||
|
t.string :provider_line_4
|
||||||
|
t.string :provider_line_5
|
||||||
|
t.string :provider_line_6
|
||||||
|
t.string :provider_line_7
|
||||||
|
t.string :provider_line_8
|
||||||
|
t.string :provider_line_9
|
||||||
|
t.string :provider_line_10
|
||||||
|
t.string :provider_line_11
|
||||||
|
t.string :provider_line_12
|
||||||
|
t.string :claim_to_1
|
||||||
|
t.string :claim_to_2
|
||||||
|
t.string :claim_to_3
|
||||||
|
t.string :claim_to_4
|
||||||
|
t.string :claim_to_5
|
||||||
|
t.string :claim_to_6
|
||||||
|
t.string :claim_to_7
|
||||||
|
t.string :claim_to_8
|
||||||
|
t.string :claim_to_9
|
||||||
|
t.string :claim_to_10
|
||||||
|
t.string :claim_to_11
|
||||||
|
t.string :claim_to_12
|
||||||
|
t.string :family_id
|
||||||
|
t.string :rx_group
|
||||||
|
t.string :customer_service
|
||||||
|
t.string :web_url
|
||||||
|
t.string :benefit_desc_1
|
||||||
|
t.string :benefit_1
|
||||||
|
t.string :benefit_desc_2
|
||||||
|
t.string :benefit_2
|
||||||
|
t.string :benefit_desc_3
|
||||||
|
t.string :benefit_3
|
||||||
|
t.string :benefit_desc_4
|
||||||
|
t.string :benefit_4
|
||||||
|
t.string :benefit_desc_5
|
||||||
|
t.string :benefit_5
|
||||||
|
t.string :benefit_desc_6
|
||||||
|
t.string :benefit_6
|
||||||
|
t.string :benefit_desc_7
|
||||||
|
t.string :benefit_7
|
||||||
|
t.string :benefit_desc_8
|
||||||
|
t.string :benefit_8
|
||||||
|
t.string :benefit_desc_9
|
||||||
|
t.string :benefit_9
|
||||||
|
t.string :benefit_desc_10
|
||||||
|
t.string :benefit_10
|
||||||
|
t.string :benefit_desc_11
|
||||||
|
t.string :benefit_11
|
||||||
|
t.string :benefit_desc_12
|
||||||
|
t.string :benefit_12
|
||||||
|
t.string :benefit_desc_13
|
||||||
|
t.string :benefit_13
|
||||||
|
t.string :benefit_desc_14
|
||||||
|
t.string :benefit_14
|
||||||
|
t.string :dependent_1
|
||||||
|
t.string :dependent_2
|
||||||
|
t.string :dependent_3
|
||||||
|
t.string :dependent_4
|
||||||
|
t.string :dependent_5
|
||||||
|
t.string :dependent_6
|
||||||
|
t.string :dependent_7
|
||||||
|
t.string :dependent_8
|
||||||
|
t.string :pl_plan_key
|
||||||
|
t.string :primary_mb_member_key
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddDependentsToMember < ActiveRecord::Migration[7.2]
|
||||||
|
def change
|
||||||
|
add_column :members, :dependents, :text
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
class CreateBatchProcess < ActiveRecord::Migration[7.2]
|
||||||
|
def change
|
||||||
|
create_table :batch_processes do |t|
|
||||||
|
t.integer :total_jobs, default: 0, null: false
|
||||||
|
t.integer :completed_jobs, default: 0, null: false
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
|
ActiveRecord::Schema[7.2].define(version: 2026_04_09_175359) do
|
||||||
create_table "employers", force: :cascade do |t|
|
create_table "employers", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "slug"
|
t.string "slug"
|
||||||
@@ -49,7 +49,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
|
|||||||
|
|
||||||
create_table "id_card_field_exceptions", force: :cascade do |t|
|
create_table "id_card_field_exceptions", force: :cascade do |t|
|
||||||
t.string "exception_type"
|
t.string "exception_type"
|
||||||
t.string "exception_value"
|
t.string "exception_values"
|
||||||
t.bigint "setup_id", null: false
|
t.bigint "setup_id", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
@@ -98,6 +98,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
|
|||||||
t.string "full_name"
|
t.string "full_name"
|
||||||
t.string "rx_group"
|
t.string "rx_group"
|
||||||
t.string "medical_eff_date"
|
t.string "medical_eff_date"
|
||||||
|
t.string "dental_coverage"
|
||||||
t.string "network_provider"
|
t.string "network_provider"
|
||||||
t.string "provider_line_1"
|
t.string "provider_line_1"
|
||||||
t.string "provider_line_2"
|
t.string "provider_line_2"
|
||||||
@@ -162,11 +163,12 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) 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.integer "network_logo_id"
|
t.string "precert_1"
|
||||||
|
t.string "precert_2"
|
||||||
|
t.string "precert_3"
|
||||||
|
t.string "precert_4"
|
||||||
t.string "network_logo_filename"
|
t.string "network_logo_filename"
|
||||||
t.string "employer_logo_filename"
|
t.string "employer_logo_filename"
|
||||||
t.boolean "sample", default: false
|
|
||||||
t.string "sample_key"
|
|
||||||
t.string "sample_plan_title"
|
t.string "sample_plan_title"
|
||||||
t.string "jasper_batch_id"
|
t.string "jasper_batch_id"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
@@ -239,6 +241,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
|
|||||||
t.string "pl_plan_key"
|
t.string "pl_plan_key"
|
||||||
t.boolean "active", default: false
|
t.boolean "active", default: false
|
||||||
t.boolean "has_divisions", default: false
|
t.boolean "has_divisions", default: false
|
||||||
|
t.boolean "has_dental", default: false
|
||||||
t.bigint "employer_id", null: false
|
t.bigint "employer_id", null: false
|
||||||
t.bigint "employer_logo_id"
|
t.bigint "employer_logo_id"
|
||||||
t.bigint "network_logo_id"
|
t.bigint "network_logo_id"
|
||||||
@@ -260,15 +263,128 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
|
|||||||
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 "id_card_display_name"
|
||||||
|
t.string "coverage_class"
|
||||||
t.string "division"
|
t.string "division"
|
||||||
|
t.string "dental_plan_key"
|
||||||
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
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.text "dependents"
|
||||||
t.index ["employer_id"], name: "index_members_on_employer_id"
|
t.index ["employer_id"], name: "index_members_on_employer_id"
|
||||||
t.index ["id_card_plan_id"], name: "index_members_on_id_card_plan_id"
|
t.index ["id_card_plan_id"], name: "index_members_on_id_card_plan_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "report_comparison_errors", force: :cascade do |t|
|
||||||
|
t.string "card_field"
|
||||||
|
t.string "new_value"
|
||||||
|
t.string "old_value"
|
||||||
|
t.boolean "disabled", default: false
|
||||||
|
t.bigint "employer_card_comparison_id"
|
||||||
|
t.bigint "member_card_comparison_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["employer_card_comparison_id"], name: "index_report_comparison_errors_on_employer_card_comparison_id"
|
||||||
|
t.index ["member_card_comparison_id"], name: "index_report_comparison_errors_on_member_card_comparison_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "report_employer_card_comparisons", force: :cascade do |t|
|
||||||
|
t.string "employer_name"
|
||||||
|
t.string "pl_plan_key"
|
||||||
|
t.integer "new_cards_count"
|
||||||
|
t.integer "old_cards_count"
|
||||||
|
t.integer "total_errors_count"
|
||||||
|
t.boolean "passed", default: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "report_member_card_comparisons", force: :cascade do |t|
|
||||||
|
t.integer "member_number"
|
||||||
|
t.string "pl_plan_key"
|
||||||
|
t.boolean "passed", default: false
|
||||||
|
t.bigint "employer_card_comparison_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["employer_card_comparison_id"], name: "idx_on_employer_card_comparison_id_43d268709e"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "report_old_card_duplicates", force: :cascade do |t|
|
||||||
|
t.string "employer_name"
|
||||||
|
t.string "full_name"
|
||||||
|
t.string "group_number"
|
||||||
|
t.string "medical_eff_date"
|
||||||
|
t.string "dental_coverage"
|
||||||
|
t.string "provider_line_1"
|
||||||
|
t.string "provider_line_2"
|
||||||
|
t.string "provider_line_3"
|
||||||
|
t.string "provider_line_4"
|
||||||
|
t.string "provider_line_5"
|
||||||
|
t.string "provider_line_6"
|
||||||
|
t.string "provider_line_7"
|
||||||
|
t.string "provider_line_8"
|
||||||
|
t.string "provider_line_9"
|
||||||
|
t.string "provider_line_10"
|
||||||
|
t.string "provider_line_11"
|
||||||
|
t.string "provider_line_12"
|
||||||
|
t.string "claim_to_1"
|
||||||
|
t.string "claim_to_2"
|
||||||
|
t.string "claim_to_3"
|
||||||
|
t.string "claim_to_4"
|
||||||
|
t.string "claim_to_5"
|
||||||
|
t.string "claim_to_6"
|
||||||
|
t.string "claim_to_7"
|
||||||
|
t.string "claim_to_8"
|
||||||
|
t.string "claim_to_9"
|
||||||
|
t.string "claim_to_10"
|
||||||
|
t.string "claim_to_11"
|
||||||
|
t.string "claim_to_12"
|
||||||
|
t.string "family_id"
|
||||||
|
t.string "rx_group"
|
||||||
|
t.string "customer_service"
|
||||||
|
t.string "web_url"
|
||||||
|
t.string "benefit_desc_1"
|
||||||
|
t.string "benefit_1"
|
||||||
|
t.string "benefit_desc_2"
|
||||||
|
t.string "benefit_2"
|
||||||
|
t.string "benefit_desc_3"
|
||||||
|
t.string "benefit_3"
|
||||||
|
t.string "benefit_desc_4"
|
||||||
|
t.string "benefit_4"
|
||||||
|
t.string "benefit_desc_5"
|
||||||
|
t.string "benefit_5"
|
||||||
|
t.string "benefit_desc_6"
|
||||||
|
t.string "benefit_6"
|
||||||
|
t.string "benefit_desc_7"
|
||||||
|
t.string "benefit_7"
|
||||||
|
t.string "benefit_desc_8"
|
||||||
|
t.string "benefit_8"
|
||||||
|
t.string "benefit_desc_9"
|
||||||
|
t.string "benefit_9"
|
||||||
|
t.string "benefit_desc_10"
|
||||||
|
t.string "benefit_10"
|
||||||
|
t.string "benefit_desc_11"
|
||||||
|
t.string "benefit_11"
|
||||||
|
t.string "benefit_desc_12"
|
||||||
|
t.string "benefit_12"
|
||||||
|
t.string "benefit_desc_13"
|
||||||
|
t.string "benefit_13"
|
||||||
|
t.string "benefit_desc_14"
|
||||||
|
t.string "benefit_14"
|
||||||
|
t.string "dependent_1"
|
||||||
|
t.string "dependent_2"
|
||||||
|
t.string "dependent_3"
|
||||||
|
t.string "dependent_4"
|
||||||
|
t.string "dependent_5"
|
||||||
|
t.string "dependent_6"
|
||||||
|
t.string "dependent_7"
|
||||||
|
t.string "dependent_8"
|
||||||
|
t.string "pl_plan_key"
|
||||||
|
t.string "primary_mb_member_key"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
t.bigint "job_id", null: false
|
t.bigint "job_id", null: false
|
||||||
t.string "queue_name", null: false
|
t.string "queue_name", null: false
|
||||||
@@ -403,6 +519,9 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
|
|||||||
add_foreign_key "id_card_setups", "id_card_rx_sections", column: "rx_section_id"
|
add_foreign_key "id_card_setups", "id_card_rx_sections", column: "rx_section_id"
|
||||||
add_foreign_key "members", "employers"
|
add_foreign_key "members", "employers"
|
||||||
add_foreign_key "members", "id_card_plans"
|
add_foreign_key "members", "id_card_plans"
|
||||||
|
add_foreign_key "report_comparison_errors", "report_employer_card_comparisons", column: "employer_card_comparison_id"
|
||||||
|
add_foreign_key "report_comparison_errors", "report_member_card_comparisons", column: "member_card_comparison_id"
|
||||||
|
add_foreign_key "report_member_card_comparisons", "report_employer_card_comparisons", column: "employer_card_comparison_id"
|
||||||
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
require "vips"
|
||||||
|
require "image_processing/vips"
|
||||||
|
|
||||||
def determine_id_card_templates(pl_plan_key)
|
def determine_id_card_templates(pl_plan_key)
|
||||||
case pl_plan_key
|
case pl_plan_key
|
||||||
when "2"
|
when "2"
|
||||||
@@ -42,7 +45,19 @@ def determine_id_card_network(pl_plan_key)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def determine_divisions(pl_plan_key)
|
def determine_divisions(pl_plan_key)
|
||||||
if pl_plan_key == "16"
|
division_employers = ["2", "16"]
|
||||||
|
|
||||||
|
if division_employers.include?(pl_plan_key)
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def determine_dental(pl_plan_key)
|
||||||
|
dental_employers = ["2", "3"]
|
||||||
|
|
||||||
|
if dental_employers.include?(pl_plan_key)
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
@@ -57,6 +72,111 @@ def determine_card_color(pl_plan_key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def determine_field_exceptions(pl_plan_key)
|
||||||
|
exceptions_map = {
|
||||||
|
"3" => [{
|
||||||
|
exception_type: "state",
|
||||||
|
exception_values: ["AZ", "MO", "IL"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "provider_section", provider_section_id: 3},
|
||||||
|
{field_name: "network_logo", network_logo_id: 8}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"13" => [{
|
||||||
|
exception_type: "zipcode",
|
||||||
|
exception_values: ["14422", "14623", "14624"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "network_logo", network_logo_id: 3}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"16" => [{
|
||||||
|
exception_type: "state",
|
||||||
|
exception_values: ["VA"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "medical_eff_date", field_value: "12/01/2025"},
|
||||||
|
{field_name: "provider_section", provider_section_id: 7},
|
||||||
|
{field_name: "network_logo", network_logo_id: 6}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"21" => [{
|
||||||
|
exception_type: "state",
|
||||||
|
exception_values: ["VA"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "network_logo", network_logo_id: 3}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"51" => [{
|
||||||
|
exception_type: "zipcode",
|
||||||
|
exception_values: ["41456", "41149", "41124"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "network_logo", network_logo_id: 4}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"55" => [{
|
||||||
|
exception_type: "state",
|
||||||
|
exception_values: ["CA", "GA"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "provider_section", provider_section_id: 8},
|
||||||
|
{field_name: "network_logo", network_logo_id: 5}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"62" => [
|
||||||
|
{
|
||||||
|
exception_type: "zipcode",
|
||||||
|
exception_values: ["49420", "48167"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "network_logo", network_logo_id: 2}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
exception_type: "zipcode",
|
||||||
|
exception_values: ["55419", "55379"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "network_logo", network_logo_id: 1}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"65" => [
|
||||||
|
{
|
||||||
|
exception_type: "zipcode",
|
||||||
|
exception_values: ["48430", "44842", "48649"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "network_logo", network_logo_id: 2}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
exception_type: "zipcode",
|
||||||
|
exception_values: ["55372", "55021"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "network_logo", network_logo_id: 1}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
exception_type: "zipcode",
|
||||||
|
exception_values: ["18042", "18080"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "network_logo", network_logo_id: 10}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"66" => [{
|
||||||
|
exception_type: "state",
|
||||||
|
exception_values: ["GA"],
|
||||||
|
field_exception_items_attributes: [
|
||||||
|
{field_name: "provider_section", provider_section_id: 8},
|
||||||
|
{field_name: "network_logo", network_logo_id: 5}
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
if exceptions_map[pl_plan_key].present?
|
||||||
|
exceptions_map[pl_plan_key]
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
puts "[**** IMPORT ID CARD TABLES ****]"
|
puts "[**** IMPORT ID CARD TABLES ****]"
|
||||||
|
|
||||||
## SET UP DEFAULT LEVEL360 PLANS FOR PLAN PICKER
|
## SET UP DEFAULT LEVEL360 PLANS FOR PLAN PICKER
|
||||||
@@ -160,18 +280,18 @@ Rake::Task["employer:vhcs_sync_all"].invoke
|
|||||||
|
|
||||||
##---------------- Import Employers (Word Docs) ------------------------------------
|
##---------------- Import Employers (Word Docs) ------------------------------------
|
||||||
|
|
||||||
puts "Importing Employers From Word Docs"
|
# puts "Importing Employers From Word Docs"
|
||||||
folder_path = Rails.root.join('employer_word_docs')
|
# folder_path = Rails.root.join('employer_word_docs')
|
||||||
file_names = Dir.children(folder_path)
|
# file_names = Dir.children(folder_path)
|
||||||
|
|
||||||
file_names.each do |word_doc|
|
# file_names.each do |word_doc|
|
||||||
puts "-- Processing #{word_doc}"
|
# puts "-- Processing #{word_doc}"
|
||||||
new_employer = BenefitsWordDocService::WordDocProcessor.new("employer_word_docs/#{word_doc}").call
|
# new_employer = BenefitsWordDocService::WordDocProcessor.new("employer_word_docs/#{word_doc}").call
|
||||||
if new_employer.save
|
# if new_employer.save
|
||||||
puts "Imported #{new_employer.name}"
|
# puts "Imported #{new_employer.name}"
|
||||||
end
|
# end
|
||||||
|
|
||||||
end
|
# end
|
||||||
|
|
||||||
##---------------- Update ID Card Setups------------------------------------
|
##---------------- Update ID Card Setups------------------------------------
|
||||||
|
|
||||||
@@ -180,6 +300,7 @@ IdCard::Setup.all.each do |setup|
|
|||||||
setup.card_template = determine_id_card_templates(setup.pl_plan_key)
|
setup.card_template = determine_id_card_templates(setup.pl_plan_key)
|
||||||
setup.card_color = determine_card_color(setup.pl_plan_key)
|
setup.card_color = determine_card_color(setup.pl_plan_key)
|
||||||
setup.has_divisions = determine_divisions(setup.pl_plan_key)
|
setup.has_divisions = determine_divisions(setup.pl_plan_key)
|
||||||
|
setup.has_dental = determine_dental(setup.pl_plan_key)
|
||||||
|
|
||||||
network_information = determine_id_card_network(setup.pl_plan_key)
|
network_information = determine_id_card_network(setup.pl_plan_key)
|
||||||
setup.network_provider = network_information[:provider]
|
setup.network_provider = network_information[:provider]
|
||||||
@@ -192,7 +313,7 @@ IdCard::Setup.all.each do |setup|
|
|||||||
rs = IdCard::RxSection.find_by(title: rx_title)
|
rs = IdCard::RxSection.find_by(title: rx_title)
|
||||||
setup.rx_section_id = rs.id
|
setup.rx_section_id = rs.id
|
||||||
|
|
||||||
employer_name = setup.employer.employer_trim_name
|
employer_name = Employer.employer_trim_name(setup.employer.name)
|
||||||
name_segments = employer_name.titleize.split
|
name_segments = employer_name.titleize.split
|
||||||
name_segments.each do |segment|
|
name_segments.each do |segment|
|
||||||
logo = IdCard::EmployerLogo.where("filename LIKE ?", "%#{segment}%")
|
logo = IdCard::EmployerLogo.where("filename LIKE ?", "%#{segment}%")
|
||||||
@@ -202,6 +323,14 @@ IdCard::Setup.all.each do |setup|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
card_exceptions = determine_field_exceptions(setup.pl_plan_key)
|
||||||
|
if card_exceptions.present?
|
||||||
|
setup.field_exceptions.create(card_exceptions)
|
||||||
|
# card_exceptions.each do |exc|
|
||||||
|
# setup.field_exceptions.create(exc)
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
if setup.pl_plan_key.present?
|
if setup.pl_plan_key.present?
|
||||||
setup.active = true
|
setup.active = true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
require 'csv'
|
||||||
|
require 'date'
|
||||||
|
|
||||||
|
start_date = Date.today - (364)
|
||||||
|
end_date = Date.today
|
||||||
|
|
||||||
|
random_date = Date.jd(rand(start_date.ajd..end_date.ajd))
|
||||||
|
formatted_date = random_date.strftime('%m%d')
|
||||||
|
|
||||||
|
puts formatted_date
|
||||||
|
|
||||||
|
input_file = 'tmp/BBSTPA_Med_Accum_20260218.txt'
|
||||||
|
output_file = 'tmp/sample_elig_file.csv'
|
||||||
|
captured_groups = []
|
||||||
|
|
||||||
|
# Read input, process, and write output
|
||||||
|
CSV.open(output_file, 'w', col_sep: '|') do |csv_out|
|
||||||
|
headers = CSV.foreach(input_file, col_sep: '|').first
|
||||||
|
csv_out << headers
|
||||||
|
CSV.foreach(input_file, headers: true, col_sep: '|').with_index do |row, i|
|
||||||
|
if row['Carrier Code'] == "CHAA" && !captured_groups.include?(row['Group Number'])
|
||||||
|
random_date = Date.jd(rand(start_date.ajd..end_date.ajd))
|
||||||
|
formatted_date = random_date.strftime('%m%d').to_s
|
||||||
|
dob = row['Date of Birth'].to_s.gsub(/.{4}$/, "#{formatted_date}")
|
||||||
|
|
||||||
|
row['Last Name'] = 'DOE'
|
||||||
|
row['First Name'] = 'JANE'
|
||||||
|
row['Date of Birth'] = dob
|
||||||
|
row['Social Security Number'] = '#########'
|
||||||
|
row['Subscriber Social Security Number'] = '#########'
|
||||||
|
|
||||||
|
captured_groups << row['Group Number']
|
||||||
|
csv_out << row
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace :employer_automation do
|
||||||
|
|
||||||
|
desc "Update Necessary Employer Values"
|
||||||
|
# rake employer:vhcs_sync_all
|
||||||
|
task employer_update: :environment do
|
||||||
|
Employer.missing_keychain_values.map(&:sync_with_vhcs)
|
||||||
|
Employer.missing_initial_members.map(&:sync_members_with_vhcs)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
desc "Update Employer Members"
|
||||||
|
# rake employer:import_members_from_vhcs[67]
|
||||||
|
task employer_members_update: :environment do
|
||||||
|
Employer.active.map(&:sync_members_with_vhcs)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
namespace :employer do
|
namespace :employer_pre_auto do
|
||||||
|
|
||||||
desc "TODO"
|
desc "TODO"
|
||||||
# rake employer:vhcs_sync_all
|
# rake employer:vhcs_sync_all
|
||||||
task vhcs_sync_all: :environment do
|
task vhcs_sync_all: :environment do
|
||||||
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active'"
|
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active' AND PLPlanKey NOT IN ('50','56')"
|
||||||
plan_headers = VhcsRecord.connection.select_all(sql_query)
|
plan_headers = VhcsRecord.connection.select_all(sql_query)
|
||||||
|
|
||||||
plan_headers.each do |ph|
|
plan_headers.each do |ph|
|
||||||
@@ -29,8 +29,8 @@ namespace :employer do
|
|||||||
pb_company_plan = Vhcs::PbCompanyPlans.find_by(pl_plan_key: em.pl_plan_key)
|
pb_company_plan = Vhcs::PbCompanyPlans.find_by(pl_plan_key: em.pl_plan_key)
|
||||||
em.company_pb_entity_key = pb_company_plan.company_pb_entity_key
|
em.company_pb_entity_key = pb_company_plan.company_pb_entity_key
|
||||||
|
|
||||||
card_print_name = Vhcs::PbEntity.find_by(company_pb_entity_key: em.company_pb_entity_key).last_name
|
card_print_name = Vhcs::PbEntity.where(company_pb_entity_key: em.company_pb_entity_key, entity_type_id: 1007).last.last_name
|
||||||
id_card_setup.print_name = em.employer_trim_name(card_print_name)
|
id_card_setup.print_name = card_print_name
|
||||||
|
|
||||||
em.active = true
|
em.active = true
|
||||||
|
|
||||||
@@ -70,13 +70,19 @@ namespace :employer do
|
|||||||
|
|
||||||
vw_mb_members.each_with_index do |vwm, i|
|
vw_mb_members.each_with_index do |vwm, i|
|
||||||
|
|
||||||
participation = Vhcs::PbProductParticipation.joins('INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', vwm.pb_entity_key).last
|
# participation = Vhcs::PbProductParticipation.joins('INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', vwm.pb_entity_key).last
|
||||||
|
|
||||||
if participation.present?
|
pb_products = Vhcs::PbProduct.joins('
|
||||||
in_effect = participation.in_effect
|
INNER JOIN "PBProductAvailability" ON "PBProductAvailability"."PBProductKey" = "PBProduct"."PBProductKey"
|
||||||
out_of_effect = participation.out_of_effect
|
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."PBProductAvailabilityKey" = "PBProductAvailability"."PBProductAvailabilityKey"
|
||||||
|
INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||||
|
').where('"PBCoveredEntities"."PBEntityKey" = ? AND "PBProductParticipation"."InEffect" <= ? AND "PBProductParticipation"."OutOfEffect" > ?', vwm.pb_entity_key, 1.month.from_now , 1.day.ago)
|
||||||
|
|
||||||
if in_effect <= (Date.today + 90.days) && (out_of_effect - 1.day) > Date.today && out_of_effect > in_effect
|
if pb_products.present?
|
||||||
|
# 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
|
||||||
Member.find_or_create_by!(mb_member_key: vwm.mb_member_key) do |me|
|
Member.find_or_create_by!(mb_member_key: vwm.mb_member_key) do |me|
|
||||||
me.name = vwm.full_name_last_name_first.titleize
|
me.name = vwm.full_name_last_name_first.titleize
|
||||||
me.pb_entity_key = vwm.pb_entity_key
|
me.pb_entity_key = vwm.pb_entity_key
|
||||||
@@ -96,16 +102,46 @@ namespace :employer do
|
|||||||
me.division = division
|
me.division = division
|
||||||
end
|
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 employer.id_card_setup.has_dental
|
||||||
if pb_product
|
# coverage_class = Vhcs::GenLookupTables.joins('
|
||||||
plan_pb_product_key = pb_product.pb_product_key
|
# INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."CoverageTypeCode" = "GEN_LookupTables"."RecordID"
|
||||||
if plan = IdCard::Plan.find_by(pb_product_key: plan_pb_product_key)
|
# INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||||
|
# ').where(
|
||||||
|
# '"PBCoveredEntities"."PBEntityKey" = ? AND "PBProductParticipation"."InEffect" <= ? AND "PBProductParticipation"."OutOfEffect" > ?', me.pb_entity_key, 1.month.from_now , 1.day.ago
|
||||||
|
# ).uniq.first.short_desc
|
||||||
|
# end
|
||||||
|
|
||||||
|
# pb_products = 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" = ? AND "PBProductParticipation"."InEffect" <= ? AND "PBProductParticipation"."OutOfEffect" > ?', me.pb_entity_key, 1.month.from_now , 1.day.ago)
|
||||||
|
|
||||||
|
# if pb_products
|
||||||
|
if employer.id_card_setup.has_dental
|
||||||
|
medical_pb_product_key = pb_products.where(short_description: "Medical")&.first&.pb_product_key
|
||||||
|
dental_pb_product_key = pb_products.where(short_description: "Dental")&.first&.pb_product_key
|
||||||
|
if dental_pb_product_key
|
||||||
|
me.dental_plan_key = dental_pb_product_key
|
||||||
|
|
||||||
|
coverage_class = Vhcs::GenLookupTables.joins('
|
||||||
|
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."CoverageTypeCode" = "GEN_LookupTables"."RecordID"
|
||||||
|
INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||||
|
').where(
|
||||||
|
'"PBCoveredEntities"."PBEntityKey" = ? AND "PBProductParticipation"."InEffect" <= ? AND "PBProductParticipation"."OutOfEffect" > ?', me.pb_entity_key, 1.month.from_now , 1.day.ago
|
||||||
|
).uniq.first.short_desc
|
||||||
|
me.coverage_class = coverage_class
|
||||||
|
end
|
||||||
|
else
|
||||||
|
medical_pb_product_key = pb_products.first.pb_product_key
|
||||||
|
end
|
||||||
|
if medical_pb_product_key && plan = IdCard::Plan.find_by(pb_product_key: medical_pb_product_key)
|
||||||
me.id_card_plan = plan
|
me.id_card_plan = plan
|
||||||
end
|
end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
puts "Employer #{employer.name} (#{i}/#{vw_mb_members_count}) members processed"
|
puts "Employer #{employer.name} (#{i}/#{vw_mb_members_count}) members processed"
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
# namespace :export_fes do
|
||||||
|
# desc "Export field exceptions for seed data"
|
||||||
|
# task to_seeds: :environment do
|
||||||
|
# IdCard::FieldExceptions.all.each do |fe|
|
||||||
|
# # Exclude internal metadata like ID and timestamps
|
||||||
|
# attrs = fe.attributes.except("id", "created_at", "updated_at")
|
||||||
|
|
||||||
|
# puts "User.find_or_create_by!(#{attrs})"
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# IdCard::FieldException.includes(:field_exception_items).all.as_json(
|
||||||
|
# except: [:id, :setup_id, :created_at, :updated_at],
|
||||||
|
# include: {
|
||||||
|
# field_exception_items: { except: [:id, :field_exception_id, :created_at, :updated_at] }
|
||||||
|
# }
|
||||||
|
# )
|
||||||
|
|
||||||
|
# {"exception_type" => "state",
|
||||||
|
# "exception_values" => "VA",
|
||||||
|
# "field_exception_items" =>
|
||||||
|
# [{"field_name" => "medical_eff_date", "field_value" => "12/01/2025", "provider_section_id" => nil},
|
||||||
|
# {"field_name" => "provider_section", "field_value" => "", "provider_section_id" => 7},
|
||||||
|
# {"field_name" => "network_logo", "field_value" => "", "network_logo_id" => 10, "provider_section_id" => nil}]}
|
||||||
|
|
||||||
|
|
||||||
|
# {
|
||||||
|
# "3" => [{
|
||||||
|
# "exception_type" => "state",
|
||||||
|
# "exception_values" => ["AZ", "MO", "IL"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "provider_section", "provider_section_id" => 3},
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 8}
|
||||||
|
# ]
|
||||||
|
# }],
|
||||||
|
# "13" => [{
|
||||||
|
# "exception_type" => "zipcode",
|
||||||
|
# "exception_values" => ["14422", "14623", "14624"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 3}
|
||||||
|
# ]
|
||||||
|
# }],
|
||||||
|
# "16" => [{
|
||||||
|
# "exception_type" => "state",
|
||||||
|
# "exception_values" => ["VA"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "medical_eff_date", "field_value" => "12/01/2025"},
|
||||||
|
# {"field_name" => "provider_section", "provider_section_id" => 7},
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 6}
|
||||||
|
# ]
|
||||||
|
# }],
|
||||||
|
# "21" => [{
|
||||||
|
# "exception_type" => "state",
|
||||||
|
# "exception_values" => ["VA"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 3}
|
||||||
|
# ]
|
||||||
|
# }],
|
||||||
|
# "51" => [{
|
||||||
|
# "exception_type" => "zipcode",
|
||||||
|
# "exception_values" => ["41456", "41149", "41124"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 4}
|
||||||
|
# ]
|
||||||
|
# }],
|
||||||
|
# "55" => [{
|
||||||
|
# "exception_type" => "state",
|
||||||
|
# "exception_values" => ["CA", "GA"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 5},
|
||||||
|
# {"field_name" => "provider_section", "provider_section_id" => 8}
|
||||||
|
# ]
|
||||||
|
# }],
|
||||||
|
# "62" => [
|
||||||
|
# {
|
||||||
|
# "exception_type" => "zipcode",
|
||||||
|
# "exception_values" => ["49420", "48167"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 2}
|
||||||
|
# ]
|
||||||
|
# },
|
||||||
|
# {
|
||||||
|
# "exception_type" => "zipcode",
|
||||||
|
# "exception_values" => ["55419", "55379"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 1}
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
# ],
|
||||||
|
# "65" => [
|
||||||
|
# {
|
||||||
|
# "exception_type" => "zipcode",
|
||||||
|
# "exception_values" => ["48430", "44842", "48649"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 2}
|
||||||
|
# ]
|
||||||
|
# },
|
||||||
|
# {
|
||||||
|
# "exception_type" => "zipcode",
|
||||||
|
# "exception_values" => ["55372", "55021"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 1}
|
||||||
|
# ]
|
||||||
|
# },
|
||||||
|
# {
|
||||||
|
# "exception_type" => "zipcode",
|
||||||
|
# "exception_values" => ["18042", "18080"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 10}
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
# ],
|
||||||
|
# "66" => [{
|
||||||
|
# "exception_type" => "state",
|
||||||
|
# "exception_values" => ["GA"],
|
||||||
|
# "field_exception_items" => [
|
||||||
|
# {"field_name" => "network_logo", "network_logo_id" => 5}
|
||||||
|
# ]
|
||||||
|
# }]
|
||||||
|
# }
|
||||||
@@ -0,0 +1,324 @@
|
|||||||
|
require 'json'
|
||||||
|
|
||||||
|
namespace :seed_tasks do
|
||||||
|
|
||||||
|
## Build ID Card Information Tables
|
||||||
|
|
||||||
|
desc "Build Initial Plan Templates"
|
||||||
|
# rake seed_tasks:build_plan_templates
|
||||||
|
task build_plan_templates: :environment do
|
||||||
|
puts "Importing Plan Templates"
|
||||||
|
file_path = Rails.root.join('seed_docs', 'Standard Level360 Plans.pdf')
|
||||||
|
reader = PDF::Reader.new(file_path)
|
||||||
|
pages = []
|
||||||
|
reader.pages.each do |page|
|
||||||
|
rows = []
|
||||||
|
text = page.text
|
||||||
|
lines = text.split("\n")
|
||||||
|
|
||||||
|
lines.each do |line|
|
||||||
|
cells = line.strip.split(/\s{2,}|\t/)
|
||||||
|
rows << cells if cells.size > 1
|
||||||
|
end
|
||||||
|
pages << rows
|
||||||
|
end
|
||||||
|
|
||||||
|
pages.each do |page_rows|
|
||||||
|
title_row = page_rows.first
|
||||||
|
title_row.each_with_index do |plan, index|
|
||||||
|
next if index == 0
|
||||||
|
plan_items = page_rows.map { |row| row[index] }
|
||||||
|
plan_items.shift
|
||||||
|
|
||||||
|
plan = IdCard::Plan.create!(title: plan, template: true)
|
||||||
|
doc_to_sequence_map = {
|
||||||
|
0 => 4,
|
||||||
|
1 => 5,
|
||||||
|
2 => 6,
|
||||||
|
3 => 7,
|
||||||
|
4 => 9,
|
||||||
|
5 => 10,
|
||||||
|
6 => 11,
|
||||||
|
7 => 12,
|
||||||
|
10 => 1,
|
||||||
|
11 => 2,
|
||||||
|
12 => 3,
|
||||||
|
13 => 13
|
||||||
|
}
|
||||||
|
# 9 => 8,
|
||||||
|
# 10 => 8,
|
||||||
|
plan_items.each_with_index do |item, i|
|
||||||
|
puts "-- #{item}"
|
||||||
|
sequence = doc_to_sequence_map[i]
|
||||||
|
if sequence.present?
|
||||||
|
benefit = plan.plan_benefits.find_by(sequence: sequence)
|
||||||
|
if item.start_with?("Ded.")
|
||||||
|
item = "Ded & Coin"
|
||||||
|
end
|
||||||
|
benefit.update(benefit: item)
|
||||||
|
elsif i == 8
|
||||||
|
carrier_coins = item.sub(/\/.*/, '')
|
||||||
|
member_coins = plan_items[(i+1)].sub(/\/.*/, '')
|
||||||
|
coins = "#{carrier_coins}/#{member_coins}"
|
||||||
|
benefit = plan.plan_benefits.find_by(sequence: 8)
|
||||||
|
benefit.update(benefit: coins)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build Initial Provider Sections"
|
||||||
|
# rake seed_tasks:build_provider_sections
|
||||||
|
task build_provider_sections: :environment do
|
||||||
|
puts "Importing Card Provider/Claims Information"
|
||||||
|
default_provider_codes = ["2", "5"]
|
||||||
|
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]
|
||||||
|
|
||||||
|
puts "-- #{attributes_hash[:title]}"
|
||||||
|
IdCard::ProviderSection.find_or_create_by(attributes_hash)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build Initial Rx Sections"
|
||||||
|
# rake seed_tasks:build_rx_sections
|
||||||
|
task build_rx_sections: :environment do
|
||||||
|
puts "Importing Card Rx Information"
|
||||||
|
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
|
||||||
|
|
||||||
|
puts "-- #{title}"
|
||||||
|
rx.title = title
|
||||||
|
rx.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build Initial Network Logos"
|
||||||
|
# rake seed_tasks:build_network_logos
|
||||||
|
task build_network_logos: :environment do
|
||||||
|
puts "Importing Network Logos"
|
||||||
|
folder_path = Rails.root.join('seed_docs', '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}"
|
||||||
|
file_path = folder_path.join(logo_upload)
|
||||||
|
new_logo = ImageProcessorService.new(file_path, "Network").call
|
||||||
|
if default_network_logos.include?(logo_upload)
|
||||||
|
new_logo.default = true
|
||||||
|
end
|
||||||
|
new_logo.active = true
|
||||||
|
new_logo.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build Initial Employer Logos"
|
||||||
|
# rake seed_tasks:build_employer_logos
|
||||||
|
task build_employer_logos: :environment do
|
||||||
|
puts "Importing Employer Logos"
|
||||||
|
folder_path = Rails.root.join('seed_docs', 'logo_files', 'employer')
|
||||||
|
file_names = Dir.children(folder_path)
|
||||||
|
|
||||||
|
file_names.each do |logo_upload|
|
||||||
|
puts "-- #{logo_upload}"
|
||||||
|
file_path = folder_path.join(logo_upload)
|
||||||
|
new_logo = ImageProcessorService.new(file_path, "Employer").call
|
||||||
|
new_logo.active = true
|
||||||
|
new_logo.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
## Build Entities Tables
|
||||||
|
|
||||||
|
desc "Build Initial Carriers"
|
||||||
|
# rake seed_tasks:build_carriers
|
||||||
|
task build_carriers: :environment do
|
||||||
|
puts "Importing Carriers"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build Initial Brokers"
|
||||||
|
# rake seed_tasks:build_brokers
|
||||||
|
task build_brokers: :environment do
|
||||||
|
puts "Importing Brokers"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build Initial Employers"
|
||||||
|
# rake seed_tasks:build_employers
|
||||||
|
task build_employers: :environment do
|
||||||
|
puts "Importing Employers"
|
||||||
|
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active'" # AND PLPlanKey NOT IN ('50','56')"
|
||||||
|
plan_headers = VhcsRecord.connection.select_all(sql_query)
|
||||||
|
|
||||||
|
plan_headers.each do |plan_header|
|
||||||
|
employer = UpdateEmployerJob.perform_now(plan_header['PLPlanKey'], plan_header, true)
|
||||||
|
puts "-- #{employer.name}"
|
||||||
|
# employer_plans = employer.id_card_setup.plans
|
||||||
|
vhcs_plans = Vhcs::PbProduct.where(company_pb_entity_key: employer.company_pb_entity_key, is_active: 255)
|
||||||
|
vhcs_plans.each do |vp|
|
||||||
|
# plan = employer_plans.find_by(pb_product_key: vp.pb_product_key)
|
||||||
|
# if plan.present?
|
||||||
|
# plan_titles = employer_plans.pluck(:title)
|
||||||
|
# plan_title_matcher = JaroWinkler.new(vp.short_description)
|
||||||
|
# closest_title = plan_titles.max_by { |title| plan_title_matcher.match(title) }
|
||||||
|
# plan = employer_plans.find_by(title: closest_title)
|
||||||
|
# plan.update(pb_product_key: vp.pb_product_key)
|
||||||
|
# end
|
||||||
|
plan = employer.id_card_setup.plans.find_by(pb_product_key: vp.pb_product_key)
|
||||||
|
puts "---- #{plan.title}"
|
||||||
|
# plan.update(
|
||||||
|
# title: vp.short_description,
|
||||||
|
# pl_plan_key: employer.pl_plan_key
|
||||||
|
# )
|
||||||
|
vhcs_plan_benefits = Vhcs::HlEgglestonCardBenefit.where(plan_id: plan.pb_product_key)
|
||||||
|
vhcs_plan_benefits.each do |vb|
|
||||||
|
benefit = plan.plan_benefits.find_by(sequence: vb.sequence)
|
||||||
|
benefit.update(benefit: vb.benefit)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build Initial Members"
|
||||||
|
# rake seed_tasks:build_members
|
||||||
|
task build_members: :environment do
|
||||||
|
puts "Importing Members"
|
||||||
|
Employer.all.map(&:sync_members_with_vhcs)
|
||||||
|
end
|
||||||
|
|
||||||
|
## Build Employer ID Card Setups
|
||||||
|
|
||||||
|
desc "Determine Initial Card Templates"
|
||||||
|
# rake seed_tasks:determine_card_templates
|
||||||
|
task determine_card_templates: :environment do
|
||||||
|
puts "Updating Card Templates"
|
||||||
|
IdCard::Setup.all.each do |setup|
|
||||||
|
setup_update_attrs = case setup.pl_plan_key
|
||||||
|
when "2"
|
||||||
|
{
|
||||||
|
card_template: "SmartIDCard",
|
||||||
|
card_color: "white",
|
||||||
|
rx_title: "FairosRx",
|
||||||
|
has_divisions: true,
|
||||||
|
has_dental: true
|
||||||
|
}
|
||||||
|
when "3"
|
||||||
|
{
|
||||||
|
card_template: "TandemlocIDCard",
|
||||||
|
card_color: "blue",
|
||||||
|
rx_title: "FairosRx",
|
||||||
|
has_dental: true
|
||||||
|
}
|
||||||
|
when "56"
|
||||||
|
{
|
||||||
|
card_template: "QRCodeIDCard",
|
||||||
|
card_color: "white",
|
||||||
|
rx_title: "TheHealthBus"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
card_template: "FairosRxIDCard",
|
||||||
|
card_color: "white",
|
||||||
|
rx_title: "FairosRx"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
rx_title = setup_update_attrs.delete(:rx_title)
|
||||||
|
rx_section_id = IdCard::RxSection.find_by(title: rx_title).id
|
||||||
|
setup_update_attrs.merge!(rx_section_id: rx_section_id)
|
||||||
|
|
||||||
|
setup.update(setup_update_attrs)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Determine Initial Network Fields"
|
||||||
|
# rake seed_tasks:determine_network_fields
|
||||||
|
task determine_network_fields: :environment do
|
||||||
|
puts "Updating Network Fields"
|
||||||
|
cigna_groups = ["13","20","39","48","49","51","53","54","56","58","60","61","62","65","67","68","69"]
|
||||||
|
medcost_groups = ["4","5","16","23","33","55","57","59","63","66"]
|
||||||
|
old_cigna_groups = ["19","21"]
|
||||||
|
smart_medcost = ["2"]
|
||||||
|
tan_medcost = ["3"]
|
||||||
|
|
||||||
|
IdCard::Setup.all.each do |setup|
|
||||||
|
pl_plan_key = setup.pl_plan_key
|
||||||
|
setup_update_attrs = case
|
||||||
|
when cigna_groups.include?(pl_plan_key) || pl_plan_key.blank?
|
||||||
|
{ network_provider: "Cigna", network_logo: "CignaLogo.png", provider_section: "Cigna" }
|
||||||
|
when medcost_groups.include?(pl_plan_key)
|
||||||
|
{ network_provider: "MedCost", network_logo: "MedcostLogo.png", provider_section: "MedCost" }
|
||||||
|
when old_cigna_groups.include?(pl_plan_key)
|
||||||
|
{ network_provider: "Cigna", network_logo: "CignaLogo.png", provider_section: "Cigna (Beam/Stevens)" }
|
||||||
|
when smart_medcost.include?(pl_plan_key)
|
||||||
|
{ network_provider: "MedCost", network_logo: "MedcostLogo.png", provider_section: "MedCost (smART)" }
|
||||||
|
when tan_medcost.include?(pl_plan_key)
|
||||||
|
{ network_provider: "MedCost", network_logo: "MedcostLogo.png", provider_section: "MedCost (Tandemloc)" }
|
||||||
|
end
|
||||||
|
|
||||||
|
provider_section_title = setup_update_attrs.delete(:provider_section)
|
||||||
|
provider_section_id = IdCard::ProviderSection.find_by(title: provider_section_title).id
|
||||||
|
setup_update_attrs.merge!(provider_section_id: provider_section_id)
|
||||||
|
|
||||||
|
network_logo_filename = setup_update_attrs.delete(:network_logo)
|
||||||
|
network_logo_id = IdCard::NetworkLogo.find_by(filename: network_logo_filename).id
|
||||||
|
setup_update_attrs.merge!(network_logo_id: network_logo_id)
|
||||||
|
|
||||||
|
setup.update(setup_update_attrs)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Determine Initial Employer Fields"
|
||||||
|
# rake seed_tasks:determine_employer_fields
|
||||||
|
task determine_employer_fields: :environment do
|
||||||
|
puts "Updating Employer Fields"
|
||||||
|
IdCard::Setup.all.each do |setup|
|
||||||
|
setup_update_attrs = {}
|
||||||
|
employer_name = Employer.employer_trim_name(setup.employer.name)
|
||||||
|
name_segments = employer_name.titleize.split
|
||||||
|
name_segments.each do |segment|
|
||||||
|
logo = IdCard::EmployerLogo.where("filename LIKE ?", "%#{segment}%")
|
||||||
|
if logo&.first
|
||||||
|
# setup_update_attrs.merge!(employer_logo_id: logo.first.id)
|
||||||
|
setup.employer_logo = logo.first
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
json_file_path = Rails.root.join('seed_docs', 'json_files', 'card_exceptions.json')
|
||||||
|
file_content = File.read(json_file_path)
|
||||||
|
card_exceptions_map = JSON.parse(file_content)
|
||||||
|
if card_exceptions_map[pl_plan_key].present?
|
||||||
|
setup.field_exceptions.create(card_exceptions_map[pl_plan_key])
|
||||||
|
end
|
||||||
|
|
||||||
|
setup.save
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -39,9 +39,10 @@ data_lines.index { |s| s == 'Medical Plan'}
|
|||||||
Zip::File.open('tmp/BRYAN PEST CONTROL ID CARD SET UP REVISION.docx') do |zip_file|
|
Zip::File.open('tmp/BRYAN PEST CONTROL ID CARD SET UP REVISION.docx') do |zip_file|
|
||||||
zip_file.each do |entry|
|
zip_file.each do |entry|
|
||||||
if entry.name.start_with?('word/media/') && !entry.directory?
|
if entry.name.start_with?('word/media/') && !entry.directory?
|
||||||
filename = File.basename(entry.name)
|
puts File.basename(entry.name)
|
||||||
image_data = entry.get_input_stream.read
|
puts File.extname(entry.name)
|
||||||
extracted_images << { filename: filename, data: image_data }
|
# image_data = entry.get_input_stream.read
|
||||||
|
# extracted_images << { filename: filename, data: image_data }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -75,7 +76,7 @@ process:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BenefitsWordDocProcessor.new('tmp/BRYAN PEST CONTROL ID CARD SET UP REVISION.docx').call
|
WordDocProcessor.new('tmp/BRYAN PEST CONTROL ID CARD SET UP REVISION.docx').call
|
||||||
|
|
||||||
sample_id_cards
|
sample_id_cards
|
||||||
rails g model SampleIdCard family_id:string network_image:string pl_plan_key:integer primary_mb_member_key:integer employer_name:string full_name:string medical_eff_date:string provider_code:string provider_line_1:string provider_line_2:string provider_line_3:string provider_line_4:string provider_line_5:string provider_line_6:string provider_line_7:string provider_line_8:string provider_line_9:string provider_line_10:string provider_line_11:string mail_to:string claim_to_1:string claim_to_2:string claim_to_3:string claim_to_4:string claim_to_5:string claim_to_6:string claim_to_7:string claim_to_8:string claim_to_9:string claim_to_10:string claim_to_11:string group_number:string rx_group:string customer_service:string web_url:string dependent_1:string dependent_2:string dependent_3:string dependent_4:string dependent_5:string dependent_6:string dependent_7:string dependent_8:string benefit_desc_1:string benefit_1:string benefit_desc_2:string benefit_2:string benefit_desc_3:string benefit_3:string benefit_desc_4:string benefit_4:string benefit_desc_5:string benefit_5:string benefit_desc_6:string benefit_6:string benefit_desc_7:string benefit_7:string benefit_desc_8:string benefit_8:string benefit_desc_9:string benefit_9:string benefit_desc_10:string benefit_10:string benefit_desc_11:string benefit_11:string benefit_desc_12:string benefit_12:string benefit_desc_13:string benefit_13:string benefit_desc_14:string benefit_14:string
|
rails g model SampleIdCard family_id:string network_image:string pl_plan_key:integer primary_mb_member_key:integer employer_name:string full_name:string medical_eff_date:string provider_code:string provider_line_1:string provider_line_2:string provider_line_3:string provider_line_4:string provider_line_5:string provider_line_6:string provider_line_7:string provider_line_8:string provider_line_9:string provider_line_10:string provider_line_11:string mail_to:string claim_to_1:string claim_to_2:string claim_to_3:string claim_to_4:string claim_to_5:string claim_to_6:string claim_to_7:string claim_to_8:string claim_to_9:string claim_to_10:string claim_to_11:string group_number:string rx_group:string customer_service:string web_url:string dependent_1:string dependent_2:string dependent_3:string dependent_4:string dependent_5:string dependent_6:string dependent_7:string dependent_8:string benefit_desc_1:string benefit_1:string benefit_desc_2:string benefit_2:string benefit_desc_3:string benefit_3:string benefit_desc_4:string benefit_4:string benefit_desc_5:string benefit_5:string benefit_desc_6:string benefit_6:string benefit_desc_7:string benefit_7:string benefit_desc_8:string benefit_8:string benefit_desc_9:string benefit_9:string benefit_desc_10:string benefit_10:string benefit_desc_11:string benefit_11:string benefit_desc_12:string benefit_12:string benefit_desc_13:string benefit_13:string benefit_desc_14:string benefit_14:string
|
||||||
@@ -99,7 +100,7 @@ IdCardBenefitsTemplate.where(id: IdCardBenefitsTemplate.group(:user_id).select('
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
BenefitsWordDocProcessor.new('').call
|
WordDocProcessor.new('').call
|
||||||
|
|
||||||
|
|
||||||
e_names = EmployerSetupProcess.where.not(employer_name: [nil, ""]).pluck(:employer_name).uniq
|
e_names = EmployerSetupProcess.where.not(employer_name: [nil, ""]).pluck(:employer_name).uniq
|
||||||
@@ -120,13 +121,774 @@ trimmed_e_names.each do |e_name|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
original_string = "How to chop an onion? This is a test string."
|
|
||||||
substrings_to_remove = ["to", "an", "a", "the"]
|
|
||||||
|
|
||||||
# Create a regular expression from the array of substrings,
|
case_insensitive_regex = Regexp.new(Regexp.union(substrings_to_remove).source, "i")
|
||||||
# using the | (OR) operator to match any of them.
|
|
||||||
# The `\b` word boundary ensures that "an" in "another" isn't removed.
|
|
||||||
regex = Regexp.union(substrings_to_remove.map { |s| /\b#{Regexp.escape(s)}\b/ })
|
|
||||||
|
|
||||||
# Use gsub with the regular expression to replace all occurrences with an empty string.
|
Plan.all.each do |p|
|
||||||
cleaned_string = original_string.gsub(regex, '')
|
puts p.employer_setup_process.employer_name
|
||||||
|
puts p.id
|
||||||
|
puts p.plan_benefits.map { |b| b.benefit }
|
||||||
|
end
|
||||||
|
|
||||||
|
WordDocProcessor.new('tmp/correction_2_AQUALIS HEALTH PLAN ID CARD SET UP EFF 1_1_2026 (002).docx').call
|
||||||
|
|
||||||
|
|
||||||
|
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 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 dependent_1 dependent_2 dependent_3 dependent_4 dependent_5 dependent_6 dependent_7 dependent_8
|
||||||
|
|
||||||
|
SampleIdCard.all.each do |sc|
|
||||||
|
sc.assign_blank_strings_to_unassigned_params
|
||||||
|
sc.save
|
||||||
|
end
|
||||||
|
|
||||||
|
doc = Nokogiri::XML('tmp/FairosRxSampleIDCard-Half-Print.jrxml')
|
||||||
|
|
||||||
|
file_path = 'tmp/FairosRxSampleIDCard-Half-Print.jrxml'
|
||||||
|
|
||||||
|
doc = File.open(file_path) do |f|
|
||||||
|
Nokogiri::XML(f)
|
||||||
|
end
|
||||||
|
|
||||||
|
elements_with_x = doc.xpath("//*[@x]")
|
||||||
|
|
||||||
|
VhcsRecord.connection.execute("DELETE FROM HLIDCardProvider WHERE ProviderCode = '3'")
|
||||||
|
Y = Vhcs::HlidCardProvider.where(provider_code: 'C').first.dup
|
||||||
|
Y.provider_code = "3"
|
||||||
|
Y.save
|
||||||
|
# Y.provider_line_1 = "American Healthcare Alliance"
|
||||||
|
# Y.provider_line_2 = "PO Box 26127"
|
||||||
|
# Y.provider_line_3 = "Overland Park, KS 66225"
|
||||||
|
# Y.provider_line_6 = "www.ahappo.com"
|
||||||
|
# Y.provider_line_7 = ""
|
||||||
|
# Y.provider_line_8 = ""
|
||||||
|
# Y.claim_to_1 = "American Healthcare Alliance"
|
||||||
|
# Y.claim_to_4 = "EDI# 01066"
|
||||||
|
# Y.claim_to_6 = "1.800.870.6252"
|
||||||
|
# Y.claim_to_7 = ""
|
||||||
|
# Y.claim_to_8 = ""
|
||||||
|
# Y.save
|
||||||
|
|
||||||
|
front_url = 'http://10.41.1.115:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxIDCard-Front-Print&family_id=CLASSIC%20.5K&employer_logo=Level360Logo.png&network_logo=AcentriaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF'
|
||||||
|
back_url = 'http://10.41.1.115:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxIDCard-Back-Print&family_id=Rebekah%201K&employer_logo=Level360Logo.png&network_logo=AcentriaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF'
|
||||||
|
'http://10.41.1.115:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxIDCard-Front-Print&family_id=CLASSIC%203.5K&employer_logo=Level360Logo.png&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF'
|
||||||
|
|
||||||
|
front_url = 'http://10.41.1.115:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxIDCard-Front-Print&family_id=CLASSIC%2035K&employer_logo=DermatologyAssociatesOfCoastalCarolina.png&network_logo=MedCostLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF'
|
||||||
|
back_url = 'http://10.41.1.115:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxIDCard-Back-Print&family_id=CLASSIC%2035K&employer_logo=DermatologyAssociatesOfCoastalCarolina.png&network_logo=MedCostLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF'
|
||||||
|
|
||||||
|
group_sample_cards_pdf = CombinePDF.new
|
||||||
|
card_front = SampleCard::JasperPdfGenerator.new(front_url).call
|
||||||
|
card_back = SampleCard::JasperPdfGenerator.new(back_url).call
|
||||||
|
|
||||||
|
group_sample_cards_pdf << card_front
|
||||||
|
group_sample_cards_pdf << card_back
|
||||||
|
|
||||||
|
todays_date = DateTime.current.strftime('%Y%m%d%H%M%S')
|
||||||
|
group_sample_cards_pdf.save("tmp/print_cards_testing_#{todays_date}.pdf")
|
||||||
|
|
||||||
|
be = BrittonWeb::Employers.last
|
||||||
|
e = EmployerSetupProcess.find(10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Vhcs::HlidCardProvider.where("field LIKE :prefix", prefix: "#{provider_line}%")
|
||||||
|
substring_regex = /provider_line|claim_to/
|
||||||
|
name_attributes = b.attributes.select { |attr, val| attr =~ substring_regex }.sort_by { |key, value| key.to_s.last }
|
||||||
|
|
||||||
|
def cp (start, ammount = 1)
|
||||||
|
substring_regex = /provider_line|claim_to/
|
||||||
|
b.attributes.select { |attr, val| attr =~ substring_regex }.sort_by { |key, value| key.to_s.split("_").last.to_i }
|
||||||
|
end
|
||||||
|
|
||||||
|
attributes_hash = JSON.parse(json)
|
||||||
|
zero = Vhcs::HlidCardProvider.new(attributes_hash)
|
||||||
|
|
||||||
|
CardLogoFile.all.each do |logo|
|
||||||
|
stringio_object = StringIO.new(logo.image_data)
|
||||||
|
image_type = FastImage.type(stringio_object)
|
||||||
|
puts "#{logo.filename} - #{image_type}"
|
||||||
|
end
|
||||||
|
|
||||||
|
rails g migration AddIdCardFieldsToEmployer id_card_display_name:string
|
||||||
|
rails g migration AddIdCardFieldsToMember id_card_display_name:string
|
||||||
|
|
||||||
|
Tables for ID Cards:
|
||||||
|
Values:
|
||||||
|
PBEntity div, pbe
|
||||||
|
Employer: CompanyPBEntityKey -> EmployerName
|
||||||
|
Member: PBEntityKey -> LastName, FirsdtName, MiddleName
|
||||||
|
|
||||||
|
PBEntityClaimsData pbc
|
||||||
|
Member: MBMemberKey, PBEntityKey
|
||||||
|
|
||||||
|
PBOrgUnit ou
|
||||||
|
Employer: CompanyNumber -> MbrType - maybe not needed
|
||||||
|
|
||||||
|
PBMember pbm
|
||||||
|
Member: FamilyId
|
||||||
|
|
||||||
|
GEN_LookupTables lct (PBCoveredEntities join table with PBEntityKey and PBProductParticipationKey)
|
||||||
|
Member: shortdesc -> MedicalCoverage
|
||||||
|
|
||||||
|
PBProductParticipation pp, pp1, Part
|
||||||
|
Member: InEffect, OutOfEffect -> Determine elig and provide EffectiveDate, no cache here
|
||||||
|
|
||||||
|
PBEntityAddress pbea, oua
|
||||||
|
State - Maybe uneeded
|
||||||
|
|
||||||
|
VWMBMember M
|
||||||
|
Employer: PLPlanKey
|
||||||
|
Member: PLPlanKey, PBEntityKey
|
||||||
|
|
||||||
|
HLPlanCode PC
|
||||||
|
Employer: GroupNumber, MedicalNumber, DentalNumber
|
||||||
|
|
||||||
|
PBProduct p, Prod
|
||||||
|
PBProductKey
|
||||||
|
|
||||||
|
Joins:
|
||||||
|
PBCoveredEntities ce, ce1
|
||||||
|
PBProductAvailability pa, Aval
|
||||||
|
PBAffiliation aff
|
||||||
|
|
||||||
|
select statement cepp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CardLogoFile.all.each do |clf|
|
||||||
|
image_io = StringIO.new(clf.image_data)
|
||||||
|
width, height = FastImage.size(image_io)
|
||||||
|
aspect_ratio = width.to_f / height
|
||||||
|
clf.aspect_ratio = aspect_ratio.round(2)
|
||||||
|
clf.save
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
http://localhost:8080/trunk/PdfServlet?
|
||||||
|
reportConn=BrittonConnect&
|
||||||
|
reportType=Idcards&
|
||||||
|
reportName=PrintCard&
|
||||||
|
reportTemplate=FairosRxIDCard&
|
||||||
|
family_id=015606258&
|
||||||
|
employer_logo=BryanPestControlLogo.jpg&
|
||||||
|
network_logo=CignaLogo.png&
|
||||||
|
FileType=PDF
|
||||||
|
|
||||||
|
|
||||||
|
private String employer_name;
|
||||||
|
private String full_name;
|
||||||
|
private String medical_eff_date;
|
||||||
|
private String provider_code;
|
||||||
|
private String provider_line_1;
|
||||||
|
private String provider_line_2;
|
||||||
|
private String provider_line_3;
|
||||||
|
private String provider_line_4;
|
||||||
|
private String provider_line_5;
|
||||||
|
private String provider_line_6;
|
||||||
|
private String provider_line_7;
|
||||||
|
private String provider_line_8;
|
||||||
|
private String provider_line_9;
|
||||||
|
private String provider_line_10;
|
||||||
|
private String provider_line_11;
|
||||||
|
private String claim_to_1;
|
||||||
|
private String claim_to_2;
|
||||||
|
private String claim_to_3;
|
||||||
|
private String claim_to_4;
|
||||||
|
private String claim_to_5;
|
||||||
|
private String claim_to_6;
|
||||||
|
private String claim_to_7;
|
||||||
|
private String claim_to_8;
|
||||||
|
private String claim_to_9;
|
||||||
|
private String claim_to_10;
|
||||||
|
private String claim_to_11;
|
||||||
|
private String family_id;
|
||||||
|
private String group_number;
|
||||||
|
private String rx_group;
|
||||||
|
private String customer_service;
|
||||||
|
private String web_url;
|
||||||
|
private String dependent_1;
|
||||||
|
private String dependent_2;
|
||||||
|
private String dependent_3;
|
||||||
|
private String dependent_4;
|
||||||
|
private String dependent_5;
|
||||||
|
private String dependent_6;
|
||||||
|
private String benefit_desc_1;
|
||||||
|
private String benefit_1;
|
||||||
|
private String benefit_desc_2;
|
||||||
|
private String benefit_2;
|
||||||
|
private String benefit_desc_3;
|
||||||
|
private String benefit_3;
|
||||||
|
private String benefit_desc_4;
|
||||||
|
private String benefit_4;
|
||||||
|
private String benefit_desc_5;
|
||||||
|
private String benefit_5;
|
||||||
|
private String benefit_desc_6;
|
||||||
|
private String benefit_6;
|
||||||
|
private String benefit_desc_7;
|
||||||
|
private String benefit_7;
|
||||||
|
private String benefit_desc_8;
|
||||||
|
private String benefit_8;
|
||||||
|
private String benefit_desc_9;
|
||||||
|
private String benefit_9;
|
||||||
|
private String benefit_desc_10;
|
||||||
|
private String benefit_10;
|
||||||
|
private String benefit_desc_11;
|
||||||
|
private String benefit_11;
|
||||||
|
private String benefit_desc_12;
|
||||||
|
private String benefit_12;
|
||||||
|
private String benefit_desc_13;
|
||||||
|
private String benefit_13;
|
||||||
|
private String benefit_desc_14;
|
||||||
|
private String benefit_14;
|
||||||
|
private String primary_mb_member_key;
|
||||||
|
private String dependent_7;
|
||||||
|
private String dependent_8;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
plan = Vhcs::HlEgglestonCardBenefit.where(plan_id: 1180).each do |bene|
|
||||||
|
if bene.sequence == 6
|
||||||
|
bene.benefit = "$3,000"
|
||||||
|
elsif bene.sequence == 7
|
||||||
|
bene.benefit = "$6,000"
|
||||||
|
elsif bene.sequence == 9
|
||||||
|
bene.benefit = "$4,500"
|
||||||
|
elsif bene.sequence == 10
|
||||||
|
bene.benefit = "$9,000"
|
||||||
|
elsif bene.sequence == 13
|
||||||
|
bene.benefit = "$1,000 copay"
|
||||||
|
end
|
||||||
|
bene.save
|
||||||
|
end
|
||||||
|
|
||||||
|
mems.each do |member|
|
||||||
|
HLQueueIDCardByKey
|
||||||
|
CallStoredProc.new('HLQueueAllIDCardsByPlan', { PlPlanKey: "2" }).call
|
||||||
|
end
|
||||||
|
|
||||||
|
VhcsRecord.connection.execute("DELETE FROM HLIDCardProvider WHERE ProviderCode = 'Y'")
|
||||||
|
Y = Vhcs::HlidCardProvider.where(provider_code: '5').first.dup
|
||||||
|
Y.provider_code = "Y"
|
||||||
|
Y.save
|
||||||
|
|
||||||
|
CallStoredProc.new('HLGetQueuedIdCardsTPATan', { PLPlanKeys: "65", ExecuteOrDisplay: 1 }).call
|
||||||
|
CallStoredProc.new('HLGetQueuedIdCardsTPANewCount', { PLPlanKeys: "63,65,66,67" }).call
|
||||||
|
|
||||||
|
Vhcs::HlidCardEggData.where(division: "AQUALIS", ben_6: "$5,000").destroy_all
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_dependent_fields(family_id)
|
||||||
|
dependent_attributes = {}
|
||||||
|
dependents = Vhcs::HlEggIdCardDependent.where(family_id: family_id)
|
||||||
|
dependents.each do |dep|
|
||||||
|
puts "----------- DEP ------------"
|
||||||
|
dependent_attributes["dependent_#{dep.sequence_number}".to_sym] = dep.dependent_name
|
||||||
|
end
|
||||||
|
dependent_attributes
|
||||||
|
end
|
||||||
|
|
||||||
|
e.members.each do |mem|
|
||||||
|
dependents = Vhcs::HlEggIdCardDependent.where(family_id: mem.family_id)
|
||||||
|
if dependents.present?
|
||||||
|
puts mem.family_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
reprint.each do |gn|
|
||||||
|
m = Member.find_by(family_id: gn)
|
||||||
|
puts m.id_card_display_name
|
||||||
|
puts reprint.include?(m.family_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
reprint.each do |gn|
|
||||||
|
m = Member.find_by(family_id: gn).destroy
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
sql_query = "SELECT PLPlanKey, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active'"
|
||||||
|
plan_headers = VhcsRecord.connection.select_all(sql_query)
|
||||||
|
|
||||||
|
|
||||||
|
needed = %w(M T A I 2 5 8 7 1 6 3 P C V Y Z)
|
||||||
|
unneeded = []
|
||||||
|
IdCard::ProviderSection.all.each do |ps|
|
||||||
|
unless needed.include?(ps.provider_code)
|
||||||
|
unneeded.push(ps.provider_code)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
plan = Vhcs::HlEgglestonCardBenefit.where(plan_id: 1183)
|
||||||
|
|
||||||
|
a = plan[7]
|
||||||
|
a.benefit = "100%/0%"
|
||||||
|
a.save
|
||||||
|
|
||||||
|
a = plan[5]
|
||||||
|
a.benefit = "$10,000"
|
||||||
|
a.save
|
||||||
|
|
||||||
|
b = plan[6]
|
||||||
|
b.benefit = "$20,000"
|
||||||
|
b.save
|
||||||
|
|
||||||
|
c = plan[8]
|
||||||
|
c.benefit = "$5,000"
|
||||||
|
c.save
|
||||||
|
|
||||||
|
d= plan[9]
|
||||||
|
d.benefit = "$10,000"
|
||||||
|
d.save
|
||||||
|
|
||||||
|
e= plan[10]
|
||||||
|
e.benefit = "$10,000"
|
||||||
|
e.save
|
||||||
|
|
||||||
|
f= plan[11]
|
||||||
|
f.benefit = "$20,000"
|
||||||
|
f.save
|
||||||
|
|
||||||
|
b = plan[7]
|
||||||
|
b.benefit = "100%/0%"
|
||||||
|
b.save
|
||||||
|
|
||||||
|
missing_benefits = []
|
||||||
|
IdCard::PlanBenefit.where(benefit: nil, sequence: 1).each do |bene|
|
||||||
|
missing_benefits.push(bene.plan.pl_plan_key)
|
||||||
|
end
|
||||||
|
missing_benefits.uniq
|
||||||
|
|
||||||
|
Vhcs::HlEgglestonCardBenefit.where(pl_plan_key: 49)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"http://10.41.1.115:8080/trunk/IdCardsServlet?reportConn=BrittonConnect&cardTemplate=FairosRxIDCard&printType=SampleCard&family_id=CLASSIC%202K&employer_logo=BoysAndGirlsClubOfEmeraldCoastLogo.jpg&network_logo=CignaLogo.png&FileType=PDF"
|
||||||
|
|
||||||
|
|
||||||
|
$F{PLPlanKey}==4?"C:\\images\\PRFaulkLogo.jpg":
|
||||||
|
$F{PLPlanKey}==5?"C:\\images\\graceChurch.jpg":
|
||||||
|
$F{PLPlanKey}==13?"C:\\images\\ovationlogo12.jpg":
|
||||||
|
$F{PLPlanKey}==19?"C:\\images\\BeamLogo.png":
|
||||||
|
$F{PLPlanKey}==20?"C:\\images\\anewgo.png":
|
||||||
|
$F{PLPlanKey}==39?"C:\\images\\HeritagePicture2.jpg":
|
||||||
|
$F{PLPlanKey}==48?"C:\\images\\HandT.png":
|
||||||
|
$F{PLPlanKey}==49?"C:\\images\\Panhandle.jpg":
|
||||||
|
$F{PLPlanKey}==50?"C:\\images\\DeepSouth.png":
|
||||||
|
$F{PLPlanKey}==51?"C:\\images\\PalmettoLogo.png":
|
||||||
|
$F{PLPlanKey}==52?"C:\\images\\90WorksLogo.png":
|
||||||
|
$F{PLPlanKey}==53?"C:\\images\\DublinLogo.png":
|
||||||
|
$F{PLPlanKey}==54?"C:\\images\\SouthlandLogo.jpg":
|
||||||
|
$F{PLPlanKey}==58?"C:\\images\\Floralawn_Logo.png":
|
||||||
|
$F{PLPlanKey}==60?"C:\\images\\DreamCenterLogo.jpg":
|
||||||
|
$F{PLPlanKey}==65?"C:\\images\\AqualisLogo.png":
|
||||||
|
$F{PLPlanKey}==67?"C:\\images\\MedicalDataSystemsLogo.png":
|
||||||
|
|
||||||
|
$F{PLPlanKey}==4?"C:\\images\\PRFaulkLogo.jpg":
|
||||||
|
$F{PLPlanKey}==5?"C:\\images\\graceChurch.jpg":
|
||||||
|
$F{PLPlanKey}==13?"C:\\images\\ovationlogo12.jpg":
|
||||||
|
$F{PLPlanKey}==19?"C:\\images\\BeamLogo.png":
|
||||||
|
$F{PLPlanKey}==20?"C:\\images\\anewgo.png":
|
||||||
|
$F{PLPlanKey}==39?"C:\\images\\HeritagePicture2.jpg":
|
||||||
|
$F{PLPlanKey}==48?"C:\\images\\HandT.png":
|
||||||
|
$F{PLPlanKey}==49?"C:\\images\\Panhandle.jpg":
|
||||||
|
$F{PLPlanKey}==50?"C:\\images\\DeepSouth.png":
|
||||||
|
$F{PLPlanKey}==51?"C:\\images\\PalmettoLogo.png":
|
||||||
|
$F{PLPlanKey}==52?"C:\\images\\90WorksLogo.png":
|
||||||
|
$F{PLPlanKey}==53?"C:\\images\\DublinLogo.png":
|
||||||
|
$F{PLPlanKey}==54?"C:\\images\\SouthlandLogo.jpg":
|
||||||
|
$F{PLPlanKey}==60?"C:\\images\\DreamCenterLogo.jpg":
|
||||||
|
$F{PLPlanKey}==61?"C:\\images\\BryanPestControlLogo.jpg":
|
||||||
|
|
||||||
|
$F{PLPlanKey}==4?"C:\\images\\PRFaulkLogo.jpg":
|
||||||
|
$F{PLPlanKey}==5?"C:\\images\\graceChurch.jpg":
|
||||||
|
$F{PLPlanKey}==16?"C:\\images\\DeaconJonesLogo.png":
|
||||||
|
$F{PLPlanKey}==19?"C:\\images\\BeamLogo.png":
|
||||||
|
$F{PLPlanKey}==23?"C:\\images\\joyce-logo.jpg":
|
||||||
|
$F{PLPlanKey}==33?"C:\\images\\swain.jpg":
|
||||||
|
$F{PLPlanKey}==39?"C:\\images\\HeritagePicture2.jpg":
|
||||||
|
$F{PLPlanKey}==48?"C:\\images\\HandT.png":
|
||||||
|
$F{PLPlanKey}==49?"C:\\images\\Panhandle.jpg":
|
||||||
|
$F{PLPlanKey}==50?"C:\\images\\DeepSouth.png":
|
||||||
|
$F{PLPlanKey}==55?"C:\\images\\AlliedEco-GripLogo.png":
|
||||||
|
$F{PLPlanKey}==57?"C:\\images\\CommCharter.png":
|
||||||
|
$F{PLPlanKey}==59?"C:\\images\\UCCSchoolLogo.jpg":
|
||||||
|
$F{PLPlanKey}==63?"C:\\images\\JECLogo.jpg":
|
||||||
|
$F{PLPlanKey}==66?"C:\\images\\DACCLogo.jpg":
|
||||||
|
|
||||||
|
|
||||||
|
pharmavail_groups = []
|
||||||
|
employer_ppks = Employer.all.pluck(:pl_plan_key)
|
||||||
|
[1, 7, 8, 14, 11, 9, 12, 10, 113, 15, 17, 18, 34].each do |pl_plan_key|
|
||||||
|
if employer_ppks.include?(pl_plan_key.to_s)
|
||||||
|
pharmavail_groups.push(pl_plan_key)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
Vhcs::PbEntity.joins('
|
||||||
|
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
|
||||||
|
|
||||||
|
Inner Join PBCoveredEntities Ent On Ent.PBEntityKey = M.PBEntityKey
|
||||||
|
INNER JOIN PBProductParticipation pp on pp.PBProductParticipationKey=Ent.PBProductParticipationKey
|
||||||
|
# INNER JOIN PBProductAvailability pa on pa.PBProductAvailabilityKey=pp.PBProductAvailabilityKey
|
||||||
|
# INNER JOIN PBProduct p on p.PBProductKey=pa.PBProductKey
|
||||||
|
INNER JOIN PBAffiliation aff ON aff.PBAffiliationKey = pp.PBAffiliationKey
|
||||||
|
INNER JOIN PBEntity div on div.PBEntityKey=aff.ParentPBEntityKey
|
||||||
|
|
||||||
|
# INNER JOIN "PBProduct" ON "PBProduct"."ParentPBEntityKey" = "PBEntity"."PBEntityKey"
|
||||||
|
# INNER JOIN "PBProductAvailability" ON "PBProductAvailability"."PBProductKey" = "PBProduct"."PBProductKey"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
header = file_buffer.read(4)
|
||||||
|
file_buffer.rewind
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
emk = Employer.find_by(pl_plan_key: "2").employer_member_keys
|
||||||
|
IdCardPrinterService::CardsGenerator.new( emk, "PrintCard").call
|
||||||
|
|
||||||
|
IdCard::NetworkLogo.pluck(:filename, "DATALENGTH(image_data) AS length")
|
||||||
|
IdCard::NetworkLogo.order(Arel.sql("DATALENGTH(image_data) DESC"))
|
||||||
|
.pluck(:filename, Arel.sql("DATALENGTH(image_data)"))
|
||||||
|
IdCard::EmployerLogo.pluck(:filename, "DATALENGTH(image_data) AS length")
|
||||||
|
IdCard::EmployerLogo.order(Arel.sql("DATALENGTH(image_data) DESC"))
|
||||||
|
.pluck(:filename, Arel.sql("DATALENGTH(image_data)"))
|
||||||
|
|
||||||
|
|
||||||
|
IdCard::EmployerLogo.all.each do |logo|
|
||||||
|
image = Vips::Image.new_from_buffer(logo.image_data, "")
|
||||||
|
|
||||||
|
# 3. Resize based on height (width: nil keeps aspect ratio)
|
||||||
|
# Using Vips directly for efficient buffer processing
|
||||||
|
# resized_image = image.thumbnail_image(nil, height: 100)
|
||||||
|
|
||||||
|
processed_file = ImageProcessing::Vips
|
||||||
|
.source(image)
|
||||||
|
.resize_to_limit(nil, 50) # nil width = auto based on height 300
|
||||||
|
.call
|
||||||
|
|
||||||
|
new_byte_data = processed_file.read
|
||||||
|
logo.image_data = new_byte_data
|
||||||
|
logo.save
|
||||||
|
end
|
||||||
|
|
||||||
|
save_path = Rails.root.join('tmp', 'combined_result.pdf')
|
||||||
|
pdf.save save_path
|
||||||
|
|
||||||
|
|
||||||
|
# 1. Identify the 3 newest records based on your criteria
|
||||||
|
records_to_keep = IdCard::PrintData.where(jasper_batch_id: '67-1774381321').order(created_at: :desc).limit(3)
|
||||||
|
|
||||||
|
# 2. Destroy all matching records NOT in that set
|
||||||
|
IdCard::PrintData.where(jasper_batch_id: '67-1774381321').where.not(id: records_to_keep).destroy_all
|
||||||
|
|
||||||
|
|
||||||
|
batches_by_card_template = IdCard::Setup.all.group_by(&:card_template).transform_values { |setups| setups.map(&:pl_plan_key) }.values
|
||||||
|
|
||||||
|
@employer = Employer.find_by(pl_plan_key: '68')
|
||||||
|
IdCardPrinterService::CardsGenerator.new(@employer.employer_member_keys, "FullPageCard", true).call
|
||||||
|
|
||||||
|
pdf_raw_data = pdf_array.first
|
||||||
|
io = StringIO.new(pdf_array.first)
|
||||||
|
reader = PDF::Reader.new(io)
|
||||||
|
page = reader.pages.first
|
||||||
|
match_data = page.text.match(/MEMBER_LNF:([^:]*):/)
|
||||||
|
match_data = page.text.match(/Member #:/)
|
||||||
|
|
||||||
|
|
||||||
|
343909
|
||||||
|
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" = ?', 343909)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INNER JOIN GEN_LookupTables lct ON lct.RecordID = pp.CoverageTypeCode
|
||||||
|
|
||||||
|
pb_products = 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" = ? AND "PBProductParticipation"."InEffect" <= ? AND "PBProductParticipation"."OutOfEffect" > ?', 343909, 1.month.from_now , 1.day.ago)
|
||||||
|
|
||||||
|
Vhcs::GenLookupTables.joins('
|
||||||
|
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."CoverageTypeCode" = "GEN_LookupTables"."RecordID"
|
||||||
|
INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||||
|
').where(
|
||||||
|
'"PBCoveredEntities"."PBEntityKey" = ? AND "PBProductParticipation"."InEffect" <= ? AND "PBProductParticipation"."OutOfEffect" > ?', 343909, 1.month.from_now , 1.day.ago
|
||||||
|
).uniq.first.short_desc
|
||||||
|
|
||||||
|
dental_products = [1024, 1025, 1019, 1020]
|
||||||
|
P.PBProductKey = 1024 OR P.PBProductKey =1025 OR P.PBProductKey =1019 OR P.PBProductKey =1020
|
||||||
|
|
||||||
|
|
||||||
|
PBProductKey: 1019,
|
||||||
|
PBProductLineKey: 60,
|
||||||
|
TargetEntityTypeID: 1010,
|
||||||
|
CompanyPBEntityKey: 259883,
|
||||||
|
FullDescription: "Dental",
|
||||||
|
ColumnDescription: "Dental",
|
||||||
|
ShortDescription: "Dental",
|
||||||
|
PresentationFormatCode: 1213,
|
||||||
|
IsActive: 255,
|
||||||
|
UsedForHRAFSA: 0,
|
||||||
|
NonNetworkRxCoverage: 0,
|
||||||
|
WebExpressProductGroup_G10: 0,
|
||||||
|
WebExpressDescription: "",
|
||||||
|
WebExpressOEProcessingOrder: 0,
|
||||||
|
ParticipantEnrolleeTypeBitmask: 0,
|
||||||
|
InvoiceGroup_G127: 0,
|
||||||
|
WebExpressMustParticipate: 0,
|
||||||
|
SuppressOptionalAmount: false,
|
||||||
|
SuppressCoverage: false,
|
||||||
|
SuppressDescription: false,
|
||||||
|
PBProductEnrollmentGroupingKey: 0>,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pb_products = 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" = ? AND "PBProductParticipation"."InEffect" <= ?', me.pb_entity_key, 1.month.from_now)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MedcostVirginiaPlusLogo
|
||||||
|
new_logo = ImageProcessorService.new("logo_files/network/MedcostVirginiaPlusLogo.jpg", "Network").call
|
||||||
|
if default_network_logos.include?(logo_upload)
|
||||||
|
new_logo.default = true
|
||||||
|
end
|
||||||
|
new_logo.active = true
|
||||||
|
new_logo.save
|
||||||
|
|
||||||
|
|
||||||
|
va_members = []
|
||||||
|
e = Employer.find_by(pl_plan_key: '16')
|
||||||
|
e.members.each do |mem|
|
||||||
|
fev = mem.id_card_field_exception_values
|
||||||
|
if fev[:state] == "VA"
|
||||||
|
va_members.push(mem.pb_entity_key)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
abc = {
|
||||||
|
pl_plan_key: '16',
|
||||||
|
member_keys: va_members
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessIdCardDataJob.new.perform(372990, [1], true, false)
|
||||||
|
|
||||||
|
66 379430
|
||||||
|
|
||||||
|
ReportsService::CardComparisons.new('66').call
|
||||||
|
|
||||||
|
Vhcs::HlidCardEggData.destroy_all
|
||||||
|
hlid_ids_compared = []
|
||||||
|
Employer.all.pluck(:pl_plan_key).each do |pl_plan_key|
|
||||||
|
group_hlid_ids = ReportsService::CardComparisons.new(pl_plan_key).call
|
||||||
|
hlid_ids_compared.concat(group_hlid_ids)
|
||||||
|
Vhcs::HlidCardEggData.where.not(id: hlid_ids_compared).destroy_all
|
||||||
|
# CallStoredProc.new('HLQueueAllIDCardsByPlan', { PLPlanKey: pl_plan_key }).call
|
||||||
|
end
|
||||||
|
|
||||||
|
:employer_name, :full_name, :group_number, :medical_eff_date, :dental_coverage, :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,:family_id, :rx_group, :customer_service, :web_url, :benefit_desc_1,
|
||||||
|
:benefit_1, :benefit_desc_2, :benefit_2, :benefit_desc_3, :benefit_3, :benefit_desc_4, :benefit_4, :benefit_desc_5, :benefit_5,
|
||||||
|
:benefit_desc_6, :benefit_6, :benefit_desc_7, :benefit_7, :benefit_desc_8, :benefit_8, :benefit_desc_9, :benefit_9, :benefit_desc_10,
|
||||||
|
:benefit_10, :benefit_desc_11, :benefit_11, :benefit_desc_12, :benefit_12, :benefit_desc_13, :benefit_13, :benefit_desc_14, :benefit_14,
|
||||||
|
:dependent_1, :dependent_2, :dependent_3, :dependent_4, :dependent_5, :dependent_6, :dependent_7, :dependent_8, :pl_plan_key, :primary_mb_member_key
|
||||||
|
|
||||||
|
|
||||||
|
not queued - 39, 48, 49
|
||||||
|
|
||||||
|
CallStoredProc.new('HLQueueAllIDCardsByPlan', { PLPlanKey: "49" }).call
|
||||||
|
CallStoredProc.new('HLGetQueuedIdCardsTPANew', { PLPlanKeys: "39" }).call
|
||||||
|
|
||||||
|
CallStoredProc.new('HLGetQueuedIdCardMemberKeysTPA', { PLPlanKeys: "49" }).call
|
||||||
|
|
||||||
|
ReportsService::DuplicateOldCards.new(['39','48','49']).call
|
||||||
|
|
||||||
|
366312
|
||||||
|
|
||||||
|
Report::MemberCardComparison.destroy_all
|
||||||
|
Report::EmployerCardComparison.destroy_all
|
||||||
|
pl = Employer.all.pluck(:pl_plan_key) - ['39','48','49']
|
||||||
|
ReportsService::EmployerCardComparisons.new(pl).call
|
||||||
|
|
||||||
|
ReportsService::EmployerCardComparisons.new(['59', '69']).call
|
||||||
|
|
||||||
|
Report::ComparisonError.where(card_field: 'Missing Member').map { |error| error.member_card_comparison.pl_plan_key }.uniq
|
||||||
|
|
||||||
|
Report::ComparisonError.where(card_field: 'dental_coverage').map { |error| error.member_card_comparison.member_number }.uniq
|
||||||
|
|
||||||
|
queue_members = IdCardQueueService::GetQueuedMembers.new('16').call
|
||||||
|
queue_member_keys = queue_members.first[:member_keys]
|
||||||
|
member_names = Member.where(pl_plan_key: '16', pb_entity_key: queue_member_keys).pluck(:id_card_display_name)
|
||||||
|
|
||||||
|
ProcessIdCardDataJob.new.perform(366312, {}, true, true)
|
||||||
|
|
||||||
|
|
||||||
|
"JAMELL BELL", "A. D JONES", "KAREN L MALDONADO ARELLANO", "GERALD B RICHERT", "MICHAEL W FERRELL", "EMILY D COOKE", "CHASE C BROCK", "PHILLIP G PURNELL", "THOMAS Z EVANS", "CHRISTINA B ARMSTRONG", "AUSTIN G HENRY", "AUTUMN R DANN", "KARRIE KERKELA", "DERRICK L LOFTIN", "KYLE P LOWE", "DANNY P HOLLAND", "CLINT BEDNAR", "KAYLEE CHARLES", "SARAHI BANEGAS", "CHRIS FOSTER", "RONI TRULL", "TRACY STONE", "MATTHEW MOORE", "CHADI EL-AAWAR", "DAVID ROSE", "ROGELIO JIMENEZ, JR", "JOSHUA BROWN", "JOSH WILLIAMS", "STEVEN SANDERSON", "BRANDON P BERG", "JOSHUA ROHMILER", "KENNEDY JACOBS", "NELDO A SUAREZ", "DAVID WILKERSON", "RAUL SANTIBANEZ", "JASON WILSON", "BRAYAN VEGA TORRES", "KEKOA GALAZIA", "TYLER CRUMPLER"
|
||||||
|
|
||||||
|
Employer.all.each do |em|
|
||||||
|
id_card_setup = em.id_card_setup
|
||||||
|
card_print_name = Vhcs::PbEntity.where(company_pb_entity_key: em.company_pb_entity_key, entity_type_id: 1007)
|
||||||
|
.where.not("LastName LIKE ? OR LastName LIKE ? OR LastName LIKE ?", "%COBRA%", "Active", ".%")
|
||||||
|
.last.last_name[0, 41]
|
||||||
|
id_card_setup.print_name = card_print_name
|
||||||
|
id_card_setup.save
|
||||||
|
end
|
||||||
|
|
||||||
|
groups_to_fix = []
|
||||||
|
one_name_group_comps = []
|
||||||
|
Employer.where.not(pl_plan_key: ['39','48','49']).each do |em|
|
||||||
|
id_card_setup = em.id_card_setup
|
||||||
|
card_print_names = Vhcs::PbEntity.where(company_pb_entity_key: em.company_pb_entity_key, entity_type_id: 1007)
|
||||||
|
.where.not("LastName LIKE ? OR LastName LIKE ? OR LastName LIKE ?", "%COBRA%", "Active", ".%").pluck(:last_name)
|
||||||
|
if card_print_names.count > 2
|
||||||
|
# groups_to_fix << [em.pl_plan_key, card_print_names.count]
|
||||||
|
one_name_group_comps << [em.pl_plan_key, id_card_setup.print_name.squish]
|
||||||
|
else
|
||||||
|
if card_print_names.last.squish == id_card_setup.print_name.squish
|
||||||
|
one_name_group_comps << [em.pl_plan_key, card_print_names.last]
|
||||||
|
else
|
||||||
|
groups_to_fix << [em.pl_plan_key, card_print_names.last.squish, id_card_setup.print_name.squish]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
groups_to_fix
|
||||||
|
|
||||||
|
select * from PBEntity
|
||||||
|
where CompanyPBEntityKey = 328241
|
||||||
|
and EntityTypeID = 1007
|
||||||
|
|
||||||
|
"Ruby on Rails"[8, 5]
|
||||||
|
card_print_name = Vhcs::PbEntity.where(company_pb_entity_key: 328241, entity_type_id: 1007)
|
||||||
|
.where.not("LastName LIKE ? OR LastName LIKE ?", "%COBRA%", "Active")
|
||||||
|
.last.last_name[0, 41]
|
||||||
|
Vhcs::PbEntity.where("LastName LIKE ?", "DEACON JONES AUTO%")
|
||||||
|
|
||||||
|
|
||||||
|
0261611
|
||||||
|
Report::OldCardDuplicate.where(pl_plan_key: '58').update_all(group_number: '0261611')
|
||||||
|
|
||||||
|
member_number = 364149
|
||||||
|
member = Member.find_by(pb_entity_key: member_number)
|
||||||
|
ProcessIdCardDataJob.new.perform(member_number, {}, false, true)
|
||||||
|
|
||||||
|
|
||||||
|
missing_members = [382559, 382592, 382570, 382544, 382545]
|
||||||
|
extra_members = [337710, 343585, 364149]
|
||||||
|
ex_mem_info = []
|
||||||
|
extra_members.each do |member_number|
|
||||||
|
member = Member.find_by(pb_entity_key: member_number)
|
||||||
|
employer =
|
||||||
|
ex_mem_info << [member.name, member.employer.name]
|
||||||
|
end
|
||||||
|
|
||||||
|
pl.each do |plan_key|
|
||||||
|
AutomationService::EmployerMembersUpdate.new(plan_key).call
|
||||||
|
end
|
||||||
|
|
||||||
|
me = Member.find_by(pb_entity_key: 364149)
|
||||||
|
vwm = me
|
||||||
|
|
||||||
|
Vhcs::VwmbMember.find_by(pb_entity_key: 364149).pluck(:social_security_number)
|
||||||
|
|
||||||
|
no_card_emps = []
|
||||||
|
Employer.where(pl_plan_key: ['39','48','49']).each do |emp|
|
||||||
|
no_card_emps << emp.name
|
||||||
|
end
|
||||||
|
no_card_emps.split(', ')
|
||||||
|
|
||||||
|
AutomationService::EmployerMembersUpdate.new(['39','48','49']).call
|
||||||
|
|
||||||
|
|
||||||
|
@file_path = Rails.root.join('seed_docs', 'Standard Level360 Plans.pdf')
|
||||||
|
def parse_table
|
||||||
|
pages = []
|
||||||
|
|
||||||
|
reader = PDF::Reader.new(@file_path)
|
||||||
|
|
||||||
|
reader.pages.each do |page|
|
||||||
|
rows = []
|
||||||
|
# Extract text from the page
|
||||||
|
text = page.text
|
||||||
|
|
||||||
|
# Split into lines
|
||||||
|
lines = text.split("\n")
|
||||||
|
|
||||||
|
# Detect table-like lines (example: CSV-like or space-separated)
|
||||||
|
lines.each do |line|
|
||||||
|
# Example: split by multiple spaces or tabs
|
||||||
|
cells = line.strip.split(/\s{2,}|\t/)
|
||||||
|
rows << cells if cells.size > 1 # Only keep lines with multiple columns
|
||||||
|
end
|
||||||
|
pages << rows
|
||||||
|
end
|
||||||
|
|
||||||
|
plan_count = rows.first.count - 1
|
||||||
|
|
||||||
|
pages.each do |page_rows|
|
||||||
|
title_row = page_rows.first
|
||||||
|
title_row.each_with_index do |plan, index|
|
||||||
|
next if index == 0
|
||||||
|
plan_items = page_rows.map { |row| row[index] }
|
||||||
|
plan_items.shift
|
||||||
|
|
||||||
|
plan = IdCard::Plan.create!(title: plan, template: true)
|
||||||
|
doc_to_sequence_map = {
|
||||||
|
0 => 4,
|
||||||
|
1 => 5,
|
||||||
|
2 => 6,
|
||||||
|
3 => 7,
|
||||||
|
4 => 9,
|
||||||
|
5 => 10,
|
||||||
|
6 => 11,
|
||||||
|
7 => 12,
|
||||||
|
8 => 3,
|
||||||
|
11 => 1,
|
||||||
|
12 => 2,
|
||||||
|
13 => 3,
|
||||||
|
14 => 13
|
||||||
|
}
|
||||||
|
plan_items.each_with_index do |item, i|
|
||||||
|
sequence = doc_to_sequence_map[i]
|
||||||
|
if sequence.present?
|
||||||
|
benefit = plan.plan_benefits.find_by(sequence: sequence)
|
||||||
|
benefit.update(benefit: item)
|
||||||
|
elsif i == 9
|
||||||
|
carrier_coins = item.sub(/\/.*/, '')
|
||||||
|
member_coins = plan_items[(i+1)].sub(/\/.*/, '')
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
9 => 8,
|
||||||
|
10 => 8,
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
{
|
||||||
|
"3" : [{
|
||||||
|
"exception_type": "state",
|
||||||
|
"exception_values": ["AZ", "MO", "IL"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "provider_section", "provider_section_id": 3},
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 8}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"13" : [{
|
||||||
|
"exception_type": "zipcode",
|
||||||
|
"exception_values": ["14422", "14623", "14624"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 3}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"16" : [{
|
||||||
|
"exception_type": "state",
|
||||||
|
"exception_values": ["VA"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "medical_eff_date", "field_value": "12/01/2025"},
|
||||||
|
{"field_name": "provider_section", "provider_section_id": 7},
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 6}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"21" : [{
|
||||||
|
"exception_type": "state",
|
||||||
|
"exception_values": ["VA"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 3}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"51" : [{
|
||||||
|
"exception_type": "zipcode",
|
||||||
|
"exception_values": ["41456", "41149", "41124"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 4}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"55" : [{
|
||||||
|
"exception_type": "state",
|
||||||
|
"exception_values": ["CA", "GA"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "provider_section", "provider_section_id": 8},
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 5}
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"62" : [
|
||||||
|
{
|
||||||
|
"exception_type": "zipcode",
|
||||||
|
"exception_values": ["49420", "48167"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 2}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exception_type": "zipcode",
|
||||||
|
"exception_values": ["55419", "55379"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 1}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"65" : [
|
||||||
|
{
|
||||||
|
"exception_type": "zipcode",
|
||||||
|
"exception_values": ["48430", "44842", "48649"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 2}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exception_type": "zipcode",
|
||||||
|
"exception_values": ["55372", "55021"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 1}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exception_type": "zipcode",
|
||||||
|
"exception_values": ["18042", "18080"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 10}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"66" : [{
|
||||||
|
"exception_type": "state",
|
||||||
|
"exception_values": ["GA"],
|
||||||
|
"field_exception_items_attributes": [
|
||||||
|
{"field_name": "provider_section", "provider_section_id": 8},
|
||||||
|
{"field_name": "network_logo", "network_logo_id": 5}
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 871 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |