66. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/2/2019 1:06:55 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

66.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\ARS_Backend\ars_app\src\main\java\gov\va\med\ars\service\impl RfaiPopulateClaimServiceImpl.java Wed Mar 27 19:22:43 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\ARS_Backend\ars_app\src\main\java\gov\va\med\ars\service\impl RfaiPopulateClaimServiceImpl.java Fri Mar 29 17:31:20 2019 UTC

66.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 966
Changed 2 6
Inserted 0 0
Removed 0 0

66.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

66.4 Active regular expressions

No regular expressions were active.

66.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.a rs.service .impl;
  5  
  6   import jav a.math.Big Decimal;
  7   import jav a.math.Big Integer;
  8   import jav a.text.Dat eFormat;
  9   import jav a.text.Sim pleDateFor mat;
  10   import jav a.time.Loc alDateTime ;
  11   import jav a.time.Zon eId;
  12   import jav a.util.Arr ayList;
  13   import jav a.util.Arr ays;
  14   import jav a.util.Col lections;
  15   import jav a.util.Com parator;
  16   import jav a.util.Dat e;
  17   import jav a.util.Lis t;
  18   import jav a.util.Set ;
  19  
  20   import org .apache.lo gging.log4 j.LogManag er;
  21   import org .apache.lo gging.log4 j.Logger;
  22   import org .springfra mework.bea ns.factory .annotatio n.Autowire d;
  23   import org .springfra mework.dao .DataAcces sException ;
  24   import org .springfra mework.dao .DataAcces sResourceF ailureExce ption;
  25   import org .springfra mework.htt p.HttpStat us;
  26   import org .springfra mework.ste reotype.Se rvice;
  27   import org .springfra mework.tra nsaction.a nnotation. Transactio nal;
  28   import org .springfra mework.uti l.StringUt ils;
  29  
  30   import gov .va.med.ar s.constant s.ClaimSub missionCon stants;
  31   import gov .va.med.ar s.constant s.ErrorMes sages;
  32   import gov .va.med.ar s.dao.ars. IClaimSubm issionRepo sitory;
  33   import gov .va.med.ar s.dao.ars. IPayerInfo Repository ;
  34   import gov .va.med.ar s.dao.erep os.IRfaiEr eposReposi tory;
  35   import gov .va.med.ar s.dao.ewv. IRfaiEwvRe pository;
  36   import gov .va.med.ar s.dao.fpps .IRfaiFpps ClaimRepos itory;
  37   import gov .va.med.ar s.errorhan dling.Vali dationMess age;
  38   import gov .va.med.ar s.exceptio ns.EntityN otFoundExc eption;
  39   import gov .va.med.ar s.exceptio ns.Generic Exception;
  40   import gov .va.med.ar s.exceptio ns.Validat ionExcepti on;
  41   import gov .va.med.ar s.model.re sponse.Rfa iLineItemR esponse;
  42   import gov .va.med.ar s.model.re sponse.Rfa iResponse;
  43   import gov .va.med.ar s.service. IRfaiPopul ateClaimSe rvice;
  44   import gov .va.med.do main.erepo sModel.Ent ityAdtlId;
  45   import gov .va.med.do main.erepo sModel.Ent ityName;
  46   import gov .va.med.do main.ewv.E wvClaims;
  47   import gov .va.med.do main.ewv.E wvServiceL ines;
  48   import gov .va.med.do main.fee.C laim;
  49   import gov .va.med.do main.fee.C laimProced ure;
  50   import gov .va.med.do main.fee.P roviderInf o;
  51  
  52   /**
  53    * @author  
D NS     GANGAV
  54    *
  55    */
  56   @Service
  57   @Transacti onal
  58   public cla ss RfaiPop ulateClaim ServiceImp l implemen ts IRfaiPo pulateClai mService {
  59  
  60           pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(Rfai PopulateCl aimService Impl.class );
  61  
  62           @A utowired
  63           IR faiFppsCla imReposito ry rfaiFpp sRepositor y;
  64  
  65           @A utowired
  66           IR faiEreposR epository  rfaiErepos Repository ;
  67  
  68           @A utowired
  69           IR faiEwvRepo sitory rfa iEwvReposi tory;
  70  
  71           @A utowired
  72           IC laimSubmis sionReposi tory claim Submission Repository ;
  73  
  74           @A utowired
  75           IP ayerInfoRe pository p ayerInfoRe pository;
  76  
  77           Da teFormat d ateFormat  = new Simp leDateForm at("MM/dd/ yyyy");
  78  
  79           pu blic final  String ew vPayerId =  " REDACTED ";
  80           pu blic final  String fp psPayerId  = " REDACTED ";
  81           pu blic final  String pa yerName =  "Veteran's  Affairs";
  82  
  83           /*
  84            *  (non-Java doc)
  85            *  
  86            *  @see gov. va.med.ars .service.I RfaiServic e#populate RfaiInfo(j ava.lang.L ong,
  87            *  java.lang .String)
  88            * /
  89           @O verride
  90           pu blic RfaiR esponse po pulateRfai Info(BigIn teger id)
  91                             throws  Validatio nException , GenericE xception,  EntityNotF oundExcept ion {
  92                    logg er.info("I n RfaiServ iceImpl");
  93                    Rfai Response r faiRespons eResult =  null;
  94                    // R faiRespons e rfaiResp onseResult  = null;
  95                    List <Validatio nMessage>  validation Messages =  new Array List<>();
  96                    List <gov.va.me d.domain.e reposModel .Claim> eR eposClaimI nfo = null ;
  97                    bool ean status  = true;
  98                    Stri ng idNumbe r = String .valueOf(i d);
  99                    try  {
  100                             if (id Number.len gth() <= 1 5) {
  101                                      if (Stri ng.valueOf (id).lengt h() == 15)  {
  102                                               if (Intege r.valueOf( idNumber.s ubstring(4 , 7)) <= 3 66 && chec kclaimType (idNumber. substring( 7, 9))) {
  103  
  104                                                       lo gger.info( " getEwvPd iInfo() :  getting th e PDI info rmation fr om EWV");
  105                                                       Ew vClaims ew vClaimsInf o = rfaiEw vRepositor y.getEwvPd iInfo(idNu mber);
  106                                                       lo gger.debug ("getEwvPd iInfo() :  PDI inform ation from  EWV" + va lueOf(ewvC laimsInfo) );
  107                                                       lo gger.info( " getErepo sClaimInfo rmation()  : getting  the PDI in formation  from ERepo s");
  108                                                       if  (ewvClaim sInfo != n ull) {
  109                                                                eRep osClaimInf o = rfaiEr eposReposi tory
  110                                                                                  .getErep osClaimInf ormation(e wvClaimsIn fo.getEdiC laimKey()) ;
  111                                                                logg er.debug(" getEreposC laimInform ation() :  PDI inform ation from  Erepos"
  112                                                                                  + valueO f(eReposCl aimInfo));
  113                                                                rfai ResponseRe sult = get PdiClaimIn formation( ewvClaimsI nfo, eRepo sClaimInfo , id);
  114  
  115                                                                logg er.info("  Claim is s elected. S o, returni ng the Cla im informa tion");
  116                                                                logg er.debug(" Claim info rmation "  + valueOf( rfaiRespon seResult)) ;
  117                                                                rfai ResponseRe sult = add PdiLineIte mInformati on(ewvClai msInfo, rf aiResponse Result);
  118                                                       }  else {
  119                                                                logg er.error(" RfaiServic eImpl.popu lateRfaiIn fo() : exc eption occ ured for "  + id);
  120                                                                thro w new Gene ricExcepti on(ErrorMe ssages.NOT _FOUND, "E WV Claim I nformation  was not f ound for P DI of " +  id + ".",
  121                                                                                  HttpStat us.NOT_FOU ND);
  122                                                       }
  123                                               } else {
  124                                                       lo gger.error ("RfaiServ iceImpl.po pulateRfai Info() : e xception o ccured for  " + id);
  125                                                       th row new Ge nericExcep tion(Error Messages.N OT_FOUND,  "Enter a v alid numbe r",
  126                                                                         HttpSt atus.NOT_F OUND);
  127                                               }
  128                                      } else {
  129                                               logger.inf o(" getCla imInformat ion() : ge tting the  Claim info rmation fr om FPPS");
  130                                               Claim clai mInfo = rf aiFppsRepo sitory.get ClaimInfor mation(id) ;
  131                                               logger.deb ug("getCla imInformat ion() : Cl aim inform ation from  FPPS" + v alueOf(cla imInfo));
  132                                               logger.inf o(" getEre posClaimIn formation( ) : gettin g the Clai m informat ion from E Repos");
  133                                               if (claimI nfo != nul l) {
  134                                                       eR eposClaimI nfo = rfai EreposRepo sitory.get EreposClai mInformati on(claimIn fo.getEdiC laimKey()) ;
  135                                                       lo gger.debug ("getErepo sClaimInfo rmation()  : Claim in formation  from ERepo s "
  136                                                                         + valu eOf(eRepos ClaimInfo) );
  137                                                       rf aiResponse Result = g etClaimIdC laimInform ation(clai mInfo, eRe posClaimIn fo, id);
  138                                                       rf aiResponse Result = a ddClaimLin eItemInfor mation(cla imInfo, rf aiResponse Result);
  139                                               } else {
  140                                                       lo gger.error ("RfaiServ iceImpl.po pulateRfai Info() : e xception o ccured for  " + id);
  141                                                       th row new Ge nericExcep tion(Error Messages.N OT_FOUND,  "Enter a v alid numbe r",
  142                                                                         HttpSt atus.NOT_F OUND);
  143                                               }
  144                                      }
  145                             } else  {
  146                                      Validati onMessage  validation Message =  new Valida tionMessag e("ERR", " id",
  147                                                       "S ize of the  entered P DI or Clai m Number i s inapprop riate");
  148                                      validati onMessages .add(valid ationMessa ge);
  149                                      status =  false;
  150                             }
  151                    } ca tch (DataA ccessResou rceFailure Exception  e) {
  152                             logger .error(
  153                                               "RfaiServi ceImpl.pop ulateRfaiI nfo() : Da taAccessRe sourceFail ureExcepti on occured  while pro cessing th e claim fo r "
  154                                                                + id  + " " + e );
  155                             throw  new Generi cException (ErrorMess ages.DATA_ ACCESS_ERR OR, e.getM essage(),
  156                                               HttpStatus .INTERNAL_ SERVER_ERR OR);
  157                    } ca tch (DataA ccessExcep tion e) {
  158                             logger .error(
  159                                               "RfaiServi ceImpl.pop ulateRfaiI nfo() : Da taAccessEx ception oc cured whil e processi ng the cla im for "
  160                                                                + id  + " " + e );
  161                             throw  new Generi cException (ErrorMess ages.DATA_ ACCESS_ERR OR, e.getM essage(),
  162                                               HttpStatus .INTERNAL_ SERVER_ERR OR);
  163                    } ca tch (Gener icExceptio n e) {
  164                             logger .error("Rf aiServiceI mpl.popula teRfaiInfo () : Gener icExceptio n occured  while proc essing the  claim for  "
  165                                               + id + " "  + e);
  166                             throw  new Generi cException (ErrorMess ages.NOT_F OUND, e.ge tErrorDesc ription(),  HttpStatu s.NOT_FOUN D);
  167                    } ca tch (Excep tion e) {
  168                             logger .error("Rf aiServiceI mpl.popula teRfaiInfo () : excep tion occur ed while p rocessing  the claim  for " + id
  169                                               + " " + e,  e);
  170                             throw  new Generi cException (ErrorMess ages.NOT_F OUND, e.ge tMessage() , HttpStat us.NOT_FOU ND);
  171                    }
  172  
  173                    if ( !status) {
  174                             throw  new Valida tionExcept ion("", va lidationMe ssages);
  175                    }
  176  
  177                    if ( rfaiRespon seResult ! = null) {
  178                             return  rfaiRespo nseResult;
  179                    } el se {
  180                             logger .error("Rf aiServiceI mpl.popula teRfaiInfo () : excep tion occur ed for " +  id);
  181                             throw  new Generi cException (ErrorMess ages.NOT_F OUND, "Ent er a valid  number",  HttpStatus .NOT_FOUND );
  182                    }
  183           }
  184  
  185           pr ivate Rfai Response a ddClaimLin eItemInfor mation(Cla im claimIn fo, RfaiRe sponse rfa iResponseC laimResult )
  186                             throws  GenericEx ception {
  187                    Rfai Response r faiRespons eResult =  null;
  188                    if ( rfaiRespon seClaimRes ult != nul l) {
  189                             rfaiRe sponseClai mResult.se tServiceFr omDate(dat eFormat.fo rmat(claim Info.getBe ginService Date()));
  190                             rfaiRe sponseClai mResult.se tServiceTo Date(dateF ormat.form at(claimIn fo.getEndS erviceDate ()));
  191                             rfaiRe sponseResu lt = getCl aimIdLineI temInforma tion(claim Info.getCl aimProcedu res(), rfa iResponseC laimResult );
  192                             if (rf aiResponse Result !=  null) {
  193                                      return r faiRespons eResult;
  194                             } else  {
  195                                      rfaiResp onseResult  = rfaiRes ponseClaim Result;
  196                             }
  197                    } el se {
  198                             logger .error(
  199                                               "RfaiServi ceImpl.add ClaimLineI temInforma tion() : e xception o ccured whi le process ing getCla imIdLineIt emInformat ion() ");
  200                             throw  new Generi cException (ErrorMess ages.NOT_F OUND, "Ent er a valid  number",  HttpStatus .NOT_FOUND );
  201                    }
  202  
  203                    retu rn rfaiRes ponseResul t;
  204           }
  205  
  206           pr ivate Rfai Response a ddPdiLineI temInforma tion(EwvCl aims ewvCl aimsInfo,  RfaiRespon se rfaiRes ponseClaim Result)
  207                             throws  GenericEx ception {
  208                    Rfai Response r faiRespons eResult =  null;
  209                    if ( rfaiRespon seClaimRes ult != nul l) {
  210                             rfaiRe sponseClai mResult.se tServiceFr omDate(ewv ClaimsInfo .getInvoic eStatement FromDate() );
  211                             // add ing this b ecause EWV  ServiceTo Date can b e null / e mpty
  212                             // (wh ich means  ServiceToD ate == Ser viceFromDa te)
  213                             String  serviceTo Date = isN ullish(ewv ClaimsInfo .getInvoic eStatement ToDate())
  214                                               ? ewvClaim sInfo.getI nvoiceStat ementFromD ate() : ew vClaimsInf o.getInvoi ceStatemen tToDate();
  215                             rfaiRe sponseClai mResult.se tServiceTo Date(servi ceToDate);
  216  
  217                             rfaiRe sponseResu lt = getPd iLineItemI nformation (ewvClaims Info.getEw vServiceLi neses(),
  218                                               rfaiRespon seClaimRes ult);
  219                             if (rf aiResponse Result !=  null) {
  220                                      return r faiRespons eResult;
  221                             } else  {
  222                                      rfaiResp onseResult  = rfaiRes ponseClaim Result;
  223                             }
  224                    } el se {
  225                             logger .error(
  226                                               "RfaiServi ceImpl.add ClaimLineI temInforma tion() : e xception o ccured whi le process ing getCla imIdLineIt emInformat ion() ");
  227                             throw  new Generi cException (ErrorMess ages.NOT_F OUND, "Ent er a valid  number",  HttpStatus .NOT_FOUND );
  228                    }
  229                    retu rn rfaiRes ponseResul t;
  230           }
  231  
  232           pr ivate bool ean checkc laimType(S tring subs tring) {
  233                    List <String> c laimTypeCo des = Arra ys.asList( "03", "04" , "05", "0 6", "07",  "08", "09" , "10", "5 0", "60",  "70",
  234                                      "91", "9 2", "93",  "94", "95" , "96", "9 8", "99");
  235                    if ( claimTypeC odes.conta ins(substr ing)) {
  236                             return  true;
  237                    }
  238                    retu rn false;
  239           }
  240  
  241           pr ivate Rfai Response g etPdiClaim Informatio n(EwvClaim s ewvClaim sInfo,
  242                             List<g ov.va.med. domain.ere posModel.C laim> eRep osClaimInf o, BigInte ger id) {
  243                    Rfai Response r faiRespons e = new Rf aiResponse ();
  244                    if ( ewvClaimsI nfo != nul l) {
  245                             rfaiRe sponse.set PatientIde ntifier(ew vClaimsInf o.getPatie ntIdNumber ());
  246                             rfaiRe sponse.set Patientcon trolNumber (ewvClaims Info.getIn voicePatie ntAccountN um());
  247                             rfaiRe sponse.set ProviderIn formation( ewvClaimsI nfo.getBil lingVendor Name());
  248                             rfaiRe sponse.set ProviderTi n(ewvClaim sInfo.getB illingVend orTaxIdNum ());
  249                             rfaiRe sponse.set ProviderNp i(ewvClaim sInfo.getB illingVend orNpi());
  250                             // }
  251                             Date d t = new Da te();
  252                             LocalD ateTime lo calDate =  dt.toInsta nt().atZon e(ZoneId.s ystemDefau lt()).toLo calDateTim e();
  253                             localD ate = loca lDate.plus Days(5);
  254                             Date c urrentDate PlusFiveDa y = Date.f rom(localD ate.atZone (ZoneId.sy stemDefaul t()).toIns tant());
  255                             rfaiRe sponse.set ResponseDa te(dateFor mat.format (currentDa tePlusFive Day));
  256                             rfaiRe sponse.set PayerClaim ControlNum ber(String .valueOf(i d));
  257  
  258                             /*
  259                              * com mented out , name is  populated  using Erep os Claim w ith
  260                              * get PatientNam e() if (ew vClaimsInf o.getPatie ntName() ! = null) {
  261                              * Str ing[] spli tted =
  262                              * ewv ClaimsInfo .getPatien tName().sp lit("\\s*( =>|,|\\s)\ \s*");
  263                              * log ger.info(" splitted l ength is "  + splitte d.length);
  264                              * 
  265                              * if  (splitted. length >=  2) {
  266                              * rfa iResponse. setPatient FirstName( splitted[1 ]);
  267                              * rfa iResponse. setPatient Lastname(s plitted[0] ); } else  {
  268                              * rfa iResponse. setPatient FirstName( splitted[1 ]); } }
  269                              */
  270                    }
  271                    if ( !eReposCla imInfo.isE mpty()) {
  272                             for (g ov.va.med. domain.ere posModel.C laim eClai mInfo : eR eposClaimI nfo) {
  273                                      List<Ent ityName> e ntityNames FoundForCl aim = rfai EreposRepo sitory
  274                                                       .g etEntityNa mesFromCla imKey(eCla imInfo.get ClaimKey() );
  275                                      List<Ent ityAdtlId>  entityAdt lIdsFoundF orClaim =  rfaiErepos Repository
  276                                                       .g etEntityAd tlIdsFromC laimKey(eC laimInfo.g etClaimKey ());
  277                                      getPatie ntName(ent ityNamesFo undForClai m, rfaiRes ponse);
  278                                      getInfor mationRece iver(entit yNamesFoun dForClaim,  rfaiRespo nse);
  279                                      getAdtlE ntityInfor mation(ent ityAdtlIds FoundForCl aim, rfaiR esponse);
  280                                      rfaiResp onse.setBi llType(eCl aimInfo.ge tClm05fcly TypeCd() +  eClaimInf o.getClm05 clmFrqCd() );
  281                             }
  282                    }
  283                    rfai Response.s etPayerId( ewvPayerId );
  284                    rfai Response.s etPayerNam e(payerNam e);
  285  
  286                    logg er.info("  generateEw vClaimLeve lData() :  Ewv Claim  informatio n ");
  287                    logg er.debug(" generateEw vClaimLeve lData() :  Ewv Claim  informatio n " + valu eOf(rfaiRe sponse));
  288                    retu rn rfaiRes ponse;
  289           }
  290  
  291           pr ivate Rfai Response g etPdiLineI temInforma tion(Set<E wvServiceL ines> ewvS erviceLine ses, RfaiR esponse rf aiResponse ) {
  292                    List <RfaiLineI temRespons e> rfaiLin eItemRespo nseList =  new ArrayL ist<>();
  293                    for  (EwvServic eLines esl  : ewvServ iceLineses ) {
  294                             BigDec imal charg eAmount =  new BigDec imal(esl.g etCharge() );
  295  
  296                             String Builder mo difiers =  new String Builder("" );
  297                             modifi ers.append (StringUti ls.isEmpty (esl.getMo difier1())  ? "" : es l.getModif ier1());
  298                             modifi ers.append (StringUti ls.isEmpty (esl.getMo difier2())  ? ""
  299                                               : (modifie rs.length( ) > 0 ? ", " : "") +  esl.getMod ifier2());
  300                             modifi ers.append (StringUti ls.isEmpty (esl.getMo difier3())  ? ""
  301                                               : (modifie rs.length( ) > 0 ? ", " : "") +  esl.getMod ifier3());
  302                             modifi ers.append (StringUti ls.isEmpty (esl.getMo difier4())  ? ""
  303                                               : (modifie rs.length( ) > 0 ? ", " : "") +  esl.getMod ifier4());
  304  
  305                             RfaiLi neItemResp onse rfaiL ineItemRes ponse = ne w RfaiLine ItemRespon se(esl.get LineNumber (),
  306                                               esl.getBeg inDateOfSe rvice(), e sl.getEndD ateOfServi ce(), esl. getRevenue Code(),
  307                                               esl.getPro cedureCode (), modifi ers.toStri ng(), char geAmount);
  308                             rfaiLi neItemResp onseList.a dd(rfaiLin eItemRespo nse);
  309                    }
  310  
  311                    Coll ections.so rt(rfaiLin eItemRespo nseList, n ew Compara tor<RfaiLi neItemResp onse>() {
  312  
  313                             @Overr ide
  314                             public  int compa re(RfaiLin eItemRespo nse o1, Rf aiLineItem Response o 2) {
  315                                      return o 1.getServi ceLineId() .compareTo (o2.getSer viceLineId ());
  316                             }
  317                    });
  318                    rfai Response.s etRfaiLine ItemRespon se(rfaiLin eItemRespo nseList);
  319                    logg er.info("  getEwvLine ItemInform ation() :  Ewv Line I tem inform ation ");
  320                    logg er.debug(" getEwvLine ItemInform ation() :  Ewv Line I tem inform ation " +  valueOf(rf aiResponse ));
  321                    retu rn rfaiRes ponse;
  322           }
  323  
  324           pr ivate Rfai Response g etClaimIdC laimInform ation(Clai m claimInf o,
  325                             List<g ov.va.med. domain.ere posModel.C laim> eRep osClaimInf o, BigInte ger id) {
  326                    Rfai Response r faiRespons e = new Rf aiResponse ();
  327                    if ( claimInfo  != null) {
  328                             getPro viderName( claimInfo. getProvide rInfos(),  rfaiRespon se);
  329                             // com mented out , name is  populated  using Erep os Claim w ith
  330                             // get PatientNam e()
  331                             // get VeteranInf o(claimInf o.getPerso nInfos(),  rfaiRespon se);
  332                             rfaiRe sponse.set Patientcon trolNumber (claimInfo .getPatien tControlNu mber());
  333                    }
  334                    if ( !eReposCla imInfo.isE mpty()) {
  335                             for (g ov.va.med. domain.ere posModel.C laim eClai mInfo : eR eposClaimI nfo) {
  336                                      List<Ent ityName> e ntityNames FoundForCl aim = rfai EreposRepo sitory
  337                                                       .g etEntityNa mesFromCla imKey(eCla imInfo.get ClaimKey() );
  338                                      List<Ent ityAdtlId>  entityAdt lIdsFoundF orClaim =  rfaiErepos Repository
  339                                                       .g etEntityAd tlIdsFromC laimKey(eC laimInfo.g etClaimKey ());
  340                                      getPatie ntName(ent ityNamesFo undForClai m, rfaiRes ponse);
  341                                      getInfor mationRece iver(entit yNamesFoun dForClaim,  rfaiRespo nse);
  342                                      getAdtlE ntityInfor mation(ent ityAdtlIds FoundForCl aim, rfaiR esponse);
  343                                      rfaiResp onse.setBi llType(eCl aimInfo.ge tClm05fcly TypeCd() +  eClaimInf o.getClm05 clmFrqCd() );
  344                             }
  345                    }
  346  
  347                    Date  dt = new  Date();
  348                    Loca lDateTime  localDate  = dt.toIns tant().atZ one(ZoneId .systemDef ault()).to LocalDateT ime();
  349                    loca lDate = lo calDate.pl usDays(5);
  350                    Date  currentDa tePlusFive Day = Date .from(loca lDate.atZo ne(ZoneId. systemDefa ult()).toI nstant());
  351                    rfai Response.s etResponse Date(dateF ormat.form at(current DatePlusFi veDay));
  352                    rfai Response.s etPayerCla imControlN umber(Stri ng.valueOf (id));
  353                    rfai Response.s etPayerId( fppsPayerI d);
  354                    rfai Response.s etPayerNam e(payerNam e);
  355  
  356                    logg er.info("  generateFp psClaimlev elData() :  FPPS Clai m informat ion ");
  357                    logg er.debug(" generateFp psClaimlev elData() :  FPPS Clai m informat ion " + va lueOf(rfai Response)) ;
  358                    retu rn rfaiRes ponse;
  359           }
  360  
  361           pr ivate Rfai Response g etClaimIdL ineItemInf ormation(S et<ClaimPr ocedure> c laimProced ures, Rfai Response r faiRespons e) {
  362                    List <RfaiLineI temRespons e> rfaiLin eItemRespo nseList =  new ArrayL ist<>();
  363                    for  (ClaimProc edure cp :  claimProc edures) {
  364  
  365                             String Builder mo difiers =  new String Builder("" );
  366                             modifi ers.append (StringUti ls.isEmpty (cp.getMod ifier1())  ? "" : cp. getModifie r1());
  367                             modifi ers.append (StringUti ls.isEmpty (cp.getMod ifier2())  ? ""
  368                                               : (modifie rs.length( ) > 0 ? ", " : "") +  cp.getModi fier2());
  369                             modifi ers.append (StringUti ls.isEmpty (cp.getMod ifier3())  ? ""
  370                                               : (modifie rs.length( ) > 0 ? ", " : "") +  cp.getModi fier3());
  371                             modifi ers.append (StringUti ls.isEmpty (cp.getMod ifier4())  ? ""
  372                                               : (modifie rs.length( ) > 0 ? ", " : "") +  cp.getModi fier4());
  373  
  374                             RfaiLi neItemResp onse rfaiL ineItemRes ponse = ne w RfaiLine ItemRespon se(cp.getC laimProced ureSeq(),
  375                                               dateFormat .format(cp .getServic eFromDate( )), dateFo rmat.forma t(cp.getSe rviceToDat e()),
  376                                               cp.getReve nueCode()  != null ?  cp.getReve nueCode(). getRevenue Cd() : nul l, cp.getP rocCode(),
  377                                               modifiers. toString() , cp.getBi lledAmount ());
  378                             rfaiLi neItemResp onseList.a dd(rfaiLin eItemRespo nse);
  379                    }
  380  
  381                    Coll ections.so rt(rfaiLin eItemRespo nseList, n ew Compara tor<RfaiLi neItemResp onse>() {
  382  
  383                             @Overr ide
  384                             public  int compa re(RfaiLin eItemRespo nse o1, Rf aiLineItem Response o 2) {
  385                                      return o 1.getServi ceLineId() .compareTo (o2.getSer viceLineId ());
  386                             }
  387                    });
  388  
  389                    rfai Response.s etRfaiLine ItemRespon se(rfaiLin eItemRespo nseList);
  390                    logg er.info("  getLineIte mInformati on() : FPP S Line inf ormation " );
  391                    logg er.debug(" getLineIte mInformati on() : FPP S Line inf ormation "  + valueOf (rfaiRespo nse));
  392                    retu rn rfaiRes ponse;
  393           }
  394  
  395           pr ivate void  getAdtlEn tityInform ation(List <EntityAdt lId> entit yAdtlIds,  RfaiRespon se rfaiRes ponse) {
  396                    for  (EntityAdt lId eId :  entityAdtl Ids) {
  397                             if ("D 9".equals( eId.getRef 01idQlfr() )) {
  398                                      rfaiResp onse.setCl earingHous eId(eId.ge tRef02scnd Id());
  399                             }
  400                             if ("E A".equals( eId.getRef 01idQlfr() )) {
  401                                      rfaiResp onse.setMe dicalRecor dNumber(eI d.getRef02 scndId());
  402                             }
  403                    }
  404           }
  405  
  406           pr ivate void  getPatien tName(List <EntityNam e> entityN ames, Rfai Response r faiRespons e) {
  407                    logg er.info("E NTITY NAME  SET SIZE  IS " + ent ityNames.s ize());
  408                    bool ean namesA lreadyPopu latedNM101 QC = false ;
  409                    for  (EntityNam e en : ent ityNames)  {
  410                             if ("Q C".equals( en.getNm10 1entyIdCd( ))) {
  411                                      setPatie ntInfo(rfa iResponse,  en);
  412                                      namesAlr eadyPopula tedNM101QC  = true;
  413                             }
  414  
  415                             if ("I L".equals( en.getNm10 1entyIdCd( )) && "201 0BA".equal s(en.getLo opId())) {
  416                                      if (!nam esAlreadyP opulatedNM 101QC) {
  417                                               setPatient Info(rfaiR esponse, e n);
  418                                      }
  419                             }
  420                    }
  421           }
  422  
  423           pr ivate void  setPatien tInfo(Rfai Response r faiRespons e, EntityN ame en) {
  424                    rfai Response.s etPatientF irstName(e n.getNm104 fstNm());
  425                    rfai Response.s etPatientM iddleName( en.getNm10 5midNm());
  426                    rfai Response.s etPatientL astname(en .getNm103l astNm());
  427                    rfai Response.s etPatientS uffix(en.g etNm107nmS fx());
  428                    rfai Response.s etPatientI dentifier( en.getNm10 9sbsrId()) ;
  429           }
  430  
  431           pr ivate void  getInform ationRecei ver(List<E ntityName>  entityNam es, RfaiRe sponse rfa iResponse)  {
  432                    for  (EntityNam e e : enti tyNames) {
  433                             if ("4 1".equals( e.getNm101 entyIdCd() )) {
  434                                      rfaiResp onse.setIn formationR eceiver(e. getNm109id Cd());
  435                             }
  436                    }
  437           }
  438  
  439           pr ivate void  getProvid erName(Set <ProviderI nfo> provi derInfos,  RfaiRespon se rfaiRes ponse) {
  440                    for  (ProviderI nfo p : pr oviderInfo s) {
  441                             if (p. getProvide rType().ge tProviderT ypeCd() !=  null) {
  442                                      if ("BIL LING PROVI DER".equal s(p.getPro viderType( ).getProvi derTypeCd( ))
  443                                                       ||  "REMITADD R".equals( p.getProvi derType(). getProvide rTypeCd()) ) {
  444                                               rfaiRespon se.setProv iderInform ation(p.ge tLastName( ));
  445                                               rfaiRespon se.setProv iderTin(p. getProvide rTin());
  446                                               rfaiRespon se.setProv iderNpi(p. getProvide rNpi());
  447                                      }
  448                             }
  449                    }
  450           }
  451  
  452           /*
  453            *  commented  out, name  is popula ted using  Erepos Cla im with ge tPatientNa me()
  454            *  private v oid getVet eranInfo(S et<PersonI nfo> perso nInfos, Rf aiResponse
  455            *  rfaiRespo nse) { for  (PersonIn fo pi : pe rsonInfos)  {
  456            *  rfaiRespo nse.setPat ientLastna me(pi.getL astName()) ;
  457            *  rfaiRespo nse.setPat ientFirstN ame(pi.get FirstName( ));
  458            *  rfaiRespo nse.setPat ientMiddle Name(pi.ge tMiddleNam e());
  459            *  rfaiRespo nse.setPat ientSuffix (pi.getNam eSuffix()) ;
  460            *  rfaiRespo nse.setPat ientIdenti fier(pi.ge tPersonId( ));
  461            *  
  462            *  } }
  463            * /
  464  
  465           pu blic stati c String v alueOf(Obj ect obj) {
  466                    retu rn (obj ==  null) ? " null" : ob j.toString ();
  467           }
  468  
  469           pr ivate bool ean isNull ish(String  value) {
  470                    retu rn (value  == null) | | (value.t rim().cont entEquals( ""));
  471           }
  472  
  473           pu blic Boole an getClai mSubmissio nStatus(Bi gInteger c laimId)
  474                             throws  Validatio nException , GenericE xception,  EntityNotF oundExcept ion {
  475                    logg er.info("  getClaimSu bmissionSt atus() : c hecking if  there is  a submitte d submissi on already ");
  476                    List <String> c laimSubmis sionStatus List = cla imSubmissi onReposito ry.getClai mSubmissio ns(claimId );
  477                    logg er.info("  getClaimSu bmissionSt atus() : c laimSubmis sionStatus List size  " + claimS ubmissionS tatusList. size());
  478                    if ( claimSubmi ssionStatu sList != n ull
  479                                      && claim Submission StatusList .contains( ClaimSubmi ssionConst ants.SUBMI SSION_SUBM ITTED_STAT US)) {
  480                             logger .info(" ge tClaimSubm issionStat us() : cla imId " + c laimId + "  has submi tted submi ssion");
  481                             return  true;
  482                    }
  483                    retu rn false;
  484           }
  485  
  486   }