Produced by Araxis Merge on 12/4/2017 8:32:42 AM 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | VCCM.zip\VCCM\CRM_solutions\VCCMResources\WebResources | ftp_WebServiceTesterjsWebServiceTesterjs47F629F2-4B57-E711-9450-0050568D743D | Tue Nov 7 11:34:40 2017 UTC |
| 2 | VCCM.zip\VCCM\CRM_solutions\VCCMResources\WebResources | ftp_WebServiceTesterjsWebServiceTesterjs47F629F2-4B57-E711-9450-0050568D743D | Mon Dec 4 13:08:00 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1448 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | var config Data = nul l, | |
| 2 | co ntext = nu ll, | |
| 3 | re trievedSet tings = nu ll; | |
| 4 | var _ICN = null, | |
| 5 | _n ationalId = null, | |
| 6 | _E DIPI = nul l, | |
| 7 | _f acilityCod eFromMVI = null, | |
| 8 | _f acilityCod eFromMVIDF N = null, | |
| 9 | _f acilityCod eFromESR = null, | |
| 10 | _f acilityCod eFromESRDF N = null, | |
| 11 | _c urrentSett ing = null ; | |
| 12 | var _retri evedVetera ns = []; | |
| 13 | var _stati onList = [ ]; | |
| 14 | var _userF irstName = null, | |
| 15 | _u serLastNam e = null, | |
| 16 | _u serFacilit yCode = nu ll, | |
| 17 | _u serIENAtFa cilityCode = null; | |
| 18 | ||
| 19 | $(document ).ready(fu nction () { | |
| 20 | co ntext = ge tContext() ; | |
| 21 | _I CN = null; | |
| 22 | _n ationalId = null; | |
| 23 | _f acilityCod eFromMVI = null; | |
| 24 | _f acilityCod eFromMVIDF N = null; | |
| 25 | _f acilityCod eFromESR = null; | |
| 26 | _f acilityCod eFromESRDF N = null; | |
| 27 | _c urrentSett ing = null ; | |
| 28 | _r etrievedVe terans = [ ]; | |
| 29 | _s tationList = []; | |
| 30 | _u serFirstNa me = null; | |
| 31 | _u serLastNam e = null; | |
| 32 | _u serFacilit yCode = nu ll; | |
| 33 | _u serIENAtFa cilityCode = null; | |
| 34 | co nfigData = parseData Parameters FromUrl(lo cation.sea rch); | |
| 35 | ||
| 36 | _c urrentSett ing = null ; | |
| 37 | ge tActiveSet tings(); | |
| 38 | ge tUserFromC RM(); | |
| 39 | ||
| 40 | $( "#displayf rame").loa d(function (){ | |
| 41 | /*$( "#loadingG ifDiv").hi de(); | |
| 42 | writ eToConsole ("hide loa dingGifDiv ");*/ | |
| 43 | }) ; | |
| 44 | wi ndow.onscr oll = func tion(){$(" #loadingGi fDiv").css ("top", wi ndow.pageY Offset);} | |
| 45 | $( "#loadingG ifDiv").hi de(); | |
| 46 | }); | |
| 47 | function c heckSubmit MVI(event) { | |
| 48 | if (event.ke yCode === 13) { | |
| 49 | sear chMVI(); | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 | function s earchMVI() { | |
| 54 | va r firstNam e = $("#mv iFirstName ").val(); | |
| 55 | va r lastName = $("#mvi LastName") .val(); | |
| 56 | if (!!firstNa me && !!la stName){ | |
| 57 | var ssn = $("# mviSSN").v al(); | |
| 58 | var dobM = $(" #mviDOBMon th").val() ; | |
| 59 | var dobD = $(" #mviDOBDat e").val(); | |
| 60 | var dobY = $(" #mviDOBYea r").val(); | |
| 61 | var dob = ""; | |
| 62 | if(! !dobM && ! !dobD && ! !dobY){ | |
| 63 | dob = dobM + "/" + dobD + "/" + dobY ; | |
| 64 | } | |
| 65 | if(! !ssn || !! dob){ | |
| 66 | $("#IC N").val("" ); | |
| 67 | $("#na tionalId") .val(""); | |
| 68 | $("#se lectedMVIF acilityCod e").val("" ); | |
| 69 | $("#se lectedMVIF acilityCod eDFN").val (""); | |
| 70 | $("#pr eferredFac ilityCodeF romESR").v al(""); | |
| 71 | $("#pr eferredFac ilityCodeF romESRDFN" ).val(""); | |
| 72 | ||
| 73 | showLo adingMessa ge("queryi ng MVI for veteran") ; | |
| 74 | var qu eryString = "$select =*&$filter =crme_IsAt tended eq true and c rme_Search Type eq 'S earchByFil ter'"; | |
| 75 | queryS tring += " and crme_ LastName e q '" + las tName + "' "; | |
| 76 | queryS tring += " and crme_ FirstName eq '" + fi rstName + "'"; | |
| 77 | queryS tring += ! !ssn ? " a nd crme_SS N eq '" + ssn + "'" : ""; | |
| 78 | queryS tring += ! !dob ? " a nd crme_DO BString eq '" + dob + "'" : "" ; | |
| 79 | var re trievedVet erans = [] ; | |
| 80 | SDK.RE ST.retriev eMultipleR ecords( | |
| 81 | "crme_pe rson", | |
| 82 | queryStr ing, | |
| 83 | function (retrieved Records){ | |
| 84 | if (typeof retrieved Records != "undefine d" && !!re trievedRec ords) retr ievedVeter ans = retr ievedVeter ans.concat (retrieved Records); | |
| 85 | }, | |
| 86 | errorHan dler, | |
| 87 | function (){ | |
| 88 | if(retriev edVeterans .length > 0 && retri evedVetera ns[0].crme _ReturnMes sage != "Y our search in MVI di d not find any recor ds matchin g the sear ch criteri a."){ | |
| 89 | _r etrievedVe terans = [ ]; | |
| 90 | _r etrievedVe terans = _ retrievedV eterans.co ncat(retri evedVetera ns); | |
| 91 | if (retrieve dVeterans[ 0].crme_Ex ceptionOcc ured || (r etrievedVe terans[0]. crme_Retur nMessage ! = null && retrievedV eterans[0] .crme_Retu rnMessage == "An une xpected er ror occure d during t he MVI sea rch. Pleas e try agai n or conta ct your sy stem admin istrator i f the prob lem persis ts.")) { | |
| 92 | aler t("Error s earching M VI: \n" + (!!(retrie vedVeteran s[0].crme_ ExceptionM essage) ? retrievedV eterans[0] .crme_Exce ptionMessa ge : retri evedVetera ns[0].crme _ReturnMes sage)); | |
| 93 | $("# loadingGif Div").hide (); | |
| 94 | retu rn; | |
| 95 | } | |
| 96 | $( "#MVISearc hResultsTa ble").html ("<thead>< th></th><t h>Name</th ><th>DOB</ th><th>Sta tions</th> </thead>") ; | |
| 97 | va r veteranC ountFromMV I = 0; | |
| 98 | fo r (var i = 0; i < re trievedVet erans.leng th; i++) { | |
| 99 | vete ranCountFr omMVI++; | |
| 100 | var thisVet = retrievedV eterans[i] ; | |
| 101 | var vetName = !!thisVet. crme_FullN ame ? this Vet.crme_F ullName : thisVet.cr me_FirstNa me + " " + thisVet.c rme_LastNa me; | |
| 102 | var buttonId = "btn_" + thisVet.cr me_ICN; | |
| 103 | var buttonHTML = "<butto n id='" + buttonId + "' oncli ck='select Veteran(th is);'>Sele ct Vet</bu tton>"; | |
| 104 | var rowId = "r ow_" + thi sVet.crme_ ICN; | |
| 105 | var stationCel lId = "sta tions_" + thisVet.cr me_ICN; | |
| 106 | var entryHTML = "<tr id= ' " + rowI d + "'><td >" + butt onHTML + " </td><td>" + vetName + "</td>< td>" + thi sVet.crme_ DOBString + "</td><t d id='" + stationCel lId + "'/> </tr>"; | |
| 107 | $("# MVISearchR esultsTabl e").append (entryHTML ); | |
| 108 | $("# " + button Id).attr(" patientMvi Identifier ", thisVet .crme_Pati entMviIden tifier); | |
| 109 | } | |
| 110 | $( "#loadingG ifDiv").hi de(); | |
| 111 | if (veteranCo untFromMVI == 1){ | |
| 112 | $("# btn_" + re trievedVet erans[0].c rme_ICN).c lick(); | |
| 113 | } | |
| 114 | } | |
| 115 | else{ | |
| 116 | $( "#loadingG ifDiv").hi de(); | |
| 117 | // 0 results | |
| 118 | al ert("0 vet erans from MVI."); | |
| 119 | } | |
| 120 | } | |
| 121 | ); | |
| 122 | } | |
| 123 | } | |
| 124 | } | |
| 125 | function s electVeter an(pButton ){ | |
| 126 | va r thisICN = pButton. id.replace ("btn_","" ); | |
| 127 | if (!!thisICN ){ | |
| 128 | $("# ICN").val( thisICN); | |
| 129 | icn_ onChange() ; | |
| 130 | ||
| 131 | var MVIID = pB utton.getA ttribute(" patientMvi Identifier "); | |
| 132 | if(! !MVIID){ | |
| 133 | getSta tions(this ICN, MVIID ); | |
| 134 | } | |
| 135 | } | |
| 136 | } | |
| 137 | function g etStations (pICN, pMV IIdentifie r){ | |
| 138 | sh owLoadingM essage("qu erying MVI for stati ons"); | |
| 139 | va r stationC ellId = "s tations_" + pICN; | |
| 140 | $( "#" + stat ionCellId) .html(""); | |
| 141 | va r retrieve dStations = []; | |
| 142 | va r queryStr ing = "$se lect=*&$fi lter=crme_ PatientMvi Identifier eq '" + p MVIIdentif ier + "' a nd crme_Se archType e q 'Selecte dPersonSea rch'"; | |
| 143 | qu eryString += "and cr me_ICN eq '" + pICN + "'"; | |
| 144 | SD K.REST.ret rieveMulti pleRecords ( | |
| 145 | "crm e_person", | |
| 146 | quer yString, | |
| 147 | func tion(retri evedRecord s){ | |
| 148 | if (ty peof retri evedRecord s != "unde fined" && !!retrieve dRecords) retrievedS tations = retrievedS tations.co ncat(retri evedRecord s); | |
| 149 | }, | |
| 150 | erro rHandler, | |
| 151 | func tion () { | |
| 152 | if(ret rievedStat ions.lengt h > 0){ | |
| 153 | _station List = []; | |
| 154 | _station List = _st ationList. concat(ret rievedStat ions); | |
| 155 | //getPre ferredFaci lityFromES R(pICN); | |
| 156 | getPrefe rredFacili tyFromSecu reESR(pICN ); | |
| 157 | var stat ionCount = 0; | |
| 158 | for(var i = 0; i < retrieved Stations.l ength; i++ ){ | |
| 159 | var thisSt ation = re trievedSta tions[i]; | |
| 160 | if(!!thisS tation.crm e_SiteId){ | |
| 161 | va r facility Code = thi sStation.c rme_SiteId ; | |
| 162 | va r identifi erAtThisSt ation = th isStation. crme_Patie ntId; | |
| 163 | if (thisStati on.crme_Si teId == "2 00DOD"){ | |
| 164 | //20 0DOD conta ins EDIPI value | |
| 165 | $("# edipi").va l(identifi erAtThisSt ation); | |
| 166 | edip i_onChange (false); | |
| 167 | } | |
| 168 | if (/*contain sOnlyNumbe rs(facilit yCode)*/tr ue){ | |
| 169 | stat ionCount++ ; | |
| 170 | var stationNam e = thisSt ation.crme _SiteName. split("&") [0]; | |
| 171 | var stationLis tEntry = ( (stationCo unt > 1 ? ",<br/>" : "") + "<a id='stati on_" + fac ilityCode + "' href= '#' onclic k='selectF acility(th is);' titl e='pick'>" + station Name + "</ a>"); | |
| 172 | $("# " + statio nCellId).a ppend(stat ionListEnt ry); | |
| 173 | $("# station_" + facility Code).attr ("DFN", id entifierAt ThisStatio n); | |
| 174 | } | |
| 175 | } | |
| 176 | } | |
| 177 | $("#load ingGifDiv" ).hide(); | |
| 178 | } | |
| 179 | else{ | |
| 180 | $("#load ingGifDiv" ).hide(); | |
| 181 | alert("0 stations from MVI") ; | |
| 182 | } | |
| 183 | } | |
| 184 | ); | |
| 185 | } | |
| 186 | function g etPreferre dFacilityF romESR(pIC N) { | |
| 187 | //depr ecated in favor of g etPreferre dFacilityF romSecureE SR(); | |
| 188 | return ; | |
| 189 | $( "#preferre dFacilityC odeFromESR ").val("lo ading...") ; | |
| 190 | if (!!retriev edSettings && !!retr ievedSetti ngs.ftp_ES RAPIURL){ | |
| 191 | var esrJsonUrl = retriev edSettings .ftp_ESRAP IURL.repla ce("xml", "json"); | |
| 192 | var esrURL = r etrievedSe ttings.ftp _DACURL + esrJsonUrl + "000000 " + _ICN + "000000"; | |
| 193 | //qu ery ESR us ing jquery | |
| 194 | jQue ry.support .cors = tr ue; | |
| 195 | $.aj ax({ | |
| 196 | type: "GET", | |
| 197 | conten tType: "ap plication/ json; char set=utf-8" , | |
| 198 | dataty pe: "json" , | |
| 199 | url: e srURL, | |
| 200 | before Send: func tion (XMLH ttpRequest ) { | |
| 201 | //Specif ying this header ens ures that the result s will be returned a s JSON. | |
| 202 | //XMLHtt pRequest.s etRequestH eader("Acc ept", "app lication/j son"); | |
| 203 | }, | |
| 204 | succes s: functio n (respons e, textSta tus, XmlHt tpRequest) { | |
| 205 | writeToC onsole("in side ESR q uery succe ss callbac k"); | |
| 206 | var pref erredFacil ity = getD eepPropert y("SOAP-EN V:Envelope .SOAP-ENV: Body.getEE SummaryRes ponse.summ ary.demogr aphics.pre ferredFaci lity", res ponse); | |
| 207 | var faci lityCodeFr omESR = pr eferredFac ility.spli t("-")[0]. trim(); | |
| 208 | $("#pref erredFacil ityCodeFro mESR").val (facilityC odeFromESR ); | |
| 209 | preferre dFacilityC odeFromESR _onChange( ); | |
| 210 | ||
| 211 | if(_stat ionList.le ngth > 0){ | |
| 212 | for(var i = 0; i < _ stationLis t.length; i++){ | |
| 213 | if (_stationL ist[i].crm e_SiteId = = facility CodeFromES R){ | |
| 214 | $("# preferredF acilityCod eFromESRDF N").val(_s tationList [i].crme_P atientId); | |
| 215 | pref erredFacil ityCodeFro mESRDFN_on Change(); | |
| 216 | brea k; | |
| 217 | } | |
| 218 | } | |
| 219 | } | |
| 220 | }, | |
| 221 | error: function (XMLHttpRe quest, tex tStatus, e rrorThrown ) { | |
| 222 | writeToC onsole("Er ror queryi ng ESR: " + errorThr own + ".", XMLHttpRe quest.resp onseText, "Error que rying ESR for vetera n data"); | |
| 223 | //setTim eout(query ESR, 2000) ; | |
| 224 | $("#pref erredFacil ityCodeFro mESR").val ("error in query"); | |
| 225 | }, | |
| 226 | async: true,/*ch anged 6/9/ 17*/ | |
| 227 | cache: false | |
| 228 | }); | |
| 229 | } | |
| 230 | } | |
| 231 | function g etPreferre dFacilityF romSecureE SR(pICN) { | |
| 232 | $("#pr eferredFac ilityCodeF romESR").v al("loadin g..."); | |
| 233 | if (!! retrievedS ettings && !!retriev edSettings .ftp_ESREn rollmentEl igibilityS ummaryAPIU RL) { | |
| 234 | va r secureES RURL = ret rievedSett ings.ftp_D ACURL + re trievedSet tings.ftp_ ESREnrollm entEligibi litySummar yAPIURL; | |
| 235 | va r secureES RParams = [{ key: "i dentifier" , type: "c :string", value: JSO N.stringif y({ Nation alId: "000 000" + _IC N + "00000 0" }) }]; | |
| 236 | Cr mSecurityT okenEncryp tion( | |
| 237 | secureES RURL, | |
| 238 | secureES RParams, | |
| 239 | context. getClientU rl(), | |
| 240 | function (pError, pResponse) { | |
| 241 | writ eToConsole ("inside E SR query s uccess cal lback"); | |
| 242 | var preferredF acility = getDeepPro perty("Dat a.Demograp hics.Prefe rredFacili ty", pResp onse); | |
| 243 | if ( preferredF acility != undefined ) { | |
| 244 | var facili tyCodeFrom ESR = pref erredFacil ity.split( "-")[0].tr im(); | |
| 245 | $("#prefer redFacilit yCodeFromE SR").val(f acilityCod eFromESR); | |
| 246 | preferredF acilityCod eFromESR_o nChange(); | |
| 247 | ||
| 248 | if (_stati onList.len gth > 0) { | |
| 249 | for (v ar i = 0; i < _stati onList.len gth; i++) { | |
| 250 | if (_station List[i].cr me_SiteId == facilit yCodeFromE SR) { | |
| 251 | $("#pref erredFacil ityCodeFro mESRDFN"). val(_stati onList[i]. crme_Patie ntId); | |
| 252 | preferre dFacilityC odeFromESR DFN_onChan ge(); | |
| 253 | break; | |
| 254 | } | |
| 255 | } | |
| 256 | } | |
| 257 | } | |
| 258 | } | |
| 259 | ); | |
| 260 | } | |
| 261 | } | |
| 262 | function s electFacil ity(pEleme nt){ | |
| 263 | va r facility Code = pEl ement.id.r eplace("st ation_", " "); | |
| 264 | $( "#selected MVIFacilit yCode").va l(facility Code); | |
| 265 | se lectedMVIF acilityCod e_onChange (); | |
| 266 | ||
| 267 | va r dfn = pE lement.get Attribute( "DFN"); | |
| 268 | $( "#selected MVIFacilit yCodeDFN") .val(dfn); | |
| 269 | se lectedMVIF acilityCod eDFN_onCha nge(); | |
| 270 | } | |
| 271 | ||
| 272 | function g etActiveSe ttings(){ | |
| 273 | va r queryStr ing = "$se lect=*&$fi lter=mcs_n ame eq 'Ac tive Setti ngs'"; | |
| 274 | SD K.REST.ret rieveMulti pleRecords ( | |
| 275 | "mcs _setting", | |
| 276 | quer yString, | |
| 277 | func tion (retr ievedRecor ds) { | |
| 278 | if (ty peof retri evedRecord s != "unde fined" && !!retrieve dRecords & & retrieve dRecords.l ength == 1 ) retrieve dSettings = retrieve dRecords[0 ]; | |
| 279 | }, | |
| 280 | erro rHandler, | |
| 281 | func tion () { | |
| 282 | if (!! retrievedS ettings) { | |
| 283 | $("#retr ievedSetti ngsContain er h2").ht ml("Active Settings, last modi fied on " + retrieve dSettings. ModifiedOn .toLocaleS tring()); | |
| 284 | ||
| 285 | $("#retr ievedSetti ngsTable") .html(""); | |
| 286 | $("#retr ievedSetti ngsTable") .append("< tr><td/><t d>Setting< /td><td>Co nfigured V alue</td>" ); | |
| 287 | Object.k eys(retrie vedSetting s).sort(). forEach(fu nction(pro p,i){ | |
| 288 | if((prop.i ndexOf("ft p_") > -1 || prop.in dexOf("vre _") > -1 | | prop.ind exOf("bah_ ") > -1) & & prop.ind exOf("mcs_ setting_") == -1 && prop.index Of("_mcs_s etting") = = -1){ | |
| 289 | co nsole.log( prop + " ( " + typeof retrieved Settings[p rop] + "): " + retri evedSettin gs[prop]); | |
| 290 | va r entryHTM L = "<tr>" | |
| 291 | + "<td><butt on id='btn _" + prop + "' title ='Test' on click='set upQueryBui lder(this, true)'>Tes t</button> </td>" | |
| 292 | + "<td>" + p rop + " [" + typeof retrievedS ettings[pr op] + "]</ td>" | |
| 293 | + "<td class ='autoWidt h'><input class='aut oWidth' ty pe='text' id='" + pr op + "_set ting' valu e='" + ret rievedSett ings[prop] + "'></td >" | |
| 294 | + "</tr>"; | |
| 295 | $( "#retrieve dSettingsT able").app end(entryH TML); | |
| 296 | } | |
| 297 | }); | |
| 298 | } //en d if !!ret rievedSett ings | |
| 299 | } | |
| 300 | ); | |
| 301 | } | |
| 302 | function s etupImpers onation(){ | |
| 303 | // retrieveVi staUsers(" Lori", "Ni cholls", " 613", fals e); | |
| 304 | $( "#userFirs tName").va l("Lori"); | |
| 305 | us erFirstNam e_onChange (false); | |
| 306 | $( "#userLast Name").val ("Nicholls "); | |
| 307 | us erLastName _onChange( false); | |
| 308 | $( "#userFaci lityCode") .val("613" ); | |
| 309 | us erFacility Code_onCha nge(true); | |
| 310 | re trieveVist aUsers(); | |
| 311 | } | |
| 312 | function g etUserFrom CRM(){ | |
| 313 | SD K.REST.ret rieveRecor d( | |
| 314 | cont ext.getUse rId(), | |
| 315 | "Sys temUser", | |
| 316 | "Fir stName,Las tName,ftp_ ftp_facili ty_systemu ser/ftp_fa cilitycode ", | |
| 317 | "ftp _ftp_facil ity_system user", | |
| 318 | func tion(retri evedUser){ | |
| 319 | if(ret rievedUser .hasOwnPro perty("ftp _ftp_facil ity_system user") && !!retrieve dUser.ftp_ ftp_facili ty_systemu ser && ret rievedUser .ftp_ftp_f acility_sy stemuser.h asOwnPrope rty("ftp_f acilitycod e") && ret rievedUser .hasOwnPro perty("Fir stName") & & !!retrie vedUser.Fi rstName && retrieved User.hasOw nProperty( "LastName" ) && !!ret rievedUser .LastName) { | |
| 320 | $("#user FirstName" ).val(retr ievedUser. FirstName) ; | |
| 321 | userFirs tName_onCh ange(false ); | |
| 322 | $("#user LastName") .val(retri evedUser.L astName); | |
| 323 | userLast Name_onCha nge(false) ; | |
| 324 | $("#user FacilityCo de").val(r etrievedUs er.ftp_ftp _facility_ systemuser .ftp_facil itycode); | |
| 325 | userFaci lityCode_o nChange(tr ue); | |
| 326 | ||
| 327 | //retrie veVistaUse rs(retriev edUser.Fir stName, re trievedUse r.LastName , retrieve dUser.ftp_ ftp_facili ty_systemu ser.ftp_fa cilitycode , false); | |
| 328 | } | |
| 329 | else{ | |
| 330 | //showEr rorMessage ("Your CRM user reco rd is miss ing some i nformation .", "Make sure it ha s your fir st name, l ast name, and a desi gnated Sit e. The ide ntified Si te should in turn ha ve a value for Facil ity Code", "Configur ation Erro r"); | |
| 331 | } | |
| 332 | }, | |
| 333 | erro rHandler | |
| 334 | ); | |
| 335 | } | |
| 336 | ||
| 337 | function r etrieveVis taUsers() { | |
| 338 | $( "#vistaUse rsListForm Container" ).hide(); | |
| 339 | va r dacURL = $("#ftp_D ACURL_sett ing").val( ); | |
| 340 | va r vistaUrl = $("#ftp _VistaUser sAPIURL_se tting").va l(); | |
| 341 | if (!!dacURL && !!vista Url && !!_ userFirstN ame && !!_ userLastNa me && !!_u serFacilit yCode){ | |
| 342 | var fullUrl = dacURL + v istaUrl + _userFirst Name + "/" + _userLa stName + " /" + _user FacilityCo de; | |
| 343 | show LoadingMes sage("Look ing up you r IEN in V istA..."); | |
| 344 | var filter = $ ("#ftp_Fil ter_settin g").val(). replace("t rue", "fal se"); | |
| 345 | try { | |
| 346 | $.ajax ({ | |
| 347 | type: "G ET", | |
| 348 | url: ful lUrl, | |
| 349 | ||
| 350 | //https:// se r
|
|
| 351 | contentT ype: "appl ication/js on; charse t=utf-8", | |
| 352 | dataType : "json", | |
| 353 | success: function (response) { | |
| 354 | if(respons e.hasOwnPr operty("Da ta") && !! response.D ata && res ponse.Data .length > 0){ | |
| 355 | va r retrieve dVistaUser s = respon se.Data; | |
| 356 | if (retrieve dVistaUser s.length > 1) { | |
| 357 | //sh ow selecti on of Vist A users, t hen post t o HDR usin g IEN of s election | |
| 358 | rend erVistAMul tipleUsers AsButtons( retrievedV istaUsers) ; | |
| 359 | } | |
| 360 | el se { | |
| 361 | //po st to HDR using the first Vist A record | |
| 362 | btn_ vistaSelec t_click($( "<div user IEN=\"" + retrievedV istaUsers[ 0].Ien + " \"></div>" )); | |
| 363 | } | |
| 364 | } | |
| 365 | else{ | |
| 366 | va r debugMes sage = "Se arch crite ria: \nFir st Name: " + _userFi rstName + "\nLast Na me: " + _u serLastNam e + "\nFac ility Code : " + _use rFacilityC ode; | |
| 367 | if (response. hasOwnProp erty("Debu gInfo")) d ebugMessag e += "<br/ >DebugInfo :<br/>" + response.D ebugInfo; | |
| 368 | al ert("Could not find your corre sponding u ser in Vis tA. VistA may be dow n at the m oment...." + debugMe ssage); | |
| 369 | $( "#loadingG ifDiv").hi de() | |
| 370 | } | |
| 371 | }, | |
| 372 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 373 | alert("Cou ld not fin d your cor responding user in V istA... " + errorThr own); | |
| 374 | $("#loadin gGifDiv"). hide() | |
| 375 | }, | |
| 376 | async: t rue, | |
| 377 | cache: f alse | |
| 378 | }); | |
| 379 | } | |
| 380 | catc h (err) { | |
| 381 | alert( "Error ret rieving Vi stA user(s ): " + er r.message) ; | |
| 382 | $("#lo adingGifDi v").hide() | |
| 383 | } | |
| 384 | } | |
| 385 | } | |
| 386 | function r enderVistA MultipleUs ersAsButto ns(pVistaU sers){ | |
| 387 | $( "#vistaUse rsListForm Container" ).html("<b r/><p>Vist A returned multiple users; sel ect the co rrect one that repre sents YOU. </p>"); | |
| 388 | if (!!pVistaU sers){ | |
| 389 | for( var u = 0; u < pVist aUsers.len gth; u++){ | |
| 390 | var th isVistaUse r = pVista Users[u]; | |
| 391 | var ne wButton = $("<button tabindex= \"" + u +" \" class=\ "ms-crm-Re freshDialo g-Button\" style=\"m argin-left : 8px;\" o nclick=\"b tn_vistaSe lect_click (this)\" t ype=\"butt on\">SELEC T</button> "); | |
| 392 | var ne wLabelHTML = $("<lab el id=\"vi staUserLab el" + u + "\">" + th isVistaUse r.DisplayN ame +": " + thisVist aUser.Titl e + "</lab el><br/>") ; | |
| 393 | $(newB utton).att r("userIEN ", thisVis taUser.Ien ); | |
| 394 | $("#vi staUsersLi stFormCont ainer").ap pend(newBu tton); | |
| 395 | $("#vi staUsersLi stFormCont ainer").ap pend(newLa belHTML); | |
| 396 | } | |
| 397 | $("# vistaUsers ListFormCo ntainer"). show(); | |
| 398 | $("# loadingGif Div").hide () | |
| 399 | } | |
| 400 | } | |
| 401 | function b tn_vistaSe lect_click (pObject){ | |
| 402 | // this funct ion is ent ered by th e user sel ecting a V istA user record, or automatic ally when VistA only returns 1 user reco rd | |
| 403 | wr iteToConso le("inside btn_vista Select_cli ck()"); | |
| 404 | $( "#userIEN" ).val($(pO bject).att r("userIEN ")); | |
| 405 | us erIEN_onCh ange(); | |
| 406 | $( "#loadingG ifDiv").hi de() | |
| 407 | } | |
| 408 | ||
| 409 | function s etupQueryB uilder(pNe wSetting, pFocus){ | |
| 410 | $( "#facility SelectionD iv").hide( ); | |
| 411 | $( "#userFaci lityInfo") .hide(); | |
| 412 | _c urrentSett ing = (!!p NewSetting && pNewSe tting.id ! = "") ? pN ewSetting. id.substr( 4) : _curr entSetting ; | |
| 413 | if (!!!_curre ntSetting) { | |
| 414 | $("# urlToTest" ).val("sel ect a sett ing from t he list ab ove"); | |
| 415 | retu rn; | |
| 416 | } | |
| 417 | $( "#queryBui lderCurren tSettingLa bel").html (_currentS etting); | |
| 418 | va r settingV alue = $(" #" + _curr entSetting + "_setti ng").val() ; | |
| 419 | ||
| 420 | va r useMVISe lectedFaci lity = $(" input[name =facilityS election]: checked"). val() == " mvi" ? tru e : false; | |
| 421 | va r facility Code = use MVISelecte dFacility ? _facilit yCodeFromM VI : _faci lityCodeFr omESR; | |
| 422 | fa cilityCode = !!facil ityCode ? facilityCo de : "[[FA CILITYCODE ]]"; | |
| 423 | va r dfn = us eMVISelect edFacility ? _facili tyCodeFrom MVIDFN : _ facilityCo deFromESRD FN; | |
| 424 | df n = !!dfn ? dfn : "[ [DFN]]"; | |
| 425 | ||
| 426 | va r fullUrl = ""; | |
| 427 | va r dacURL = $("#ftp_D ACURL_sett ing").val( ); | |
| 428 | va r filter = $("#ftp_F ilter_sett ing").val( ); | |
| 429 | ||
| 430 | sw itch(_curr entSetting ){ | |
| 431 | case "ftp_ESRA PIURL": | |
| 432 | fullUr l = dacURL + setting Value + "0 00000" + _ ICN + "000 000"; | |
| 433 | break; | |
| 434 | case "ftp_Pati entSummary APIURL": | |
| 435 | $("#fa cilitySele ctionDiv") .show(); | |
| 436 | fullUr l = dacURL + setting Value + fa cilityCode + "/" + _ ICN + "?id Type=ICN"; | |
| 437 | break; | |
| 438 | case "ftp_Flag sAPIURL": | |
| 439 | fullUr l = dacURL + setting Value + _n ationalId; | |
| 440 | break; | |
| 441 | case "ftp_Sens itivePatie ntAPIURL": | |
| 442 | $("#fa cilitySele ctionDiv") .show(); | |
| 443 | $("#us erFacility Info").sho w(); | |
| 444 | $("#bt n_getVista Users").sh ow(); | |
| 445 | $("#vi staUsersLi stFormCont ainer").sh ow(); | |
| 446 | $("#us erIENDiv") .show(); | |
| 447 | var ie n = _userI ENAtFacili tyCode; | |
| 448 | fullUr l = dacURL + setting Value + ie n + "/USVH A/" + dfn + "/" + fa cilityCode ; | |
| 449 | break; | |
| 450 | case "ftp_Vist aUsersAPIU RL": | |
| 451 | $("#us erFacility Info").sho w(); | |
| 452 | $("#bt n_getVista Users").hi de(); | |
| 453 | $("#vi staUsersLi stFormCont ainer").hi de(); | |
| 454 | $("#us erIENDiv") .hide(); | |
| 455 | fullUr l = dacURL + setting Value + _u serFirstNa me + "/" + _userLast Name + "/" + _userFa cilityCode ; | |
| 456 | break; | |
| 457 | defa ult: | |
| 458 | //Note s, Orders, Appointme nts, Medic ations, Po stings, Al lergies, L abs, Consu lts, Non-V A Meds, Vi tals, Radi ology, Dis charges | |
| 459 | fullUr l = dacURL + setting Value + _n ationalId + filter; | |
| 460 | break; | |
| 461 | } | |
| 462 | // SC Disabil ities | |
| 463 | // fullUrl = context.ge tClientUrl () + "/Web Resources/ ftp_/ServC onnDisabil itiesGrid/ ServConnDi sabilities Grid.html? data=" + i cn; | |
| 464 | ||
| 465 | $( "#urlToTes t").val(fu llUrl); | |
| 466 | if (pFocus) { $("#urlTo Test").foc us(); } | |
| 467 | } | |
| 468 | ||
| 469 | function c heckSubmit Test(event ){ | |
| 470 | if (event.ke yCode === 13) { | |
| 471 | begi nTest(); | |
| 472 | } | |
| 473 | } | |
| 474 | function b eginTest() { | |
| 475 | sh owLoadingM essage("Lo ading test result... "); | |
| 476 | se tTestResul tContainer HTML(); | |
| 477 | } | |
| 478 | function s etTestResu ltContaine rHTML(){ | |
| 479 | $( "#displayf rame").loa d(function (){return; }); | |
| 480 | re setTestRes ultContain er(); | |
| 481 | va r fullUrl = $("#urlT oTest").va l(); | |
| 482 | ||
| 483 | if (fullUrl.t oLowerCase ().indexOf ("api") > -1){ | |
| 484 | //fo r APIs, qu ery the AP I and then format re sults in a n HTML pag e in the i Frame | |
| 485 | var dType = fu llUrl.inde xOf("json" ) > -1 ? " json" : "t ext"; | |
| 486 | var cType = fu llUrl.inde xOf("json" ) > -1 ? " applicatio n/json; ch arset=utf- 8" : "char set=utf-8" ; | |
| 487 | $.aj ax({ | |
| 488 | type: "GET", | |
| 489 | conten tType: cTy pe, | |
| 490 | dataty pe: dType, | |
| 491 | url: f ullUrl, | |
| 492 | before Send: func tion (XMLH ttpRequest ) { | |
| 493 | //Specif ying this header ens ures that the result s will be returned a s JSON. | |
| 494 | if(dType == "json" ) XMLHttpR equest.set RequestHea der("Accep t", "appli cation/jso n"); | |
| 495 | }, | |
| 496 | succes s: functio n (respons e, textSta tus, XmlHt tpRequest) { | |
| 497 | showLoad ingMessage ("Loading test resul t..."); | |
| 498 | writeToC onsole("in side setTe stResultCo ntainerHTM L() API qu ery succes s callback "); | |
| 499 | if(!!res ponse){ | |
| 500 | if(dType = = "json"){ | |
| 501 | va r newFrame Content = "<pre>" + JSON.strin gify(respo nse,undefi ned,2) + " </pre>"; | |
| 502 | se tIFrame(ne wFrameCont ent, true) ; | |
| 503 | } | |
| 504 | else{/*xml */ | |
| 505 | va r newFrame Content = "<textarea cols='200 ' rows='20 0'>" + new XMLSerial izer().ser ializeToSt ring(respo nse) + "</ textarea>" ; | |
| 506 | se tIFrame(ne wFrameCont ent, true) ; | |
| 507 | } | |
| 508 | } | |
| 509 | }, | |
| 510 | error: function (XMLHttpRe quest, tex tStatus, e rrorThrown ) { | |
| 511 | alert("e rror query ing API. u se develop er console ."); | |
| 512 | var newF rameConten t = "<p>er ror queryi ng API. us e develope r console. </p><pre>" + JSON.st ringify(XM LHttpReque st.respons eJSON,unde fined,2) + "</pre>"; | |
| 513 | setIFram e(newFrame Content, t rue); | |
| 514 | $("#load ingGifDiv" ).hide(); | |
| 515 | }, | |
| 516 | async: true,/*ch anged 6/9/ 17*/ | |
| 517 | cache: false | |
| 518 | }); | |
| 519 | } | |
| 520 | el se{ | |
| 521 | $("# displayfra me").load( function() { | |
| 522 | $("#lo adingGifDi v").hide() ; | |
| 523 | writeT oConsole(" hide loadi ngGifDiv") ; | |
| 524 | $("#di splayframe ").load(fu nction(){r eturn;}); | |
| 525 | }); | |
| 526 | //fo r web part s, just qu ery the we b part url | |
| 527 | setI Frame(full Url, false ); | |
| 528 | } | |
| 529 | ||
| 530 | } | |
| 531 | function s etIFrame(p Source, pI sText){ | |
| 532 | if (!!pSource ){ | |
| 533 | if(p IsText){ | |
| 534 | $('#di splayframe ')[0].cont entWindow. document.w rite(pSour ce); | |
| 535 | writeT oConsole(" set displa yFrame HTM L content directly") ; | |
| 536 | $("#lo adingGifDi v").hide() ; | |
| 537 | } | |
| 538 | else { | |
| 539 | $('#di splayframe ').attr({ | |
| 540 | src: pSo urce, | |
| 541 | title: _ currentSet ting | |
| 542 | }); | |
| 543 | writeT oConsole(" set displa yFrame src attribute "); | |
| 544 | } | |
| 545 | } | |
| 546 | } | |
| 547 | ||
| 548 | function r esetTestRe sultContai ner(){ | |
| 549 | $( '#displayf rame').att r({ | |
| 550 | src: "", | |
| 551 | titl e: ""/*set tingName*/ | |
| 552 | }) ; | |
| 553 | ||
| 554 | } | |
| 555 | function h ideLoading Gif(){ | |
| 556 | wr iteToConso le("begin hideLoadin gGif()"); | |
| 557 | $( "#loadingG ifDiv").hi de(); | |
| 558 | } | |
| 559 | ||
| 560 | function i cn_onChang e(){ | |
| 561 | _I CN = $("#I CN").val() ; | |
| 562 | $( "#national Id").val(_ ICN.substr ing(0,10)) ; | |
| 563 | na tionalId_o nChange(fa lse); | |
| 564 | se tupQueryBu ilder(null , false); | |
| 565 | } | |
| 566 | function n ationalId_ onChange(p FireSetupQ ueryBuilde r){ | |
| 567 | _n ationalId = $("#nati onalId").v al(); | |
| 568 | if (pFireSetu pQueryBuil der == nul l || pFire SetupQuery Builder == true){ | |
| 569 | setu pQueryBuil der(null, false); | |
| 570 | } | |
| 571 | } | |
| 572 | function e dipi_onCha nge(pFireS etupQueryB uilder){ | |
| 573 | _E DIPI = $(" #edipi").v al(); | |
| 574 | if (pFireSetu pQueryBuil der == nul l || pFire SetupQuery Builder == true){ | |
| 575 | setu pQueryBuil der(null, false); | |
| 576 | } | |
| 577 | } | |
| 578 | function s electedMVI FacilityCo de_onChang e(){ | |
| 579 | _f acilityCod eFromMVI = $("#selec tedMVIFaci lityCode") .val(); | |
| 580 | $( "label[for =useMVISel ectedFacil ity]").tex t("Use vet eran facil ity from M VI (" + _f acilityCod eFromMVI + ")"); | |
| 581 | se tupQueryBu ilder(null , false); | |
| 582 | } | |
| 583 | function s electedMVI FacilityCo deDFN_onCh ange(){ | |
| 584 | _f acilityCod eFromMVIDF N = $("#se lectedMVIF acilityCod eDFN").val (); | |
| 585 | se tupQueryBu ilder(null , false); | |
| 586 | } | |
| 587 | function p referredFa cilityCode FromESR_on Change(){ | |
| 588 | _f acilityCod eFromESR = $("#prefe rredFacili tyCodeFrom ESR").val( ); | |
| 589 | $( "label[for =useESRPre ferredFaci lity]").te xt("Use ve teran pref erred faci lity from ESR (" + _ facilityCo deFromESR + ")"); | |
| 590 | se tupQueryBu ilder(null , false); | |
| 591 | } | |
| 592 | function p referredFa cilityCode FromESRDFN _onChange( ){ | |
| 593 | _f acilityCod eFromESRDF N = $("#pr eferredFac ilityCodeF romESRDFN" ).val(); | |
| 594 | se tupQueryBu ilder(null , false); | |
| 595 | } | |
| 596 | function u serFirstNa me_onChang e(pFireSet upQueryBui lder){ | |
| 597 | _u serFirstNa me = $("#u serFirstNa me").val() ; | |
| 598 | if (pFireSetu pQueryBuil der == nul l || pFire SetupQuery Builder == true){ | |
| 599 | setu pQueryBuil der(null, false); | |
| 600 | } | |
| 601 | } | |
| 602 | function u serLastNam e_onChange (pFireSetu pQueryBuil der){ | |
| 603 | _u serLastNam e = $("#us erLastName ").val(); | |
| 604 | if (pFireSetu pQueryBuil der == nul l || pFire SetupQuery Builder == true){ | |
| 605 | setu pQueryBuil der(null, false); | |
| 606 | } | |
| 607 | } | |
| 608 | function u serFacilit yCode_onCh ange(pFire SetupQuery Builder){ | |
| 609 | _u serFacilit yCode = $( "#userFaci lityCode") .val(); | |
| 610 | if (pFireSetu pQueryBuil der == nul l || pFire SetupQuery Builder == true){ | |
| 611 | setu pQueryBuil der(null, false); | |
| 612 | } | |
| 613 | } | |
| 614 | function u serIEN_onC hange(){ | |
| 615 | _u serIENAtFa cilityCode = $("#use rIEN").val (); | |
| 616 | se tupQueryBu ilder(null , false); | |
| 617 | } | |
| 618 | ||
| 619 | ||
| 620 | function g etContext( ) { | |
| 621 | re turn (type of GetGlob alContext != "undefi ned") ? Ge tGlobalCon text() : n ull; | |
| 622 | } | |
| 623 | function s howLoading Message(pM essage){ | |
| 624 | $( "#progress Text").htm l(pMessage ); | |
| 625 | $( "#loadingG ifDiv").sh ow(); | |
| 626 | } | |
| 627 | ||
| 628 | function s howDiv(pDi vToShow){ | |
| 629 | va r knownDiv s = [ | |
| 630 | "#lo adingGifDi v", | |
| 631 | "#MV ISearchCon tainer", | |
| 632 | "#re trievedSet tingsConta iner", | |
| 633 | "#te stQueryBui lderContai ner", | |
| 634 | "#te stResultCo ntainer" | |
| 635 | ]; | |
| 636 | fo r(var d = 0; d < kno wnDivs.len gth; d++){ | |
| 637 | if(k nownDivs[d ] == pDivT oShow) { | |
| 638 | $(know nDivs[d]). show(); | |
| 639 | } | |
| 640 | else { | |
| 641 | $(know nDivs[d]). hide(); | |
| 642 | } | |
| 643 | } | |
| 644 | } | |
| 645 | ||
| 646 | function p arseDataPa rametersFr omUrl(pQue ryString) { | |
| 647 | // example qu ery string (unencode d): contac tid={32CA1 B55-DC81-E 611-9445-0 050568D743 D}&fullnam e=TIFINKLE , ANDREW&s ensitivity =true&IsUS D=true | |
| 648 | va r fullPara meterArray = pQueryS tring.subs tr(1).spli t("&"); | |
| 649 | ||
| 650 | // clean up t he URL que ry string and split each membe r into a k ey/value p air | |
| 651 | fo r (var i i n fullPara meterArray ) { | |
| 652 | full ParameterA rray[i] = fullParame terArray[i ].replace( /\+/g, " " ).split("= "); | |
| 653 | } | |
| 654 | ||
| 655 | va r customDa taString = ""; | |
| 656 | fo r (var i i n fullPara meterArray ) { | |
| 657 | if ( fullParame terArray[i ][0].toLow erCase() = = "data") { | |
| 658 | custom DataString = fullPar ameterArra y[i][1]; | |
| 659 | break; | |
| 660 | } | |
| 661 | } | |
| 662 | ||
| 663 | va r customDa taArray = decodeURIC omponent(c ustomDataS tring).spl it("&"); | |
| 664 | fo r (var i i n customDa taArray) { | |
| 665 | cust omDataArra y[i] = cus tomDataArr ay[i].repl ace(/\+/g, " ").spli t("="); | |
| 666 | } | |
| 667 | ||
| 668 | va r configOb ject = {}; | |
| 669 | fo r (var i i n customDa taArray) { | |
| 670 | conf igObject[c ustomDataA rray[i][0] ] = custom DataArray[ i][1]; | |
| 671 | } | |
| 672 | ||
| 673 | // optionally , put code here to s how body o nce we hav e the conf ig object, if it's t aking too long | |
| 674 | re turn confi gObject; | |
| 675 | } | |
| 676 | function b uildQueryF ilter(fiel d, value, and) { | |
| 677 | return !!field ? ((and ? " and " : " ") + field + " eq " + (value = = '' ? "nu ll" : "'" + value + "'")) : "" ; | |
| 678 | } | |
| 679 | function e rrorHandle r(error) { | |
| 680 | wr iteToConso le(error.m essage); | |
| 681 | //show ErrorMessa ge("Error" , error.me ssage, "Er ror"); | |
| 682 | } | |
| 683 | function w riteToCons ole(messag e) { | |
| 684 | if (ty peof conso le != 'und efined') c onsole.log (message); | |
| 685 | } | |
| 686 | function x mlParser(t xt){ | |
| 687 | // cross brow ser respon seXml to r eturn a XM L object | |
| 688 | va r xmlDoc = null; | |
| 689 | tr y{ | |
| 690 | xmlD oc = new A ctiveXObje ct("Micros oft.XMLDOM "); | |
| 691 | xmlD oc.async = false; | |
| 692 | xmlD oc.loadXML (txt); | |
| 693 | } | |
| 694 | ca tch(e){ | |
| 695 | if(w indow.DOMP arser){ | |
| 696 | var pa rser = new DOMParser (); | |
| 697 | xmlDoc = parser. parseFromS tring(txt, "text/xml "); | |
| 698 | } | |
| 699 | else { | |
| 700 | showEr rorMessage ("Cannot c onvert str ing to a c ross-brows er XML obj ect.",""," Error pars ing XML"); | |
| 701 | } | |
| 702 | } | |
| 703 | re turn xmlDo c; | |
| 704 | } | |
| 705 | function g etDeepProp erty(pPath , pObject) { | |
| 706 | if (!!pPath){ | |
| 707 | var pathAsArra y = pPath. split(".") ; | |
| 708 | var returnObj = !!pObjec t ? pObjec t : window [pathAsArr ay.shift() ]; | |
| 709 | if(t ypeof retu rnObj != " undefined" ){ | |
| 710 | while( !!returnOb j && pathA sArray.len gth > 0){ | |
| 711 | returnOb j = return Obj[pathAs Array.shif t()]; | |
| 712 | } | |
| 713 | return returnObj ; | |
| 714 | } | |
| 715 | else { | |
| 716 | return undefined ; | |
| 717 | } | |
| 718 | } | |
| 719 | el se{ | |
| 720 | retu rn undefin ed; | |
| 721 | } | |
| 722 | } | |
| 723 | function c ontainsOnl yNumbers(p String){ | |
| 724 | re turn !/\D/ .test(pStr ing); | |
| 725 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.