33. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 8/31/2017 11:16:53 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.

33.1 Files compared

# Location File Last Modified
1 JLV_2.6.zip\JLV_2.6\JLV_2.6\Joint Legacy Viewer\jMeadows\src\main\java\gov\va\med\jmeadows\dataservicehandler EntityPatientRetrieveServiceHandler.java Thu Aug 31 12:13:08 2017 UTC
2 JLV_2.6.zip\JLV_2.6\JLV_2.6\Joint Legacy Viewer\jMeadows\src\main\java\gov\va\med\jmeadows\dataservicehandler EntityPatientRetrieveServiceHandler.java Thu Aug 31 13:28:59 2017 UTC

33.2 Comparison summary

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

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

33.4 Active regular expressions

No regular expressions were active.

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