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