/** * Creates a 1095 record based on a MDW or Kickout record * * @param mdwSubscriber * @param wasKickout - Set to true if record came from Kickout table, false if record came from * MDW table * @param kickoutId - Only used to audit kickout records */ public void create1095Record(MecMdw mdwSubscriber, boolean wasKickout, long kickoutId) { long mec_doc_id = mecDocMapper.getMecDocMainSeq(); // mec_doc_id= mec_doc_id + 1;//TODO REMOVE THE 20310 once table is deleted. // logger.debug(seq ); // Main MecDocMain main = new MecDocMain(); main.setMec_doc_id(mec_doc_id); main.setFk_mdw_id(mdwSubscriber.getMdw_id()); generateAndInsertMecDocMain(main); ; // Sub Subscriber newSubscriber = new Subscriber(); String familyId = mdwSubscriber.getFamily_id_num(); String regionCd = mdwSubscriber.getRgn_cd(); newSubscriber.setFk_mec_doc_id(mec_doc_id); generateAndInsertMecDocSub(mdwSubscriber, newSubscriber); // dependent if (wasKickout) { // Set kickout fl for subscriber kickoutMapper.setKickoutFlag(kickoutId, MecConstants.C_FLAG); List<Kickout> kickouts = kickoutMapper.getDependentsForFamily(familyId, regionCd); for (Kickout kickout : kickouts) { generateAndInsertMecDocCovInd(mec_doc_id, new MecMdw(kickout)); kickoutMapper.setKickoutFlag(kickout.getKickout_id(), MecConstants.C_FLAG); } auditSubscriberRecord(newSubscriber, kickoutId); } else { List<MecMdw> dependents = mdwMapper.getDependentsForFamily(familyId, regionCd); for (MecMdw mdwDependent : dependents) { generateAndInsertMecDocCovInd(mec_doc_id, mdwDependent); } auditSubscriberRecord(newSubscriber); } // logger.debug("dependent size="+dependents.size()); // Audit tbl [mec doc id + mdw id] // logger.debug("main.getMec_doc_id()=="+main.getMec_doc_id()); }
/** * @param insertedRecord * @param mdwDependent * @author Eric * @comment Inserts a dependent into MecDocCovInd */ private void generateAndInsertMecDocCovInd(long mecDocId, MecMdw mdwDependent) { Dependent dependent = new Dependent(); dependent.setFirst_nm(mdwDependent.getMbr_frst_nm()); dependent.setMiddle_nm(mdwDependent.getMbr_mdl_nm()); dependent.setLast_nm(mdwDependent.getMbr_lst_nm()); dependent.setSuffix_nm(mdwDependent.getMbr_sfx()); dependent.setMrn_pfx(mdwDependent.getMrn_pfx()); dependent.setMrn(mdwDependent.getMbr_mrn()); dependent.setLast_nm(mdwDependent.getMbr_lst_nm()); updateMecDocMonths(mdwDependent, dependent); dependent.setFk_mdw_id(mdwDependent.getMdw_id()); dependent.setFk_mec_doc_id(mecDocId); dependent.setCreated_by(mecProperty.getProperty(MecConstants.CREATED_BY)); Date dob = mecUtils.parseDate( mdwDependent.getMbr_dob(), mecProperty.getProperty(MecConstants.MDW_DOB_FORMAT)); dependent.setDob(dob); dependent.setSsn(mdwDependent.getRep_ssn()); mecDocMapper.insertMecDocCovInd(dependent); }
/** * @param mdwSubscriber * @param newSubscriber * @author Eric * @comment Inserts a subscriber into MecDocSub */ private void generateAndInsertMecDocSub(MecMdw mdwSubscriber, Subscriber newSubscriber) { // TODO: check employer sponsored codes if (MecConstants.EMPLOYER_SPONSORED_PLANS.contains(mdwSubscriber.getRep_policy_ogn_cd())) { newSubscriber.setEmployer_name(mdwSubscriber.getRep_ein_emp_name()); newSubscriber.setEmployer_name2(""); newSubscriber.setEmployer_ein(mdwSubscriber.getRep_ein()); newSubscriber.setEmp_addr1(mdwSubscriber.getRep_ein_addr1()); newSubscriber.setEmp_addr2(mdwSubscriber.getRep_ein_addr2()); newSubscriber.setEmp_city(mdwSubscriber.getRep_ein_city()); newSubscriber.setEmp_state(mdwSubscriber.getRep_ein_state()); newSubscriber.setEmp_province(mdwSubscriber.getRep_ein_province()); newSubscriber.setEmp_zip(mdwSubscriber.getRep_ein_zip()); newSubscriber.setEmp_zip_4(mdwSubscriber.getRep_ein_zip_4()); newSubscriber.setEmp_country_cd(mdwSubscriber.getRep_ein_country_Cd()); newSubscriber.setEmp_country(mdwSubscriber.getRep_ein_country_name()); newSubscriber.setEmp_foreign_zip(mdwSubscriber.getRep_ein_foreign_zip_code()); } Date dob = mecUtils.parseDate( mdwSubscriber.getSbscrb_dob(), mecProperty.getProperty(MecConstants.MDW_DOB_FORMAT)); newSubscriber.setDob(dob); newSubscriber.setPolicy_origin_cd(mdwSubscriber.getRep_policy_ogn_cd()); newSubscriber.setShop_idn_num(mdwSubscriber.getRep_shop_market_id()); newSubscriber.setSsn(mdwSubscriber.getRep_ssn()); newSubscriber.setSubs_type_cd(mdwSubscriber.getSbscrb_typ_cd()); newSubscriber.setFirst_nm(mdwSubscriber.getSbscrb_frst_nm()); newSubscriber.setMiddle_nm(mdwSubscriber.getSbscrb_mdl_nm()); newSubscriber.setLast_nm(mdwSubscriber.getSbscrb_lst_nm()); newSubscriber.setSuffix_nm(mdwSubscriber.getSbscrb_sfx()); newSubscriber.setAddr1(mdwSubscriber.getSbscrb_lne_1()); newSubscriber.setAddr2(mdwSubscriber.getSbscrb_lne_2()); newSubscriber.setCity(mdwSubscriber.getSbscrb_cty_nm()); newSubscriber.setState(mdwSubscriber.getSbscrb_st_cd()); newSubscriber.setSub_province(mdwSubscriber.getSbscrb_prvnc()); newSubscriber.setZip(mdwSubscriber.getSbscrb_zip_cd()); newSubscriber.setMailzip4(mdwSubscriber.getSbscrb_zip_pls_4()); newSubscriber.setSub_country_cd(mdwSubscriber.getSbscrb_cntry_cd()); newSubscriber.setCountry(mdwSubscriber.getSbscrb_cntry_name()); newSubscriber.setSub_foreign_cd(mdwSubscriber.getSbscrb_frn_pstl_cd()); newSubscriber.setRgn_cd(mdwSubscriber.getRgn_cd()); newSubscriber.setMrn(mdwSubscriber.getSbscrb_mrn()); newSubscriber.setMrn_pfx(mdwSubscriber.getSbscrb_mrn_pfx()); newSubscriber.setFk_mdw_id(mdwSubscriber.getMdw_id()); newSubscriber.setIrs_trans_type(MecConstants.ORIGINAL_DOC); newSubscriber.setStmt_type(MecConstants.ORIGINAL_DOC); newSubscriber.setCreated_by(mecProperty.getProperty(MecConstants.CREATED_BY)); newSubscriber.setTax_year(mdwSubscriber.getTax_year()); newSubscriber.setFk_issuer_id(mdwSubscriber.getRep_kaiser_issuer_id()); // NON-COV Subscribers do not need coverage months if (mecProperty.getProperty(MecConstants.SUBSCRIBER).equals(newSubscriber.getSubs_type_cd())) { updateMecDocMonths(mdwSubscriber, newSubscriber); } try { // TODO: load region table by memory // logger.error("88888= "+mecRegions.getRegion(1)); // newRecord.setFk_region_id(regionMapper.getRegionIdByMdwCode(mdwRecord.getRgn_cd())); newSubscriber.setFk_region_id(mecRegions.getRegionIdByMdwCode(mdwSubscriber.getRgn_cd())); } catch (BindingException e) { logger.error("Error: " + e.getMessage(), e); throw e; } mecDocMapper.insertSubscriberRecord(newSubscriber); }