Produced by Araxis Merge on 5/9/2017 12:03:44 PM Eastern 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | OSCIF_HEC_v1.4_Sprint23_build4_Apr_2017.zip\CRM_solutions\VHACRMWebResources\VHACRMWebResources.zip\WebResources | vhacrm_VIAvhacrm_via_libraryjsE3108D6D-B918-E711-812A-1289A8FDD3DA | Sat Apr 22 02:41:48 2017 UTC |
| 2 | OSCIF_HEC_v1.4_Sprint23_build4_Apr_2017.zip\CRM_solutions\VHACRMWebResources\VHACRMWebResources.zip\WebResources | vhacrm_VIAvhacrm_via_libraryjsE3108D6D-B918-E711-812A-1289A8FDD3DA | Thu May 4 22:07:20 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1548 |
| 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 | if (typeof (VIAServi ces) === " undefined" ) { | |
| 2 | VIASer vices = { __namespac e: true }; | |
| 3 | } | |
| 4 | ||
| 5 | //Static V ariables | |
| 6 | var consum ingApp; | |
| 7 | var callBa ckFunction ; | |
| 8 | ||
| 9 | var xml_en code_map = { | |
| 10 | '&': ' &', | |
| 11 | '"': ' "', | |
| 12 | '<': ' <', | |
| 13 | '>': ' >', | |
| 14 | '/': ' \' | |
| 15 | }; | |
| 16 | ||
| 17 | var xml_de code_map = { | |
| 18 | '& ': '&', | |
| 19 | '" ;': '"', | |
| 20 | '<' : '<', | |
| 21 | '>' : '>', | |
| 22 | '\ ': '/' | |
| 23 | }; | |
| 24 | ||
| 25 | function e ncodeXml(s tring) { | |
| 26 | return string.re place(/([\ &"<>])/g, function ( str, item) { | |
| 27 | re turn xml_e ncode_map[ item]; | |
| 28 | }); | |
| 29 | }; | |
| 30 | ||
| 31 | function d ecodeXml(s tring) { | |
| 32 | return string.re place(/(&q uot;|<| >|& )/g, | |
| 33 | func tion (str, item) { | |
| 34 | return xml _decode_ma p[item]; | |
| 35 | }); | |
| 36 | } | |
| 37 | ||
| 38 | function v iaLineBrea ks(string) { | |
| 39 | return string.re place(/[\n \r]/g, '|' ); | |
| 40 | } | |
| 41 | ||
| 42 | function c reateNode( tag, value ) { | |
| 43 | return "<" + tag + ">" + v alue + "</ " + tag + ">" | |
| 44 | } | |
| 45 | ||
| 46 | function v ia_getCook ie(cname) { | |
| 47 | try { | |
| 48 | va r name = c name + "=" ; | |
| 49 | va r result = document. cookie.mat ch(new Reg Exp(cname + '=([^;]+ )')); | |
| 50 | re sult && (r esult = JS ON.parse(r esult[1])) ; | |
| 51 | re turn resul t; | |
| 52 | } | |
| 53 | catch (err) { | |
| 54 | al ert('via_g etCookie: ' + err.me ssage); | |
| 55 | } | |
| 56 | } | |
| 57 | ||
| 58 | function v ia_setCook ie(cname, cvalue, ex minutes) { | |
| 59 | var vi a_context = GetGloba lContext() ; | |
| 60 | var vi a_orgName = via_cont ext.getOrg UniqueName (); | |
| 61 | ||
| 62 | try { | |
| 63 | va r d = new Date(); | |
| 64 | d. setMinutes (d.getMinu tes() + (e xminutes)) ; | |
| 65 | va r expires = "expires =" + d.toU TCString() ; | |
| 66 | do cument.coo kie = [cna me, "=", J SON.string ify(cvalue ), "; ", e xpires, "; path=/", via_orgNam e, "/;"].j oin(""); | |
| 67 | } | |
| 68 | catch (err) { | |
| 69 | al ert('via_s etCookie: ' + err.me ssage); | |
| 70 | } | |
| 71 | } | |
| 72 | ||
| 73 | function v ia_checkUs erLogIn() { | |
| 74 | //Chec k if VIA L ogin cooki e exist (n ot expired ) | |
| 75 | var lo ginCookie = via_getC ookie("via sessionlin k"); | |
| 76 | ||
| 77 | //Hide Vista Log in section and exit if cookie exist | |
| 78 | if (lo ginCookie != null) { | |
| 79 | re turn true; | |
| 80 | } | |
| 81 | else { | |
| 82 | re turn false ; | |
| 83 | } | |
| 84 | } | |
| 85 | ||
| 86 | function v ia_getLoca tions(call back) { | |
| 87 | var ap iName = "g etLocation s"; | |
| 88 | var ta rget = "*" ; // Get all locati ons | |
| 89 | var us erTO = via _getCookie ("viasessi onlink"); | |
| 90 | try { | |
| 91 | if (target ! == null && userTO != = null) { | |
| 92 | VIAServi ces.getLoc ations(use rTO, targe t, callbac k); | |
| 93 | } else { | |
| 94 | alert("A ll fields must be fi lled out, please try again."); | |
| 95 | } | |
| 96 | } catc h (err) { | |
| 97 | al ert(apiNam e.value + ': ' + err .message); | |
| 98 | } | |
| 99 | } | |
| 100 | ||
| 101 | function v ia_getVete ranId(vete ranId, cal lback) { | |
| 102 | // Get selected Veteran's SSN | |
| 103 | SDK.RE ST.retriev eMultipleR ecords("Co ntact", | |
| 104 | "$ select=bah _ssn_text& $filter=Co ntactId eq guid'" + veteranId[ 0].id.toSt ring() + " '", | |
| 105 | fu nction (da ta) { | |
| 106 | if (data .length > 0) { | |
| 107 | var target = d ata[0].bah _ssn_text; | |
| 108 | var userTO = v ia_getCook ie("viases sionlink") ; | |
| 109 | if ( target && userTO) { | |
| 110 | VIAService s.match(us erTO, targ et, callba ck); | |
| 111 | } | |
| 112 | } | |
| 113 | }, | |
| 114 | fu nction (er ror) { | |
| 115 | alert("E rror loadi ng Veteran identifie rs" + ":\n " + error) ; | |
| 116 | }, | |
| 117 | fu nction () { | |
| 118 | //do not hing on co mpletion | |
| 119 | } | |
| 120 | ); | |
| 121 | } | |
| 122 | ||
| 123 | //Key Valu e Pairs | |
| 124 | function g etKeyValue Pair(kvpna me, callba ck) { | |
| 125 | SDK.RE ST.retriev eMultipleR ecords("ba h_keyvalue pair", | |
| 126 | "$ select=*&$ filter=bah _name_text eq '" + k vpname + " '", | |
| 127 | fu nction (da ta) { | |
| 128 | if (data .length > 0) { | |
| 129 | swit ch (data[0 ].bah_valu etype_code .Value) { | |
| 130 | case 81005 0003: | |
| 131 | callba ck(data[0] .bah_datev alue_date) ; | |
| 132 | break; | |
| 133 | case 81005 0001: | |
| 134 | callba ck(data[0] .bah_decim alvalue_nu m); | |
| 135 | break; | |
| 136 | case 81005 0002: | |
| 137 | callba ck(data[0] .bah_integ ervalue_nu m); | |
| 138 | break; | |
| 139 | case 81005 0000: | |
| 140 | callba ck(data[0] .bah_strin gvalue_tex t); | |
| 141 | break; | |
| 142 | } | |
| 143 | } else { | |
| 144 | aler t("Could n ot find va lue for " + kvpname) ; | |
| 145 | } | |
| 146 | }, | |
| 147 | fu nction (er ror) { | |
| 148 | alert("E rror loadi ng value f or " + kvp name + ":\ n" + error ); | |
| 149 | }, | |
| 150 | fu nction () { | |
| 151 | //do not hing on co mpletion | |
| 152 | } | |
| 153 | ); | |
| 154 | } | |
| 155 | ||
| 156 | function g et2Digits( startValue ) { | |
| 157 | var en dValue = " 0"; | |
| 158 | ||
| 159 | if (st artValue < 10) { | |
| 160 | en dValue += startValue ; | |
| 161 | } else { | |
| 162 | en dValue = s tartValue; | |
| 163 | } | |
| 164 | ||
| 165 | return endValue; | |
| 166 | } | |
| 167 | ||
| 168 | function g etVistaDat e(myDate) { | |
| 169 | ||
| 170 | var da y = get2Di gits(myDat e.getDate( )); | |
| 171 | var mo nth = get2 Digits(myD ate.getMon th() + 1); //January is 0! | |
| 172 | var ye ar = myDat e.getFullY ear() - 17 00; | |
| 173 | var ho ur = get2D igits(myDa te.getHour s()); | |
| 174 | var mi nute = get 2Digits(my Date.getMi nutes()); | |
| 175 | var se cond = get 2Digits(my Date.getSe conds()); | |
| 176 | ||
| 177 | return (year + m onth + day + "." + h our + minu te + secon d); | |
| 178 | } | |
| 179 | ||
| 180 | Date.proto type.vista _date = fu nction () { | |
| 181 | var da y = get2Di gits(this. getDate()) ; | |
| 182 | var mo nth = get2 Digits(thi s.getMonth () + 1); / /January i s 0! | |
| 183 | var ye ar = this. getFullYea r() - 1700 ; | |
| 184 | var ho ur = get2D igits(this .getHours( )); | |
| 185 | var mi nute = get 2Digits(th is.getMinu tes()); | |
| 186 | var se cond = get 2Digits(th is.getSeco nds()); | |
| 187 | ||
| 188 | return (year + m onth + day + "." + h our + minu te + secon d); | |
| 189 | }; | |
| 190 | ||
| 191 | Date.proto type.yyyym mdd = func tion () { | |
| 192 | var da y = get2Di gits(this. getDate()) ; | |
| 193 | var mo nth = get2 Digits(thi s.getMonth () + 1); / / getMonth () is zero -based | |
| 194 | var ye ar = this. getFullYea r(); | |
| 195 | ||
| 196 | return (year + m onth + day ); | |
| 197 | }; | |
| 198 | ||
| 199 | ||
| 200 | ||
| 201 | //AppInfo | |
| 202 | function A ppInfo() { | |
| 203 | this.n ame = ""; | |
| 204 | this.t oken = ""; | |
| 205 | this.p assword = ""; | |
| 206 | this.n otetitleid = ""; | |
| 207 | this.u rl = ""; | |
| 208 | } | |
| 209 | ||
| 210 | AppInfo.pr ototype.ge tXMLNodes = function () { | |
| 211 | return "<request ingApp>" + this.name + "</requ estingApp> " + | |
| 212 | "<cons umingAppTo ken>" + th is.token + "</consum ingAppToke n>" + | |
| 213 | "<cons umingAppPa ssword>" + this.pass word + "</ consumingA ppPassword >"; | |
| 214 | }; | |
| 215 | ||
| 216 | //Soap Wra pper | |
| 217 | function S oapWrapper (servicena me) { | |
| 218 | this.s ervicename = service name; | |
| 219 | } | |
| 220 | ||
| 221 | SoapWrappe r.prototyp e.getSoapH eader = fu nction () { | |
| 222 | return "<soapenv :Envelope xmlns:soap env='http: //schemas. xmlsoap.or g/soap/env elope/' " + | |
| 223 | "xmlns:ser ='http:// DNS . URL /'>" + | |
| 224 | "<soap env:Header />" + | |
| 225 | "<soap env:Body>" + | |
| 226 | "<ser: " + this.s ervicename + ">"; | |
| 227 | }; | |
| 228 | ||
| 229 | SoapWrappe r.prototyp e.getSoapF ooter = fu nction () { | |
| 230 | return "</ser:" + this.ser vicename + ">" + | |
| 231 | "</soa penv:Body> " + | |
| 232 | "</soa penv:Envel ope>"; | |
| 233 | }; | |
| 234 | ||
| 235 | //UserTO | |
| 236 | function U serTO() { | |
| 237 | this.n ame = ""; | |
| 238 | this.s sn = ""; | |
| 239 | this.d uz = ""; | |
| 240 | this.v istaduz = ""; | |
| 241 | this.s iteid = "" ; | |
| 242 | this.g reeting = ""; | |
| 243 | this.f ault = ""; | |
| 244 | this.e rror = ""; | |
| 245 | this.v alue = ""; | |
| 246 | } | |
| 247 | ||
| 248 | UserTO.pro totype.get XMLNodes = function () { | |
| 249 | return "<name>" + this.nam e + "</nam e>" + | |
| 250 | "<logi nSiteCode> " + this.g etSubDivis ion() + "< /loginSite Code>" + | |
| 251 | "<user Id>" + thi s.duz + "< /userId>"; | |
| 252 | }; | |
| 253 | UserTO.pro totype.get SiteId = f unction () { | |
| 254 | return this.site id.substr( 0, 3); | |
| 255 | }; | |
| 256 | UserTO.pro totype.get SubDivisio n = functi on () { | |
| 257 | return ((this.si teid.lengt h > 3) ? t his.siteid .substr(3) : this.si teid.subst r(0, 3)); | |
| 258 | }; | |
| 259 | ||
| 260 | //Patient | |
| 261 | function P atientTO() { | |
| 262 | this.n ame = ""; | |
| 263 | this.s sn = ""; | |
| 264 | this.d ob = ""; | |
| 265 | this.p atientname = ""; | |
| 266 | this.l ocalpid = ""; | |
| 267 | this.p atientflag s = ""; | |
| 268 | this.f ault = ""; | |
| 269 | this.e rror = ""; | |
| 270 | this.v alue = ""; | |
| 271 | ||
| 272 | //addi tional fie lds from s elect | |
| 273 | this.g ender = "" ; | |
| 274 | this.m pipid = "" ; | |
| 275 | this.m pichecksum = ""; | |
| 276 | this.l ocation = ""; | |
| 277 | this.r estricted = ""; | |
| 278 | this.c onfidentia lity = ""; | |
| 279 | ||
| 280 | } | |
| 281 | ||
| 282 | PatientTO. prototype. getXMLNode s = functi on () { | |
| 283 | return "<name>" + this.pat ientname + "</name>" + | |
| 284 | "<loca lPid>" + t his.localp id + "</lo calPid>"; | |
| 285 | ||
| 286 | }; | |
| 287 | ||
| 288 | //Note Tit les | |
| 289 | function N oteTitle() { | |
| 290 | this.i d = ""; | |
| 291 | this.n ame = ""; | |
| 292 | this.f ault = ""; | |
| 293 | this.e rror = ""; | |
| 294 | this.v alue = ""; | |
| 295 | } | |
| 296 | ||
| 297 | //Location | |
| 298 | function L ocation() { | |
| 299 | this.i d = ""; | |
| 300 | this.n ame = ""; | |
| 301 | this.f ault = ""; | |
| 302 | this.e rror = ""; | |
| 303 | this.v alue = ""; | |
| 304 | } | |
| 305 | ||
| 306 | //isConsul t isSurger y | |
| 307 | function V isitTO() { | |
| 308 | this.t ype = ""; | |
| 309 | this.l ocation = new Locati on(); | |
| 310 | this.t imestamp = ""; | |
| 311 | this.s tatus = "" ; | |
| 312 | this.f ault = ""; | |
| 313 | this.e rror = ""; | |
| 314 | this.v alue = ""; | |
| 315 | } | |
| 316 | ||
| 317 | ||
| 318 | //Write No te | |
| 319 | function N oteResultT O() { | |
| 320 | this.i d = ""; | |
| 321 | this.t otalpages = ""; | |
| 322 | this.l astpagerec d = ""; | |
| 323 | this.f ault = ""; | |
| 324 | this.e rror = ""; | |
| 325 | this.v alue = ""; | |
| 326 | } | |
| 327 | ||
| 328 | //isConsul t isSurger y Confiden tiality | |
| 329 | function T extTo() { | |
| 330 | this.t ext = ""; | |
| 331 | this.f ault = ""; | |
| 332 | this.e rror = ""; | |
| 333 | this.v alue = ""; | |
| 334 | } | |
| 335 | ||
| 336 | function B uildEncoun terString( isHistoric al, locati onId) { | |
| 337 | //LOCA TIONIEN;YY YYMMDD;ENC OUNTERTYPE | |
| 338 | // --- ---------- ---------- ---------- ---------- ------ | |
| 339 | // hi storical | |
| 340 | // -l ocation locationid ; currentd ate; E | |
| 341 | // --- ---------- ---------- ---------- ---------- ------ | |
| 342 | // no n-historic | |
| 343 | // -l ocation locationid ; currentd ate; A | |
| 344 | // -v isit visitlocat ionid; vis itdate; vi sittype | |
| 345 | // --- ---------- ---------- ---------- ---------- ------ | |
| 346 | // Enc ounter Typ e – Can be one of three poss ible value s: | |
| 347 | // A (A MBULATORY) , | |
| 348 | // H (H OSPITALIZA TION) | |
| 349 | // E (E VENT- HIST ORICAL) | |
| 350 | ||
| 351 | //var visitTime = window.p arent.Xrm. Page.getAt tribute("v cl_via_vis it_time_te xt").getVa lue(); | |
| 352 | //var visitType = window.p arent.Xrm. Page.getAt tribute("v cl_via_vis it_type_te xt").getVa lue(); | |
| 353 | ||
| 354 | var en counterTyp e = (isHis torical = 'Y' ? 'E' : 'A'); | |
| 355 | ||
| 356 | var en counterDat e = getVis taDate(new Date()); | |
| 357 | ||
| 358 | return (location Id + ";" + encounter Date + ";" + encount erType) | |
| 359 | } | |
| 360 | ||
| 361 | //Start of Namespace | |
| 362 | ||
| 363 | VIAService s = { | |
| 364 | ||
| 365 | callSe rvice: fun ction (soa pMessage, on_success , on_error ) { | |
| 366 | va r resultDa ta = null; | |
| 367 | $. ajax({ | |
| 368 | url: con sumingApp. url, | |
| 369 | type: "P OST", | |
| 370 | datatype : "xml", | |
| 371 | data: so apMessage, | |
| 372 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 373 | success: on_succes s, | |
| 374 | error: o n_error | |
| 375 | }) ; | |
| 376 | }, | |
| 377 | ||
| 378 | //VIA SERVICE: l oginVIA | |
| 379 | loginV IA: functi on (siteId , accessCo de, verify Code, call back) { | |
| 380 | va r viaLogin Wrapper = new SoapWr apper("log inVIA"); | |
| 381 | ||
| 382 | va r soapMess age = viaL oginWrappe r.getSoapH eader() + | |
| 383 | "< queryBean> " + | |
| 384 | cr eateNode(" requesting App", cons umingApp.n ame) + | |
| 385 | cr eateNode(" consumingA ppToken", consumingA pp.token) + | |
| 386 | cr eateNode(" consumingA ppPassword ", consumi ngApp.pass word) + | |
| 387 | "< /queryBean >" + | |
| 388 | cr eateNode(" siteCode", siteId) + | |
| 389 | cr eateNode(" accessCode ", encodeX ml(accessC ode)) + | |
| 390 | cr eateNode(" verifyCode ", encodeX ml(verifyC ode)) + | |
| 391 | viaLog inWrapper. getSoapFoo ter(); | |
| 392 | ||
| 393 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 394 | el se { callB ackFunctio n = ""; } | |
| 395 | VI AServices. callServic e(soapMess age, VIASe rvices.log inVIA_OnSu ccess, VIA Services.l oginVIA_On Error); | |
| 396 | }, | |
| 397 | ||
| 398 | loginV IA_OnSucce ss: functi on (data, status) { | |
| 399 | // FIND TAG N AME: valu eNodes.chi ldNodes[0] .childNode s[2].tagNa me | |
| 400 | ||
| 401 | // Check for return nod e | |
| 402 | if (data.get ElementsBy TagName('n s2:UserTO' ).length > 0) { | |
| 403 | var valu eNodes = d ata.getEle mentsByTag Name('ns2: UserTO')[0 ]; | |
| 404 | ||
| 405 | //Parse return nod e (includi ng fault) | |
| 406 | var retu rnUserTO = new UserT O(); | |
| 407 | returnUs erTO.name = $(valueN odes.getEl ementsByTa gName('nam e')).text( ); | |
| 408 | returnUs erTO.ssn = $(valueNo des.getEle mentsByTag Name('SSN' )).text(); | |
| 409 | returnUs erTO.duz = $(valueNo des.getEle mentsByTag Name('DUZ' )).text(); | |
| 410 | returnUs erTO.sitei d = $(valu eNodes.get ElementsBy TagName('s iteId')).t ext(); | |
| 411 | returnUs erTO.greet ing = $(va lueNodes.g etElements ByTagName( 'greeting' )).text(); | |
| 412 | returnUs erTO.vista duz = $(va lueNodes.g etElements ByTagName( 'vistaDUZ' )).text(); | |
| 413 | returnUs erTO.fault = $(value Nodes.getE lementsByT agName('fa ult')).tex t(); | |
| 414 | returnUs erTO.value = $(value Nodes).tex t(); | |
| 415 | ||
| 416 | //check if error | |
| 417 | if (retu rnUserTO.f ault !== " " && retur nUserTO.fa ult !== nu ll) { | |
| 418 | retu rnUserTO.e rror = "Lo gin failed "; | |
| 419 | } | |
| 420 | } | |
| 421 | ||
| 422 | if (callBack Function ! == "") { c allBackFun ction(retu rnUserTO); } | |
| 423 | }, | |
| 424 | ||
| 425 | loginV IA_OnError : function (request, status, e rror) { | |
| 426 | // Parse Faul t | |
| 427 | va r returnUs erTO = new UserTO(); | |
| 428 | re turnUserTO .error = e rror; | |
| 429 | re turnUserTO .fault = $ (request.r esponseXML .getElemen tsByTagNam e('faultst ring')).te xt(); | |
| 430 | re turnUserTO .value = $ (request.r esponseTex t).text(); | |
| 431 | ||
| 432 | if (callBack Function ! == "") { c allBackFun ction(retu rnUserTO); } | |
| 433 | }, | |
| 434 | ||
| 435 | //VIA SERVICE: m atch | |
| 436 | match: function (userTO, t arget, cal lback) { | |
| 437 | // target an d directio n are opti onal per d ocumentati on | |
| 438 | va r getMatch Wrapper = new SoapWr apper("mat ch"); | |
| 439 | ||
| 440 | va r soapMess age = getM atchWrappe r.getSoapH eader() + | |
| 441 | "< queryBean> " + | |
| 442 | crea teNode("ta rget", enc odeXml(tar get)) + | |
| 443 | crea teNode("di rection", 1) + | |
| 444 | "< provider>" + | |
| 445 | cr eateNode(" name", use rTO.name) + | |
| 446 | cr eateNode(" loginSiteC ode", ((us erTO.sitei d.length > 3) ? user TO.siteid. substr(3) : userTO.s iteid.subs tr(0, 3))) + | |
| 447 | cr eateNode(" userId", u serTO.duz) + | |
| 448 | "< /provider> " + | |
| 449 | cr eateNode(" requesting App", cons umingApp.n ame) + | |
| 450 | cr eateNode(" consumingA ppToken", consumingA pp.token) + | |
| 451 | cr eateNode(" consumingA ppPassword ", consumi ngApp.pass word) + | |
| 452 | "</q ueryBean>" + | |
| 453 | ge tMatchWrap per.getSoa pFooter(); | |
| 454 | ||
| 455 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 456 | el se { callB ackFunctio n = ""; } | |
| 457 | VI AServices. callServic e(soapMess age, VIASe rvices.mat ch_OnSucce ss, VIASer vices.matc h_OnError) ; | |
| 458 | }, | |
| 459 | ||
| 460 | match_ OnSuccess: function (data, sta tus) { | |
| 461 | va r returnRe sult = []; | |
| 462 | ||
| 463 | // Check for return nod e | |
| 464 | if (data.get ElementsBy TagName("n s2:TaggedP atientArra y").length > 0) { | |
| 465 | var valu eNodes = d ata.getEle mentsByTag Name("ns2: TaggedPati entArray") [0].getEle mentsByTag Name("pati ents")[0]; | |
| 466 | ||
| 467 | $(valueN odes).chil dren().eac h(function (index) { | |
| 468 | //Pa rse return node (inc luding fau lt) | |
| 469 | var tempPatien tTO = new PatientTO( ); | |
| 470 | temp PatientTO. name = $(v alueNodes. childNodes [index].ge tElementsB yTagName(' name')).te xt(); | |
| 471 | temp PatientTO. ssn = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('s sn')).text () | |
| 472 | temp PatientTO. dob = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('d ob')).text (); | |
| 473 | temp PatientTO. patientnam e = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('pat ientName') ).text(); | |
| 474 | temp PatientTO. localpid = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('localP id')).text (); | |
| 475 | temp PatientTO. patientfla gs = $(val ueNodes.ch ildNodes[i ndex].getE lementsByT agName('pa tientFlags ')).text() ; | |
| 476 | temp PatientTO. fault = $( valueNodes .childNode s[index].g etElements ByTagName( 'fault')). text(); | |
| 477 | temp PatientTO. value = $( valueNodes .childNode s[index].g etElements ByTagName( 'patientTO ')).text() ; | |
| 478 | ||
| 479 | //ch eck if err or | |
| 480 | if ( tempPatien tTO.fault !== "" && tempPatien tTO.fault !== null) { | |
| 481 | tempPatien tTO.error = "Get Pat ient Faile d"; | |
| 482 | } | |
| 483 | ||
| 484 | retu rnResult.p ush(tempPa tientTO); | |
| 485 | }); | |
| 486 | ||
| 487 | } else { | |
| 488 | //Could not find m ain node | |
| 489 | //Parse Fault | |
| 490 | var temp PatientTO = new Pati entTO(); | |
| 491 | tempPati entTO.erro r = "Could not find return dat a in expec ted struct ure"; | |
| 492 | tempPati entTO.faul t = $(data .getElemen tsByTagNam e('fault') ).text(); | |
| 493 | tempPati entTO.valu e = $(data .documentE lement).te xt(); | |
| 494 | ||
| 495 | returnRe sult.push( tempPatien tTO); | |
| 496 | } | |
| 497 | ||
| 498 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 499 | }, | |
| 500 | ||
| 501 | match_ OnError: f unction (r equest, st atus, erro r) { | |
| 502 | va r returnRe sult = []; | |
| 503 | ||
| 504 | va r tempPati entTO = ne w PatientT O(); | |
| 505 | te mpPatientT O.value = request; | |
| 506 | te mpPatientT O.error = error; | |
| 507 | ||
| 508 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult.p ush(return PatientTO) ); } | |
| 509 | }, | |
| 510 | ||
| 511 | //VIA SERVICE: s elect | |
| 512 | select : function (userTO, localPid, target, ca llback) { | |
| 513 | // target an d directio n are opti onal per d ocumentati on | |
| 514 | va r selectWr apper = ne w SoapWrap per("selec t"); | |
| 515 | ||
| 516 | va r soapMess age = sele ctWrapper. getSoapHea der() + | |
| 517 | "<qu eryBean>" + | |
| 518 | "<pati ent>" + | |
| 519 | createNo de("localP id", local Pid) + | |
| 520 | createNo de("localS iteId", us erTO.getSi teId()) + | |
| 521 | "</pat ient>" + | |
| 522 | "< provider>" + | |
| 523 | cr eateNode(" name", use rTO.name) + | |
| 524 | cr eateNode(" loginSiteC ode", ((us erTO.sitei d.length > 3) ? user TO.siteid. substr(3) : userTO.s iteid.subs tr(0, 3))) + | |
| 525 | cr eateNode(" userId", u serTO.duz) + | |
| 526 | "< /provider> " + | |
| 527 | cr eateNode(" requesting App", cons umingApp.n ame) + | |
| 528 | cr eateNode(" consumingA ppToken", consumingA pp.token) + | |
| 529 | cr eateNode(" consumingA ppPassword ", consumi ngApp.pass word) + | |
| 530 | "< /queryBean >" + | |
| 531 | se lectWrappe r.getSoapF ooter(); | |
| 532 | ||
| 533 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 534 | el se { callB ackFunctio n = ""; } | |
| 535 | VI AServices. callServic e(soapMess age, VIASe rvices.sel ect_OnSucc ess, VIASe rvices.sel ect_OnErro r); | |
| 536 | ||
| 537 | }, | |
| 538 | ||
| 539 | select _OnSuccess : function (data, st atus) { | |
| 540 | va r returnRe sult = []; | |
| 541 | ||
| 542 | if (data.get ElementsBy TagName("n s2:selectR esponse"). length > 0 ) { | |
| 543 | var valu eNodes = d ata.getEle mentsByTag Name("ns2: selectResp onse")[0]; | |
| 544 | ||
| 545 | $(valueN odes).chil dren().eac h(function (index) { | |
| 546 | var tempPatien tTo = new PatientTO( ); | |
| 547 | ||
| 548 | temp PatientTo. name = $(v alueNodes. childNodes [index].ge tElementsB yTagName(' name')).te xt(); | |
| 549 | temp PatientTo. ssn = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('s sn')).text (); | |
| 550 | temp PatientTo. dob = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('d ob')).text (); | |
| 551 | temp PatientTo. patientnam e = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('pat ientName') ).text(); | |
| 552 | temp PatientTo. localpid = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('localP id')).text (); | |
| 553 | temp PatientTo. patientfla gs = $(val ueNodes.ch ildNodes[i ndex].getE lementsByT agName('pa tientFlags ')).text() ; | |
| 554 | ||
| 555 | temp PatientTo. gender = $ (valueNode s.childNod es[index]. getElement sByTagName ('gender') ).text(); | |
| 556 | temp PatientTo. mpipid = $ (valueNode s.childNod es[index]. getElement sByTagName ('mpiPid') ).text(); | |
| 557 | temp PatientTo. mpichecksu m = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('mpi Checksum') ).text(); | |
| 558 | temp PatientTo. location = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('locati on')).text (); | |
| 559 | temp PatientTo. restricted = $(value Nodes.chil dNodes[ind ex].getEle mentsByTag Name('rest ricted')). text(); | |
| 560 | temp PatientTo. confidenti ality = $( valueNodes .childNode s[index].g etElements ByTagName( 'confident iality')). text(); | |
| 561 | ||
| 562 | temp PatientTo. fault = $( valueNodes .childNode s[index].g etElements ByTagName( 'fault')). text(); | |
| 563 | temp PatientTo. value = $( valueNodes .childNode s[index]). text(); | |
| 564 | ||
| 565 | //ch eck if err or | |
| 566 | if ( tempPatien tTo.fault !== "" && tempPatien tTo.fault !== null) { | |
| 567 | tempPatien tTo.error = "Select Patient Fa iled"; | |
| 568 | } | |
| 569 | ||
| 570 | retu rnResult.p ush(tempPa tientTo); | |
| 571 | }); | |
| 572 | ||
| 573 | } else { | |
| 574 | //Could not find m ain node | |
| 575 | //Parse Fault | |
| 576 | var temp PatientTo = new Pati entTO(); | |
| 577 | tempPati entTo.erro r = "Could not find return dat a in expec ted struct ure"; | |
| 578 | tempPati entTo.faul t = $(data .getElemen tsByTagNam e('fault') ).text(); | |
| 579 | tempPati entTo.valu e = $(data .documentE lement).te xt(); | |
| 580 | ||
| 581 | returnRe sult.push( tempPatien tTo); | |
| 582 | } | |
| 583 | ||
| 584 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 585 | ||
| 586 | }, | |
| 587 | ||
| 588 | select _OnError: function ( request, s tatus, err or) { | |
| 589 | va r returnRe sult = []; | |
| 590 | ||
| 591 | va r tempPati entTo = ne w PatientT O(); | |
| 592 | te mpPatientT o.error = error; | |
| 593 | te mpPatientT o.fault = $(request. responseXM L.getEleme ntsByTagNa me('faults tring')).t ext(); | |
| 594 | te mpPatientT o.value = $(request. responseTe xt).text() ; | |
| 595 | ||
| 596 | re turnResult .push(temp PatientTo) ; | |
| 597 | ||
| 598 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 599 | }, | |
| 600 | ||
| 601 | ||
| 602 | //VIA SERVICE: g etLocation s | |
| 603 | getLoc ations: fu nction (us erTO, targ et, callba ck) { | |
| 604 | // target an d directio n are opti onal per d ocumentati on | |
| 605 | va r getLocat ionsWrappe r = new So apWrapper( "getLocati ons"); | |
| 606 | ||
| 607 | va r soapMess age = getL ocationsWr apper.getS oapHeader( ) + | |
| 608 | "< queryBean> " + | |
| 609 | crea teNode("ta rget", enc odeXml(tar get)) + | |
| 610 | crea teNode("di rection", 1) + | |
| 611 | "< provider>" + | |
| 612 | cr eateNode(" name", use rTO.name) + | |
| 613 | cr eateNode(" loginSiteC ode", ((us erTO.sitei d.length > 3) ? user TO.siteid. substr(3) : userTO.s iteid.subs tr(0, 3))) + | |
| 614 | cr eateNode(" userId", u serTO.duz) + | |
| 615 | "< /provider> " + | |
| 616 | cr eateNode(" requesting App", cons umingApp.n ame) + | |
| 617 | cr eateNode(" consumingA ppToken", consumingA pp.token) + | |
| 618 | cr eateNode(" consumingA ppPassword ", consumi ngApp.pass word) + | |
| 619 | "</q ueryBean>" + | |
| 620 | ge tLocations Wrapper.ge tSoapFoote r(); | |
| 621 | ||
| 622 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 623 | el se { callB ackFunctio n = ""; } | |
| 624 | VI AServices. callServic e(soapMess age, VIASe rvices.get Locations_ OnSuccess, VIAServic es.getLoca tions_OnEr ror); | |
| 625 | }, | |
| 626 | ||
| 627 | getLoc ations_OnS uccess: fu nction (da ta, status ) { | |
| 628 | va r returnRe sult = []; | |
| 629 | ||
| 630 | if (data.get ElementsBy TagName("n s2:TaggedH ospitalLoc ationArray ").length > 0) { | |
| 631 | var valu eNodes = d ata.getEle mentsByTag Name("loca tions")[0] ; | |
| 632 | ||
| 633 | $(valueN odes).chil dren().eac h(function (index) { | |
| 634 | var tempLocati on = new L ocation(); | |
| 635 | temp Location.i d = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('id' )).text(); | |
| 636 | temp Location.n ame = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('n ame')).tex t(); | |
| 637 | temp Location.f ault = $(v alueNodes. childNodes [index].ge tElementsB yTagName(' fault')).t ext(); | |
| 638 | temp Location.v alue = $(v alueNodes. childNodes [index]).t ext(); | |
| 639 | ||
| 640 | //ch eck if err or | |
| 641 | if ( tempLocati on.fault ! == "" && t empLocatio n.fault != = null) { | |
| 642 | tempLocati on.error = "Get Loca tion Faile d"; | |
| 643 | } | |
| 644 | ||
| 645 | retu rnResult.p ush(tempLo cation); | |
| 646 | }); | |
| 647 | } else { | |
| 648 | //Could not find m ain node | |
| 649 | //Parse Fault | |
| 650 | var temp Location = new Locat ion(); | |
| 651 | tempLoca tion.error = "Could not find r eturn data in expect ed structu re"; | |
| 652 | tempLoca tion.fault = $(data. getElement sByTagName ('fault')) .text(); | |
| 653 | tempLoca tion.value = $(data. documentEl ement).tex t(); | |
| 654 | ||
| 655 | returnRe sult.push( tempLocati on); | |
| 656 | } | |
| 657 | ||
| 658 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 659 | }, | |
| 660 | ||
| 661 | getLoc ations_OnE rror: func tion (requ est, statu s, error) { | |
| 662 | va r returnRe sult = []; | |
| 663 | ||
| 664 | va r tempLoca tion = new Location( ); | |
| 665 | te mpLocation .error = e rror; | |
| 666 | te mpLocation .fault = $ (request.r esponseXML .getElemen tsByTagNam e('faultst ring')).te xt(); | |
| 667 | te mpLocation .value = $ (request.r esponseTex t).text(); | |
| 668 | ||
| 669 | re turnResult .push(temp Location); | |
| 670 | ||
| 671 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 672 | }, | |
| 673 | ||
| 674 | ||
| 675 | ||
| 676 | //VIA SERVICE: w riteNotes | |
| 677 | writeN ote: funct ion (userT O, localPi d, titleId , encounte rString, c ontent, ca llback) { | |
| 678 | // encounter date | |
| 679 | va r myDate = new Date( ); | |
| 680 | va r encounte rDate = ge tVistaDate (new Date( )); | |
| 681 | // Change lin ebreaks | |
| 682 | co ntent = vi aLineBreak s(content) ; | |
| 683 | ||
| 684 | // target an d directio n are opti onal per d ocumentati on | |
| 685 | va r writeNot eWrapper = new SoapW rapper("wr iteNote"); | |
| 686 | ||
| 687 | va r soapMess age = writ eNoteWrapp er.getSoap Header() + | |
| 688 | crea teNode("ti tleIEN", t itleId); | |
| 689 | ||
| 690 | so apMessage += createN ode("encou nterString ", encount erString); //LOCATI ONIEN;YYYY MMDD;ENCOU NTERTYPE | |
| 691 | ||
| 692 | so apMessage += createN ode("text" , content) + | |
| 693 | "<quer yBean>" + | |
| 694 | "< patient>" + | |
| 695 | createNo de("localP id", local Pid) + | |
| 696 | "< /patient>" + | |
| 697 | "< provider>" + | |
| 698 | cr eateNode(" name", use rTO.name) + | |
| 699 | cr eateNode(" loginSiteC ode", ((us erTO.sitei d.length > 3) ? user TO.siteid. substr(3) : userTO.s iteid.subs tr(0, 3))) + | |
| 700 | cr eateNode(" userId", u serTO.duz) + | |
| 701 | "< /provider> " + | |
| 702 | cr eateNode(" recordSite Code", ((u serTO.site id.length > 3) ? use rTO.siteid .substr(3) : userTO. siteid.sub str(0, 3)) ) + | |
| 703 | cr eateNode(" requesting App", cons umingApp.n ame) + | |
| 704 | cr eateNode(" consumingA ppToken", consumingA pp.token) + | |
| 705 | cr eateNode(" consumingA ppPassword ", consumi ngApp.pass word) + | |
| 706 | "</que ryBean>" + | |
| 707 | writeNoteW rapper.get SoapFooter (); | |
| 708 | ||
| 709 | // <encounter String>887 ;3140121.1 63242;E</e ncounterSt ring> | |
| 710 | // Location ID – Mig ht need to use the V IA service “getHos pitalLocat ions†to retrieve the valid location I Ds by name | |
| 711 | // VistA Dat e/Time - G enerate th e second p iece of in formation by sending a date an d time in Vista form at. | |
| 712 | // i.e. 313 0715.16324 2 represen ts July 15 , 2013 4:3 2:42. | |
| 713 | // The Vist A date for mat is Vis taYear + m mdd.hhmmss . | |
| 714 | // The only weird thi ng is the VistA year . It is ca lculated u sing the c urrent yea r minus 17 00. | |
| 715 | // So Februar y 7, 2017 08:00 woul d be 31702 07.080000. Where 317 is 2017 â €“ 1700. | |
| 716 | ||
| 717 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 718 | el se { callB ackFunctio n = ""; } | |
| 719 | VI AServices. callServic e(soapMess age, VIASe rvices.wri teNote_OnS uccess, VI AServices. writeNote_ OnError); | |
| 720 | }, | |
| 721 | ||
| 722 | writeN ote_OnSucc ess: funct ion (data, status) { | |
| 723 | va r returnRe sult = []; | |
| 724 | ||
| 725 | // Check for return nod e | |
| 726 | if (data.get ElementsBy TagName('s oap:Envelo pe').lengt h > 0) { | |
| 727 | var valu eNodes = d ata.getEle mentsByTag Name('soap :Envelope' )[0].child Nodes[0].c hildNodes[ 0]; | |
| 728 | ||
| 729 | $(valueN odes).chil dren().eac h(function (index) { | |
| 730 | //Pa rse return node (inc luding fau lt) | |
| 731 | var noteResult To = new N oteResultT O(); | |
| 732 | note ResultTo.i d = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('id' )).text(); | |
| 733 | note ResultTo.t otalpages = $(valueN odes.child Nodes[inde x].getElem entsByTagN ame('total Pages')).t ext() | |
| 734 | note ResultTo.l astpagerec d = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('las tPageRecd' )).text(); | |
| 735 | note ResultTo.f ault = $(v alueNodes. childNodes [index].ge tElementsB yTagName(' fault')).t ext(); | |
| 736 | note ResultTo.v alue = $(v alueNodes. childNodes [index]).t ext(); | |
| 737 | ||
| 738 | //ch eck if err or | |
| 739 | if ( noteResult To.fault ! == "" && n oteResultT o.fault != = null) { | |
| 740 | noteResult To.error = "Note Wri te Failed" ; | |
| 741 | } | |
| 742 | ||
| 743 | retu rnResult.p ush(noteRe sultTo); | |
| 744 | }); | |
| 745 | ||
| 746 | } else { | |
| 747 | //Could not find m ain node | |
| 748 | //Parse Fault | |
| 749 | var note ResultTo = new NoteR esultTO(); | |
| 750 | noteResu ltTo.error = "Could not find r eturn data in expect ed structu re"; | |
| 751 | noteResu ltTo.fault = $(data. getElement sByTagName ('fault')) .text(); | |
| 752 | noteResu ltTo.value = $(data. documentEl ement).tex t(); | |
| 753 | ||
| 754 | returnRe sult.push( noteResult To); | |
| 755 | } | |
| 756 | ||
| 757 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 758 | ||
| 759 | }, | |
| 760 | ||
| 761 | writeN ote_OnErro r: functio n (request , status, error) { | |
| 762 | va r returnRe sult = []; | |
| 763 | ||
| 764 | va r noteResu ltTo = new NoteResul tTO(); | |
| 765 | no teResultTo .error = e rror; | |
| 766 | no teResultTo .fault = $ (request.r esponseXML .getElemen tsByTagNam e('faultst ring')).te xt(); | |
| 767 | no teResultTo .value = $ (request.r esponseTex t).text(); | |
| 768 | ||
| 769 | re turnResult .push(note ResultTo); | |
| 770 | ||
| 771 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 772 | ||
| 773 | }, | |
| 774 | ||
| 775 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.