72. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/1/2018 12:13:17 PM Central Standard 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.

72.1 Files compared

# Location File Last Modified
1 ehealth_xchange_cif.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters MVI1302DataAdapter.java Thu Feb 22 14:26:48 2018 UTC
2 ehealth_xchange_cif.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters MVI1302DataAdapter.java Wed Feb 28 18:05:21 2018 UTC

72.2 Comparison summary

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

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

72.4 Active regular expressions

No regular expressions were active.

72.5 Comparison detail

  1   /*
  2    * To chan ge this li cense head er, choose  License H eaders in  Project Pr operties.
  3    * To chan ge this te mplate fil e, choose  Tools | Te mplates
  4    * and ope n the temp late in th e editor.
  5    */
  6   package go v.va.med.n hin.adapte r.datamana ger.adapte rs;
  7  
  8   import com .sun.xml.w s.client.B indingProv iderProper ties;
  9   import gov .hhs.fha.n hinc.commo n.nhinccom mon.Assert ionType;
  10   import gov .va.med.nh in.adapter .datamanag er.DataAda pter;
  11   import gov .va.med.nh in.adapter .datamanag er.DataQue ry;
  12   import sta tic gov.va .med.nhin. adapter.da tamanager. adapters.M VIDataAdap ter.VA_OID ;
  13   import gov .va.med.nh in.adapter .utils.Nul lChecker;
  14   import gov .va.oit.oe d.vaww.VAI dMPort;
  15   import jav a.util.Arr ayList;
  16   import jav a.util.Has hMap;
  17   import jav a.util.Lis t;
  18   import jav a.util.Map ;
  19   import jav ax.xml.bin d.JAXBElem ent;
  20   import jav ax.xml.ws. BindingPro vider;
  21   import jav ax.xml.ws. WebService Exception;
  22   import jav ax.xml.ws. soap.SOAPF aultExcept ion;
  23   import org .hl7.v3.AD Explicit;
  24   import org .hl7.v3.Ac tClassCont rolAct;
  25   import org .hl7.v3.Ad xpExplicit City;
  26   import org .hl7.v3.Ad xpExplicit PostalCode ;
  27   import org .hl7.v3.Ad xpExplicit State;
  28   import org .hl7.v3.Ad xpExplicit StreetAddr essLine;
  29   import org .hl7.v3.CE ;
  30   import org .hl7.v3.CO CTMT090003 UV01Assign edEntity;
  31   import org .hl7.v3.CO CTMT090003 UV01Organi zation;
  32   import org .hl7.v3.CO CTMT150002 UV01Organi zation;
  33   import org .hl7.v3.CO CTMT150003 UV03Contac tParty;
  34   import org .hl7.v3.CO CTMT150003 UV03Organi zation;
  35   import org .hl7.v3.CS ;
  36   import org .hl7.v3.En ExplicitFa mily;
  37   import org .hl7.v3.En ExplicitGi ven;
  38   import org .hl7.v3.II ;
  39   import org .hl7.v3.MC CIIN000002 UV01;
  40   import org .hl7.v3.MF MIMT700701 UV01Custod ian;
  41   import org .hl7.v3.PN Explicit;
  42   import org .hl7.v3.PR PAIN201302 UV02;
  43   import org .hl7.v3.PR PAIN201302 UV02MFMIMT 700701UV01 ControlAct Process;
  44   import org .hl7.v3.PR PAIN201302 UV02MFMIMT 700701UV01 Registrati onEvent;
  45   import org .hl7.v3.PR PAIN201302 UV02MFMIMT 700701UV01 Subject1;
  46   import org .hl7.v3.PR PAIN201302 UV02MFMIMT 700701UV01 Subject2;
  47   import org .hl7.v3.PR PAMT201302 UV02BirthP lace;
  48   import org .hl7.v3.PR PAMT201302 UV02OtherI Ds;
  49   import org .hl7.v3.PR PAMT201302 UV02OtherI DsId;
  50   import org .hl7.v3.PR PAMT201302 UV02Patien t;
  51   import org .hl7.v3.PR PAMT201302 UV02Patien tId;
  52   import org .hl7.v3.PR PAMT201302 UV02Patien tPatientPe rson;
  53   import org .hl7.v3.PR PAMT201302 UV02Patien tStatusCod e;
  54   import org .hl7.v3.Pa rticipatio nTargetSub ject;
  55   import org .hl7.v3.Ro leClassCon tact;
  56   import org .hl7.v3.TE LExplicit;
  57   import org .hl7.v3.TS Explicit;
  58   import org .hl7.v3.XA ctMoodInte ntEvent;
  59   import org .slf4j.Log ger;
  60   import org .slf4j.Log gerFactory ;
  61  
  62   /**
  63    *
  64    * @author   DN S      WARDJ
  65    */
  66   public cla ss MVI1302 DataAdapte r extends  MVIDataAda pter<Map<S tring, Str ing>> impl ements Dat aAdapter<M ap<String,  String>>  {
  67       
  68       privat e static f inal Logge r logger =  LoggerFac tory.getLo gger(MVI13 02DataAdap ter.class. getName()) ;
  69  
  70       @Overr ide
  71       public  List<Map< String, St ring>> get Data(DataQ uery dataQ uery) thro ws Excepti on {
  72           in itializePr operties(d ataQuery);
  73           Li st<Map<Str ing,String >> result  = new Arra yList<>();
  74           //  Implement  a require ment to re try the op eration on  failure,  up to a
  75           //  retry lim it
  76           in t retriesR emaining =  mviRetryL imit;
  77           wh ile (true)  {
  78                try {
  79                    // b uild reque st 1302
  80                    PRPA IN201302UV 02 request 1302 = bui ldRequest1 302(dataQu ery);
  81                    VAId MPort port  = getVAId MPort(wsdl URL);
  82                    Map< String, Ob ject> requ estContext  = ((Bindi ngProvider ) port).ge tRequestCo ntext();
  83                    requ estContext .put(Bindi ngProvider Properties .REQUEST_T IMEOUT, mv iRequestTi meout);
  84                    requ estContext .put(Bindi ngProvider Properties .CONNECT_T IMEOUT, mv iConnectTi meout);
  85                    MCCI IN000002UV 01 ack = ( MCCIIN0000 02UV01) po rt.prpaIN2 01302UV02( request130 2);
  86                    if ( NullChecke r.isNotNul lOrEmpty(a ck.getAckn owledgemen t()))
  87                    {
  88                         if (ack.ge tAcknowled gement().g et(0).getT ypeCode(). getCode(). equalsIgno reCase("AE ")) {
  89                             String  mviAckTex t = (Strin g) ack.get Acknowledg ement().ge t(0).getAc knowledgem entDetail( ).get(0).g etText().g etContent( ).get(0);
  90                             String  errorMsg  = "MVI ret urned with  error cod e of 'AE'.   Details:  '" + mviA ckText + " '";
  91  
  92                             // {}- CCR 177986
  93                             logger .error(err orMsg);
  94                             // mea ningful ex ception
  95                             throw  new DataAd apterExcep tion(error Msg);
  96                         }
  97                          // parse  1301 respo nse
  98                          result =  mapAckToRe sult(ack);
  99                          
  100                    }
  101  
  102                   if (r esult == n ull || res ult.isEmpt y()) {
  103                         result = c reateDefau ltResult(" <UNKNOWN>" );
  104                    }
  105                    brea k;
  106                } catch  (SOAPFault Exception  sfe) {
  107                    Stri ng msg = s fe.getMess age();
  108                    Stri ng sfStr =  sfe.getFa ult().getF aultString ();
  109                    Stri ng sfCode  = sfe.getF ault().get FaultCode( );
  110  
  111                    // C CR 179231
  112                    thro w new Data AdapterExc eption("SO APFaultExc eption occ urred :" +  "Message:  " + msg +  "; " + "F aultString : " + sfSt r + ";" +  "FaultCode : " + sfCo de, sfe);
  113                } catch  (WebServic eException  ste) {
  114                    logg er.error(" WebService Exception  connecting  to MVI.   Message={} ", ste.get Message()) ;
  115  
  116                    // o nly execut e retries  on timeout
  117                    if ( ste.getCau se() insta nceof java .net.Socke tTimeoutEx ception) {
  118                         if (--retr iesRemaini ng == 0) {
  119                             throw  new DataAd apterExcep tion(ste);
  120                         } else {
  121                             logger .debug("Re trying con nection to  MVI due t o SocketTi meoutExcep tion. {} r etries rem aining.",  retriesRem aining);
  122                         }
  123                    } el se {
  124                         throw new  DataAdapte rException (ste);
  125                    }
  126                } catch  (Throwable  t) {
  127                    logg er.error(" There was  an error g etting dat a from MVI .  Message ={}", t.ge tMessage() );
  128  
  129                    thro w new Data AdapterExc eption("Th ere was an  error get ting data  from MVI",  t);
  130                }
  131           }
  132           re turn resul t;
  133  
  134       }
  135  
  136       privat e List<Map <String,St ring>> cre ateDefault Result(Str ing defaul tValue)
  137       {
  138           Ma p<String,S tring> def aultInfo =  new HashM ap<>();
  139           Ar rayList<Ma p<String,S tring>> de faultResul t = new Ar rayList<>( );
  140  
  141           de faultInfo. put("resul t", defaul tValue);
  142  
  143           de faultResul t.add(defa ultInfo);
  144  
  145           re turn defau ltResult;
  146       }
  147  
  148       privat e PRPAIN20 1302UV02 b uildReques t1302(Data Query data Query)
  149       {
  150           or g.hl7.v3.O bjectFacto ry of = ne w org.hl7. v3.ObjectF actory();
  151           PR PAIN201302 UV02 reque st1302 = o f.createPR PAIN201302 UV02();
  152           As sertionTyp e assertio n = (Asser tionType)  dataQuery. getParamet er("assert ion");
  153  
  154           St ring sendi ngFacility OID = (Str ing) dataQ uery.getPa rameter("s endingFaci lityOID");
  155           St ring sendi ngFacility Number = ( String) da taQuery.ge tParameter ("sendingF acilityNum ber");
  156           St ring assig ningAuthor ityID = (S tring) dat aQuery.get Parameter( "correlate dAssigning Authority" );
  157  
  158           //  Set up me ssage head er fields
  159           re quest1302. setITSVers ion(reques t1302.getI TSVersion( )); // "XM L_1.0"
  160  
  161           re quest1302. setId(crea teMessageI d(request1 302.getId( )));
  162  
  163           //  Set Creat ion Time
  164           re quest1302. setCreatio nTime(crea teCreation Time());
  165  
  166           II  interacti onId = new  II();
  167           in teractionI d.setRoot( "2.16.840. 1.113883.1 .6"); // H L7Constant s.INTERACT ION_ID_ROO T
  168           in teractionI d.setExten sion("PRPA _IN201302U V02");
  169           re quest1302. setInterac tionId(int eractionId );
  170  
  171           //  Set Proce ssing Code
  172           CS  processin gCode = ne w CS();
  173           pr ocessingCo de.setCode ("P"); //p rocessingC odeStr
  174           re quest1302. setProcess ingCode(pr ocessingCo de);
  175  
  176           CS  processin gModeCode  = new CS() ;
  177           //  processin gModeCode. setCode("R ");
  178           pr ocessingMo deCode.set Code("T");
  179           re quest1302. setProcess ingModeCod e(processi ngModeCode );
  180  
  181           //  Set Ackno wlegment C ode
  182           CS  acceptAck Code = new  CS();
  183           ac ceptAckCod e.setCode( "AL");
  184           re quest1302. setAcceptA ckCode(acc eptAckCode );
  185  
  186           //  Set Recei ver
  187           re quest1302. getReceive r().add(cr eateReceiv er());
  188  
  189           //  Set Sende r
  190           re quest1302. setSender( createSend er(mviSite Key1302, s endingFaci lityOID, s endingFaci lityNumber ));
  191  
  192           //  set Contr ol Act Pro cess block
  193           PR PAIN201302 UV02MFMIMT 700701UV01 ControlAct Process co ntrolActPr ocess = ne w PRPAIN20 1302UV02MF MIMT700701 UV01Contro lActProces s();
  194           co ntrolActPr ocess.setM oodCode(XA ctMoodInte ntEvent.EV N);
  195           co ntrolActPr ocess.setC lassCode(A ctClassCon trolAct.CA CT);
  196  
  197           //  Set DataE nterer
  198           co ntrolActPr ocess.getD ataEnterer ().add(cre ateDataEnt erer1(asse rtion));
  199  
  200           //  set up Su bject
  201           PR PAIN201302 UV02MFMIMT 700701UV01 Subject1 s ubject = n ew PRPAIN2 01302UV02M FMIMT70070 1UV01Subje ct1();
  202           su bject.getT ypeCode(). add("SUBJ" );
  203  
  204           //  set up Re gistration Event
  205           PR PAIN201302 UV02MFMIMT 700701UV01 Registrati onEvent ev ent = new  PRPAIN2013 02UV02MFMI MT700701UV 01Registra tionEvent( );
  206           ev ent.getCla ssCode().a dd("REG");
  207           ev ent.getMoo dCode().ad d("EVN");
  208  
  209           II  nullId =  new II();
  210           nu llId.getNu llFlavor() .add("NA") ;
  211           ev ent.getId( ).add(null Id);
  212  
  213           //  set Regis tration Ev ent Status  Code
  214           CS  eventStat usCode = n ew CS();
  215           ev entStatusC ode.setCod e("active" );
  216           ev ent.setSta tusCode(ev entStatusC ode);
  217  
  218           PR PAIN201302 UV02MFMIMT 700701UV01 Subject2 s ubject1 =  new PRPAIN 201302UV02 MFMIMT7007 01UV01Subj ect2();
  219           su bject1.set TypeCode(P articipati onTargetSu bject.SBJ) ;
  220  
  221           //  set up Pa tient
  222           PR PAMT201302 UV02Patien t patient  = new PRPA MT201302UV 02Patient( );
  223           pa tient.getC lassCode() .add("PAT" );
  224  
  225           //  set up IC N
  226           PR PAMT201302 UV02Patien tId patien tId = new  PRPAMT2013 02UV02Pati entId();
  227           pa tientId.se tRoot(VA_O ID);
  228           pa tientId.se tExtension ((String)  dataQuery. getParamet er("patien tId"));
  229           pa tient.getI d().add(pa tientId);
  230  
  231           //  set Patie nt Status  Code
  232           PR PAMT201302 UV02Patien tStatusCod e patientS tatusCode  = new PRPA MT201302UV 02PatientS tatusCode( );
  233           pa tientStatu sCode.setC ode("activ e");
  234           pa tient.setS tatusCode( patientSta tusCode);
  235  
  236           //  set up pe rson
  237           PR PAMT201302 UV02Patien tPatientPe rson perso n = new PR PAMT201302 UV02Patien tPatientPe rson();
  238           PN Explicit p ersonName  = new PNEx plicit();
  239           pe rsonName.g etUse().ad d("L");
  240           pe rson.getNa me().add(p ersonName) ;
  241  
  242           //  set up na mes
  243           if  (NullChec ker.isNotN ullOrEmpty ((String)  dataQuery. getParamet er("firstN ame"))) {
  244                EnExplic itGiven fi rstName =  new EnExpl icitGiven( );
  245                firstNam e.setConte nt((String ) dataQuer y.getParam eter("firs tName"));
  246                JAXBElem ent<EnExpl icitGiven>  firstName Elem = of. createENEx plicitGive n(firstNam e);
  247                personNa me.getCont ent().add( firstNameE lem);
  248           }
  249  
  250           if  (NullChec ker.isNotN ullOrEmpty ((String)  dataQuery. getParamet er("middle Name"))) {
  251                EnExplic itGiven mi ddleName =  new EnExp licitGiven ();
  252                middleNa me.setCont ent((Strin g) dataQue ry.getPara meter("mid dleName")) ;
  253                JAXBElem ent<EnExpl icitGiven>  middleNam eElem = of .createENE xplicitGiv en(middleN ame);
  254                personNa me.getCont ent().add( middleName Elem);
  255           }
  256  
  257           if  (NullChec ker.isNotN ullOrEmpty ((String)  dataQuery. getParamet er("family Name"))) {
  258                EnExplic itFamily f amilyName  = new EnEx plicitFami ly();
  259                familyNa me.setCont ent((Strin g) dataQue ry.getPara meter("fam ilyName")) ;
  260                JAXBElem ent<EnExpl icitFamily > familyNa meElem = o f.createEN ExplicitFa mily(famil yName);
  261                personNa me.getCont ent().add( familyName Elem);
  262           }
  263  
  264           //  Mothers M aiden Name
  265           St ring mmnSt r = (Strin g) dataQue ry.getPara meter("mot hersMaiden Name");
  266           if  (NullChec ker.isNotN ullOrEmpty (mmnStr))  {
  267                PNExplic it mmnName  = new PNE xplicit();
  268                mmnName. getUse().a dd("C");
  269                EnExplic itFamily m mnFamily =  new EnExp licitFamil y();
  270                mmnFamil y.setConte nt(mmnStr) ;
  271                JAXBElem ent<EnExpl icitFamily > mmnFamil yElem = of .createENE xplicitFam ily(mmnFam ily);
  272                mmnName. getContent ().add(mmn FamilyElem );
  273                person.g etName().a dd(mmnName );
  274           }
  275  
  276           //  set up Te lecom
  277           St ring homeP hone = (St ring) data Query.getP arameter(" homePhone" );
  278           if  (NullChec ker.isNotN ullOrEmpty (homePhone )) {
  279                TELExpli cit teleco m = new TE LExplicit( );
  280                telecom. setValue(h omePhone);
  281                telecom. getUse().a dd("HP");
  282                person.g etTelecom( ).add(tele com);
  283           }
  284  
  285           //  set up ge nder
  286           St ring gende rStr = (St ring) data Query.getP arameter(" gender");
  287           if  (NullChec ker.isNotN ullOrEmpty (genderStr )) {
  288                CE gende r = new CE ();
  289                gender.s etCode(gen derStr);
  290                person.s etAdminist rativeGend erCode(gen der);
  291           }
  292  
  293           //  set up Bi rthTime
  294           if  (NullChec ker.isNotN ullOrEmpty ((String)  dataQuery. getParamet er("dob")) ) {
  295                TSExplic it birthTi me = new T SExplicit( );
  296                birthTim e.setValue ((String)  dataQuery. getParamet er("dob")) ;
  297                person.s etBirthTim e(birthTim e);
  298           }
  299  
  300           //  set up Ad dress
  301           AD Explicit a ddr = null ;
  302  
  303           if  (NullChec ker.isNotN ullOrEmpty ((String)  dataQuery. getParamet er("homeAd dressStree t1"))) {
  304                AdxpExpl icitStreet AddressLin e streetAd dressLine  = new Adxp ExplicitSt reetAddres sLine();
  305                streetAd dressLine. setContent ((String)  dataQuery. getParamet er("homeAd dressStree t1") + " "  + (String ) dataQuer y.getParam eter("home AddressStr eet2") + "  " + (Stri ng) dataQu ery.getPar ameter("ho meAddressS treet3"));
  306                JAXBElem ent<AdxpEx plicitStre etAddressL ine> stree tAddressLi neElem = o f.createAD ExplicitSt reetAddres sLine(stre etAddressL ine);
  307                if (addr  == null)  {
  308                    addr  = new ADE xplicit();
  309                }
  310                addr.get Content(). add(street AddressLin eElem);
  311           }
  312  
  313           if  (NullChec ker.isNotN ullOrEmpty ((String)  dataQuery. getParamet er("homeAd dressCity" ))) {
  314                AdxpExpl icitCity c ity = new  AdxpExplic itCity();
  315                city.set Content((S tring) dat aQuery.get Parameter( "homeAddre ssCity"));
  316                JAXBElem ent<AdxpEx plicitCity > cityElem  = of.crea teADExplic itCity(cit y);
  317                if (addr  == null)  {
  318                    addr  = new ADE xplicit();
  319                }
  320                addr.get Content(). add(cityEl em);
  321           }
  322  
  323           if  (NullChec ker.isNotN ullOrEmpty ((String)  dataQuery. getParamet er("homeAd dressState "))) {
  324                AdxpExpl icitState  state = ne w AdxpExpl icitState( );
  325                state.se tContent(( String) da taQuery.ge tParameter ("homeAddr essState") );
  326                JAXBElem ent<AdxpEx plicitStat e> stateEl em = of.cr eateADExpl icitState( state);
  327                if (addr  == null)  {
  328                    addr  = new ADE xplicit();
  329                }
  330                addr.get Content(). add(stateE lem);
  331           }
  332  
  333           if  (NullChec ker.isNotN ullOrEmpty ((String)  dataQuery. getParamet er("homeAd dressPosta l"))) {
  334                AdxpExpl icitPostal Code posta lCode = ne w AdxpExpl icitPostal Code();
  335                postalCo de.setCont ent((Strin g) dataQue ry.getPara meter("hom eAddressPo stal"));
  336                if (addr  == null)  {
  337                    addr  = new ADE xplicit();
  338                }
  339                addr.get Content(). add(of.cre ateADExpli citPostalC ode(postal Code));
  340           }
  341  
  342           if  (addr !=  null) {
  343                person.g etAddr().a dd(addr);
  344           }
  345  
  346           //  BEGIN - B irth Place  Address
  347           PR PAMT201302 UV02BirthP lace bp =  null;
  348           //  ADExplici t pobAddr  = null;
  349           AD Explicit p obAddr = n ull;
  350           St ring pobCi ty = (Stri ng) dataQu ery.getPar ameter("po bCity");
  351           St ring pobSt ate = (Str ing) dataQ uery.getPa rameter("p obState");
  352  
  353           //  pob city
  354           if  (NullChec ker.isNotN ullOrEmpty (pobCity))  {
  355                if (bp = = null) {
  356                    bp =  of.create PRPAMT2013 02UV02Birt hPlace();
  357                }
  358  
  359                AdxpExpl icitCity c ity = new  AdxpExplic itCity();
  360                city.set Content(po bCity);
  361                JAXBElem ent<AdxpEx plicitCity > cityElem  = of.crea teADExplic itCity(cit y);
  362                if (pobA ddr == nul l) {
  363                    pobA ddr = new  ADExplicit ();
  364                }
  365                pobAddr. getContent ().add(cit yElem);
  366                bp.setAd dr(pobAddr );
  367           }
  368           //  pob state
  369           if  (NullChec ker.isNotN ullOrEmpty (pobState) ) {
  370                if (bp = = null) {
  371                    bp =  of.create PRPAMT2013 02UV02Birt hPlace();
  372                }
  373  
  374                AdxpExpl icitState  state = ne w AdxpExpl icitState( );
  375                state.se tContent(p obState);
  376                JAXBElem ent<AdxpEx plicitStat e> stateEl em = of.cr eateADExpl icitState( state);
  377                if (pobA ddr == nul l) {
  378                    pobA ddr = new  ADExplicit ();
  379                }
  380                pobAddr. getContent ().add(sta teElem);
  381                bp.setAd dr(pobAddr );
  382           }
  383  
  384           if  (bp != nu ll) {
  385                javax.xm l.namespac e.QName xm lqname = n ew javax.x ml.namespa ce.QName(" urn:hl7-or g:v3", "bi rthPlace") ;
  386                JAXBElem ent<PRPAMT 201302UV02 BirthPlace > bpElemen t = new JA XBElement< PRPAMT2013 02UV02Birt hPlace>(xm lqname, PR PAMT201302 UV02BirthP lace.class , bp);
  387                person.s etBirthPla ce(bpEleme nt);
  388           }
  389           //  END - Bir th Place A ddress
  390  
  391           //  set up re mote patie nt ID and  scoping or ganization
  392           PR PAMT201302 UV02OtherI Ds correla tedId = ne w PRPAMT20 1302UV02Ot herIDs();
  393           co rrelatedId .getClassC ode().add( "PAT");
  394           PR PAMT201302 UV02OtherI DsId corre latedIdId  = new PRPA MT201302UV 02OtherIDs Id();
  395  
  396           co rrelatedId Id.setRoot (assigning AuthorityI D);
  397           co rrelatedId Id.setExte nsion((Str ing) dataQ uery.getPa rameter("c orrelatedP atientId")  + "^NI^"  + (String)  dataQuery .getParame ter("corre latedAssig ningFacili ty") + "^"  + assigni ngAuthorit yID);
  398           co rrelatedId .getId().a dd(correla tedIdId);
  399           
  400           CS  unlinkCod e = new CS ();
  401           un linkCode.s etCode("UN LINK");
  402           co rrelatedId .setStatus Code(unlin kCode);
  403  
  404           CO CTMT150002 UV01Organi zation cor relatedIdS copingOrg  = new COCT MT150002UV 01Organiza tion();
  405           co rrelatedId ScopingOrg .setClassC ode("ORG") ;
  406           co rrelatedId ScopingOrg .setDeterm inerCode(" INSTANCE") ;
  407           II  correlate dIdScoping OrgId = ne w II();
  408           co rrelatedId ScopingOrg Id.setRoot (VA_OID);
  409           co rrelatedId ScopingOrg .getId().a dd(correla tedIdScopi ngOrgId);
  410           co rrelatedId .setScopin gOrganizat ion(correl atedIdScop ingOrg);
  411  
  412           pe rson.getAs OtherIDs() .add(corre latedId);
  413  
  414           //  set up SS N and scop ing org
  415   //         PRPAMT2013 02UV02Othe rIDs ssn =  new PRPAM T201302UV0 2OtherIDs( );
  416   //         ssn.getCla ssCode().a dd("SSN");
  417   //         PRPAMT2013 02UV02Othe rIDsId ssn Id = new P RPAMT20130 2UV02Other IDsId();
  418   //         ssnId.setR oot("2.16. 840.1.1138 83.4.1");
  419   //         ssnId.setE xtension(( String) da taQuery.ge tParameter ("ssn"));
  420   //         ssn.getId( ).add(ssnI d);
  421   //
  422   //         COCTMT1500 02UV01Orga nization s snScopingO rg = new C OCTMT15000 2UV01Organ ization();
  423   //         ssnScoping Org.setCla ssCode("OR G");
  424   //         ssnScoping Org.setDet erminerCod e("INSTANC E");
  425   //         II ssnScop ingOrgId =  new II();
  426   //         ssnScoping OrgId.setR oot("2.16. 840.1.1138 83.4.1");
  427   //         ssnScoping Org.getId( ).add(ssnS copingOrgI d);
  428   //         ssn.setSco pingOrgani zation(ssn ScopingOrg );
  429   //         person.get AsOtherIDs ().add(ssn );
  430  
  431           JA XBElement< PRPAMT2013 02UV02Pati entPatient Person> pa tientPerso n = of.cre atePRPAMT2 01302UV02P atientPati entPerson( person);
  432           pa tient.setP atientPers on(patient Person);
  433  
  434           //  Set Provi der Organi zation
  435           CO CTMT150003 UV03Organi zation pro viderOrg =  new COCTM T150003UV0 3Organizat ion();
  436           pr oviderOrg. setClassCo de("ORG");
  437           pr oviderOrg. setDetermi nerCode("I NSTANCE");
  438  
  439           II  providerO rgId = new  II();
  440           pr oviderOrgI d.setRoot( "1.2.840.1 14350.1.13 .99998.873 4");
  441           pr oviderOrg. getId().ad d(provider OrgId);
  442  
  443           pr oviderOrg. getName(). add("Good  Health Cli nic");
  444  
  445           CO CTMT150003 UV03Contac tParty con tactParty  = new COCT MT150003UV 03ContactP arty();
  446           co ntactParty .setClassC ode(RoleCl assContact .CON);
  447           TE LExplicit  contactTel ecom = new  TELExplic it();
  448           co ntactTelec om.setValu e("tel:+1- 342-555-83 94");
  449           co ntactParty .getTeleco m().add(co ntactTelec om);
  450           pr oviderOrg. getContact Party().ad d(contactP arty);
  451  
  452           pa tient.setP roviderOrg anization( of.createP RPAMT20130 2UV02Patie ntProvider Organizati on(provide rOrg));
  453  
  454           MF MIMT700701 UV01Custod ian custod ian = new  MFMIMT7007 01UV01Cust odian();
  455           cu stodian.ge tTypeCode( ).add("CST ");
  456  
  457           CO CTMT090003 UV01Assign edEntity a ssignedEnt ity = new  COCTMT0900 03UV01Assi gnedEntity ();
  458           as signedEnti ty.setClas sCode("ASS IGNED");
  459           II  assignedE ntityId =  new II();
  460           as signedEnti tyId.setEx tension("M CID-123456 ");
  461           as signedEnti tyId.setRo ot("1.2.84 0.114350.1 .13.99998. 8734");
  462           as signedEnti ty.getId() .add(assig nedEntityI d);
  463  
  464           CO CTMT090003 UV01Organi zation ass ignedOrg =  new COCTM T090003UV0 1Organizat ion();
  465           as signedOrg. setClassCo de("ORG");
  466           as signedOrg. setDetermi nerCode("I NSTANCE");
  467           as signedOrg. getName(). add("Good  Health Cli nic");
  468  
  469           as signedEnti ty.setAssi gnedOrgani zation(of. createCOCT MT090003UV 01Assigned EntityAssi gnedOrgani zation(ass ignedOrg)) ;
  470  
  471           cu stodian.se tAssignedE ntity(assi gnedEntity );
  472  
  473           su bject1.set Patient(pa tient);
  474           ev ent.setSub ject1(subj ect1);
  475           ev ent.setCus todian(cus todian);
  476           su bject.setR egistratio nEvent(eve nt);
  477           co ntrolActPr ocess.getS ubject().a dd(subject );
  478           re quest1302. setControl ActProcess (controlAc tProcess);
  479  
  480           re turn reque st1302;
  481       }
  482  
  483       privat e ArrayLis t<Map<Stri ng,String> > mapAckTo Result(MCC IIN000002U V01 ack)
  484       {
  485           St ring resul tText = ac k.getAckno wledgement ().get(0). getAcknowl edgementDe tail().get (0).getTex t().getRep resentatio n().value( );
  486  
  487           Ma p<String,S tring> inf o = new Ha shMap<>();
  488           Ar rayList<Ma p<String,S tring>> re sult = new  ArrayList <>();
  489  
  490           in fo.put("re sult", res ultText);
  491  
  492           re sult.add(i nfo);
  493  
  494           re turn resul t;
  495       }
  496       
  497   }