31. EPMO Open Source Coordination Office Redaction File Detail Report

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

31.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\ZIP\JLV_2.6.2.0.3_src\jMeadows\src\main\java\gov\va\med\jmeadows\dataservicehandler EntityPatientRetrieveServiceHandler.java Thu Mar 29 22:08:33 2018 UTC
2 C:\AraxisMergeCompare\Pri_re\ZIP\JLV_2.6.2.0.3_src\jMeadows\src\main\java\gov\va\med\jmeadows\dataservicehandler EntityPatientRetrieveServiceHandler.java Tue May 1 13:46:43 2018 UTC

31.2 Comparison summary

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

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

31.4 Active regular expressions

No regular expressions were active.

31.5 Comparison detail

  1   /*
  2    * Janus 4 .0 (c)
  3    * Copyrig ht (c) 201 2 Hawaii R esource Gr oup LLC. A ll Rights  Reserved.
  4    * Develop ed for the  Pacific T elehealth  & Technolo gy Hui and  the Pacif ic Joint I nformation  Technolog y Center
  5    * Contrib utors:
  6    *      Ho norable Se nator Dani el K. Inou ye
  7    *      VA  Pacific I slands Hea lth Care S ystem
  8    *      Tr ipler Army  Medical C enter
  9    */
  10  
  11   package go v.va.med.j meadows.da taserviceh andler;
  12  
  13   import gov .va.med.jm eadows.com mon.JMeado wsExceptio n;
  14   import gov .va.med.jm eadows.dao .beans.PDW SQueryBean ;
  15   import gov .va.med.jm eadows.dao .beans.Res ponsePatie ntQuery;
  16   import gov .va.med.pd ws.*;
  17   import gov .va.med.vd s.webservi ce.Patient ;
  18   import gov .va.med.vd s.webservi ce.User;
  19   import org .slf4j.Log ger;
  20   import org .slf4j.Log gerFactory ;
  21  
  22   import jav ax.xml.bin d.JAXBElem ent;
  23   import jav ax.xml.nam espace.QNa me;
  24   import jav ax.xml.ws. BindingPro vider;
  25   import jav ax.xml.ws. handler.Ha ndler;
  26   import jav a.io.Seria lizable;
  27   import jav a.math.Big Integer;
  28   import jav a.net.Malf ormedURLEx ception;
  29   import jav a.text.Sim pleDateFor mat;
  30   import jav a.util.Arr ayList;
  31   import jav a.util.Dat e;
  32   import jav a.util.Lis t;
  33  
  34   public cla ss EntityP atientRetr ieveServic eHandler e xtends Dat aServiceHa ndler {
  35       privat e static f inal Logge r LOGGER =  LoggerFac tory.getLo gger(Entit yPatientRe trieveServ iceHandler .class);
  36       privat e static f inal Strin g AGENCY_D OD = APP_C ONFIG.getA gencyDOD() ;
  37       privat e static f inal Strin g AGENCY_V A = APP_CO NFIG.getAg encyVA();
  38       privat e EntityPa tientInqui ry entityP atientInqu iry;
  39  
  40       public  EntityPat ientRetrie veServiceH andler(Str ing url) {
  41           su per();
  42           se rviceURL =  url;
  43           se rviceName  = "PDWSPat ientRetrie ve";
  44             serviceNam espace = " http://web service.pd ws. URL         /";
  45           qS erviceName  = new QNa me(service Namespace,  serviceNa me);
  46  
  47           en tityPatien tInquiry =  new Entit yPatientIn quiry();
  48       }
  49  
  50       privat e EntityPa tientRetri evePortTyp e getEntit yPatientRe trievePort () throws  MalformedU RLExceptio n {
  51           En tityPatien tRetrieveP ortType po rt;
  52           St ring appEn v = APP_CO NFIG.getAp pEnvironme nt();
  53  
  54           po rt = entit yPatientIn quiry.getE ntityPatie ntRetrieve PortSoap11 ();
  55           Bi ndingProvi der prov =  (BindingP rovider) p ort;
  56           pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY,  serviceURL );
  57           pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout",  serviceCon nectionTim eoutMS);
  58           pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout",  serviceReq uestTimeou tMS);
  59           pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout",  serviceCo nnectionTi meoutMS);
  60           pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout",  serviceRe questTimeo utMS);
  61  
  62           //  SOAP mess age loggin g - Enable  to show l ogging in  output win dow
  63           if  ("test".e qualsIgnor eCase(appE nv) || "de velopment" .equalsIgn oreCase(ap pEnv)) {
  64                prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler());
  65                List<Han dler> hand lerList =  prov.getBi nding().ge tHandlerCh ain();
  66                handlerL ist.add(ne w SOAPLogg ingHandler ());
  67                prov.get Binding(). setHandler Chain(hand lerList);
  68           }
  69  
  70           re turn port;
  71       }
  72  
  73       public  ResponseP atientQuer y lookupPa tient(PDWS QueryBean  queryBean)  throws JM eadowsExce ption, Mal formedURLE xception {
  74           PR PAIN201305 UV02 reque st = Gener ateRequest (queryBean );
  75           PR PAIN201306 UV02 respo nse = null ;
  76           Re sponsePati entQuery r tc = null;
  77  
  78           re sponse = g etEntityPa tientRetri evePort(). entityPati entRetriev e(request) ;
  79  
  80           if  (response  != null)  {
  81                rtc = Pa rseRespons eToPatient List(respo nse);
  82                if (rtc  != null &&  !rtc.getP atients(). isEmpty())  {
  83                    bool ean found  = true;
  84                    whil e (found)  {
  85                         found = fa lse;
  86                         List<Patie nt> patien ts = rtc.g etPatients ();
  87                         Patient bl acklisted  = null;
  88                         for (Patie nt patient  : patient s) {
  89                             if (PD WSBlackLis t.getInsta nce().isBl ackListed( patient.ge tEDIPI()))  {
  90                                 fo und = true ;
  91                                 bl acklisted  = patient;
  92                                 br eak;
  93                             }
  94                         }
  95                         if (blackl isted != n ull) {
  96                             LOGGER .error("re moving bla cklisted p atient");
  97                             patien ts.remove( blackliste d);
  98                             rtc.se tPatients( patients);
  99                         }
  100                    }
  101                }
  102           }
  103  
  104           re turn rtc;
  105       }
  106  
  107       privat e PRPAIN20 1305UV02 G enerateReq uest(PDWSQ ueryBean q ueryBean)  {
  108           MC CIMT000100 UV01Device  device;
  109           II  ii;
  110           CS  cs;
  111           CD  cd;
  112  
  113           Us er user =  queryBean. getUser();
  114           St ring agenc y = user.g etAgency() ;
  115           St ring dmisI d = user.g etHostSite ().getDmis Id();
  116           St ring siteI d = user.g etHostSite ().getSite Code();
  117  
  118           Ob jectFactor y factory  = new Obje ctFactory( );
  119           PR PAIN201305 UV02 reque st = facto ry.createP RPAIN20130 5UV02();
  120  
  121           // id
  122           ii  = factory .createII( );
  123           ii .setRoot(" 2.16.840.1 .113883.3. 2017");
  124           ii .setExtens ion("DMDC" );
  125           re quest.setI d(ii);
  126  
  127           // creationTi me
  128           TS  ts;
  129           ts  = factory .createTS( );
  130           Si mpleDateFo rmat simpl eDateForma t;
  131           si mpleDateFo rmat = new  SimpleDat eFormat("y yyyMMddhhm mss");
  132           ts .setValue( simpleDate Format.for mat(new Da te()));
  133           re quest.setC reationTim e(ts);
  134  
  135           // versionCod e (optiona l?)
  136           cs  = factory .createCS( );
  137           cs .setCode(" V3PR1");
  138           re quest.setV ersionCode (cs);
  139  
  140           // interactio nId
  141           ii  = factory .createII( );
  142           ii .setRoot(" 2.16.840.1 .113883.1. 6");
  143           ii .setExtens ion("PRPA_ IN201306UV 02");
  144           re quest.setI nteraction Id(ii);
  145  
  146           // processing Code
  147           cs  = factory .createCS( );
  148           cs .setCode(A PP_CONFIG. getPDWSPro cCode());
  149           re quest.setP rocessingC ode(cs);
  150  
  151           // processing ModeCode
  152           cs  = factory .createCS( );
  153           cs .setCode(" I");
  154           re quest.setP rocessingM odeCode(cs );
  155  
  156           // acceptAckC ode
  157           cs  = factory .createCS( );
  158           cs .setCode(" AL");
  159           re quest.setA cceptAckCo de(cs);
  160  
  161           // receiver
  162           MC CIMT000100 UV01Receiv er receive r = factor y.createMC CIMT000100 UV01Receiv er();
  163           re quest.getR eceiver(). add(receiv er);
  164  
  165           // receiver/t ypeCode
  166           re ceiver.set TypeCode(C ommunicati onFunction Type.RCV);
  167  
  168           // receiver/d evice
  169           de vice = fac tory.creat eMCCIMT000 100UV01Dev ice();
  170           re ceiver.set Device(dev ice);
  171  
  172           // receiver/d evice/clas sCode
  173           de vice.setCl assCode(En tityClassD evice.DEV) ;
  174  
  175           // receiver/d evice/dete rminerCode
  176           de vice.setDe terminerCo de("INSTAN CE");
  177  
  178           // receiver/d evice/id
  179           ii  = factory .createII( );
  180           ii .setRoot(" 1.3.6.1.4. 1.21367.20 09.1.3.1.1 45");
  181           de vice.getId ().add(ii) ;
  182  
  183           // sender
  184           MC CIMT000100 UV01Sender  sender =  factory.cr eateMCCIMT 000100UV01 Sender();
  185           re quest.setS ender(send er);
  186  
  187           // sender/typ eCode
  188           se nder.setTy peCode(Com munication FunctionTy pe.SND);
  189  
  190           // sender/dev ice
  191           de vice = fac tory.creat eMCCIMT000 100UV01Dev ice();
  192           se nder.setDe vice(devic e);
  193  
  194           // sender/dev ice/classC ode
  195           de vice.setCl assCode(En tityClassD evice.DEV) ;
  196  
  197           // sender/dev ice/determ inerCode
  198           de vice.setDe terminerCo de("INSTAN CE");
  199  
  200           // sender/dev ice/id
  201           ii  = factory .createII( );
  202           ii .setRoot(" 2.16.840.1 .113883.3. 2017.11.7" );
  203           ii .setExtens ion(APP_CO NFIG.getPD WSSndDevId ());
  204           de vice.getId ().add(ii) ;
  205  
  206           // sender/dev ice/asAgen t
  207           MC CIMT000100 UV01Agent  agent = fa ctory.crea teMCCIMT00 0100UV01Ag ent();
  208           de vice.setAs Agent(fact ory.create MCCIMT0001 00UV01Devi ceAsAgent( agent));
  209  
  210           // sender/dev ice/asAgen t/classCod e
  211           ag ent.getCla ssCode().a dd("AGNT") ;
  212  
  213           // sender/dev ice/asAgen t/represen tedOrganiz ation
  214           MC CIMT000100 UV01Organi zation org anization  = factory. createMCCI MT000100UV 01Organiza tion();
  215           ag ent.setRep resentedOr ganization (factory.c reateMCCIM T000100UV0 1AgentRepr esentedOrg anization(
  216                    orga nization)) ;
  217  
  218           // sender/dev ice/asAgen t/represen tedOrganiz ation/clas sCode
  219           or ganization .setClassC ode("ORG") ;
  220  
  221           // sender/dev ice/asAgen t/represen tedOrganiz ation/dete rminerCode
  222           or ganization .setDeterm inerCode(" INSTANCE") ;
  223  
  224           // sender/dev ice/asAgen t/represen tedOrganiz ation/id
  225           ii  = factory .createII( );
  226           if  (AGENCY_D OD.equalsI gnoreCase( agency)) {
  227                ii.setRo ot("2.16.8 40.1.11388 3.3.42.100 02.100001. 8");
  228                ii.setEx tension(dm isId);
  229           }  else if (A GENCY_VA.e qualsIgnor eCase(agen cy)) {
  230                ii.setRo ot("2.16.8 40.1.11388 3.4.349");
  231                ii.setEx tension(si teId);
  232           }
  233           or ganization .getId().a dd(ii);
  234  
  235           // controlAct Process
  236           PR PAIN201305 UV02QUQIMT 021001UV01 ControlAct Process co ntrolActPr ocess = fa ctory.crea tePRPAIN20 1305UV02QU QIMT021001 UV01Contro lActProces s();
  237           re quest.setC ontrolActP rocess(con trolActPro cess);
  238  
  239           // controlAct Process/cl assCode
  240           co ntrolActPr ocess.setC lassCode(A ctClassCon trolAct.CA CT);
  241  
  242           // controlAct Process/mo odCode
  243           co ntrolActPr ocess.setM oodCode(XA ctMoodInte ntEvent.EV N);
  244  
  245           // controlAct Process/co de
  246           cd  = factory .createCD( );
  247           cd .setCode(" PRPA_TE201 305UV02");
  248           co ntrolActPr ocess.setC ode(cd);
  249  
  250           // controlAct Process/co deSystem
  251           cd .setCodeSy stem("2.16 .840.1.113 883.1.6");
  252  
  253           // controlAct Process/da taEnterer
  254           QU QIMT021001 UV01DataEn terer data Enterer =  factory.cr eateQUQIMT 021001UV01 DataEntere r();
  255           co ntrolActPr ocess.getD ataEnterer ().add(dat aEnterer);
  256  
  257           // controlAct Process/da taEnterer/ typeCode
  258           da taEnterer. getTypeCod e().add("E NT");
  259  
  260           // controlAct Process/da taEnterer/  contextCo ntrolCode
  261           da taEnterer. setContext ControlCod e("AP");
  262  
  263           // controlAct Process/da taEnterer/ assignedPe rson
  264           CO CTMT090100 UV01Assign edPerson a ssignedPer son = fact ory.create COCTMT0901 00UV01Assi gnedPerson ();
  265           da taEnterer. setAssigne dPerson(as signedPers on);
  266  
  267           // controlAct Process/da taEnterer/ assignedPe rson/class Code
  268           as signedPers on.setClas sCode("ASS IGNED");
  269  
  270           // controlAct Process/da taEnterer/ assignedPe rson/id
  271           ii  = factory .createII( );
  272           if  (AGENCY_D OD.equalsI gnoreCase( agency)) {
  273                ii.setRo ot("2.16.8 40.1.11388 3.3.42.127 .100001.79 ");
  274                ii.setEx tension(us er.getUser Ien() + "^ " + dmisId );
  275           }  else if (A GENCY_VA.e qualsIgnor eCase(agen cy)) {
  276                ii.setRo ot("2.16.8 40.1.11388 3.4.349");
  277                ii.setEx tension(us er.getUser Ien() + "^ " + siteId );
  278           }
  279           as signedPers on.getId() .add(ii);
  280  
  281           // controlAct Process/da taEnterer/ assignedPe rson/Perso n
  282           CO CTMT090100 UV01Person  person =  factory.cr eateCOCTMT 090100UV01 Person();
  283           as signedPers on.setAssi gnedPerson (factory.c reateCOCTM T090100UV0 1AssignedP ersonAssig nedPerson( person));
  284  
  285           // controlAct Process/da taEnterer/ assignedPe rson/Perso n/name
  286           EN  en = fact ory.create EN();
  287           en .getConten t().add(qu eryBean.ge tUser().ge tName());
  288           pe rson.getNa me().add(e n);
  289  
  290           // controlAct Process/qu eryByParam eter
  291           PR PAMT201306 UV02QueryB yParameter  queryByPa rameter =  factory.cr eatePRPAMT 201306UV02 QueryByPar ameter();
  292           co ntrolActPr ocess.setQ ueryByPara meter(fact ory.create PRPAIN2013 06UV02MFMI MT700711UV 01ControlA ctProcessQ ueryByPara meter(quer yByParamet er));
  293  
  294           // controlAct Process/qu eryByParam eter/query Id
  295           ii  = factory .createII( );
  296           ii .setRoot(" 2.16.840.1 .113883.3. 2017");
  297           ii .setExtens ion("33333 4433");
  298           qu eryByParam eter.setQu eryId(ii);
  299  
  300           // controlAct Process/qu eryByParam eter/statu sCode
  301           cs  = factory .createCS( );
  302           cs .setCode(" new");
  303           qu eryByParam eter.setSt atusCode(c s);
  304  
  305           // controlAct Process/qu eryByParam eter/initi alQuantity
  306           IN T i = fact ory.create INT();
  307           i. setValue(B igInteger. valueOf(10 ));
  308           qu eryByParam eter.setIn itialQuant ity(i);
  309  
  310           // controlAct Process/qu eryByParam eter/param eterList
  311           PR PAMT201306 UV02Parame terList pa rameterLis t = factor y.createPR PAMT201306 UV02Parame terList();
  312           qu eryByParam eter.setPa rameterLis t(paramete rList);
  313  
  314           // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctId
  315           if  (!"".equa ls(queryBe an.getPati entId()) & & !"".equa ls(queryBe an.getPati entIdType( )))
  316           {
  317                ii = fac tory.creat eII();
  318                ii.setRo ot("2.16.8 40.1.11388 3.3.42.100 01.100001. 12");
  319                ii.setEx tension(qu eryBean.ge tPatientId ());
  320  
  321                PRPAMT20 1306UV02Li vingSubjec tId living SubjectId  = factory. createPRPA MT201306UV 02LivingSu bjectId();
  322                livingSu bjectId.ge tValue().a dd(ii);
  323                paramete rList.getL ivingSubje ctId().add (livingSub jectId);
  324  
  325                //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectId/s emanticsTe xt
  326                ST st =  factory.cr eateST();
  327                st.getCo ntent().ad d("LivingS ubject.id" );
  328                livingSu bjectId.se tSemantics Text(st);
  329           }
  330  
  331           re turn reque st;
  332       }
  333  
  334       privat e Response PatientQue ry ParseRe sponseToPa tientList( PRPAIN2013 06UV02 res ponse) thr ows JMeado wsExceptio n {
  335           Re sponsePati entQuery r espPatQuer y = new Re sponsePati entQuery() ;
  336           bo olean done  = false;
  337  
  338           //  Initially  set to fa ilure with  generic e rror messa ge. Will o nly be
  339           //  set to su ccess if t here are n o acknowle dgement er rors and n o
  340           //  errors re trieving p atient lis t, even if  the list  is empty
  341           re spPatQuery .setSucces s(false);
  342           re spPatQuery .setErrorM sg("Error  retrieving  patients. "
  343                    + "< br><br>Ple ase try ag ain."
  344                    + "< br><br>If  the proble m persists , notify y our system  administr ator or he lp desk.") ;
  345  
  346           //  Create li st of resu lt patient s
  347           Li st<Patient > resultPa tList = ne w ArrayLis t<Patient> ();
  348  
  349           if  (response  != null)  {
  350                // Check  the respo nse acknow ledgement  for an app lication e rror
  351                List<MCC IMT000300U V01Acknowl edgement>  ackList =  response.g etAcknowle dgement();
  352                if (ackL ist != nul l) {
  353                    for  (MCCIMT000 300UV01Ack nowledgeme nt ack : a ckList) {
  354                         CS cs = ac k.getTypeC ode();
  355                         if (cs !=  null && "A E".equalsI gnoreCase( cs.getCode ())) {
  356                             // App lication e rror occur red
  357                             List<M CCIMT00030 0UV01Ackno wledgement Detail> ac kDetailLis t = ack.ge tAcknowled gementDeta il();
  358                             if (ac kDetailLis t != null)  {
  359                                 fo r (MCCIMT0 00300UV01A cknowledge mentDetail  ackDetail  : ackDeta ilList) {
  360                                      if (ackD etail.getT ypeCode()  == Acknowl edgementDe tailType.E ) {
  361                                          // A pplication  error mes sage
  362                                          resp PatQuery.s etSuccess( false);
  363  
  364                                          CE c e = ackDet ail.getCod e();
  365                                          if ( (ce != nul l) && (ce. getDisplay Name() !=  null))
  366                                          {
  367                                               LOGGER.err or(ce.getD isplayName ());
  368                                               respPatQue ry.setErro rMsg(ce.ge tDisplayNa me());
  369                                          }
  370  
  371                                          done  = true;
  372                                          brea k;
  373                                      }
  374                                 }
  375                             }
  376                         }
  377                    }
  378                }
  379  
  380                if (!don e) {
  381                    // P arse messa ge for lis t of patie nts
  382                    PRPA IN201306UV 02MFMIMT70 0711UV01Co ntrolActPr ocess ctrl ActProc =  response.g etControlA ctProcess( );
  383                    if ( ctrlActPro c != null)  {
  384                         // Iterate  through e ach patien t
  385                         List<PRPAI N201306UV0 2MFMIMT700 711UV01Sub ject1> sub jList = ct rlActProc. getSubject ();
  386                         if (subjLi st != null ) {
  387                             String Builder fa milyName =  new Strin gBuilder() ;
  388                             String Builder gi venName =  new String Builder();
  389                             String Builder pr efixName =  new Strin gBuilder() ;
  390                             String Builder su ffixName =  new Strin gBuilder() ;
  391                             for (P RPAIN20130 6UV02MFMIM T700711UV0 1Subject1  subj : sub jList) {
  392                                 fa milyName.s etLength(0 );
  393                                 gi venName.se tLength(0) ;
  394                                 pr efixName.s etLength(0 );
  395                                 su ffixName.s etLength(0 );
  396                                 St ring edipi  = null;
  397                                 St ring ssn =  "N/A";
  398                                 St ring gende r = "N/A";
  399                                 St ring dob =  "N/A";
  400       
  401                                 PR PAIN201306 UV02MFMIMT 700711UV01 Registrati onEvent re gEvent = s ubj.getReg istrationE vent();
  402                                 if  (regEvent  != null)  {
  403                                      PRPAIN20 1306UV02MF MIMT700711 UV01Subjec t2 subj1 =  regEvent. getSubject 1();
  404                                      if (subj 1 != null)  {
  405                                          PRPA MT201310UV 02Patient  pat = subj 1.getPatie nt();
  406                                          if ( pat != nul l) {
  407                                               // Retriev e patient  EDIPI
  408                                               List<II> i iList = pa t.getId();
  409                                               if ((iiLis t != null)  && !iiLis t.isEmpty( )) {
  410                                                   edipi  = iiList.g et(0).getE xtension() ;
  411                                               }
  412       
  413                                               // Retriev e patient' s demograp hics infor mation (na me, gender , dob, ssn )
  414                                               JAXBElemen t<PRPAMT20 1310UV02Pe rson> jaxb ElementPer son = pat. getPatient Person();
  415                                               if (jaxbEl ementPerso n != null)  {
  416                                                   PRPAMT 201310UV02 Person per son = jaxb ElementPer son.getVal ue();
  417                                                   if (pe rson != nu ll) {
  418                                                       //  Retrieve  patient ge nder
  419                                                       CE  ce = pers on.getAdmi nistrative GenderCode ();
  420                                                       if  (ce != nu ll) {
  421                                                            gender =  ce.getCod e();
  422                                                       }
  423       
  424                                                       //  Retrieve  patient da te of birt h
  425                                                       TS  ts = pers on.getBirt hTime();
  426                                                       if  (ts != nu ll) {
  427                                                            dob = ts .getValue( );
  428                                                       }
  429       
  430                                                       //  Retrieve  patient na me
  431                                                       Li st<PN> pnL ist = pers on.getName ();
  432                                                       if  (pnList = = null) {
  433                                                            LOGGER.e rror("List <PN> is nu ll");
  434                                                       }  else {
  435                                                            for (PN  pn : pnLis t) {
  436                                                                List <Serializa ble> seria lList = pn .getConten t();
  437                                                                if ( serialList  == null)  {
  438                                                                     LOGGER.err or("List<S erializabl e> is null ");
  439                                                                } el se {
  440                                                                     for (Seria lizable se rial : ser ialList) {
  441                                                                         if (se rial insta nceof JAXB Element) {
  442                                                                             Ob ject obj =  ((JAXBEle ment) seri al).getVal ue();
  443                                                                             if  (obj != n ull) {
  444                                                                                  if (obj  instanceof  EnFamily)  {
  445                                                                                      List <Serializa ble> seria l2List = ( (EnFamily)  obj).getC ontent();
  446                                                                                      if ( (serial2Li st != null ) && !seri al2List.is Empty()) {
  447                                                                                           familyName .append(se rial2List. get(0) + "  ");
  448                                                                                      }
  449                                                                                  } else i f (obj ins tanceof En Given) {
  450                                                                                      List <Serializa ble> seria l2List = ( (EnGiven)  obj).getCo ntent();
  451                                                                                      if ( (serial2Li st != null ) && !seri al2List.is Empty()) {
  452                                                                                           givenName. append(ser ial2List.g et(0) + "  ");
  453                                                                                      }
  454                                                                                  } else i f (obj ins tanceof En Prefix) {
  455                                                                                      List <Serializa ble> seria l2List = ( (EnPrefix)  obj).getC ontent();
  456                                                                                      if ( (serial2Li st != null ) && !seri al2List.is Empty()) {
  457                                                                                           prefixName .append(se rial2List. get(0) + "  ");
  458                                                                                      }
  459                                                                                  } else i f (obj ins tanceof En Suffix) {
  460                                                                                      List <Serializa ble> seria l2List = ( (EnSuffix)  obj).getC ontent();
  461                                                                                      if ( (serial2Li st != null ) && !seri al2List.is Empty()) {
  462                                                                                           suffixName .append(se rial2List. get(0) + "  ");
  463                                                                                      }
  464                                                                                  }
  465                                                                             }
  466                                                                         }
  467                                                                     }
  468                                                                }
  469                                                            }
  470       
  471                                                            // Forma t: PrefixN ame Family Name,Given Name Suffi xName
  472                                                            // (comm a will be  added when  generatin g name str ing)
  473       
  474                                                            // Add p refix befo re family  name
  475                                                            if (pref ixName.len gth() > 0)  {
  476                                                                fami lyName = p refixName. append(fam ilyName);
  477                                                            }
  478       
  479                                                            // Add s uffix afte r given na me
  480                                                            if (suff ixName.len gth() > 0)  {
  481                                                                give nName.appe nd(suffixN ame);
  482                                                            }
  483                                                       }
  484       
  485                                                       //  Retrieve  patient SS N
  486                                                       Li st<PRPAMT2 01310UV02O therIDs> o therIdsLis t = person .getAsOthe rIDs();
  487                                                       if  (otherIds List != nu ll) {
  488                                                            for (PRP AMT201310U V02OtherID s otherIDs  : otherId sList)
  489                                                            {
  490                                                                List <II> ii2Li st = other IDs.getId( );
  491                                                                if ( ii2List !=  null) {
  492                                                                     for (II ii  : ii2List ) {
  493                                                                         CS cs  = otherIDs .getStatus Code();
  494                                                                         if (cs  != null & & "2.16.84 0.1.113883 .4.1".equa lsIgnoreCa se(ii.getR oot()) &&  "active".e qualsIgnor eCase(cs.g etCode()))  {
  495                                                                             ss n = ii.get Extension( );
  496                                                                         }
  497                                                                     }
  498                                                                }
  499                                                            }
  500                                                       }
  501                                                   }
  502                                               }
  503                                          }
  504                                      }
  505                                 }
  506       
  507                                 Pa tient resu ltPat = ne w Patient( );
  508       
  509                                 //  Set patie nt informa tion
  510                                 re sultPat.se tEDIPI(edi pi);
  511                                 re sultPat.se tSSN(ssn);
  512                                 re sultPat.se tName(fami lyName.toS tring().tr im() + ","  + givenNa me.toStrin g().trim() );
  513                                 re sultPat.se tGender(ge nder);
  514                                 re sultPat.se tDob(dob);
  515       
  516                                 //  Add to pa tient list
  517                                 re sultPatLis t.add(resu ltPat);
  518                             }
  519                         }
  520                    }
  521                }
  522       
  523                respPatQ uery.setSu ccess(true );
  524                respPatQ uery.setEr rorMsg(nul l);
  525                respPatQ uery.setPa tients(res ultPatList );
  526           }
  527           re turn respP atQuery;
  528       }
  529   }