/** * Audits a regular mdw record consolidation * * @param insertedRecord */ private void auditSubscriberRecord(Subscriber insertedRecord) { Audit audit = new Audit(); String actionType = mecProperty.getProperty(MecConstants.DATA_CONSOLIDATED); String comment = mecProperty.getProperty(MecConstants.DATA_CREATED); String createdBy = mecProperty.getProperty(MecConstants.CREATED_BY); audit.setAction_type(actionType); audit.setComment(comment); audit.setFk_mec_doc_id(insertedRecord.getFk_mec_doc_id()); audit.setFk_mec_mdw_id(insertedRecord.getFk_mdw_id()); audit.setEvent_src(MecConstants.MEC); audit.setCreated_by(createdBy); auditMapper.insertAudit(audit); }
/** * 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 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); }