66. EPMO Open Source Coordination Office Redaction File Detail Report

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

66.1 Files compared

# Location File Last Modified
1 C:\working_scrub\Unredacted\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters MVI1301DataAdapter.java Fri Feb 10 15:41:44 2017 UTC
2 eHX-CIF.zip\eHX-CIF\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters MVI1301DataAdapter.java Mon Apr 3 14:25:18 2017 UTC

66.2 Comparison summary

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

66.3 Comparison options

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

66.4 Active regular expressions

No regular expressions were active.

66.5 Comparison detail

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