temp = IdCardBenefitsTemplate.create(title: "Testing Template") (1..14).each do |bene| IdCardBenefit.create(sequence: bene, benefit: "value_#{bene}", id_card_benefits_template: temp) end 3.times do |i| puts i end
co
ve
co
ve
co
ve
co
ve
co
ve
co
doc = Docx::Document.open('tmp/BRYAN PEST CONTROL ID CARD SET UP REVISION.docx') data_lines = doc.paragraphs.map { |p| p.to_s.strip }.reject!(&:empty?) data_lines.each_with_index do |p, i| if p.to_s.length > 1 puts "-#{i}----------------------------------------------------------" puts p end end doc.bookmarks.each_pair do |bookmark_name, bookmark_object| puts bookmark_object.text end 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.each do |entry| if entry.name.start_with?('word/media/') && !entry.directory? puts File.basename(entry.name) puts File.extname(entry.name) # image_data = entry.get_input_stream.read # extracted_images << { filename: filename, data: image_data } end end end Sitation [8,9,10,15,19,40] plan 1 [48..62] plan 2 [65..79] plan 3 [85..99] Bryan group_number employer_name effect_date logo_name plans: same as template process: { } WordDocProcessor.new('tmp/BRYAN PEST CONTROL ID CARD SET UP REVISION.docx').call 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 :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 claim_to temp = IdCardBenefitsTemplate.first seed_data = temp.attributes.except("id", "created_at", "updated_at") seed_data_bene = temp.id_card_benefits.order(:sequence).pluck(:benefit) IdCardBenefitsTemplate.find() IdCardBenefitsTemplate.where(id: IdCardBenefitsTemplate.group(:user_id).select('MAX(id)')) WordDocProcessor.new('').call e_names = EmployerSetupProcess.where.not(employer_name: [nil, ""]).pluck(:employer_name).uniq substrings_to_remove = ["health plan", "the", "inc", "llc"] regex = Regexp.union(substrings_to_remove) trimmed_e_names = e_names.map { |e_name| e_name.downcase.gsub(regex, "").squish } sql_query = "SELECT PLPlanKey, PlanId, Company FROM PLPlanHeader WHERE PLPlanKey >= 58" plan_headers = VhcsRecord.connection.select_all(sql_query) trimmed_e_names.each do |e_name| match = plan_headers.select { |ph| e_name.downcase.include?(ph["Company"].downcase) || ph["Company"].downcase.include?(e_name.downcase) } if match.present? puts match else puts "#{e_name} not matched" end end case_insensitive_regex = Regexp.new(Regexp.union(substrings_to_remove).source, "i") Plan.all.each do |p| 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