3. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 7/6/2017 8:32:12 AM 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.

3.1 Files compared

# Location File Last Modified
1 HC 837 Compliance 05122017.zip\HC 837 Compliance 05122017\EDI_CodeConversion\EDI_CodeConversion\src\main\gov\va\med\hac\edi\extract\feeclaimstatus\feeFinal PaymentDataExtraction.java Thu May 12 19:17:58 2016 UTC
2 HC 837 Compliance 05122017.zip\HC 837 Compliance 05122017\EDI_CodeConversion\EDI_CodeConversion\src\main\gov\va\med\hac\edi\extract\feeclaimstatus\feeFinal PaymentDataExtraction.java Wed Jul 5 13:05:18 2017 UTC

3.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 6588
Changed 1 2
Inserted 0 0
Removed 0 0

3.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

3.4 Active regular expressions

No regular expressions were active.

3.5 Comparison detail

  1   package go v.va.med.h ac.edi.ext ract.feecl aimstatus. feeFinal;
  2  
  3  
  4   import jav a.math.Big Decimal;
  5   import jav a.sql.Time stamp;
  6   import jav a.text.Dec imalFormat ;
  7   import jav a.text.Sim pleDateFor mat;
  8   import jav a.util.Arr ayList;
  9   import jav a.util.Dat e;
  10   import jav a.util.Ite rator;
  11   import jav a.util.Lis t;
  12  
  13   import jav ax.persist ence.Entit yManager;
  14   import jav ax.persist ence.Query ;
  15  
  16   import org .slf4j.Log ger;
  17   import org .slf4j.Log gerFactory ;
  18  
  19   /**
  20   This class  is used t o extract  various fi elds not i mplemented  in initia l and pend ing proces ses
  21   Method nam es are bas ed on fiel d names FR OM the Emd eon Spec.,  may be ab breviated  for readab ility.
  22   The majori ty of thes e fields a re set to  null or em pty String  "" in the  existing  initial an d pending
  23   createPrim aryDetailR ec() . Thi s is an at tempt to c odify thes e fields a nd extract  their val ues for a
  24   given clai m.
  25  
  26   HAPE POR V A DO# 118- 11-D-1009,  TO#118-10 09-0001; H ARRIS
  27  
  28   @author Bi ll Blackmo n
  29   @since 3/1 4/2014
  30   @version R 1.0.0
  31    *
  32    */
  33   public cla ss Payment DataExtrac tion {
  34  
  35  
  36  
  37           st atic final  Logger LO GGER = Log gerFactory .getLogger (PaymentDa taExtracti on.class);
  38  
  39           //  not in DB , never re ad, always  ""
  40           pr ivate Stri ng billing ProviderPa yerAssigne dNumber="" ;
  41           pr ivate Stri ng service ProviderPa yerAssigne dNumber="" ;
  42  
  43           pr ivate Stri ng billing ProviderFe deralTaxID ="";
  44           pr ivate Stri ng billing ProviderNa tionalProv iderID="";
  45           pr ivate Stri ng billing ProviderLa stName="";
  46           pr ivate Stri ng billing ProviderFi rstName="" ;
  47           pr ivate Stri ng billing ProviderMi ddleName=" ";
  48           pr ivate Stri ng billing ProviderNa meSuffix=" ";
  49  
  50           pr ivate Stri ng service ProviderFe deralTaxID ="";
  51           pr ivate Stri ng service ProviderNa tionalProv iderID="";
  52           pr ivate Stri ng service ProviderLa stName="";
  53           pr ivate Stri ng service ProviderFi rstName="" ;
  54           pr ivate Stri ng service ProviderMi ddleName=" ";
  55           pr ivate Stri ng service ProviderNa meSuffix=" ";
  56  
  57           pr ivate Stri ng employe rIdentific ationNumbe r="";
  58           pr ivate Stri ng employe rName="";
  59  
  60  
  61           pr ivate Stri ng subscri berID="";
  62           pr ivate Stri ng subscri berLastNam e="";
  63           pr ivate Stri ng subscri berFirstNa me="";
  64           pr ivate Stri ng subscri berMiddleN ame="";
  65           pr ivate Stri ng subscri berNameSuf fix="";
  66  
  67           pr ivate Stri ng patient ID="";
  68           pr ivate Stri ng patient LastName=" ";
  69           pr ivate Stri ng patient FirstName= "";
  70           pr ivate Stri ng patient MiddleName ="";
  71           pr ivate Stri ng patient NameSuffix ="";
  72           pr ivate Stri ng patient DateOfBirt h="";
  73           pr ivate Stri ng patient Gender="";
  74  
  75  
  76           pr ivate doub le claimCh argeAmount ;
  77           pr ivate doub le claimPa ymentAmoun t;
  78  
  79  
  80           pr ivate Stri ng claimAd judication PaymentDat e="";
  81           pr ivate Stri ng checkDa te="";
  82           pr ivate Stri ng checkNu mber="";
  83           pr ivate Stri ng billTyp e="";
  84  
  85           pr ivate Stri ng payerCl aimIdentif icationNum ber="";
  86           pr ivate Stri ng patient AccountNum ber="";
  87           pr ivate Stri ng pharmac yPrescript ionNumber= "";
  88           pr ivate Stri ng voucher Identifier ="";
  89           pr ivate Stri ng applica tionSystem Identifier ="";
  90           pr ivate Stri ng groupNu mber="";
  91  
  92           pr ivate Date  claimServ iceDateSta rt;
  93           pr ivate Date  claimServ iceDateEnd ;
  94  
  95  
  96           pr ivate Stri ng payerID ="";
  97           pr ivate Stri ng lineIte mControlNu mber="";
  98           pr ivate Stri ng service QualifierI D="";
  99           pr ivate Stri ng service Identifica tionCode=" ";
  100           pr ivate Stri ng procedu reModifier 1="";
  101           pr ivate Stri ng procedu reModifier 2="";
  102           pr ivate Stri ng procedu reModifier 3="";
  103           pr ivate Stri ng procedu reModifier 4="";
  104           pr ivate Stri ng revenue Code="";
  105           pr ivate int  unitsOfSer vice;
  106           pr ivate Stri ng emdeonC laimNumber ="";
  107           pr ivate Date  dateOfSer viceStart;
  108           pr ivate Date  dateOfSer viceEnd;
  109  
  110           pr ivate Stri ng service TypeCode=" ";
  111           pr ivate Stri ng procCod e="";
  112  
  113  
  114       @Suppr essWarning s("rawtype s")
  115           Ar rayList mo difiers =  new ArrayL ist();
  116  
  117       privat e BigDecim al lineIte mChargeAmo unt;
  118           pr ivate BigD ecimal lin eItemProvi derPayment Amount;
  119  
  120  
  121           pr ivate Enti tyManager  entityMana ger;
  122           pr ivate BigD ecimal bil ledUnits;
  123           pr ivate Time stamp serv iceFromDat e;
  124           pr ivate Time stamp serv iceToDate;
  125           pr ivate Stri ng procCod eDesc;
  126           pr ivate BigD ecimal bil ledAmt;
  127           pr ivate BigD ecimal pai dAmt;
  128           pr ivate BigD ecimal cla imProcedur eSeq;
  129  
  130           //  flags for  negative  paid amoun ts
  131           pr ivate bool ean bNegat ivePaidAmo unt=false;
  132           pr ivate bool ean bNegat iveChargeA mount=fals e;
  133  
  134  
  135           //  flags for  null paym ent amount s due to B AD data
  136           pr ivate bool ean bNullC laimPaymen tAmount=fa lse;
  137           pr ivate bool ean bNullC laimCharge Amount=fal se;
  138           /* *
  139           Bi gDecimal c laimPaymen tAmount =  null;
  140       BigDec imal claim ChargeAmou nt = null;
  141       */
  142  
  143  
  144           //  default c onstructor
  145           pu blic Payme ntDataExtr action() { };
  146  
  147           /* *
  148            *  This meth od calls a ll of the  set..() me thods to l oad the da ta upfront
  149            *  NOT USED  - 11/25
  150              * @author 
D NS     BLACKW
  151            *  @param cl aimIndexId
  152            * /
  153           //  load all  data at on ce
  154           //  NOTE: all  methods h ere will h ave to be  changed to  private o nce this i s implemen ted and te sted.
  155           pu blic void  loadData(S tring clai mIndexId)  {
  156  
  157                    setB illingProv iderInfo(c laimIndexI d);
  158                    setS erviceProv iderInfo(c laimIndexI d);
  159                    setE mdeonClaim Number(cla imIndexId) ;
  160                    setC laimCharge PaymentAmo unts(claim IndexId);
  161                    setC laimAdjudi cationPaym entDate(cl aimIndexId );
  162                    setC heckDateAn dNumber(cl aimIndexId );
  163                    setP harmacyPre scriptionN umber(clai mIndexId);
  164                    setE mdeonClaim Number(cla imIndexId) ;
  165  
  166  
  167  
  168  
  169  
  170           }        // e nd loadDat a()
  171  
  172  
  173           /* *
  174            *  This meth od sets th e Emdeon C laim Numbe r, Field #  33  in sp ec.
  175            *  @param cl aimIndexId
  176            * /
  177           pu blic void  setEmdeonC laimNumber (String cl aimIndexId ) {
  178  
  179                    Quer y q;
  180                List<?>  l;
  181                Iterator <?> it;
  182  
  183                                 tr y {
  184  
  185                               Stri ng sql =
  186                                       " selec t " +
  187                                                 " REF02S CND_ID " +
  188                                      " from "  +
  189                                               "entity_ad tl_id e, c laims c, c laim cc "  +
  190                                      " where  " +
  191                                               "c.claim_i ndex = " +  claimInde xId + " an d " +
  192                                               "edi_claim _key = cc. claim_key  and " +
  193                                               " cc.claim _key = e.c laim_key a nd " +
  194                                               " e.file_n umber = cc .file_numb er and " +
  195                                               " CC.ST02T XN_CTL_NBR  = E.ST02T XN_CTL_NBR  and E.REF 01ID_QLFR  = 'D9' ";
  196  
  197  
  198  
  199                                                              q = th is.entityM anager.cre ateNativeQ uery(sql);
  200                                                              l = q. getResultL ist();
  201                                                              it = l .iterator( );
  202  
  203                                                              String  tmp = "";
  204  
  205                                                              while  (it.hasNex t()) {
  206                                                                 Obj ect row =  (String) i t.next();
  207                                                                 if( row != nul l) {
  208                                                                         tmp =  row.toStri ng();
  209  
  210                                                                         if(tmp  != null)
  211                                                                                  this.emd eonClaimNu mber = tmp ;
  212                                                                 }
  213                                                              }
  214  
  215                           }catch(E xception e x) {
  216   //                          Syst em.out.pri ntln("Paym entDataExt raction.se tEmdeonCla imNumber()  ERROR: "  + ex.getMe ssage());
  217                               LOGG ER.error(" Error on P aymentData Extraction .setEmdeon ClaimNumbe r(), error ed on Clai m Key: {}" ,  claimIn dexId);
  218                               LOGG ER.error(e x.getMessa ge(), ex);
  219                           }
  220  
  221  
  222           }        // e nd setEmde onCode()
  223  
  224           /* *
  225            *  This meth od sets th e Billing  Provider i nformation
  226            *  @author B ill Blackm on
  227            *  @param cl aimIndexId
  228            * /
  229           pu blic void  setBilling ProviderIn fo(String  claimIndex Id) {
  230  
  231                    bool ean DEBUG  = false;
  232  
  233                    Quer y q;
  234                List<?>  l;
  235                Iterator <?> it;
  236                int iCou nt = 0;
  237  
  238  
  239                try {
  240  
  241  
  242  
  243                      St ring sql =  "select p rovider_np i, first_n ame, last_ name,  mid dle_name,  name_suffi x,  provid er_tin " +
  244                      "  from provi der_info "  +
  245                      "  where " +
  246                      "  claim_inde x = " + cl aimIndexId  + " and p rovider_ty pe_cd = 'B ILLING PRO VIDER' ";
  247  
  248                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  249  
  250                                                     l =  q.getResul tList();
  251                                                     it =  l.iterato r();
  252  
  253                                                     // a ll returne d vals are  Strings
  254  
  255                                                     whil e (it.hasN ext()) {
  256                                                        i Count++;
  257  
  258                                                        O bject[] ro w = (Objec t[]) it.ne xt();
  259  
  260  
  261                                                        i f(row != n ull) {
  262   // Field # 7
  263                                                                 if( row[0] !=  null)
  264                                                                          this. billingPro viderNatio nalProvide rID = (Str ing) row[0 ];
  265   // Field # 9
  266                                                                 if( row[1] !=  null)
  267                                                                          this. billingPro viderFirst Name = (St ring) row[ 1];
  268  
  269   // Field # 8
  270                                                                 if( row[2] !=  null)
  271                                                                          this. billingPro viderLastN ame = (Str ing) row[2 ];
  272   // Field # 10
  273                                                                 if( row[3] !=  null)
  274                                                                          this. billingPro viderMiddl eName = (S tring) row [3];
  275  
  276   // Field # 11
  277                                                                 if( row[4] !=  null)
  278                                                                          this. billingPro viderNameS uffix = (S tring) row [4];
  279  
  280   // Field # 5
  281                                                                 if( row[5] !=  null)
  282                                                                          this. billingPro viderFeder alTaxID =  (String) r ow[5];
  283  
  284  
  285                                                     } //  end if
  286  
  287                                                } // end  while
  288  
  289                                                if(iCount ==0) {
  290   if(DEBUG)
  291   System.out .println(" \nsetBilli ngProvider Info() - n o informat ion found  for claim  index: " +  claimInde xId);
  292                                                }
  293  
  294  
  295    if(DEBUG)       {
  296                                                   System .out.print ln("\nBill ingProvide rInfo for  Claim: " +  claimInde xId);
  297                                                   System .out.print ln("Federa l Tax ID:  " + this.b illingProv iderFedera lTaxID);
  298                                                       Sy stem.out.p rintln("Na tional Pro vider ID:  " +  this. billingPro viderNatio nalProvide rID);
  299                                                       Sy stem.out.p rintln("Fi rst Name:  " +  this. billingPro viderFirst Name);
  300                                                       Sy stem.out.p rintln("La st Name: "  + this.bi llingProvi derLastNam e);
  301                                                       Sy stem.out.p rintln("Mi ddle Name:  " + this. billingPro viderMiddl eName);
  302                                                       Sy stem.out.p rintln("Na me suffix:  " + this. billingPro viderNameS uffix);
  303  
  304                                                       Sy stem.out.p rintln("\n ");
  305   }
  306  
  307  
  308  
  309                           }catch(E xception e x) {
  310                               Syst em.out.pri ntln("Paym entDataExt raction.se tBillingPr oviderInfo () ERROR:  " + ex.get Message()) ;
  311                               LOGG ER.error(" Error on P aymentData Extraction .setBillin gProviderI nfo, error ed on Clai m Key: {}" ,  claimIn dexId);
  312                               LOGG ER.error(e x.getMessa ge(), ex);
  313                           } // end  try
  314  
  315           }        // e nd setBill ingProvide rInfo()
  316  
  317  
  318   /**
  319   Test scena rios from  Anne D, -  7/26
  320   86419549
  321   A.      If  both sp.N PI and sp. TaxID are  null, disp lay NOTHIN G for ALL  service pr ovider fie lds (DTL-F L12 thru D TL-FL18)
  322  
  323   86320901 -  CHECK THI S
  324   B.      If  sp.TaxID  = bp.TaxId  and sp.NP I = bp.NPI , display  nothing fo r all serv ice provid er fields  (DTL-FL12  thru DTL-F L18)
  325  
  326   86932889 -  CHECK THI S
  327   C.      If  sp.TaxId  != bp.TaxI d and sp.N PI = bp.NP I, display  sp.TaxId  value in D TL-FL12, d isplay not hing for D TL-FL14, a nd pull co rrespondin g values f or DTL-FL1 5 thru DTL -FL18
  328  
  329   //86932908
  330   D.      IF  SP.TAXID  = BP.TAXID  AND SP.NP I != BP.NP I, DISPLAY  NOTHING I N DTL-FL12 , DISPLAY  SP.NPI VAL UE AND the  rest of t he values
  331  
  332   86932909
  333   E.      If  sp.TaxId  != bp.TaxI d and sp.N PI != bp.N PI, displa y sp.TaxId  value in  DTL-FL12,  display sp .NPI value  in DTL-FL 14, and pu ll corresp onding val ues for DT L-FL15 thr u DTL-FL18
  334  
  335  
  336   86982459
  337   F. If sp.T axId != pb .TaxId and  sp. NPI i s null, di splay sp.T axId value  in DTL-FL 12, displa y nothing  in DTL-FL1 4, and pul l correspo nding valu es for DTL -FL15 thru  DTL-FL18
  338  
  339  
  340  
  341  
  342  
  343    *
  344    *
  345   **/
  346   /**
  347    * Potenti al method  to set BOT H billing  and servic e provider  info
  348    * @author  Bill Blac kmon
  349    * @since  11/26/2013
  350    * @param  claimIndex Id
  351    */
  352  
  353   public voi d setProvi derInfo(St ring claim IndexId) {
  354  
  355           bo olean DEBU G = false;
  356  
  357           Qu ery q;
  358       List<? > l;
  359       Iterat or<?> it;
  360  
  361           bo olean bSam eTaxId = f alse;
  362           bo olean bSam eNPI = fal se;
  363           bo olean bNul lTaxId = f alse;
  364           bo olean bNul lNPI = fal se;
  365  
  366           bo olean bBil ling = fal se;
  367           bo olean bSer vice = fal se;
  368  
  369           St ring sProv iderType =  "";
  370  
  371           //  compare s ql from bo th methods  -
  372           //  servicePo vider sql
  373           //  SELECT pr ovider_tin , provider _npi,  las t_name, fi rst_name,   middle_na me, name_s uffix
  374  
  375           //  billing p rovider sq l
  376           //  select pr ovider_npi , first_na me, last_n ame,  midd le_name, n ame_suffix ,  provide r_tin " +
  377  
  378  
  379            S tring sql  =                  "S ELECT prov ider_tin,  provider_n pi, last_n ame, first _name, mid dle_name,  name_suffi x," +
  380           "  (CASE " +
  381           "        WHEN  PROVIDER_ TYPE_CD='B ILLING PRO VIDER' THE N 'B' " +
  382           "        WHEN  PROVIDER_ TYPE_CD='R ENDERING P ROVIDER' T HEN 'R' "  +
  383           "        END  ) as provi der_type "  +
  384           "        From  " +
  385           "                 provid er_info "  +
  386           "  Where " +
  387           "        clai m_index =  " + claimI ndexId + "  and " +
  388           "                 ((prov ider_type_ cd = 'BILL ING PROVID ER') " +
  389           "        or "  +
  390           "                 (provi der_type_c d = 'RENDE RING PROVI DER')) ";
  391  
  392  
  393   if(DEBUG)  {
  394           //  System.ou t.println( "setProvid erInfo() -  sql is: "  + sql);
  395   }
  396  
  397   try {
  398  
  399       q = th is.entityM anager.cre ateNativeQ uery(sql);
  400       l = q. getResultL ist();
  401       it = l .iterator( );
  402  
  403                                 wh ile (it.ha sNext())
  404                                 {
  405  
  406                                      // reset  flags.
  407                                      bBilling  = false;
  408                                      bService  = false;
  409  
  410                                      Object[]  row = (Ob ject[]) it .next();
  411  
  412   /**
  413    *      pr ivate Stri ng billing ProviderFe deralTaxID ="";
  414           pr ivate Stri ng billing ProviderNa tionalProv iderID="";
  415           pr ivate Stri ng billing ProviderLa stName="";
  416           pr ivate Stri ng billing ProviderFi rstName="" ;
  417           pr ivate Stri ng billing ProviderMi ddleName=" ";
  418           pr ivate Stri ng billing ProviderNa meSuffix=" ";
  419    */
  420  
  421                                     if(row !=  null)
  422                                     {
  423  
  424                                                       //  GET THE P ROVIDER TY PE CODE FI RST...
  425  
  426   if(claimIn dexId.equa lsIgnoreCa se("863255 04")) {
  427           Sy stem.out.p rintln("cl aim with b oth provid ers found. ....be car eful");
  428   }
  429                                                           if(row[6]  != null)  {
  430                                                                         sProvi derType =  (String) r ow[6].toSt ring();      // this  is a char. ....
  431                                                                         if(sPr oviderType .equalsIgn oreCase("B ")) {
  432                                                                                  bBilling  = true;
  433                                                                         } else   if(sProv iderType.e qualsIgnor eCase("R") ) {
  434                                                                                  bService  = true;
  435                                                                         } else  {
  436   // catch t he inevita ble garbag e value fr om the tes t database  and print  an error  and exit
  437                                                                                  if(DEBUG ) {
  438                                                                                    System .out.print ln("\n\nPa ymentDataE xtraction. setProvide rInfo() ER ROR: INVAL ID PROVIDE R TYPE: "  + sProvide rType + "  for claim:  " + claim IndexId);
  439                                                                                  }
  440                                                                                  LOGGER.e rror("Paym entDataExt raction.se tProviderI nfo() ERRO R: INVALID  PROVIDER  TYPE: " +  sProviderT ype + " fo r claim: "  + claimIn dexId);
  441                                                                                  return;
  442                                                                         }
  443  
  444   if(DEBUG)  {
  445           Sy stem.out.p rintln("se tProviderI nfo() - pr oviderType Code is: "  + sProvid erType);
  446   }
  447  
  448  
  449                                                                }
  450  
  451  
  452                                                                //FI ELD 12                tax id
  453  
  454   // insert  test for e ach field  to check i f it is bP rovider or  bBilling  then assig n values f rom billin gProvider  or service Provider.. ...
  455   // the ins ert the ni ghtmarish  logic for  each at th e end of t he method. .....slowl y
  456                                                                 if( row[0] !=  null) {
  457                                                                          if(bS ervice) {
  458                                                                                   this.se rviceProvi derFederal TaxID = (S tring) row [0];
  459                                                                          } els e {
  460                                                                                   this.bi llingProvi derFederal TaxID = (S tring) row [0];
  461                                                                          }
  462                                                                 } e lse {                                  // i s null and  is Servic eProvider
  463                                                                          if(bS ervice) {
  464                                                                                   bNullTa xId = true ;
  465                                                                          }
  466                                                                 }
  467  
  468                             //fiel d 14        NPI
  469                                                                 if( row[1] !=  null) {
  470                                                                         if(bSe rvice) {
  471                                                                                  this.ser viceProvid erNational ProviderID  = (String ) row[1];
  472                                                                         } else  {
  473                                                                                  this. bi llingProvi derNationa lProviderI D = (Strin g) row[1];
  474                                                                         }
  475                                                                 } e lse {
  476                                                                          if(bS ervice) {          //  is null a nd is Serv iceProvide r
  477                                                                                   bNullNP I = true;
  478                                                                          }
  479                                                                 }
  480  
  481                                                                 if( row[2] !=  null) {
  482                                                                          if(bS ervice) {
  483                                                                                   this.se rviceProvi derLastNam e = (Strin g) row[2];
  484                                                                          } els e {
  485                                                                                   this.bi llingProvi derLastNam e = (Strin g) row[2];
  486                                                                          }
  487                                                                 }
  488  
  489                                                                          if(ro w[3] != nu ll) {
  490                                                                                   if(bSer vice) {
  491                                                                                            this.serv iceProvide rFirstName  = (String ) row[3];
  492                                                                                   } else  {
  493                                                                                            this.bill ingProvide rLastName  = (String)  row[3];
  494                                                                                   }
  495                                                                          }
  496  
  497  
  498  
  499                                                                          if(ro w[4] != nu ll) {
  500                                                                                   if(bSer vice) {
  501                                                                                            this.serv iceProvide rMiddleNam e = (Strin g) row[4];
  502                                                                                   } else  {
  503                                                                                            this.bill ingProvide rMiddleNam e = (Strin g) row[4];
  504                                                                                   }
  505                                                                          }
  506  
  507  
  508  
  509                                                                          if(ro w[5] != nu ll) {
  510                                                                                   if(bSer vice) {
  511                                                                                            this.serv iceProvide rNameSuffi x = (Strin g) row[5];
  512                                                                                   } else  {
  513                                                                                            this.bill ingProvide rNameSuffi x = (Strin g) row[5];
  514                                                                                   }
  515                                                                          }
  516  
  517                                     }         // end nul l check
  518  
  519  
  520  
  521  
  522  
  523                             }        // END R ECORD LOOP .....
  524  
  525                                 if (DEBUG) {
  526                                          Syst em.out.pri ntln("\n") ;
  527                                          Syst em.out.pri ntln("setP roviderInf o()....... ");
  528                                               System.out .println(" ServicePro vider Info  form clai m: " + cla imIndexId) ;
  529                                               System.out .println(" Federal Ta x ID: " +  this.servi ceProvider FederalTax ID);
  530                                               System.out .println(" National P rovider ID : " + this .servicePr oviderNati onalProvid erID);
  531                                               System.out .println(" First Name : " + this .servicePr oviderFirs tName);
  532                                               System.out .println(" Last Name:  " + this. servicePro viderLastN ame);
  533                                               System.out .println(" Middle Nam e: " + thi s.serviceP roviderMid dleName);
  534                                               System.out .println(" Name Suffi x: " + thi s.serviceP roviderNam eSuffix);
  535                                               System.out .println(" \n\n");
  536                                         }     // END DEB UG
  537  
  538                                 if (DEBUG)    {
  539                                          Syst em.out.pri ntln("Bill ingProvide rInfo for  Claim: " +  claimInde xId);
  540                                          Syst em.out.pri ntln("Fede ral Tax ID : " + this .billingPr oviderFede ralTaxID);
  541                                               System.out .println(" National P rovider ID : " +  thi s.billingP roviderNat ionalProvi derID);
  542                                               System.out .println(" First Name : " +  thi s.billingP roviderFir stName);
  543                                               System.out .println(" Last Name:  " + this. billingPro viderLastN ame);
  544                                               System.out .println(" Middle Nam e: " + thi s.billingP roviderMid dleName);
  545                                               System.out .println(" Name suffi x: " + thi s.billingP roviderNam eSuffix);
  546  
  547                                               System.out .println(" \n");
  548                                 }
  549  
  550   // logic.. ....
  551                                 if (DEBUG) {
  552  
  553                                      if(((! ( this.servi ceProvider FederalTax ID.equalsI gnoreCase( ""))) && ( ! (this.se rviceProvi derNationa lProviderI D.equalsIg noreCase(" ")) ) )) {
  554                                                                Syst em.out.pri ntln("setP roviderInf o() - NEIT HER TAX ID  or PROVID ER ID are  empty for  id: " + cl aimIndexId );
  555                                               }
  556  
  557                    // t ax id is e mpty and p rovider id  is NOT em pty
  558                                      if(((thi s.serviceP roviderFed eralTaxID. equalsIgno reCase("") ) && (! (t his.servic eProviderN ationalPro viderID.eq ualsIgnore Case(""))  ) )) {
  559                                                       Sy stem.out.p rintln("se tProviderI nfo() - TA X ID IS EM PTY and PR OVIDER ID  isn't for  id: " + cl aimIndexId );
  560                                      }
  561  
  562                    // t ax id is N OT empty,  provider i d IS empty
  563                                      if(((!th is.service ProviderFe deralTaxID .equalsIgn oreCase("" )) && (thi s.serviceP roviderNat ionalProvi derID.equa lsIgnoreCa se("")) ))  {
  564                                                                Syst em.out.pri ntln("setP roviderInf o() - TAX  ID IS NOT  EMPTY and  PROVIDER I D IS EMPTY  for id: "  + claimIn dexId);
  565                                      }
  566                                 }
  567  
  568                                 if ((this.ser viceProvid erFederalT axID.equal sIgnoreCas e("")) &&  (this.serv iceProvide rNationalP roviderID. equalsIgno reCase("") )) {
  569                                      if(DEBUG ) {
  570                                      System.o ut.println ("setProvi derInfo()  BOTH servi ceProvider FederalTax ID and ser viceProvid erNational ProviderID  are EMPTY  for claim : " + clai mIndexId);
  571                                      System.o ut.println ("setProvi derInfo()  - SETTING  servicedPr ovider inf ormation t o null - W ILL NOT BE  DISPLAYED ");
  572                                      }
  573  
  574                                       this.se rviceProvi derLastNam e = "";
  575                                       this.se rviceProvi derFirstNa me = "";
  576                                       this.se rviceProvi derMiddleN ame = "";
  577                                       this.se rviceProvi derNameSuf fix = "";
  578  
  579                                  r eturn;
  580  
  581                                 }
  582  
  583  
  584  
  585                                 //
  586                                 //  ALSO CATC HES D...le ss specifi c - leave  out for no w.....7/28
  587                                 /* *
  588                                  *
  589                                  *
  590                                    *
  591                                 if ( !this.se rviceProvi derNationa lProviderI D.equalsIg noreCase(t his.billin gProviderN ationalPro viderID))  {
  592  
  593                                      if(DEBUG ) {
  594                                               System.out .println(" setProvide rInfo() -  Top Level  NPI compar ison - ser vice NPI i s DIFFEREN T than bil ling NPI f or claim:  " + claimI ndexId + "  checking  for null s p.TaxId");
  595  
  596                                      }
  597  
  598  
  599                                      if( !bNu llTaxId )  {
  600  
  601                                               this.servi ceProvider FederalTax ID=this.se rviceProvi derNationa lProviderI D;
  602  
  603                                                if(DEBUG)  {
  604                                                            System.o ut.println ("setProvi derInfo()  - Top Leve l NPI comp arison - s p.TaxId is  NOT NULL  - setting  sp.TaxId t o sp.NPI") ;
  605                                                                Syst em.out.pri ntln("\nSe rviceProvi der Info f or claim:  " + claimI ndexId);
  606                                                                Syst em.out.pri ntln("Fede ral Tax ID : " + this .servicePr oviderFede ralTaxID);
  607                                                                Syst em.out.pri ntln("Nati onal Provi der ID: "  + this.ser viceProvid erNational ProviderID );
  608                                                                Syst em.out.pri ntln("Firs t Name: "  + this.ser viceProvid erFirstNam e);
  609                                                                Syst em.out.pri ntln("Last  Name: " +  this.serv iceProvide rLastName) ;
  610                                                                Syst em.out.pri ntln("Midd le Name: "  + this.se rviceProvi derMiddleN ame);
  611                                                                Syst em.out.pri ntln("Name  Suffix: "  + this.se rviceProvi derNameSuf fix);
  612                                                                Syst em.out.pri ntln("EXIT ING EVALUA TION\n");
  613  
  614                                                 }     //  end debug
  615  
  616                                                return;
  617                                      }        // end nul l check
  618  
  619                                 }  else {
  620  
  621                                      if(DEBUG ) {
  622                                               System.out .println(" setProvide rInfo() -  Top Level  NPI compar ison - ser vice NPI i s THE SAME  than bill ing NPI -  continuing ");
  623                                      }
  624  
  625  
  626                                 }    // END t op-level b p.NPI and  sp.NPI com parison
  627                                 ** /
  628  
  629  
  630  
  631                                 /* *
  632                                  *  Please se e 86932908 , in this  ex, Render ing’s tax  id = Billi ng’s tax i d, so Serv ice Provid er Federal  Tax ID is  null (cap tured corr ectly),
  633                                  * /
  634  
  635  
  636                                 //  86419549
  637                                 //  If both s p.NPI and  sp.TaxID a re null, d isplay NOT HING for A LL service  provider  fields (DT L-FL12 thr u DTL-FL18 )
  638  
  639  
  640                                                     if(( bNullNPI)  && (bNullT axId) ) {
  641  
  642  
  643                                                          if(DEBUG)  {
  644                                                                  Sy stem.out.p rintln("se tProviderI nfo() - To p Null che ck - If sp .TaxID = b p.TaxId an d sp.NPI =  bp.NPI, d isplay not hing for a ll service  provider  fields (DT L-FL12 thr u DTL-FL18 ) MET for  id: " + cl aimIndexId );
  645  
  646                                                                         System .out.print ln("\nServ iceProvide r Info for  claim: "  + claimInd exId);
  647                                                                                  System.o ut.println ("Federal  Tax ID: "  + this.ser viceProvid erFederalT axID);
  648                                                                                  System.o ut.println ("National  Provider  ID: " + th is.service ProviderNa tionalProv iderID);
  649                                                                                  System.o ut.println ("First Na me: " + th is.service ProviderFi rstName);
  650                                                                                  System.o ut.println ("Last Nam e: " + thi s.serviceP roviderLas tName);
  651                                                                                  System.o ut.println ("Middle N ame: " + t his.servic eProviderM iddleName) ;
  652                                                                                  System.o ut.println ("Name Suf fix: " + t his.servic eProviderN ameSuffix) ;
  653                                                                                  System.o ut.println ("EXITING  EVALUATION \n");
  654  
  655                                                          }
  656  
  657                                                                 thi s.serviceP roviderLas tName = "" ;
  658                                                                 thi s.serviceP roviderFir stName = " ";
  659                                                                 thi s.serviceP roviderMid dleName =  "";
  660                                                                 thi s.serviceP roviderNam eSuffix =  "";
  661  
  662                                                                 ret urn;
  663  
  664                                                     }
  665  
  666  
  667                                 /* *
  668                                  *  86320901  -
  669                                  *
  670                                 B.   If sp.Ta xID = bp.T axId and s p.NPI = bp .NPI, disp lay nothin g for all  service pr ovider fie lds (DTL-F L12 thru D TL-FL18)
  671  
  672                                  * /
  673  
  674                                                     if(t his.servic eProviderF ederalTaxI D.equalsIg noreCase(t his.billin gProviderF ederalTaxI D)) {
  675                                                          if(this.se rviceProvi derNationa lProviderI D.equalsIg noreCase(t his.billin gProviderN ationalPro viderID))  {
  676  
  677                                                                  //  clear ALL  values
  678                                                                  th is.service ProviderFe deralTaxID ="";
  679                                                                  th is.service ProviderNa tionalProv iderID="";
  680                                                                  th is.service ProviderLa stName = " ";
  681                                                                           this .servicePr oviderFirs tName = "" ;
  682                                                                           this .servicePr oviderMidd leName = " ";
  683                                                                           this .servicePr oviderName Suffix = " ";
  684  
  685                                                                  if (DEBUG) {
  686                                                                           Syst em.out.pri ntln("Chec k B. - If  sp.TaxID =  bp.TaxId  and sp.NPI  = bp.NPI,  display n othing for  all servi ce provide r fields ( DTL-FL12 t hru DTL-FL 18) MET fo r id: " +  claimIndex Id);
  687  
  688                                                                                  System.o ut.println ("\nServic eProvider  Info for c laim: " +  claimIndex Id);
  689                                                                                           System.out .println(" Federal Ta x ID: " +  this.servi ceProvider FederalTax ID);
  690                                                                                           System.out .println(" National P rovider ID : " + this .servicePr oviderNati onalProvid erID);
  691                                                                                           System.out .println(" First Name : " + this .servicePr oviderFirs tName);
  692                                                                                           System.out .println(" Last Name:  " + this. servicePro viderLastN ame);
  693                                                                                           System.out .println(" Middle Nam e: " + thi s.serviceP roviderMid dleName);
  694                                                                                           System.out .println(" Name Suffi x: " + thi s.serviceP roviderNam eSuffix);
  695                                                                                           System.out .println(" EXITING EV ALUATION\n ");
  696  
  697                                                                  }
  698  
  699  
  700                                                                  //  do not co ntinue
  701                                                                           retu rn;
  702  
  703                                                          }
  704  
  705                                                     } //  end if
  706  
  707  
  708                                 //  end check  B.
  709  
  710                                 //  check C.
  711                                 /* *
  712                                  *  86932889
  713                                  C . If sp.Ta xId != bp. TaxId and  sp.NPI = b p.NPI, dis play sp.Ta xId value  in DTL-FL1 2, display  nothing f or DTL-FL1 4, and pul l correspo nding valu es for DTL -FL15 thru  DTL-FL18
  714  
  715                                 ** /
  716  
  717                                                     if(! this.servi ceProvider FederalTax ID.equalsI gnoreCase( this.billi ngProvider FederalTax ID)) {
  718                                                          if(this.se rviceProvi derNationa lProviderI D.equalsIg noreCase(b illingProv iderNation alProvider ID)) {
  719  
  720                                                                  //  field NOT HING in fi eld 14 NPI
  721                                                                  th is.service ProviderNa tionalProv iderID = " ";
  722  
  723                                                                  if (DEBUG) {
  724                                                                           Syst em.out.pri ntln("Chec k C. - If  sp.TaxId ! = bp.TaxId  and sp.NP I = bp.NPI , display  sp.TaxId v alue in DT L-FL12, di splay noth ing for DT L-FL14, an d pull cor responding  values fo r DTL-FL15  thru DTL- FL18 for c laim: " +  claimIndex Id);
  725  
  726  
  727                                                                             Sy stem.out.p rintln("\n ServicePro vider Info  for claim : " + clai mIndexId);
  728                                                                                           System.out .println(" Federal Ta x ID: " +  this.servi ceProvider FederalTax ID);
  729                                                                                           System.out .println(" National P rovider ID : " + this .servicePr oviderNati onalProvid erID);
  730                                                                                           System.out .println(" First Name : " + this .servicePr oviderFirs tName);
  731                                                                                           System.out .println(" Last Name:  " + this. servicePro viderLastN ame);
  732                                                                                           System.out .println(" Middle Nam e: " + thi s.serviceP roviderMid dleName);
  733                                                                                           System.out .println(" Name Suffi x: " + thi s.serviceP roviderNam eSuffix);
  734                                                                                           System.out .println(" EXITING EV ALUATION\n ");
  735                                                                           }
  736  
  737                                                                  re turn;
  738  
  739  
  740                                                          }     // e nd if
  741  
  742                                                     } //  end if
  743  
  744  
  745                                 //  end check  C.
  746  
  747  
  748  
  749                                                               if(th is.service ProviderFe deralTaxID .equalsIgn oreCase(th is.billing ProviderFe deralTaxID ) ) {
  750                                                                            if  (!this.ser viceProvid erNational ProviderID .equalsIgn oreCase(th is.billing ProviderNa tionalProv iderID)) {
  751  
  752                                                                                  //  DISP LAY NOTHIN G IN sp.Ta xId
  753                                                                                  this.ser viceProvid erFederalT axID = "";
  754  
  755                                                                                           if(DEBUG)  {
  756                                                                                               System .out.print ln("\n");
  757                                 Sy stem.out.p rintln("Ch eck D. - I f sp.TaxId  != bp.Tax Id and sp. NPI = bp.N PI, displa y sp.TaxId  value in  DTL-FL12,  display no thing for  DTL-FL14,  and pull c orrespondi ng values  for DTL-FL 15 thru DT L-FL18 for  claim: "  + claimInd exId);
  758  
  759                                                                                                            Syst em.out.pri ntln("\nSe rviceProvi der Info f orm claim:  " + claim IndexId);
  760                                                                                                            Syst em.out.pri ntln("Fede ral Tax ID : " + this .servicePr oviderFede ralTaxID);
  761                                                                                                            Syst em.out.pri ntln("Nati onal Provi der ID: "  + this.ser viceProvid erNational ProviderID );
  762                                                                                                            Syst em.out.pri ntln("Firs t Name: "  + this.ser viceProvid erFirstNam e);
  763                                                                                                            Syst em.out.pri ntln("Last  Name: " +  this.serv iceProvide rLastName) ;
  764                                                                                                            Syst em.out.pri ntln("Midd le Name: "  + this.se rviceProvi derMiddleN ame);
  765                                                                                                            Syst em.out.pri ntln("Name  Suffix: "  + this.se rviceProvi derNameSuf fix);
  766                                                                                                            Syst em.out.pri ntln("EXIT ING EVALUA TION\n");
  767                                                                                                   }
  768  
  769                                                                                  // EXIT  ALL PROCES SING......
  770                                                                                  return;
  771                                                                            }    // end IF
  772  
  773                                                               }          // en d IF
  774  
  775  
  776  
  777                                 //  end condi tionn D
  778  
  779  
  780                                 /* *
  781                                  *  86932909
  782                                 E.   If sp.Ta xId != bp. TaxId and  sp.NPI !=  bp.NPI (BU T sp.NPI I S NOT NULL ), display  sp.TaxId  value in D TL-FL12, d isplay sp. NPI value  in DTL-FL1 4, and pul l correspo nding valu es for DTL -FL15 thru  DTL-FL18
  783  
  784                                  * /
  785                                                               if(!b NullNPI) {  // null i s differen t from ""  - see F.
  786                                                                        if(!thi s.serviceP roviderFed eralTaxID. equalsIgno reCase(thi s.billingP roviderFed eralTaxID) ) {
  787                                                                            if( !this.serv iceProvide rNationalP roviderID. equalsIgno reCase(bil lingProvid erNational ProviderID )) {
  788  
  789                                                                                     // di splay ever ything as- is
  790  
  791                                                                                                   if (DEBUG) {
  792                                                                                               System .out.print ln("\n");
  793                                      System.o ut.println ("Check E.  - If sp.T axId != bp .TaxId and  sp.NPI !=  bp.NPI, d isplay sp. TaxId valu e in DTL-F L12, displ ay sp.NPI  value in D TL-FL14, a nd pull co rrespondin g values f or DTL-FL1 5 thru DTL -FL18 for  claim: " +  claimInde xId);
  794  
  795                                                                                                            Syst em.out.pri ntln("\nSe rviceProvi der Info f orm claim:  " + claim IndexId);
  796                                                                                                            Syst em.out.pri ntln("Fede ral Tax ID : " + this .servicePr oviderFede ralTaxID);
  797                                                                                                            Syst em.out.pri ntln("Nati onal Provi der ID: "  + this.ser viceProvid erNational ProviderID );
  798                                                                                                            Syst em.out.pri ntln("Firs t Name: "  + this.ser viceProvid erFirstNam e);
  799                                                                                                            Syst em.out.pri ntln("Last  Name: " +  this.serv iceProvide rLastName) ;
  800                                                                                                            Syst em.out.pri ntln("Midd le Name: "  + this.se rviceProvi derMiddleN ame);
  801                                                                                                            Syst em.out.pri ntln("Name  Suffix: "  + this.se rviceProvi derNameSuf fix);
  802                                                                                                            Syst em.out.pri ntln("EXIT ING EVALUA TION\n");
  803                                                                                                   }
  804  
  805                                                                                                   re turn;
  806                                                                            }     // end i f
  807                                                                        }         // end i f
  808                                                               }
  809  
  810                                 //  end condi tion E.
  811  
  812  
  813                                 /* *
  814                                  *  F. 869824 59
  815                                 If  sp.TaxId  != pb.TaxI d and sp.  NPI is nul l, display  sp.TaxId  value in D TL-FL12, d isplay not hing in DT L-FL14, an d pull cor responding  values fo r DTL-FL15  thru DTL- FL18
  816                                  * /
  817  
  818                                                                if(! this.servi ceProvider FederalTax ID.equalsI gnoreCase( this.billi ngProvider FederalTax ID)) {
  819  
  820                                                                         if(bNu llNPI) {
  821                                                                                  // displ ay nothing  in DTL-FL 14
  822                                                                                  this.ser viceProvid erNational ProviderID  = "";
  823  
  824                                                                                  if(DEBUG ) {
  825                                                                                      Syst em.out.pri ntln("\n") ;
  826                                      System.o ut.println ("Check F.  - If sp.T axId != pb .TaxId and  sp. NPI i s null, di splay sp.T axId value  in DTL-FL 12, displa y nothing  in DTL-FL1 4, and pul l correspo nding valu es for DTL -FL15 thru  DTL-FL18  for claim:  " + claim IndexId);
  827  
  828                                                                                                   Sy stem.out.p rintln("\n ServicePro vider Info  form clai m: " + cla imIndexId) ;
  829                                                                                                   Sy stem.out.p rintln("Fe deral Tax  ID: " + th is.service ProviderFe deralTaxID );
  830                                                                                                   Sy stem.out.p rintln("Na tional Pro vider ID:  " + this.s erviceProv iderNation alProvider ID);
  831                                                                                                   Sy stem.out.p rintln("Fi rst Name:  " + this.s erviceProv iderFirstN ame);
  832                                                                                                   Sy stem.out.p rintln("La st Name: "  + this.se rviceProvi derLastNam e);
  833                                                                                                   Sy stem.out.p rintln("Mi ddle Name:  " + this. servicePro viderMiddl eName);
  834                                                                                                   Sy stem.out.p rintln("Na me Suffix:  " + this. servicePro viderNameS uffix);
  835                                                                                                   Sy stem.out.p rintln("EX ITING EVAL UATION\n") ;
  836                                                                                           }   // end  debug
  837  
  838                                                                                  return;
  839  
  840                                                                         }        // end i f
  841                                                                }        // end  if
  842                                 //  end Condi tion F.
  843  
  844  
  845                                 //  condition  2
  846  
  847  
  848  
  849  
  850                                 //  14 Servic e Provider  National  Provider I D test
  851                                                                            //  test for d ifferent S erviceProv iderId and  Billing P rovider Id
  852                                 //  conditito n 3
  853  
  854  
  855              }catch(Exc eption ex)  {
  856                      Sy stem.out.p rintln("Pa ymentDataE xtraction. setProvide rInfo() ER ROR: " + e x.getMessa ge());
  857                      ex .printStac kTrace();
  858                      LO GGER.error ("Error on  PaymentDa taExtracti on.setProv iderInfo,  errored on  Claim Key : {}",  cl aimIndexId );
  859                  LOGGER .error(ex. getMessage (), ex);
  860              }     // E ND TRY/CAT CH
  861  
  862  
  863  
  864  
  865           }  // end set ProviderIn fo()
  866  
  867   /**
  868           *  NOTE: fiel d #13 Serv ice Provid er Payer A ssigned Nu mber NOT i ncluded he re! Under  investigat ion 3/20
  869            *  This meth od sets th e Service  Provider I nformation
  870            *  @author B ill Blackm on
  871            *  @param cl aimIndexId
  872            * /
  873           pu blic void  setService ProviderIn fo(String  claimIndex Id) {
  874  
  875  
  876                    bool ean DEBUG= false;
  877  
  878                    bool ean bSameT axId = fal se;
  879                    bool ean bSameN PI = false ;
  880                    bool ean bNullT axId = fal se;
  881                    bool ean bNullN PI = false ;
  882  
  883                    Quer y q;
  884                List<?>  l;
  885                Iterator <?> it;
  886                // int i Count = 0;
  887  
  888                try {
  889  
  890                      St ring sql =  "SELECT p rovider_ti n, provide r_npi,  la st_name, f irst_name,   middle_n ame, name_ suffix  "  +
  891                                                       "  FROM provi der_info p  WHERE " +
  892                                                       "  claim_inde x = " + cl aimIndexId  + " and "  +
  893                                                       "  provider_t ype_cd = ' RENDERING  PROVIDER'  ";
  894  
  895  
  896                                                       //  " provide r_type_cd  = 'SERVICE _FACILITY’  ";
  897  
  898                                               if(DEBUG)        {
  899                                                       //  System.ou t.println( "setServic eProviderI nfo() - SQ L IS: " +  sql);
  900                                                       Sy stem.out.p rintln("se tServicePr oviderInfo () - CLAIM  IS: " + c laimIndexI d);
  901                                               }
  902  
  903                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  904                                                     l =  q.getResul tList();
  905                                                     it =  l.iterato r();
  906  
  907   if(DEBUG)  {
  908   if(l.size( )==0) {
  909           Sy stem.out.p rintln("\n setService ProviderIn fo() - NO  RECORDS FO R CLAIM: "  + claimIn dexId + "\ n");
  910           re turn;
  911   }
  912  
  913           if (l.size()  > 1) {
  914                    Syst em.out.pri ntln("\n\n setService ProviderIn fo() -WHHO OAAAHHH! -  multiple  records fo r claim: "  + claimIn dexId + "\ n\n");
  915           }
  916   }
  917  
  918                                                     // a ll returne d vals are  Strings
  919                                                     Stri ng temp =  "";
  920  
  921                                                     whil e (it.hasN ext())
  922                                                     {
  923                                                          Object[] r ow = (Obje ct[]) it.n ext();
  924  
  925  
  926  
  927                                                        i f(row != n ull)
  928                                                        {
  929  
  930  
  931  
  932   // FIELD 1 2              tax id
  933                                                                                   if(row[ 0] != null ) {
  934                                                                                            this.serv iceProvide rFederalTa xID = (Str ing) row[0 ];
  935                                                                                   } else  {
  936                                                                                            bNullTaxI d = true;
  937                                                                                   }
  938  
  939  
  940   // field 1 4      NPI
  941                                                                                   if(row[ 1] != null ) {
  942                                                                                           this.servi ceProvider NationalPr oviderID =  (String)  row[1];
  943                                                                                   } else  {
  944                                                                                            bNullNPI  = true;
  945                                                                                            }
  946  
  947                                                                                   if(row[ 2] != null ) {
  948                                                                                                    t his.servic eProviderL astName =  (String) r ow[2];
  949                                                                                   }
  950  
  951                                                                                            if(row[3]  != null)  {
  952                                                                                                    t his.servic eProviderF irstName =  (String)  row[3];
  953                                                                                            }
  954  
  955                                                                                            if(row[4]  != null)  {
  956                                                                                                    t his.servic eProviderM iddleName  = (String)  row[4];
  957                                                                                            }
  958  
  959                                                                                            if(row[5]  != null)  {
  960                                                                                                    t his.servic eProviderN ameSuffix  = (String)  row[5];
  961                                                                                            }
  962  
  963                                                        }
  964  
  965  
  966                                                }      //  END RECOR D LOOP.... .
  967  
  968  
  969  
  970  
  971   if(DEBUG)  {
  972  
  973                    if(( (! (this.s erviceProv iderFedera lTaxID.equ alsIgnoreC ase("")))  && (! (thi s.serviceP roviderNat ionalProvi derID.equa lsIgnoreCa se("")) )  )) {
  974                             /**
  975                             if(DEB UG) {
  976                                               System.out .println(" setService ProviderIn fo() - NEI THER TAX I D or PROVI DER ID are  empty for  id: " + c laimIndexI d);
  977                             }
  978                             **/
  979                             }
  980  
  981   // tax id  is empty a nd provide r id is NO T empty
  982                    if(( (this.serv iceProvide rFederalTa xID.equals IgnoreCase ("")) && ( ! (this.se rviceProvi derNationa lProviderI D.equalsIg noreCase(" ")) ) )) {
  983                             /**
  984                             if(DEB UG) {
  985                                      System.o ut.println ("setServi ceProvider Info() - T AX ID IS E MPTY and P ROVIDER ID  isn't for  id: " + c laimIndexI d);
  986                             }
  987                             **/
  988                    }
  989  
  990   // tax id  is NOT emp ty, provid er id IS e mpty
  991                    if(( (!this.ser viceProvid erFederalT axID.equal sIgnoreCas e("")) &&  (this.serv iceProvide rNationalP roviderID. equalsIgno reCase("") ) )) {
  992                             /**
  993                             if(DEB UG) {
  994                                               System.out .println(" setService ProviderIn fo() - TAX  ID IS NOT  EMPTY and  PROVIDER  ID IS EMPT Y for id:  " + claimI ndexId);
  995                             }
  996                             **/
  997                    }
  998   }
  999  
  1000  
  1001                    if(( this.servi ceProvider FederalTax ID.equalsI gnoreCase( "")) && (t his.servic eProviderN ationalPro viderID.eq ualsIgnore Case("")))  {
  1002  
  1003                             if(DEB UG) {
  1004                             System .out.print ln("setSer viceProvid erInfo() B OTH servic eProviderF ederalTaxI D and serv iceProvide rNationalP roviderID  are EMPTY  for claim:  " + claim IndexId);
  1005                             System .out.print ln("setSer viceProvid erInfo() -  SETTING s ervicedPro vider info rmation to  null - WI LL NOT BE  DISPLAYED" );
  1006                             }
  1007  
  1008  
  1009                              this. servicePro viderLastN ame = "";
  1010                              this. servicePro viderFirst Name = "";
  1011                              this. servicePro viderMiddl eName = "" ;
  1012                              this. servicePro viderNameS uffix = "" ;
  1013  
  1014                     ret urn;
  1015  
  1016                    }
  1017  
  1018  
  1019  
  1020   //
  1021   // ALSO CA TCHES D... less speci fic - leav e out for  now.....7/ 28
  1022   /**
  1023    *
  1024    *
  1025     *
  1026   if( !this. servicePro viderNatio nalProvide rID.equals IgnoreCase (this.bill ingProvide rNationalP roviderID) ) {
  1027  
  1028           if (DEBUG) {
  1029                    Syst em.out.pri ntln("setS erviceProv iderInfo()  - Top Lev el NPI com parison -  service NP I is DIFFE RENT than  billing NP I for clai m: " + cla imIndexId  + " checki ng for nul l sp.TaxId ");
  1030  
  1031           }
  1032  
  1033  
  1034           if ( !bNullTa xId ) {
  1035  
  1036                    this .servicePr oviderFede ralTaxID=t his.servic eProviderN ationalPro viderID;
  1037  
  1038                     if( DEBUG) {
  1039                                 Sy stem.out.p rintln("se tServicePr oviderInfo () - Top L evel NPI c omparison  - sp.TaxId  is NOT NU LL - setti ng sp.TaxI d to sp.NP I");
  1040                                      System.o ut.println ("\nServic eProvider  Info for c laim: " +  claimIndex Id);
  1041                                      System.o ut.println ("Federal  Tax ID: "  + this.ser viceProvid erFederalT axID);
  1042                                      System.o ut.println ("National  Provider  ID: " + th is.service ProviderNa tionalProv iderID);
  1043                                      System.o ut.println ("First Na me: " + th is.service ProviderFi rstName);
  1044                                      System.o ut.println ("Last Nam e: " + thi s.serviceP roviderLas tName);
  1045                                      System.o ut.println ("Middle N ame: " + t his.servic eProviderM iddleName) ;
  1046                                      System.o ut.println ("Name Suf fix: " + t his.servic eProviderN ameSuffix) ;
  1047                                      System.o ut.println ("EXITING  EVALUATION \n");
  1048  
  1049                      }      // end  debug
  1050  
  1051                     ret urn;
  1052           }        // e nd null ch eck
  1053  
  1054   } else {
  1055  
  1056           if (DEBUG) {
  1057                    Syst em.out.pri ntln("setS erviceProv iderInfo()  - Top Lev el NPI com parison -  service NP I is THE S AME than b illing NPI  - continu ing");
  1058           }
  1059  
  1060  
  1061   }       //  END top-l evel bp.NP I and sp.N PI compari son
  1062   **/
  1063  
  1064  
  1065  
  1066   /**
  1067    * Please  see 869329 08, in thi s ex, Rend ering’s ta x id = Bil ling’s tax  id, so Se rvice Prov ider Feder al Tax ID  is null (c aptured co rrectly),
  1068    */
  1069  
  1070  
  1071   // 8641954 9
  1072   // If both  sp.NPI an d sp.TaxID  are null,  display N OTHING for  ALL servi ce provide r fields ( DTL-FL12 t hru DTL-FL 18)
  1073  
  1074  
  1075                           if((bNul lNPI) && ( bNullTaxId ) ) {
  1076  
  1077  
  1078                               if(D EBUG) {
  1079                                        System .out.print ln("setSer viceProvid erInfo() -  Top Null  check - If  sp.TaxID  = bp.TaxId  and sp.NP I = bp.NPI , display  nothing fo r all serv ice provid er fields  (DTL-FL12  thru DTL-F L18) MET f or id: " +  claimInde xId);
  1080  
  1081                                               System.out .println(" \nServiceP rovider In fo for cla im: " + cl aimIndexId );
  1082                                                       Sy stem.out.p rintln("Fe deral Tax  ID: " + th is.service ProviderFe deralTaxID );
  1083                                                       Sy stem.out.p rintln("Na tional Pro vider ID:  " + this.s erviceProv iderNation alProvider ID);
  1084                                                       Sy stem.out.p rintln("Fi rst Name:  " + this.s erviceProv iderFirstN ame);
  1085                                                       Sy stem.out.p rintln("La st Name: "  + this.se rviceProvi derLastNam e);
  1086                                                       Sy stem.out.p rintln("Mi ddle Name:  " + this. servicePro viderMiddl eName);
  1087                                                       Sy stem.out.p rintln("Na me Suffix:  " + this. servicePro viderNameS uffix);
  1088                                                       Sy stem.out.p rintln("EX ITING EVAL UATION\n") ;
  1089  
  1090                               }
  1091  
  1092  
  1093                                       this.se rviceProvi derLastNam e = "";
  1094                                       this.se rviceProvi derFirstNa me = "";
  1095                                       this.se rviceProvi derMiddleN ame = "";
  1096                                       this.se rviceProvi derNameSuf fix = "";
  1097  
  1098                                       return;
  1099  
  1100                           }
  1101  
  1102  
  1103   /**
  1104    * 8632090 1 -
  1105    *
  1106   B.      If  sp.TaxID  = bp.TaxId  and sp.NP I = bp.NPI , display  nothing fo r all serv ice provid er fields  (DTL-FL12  thru DTL-F L18)
  1107  
  1108    */
  1109  
  1110                           if(this. servicePro viderFeder alTaxID.eq ualsIgnore Case(this. billingPro viderFeder alTaxID))  {
  1111                               if(t his.servic eProviderN ationalPro viderID.eq ualsIgnore Case(this. billingPro viderNatio nalProvide rID)) {
  1112  
  1113                                        // cle ar ALL val ues
  1114                                        this.s erviceProv iderFedera lTaxID="";
  1115                                        this.s erviceProv iderNation alProvider ID="";
  1116                                        this.s erviceProv iderLastNa me = "";
  1117                                                 this.ser viceProvid erFirstNam e = "";
  1118                                                 this.ser viceProvid erMiddleNa me = "";
  1119                                                 this.ser viceProvid erNameSuff ix = "";
  1120  
  1121  
  1122                                        if(DEB UG) {
  1123                                                 System.o ut.println ("setServi ceProvider Info()  Ch eck B. - I f sp.TaxID  = bp.TaxI d and sp.N PI = bp.NP I, display  nothing f or all ser vice provi der fields  (DTL-FL12  thru DTL- FL18) MET  for id: "  + claimInd exId);
  1124  
  1125                                                       Sy stem.out.p rintln("\n ServicePro vider Info  for claim : " + clai mIndexId);
  1126                                                                Syst em.out.pri ntln("Fede ral Tax ID : " + this .servicePr oviderFede ralTaxID);
  1127                                                                Syst em.out.pri ntln("Nati onal Provi der ID: "  + this.ser viceProvid erNational ProviderID );
  1128                                                                Syst em.out.pri ntln("Firs t Name: "  + this.ser viceProvid erFirstNam e);
  1129                                                                Syst em.out.pri ntln("Last  Name: " +  this.serv iceProvide rLastName) ;
  1130                                                                Syst em.out.pri ntln("Midd le Name: "  + this.se rviceProvi derMiddleN ame);
  1131                                                                Syst em.out.pri ntln("Name  Suffix: "  + this.se rviceProvi derNameSuf fix);
  1132                                                                Syst em.out.pri ntln("EXIT ING EVALUA TION\n");
  1133  
  1134                                        }
  1135  
  1136  
  1137  
  1138                                        // do  not contin ue
  1139                                                 return;
  1140  
  1141                               }
  1142  
  1143                           } // end  if
  1144  
  1145  
  1146   // end che ck B.
  1147  
  1148   // check C .
  1149   /**
  1150    * 8693288 9
  1151    C.     If  sp.TaxId  != bp.TaxI d and sp.N PI = bp.NP I, display  sp.TaxId  value in D TL-FL12, d isplay not hing for D TL-FL14, a nd pull co rrespondin g values f or DTL-FL1 5 thru DTL -FL18
  1152  
  1153   **/
  1154  
  1155                           if(!this .servicePr oviderFede ralTaxID.e qualsIgnor eCase(this .billingPr oviderFede ralTaxID))  {
  1156                               if(t his.servic eProviderN ationalPro viderID.eq ualsIgnore Case(billi ngProvider NationalPr oviderID))  {
  1157  
  1158                                        // fie ld NOTHING  in field  14 NPI
  1159                                        this.s erviceProv iderNation alProvider ID = "";
  1160  
  1161  
  1162                                        if(DEB UG) {
  1163                                                 System.o ut.println ("setServi ceProvider Info() Che ck C. - If  sp.TaxId  != bp.TaxI d and sp.N PI = bp.NP I, display  sp.TaxId  value in D TL-FL12, d isplay not hing for D TL-FL14, a nd pull co rrespondin g values f or DTL-FL1 5 thru DTL -FL18 for  claim: " +  claimInde xId);
  1164  
  1165  
  1166                                                   System .out.print ln("\nServ iceProvide r Info for  claim: "  + claimInd exId);
  1167                                                                Syst em.out.pri ntln("Fede ral Tax ID : " + this .servicePr oviderFede ralTaxID);
  1168                                                                Syst em.out.pri ntln("Nati onal Provi der ID: "  + this.ser viceProvid erNational ProviderID );
  1169                                                                Syst em.out.pri ntln("Firs t Name: "  + this.ser viceProvid erFirstNam e);
  1170                                                                Syst em.out.pri ntln("Last  Name: " +  this.serv iceProvide rLastName) ;
  1171                                                                Syst em.out.pri ntln("Midd le Name: "  + this.se rviceProvi derMiddleN ame);
  1172                                                                Syst em.out.pri ntln("Name  Suffix: "  + this.se rviceProvi derNameSuf fix);
  1173                                                                Syst em.out.pri ntln("EXIT ING EVALUA TION\n");
  1174                                               }
  1175  
  1176                                        return ;
  1177  
  1178  
  1179                               }      // end i f
  1180  
  1181                           } // end  if
  1182  
  1183  
  1184   // end che ck C.
  1185  
  1186  
  1187  
  1188                                     if(this.s erviceProv iderFedera lTaxID.equ alsIgnoreC ase(this.b illingProv iderFedera lTaxID) )  {
  1189                                                  if (!th is.service ProviderNa tionalProv iderID.equ alsIgnoreC ase(this.b illingProv iderNation alProvider ID)) {
  1190  
  1191                                                       //   DISPLAY  NOTHING IN  sp.TaxId
  1192                                                       th is.service ProviderFe deralTaxID  = "";
  1193  
  1194  
  1195                                                                if(D EBUG) {
  1196                                                                     System.out .println(" \n");
  1197   System.out .println(" setService ProviderIn fo() Check  D. - If s p.TaxId !=  bp.TaxId  and sp.NPI  = bp.NPI,  display s p.TaxId va lue in DTL -FL12, dis play nothi ng for DTL -FL14, and  pull corr esponding  values for  DTL-FL15  thru DTL-F L18 for cl aim: " + c laimIndexI d);
  1198  
  1199                                                                                  System.o ut.println ("\nServic eProvider  Info form  claim: " +  claimInde xId);
  1200                                                                                  System.o ut.println ("Federal  Tax ID: "  + this.ser viceProvid erFederalT axID);
  1201                                                                                  System.o ut.println ("National  Provider  ID: " + th is.service ProviderNa tionalProv iderID);
  1202                                                                                  System.o ut.println ("First Na me: " + th is.service ProviderFi rstName);
  1203                                                                                  System.o ut.println ("Last Nam e: " + thi s.serviceP roviderLas tName);
  1204                                                                                  System.o ut.println ("Middle N ame: " + t his.servic eProviderM iddleName) ;
  1205                                                                                  System.o ut.println ("Name Suf fix: " + t his.servic eProviderN ameSuffix) ;
  1206                                                                                  System.o ut.println ("EXITING  EVALUATION \n");
  1207                                                                         }
  1208  
  1209  
  1210                                                       //  EXIT ALL  PROCESSING ......
  1211                                                       re turn;
  1212                                                  }   //  end IF
  1213  
  1214                                     }          // end IF
  1215  
  1216  
  1217  
  1218   // end con ditionn D
  1219  
  1220  
  1221   /**
  1222    * 8693290 9
  1223   E.      If  sp.TaxId  != bp.TaxI d and sp.N PI != bp.N PI (BUT sp .NPI IS NO T NULL), d isplay sp. TaxId valu e in DTL-F L12, displ ay sp.NPI  value in D TL-FL14, a nd pull co rrespondin g values f or DTL-FL1 5 thru DTL -FL18
  1224  
  1225    */
  1226                                     if(!bNull NPI) { //  null is di fferent fr om "" - se e F.
  1227                                             i f(!this.se rviceProvi derFederal TaxID.equa lsIgnoreCa se(this.bi llingProvi derFederal TaxID)) {
  1228                                                  if(!thi s.serviceP roviderNat ionalProvi derID.equa lsIgnoreCa se(billing ProviderNa tionalProv iderID)) {
  1229  
  1230                                                           // displa y everythi ng as-is
  1231  
  1232                                                                         if(DEB UG) {
  1233                                                                     System.out .println(" \n");
  1234           Sy stem.out.p rintln("se tServicePr oviderInfo () - Check  E. - If s p.TaxId !=  bp.TaxId  and sp.NPI  != bp.NPI , display  sp.TaxId v alue in DT L-FL12, di splay sp.N PI value i n DTL-FL14 , and pull  correspon ding value s for DTL- FL15 thru  DTL-FL18 f or claim:  " + claimI ndexId);
  1235  
  1236                                                                                  System.o ut.println ("\nServic eProvider  Info form  claim: " +  claimInde xId);
  1237                                                                                  System.o ut.println ("Federal  Tax ID: "  + this.ser viceProvid erFederalT axID);
  1238                                                                                  System.o ut.println ("National  Provider  ID: " + th is.service ProviderNa tionalProv iderID);
  1239                                                                                  System.o ut.println ("First Na me: " + th is.service ProviderFi rstName);
  1240                                                                                  System.o ut.println ("Last Nam e: " + thi s.serviceP roviderLas tName);
  1241                                                                                  System.o ut.println ("Middle N ame: " + t his.servic eProviderM iddleName) ;
  1242                                                                                  System.o ut.println ("Name Suf fix: " + t his.servic eProviderN ameSuffix) ;
  1243                                                                                  System.o ut.println ("EXITING  EVALUATION \n");
  1244                                                                         }
  1245  
  1246                                                                         return ;
  1247                                                  }    //  end if
  1248                                             }         //  end if
  1249                                     }
  1250  
  1251   // end con dition E.
  1252  
  1253  
  1254   /**
  1255    * F. 8698 2459
  1256   If sp.TaxI d != pb.Ta xId and sp . NPI is n ull, displ ay sp.TaxI d value in  DTL-FL12,  display n othing in  DTL-FL14,  and pull c orrespondi ng values  for DTL-FL 15 thru DT L-FL18
  1257    */
  1258  
  1259                                      if(!this .servicePr oviderFede ralTaxID.e qualsIgnor eCase(this .billingPr oviderFede ralTaxID))  {
  1260  
  1261                                               if(bNullNP I) {
  1262                                                       //  display n othing in  DTL-FL14
  1263                                                       th is.service ProviderNa tionalProv iderID = " ";
  1264  
  1265  
  1266                                                       if (DEBUG) {
  1267                                                            System.o ut.println ("\n");
  1268           Sy stem.out.p rintln("se tServicePr oviderInfo () - Check  F. - If s p.TaxId !=  pb.TaxId  and sp. NP I is null,  display s p.TaxId va lue in DTL -FL12, dis play nothi ng in DTL- FL14, and  pull corre sponding v alues for  DTL-FL15 t hru DTL-FL 18 for cla im: " + cl aimIndexId );
  1269  
  1270                                                                         System .out.print ln("\nServ iceProvide r Info for m claim: "  + claimIn dexId);
  1271                                                                         System .out.print ln("Federa l Tax ID:  " + this.s erviceProv iderFedera lTaxID);
  1272                                                                         System .out.print ln("Nation al Provide r ID: " +  this.servi ceProvider NationalPr oviderID);
  1273                                                                         System .out.print ln("First  Name: " +  this.servi ceProvider FirstName) ;
  1274                                                                         System .out.print ln("Last N ame: " + t his.servic eProviderL astName);
  1275                                                                         System .out.print ln("Middle  Name: " +  this.serv iceProvide rMiddleNam e);
  1276                                                                         System .out.print ln("Name S uffix: " +  this.serv iceProvide rNameSuffi x);
  1277                                                                         System .out.print ln("EXITIN G EVALUATI ON\n");
  1278                                                                }    // end deb ug
  1279  
  1280                                                       re turn;
  1281  
  1282                                               }       //  end if
  1283                                      }        // end if
  1284   // end Con dition F.
  1285  
  1286   // debug o utput
  1287   if(DEBUG)  {
  1288           Sy stem.out.p rintln("\n setService ProviderIn fo() Servi ceProvider  Info form  claim: "  + claimInd exId);
  1289           Sy stem.out.p rintln("Fe deral Tax  ID: " + th is.service ProviderFe deralTaxID );
  1290           Sy stem.out.p rintln("Na tional Pro vider ID:  " + this.s erviceProv iderNation alProvider ID);
  1291           Sy stem.out.p rintln("Fi rst Name:  " + this.s erviceProv iderFirstN ame);
  1292           Sy stem.out.p rintln("La st Name: "  + this.se rviceProvi derLastNam e);
  1293           Sy stem.out.p rintln("Mi ddle Name:  " + this. servicePro viderMiddl eName);
  1294           Sy stem.out.p rintln("Na me Suffix:  " + this. servicePro viderNameS uffix);
  1295           Sy stem.out.p rintln("EX ITING EVAL UATION\n") ;
  1296   }
  1297  
  1298                           }catch(E xception e x) {
  1299                               Syst em.out.pri ntln("Paym entDataExt raction.se tServicePr oviderInfo () ERROR:  " + ex.get Message()) ;
  1300                               ex.p rintStackT race();
  1301                               LOGG ER.error(" Error on P aymentData Extraction .setServic eProviderI nfo, error ed on Clai m Key: {}" ,  claimIn dexId);
  1302                               LOGG ER.error(e x.getMessa ge(), ex);
  1303                           } // END  TRY/CATCH
  1304  
  1305  
  1306   } // end s etServiceP roviderInf o()
  1307  
  1308  
  1309  
  1310  
  1311  
  1312  
  1313  
  1314           /* *
  1315            *  This meth od sets th e modifier s
  1316            *  @author B ill Blackm on
  1317            *  @param St ring claim IndexId
  1318            *  @param St ring seque nce number
  1319            *
  1320            * /
  1321           pu blic void  setModifie rs(String  claimIndex Id, String  procSeqNb r) {
  1322  
  1323                     Str ing sql =  "select mo difier1, m odifier2,  modifier3,  modifier4  from clai m_procedur e where CL AIM_INDEX  = " + clai mIndexId +  " and cla im_procedu re_seq = "  + procSeq Nbr;
  1324  
  1325                    Quer y q;
  1326                List<?>  l;
  1327                Iterator <?> it;
  1328  
  1329   // clear p revious va lues.
  1330                this.pro cedureModi fier1="";
  1331                this.pro cedureModi fier2="";
  1332                this.pro cedureModi fier3="";
  1333                this.pro cedureModi fier4="";
  1334  
  1335                    // c heck for n ulls first  - can't t rust data
  1336                    if(  (claimInde xId != nul l) && (pro cSeqNbr !=  null) ) {
  1337  
  1338                             try {
  1339                                            q  = this.ent ityManager .createNat iveQuery(s ql);
  1340                                            l  = q.getRes ultList();
  1341                                            it  = l.itera tor();
  1342  
  1343                                            //  loop thro ugh and as sign vals
  1344                                            St ring tmp =  "";
  1345                                            wh ile (it.ha sNext()) {
  1346                                                        O bject[] ro w = (Objec t[]) it.ne xt();
  1347  
  1348  
  1349                                                        i f(row != n ull) {
  1350                                                                 //  check for  null value s before a ssignment. ..
  1351                                                                 tmp  = (String ) row[0];
  1352                                                                 if( tmp != nul l) {
  1353                                                                          this. procedureM odifier1 =  (String)  row[0];
  1354                                                                 }
  1355  
  1356                                                                 tmp  = (String ) row[1];
  1357                                                                 if( tmp != nul l) {
  1358                                                                          this. procedureM odifier2 =  (String)  row[1];
  1359                                                                 }
  1360  
  1361                                                                 tmp  = (String ) row[2];
  1362                                                                 if( tmp != nul l) {
  1363                                                                          this. procedureM odifier3 =  (String)  row[2];
  1364                                                                 }
  1365  
  1366                                                                 tmp  = (String ) row[3];
  1367                                                                 if( tmp != nul l) {
  1368                                                                          this. procedureM odifier4 =  (String)  row[3];
  1369                                                                 }
  1370  
  1371                                                                } //  end if
  1372                                       }       // end whi le
  1373                             } catc h(Exceptio n ex) {
  1374                               Syst em.out.pri ntln("Paym entDataExt raction.se tModifiers () ERROR:  " + ex.get Message()) ;
  1375                               LOGG ER.error(" Error on P aymentData Extraction .setModifi ers(), err ored on Cl aim Key: { }",  claim IndexId);
  1376                               LOGG ER.error(e x.getMessa ge(), ex);
  1377                             }        // end t ry/catch
  1378  
  1379                    }        // end  if
  1380  
  1381  
  1382           }        // e nd setModi fiers()
  1383  
  1384  
  1385  
  1386  
  1387  
  1388           /* *
  1389            *  Get Entit y-level Li ne Item Co ntrol Numb ers
  1390            *  @author B ill Blackm on
  1391            *  @param St ring claim  index
  1392            *  @return A rrayList
  1393           ** /
  1394           @S uppressWar nings("unc hecked")
  1395           pu blic Array List getEn tityLineIt emControlN umbers(Str ing claimI ndexId) {
  1396  
  1397                    bool ean DEBUG  = false;
  1398  
  1399                    Arra yList list  = new Arr ayList();
  1400  
  1401                    Quer y q;
  1402                List<?>  l;
  1403                Iterator <?> it;
  1404                String t mp = "";
  1405  
  1406                try {
  1407  
  1408                      St ring sql =  " SELECT  ref02scnd_ id AS LINE _ITEM_CONT ROL_NUMBER  " +
  1409                                                  " FROM  Claims, en tity_adtl_ id " +
  1410                                     " WHERE c laim_index  = '" + cl aimIndexId  + "' and  Edi_claim_ key = clai m_key and  loop_id =  '2400' and  ref01id_q lfr = '6R'  order by  LINE_ITEM_ CONTROL_NU MBER  ";
  1411  
  1412                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  1413   // fail... .invalid n umber
  1414   // SELECT  ref02scnd_ id AS LINE _ITEM_CONT ROL_NUMBER   FROM ent ity_adtl_i d  WHERE c laim_key =  86435644  and loop_i d = '2400'  and ref01 id_qlfr =  '6R' order  by LINE_I TEM_CONTRO L_NUMBER
  1415                                                     l =  q.getResul tList();
  1416                                                     it =  l.iterato r();
  1417  
  1418  
  1419                                                     whil e (it.hasN ext()) {
  1420   // System. out.printl n("Top Lev el lineIte mControlNu mbers foun d for id:  " + claimI ndexId);
  1421   // System. out.printl n("SQL IS:  " + sql);
  1422   // CHECK F OR VALUES  HERE THAT  ARE PUT IN TO ARRAY.. ...
  1423                                                             Object  row = (Str ing) it.ne xt();
  1424  
  1425                                                        i f(row != n ull) {
  1426  
  1427   tmp = row. toString() ;if(DEBUG)  {
  1428           Sy stem.out.p rintln("pd e.getEntit yLineItemC ontrolNumb ers() - ar ray item i s: " + tmp );
  1429   }
  1430  
  1431  
  1432  
  1433  
  1434  
  1435                                                                list .add(tmp);
  1436                                                        }
  1437                                                     }
  1438  
  1439                  }catch (Exception  ex) {
  1440                      Sy stem.out.p rintln("Pa ymentDataE xtraction. getEntityL ineItemCon trolNumber s() ERROR:  " + ex.ge tMessage() );
  1441                      LO GGER.error ("Error on  PaymentDa taExtracti on.getEnti tyLineItem ControlNum bers(), er rored on C laim Key:  {}",  clai mIndexId);
  1442                      LO GGER.error (ex.getMes sage(), ex );
  1443                  }
  1444  
  1445  
  1446                    retu rn list;
  1447           }  // end get EntityLine ItemContro lNumbers()
  1448  
  1449  
  1450  
  1451  
  1452   /**
  1453    * ROUGH D RAFT - get  detail re cords SQL
  1454    *
  1455    * find se rvice code  type firs t......
  1456  
  1457  
  1458   These line  item cont rol number s have PRE CEDENCE ov er the LIN E_ITEM_CON TROL_NUMBE RS in the  separate
  1459   service-co de-type ba sed LINE_I TEM_CONTRO L_NUMBERS.
  1460  
  1461   This SQL m ay return  multiple r ecords or  0 records.
  1462   If 0 recor ds, use th e service- code-type  LINE_ITEM_ CONTROL_NU MBERs,
  1463   else use t he TOP LEV EL items.. ...
  1464  
  1465   Test this  with new d ata to ens ure that t he count o f TOP LEVE L records  matches th e count of  detail re cords
  1466   for a give n Claim... ....
  1467  
  1468   Move to se parate met hod - getE ntityLineI temControl Number(Str ing claimI ndexId)
  1469   select ref 02scnd_id  AS LINE_IT EM_CONTROL _NUMBER //  this is a  String
  1470   from
  1471   entity_adt l_id
  1472   where clai m_key = xx x and
  1473   loop_id =  '2400' and  ref01id_q lfr = '6R'
  1474   order by r ef02scnd_i d
  1475   // multipl e records  returned.
  1476   //
  1477  
  1478   use line_i tem_contro l_number h ere if fou nd
  1479  
  1480   in any cas e, run the  individua l sqls bas ed on serv ice code a nd disrega rd l.line_ item_cotro l
  1481  
  1482   @author Bi ll Blackmo n
  1483   @param Str ing claim  index id
  1484   @return Li st of deta il records  for given  claim
  1485    *
  1486    */
  1487   @SuppressW arnings({  "unchecked ", "rawtyp es", "null " })
  1488   public Lis t getDetai lRecords(S tring clai mIndexId)  {
  1489  
  1490           bo olean DEBU G = false;
  1491  
  1492           Li st lDetail Records =  new ArrayL ist();
  1493           St ring curSQ L = "";
  1494           bo olean bTop Found = fa lse;
  1495           in t pos = 0;
  1496           in t posTest  = 0;
  1497  
  1498           Qu ery q;
  1499       List<? > l;
  1500       Iterat or<?> it;
  1501  
  1502  
  1503    // new -  7/17
  1504       String  sqlProfes sional = "  SELECT "  +
  1505                " claim_ procedure_ seq, proc_ code_desc,  cp.billed _amount, "  +
  1506                " cpr.pa id_amount,  PSL.LX01A SGN_LN_ITM  AS LINE_I TEM_CONTRO L_NUMBER,  " +
  1507                " cp.ser vice_from_ date,  cp. service_to _date, cp. revenue_cd , cp.bille d_units, c p.proc_cod e, psl.SV1 01PROC_CD_ QUAL " +
  1508            "  FROM " +
  1509                 " fpps_ owner.clai ms c " +
  1510                 " join  fpps_owner .claim_pro cedure cp  on c.claim _index = c p.claim_in dex " +
  1511                 " join  e_repos.cl aim cc on  c.edi_clai m_key = cc .claim_key  " +
  1512                 " join  prfsn_svc_ line psl   on cc.clai m_key = ps l.claim_ke y  and PSL .LX01ASGN_ LN_ITM = C P.CLAIM_PR OCEDURE_SE Q " +
  1513                 " left  join claim _proc_reco n cpr on C P.CLAIM_PR OC_ID = CP R.CLAIM_PR OC_ID " +
  1514                 " where  " +
  1515                 " c.cla im_index =    " + cla imIndexId  + " ORDER  BY claim_p rocedure_s eq ";
  1516  
  1517                    // n ew 7/17
  1518  
  1519                    Stri ng sqlInst itutional  = " SELECT  " +
  1520                       "  claim_pro cedure_seq , proc_cod e_desc, cp .billed_am ount, cpr. paid_amoun t, isl.LX0 1ASGN_LN_n br AS LINE _ITEM_CONT ROL_NUMBER , " +
  1521                       "  cp.servic e_from_dat e, cp.serv ice_to_dat e, cp.reve nue_cd, cp .billed_un its, cp.pr oc_code, i sl.SV202SV C_ID_QUAL  " +
  1522                    " FR OM "  +
  1523                       "  fpps_owne r.claims c  " +
  1524                       "  join fpps _owner.cla im_procedu re cp on c .claim_ind ex = cp.cl aim_index  " +
  1525                       "  join e_re pos.claim  cc on c.ed i_claim_ke y = cc.cla im_key " +
  1526                       "  join inst _svc_line  isl  on cc .claim_key  = isl.cla im_key  an d iSL.LX01 ASGN_LN_nb r = CP.CLA IM_PROCEDU RE_SEQ " +
  1527                       "  left join  claim_pro c_recon cp r on cpr.c laim_proc_ id = CP.CL AIM_PROC_I D " +
  1528                    " wh ere " +
  1529                      "  c.claim_in dex =" + c laimIndexI d + " ORDE R BY claim _procedure _seq ";
  1530  
  1531  
  1532   // DENTAL  claims onl y  New 7/1 7
  1533  
  1534                    Stri ng sqlDent al = " SEL ECT " +
  1535                             " clai m_procedur e_seq, pro c_code_des c, cp.bill ed_amount,  cpr.paid_ amount, dS L.LX01ASGN _LN_itm AS  LINE_ITEM _CONTROL_N UMBER, " +
  1536                             " cp.s ervice_fro m_date, cp .service_t o_date, cp .revenue_c d, cp.bill ed_units,   cp.proc_c ode, " +
  1537                             "dsl.S V301ADA_CD _QUAL " +
  1538                              " FRO M " +
  1539                              " fpp s_owner.cl aims c " +
  1540                              " joi n fpps_own er.claim_p rocedure c p on c.cla im_index =  cp.claim_ index " +
  1541                              " joi n e_repos. claim cc o n c.edi_cl aim_key =  cc.claim_k ey " +
  1542                              " joi n dental_s vc_line ds l  on cc.c laim_key =  dsl.claim _key  and  dSL.LX01AS GN_LN_itm  = CP.CLAIM _PROCEDURE _SEQ " +
  1543                              " lef t join cla im_proc_re con cpr on  cp.claim_ proc_id= c pr.claim_p roc_id " +
  1544                             " wher e " +
  1545                             " c.cl aim_index  = " + clai mIndexId +  " ORDER B Y claim_pr ocedure_se q ";
  1546  
  1547  
  1548  
  1549           //  find out  type of re cord - DEN TAL, PROFE SSIONAL or  INSTITUTI ONAL
  1550           //  based on  serviceTyp eCode, cal l one of t he followi ng SQL sta tements be low.
  1551           //  all shoul d return t he same fi elds that  are necess ary to get  ALL field s necessar y for a de tail recor d
  1552  
  1553           //  set the s erviceType Code for t his partic ular claim
  1554           tr y {
  1555                                               // set the  serviceTy peCode for  this part icular cla im
  1556  
  1557  
  1558                                               String stc  = getServ iceTypeCod e();
  1559  
  1560                                               // THEN SE T THIS VAL UE FOR EAC H CLAIM
  1561                                               // setServ iceQualifi erID(claim IndexId);
  1562  
  1563  
  1564   // System. out.printl n("getDeta ilRecords( ) - servic e type cod e is: " +  stc + " fo r claim: "  + claimIn dexId);
  1565  
  1566   // test tr ap, 6/19 B .B.
  1567                                               if( (stc.e qualsIgnor eCase(""))  || (stc.l ength()==0 ) || (stc  == null) )  {
  1568   // EXIT ME THOD...... or excepti on will be  thrown be low
  1569                                                       re turn lDeta ilRecords; // new - 7 /17
  1570                                               }
  1571  
  1572  
  1573  
  1574                                               // get lis t of Entit y-level li ne item co ntrol numb ers
  1575   if(DEBUG)  {
  1576           Sy stem.out.p rintln("\n pde.getDet ailRecords () - calli ng getLine ItemContro lNumbers") ;
  1577           ge tNow();
  1578   }
  1579  
  1580   // NOTE: P OSSIBLY MO VE THIS CA LL TO TOP  OF RECORDS  LOOP?
  1581                                               ArrayList  lcns = get EntityLine ItemContro lNumbers(c laimIndexI d);
  1582  
  1583   if(DEBUG)  {
  1584           Sy stem.out.p rintln("\n pde.getDet ailRecords () - DONE  calling ge tLineItemC ontrolNumb ers");
  1585           ge tNow();
  1586   }
  1587  
  1588  
  1589  
  1590   // System. out.printl n("getDeta ilRecords( ) id = " +   claimInd exId + " -  top-level  lineItemC ontrolNumb ers array  size is: "  + lcns.si ze());
  1591  
  1592                                               if(lcns.si ze() > 0)  {
  1593   //                                                   S ystem.out. println("g etDetailRe cords() -  TOP LEVEL  DETAIL REC ORDS FOUND  for ID: "  + claimIn dexId);
  1594                                                       bT opFound =  true;
  1595                                               } else {
  1596   //                                                   S ystem.out. println("g etDetailRe cords() -  NO TOP LEV EL DETAIL  RECORDS FO UND for ID : " + clai mIndexId);
  1597                                               }
  1598  
  1599                                               // run SQL  based on  stc
  1600                                       if ("DE NT".equals IgnoreCase (stc)) {
  1601                                                curSQL =  sqlDental;
  1602   // System. out.printl n("Payment DataExtrac tion.getDe tailRecord s() - DENT  serviceTy peCode");
  1603                                } e lse if("PR OF".equals IgnoreCase (serviceTy peCode)) {
  1604                                       curSQL  = sqlProfe ssional;
  1605   // System. out.printl n("Payment DataExtrac tion.getDe tailRecord s() - PROF  serviceTy peCode");
  1606                                } e lse if("IN ST".equals IgnoreCase (serviceTy peCode)) {
  1607                                         curSQ L = sqlIns titutional ;
  1608   // System. out.printl n("Payment DataExtrac tion.getDe tailRecord s() - INST  serviceTy peCode");
  1609                                }
  1610   // System. out.printl n("getDeta ilRecords( ) - execut ing SQL: "  + curSQL) ;
  1611  
  1612   if(DEBUG)  {
  1613           Sy stem.out.p rintln("pd e.getDetai lRecords()  - RUNNING  QUERY..") ;
  1614           ge tNow();
  1615   }
  1616                     q =  this.enti tyManager. createNati veQuery(cu rSQL);
  1617                 l = q.g etResultLi st();
  1618  
  1619   if(DEBUG)  {
  1620                    Syst em.out.pri ntln("pde. getDetailR ecords() -  END RUNNI NG QUERY.. ");
  1621                    getN ow();
  1622   }
  1623  
  1624  
  1625  
  1626                                  i t = l.iter ator();
  1627  
  1628   // System. out.printl n("getDeta ilRecords( ) record c ount is: "  + l.size( ));
  1629  
  1630                                       // extr act values  from resu ltset
  1631                                       while ( it.hasNext ()) {
  1632  
  1633   if(DEBUG)  {
  1634   //               Syst em.out.pri ntln("\npd e.getDetai lRecords()  - in reco rd loop... ");
  1635   //               getN ow();
  1636   }
  1637  
  1638  
  1639                                       Object[ ] row = (O bject[]) i t.next();
  1640  
  1641                                       if(row  != null) {
  1642                                                if(row[0]  != null)  {
  1643                                                        t his.claimP rocedureSe q = (BigDe cimal) row [0];
  1644                                                } else {
  1645   // System. out.printl n("getDeta ilRecords( ) - claimP rocedureSe q is null  for id: "  + claimInd exId);
  1646                                                }
  1647  
  1648  
  1649                                                if(row[1]  != null)
  1650                                                        t his.procCo deDesc = ( String) ro w[1];
  1651  
  1652  
  1653                                                if(row[2]  != null)  {
  1654                                                        t his.billed Amt = (Big Decimal) r ow[2];
  1655  
  1656   // System. out.printl n("getDeta ilRecords( ) - billed  amt is: "  + this.bi lledAmt);
  1657                                                } else {
  1658   // System. out.printl n("getDeta ilRecords( ) - NULL B ILLED AMOU NT");
  1659                                                }
  1660  
  1661  
  1662  
  1663                                                if(row[3]  != null)  {
  1664                                                        t his.paidAm t = (BigDe cimal) row [3];
  1665  
  1666                                                        i f(this.pai dAmt.signu m() == -1)  {
  1667   //                                                            Sys tem.out.pr intln("NEG ATIVE AMT  AND ID ARE : " + this .paidAmt +  ", " + cl aimIndexId );
  1668                                                                 thi s.bNegativ ePaidAmoun t=true;
  1669                                                        }
  1670                                                } else {
  1671   // System. out.printl n("getDeta ilRecords( ) - NULL P AID AMOUNT  for: " +  claimIndex Id);
  1672  
  1673                                                }
  1674  
  1675  
  1676                                                if(row[4]  != null)  {
  1677                                                        / / line ite m control  numbers fo und....dSL .LX01ASGN_ LN_itm AS  LINE_ITEM_ CONTROL_NU MBER
  1678                                                        i f(bTopFoun d) {
  1679                                                                         // Sys tem.out.pr intln("get DetailReco rds() - to pFound - s wapping lc n - item i n foundArr ay is: " +  lcns.get( pos));
  1680  
  1681                                                                         if(DEB UG) {
  1682                                                                                           System.out .println(" getDetailR ecords() -  lcns size  is: " + l cns.size() );
  1683                                                                                           System.out .println(" posTest is : " + posT est);
  1684                                                                                           System.out .println(" pos is: "  + pos);
  1685                                                                                           System.out .println(" claimIndex Id is: " +  claimInde xId);
  1686                                                                                  }
  1687  
  1688   /**
  1689    * java.la ng.IndexOu tOfBoundsE xception:  Index: 2,  Size: 2        - ERRO R - pos is  being inc remented w hen it sho uldn't be. ....
  1690    * WHAT IS  THE CONDI TION FOR I T TO BE IN CREMENTED?
  1691                    at j ava.util.A rrayList.R angeCheck( Unknown So urce) [na: 1.6.0_29]
  1692                    at j ava.util.A rrayList.g et(Unknown  Source) [ na:1.6.0_2 9]
  1693    */
  1694                                                                                  try {
  1695                                                                                                   //  prevent i ndex overr un
  1696                                                                                               if(pos  < lcns.si ze()) {
  1697                                                                                                            this .lineItemC ontrolNumb er = (Stri ng) lcns.g et(pos).to String();
  1698                                                                                                            if(D EBUG) {
  1699                                                                                                                     System .out.print ln("pde.ge tDetailRec ords() - l ineItemCon trolNumber  set to: "  + this.li neItemCont rolNumber) ;
  1700                                                                                                            }
  1701                                                                                               }
  1702                                                                                  }catch(E xception x ) {
  1703                                                                                           System.out .println(" ERROR W AR RAY ID IS:  " + claim IndexId);
  1704                                                                                           System.out .println(" Error with  array: "  + x.getMes sage());
  1705                                                                                  }
  1706                                                                                  pos++;
  1707  
  1708                                                        }  else {
  1709                                                                 thi s.lineItem ControlNum ber = (Str ing) row[4 ].toString ();
  1710   // System. out.printl n("getDeta ilRecords( ) - topFou nd = FALSE  - bottom  lcn is: "  + lineItem ControlNum ber);
  1711                                                        }       // e nd top lin e item con trol numbe r check
  1712   // System. out.printl n("getDeta ilRecords( ) - FINAL  lcn is: "  + lineItem ControlNum ber);
  1713                                                }      //  end line  item contr ol number  processing ....
  1714  
  1715  
  1716                                                if(row[5]  != null)
  1717                                                        t his.servic eFromDate  = (Timesta mp) row[5] ;
  1718  
  1719                                                if(row[6]  != null)
  1720                                                        t his.servic eToDate =  (Timestamp ) row[6];
  1721  
  1722  
  1723                                                if(row[7]  != null)  {
  1724                                                        t his.revenu eCode = (S tring) row [7];
  1725   // System. out.printl n("getDeta ilRecords( ) - revenu eCode is:  " + this.r evenueCode );
  1726                                                }
  1727                                                if(row[8]  != null)
  1728                                                        t his.billed Units = (B igDecimal)  row[8];
  1729  
  1730  
  1731   // Detail  item #7 Se rvice Iden tification  Code
  1732                                                if(row[9]  != null)  {
  1733                                                        t his.procCo de = (Stri ng) row[9] ;
  1734                                                } else {
  1735   //                                                   S ystem.out. println("g etDetailRe cords() -  proc code  is null -  setting to  empty str ing");
  1736                                                        t his.procCo de = "";
  1737                                                }
  1738  
  1739  
  1740  
  1741   // System. out.printl n("getDeta ilRecords( ) - Initia l Claim ID , procCode  and procC odeDescrip tion value s are: " +  claimInde xId +": "  + this.pro cCode + ":  " +  this .procCodeD esc);
  1742  
  1743   // HERE... .
  1744   // from Ma ry - 8/26
  1745   /**
  1746    * Inpatie nt institu tional cla ims will o ften have  no procedu re codes
  1747    * so you  have to fa ll back to  the Reven ue code an d then the  qualifier
  1748    * will be  NU.  It w as an inst itutional  claim that  failed.
  1749    */
  1750   /** new lo gic - 8/22  **/
  1751   /**
  1752    *               So,  if  Servic e Code is  empty or n ull
  1753                    Set  it to Reve nue Code ( if it exis ts)
  1754                    Set  6 Service  Qualifier  ID to ‘NU’      (rega rdless of  Revenue Co de)
  1755    */
  1756  
  1757  
  1758  
  1759  
  1760                                                // set se rviceQuali fierID val ue
  1761    // field  6 Service  Qualifier  ID
  1762  
  1763   /**
  1764   if(DEBUG)  {
  1765                    Syst em.out.pri ntln("\npd e.getDetai lRecords()  looping -  CALLING s etServiceQ ualifierID ()...");
  1766                    getN ow();
  1767   }
  1768   **/
  1769  
  1770   // NOTE: p ossibly mo ve this ou t to top r ecord loop ?
  1771   // setServ iceQualifi erID(claim IndexId);
  1772  
  1773   /**
  1774   if(DEBUG)  {
  1775                    Syst em.out.pri ntln("\npd e.getDetai lRecords()  looping -  DONE CALL ING setSer viceQualif ierID()... ");
  1776                    getN ow();
  1777   }
  1778   **/
  1779  
  1780   // System. out.printl n("getDeta ilRecords( ) -  Servi ceQualifie rID return ed is: " +  this.getS erviceQual ifierID()) ;
  1781  
  1782  
  1783                                                if(this.g etServiceQ ualifierID ().equalsI gnoreCase( "NU")) {
  1784   // System. out.printl n("getDeta ilRecords( ) - servic eQualifier Id is 'NU'  - setting  procCode  to revenue Code: " +  this.reven ueCode);
  1785                                                                this .procCode  = this.rev enueCode;
  1786                                                }
  1787  
  1788  
  1789                                                if(this.g etServiceQ ualifierID ().equalsI gnoreCase( "HC")) {
  1790                                                        i f(this.pro cCode.equa lsIgnoreCa se("")) {
  1791                                                                 thi s.serviceQ ualifierID ="NU";
  1792                                                                 thi s.procCode =this.reve nueCode;
  1793                                                        }
  1794                                                }
  1795  
  1796   // this te st will pa ss if the  above test  is met... ..
  1797                                                if(this.p rocCode.eq ualsIgnore Case(""))  {
  1798                                                                if(t his.revenu eCode.leng th() > 0)   {
  1799                                                                         this.p rocCode=th is.revenue Code;
  1800                                                                }
  1801                                                       th is.service QualifierI D="NU";
  1802                                                }               // e nd empty p rocCode tr ap.
  1803  
  1804  
  1805                                                        / / get modi fiers list  here....
  1806                                                if(this.c laimProced ureSeq !=  null) {
  1807                                                        s etModifier s(claimInd exId, this .claimProc edureSeq.t oString()) ;
  1808                                                }
  1809  
  1810                                                       //  create ne w DetailRe cord and a dd to list  here.....
  1811                                                        D etailRecor d dRec = n ew DetailR ecord(this .billedAmt , this.pai dAmt, this .claimProc edureSeq,  this.lineI temControl Number, th is.procCod eDesc, thi s.serviceF romDate,
  1812                                                                          this. serviceToD ate, this. revenueCod e, this.bi lledUnits,  this.proc Code,
  1813                                                                                  this.pro cedureModi fier1, thi s.procedur eModifier2 , this.pro cedureModi fier3,
  1814                                                                                  this.pro cedureModi fier4, thi s.serviceQ ualifierID , this.emd eonClaimNu mber, this .bNegative PaidAmount );
  1815  
  1816                                                        l DetailReco rds.add(dR ec);
  1817   // System. out.printl n("getDeta ilRecords( ) - new De tailRecord  added to  detailReco rds arrayL ist");
  1818  
  1819                                           }   // end if
  1820  
  1821  
  1822                                    } // end w hile
  1823  
  1824  
  1825  
  1826  
  1827           }  catch(Exce ption ex)  {
  1828                    Syst em.out.pri ntln("Paym entDataExt raction.ge tDetailRec ords() ERR OR: " + ex .getMessag e());
  1829                    ex.p rintStackT race();
  1830                    LOGG ER.error(" Error on P aymentData Extraction .getDetail Records(),  errored o n Claim Ke y: {}",  c laimIndexI d);
  1831           LO GGER.error (ex.getMes sage(), ex );
  1832           }
  1833  
  1834   //           System.o ut.println ("getDetai lRecords()  - size of  detail re cords arra y returned  is: " + l DetailReco rds.size() );
  1835  
  1836   if(DEBUG)  {
  1837                    Syst em.out.pri ntln("\npd e.getDetai lRecords()  END");
  1838                    getN ow();
  1839   }
  1840  
  1841           re turn lDeta ilRecords;
  1842  
  1843   }
  1844  
  1845  
  1846           /* *
  1847            *  This meth od deterrm ines the S ervice Qua lifier ID
  1848            *  #6 Servic e Qualifie r ID in Li ne Level r ecords via  spec.
  1849            *  @author B ill Blackm on
  1850            *  @param St ring claim  index id
  1851            *
  1852            * /
  1853           pu blic void  setService QualifierI D(String c laimIndexI d) {
  1854  
  1855                    bool ean DEBUG  = false;
  1856  
  1857  
  1858   if(DEBUG)  {
  1859           Sy stem.out.p rintln("se tServiceQu alifierID( ) claim is : " + clai mIndexId);
  1860   }
  1861  
  1862                    @Sup pressWarni ngs("unche cked")
  1863                    Arra yList<Stri ng> list =  new Array List();
  1864                    list .add("AC") ;
  1865                    list .add("ER") ;
  1866                    list .add("HC") ;
  1867                    list .add("HP") ;
  1868                    list .add("IV") ;
  1869                    list .add("N4") ;
  1870                    list .add("NU") ;;
  1871                    list .add("WK") ;
  1872  
  1873  
  1874                    Quer y q;
  1875                List<?>  l;
  1876                Iterator <?> it;
  1877                String t mp = "";
  1878                String d efCode = " ";
  1879                String r etVal = "" ;
  1880  
  1881  
  1882  
  1883  
  1884                                      String c urSQL = "" ;
  1885  
  1886                                      // If it ’s institu tional use  this chun k:
  1887                                      String s qlINST = " select  "  +
  1888                                                   "max(s v202svc_id _qual) as  CODE " +
  1889                                               " from ins t_svc_line  i, claims  c " +
  1890                                               " where "  +
  1891                                                 " c.clai m_index =  " + claimI ndexId + "  and " +
  1892                                                 " C.EDI_ CLAIM_KEY  = i.CLAIM_ KEY ";
  1893  
  1894  
  1895                                      // If it ’s dental  use this c hunk:
  1896                                      String s qlDENT = " select " +
  1897                                                   " max( sv301ada_c d_qual) as  CODE " +
  1898                                               " from " +
  1899                                                  " denta l_svc_line  i, " +
  1900                                                  " claim s c " +
  1901                                               " where "  +
  1902                                                 " c.clai m_index =  " + claimI ndexId + "  and " +
  1903                                                 "  C.EDI _CLAIM_KEY  = i.CLAIM _KEY ";
  1904  
  1905                                      // If it ’s profess ional use  this chunk :
  1906                                      String s qlPROF = "       sele ct " +
  1907                                                   " max( sv101proc_ cd_qual) a s CODE " +
  1908                                               " from " +
  1909                                                  " prfsn _svc_line  i, claims  c " +
  1910                                               " where "  +
  1911                                                  " c.cla im_index =  " + claim IndexId +  " and " +
  1912                                                  " C.EDI _CLAIM_KEY  = i.CLAIM _KEY ";
  1913  
  1914  
  1915  
  1916                                               if(this.se rviceTypeC ode.equals IgnoreCase ("PROF"))  {
  1917   // System. out.printl n("setServ iceQualifi erID() - c ode is PRO F ");
  1918                                                                curS QL = sqlPR OF;
  1919                                                                defC ode = "HC" ;
  1920                                               } else if  (this.serv iceTypeCod e.equalsIg noreCase(" DENT")) {
  1921   // System. out.printl n("setServ iceQualifi erID() - c ode is DEN T ");
  1922                                                                curS QL = sqlDE NT;
  1923                                                                defC ode = "AD" ;
  1924                                               } else if( this.servi ceTypeCode .equalsIgn oreCase("I NST")) {
  1925   // System. out.printl n("setServ iceQualifi erID() - c ode is INS T - defaul t Code is  'HC' ");
  1926                                                                curS QL = sqlIN ST;
  1927                                                                defC ode = "HC" ;
  1928                                               } else {
  1929                                                       //       // e rror
  1930   System.out .println(" setService QualifierI D() - BAD  code: " +  this.servi ceTypeCode );
  1931                                               }
  1932  
  1933                                               // get one  field and  assign va lue to ser viceQualif ierId - th is needs t o be passe d into Det ailRecord  for displa y
  1934  
  1935                                                try {
  1936                                                     q =  this.entit yManager.c reateNativ eQuery(cur SQL);
  1937                                                     l =  q.getResul tList();
  1938                                                     it =  l.iterato r();
  1939  
  1940  
  1941                                                     whil e (it.hasN ext()) {
  1942  
  1943                                                        O bject row  = (Object)  it.next() ;
  1944  
  1945                                                        i f(row != n ull) {
  1946                                                                         tmp =  row.toStri ng().trim( );
  1947  
  1948                                                                         if(tmp  != null)  {
  1949                                                                                  boolean  found = li st.contain s(tmp);
  1950  
  1951                                                                                  if(found ) {
  1952                                                                                           this.servi ceQualifie rID = tmp;
  1953   // System. out.printl n("\nsetSe rviceTypeC ode() - VA LID CODE:  serviceQua lifierId i s: " + tmp );
  1954  
  1955                                                                                  } else {
  1956  
  1957                                                                                           this.servi ceQualifie rID = defC ode;
  1958  
  1959   // System. out.printl n("\nsetSe rviceTypeC ode() - IN VALID CODE : " + tmp  + ", setti ng to defa ult value  of: " + de fCode);
  1960   // System. out.printl n("\n");
  1961  
  1962  
  1963                                                                                  }        // end if
  1964                                                                              }   // end i f
  1965                                                                  }      // end  if
  1966                                                     } //  end while
  1967  
  1968  
  1969   if(DEBUG)  {
  1970           Sy stem.out.p rintln("pd e.setServi ceQualifie rId() - id  is: " + t his.servic eQualifier ID);
  1971           //  getNow();
  1972  
  1973   }
  1974  
  1975  
  1976                                            }c atch(Excep tion ex) {
  1977                                                 System.o ut.println ("PaymentD ataExtract ion.setSer viceQualif ierID() ER ROR: " + e x.getMessa ge() + "on  ID : " +  claimIndex Id);
  1978                                                 ex.print StackTrace ();
  1979                                                 LOGGER.e rror("Erro r on Payme ntDataExtr action.set ServiceQua lifierID() , errored  on Claim K ey: {}",   claimIndex Id);
  1980                                                 LOGGER.e rror(ex.ge tMessage() , ex);
  1981                                            }
  1982  
  1983           }        // e nd setServ iceQualifi erID
  1984  
  1985  
  1986           /* *
  1987            *  Step 1 of  determini ng Service  Type.....
  1988            *  This meth od determi nes whethe r or not a  claim is  of type 'P ROF', 'DEN T' or 'INS T'
  1989            *  @author B ill Blackm on
  1990            *  @param St ring claim IndexId
  1991            * /
  1992           pu blic void  setService TypeCode(S tring clai mIndexId)  {
  1993  
  1994  
  1995                    Quer y q;
  1996                List<?>  l;
  1997                Iterator <?> it;
  1998                String t mp = "";
  1999  
  2000                try {
  2001  
  2002                                                 String s ql = "Sele ct service _type_cd F ROM fpps_o wner.claim s WHERE cl aim_index  = " + clai mIndexId;
  2003  
  2004                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  2005                                                     l =  q.getResul tList();
  2006                                                     it =  l.iterato r();
  2007  
  2008  
  2009                                                     whil e (it.hasN ext()) {
  2010                                                        O bject row  = (String)  it.next() ;
  2011                                                        i f(row != n ull) {
  2012                                                                tmp  = row.toSt ring();
  2013  
  2014                                                                // d ouble chec k for bad  data
  2015                                                                if(  (tmp != nu ll) && (tm p.length()  > 0) ) {
  2016                                                                         this.s erviceType Code = tmp ;
  2017                                                                }
  2018  
  2019  
  2020                                                        }  else {
  2021                                                                         // bad  record -  no service TypeCode
  2022   // System. out.printl n("Payment DataExtrac tion.setSe rviceTypeC ode() no v alid servi ce type co de for Cla im Key: "  + claimInd exId);
  2023  
  2024                                                       }        // e nd null ch eck
  2025  
  2026                                                     } //  end while
  2027  
  2028  
  2029   // System. out.printl n("setServ iceTypeCod e() for cl aim Id: "  + claimInd exId + ";  returning  code: " +  tmp);
  2030  
  2031  
  2032  
  2033                  }catch (Exception  ex) {
  2034                      Sy stem.out.p rintln("Pa ymentDataE xtraction. setService TypeCode()  ERROR: "  + ex.getMe ssage());
  2035                      ex .printStac kTrace();
  2036                      LO GGER.error ("Error on  PaymentDa taExtracti on.setServ iceTypeCod e(), error ed on Clai m Key: {}" ,  claimIn dexId);
  2037                      LO GGER.error (ex.getMes sage(), ex );
  2038                  }
  2039  
  2040   // System. out.printl n("service TypeCode i s: " + thi s.serviceT ypeCode);
  2041  
  2042                    // t his.servic eTypeCode  = serviceT ypeCode;
  2043           }        // e nd setServ iceTypeCod e()
  2044  
  2045  
  2046   ////////// ////////// ////////// /////
  2047  
  2048           pu blic Strin g getServi ceTypeCode () {
  2049                    retu rn service TypeCode;
  2050           }
  2051  
  2052  
  2053  
  2054   /**
  2055    * 6/14/20 13
  2056    * Problem  - What do  we want t o display  in the out put file i n the case  of null v alues for  either of  the return ed fields?
  2057    * This me thod deter mines the  payment an d charge a mounts
  2058    * @author  Bill Blac kmon
  2059    * @param  claimIndex Id
  2060    */
  2061  
  2062           pu blic void  setClaimCh argePaymen tAmounts(S tring clai mIndexId)  {
  2063  
  2064                    bool ean DEBUG  = false;
  2065  
  2066                    Quer y q;
  2067                List<?>  l;
  2068                Iterator <?> it;
  2069                BigDecim al claimPa ymentAmoun t = null;
  2070                BigDecim al claimCh argeAmount  = null;
  2071  
  2072  
  2073                try {
  2074  
  2075   // New 7/1 0
  2076   /**
  2077    String sq l =
  2078     " SELECT  sum(cpay. paid_amoun t), sum(cp .billed_am ount) " +
  2079     " FROM c laim_proce dure cp, c laim_proc_ recon cpr,  claim_pay ment cpay  " +
  2080     " WHERE  " +
  2081     " CP.CLA IM_PROC_ID  = CPR.CLA IM_PROC_ID  " +
  2082     " and CP R.CLAIM_PA YMENT_ID =  CPAY.CLAI M_PAYMENT_ ID and Cp. claim_inde x =  " + c laimIndexI d;
  2083   **/
  2084  
  2085   /** Take 2  - 7/11 ** /
  2086   /**
  2087   String sql  = "select  sum(cpay. paid_amoun t), sum(cp .billed_am ount) " +
  2088                              " Fro m " +
  2089                 " claim _procedure  cp, " +
  2090                 " claim _payment c pay " +
  2091                              " whe re cp.clai m_index =  cpay.claim _index and  cpay.clai m_index =  " + claimI ndexId;
  2092   **/
  2093  
  2094   // take 3   - 7/12
  2095   /**
  2096   String sql  = "select  sum(cpay. paid_amoun t), sum(cp .billed_am ount)  Fro m  claim_p rocedure c p,  claim_ payment cp ay  , clai m_proc_rec on cpr " +
  2097           "  where " +
  2098           "  cpr.claim_ index = "  + claimInd exId + " a nd " +
  2099           "  cpr.claim_ proc_id =  cp.claim_p roc_id and  " +
  2100           "  cpr.claim_ payment_id  = cpay.cl aim_paymen t_id ";
  2101   **/
  2102  
  2103   // 7/17
  2104                    Stri ng sql = " select sum (cpay.paid _amount),  sum(cp.bil led_amount )  From  c laim_proce dure cp,   claim_paym ent cpay   , claim_pr oc_recon c pr " +
  2105                                      " where  " +
  2106                                      " cp.cla im_index =  " + claim IndexId +  " and " +
  2107                                      " cp.cla im_proc_id  = cpr.cla im_proc_id (+) and "  +
  2108                                      " cpr.cl aim_paymen t_id = cpa y.claim_pa yment_id(+ ) ";
  2109  
  2110  
  2111  
  2112  
  2113   if(DEBUG)
  2114   System.out .println(" setClaimCh argePaymen tAmounts()  - sql is:  " + sql);
  2115  
  2116                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  2117                                                     l =  q.getResul tList();
  2118                                                     it =  l.iterato r();
  2119  
  2120                                                     // a ll returne d vals are  BigDecima ls - deal  with forma tting afte r correct  vals are a ssured.
  2121  
  2122                                                     whil e (it.hasN ext()) {
  2123                                                        O bject[] ro w = (Objec t[]) it.ne xt();
  2124                                                        i f(row != n ull) {
  2125                                                                 cla imPaymentA mount = (B igDecimal)  row[0];
  2126                                                                 cla imChargeAm ount = (Bi gDecimal)  row[1];
  2127  
  2128                                                                 if( claimPayme ntAmount ! = null) {
  2129                                                                          if(cl aimPayment Amount.sig num() == - 1) {
  2130                                                                                   this.bN egativePai dAmount=tr ue;
  2131                                                                          }
  2132                                                                         this.s etClaimPay mentAmount (claimPaym entAmount. doubleValu e());
  2133  
  2134   if(DEBUG)
  2135   System.out .println(" setClaimCh argePaymen tAmounts()  - ClaimPa ymentAmt i s: " + thi s.claimPay mentAmount );
  2136  
  2137                                                                         this.b NullClaimP aymentAmou nt=false;
  2138  
  2139                                                                 }       else {
  2140                                                                          this. bNullClaim PaymentAmo unt=true;
  2141  
  2142   if(DEBUG)
  2143   System.out .println(" NULL CLAIM  PAYMENT A MOUNT IS T RUE");
  2144  
  2145                                                                 }
  2146  
  2147  
  2148  
  2149                                                                 if( claimCharg eAmount !=  null) {
  2150                                                                          /**
  2151                                                                          if(cl aimPayment Amount.sig num() == - 1) {
  2152                                                                                   this.bN egativeCha rgeAmount= true;
  2153                                                                          }
  2154                                                                          **/
  2155  
  2156  
  2157                                                                         this.s etClaimCha rgeAmount( claimCharg eAmount.do ubleValue( ));
  2158                                                                         this.b NullClaimC hargeAmoun t=false;
  2159  
  2160   if(DEBUG)
  2161   System.out .println(" setClaimCh argePaymen tAmounts()  - ClaimCh argeAmt is : " + this .claimChar geAmount);
  2162  
  2163                                                                 } e lse {
  2164                                                                          this. bNullClaim ChargeAmou nt=true;
  2165                                                                 }
  2166  
  2167                                                             }
  2168  
  2169  
  2170   if(DEBUG)  {
  2171           if ( (this.bN ullClaimCh argeAmount ==true) ||  (this.bNu llClaimPay mentAmount ==true) )  {
  2172                     Sys tem.out.pr intln("\ns etClaimCha rgePayment Amounts()  - NULL PAY MENT AMOUN T(S) for c laim #: "  + claimInd exId);
  2173                     Sys tem.out.pr intln("set ClaimCharg ePaymentAm ounts() -  claim id,  CHARGED an d PAID amt s are: " +  claimInde xId +", "  + claimCha rgeAmount  + ", " + c laimPaymen tAmount);
  2174                 System. out.printl n("setClai mChargePay mentAmount s() - bNul lClaimChar geAmount a nd bNullCl aimPayment Amount are : " + bNul lClaimChar geAmount +  ", " + bN ullClaimPa ymentAmoun t);
  2175           }
  2176   }
  2177  
  2178  
  2179                                                     }
  2180  
  2181                           }catch(E xception e x) {
  2182                               Syst em.out.pri ntln("Paym entDataExt raction.se tClaimChar gePaymentA mounts() E RROR: " +  ex.getMess age());
  2183                               ex.p rintStackT race();
  2184                               LOGG ER.error(" Error on P aymentData Extraction .setClaimC hargePayme ntAmounts( ), errored  on Claim  Key: {}",   claimInde xId);
  2185                               LOGG ER.error(e x.getMessa ge(), ex);
  2186                  }
  2187  
  2188           }        // e nd setClai mChargePay mentAmount s()
  2189  
  2190  
  2191           pr ivate void  setClaimP aymentAmou nt(double  claimPayme ntAmount2)  {
  2192                    this .claimPaym entAmount  = claimPay mentAmount 2;
  2193  
  2194           }
  2195  
  2196           pu blic doubl e getClaim PaymentAmo unt() {
  2197  
  2198                             return  this.clai mPaymentAm ount;
  2199           }
  2200  
  2201           /* *
  2202            *  This meth od returns  a formatt ed String  of the pay ment amoun t
  2203            *  @author B ill Blackm on
  2204            *  @return S tring
  2205            * /
  2206           pu blic Strin g getClaim PaymentAmo untFormatt ed() {
  2207                    Deci malFormat  df = new D ecimalForm at("#.00") ;
  2208                    Stri ng s = "";
  2209  
  2210                    // c heck for n ull amount  from BAD  data
  2211                    if(t his.bNullC laimPaymen tAmount==t rue) {
  2212                                      s="";
  2213                                      return s ;
  2214                    }
  2215  
  2216                    // u se getter  method her e....
  2217                    /**
  2218                    if(    (claimPa ymentAmoun t > 0) ||  (claimPaym entAmount  < 0)     )  {
  2219                             s = df .format(cl aimPayment Amount);
  2220                    } el se {
  2221                             s="0.0 0";
  2222                             // s=" ";
  2223                    }
  2224                    **/
  2225                    if(   (this.get ClaimPayme ntAmount()  > 0.00 )  || (this.g etClaimPay mentAmount () < 0.00  )   ) {
  2226                             s = df .format(cl aimPayment Amount);
  2227                    } el se {
  2228                             s = "0 .00";
  2229                             // s=" ";
  2230                    }
  2231  
  2232  
  2233                    retu rn s;
  2234           }
  2235  
  2236  
  2237  
  2238  
  2239           pr ivate bool ean getbNu llClaimPay mentAmount () {
  2240                    retu rn false;
  2241           }
  2242  
  2243           pu blic Strin g getCheck Number() {
  2244                    retu rn checkNu mber;
  2245           }
  2246  
  2247  
  2248   // 37 and  38 - sets  check date  and check  numnber
  2249           /* *
  2250            *  This meth od sets th e check da te and che ck number  for a give n claim pa yment
  2251            *  @author B ill Blackm on
  2252            *  @param St ring claim IndexId
  2253            * /
  2254           pu blic void  setCheckDa teAndNumbe r(String c laimIndexI d) {
  2255  
  2256  
  2257                    Quer y q;
  2258                List<?>  l;
  2259                Iterator <?> it;
  2260                String s tringDate  = "";
  2261  
  2262                boolean  DEBUG=fals e;
  2263  
  2264  
  2265                   try {
  2266  
  2267                       / ** ORIGINA L
  2268                                      String s ql = "SELE CT check_d ate, max(c heck_numbe r) FROM fe e_claim_pa yments f,  fee_claim_ payment_li nes l " +
  2269                                      " WHERE  " +
  2270                                               " f.claim_ index = "  + claimInd exId + " a nd      F. FEE_CLAIM_ PAYMENT_ID  = L.FEE_C LAIM_PAYME NT_ID and  " +
  2271                                               " l.type_o f_payment  in ('CHK', 'EFT') and  " +
  2272                                               " check_da te = ( " +
  2273                                                                " se lect max(c heck_date)  from " +
  2274                                                                "fee _claim_pay ments ff,  fee_claim_ payment_li nes ll " +
  2275                                                                         "where  " +
  2276                                                                         " ff.c laim_index  = f.claim _index and  " +
  2277                                                                         " FF.F EE_CLAIM_P AYMENT_ID  = LL.FEE_C LAIM_PAYME NT_ID and  " +
  2278                                                                         " LL.T YPE_OF_PAY MENT in (' CHK','EFT' ) ) group  by check_d ate ";
  2279                                      **/
  2280  
  2281  
  2282  
  2283   /**
  2284    *    CLM- FL37(check /EFT date) : didn’t t ake the LA TER date ( max) of tr easury_pay ment_date.  claim id  86982489
  2285    */
  2286  
  2287                                      // New 7 /11
  2288                                        String  sql = " S ELECT  max (treasury_ payment_da te), payme nt_trackin g_number "  +
  2289                                          " FR OM " +
  2290                                                 "     cl aim_paymen t cpay " +
  2291                                                 " where  " +
  2292                                                 "     CL AIM_PAYMEN T_TYPE_COD E in ('CHE CK','EFT')  and " +
  2293                                                 "     cl aim_index  = " + clai mIndexId +  " group b y payment_ tracking_n umber ";
  2294  
  2295  
  2296                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  2297                                                     l =  q.getResul tList();
  2298                                                     it =  l.iterato r();
  2299  
  2300                                                     whil e (it.hasN ext()) {
  2301                                                        O bject[] ro w = (Objec t[]) it.ne xt();
  2302                                                        i f(row != n ull) {
  2303                                                                 //  get date t hen number
  2304                                                                         Object  checkDate  = (java.s ql.Timesta mp) row[0] ;
  2305                                                                         if(che ckDate !=  null) {
  2306                                                                                   SimpleD ateFormat  formatter  = new Simp leDateForm at("yyyyMM dd");
  2307                                                                                   stringD ate = form atter.form at(checkDa te);
  2308                                                                                   this.ch eckDate=st ringDate;
  2309                                                                         } else  {
  2310                                                                                   this.ch eckDate= " ";
  2311                                                                         }
  2312  
  2313                                                                         String  temp = (S tring) row [1];
  2314                                                                         if(tem p != null)  {
  2315                                                                                  this.che ckNumber=t emp;
  2316                                                                         } else  {
  2317                                                                                  this.che ckNumber =  "";
  2318                                                                         }
  2319                                                             }
  2320                                                     }
  2321  
  2322  
  2323   if(DEBUG)  {
  2324     System.o ut.println ("\n");
  2325     System.o ut.println ("setCheck DateAndNum ber() - cl aimIndex i s: " + cla imIndexId) ;
  2326     System.o ut.println ("setCheck DateAndNum ber() - sq l is: " +  sql);
  2327     System.o ut.println ("setCheck DateAndNum ber() chec kDate is:  " + checkD ate);
  2328     System.o ut.println ("setCheck DateAndNum ber() chec kNumber is : " + chec kNumber);
  2329     System.o ut.println ("\n");
  2330   }
  2331  
  2332  
  2333  
  2334                           }catch(E xception e x) {
  2335                               Syst em.out.pri ntln("Paym entDataExt raction.se tCheckDate AndNumber( ) ERROR: "  + ex.getM essage());
  2336                               ex.p rintStackT race();
  2337                               LOGG ER.error(" Error on P aymentData Extraction .setCheckD ateAndNumb er(), erro red on Cla im Key: {} ",  claimI ndexId);
  2338                               LOGG ER.error(e x.getMessa ge(), ex);
  2339                  }
  2340           }                 // end  setCheckD ateAndNumb er()
  2341  
  2342           //  37 Check/ EFT Date
  2343           /* *
  2344            *  @return S tring
  2345            * /
  2346                    publ ic String  getCheckDa te() {
  2347                             return  checkDate ;
  2348                    }
  2349  
  2350  
  2351  
  2352   // #36 Cla im Adjudic ation/Paym ent Date -         MU ST BE FORM ATTED  DT  Date forma t of CCYYM MDD
  2353           pu blic void  setClaimAd judication PaymentDat e(String c laimIndexI d) {
  2354  
  2355                    /**
  2356                     * S ELECT max( treasury_p ayment_dat e) FROM cl aim_paymen t WHERE cl aim_index  = xxx
  2357  
  2358                     */
  2359                    Quer y q;
  2360                List<?>  l;
  2361                Iterator <?> it;
  2362                String s tringDate  = "";
  2363  
  2364  
  2365   /**
  2366    * //   CL M-FL37(che ck/EFT dat e): didn’t  take the  LATER date  (max) of  treasury_p ayment_dat e. claim i d 86982489  ?? DIDN'T  TAKE? SQL  error?
  2367    */
  2368                  try {
  2369  
  2370                      St ring sql =  "SELECT m ax(PAYMENT _BATCH_DAT E) FROM cl aim_paymen t WHERE cl aim_index  = " + clai mIndexId;
  2371  
  2372  
  2373                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  2374                                                     l =  q.getResul tList();
  2375                                                     it =  l.iterato r();
  2376  
  2377  
  2378                                                     whil e (it.hasN ext()) {
  2379                                                        O bject row  = (java.sq l.Timestam p) it.next ();
  2380                                                        i f(row != n ull) {
  2381                                                                 Sim pleDateFor mat format ter = new  SimpleDate Format("yy yyMMdd");
  2382                                                                 str ingDate =  formatter. format(row );
  2383  
  2384   /**
  2385   System.out .println(" \n");
  2386   System.out .println(" setClaimAd judication PaymentDat e() - sql  is: " + sq l);
  2387   System.out .println(" setClaimAd judication PaymentDat e() PAYMEN T DATE FOR  ID: " + c laimIndexI d + " is:  " + string Date);
  2388   System.out .println(" \n");
  2389   **/
  2390  
  2391  
  2392  
  2393                                                        }
  2394                                                     }
  2395                  }catch (Exception  ex) {
  2396                      Sy stem.out.p rintln("Pa ymentDataE xtraction. setClaimAd judication PaymentDat e() ERROR:  " + ex.ge tMessage() );
  2397                      LO GGER.error ("Error on  PaymentDa taExtracti on.setClai mAdjudicat ionPayment Date, erro red on Cla im Key: {} ",  claimI ndexId);
  2398                      LO GGER.error (ex.getMes sage(), ex );
  2399                  }
  2400  
  2401                    this .claimAdju dicationPa ymentDate  = stringDa te;
  2402  
  2403           }        // e nd setClai mAdjudicat ionPayment Date()
  2404  
  2405  
  2406           pu blic Strin g getClaim Adjudicati onPaymentD ate() {
  2407                    retu rn claimAd judication PaymentDat e;
  2408           }
  2409  
  2410  
  2411  
  2412  
  2413  
  2414  
  2415           //  42 Pharma cy Prescri ption Numb er
  2416           pu blic Strin g getPharm acyPrescri ptionNumbe r() {
  2417                    retu rn pharmac yPrescript ionNumber;
  2418           }
  2419  
  2420  
  2421           pu blic void  setPharmac yPrescript ionNumber( String cla imIndexId)  {
  2422  
  2423                      Qu ery q;
  2424                  List<? > l;
  2425                  Iterat or<?> it;
  2426  
  2427  
  2428                  try {
  2429  
  2430                      St ring sql =  "SELECT p rescriptio n_number F ROM claim_ procedure  WHERE clai m_index =  " + claimI ndexId + "  and presc ription_nu mber is no t null";
  2431  
  2432  
  2433                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  2434                                                     l =  q.getResul tList();
  2435                                                     it =  l.iterato r();
  2436  
  2437  
  2438                                                     whil e (it.hasN ext()) {
  2439                                                        O bject row  = it.next( );
  2440                                                        i f(row != n ull) {
  2441                                                                 thi s.pharmacy Prescripti onNumber =  row.toStr ing();
  2442                                                        }
  2443                                                     }
  2444  
  2445                  }catch (Exception  ex) {
  2446                      Sy stem.out.p rintln("Pa ymentDataE xtraction. setPharmac yPrescript ionNumber( ) ERROR: "  + ex.getM essage());
  2447                      LO GGER.error ("Error on  PaymentDa taExtracti on.setPhar macyPrescr iptionNumb er, errore d on Claim  Key: {}",   claimInd exId);
  2448                      LO GGER.error (ex.getMes sage(), ex );
  2449                  }
  2450  
  2451           }        // e nd setPhar macyPrescr iptionNumb er()
  2452  
  2453  
  2454  
  2455  
  2456  
  2457  
  2458           pu blic Strin g getProce dureModifi er1() {
  2459                    retu rn procedu reModifier 1;
  2460           }
  2461  
  2462  
  2463           pu blic void  setProcedu reModifier 1(String p rocedureMo difier1) {
  2464                    this .procedure Modifier1  = procedur eModifier1 ;
  2465           }
  2466  
  2467  
  2468  
  2469  
  2470           //  #6 Billin g Provider  Payer Ass igned Numb er
  2471           pu blic Strin g getServi ceProvider PayerAssig nedNumber( ) {
  2472                    retu rn service ProviderPa yerAssigne dNumber;
  2473           }
  2474  
  2475  
  2476           pu blic void  setService ProviderPa yerAssigne dNumber(St ring claim IndexId) {
  2477  
  2478                      Qu ery q;
  2479                  List<? > l;
  2480                  Iterat or<?> it;
  2481  
  2482  
  2483                  try {
  2484  
  2485                      St ring sql =  "SELECT p rovider_np i FROM pro vider_info  WHERE cla im_index =  " + claim IndexId +  " and (pro vider_type _cd = 'SER VICE FACIL ITY' or pr ovider_typ e_cd = 'RE NDERING PR OVIDER')";
  2486  
  2487  
  2488                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  2489                                                     l =  q.getResul tList();
  2490                                                     it =  l.iterato r();
  2491  
  2492  
  2493                                                     whil e (it.hasN ext()) {
  2494                                                        O bject row  = it.next( );
  2495                                                        i f(row != n ull) {
  2496                                                                 thi s.serviceP roviderPay erAssigned Number = r ow.toStrin g();
  2497                                                        }  else {
  2498                                                                 thi s.serviceP roviderPay erAssigned Number = " ";
  2499                                                        }
  2500                                                     }
  2501  
  2502                  }catch (Exception  ex) {
  2503                      Sy stem.out.p rintln("Pa ymentDataE xtraction. setService ProviderPa yerAssigne dNumber()  ERROR: " +  ex.getMes sage());
  2504                      LO GGER.error ("Error on  PaymentDa taExtracti on.setServ iceProvide rPayerAssi gnedNumber , errored  on Claim K ey: {}",   claimIndex Id);
  2505                      LO GGER.error (ex.getMes sage(), ex );
  2506                  }
  2507  
  2508  
  2509           }        // e nd setServ iceProvide rPayerAssi gnedNumber ()
  2510  
  2511  
  2512           //  #7 Billin g Provider  National  Provider I D
  2513           pu blic Strin g getServi ceProvider NationalPr oviderID()  {
  2514                    retu rn service ProviderNa tionalProv iderID;
  2515           }
  2516  
  2517  
  2518           pu blic void  setService ProviderNa tionalProv iderID(Str ing claimI ndexId) {
  2519  
  2520                      Qu ery q;
  2521                  List<? > l;
  2522                  Iterat or<?> it;
  2523  
  2524  
  2525                  try {
  2526  
  2527                      St ring sql =  "SELECT p rovider_np i FROM pro vider_info  WHERE cla im_index =  " + claim IndexId +  " and lowe r(provider _type_cd)  = 'billing  provider' ";
  2528  
  2529  
  2530                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  2531                                                     l =  q.getResul tList();
  2532                                                     it =  l.iterato r();
  2533  
  2534  
  2535                                                     whil e (it.hasN ext()) {
  2536                                                        O bject row  = it.next( );
  2537                                                        i f(row != n ull) {
  2538                                                                 thi s.billingP roviderNat ionalProvi derID = ro w.toString ();
  2539                                                        }  else {
  2540                                                                 thi s.billingP roviderNat ionalProvi derID = nu ll;
  2541                                                        }
  2542                                                     }
  2543  
  2544                  }catch (Exception  ex) {
  2545                      Sy stem.out.p rintln("Pa ymentDataE xtraction. setBilling ProviderNa tionalProv iderID() E RROR: " +  ex.getMess age());
  2546                      LO GGER.error ("Error on  PaymentDa taExtracti on.setBill ingProvide rNationalP roviderID,  errored o n Claim Ke y: {}",  c laimIndexI d);
  2547                      LO GGER.error (ex.getMes sage(), ex );
  2548                  }
  2549  
  2550           }        // e nd setServ iceProvide rNationalP roviderID( )
  2551  
  2552  
  2553           pu blic Strin g getBilli ngProvider NationalPr oviderID()  {
  2554                    retu rn billing ProviderNa tionalProv iderID;
  2555           }
  2556  
  2557           /* *
  2558            *  This meth od sets th e National  Billing P rovider Id
  2559            *  @author B ill Blackm on
  2560            *  @param cl aimIndexId
  2561            * /
  2562           pu blic void  setBilling ProviderNa tionalProv iderID(Str ing claimI ndexId) {
  2563                      Qu ery q;
  2564                  List<? > l;
  2565                  Iterat or<?> it;
  2566  
  2567  
  2568                  try {
  2569  
  2570                      St ring sql =  "SELECT p rovider_np i FROM pro vider_info  WHERE cla im_index =  " + claim IndexId +  " and lowe r(provider _type_cd)  = 'billing  provider' ";
  2571  
  2572  
  2573                                                     q =  this.entit yManager.c reateNativ eQuery(sql );
  2574                                                     l =  q.getResul tList();
  2575                                                     it =  l.iterato r();
  2576  
  2577  
  2578                                                     whil e (it.hasN ext()) {
  2579                                                        O bject row  = it.next( );
  2580                                                        i f(row != n ull) {
  2581                                                              this.b illingProv iderNation alProvider ID = row.t oString();
  2582                                                        }  else {
  2583                                                                 thi s.billingP roviderNat ionalProvi derID = "" ;
  2584                                                        }
  2585                                                     }
  2586  
  2587                  }catch (Exception  ex) {
  2588                      Sy stem.out.p rintln("Pa ymentDataE xtraction. setBilling ProviderNa tionalProv iderID() E RROR: " +  ex.getMess age() + "o n claimId:  " + claim IndexId);
  2589                      ex .printStac kTrace();
  2590                      LO GGER.error ("Error on  PaymentDa taExtracti on.setBill ingProvide rNationalP roviderID,  errored o n Claim Ke y: {}",  c laimIndexI d);
  2591                      LO GGER.error (ex.getMes sage(), ex );
  2592                  }
  2593  
  2594           }        // e nd setBill ingProvide rNationalP roviderID( )
  2595  
  2596  
  2597  
  2598           pu blic Entit yManager g etEntityMa nager() {
  2599                    retu rn entityM anager;
  2600           }
  2601  
  2602  
  2603           pu blic void  setEntityM anager(Ent ityManager  entityMan ager) {
  2604                    this .entityMan ager = ent ityManager ;
  2605           }
  2606  
  2607  
  2608           pu blic Strin g getBilli ngProvider PayerAssig nedNumber( ) {
  2609                    retu rn this.bi llingProvi derPayerAs signedNumb er;
  2610           }
  2611  
  2612  
  2613           pu blic void  setBilling ProviderFe deralTaxID (String bi llingProvi derFederal TaxID) {
  2614                    this .billingPr oviderFede ralTaxID =  billingPr oviderFede ralTaxID;
  2615           }
  2616  
  2617           pu blic Strin g getBilli ngProvider FederalTax ID() {
  2618                    retu rn billing ProviderFe deralTaxID ;
  2619           }
  2620  
  2621  
  2622  
  2623  
  2624           pu blic Strin g getBilli ngProvider LastName()  {
  2625                    retu rn billing ProviderLa stName;
  2626           }
  2627  
  2628  
  2629           pu blic void  setBilling ProviderLa stName(Str ing billin gProviderL astName) {
  2630                    this .billingPr oviderLast Name = bil lingProvid erLastName ;
  2631           }
  2632  
  2633  
  2634           pu blic Strin g getBilli ngProvider FirstName( ) {
  2635                    retu rn billing ProviderFi rstName;
  2636           }
  2637  
  2638  
  2639           pu blic void  setBilling ProviderFi rstName(St ring billi ngProvider FirstName)  {
  2640                    this .billingPr oviderFirs tName = bi llingProvi derFirstNa me;
  2641           }
  2642  
  2643  
  2644           pu blic Strin g getBilli ngProvider MiddleName () {
  2645                    retu rn billing ProviderMi ddleName;
  2646           }
  2647  
  2648  
  2649           pu blic void  setBilling ProviderMi ddleName(S tring bill ingProvide rMiddleNam e) {
  2650                    this .billingPr oviderMidd leName = b illingProv iderMiddle Name;
  2651           }
  2652  
  2653  
  2654           pu blic Strin g getBilli ngProvider NameSuffix () {
  2655                    retu rn billing ProviderNa meSuffix;
  2656           }
  2657  
  2658  
  2659           pu blic void  setBilling ProviderNa meSuffix(S tring bill ingProvide rNameSuffi x) {
  2660                    this .billingPr oviderName Suffix = b illingProv iderNameSu ffix;
  2661           }
  2662  
  2663  
  2664           pu blic Strin g getServi ceProvider FederalTax ID() {
  2665                    retu rn service ProviderFe deralTaxID ;
  2666           }
  2667  
  2668  
  2669           pu blic void  setService ProviderFe deralTaxID (String se rviceProvi derFederal TaxID) {
  2670                    this .servicePr oviderFede ralTaxID =  servicePr oviderFede ralTaxID;
  2671           }
  2672  
  2673  
  2674  
  2675           pu blic Strin g getServi ceProvider LastName()  {
  2676                    retu rn service ProviderLa stName;
  2677           }
  2678  
  2679  
  2680           pu blic void  setService ProviderLa stName(Str ing servic eProviderL astName) {
  2681                    this .servicePr oviderLast Name = ser viceProvid erLastName ;
  2682           }
  2683  
  2684  
  2685           pu blic Strin g getServi ceProvider FirstName( ) {
  2686                    retu rn service ProviderFi rstName;
  2687           }
  2688  
  2689  
  2690           pu blic void  setService ProviderFi rstName(St ring servi ceProvider FirstName)  {
  2691                    this .servicePr oviderFirs tName = se rviceProvi derFirstNa me;
  2692           }
  2693  
  2694  
  2695  
  2696  
  2697           pu blic void  setService ProviderMi ddleName(S tring serv iceProvide rMiddleNam e) {
  2698                    this .servicePr oviderMidd leName = s erviceProv iderMiddle Name;
  2699           }
  2700  
  2701  
  2702           pu blic Strin g getServi ceProvider MiddleName () {
  2703                    retu rn service ProviderMi ddleName;
  2704           }
  2705  
  2706           pu blic Strin g getServi ceProvider NameSuffix () {
  2707                    retu rn service ProviderNa meSuffix;
  2708           }
  2709  
  2710  
  2711           pu blic void  setService ProviderNa meSuffix(S tring serv iceProvide rNameSuffi x) {
  2712                    this .servicePr oviderName Suffix = s erviceProv iderNameSu ffix;
  2713           }
  2714  
  2715  
  2716           pu blic Strin g getEmplo yerIdentif icationNum ber() {
  2717                    retu rn employe rIdentific ationNumbe r;
  2718           }
  2719  
  2720  
  2721           pu blic void  setEmploye rIdentific ationNumbe r(String e mployerIde ntificatio nNumber) {
  2722                    this .employerI dentificat ionNumber  = employer Identifica tionNumber ;
  2723           }
  2724  
  2725  
  2726           pu blic Strin g getEmplo yerName()  {
  2727                    retu rn employe rName;
  2728           }
  2729  
  2730  
  2731           pu blic void  setEmploye rName(Stri ng employe rName) {
  2732                    this .employerN ame = empl oyerName;
  2733           }
  2734  
  2735  
  2736           pu blic Strin g getSubsc riberID()  {
  2737                    retu rn subscri berID;
  2738           }
  2739  
  2740  
  2741           pu blic void  setSubscri berID(Stri ng subscri berID) {
  2742                    this .subscribe rID = subs criberID;
  2743           }
  2744  
  2745  
  2746           pu blic Strin g getSubsc riberLastN ame() {
  2747                    retu rn subscri berLastNam e;
  2748           }
  2749  
  2750  
  2751           pu blic void  setSubscri berLastNam e(String s ubscriberL astName) {
  2752                    this .subscribe rLastName  = subscrib erLastName ;
  2753           }
  2754  
  2755  
  2756           pu blic Strin g getSubsc riberFirst Name() {
  2757                    retu rn subscri berFirstNa me;
  2758           }
  2759  
  2760  
  2761           pu blic void  setSubscri berFirstNa me(String  subscriber FirstName)  {
  2762                    this .subscribe rFirstName  = subscri berFirstNa me;
  2763           }
  2764  
  2765  
  2766           pu blic Strin g getSubsc riberMiddl eName() {
  2767                    retu rn subscri berMiddleN ame;
  2768           }
  2769  
  2770  
  2771           pu blic void  setSubscri berMiddleN ame(String  subscribe rMiddleNam e) {
  2772                    this .subscribe rMiddleNam e = subscr iberMiddle Name;
  2773           }
  2774  
  2775  
  2776           pu blic Strin g getSubsc riberNameS uffix(Stri ng claimIn dex) {
  2777                    retu rn subscri berNameSuf fix;
  2778           }
  2779  
  2780  
  2781           pu blic void  setSubscri berNameSuf fix(String  subscribe rNameSuffi x) {
  2782                    this .subscribe rNameSuffi x = subscr iberNameSu ffix;
  2783           }
  2784  
  2785  
  2786           pu blic Strin g getPatie ntID() {
  2787                    retu rn patient ID;
  2788           }
  2789  
  2790  
  2791           pu blic void  setPatient ID(String  patientID)  {
  2792                    this .patientID  = patient ID;
  2793           }
  2794  
  2795  
  2796           pu blic Strin g getPatie ntLastName () {
  2797                    retu rn patient LastName;
  2798           }
  2799  
  2800  
  2801           pu blic void  setPatient LastName(S tring pati entLastNam e) {
  2802                    this .patientLa stName = p atientLast Name;
  2803           }
  2804  
  2805  
  2806           pu blic Strin g getPatie ntFirstNam e() {
  2807                    retu rn patient FirstName;
  2808           }
  2809  
  2810  
  2811           pu blic void  setPatient FirstName( String pat ientFirstN ame) {
  2812                    this .patientFi rstName =  patientFir stName;
  2813           }
  2814  
  2815  
  2816           pu blic Strin g getPatie ntMiddleNa me() {
  2817                    retu rn patient MiddleName ;
  2818           }
  2819  
  2820  
  2821           pu blic void  setPatient MiddleName (String pa tientMiddl eName) {
  2822                    this .patientMi ddleName =  patientMi ddleName;
  2823           }
  2824  
  2825  
  2826           pu blic Strin g getPatie ntNameSuff ix() {
  2827                    retu rn patient NameSuffix ;
  2828           }
  2829  
  2830  
  2831           pu blic void  setPatient NameSuffix (String pa tientNameS uffix) {
  2832                    this .patientNa meSuffix =  patientNa meSuffix;
  2833           }
  2834  
  2835  
  2836           pu blic Strin g getPatie ntDateOfBi rth() {
  2837                    retu rn patient DateOfBirt h;
  2838           }
  2839  
  2840  
  2841           pu blic void  setPatient DateOfBirt h(String p atientDate OfBirth) {
  2842                    this .patientDa teOfBirth  = patientD ateOfBirth ;
  2843           }
  2844  
  2845  
  2846           pu blic Strin g getPatie ntGender()  {
  2847                    retu rn patient Gender;
  2848           }
  2849  
  2850  
  2851           pu blic void  setPatient Gender(Str ing patien tGender) {
  2852                    this .patientGe nder = pat ientGender ;
  2853           }
  2854  
  2855  
  2856           pu blic doubl e getClaim ChargeAmou nt() {
  2857                    retu rn claimCh argeAmount ;
  2858           }
  2859  
  2860           pu blic Strin g getClaim ChargeAmou ntFormatte d() {
  2861                    Deci malFormat  df = new D ecimalForm at("#.00") ;
  2862                    Stri ng s = "";
  2863  
  2864                    // c heck for n ull amount  from BAD  data
  2865                    if(t his.bNullC laimCharge Amount==tr ue) {
  2866                                      s="";
  2867                                      return s ;
  2868                    }
  2869  
  2870                    if(   (this.get ClaimCharg eAmount()  > 0.00 ) | | (this.ge tClaimChar geAmount()  < 0.00 )    ) {
  2871                             s = df .format(cl aimChargeA mount);
  2872                    } el se {
  2873                             s = "0 .00";
  2874                             // s=" ";
  2875                    }
  2876  
  2877  
  2878  
  2879                    retu rn s;
  2880           }
  2881  
  2882  
  2883  
  2884           pu blic void  setClaimCh argeAmount (double cl aimChargeA mount) {
  2885                    this .claimChar geAmount =  claimChar geAmount;
  2886           }
  2887  
  2888  
  2889  
  2890  
  2891           pu blic Strin g getBillT ype() {
  2892                    retu rn billTyp e;
  2893           }
  2894  
  2895  
  2896           pu blic void  setBillTyp e(String b illType) {
  2897                    this .billType  = billType ;
  2898           }
  2899  
  2900  
  2901           pu blic Strin g getPayer ClaimIdent ificationN umber() {
  2902                    retu rn payerCl aimIdentif icationNum ber;
  2903           }
  2904  
  2905  
  2906           pu blic void  setPayerCl aimIdentif icationNum ber(
  2907                             String  payerClai mIdentific ationNumbe r) {
  2908                    this .payerClai mIdentific ationNumbe r = payerC laimIdenti ficationNu mber;
  2909           }
  2910  
  2911  
  2912           pu blic Strin g getPatie ntAccountN umber() {
  2913                    retu rn patient AccountNum ber;
  2914           }
  2915  
  2916  
  2917           pu blic void  setPatient AccountNum ber(String  patientAc countNumbe r) {
  2918                    this .patientAc countNumbe r = patien tAccountNu mber;
  2919           }
  2920  
  2921  
  2922  
  2923  
  2924  
  2925           pu blic Strin g getVouch erIdentifi er() {
  2926                    retu rn voucher Identifier ;
  2927           }
  2928  
  2929  
  2930           pu blic void  setVoucher Identifier (String vo ucherIdent ifier) {
  2931                    this .voucherId entifier =  voucherId entifier;
  2932           }
  2933  
  2934  
  2935           pu blic Strin g getAppli cationSyst emIdentifi er() {
  2936                    retu rn applica tionSystem Identifier ;
  2937           }
  2938  
  2939  
  2940           pu blic void  setApplica tionSystem Identifier (String ap plicationS ystemIdent ifier) {
  2941                    this .applicati onSystemId entifier =  applicati onSystemId entifier;
  2942           }
  2943  
  2944  
  2945           pu blic Strin g getGroup Number() {
  2946                    retu rn groupNu mber;
  2947           }
  2948  
  2949  
  2950           pu blic void  setGroupNu mber(Strin g groupNum ber) {
  2951                    this .groupNumb er = group Number;
  2952           }
  2953  
  2954  
  2955           pu blic Date  getClaimSe rviceDateS tart() {
  2956                    retu rn claimSe rviceDateS tart;
  2957           }
  2958  
  2959  
  2960           pu blic void  setClaimSe rviceDateS tart(Date  claimServi ceDateStar t) {
  2961                    this .claimServ iceDateSta rt = claim ServiceDat eStart;
  2962           }
  2963  
  2964  
  2965           pu blic Date  getClaimSe rviceDateE nd() {
  2966                    retu rn claimSe rviceDateE nd;
  2967           }
  2968  
  2969  
  2970           pu blic void  setClaimSe rviceDateE nd(Date cl aimService DateEnd) {
  2971                    this .claimServ iceDateEnd  = claimSe rviceDateE nd;
  2972           }
  2973  
  2974  
  2975           pu blic Strin g getPayer ID() {
  2976                    retu rn payerID ;
  2977           }
  2978  
  2979  
  2980           pu blic void  setPayerID (String pa yerID) {
  2981                    this .payerID =  payerID;
  2982           }
  2983  
  2984  
  2985           pu blic Strin g getLineI temControl Number() {
  2986                    retu rn lineIte mControlNu mber;
  2987           }
  2988  
  2989  
  2990           pu blic void  setLineIte mControlNu mber(Strin g lineItem ControlNum ber) {
  2991                    this .lineItemC ontrolNumb er = lineI temControl Number;
  2992           }
  2993  
  2994  
  2995           pu blic Strin g getServi ceQualifie rID() {
  2996                    retu rn service QualifierI D;
  2997           }
  2998  
  2999  
  3000  
  3001  
  3002           pu blic Strin g getServi ceIdentifi cationCode () {
  3003                    retu rn service Identifica tionCode;
  3004           }
  3005  
  3006  
  3007           pu blic void  setService Identifica tionCode(S tring serv iceIdentif icationCod e) {
  3008                    this .serviceId entificati onCode = s erviceIden tification Code;
  3009           }
  3010  
  3011           pu blic Strin g getProce dureModifi er2() {
  3012                    retu rn procedu reModifier 2;
  3013           }
  3014  
  3015  
  3016           pu blic void  setProcedu reModifier 2(String p rocedureMo difier2) {
  3017                    this .procedure Modifier2  = procedur eModifier2 ;
  3018           }
  3019  
  3020  
  3021           pu blic Strin g getProce dureModifi er3() {
  3022                    retu rn procedu reModifier 3;
  3023           }
  3024  
  3025  
  3026           pu blic void  setProcedu reModifier 3(String p rocedureMo difier3) {
  3027                    this .procedure Modifier3  = procedur eModifier3 ;
  3028           }
  3029  
  3030  
  3031           pu blic Strin g getProce dureModifi er4() {
  3032                    retu rn procedu reModifier 4;
  3033           }
  3034  
  3035  
  3036           pu blic void  setProcedu reModifier 4(String p rocedureMo difier4) {
  3037                    this .procedure Modifier4  = procedur eModifier4 ;
  3038           }
  3039  
  3040  
  3041           pu blic BigDe cimal getL ineItemCha rgeAmount( ) {
  3042                    retu rn lineIte mChargeAmo unt;
  3043           }
  3044  
  3045  
  3046           pu blic void  setLineIte mChargeAmo unt(BigDec imal lineI temChargeA mount) {
  3047                    this .lineItemC hargeAmoun t = lineIt emChargeAm ount;
  3048           }
  3049  
  3050  
  3051           pu blic BigDe cimal getL ineItemPro viderPayme ntAmount()  {
  3052                    retu rn lineIte mProviderP aymentAmou nt;
  3053           }
  3054  
  3055  
  3056           pu blic void  setLineIte mProviderP aymentAmou nt(
  3057                             BigDec imal lineI temProvide rPaymentAm ount) {
  3058                    this .lineItemP roviderPay mentAmount  = lineIte mProviderP aymentAmou nt;
  3059           }
  3060  
  3061  
  3062           pu blic Strin g getReven ueCode() {
  3063                    retu rn revenue Code;
  3064           }
  3065  
  3066  
  3067           pu blic void  setRevenue Code(Strin g revenueC ode) {
  3068                    this .revenueCo de = reven ueCode;
  3069           }
  3070  
  3071  
  3072           pu blic int g etUnitsOfS ervice() {
  3073                    retu rn unitsOf Service;
  3074           }
  3075  
  3076  
  3077           pu blic void  setUnitsOf Service(in t unitsOfS ervice) {
  3078                    this .unitsOfSe rvice = un itsOfServi ce;
  3079           }
  3080  
  3081  
  3082           pu blic Date  getDateOfS erviceStar t() {
  3083                    retu rn dateOfS erviceStar t;
  3084           }
  3085  
  3086  
  3087           pu blic void  setDateOfS erviceStar t(Date dat eOfService Start) {
  3088                    this .dateOfSer viceStart  = dateOfSe rviceStart ;
  3089           }
  3090  
  3091  
  3092           pu blic Date  getDateOfS erviceEnd( ) {
  3093                    retu rn dateOfS erviceEnd;
  3094           }
  3095  
  3096  
  3097           pu blic void  setDateOfS erviceEnd( Date dateO fServiceEn d) {
  3098                    this .dateOfSer viceEnd =  dateOfServ iceEnd;
  3099           }
  3100  
  3101  
  3102           pu blic void  setBilling ProviderPa yerAssigne dNumber(St ring billi ngProvider PayerAssig nedNumber)  {
  3103                    this .billingPr oviderPaye rAssignedN umber = bi llingProvi derPayerAs signedNumb er;
  3104           }
  3105  
  3106  
  3107           pu blic Strin g getProcC ode() {
  3108                    retu rn procCod e;
  3109           }
  3110  
  3111  
  3112           pu blic void  setProcCod e(String p rocCode) {
  3113                    this .procCode  = procCode ;
  3114           }
  3115  
  3116  
  3117  
  3118  
  3119           pu blic Strin g getSubsc riberNameS uffix() {
  3120                    retu rn subscri berNameSuf fix;
  3121           }
  3122  
  3123  
  3124           pu blic Strin g getEmdeo nClaimNumb er() {
  3125                    retu rn emdeonC laimNumber ;
  3126           }
  3127  
  3128  
  3129           @S uppressWar nings("raw types")
  3130           pu blic Array List getMo difiers()  {
  3131                    retu rn modifie rs;
  3132           }
  3133  
  3134           pu blic void  setModifie rs(@Suppre ssWarnings ("rawtypes ") ArrayLi st modifie rs) {
  3135                    this .modifiers  = modifie rs;
  3136           }
  3137  
  3138           pu blic BigDe cimal getB illedUnits () {
  3139                    retu rn billedU nits;
  3140           }
  3141  
  3142           pu blic void  setBilledU nits(BigDe cimal bill edUnits) {
  3143                    this .billedUni ts = bille dUnits;
  3144           }
  3145  
  3146           pu blic Times tamp getSe rviceFromD ate() {
  3147                    retu rn service FromDate;
  3148           }
  3149  
  3150           pu blic void  setService FromDate(T imestamp s erviceFrom Date) {
  3151                    this .serviceFr omDate = s erviceFrom Date;
  3152           }
  3153  
  3154           pu blic Times tamp getSe rviceToDat e() {
  3155                    retu rn service ToDate;
  3156           }
  3157  
  3158           pu blic void  setService ToDate(Tim estamp ser viceToDate ) {
  3159                    this .serviceTo Date = ser viceToDate ;
  3160           }
  3161  
  3162           pu blic Strin g getProcC odeDesc()  {
  3163                    retu rn procCod eDesc;
  3164           }
  3165  
  3166           pu blic void  setProcCod eDesc(Stri ng procCod eDesc) {
  3167                    this .procCodeD esc = proc CodeDesc;
  3168           }
  3169  
  3170           pu blic BigDe cimal getB illedAmt()  {
  3171                    retu rn billedA mt;
  3172           }
  3173  
  3174           pu blic void  setBilledA mt(BigDeci mal billed Amt) {
  3175                    this .billedAmt  = billedA mt;
  3176           }
  3177  
  3178           pu blic BigDe cimal getP aidAmt() {
  3179                    retu rn paidAmt ;
  3180           }
  3181  
  3182           pu blic void  setPaidAmt (BigDecima l paidAmt)  {
  3183                    this .paidAmt =  paidAmt;
  3184           }
  3185  
  3186           pu blic BigDe cimal getC laimProced ureSeq() {
  3187                    retu rn claimPr ocedureSeq ;
  3188           }
  3189  
  3190           pu blic void  setClaimPr ocedureSeq (BigDecima l claimPro cedureSeq)  {
  3191                    this .claimProc edureSeq =  claimProc edureSeq;
  3192           }
  3193  
  3194           pu blic boole an isbNega tivePaidAm ount() {
  3195                    retu rn bNegati vePaidAmou nt;
  3196           }
  3197  
  3198           pu blic void  setbNegati vePaidAmou nt(boolean  bNegative PaidAmount ) {
  3199                    this .bNegative PaidAmount  = bNegati vePaidAmou nt;
  3200           }
  3201  
  3202  
  3203           /* *
  3204            *  @author B ill Blackm on
  3205            *  Set all c lass-level  variables  to initia l state
  3206            * /
  3207           @S uppressWar nings("raw types")
  3208           pu blic void  clearAll()  {
  3209  
  3210                    this .billingPr oviderNati onalProvid erID="";
  3211                    this .billingPr oviderLast Name="";
  3212                    this .billingPr oviderFirs tName="";
  3213                    this .billingPr oviderMidd leName="";
  3214                    this .billingPr oviderName Suffix="";
  3215  
  3216                    this .billType= "";
  3217  
  3218                    this .servicePr oviderFede ralTaxID=" ";
  3219                    this .servicePr oviderPaye rAssignedN umber="";
  3220                    this .servicePr oviderNati onalProvid erID="";
  3221                    this .servicePr oviderLast Name="";
  3222                    this .servicePr oviderFirs tName="";
  3223                    this .servicePr oviderMidd leName="";
  3224                    this .servicePr oviderName Suffix="";
  3225  
  3226                    this .serviceTy peCode="";
  3227  
  3228                    this .claimChar geAmount =  0.00;;
  3229                    this .claimPaym entAmount  = 0.00;
  3230  
  3231                    this .paidAmt=n ull;
  3232                    this .billedAmt =null;
  3233  
  3234   // System. out.printl n("clearAl l() - clai mCharge am t is now:  " + this.g etClaimCha rgeAmount( ));
  3235   // System. out.printl n("clearAl l() - clai mPayment a mt is now:  " + this. getClaimPa ymentAmoun t())  ;
  3236  
  3237  
  3238                    this .claimAdju dicationPa ymentDate= "";
  3239  
  3240                    this .checkDate ="";
  3241                    this .checkNumb er="";
  3242  
  3243  
  3244                    this .payerClai mIdentific ationNumbe r="";
  3245                    this .patientAc countNumbe r="";
  3246                    this .pharmacyP rescriptio nNumber="" ;
  3247                    this .voucherId entifier=" ";
  3248                    this .applicati onSystemId entifier=" ";
  3249                    this .groupNumb er="";
  3250  
  3251                    this .claimServ iceDateSta rt = null;
  3252                    this .claimServ iceDateEnd  = null;
  3253  
  3254  
  3255                    this .payerID=" ";
  3256                    this .lineItemC ontrolNumb er="";
  3257                    this .serviceQu alifierID= "";
  3258                    this .serviceId entificati onCode="";
  3259  
  3260                    this .procedure Modifier1= "";
  3261                    this .procedure Modifier2= "";
  3262                    this .procedure Modifier3= "";
  3263                    this .procedure Modifier4= "";
  3264  
  3265                    this .lineItemC hargeAmoun t=null;
  3266                    this .lineItemP roviderPay mentAmount =null;
  3267                    this .revenueCo de="";
  3268                    this .unitsOfSe rvice=0;
  3269                    this .emdeonCla imNumber=" ";
  3270                    this .dateOfSer viceStart= null;
  3271                    this .dateOfSer viceEnd=nu ll;
  3272  
  3273  
  3274                    this .procCode= "";
  3275  
  3276                    this .modifiers =new Array List();
  3277  
  3278                    this .bNegative PaidAmount =false;
  3279                    this .bNegative ChargeAmou nt=false;
  3280                    this .bNullClai mPaymentAm ount=false ;
  3281                    this .bNullClai mChargeAmo unt=false;
  3282           }
  3283  
  3284  
  3285           pu blic void  getNow() {
  3286                     Dat e dNow = n ew Date( ) ;
  3287                  Simple DateFormat  ft =
  3288                  new Si mpleDateFo rmat ("hh: mm:ss:ms") ;
  3289  
  3290                  System .out.print ln(ft.form at(dNow));
  3291           }
  3292  
  3293  
  3294  
  3295   }       //  end of cl ass