Produced by Araxis Merge on 9/22/2017 10:18:54 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_ Purch Care NonVA Call Ctr_CCWF_v1.6_release 6.zip\MVIPersonSearchWebResources_1_6_0_2.zip\WebResources | bah_via_libraryjs27DEC458-6172-E711-812D-1289A8FDD3DA | Mon Aug 14 22:07:34 2017 UTC |
| 2 | OSCIF_ Purch Care NonVA Call Ctr_CCWF_v1.6_release 6.zip\MVIPersonSearchWebResources_1_6_0_2.zip\WebResources | bah_via_libraryjs27DEC458-6172-E711-812D-1289A8FDD3DA | Fri Sep 22 16:13:31 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 2566 |
| Changed | 2 | 4 |
| 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 | ||
| 2 | if (typeof (VIAServi ces) === " undefined" ) { | |
| 3 | VIASer vices = { __namespac e: true }; | |
| 4 | } | |
| 5 | ||
| 6 | // UTILITI ES SECTION | |
| 7 | var xml_en code_map = { | |
| 8 | '& ': '&' , | |
| 9 | '" ': '" ', | |
| 10 | '< ': '<', | |
| 11 | '> ': '>' | |
| 12 | }; | |
| 13 | ||
| 14 | var xml_de code_map = { | |
| 15 | '& amp;': '&' , | |
| 16 | '& quot;': '" ', | |
| 17 | '& lt;': '<', | |
| 18 | '& gt;': '>' | |
| 19 | }; | |
| 20 | ||
| 21 | function e ncodeXml(s tring) { | |
| 22 | re turn strin g.replace( /([\&"<>]) /g, functi on(str, it em) { | |
| 23 | retu rn xml_enc ode_map[it em]; | |
| 24 | }) ; | |
| 25 | }; | |
| 26 | ||
| 27 | function d ecodeXml(s tring) { | |
| 28 | re turn strin g.replace( /("|& lt;|>|& amp;)/g, | |
| 29 | func tion(str, item) { | |
| 30 | return xml_decod e_map[item ]; | |
| 31 | }) ; | |
| 32 | } | |
| 33 | ||
| 34 | function v iaLineBrea ks(string) { | |
| 35 | re turn strin g.replace( /[\n\r]/g, '|'); | |
| 36 | } | |
| 37 | ||
| 38 | function c reateNode( tag, value ) { | |
| 39 | re turn "<" + tag + ">" + value + "</" + ta g + ">" | |
| 40 | } | |
| 41 | ||
| 42 | function g et2Digits( startValue ) { | |
| 43 | var endValue = "0"; | |
| 44 | ||
| 45 | if(s tartValue< 10){ | |
| 46 | endVal ue += star tValue; | |
| 47 | } el se { | |
| 48 | endVal ue = start Value; | |
| 49 | } | |
| 50 | ||
| 51 | retu rn endValu e; | |
| 52 | } | |
| 53 | ||
| 54 | function g etVistaDat e(myDate) { | |
| 55 | ||
| 56 | var day = get2 Digits(myD ate.getDat e()); | |
| 57 | var month = ge t2Digits(m yDate.getM onth()+1); //January is 0! | |
| 58 | var year = myD ate.getFul lYear() - 1700; | |
| 59 | var hour = get 2Digits(my Date.getHo urs()); | |
| 60 | var minute = g et2Digits( myDate.get Minutes()) ; | |
| 61 | var second = g et2Digits( myDate.get Seconds()) ; | |
| 62 | ||
| 63 | retu rn ( year + month + day + "." + hour + minute + s econd); | |
| 64 | } | |
| 65 | ||
| 66 | Date.proto type.vista _date = fu nction() { | |
| 67 | var day = get2 Digits(thi s.getDate( )); | |
| 68 | var month = ge t2Digits(t his.getMon th()+1); / /January i s 0! | |
| 69 | var year = thi s.getFullY ear() - 17 00; | |
| 70 | var hour = get 2Digits(th is.getHour s()); | |
| 71 | var minute = g et2Digits( this.getMi nutes()); | |
| 72 | var second = g et2Digits( this.getSe conds()); | |
| 73 | ||
| 74 | retu rn ( year + month + day + "." + hour + minute + s econd); | |
| 75 | }; | |
| 76 | ||
| 77 | Date.proto type.yyyym mdd = func tion() { | |
| 78 | var day = get2 Digits(thi s.getDate( )); | |
| 79 | var month = ge t2Digits(t his.getMon th()+1); / / getMonth () is zero -based | |
| 80 | var year = thi s.getFullY ear(); | |
| 81 | ||
| 82 | retu rn ( year + month + day); | |
| 83 | }; | |
| 84 | ||
| 85 | ||
| 86 | ||
| 87 | //AppInfo | |
| 88 | function A ppInfo() { | |
| 89 | this.n ame = ""; | |
| 90 | th is.token = ""; | |
| 91 | th is.passwor d = ""; | |
| 92 | } | |
| 93 | ||
| 94 | AppInfo.pr ototype.ge tXMLNodes = function () { | |
| 95 | va r strXML= createNode ("requesti ngApp", th is.name) + | |
| 96 | createNo de("consum ingAppToke n",this.to ken) + | |
| 97 | createNo de("consum ingAppPass word", thi s.password ); | |
| 98 | re turn strX ML; | |
| 99 | }; | |
| 100 | ||
| 101 | //Soap Wra pper | |
| 102 | function S oapWrapper (servicena me) { | |
| 103 | this.s ervicename = service name; | |
| 104 | } | |
| 105 | ||
| 106 | SoapWrappe r.prototyp e.getSoapH eader = fu nction() { | |
| 107 | return "<so apenv:Enve lope xmlns :soapenv=' http://sch emas.xmlso ap.org/soa p/envelope /' " + | |
| 108 | "xmlns:ser ='http:// DNS . URL /'>" + | |
| 109 | "<soap env:Header />" + | |
| 110 | "<soap env:Body>" + | |
| 111 | "<ser: " + this.s ervicename +">"; | |
| 112 | }; | |
| 113 | ||
| 114 | SoapWrappe r.prototyp e.getSoapF ooter = fu nction() { | |
| 115 | return "</s er:" + thi s.servicen ame +">" + | |
| 116 | "</soa penv:Body> " + | |
| 117 | "</soa penv:Envel ope>"; | |
| 118 | }; | |
| 119 | ||
| 120 | //UserTO | |
| 121 | function U serTO() { | |
| 122 | this.n ame = ""; | |
| 123 | th is.ssn = " "; | |
| 124 | th is.duz = " "; | |
| 125 | th is.vistadu z = ""; | |
| 126 | th is.siteid = ""; | |
| 127 | th is.greetin g = ""; | |
| 128 | th is.fault = ""; | |
| 129 | th is.error = ""; | |
| 130 | th is.value = ""; | |
| 131 | } | |
| 132 | ||
| 133 | UserTO.pro totype.get XMLNodes = function( ) { | |
| 134 | va r strXML= "<prov ider>" + | |
| 135 | createNo de("name", this.name ) + | |
| 136 | createNo de("loginS iteCode",t his.getSub Division() ) + | |
| 137 | createNo de("userId ", this.du z) + | |
| 138 | "</provi der>"; | |
| 139 | re turn strX ML; | |
| 140 | }; | |
| 141 | UserTO.pro totype.get SiteId = f unction() { | |
| 142 | re turn this .siteid.su bstr(0,3); | |
| 143 | }; | |
| 144 | UserTO.pro totype.get SubDivisio n = functi on() { | |
| 145 | re turn ((thi s.siteid.l ength > 5) ? this.si teid.subst r(3): this .siteid); | |
| 146 | }; | |
| 147 | ||
| 148 | var _curre ntSiteCode = ""; | |
| 149 | ||
| 150 | //Patient | |
| 151 | function P atientTO() { | |
| 152 | this.n ame = ""; | |
| 153 | th is.ssn = " "; | |
| 154 | th is.dob = " "; | |
| 155 | th is.patient name = ""; | |
| 156 | th is.localpi d = ""; | |
| 157 | th is.patient flags= ""; | |
| 158 | th is.fault = ""; | |
| 159 | th is.error = ""; | |
| 160 | th is.value = ""; | |
| 161 | ||
| 162 | // additional fields fr om select | |
| 163 | th is.gender =""; | |
| 164 | th is.mpipid =""; | |
| 165 | th is.mpichec ksum =""; | |
| 166 | th is.locatio n =""; | |
| 167 | th is.restric ted =""; | |
| 168 | th is.confide ntiality = ""; | |
| 169 | ||
| 170 | th is.localsi teid = _cu rrentSiteC ode; | |
| 171 | } | |
| 172 | ||
| 173 | PatientTO. prototype. getXMLNode s = functi on(blsubdi vision) { | |
| 174 | /* default v alue if no t passed * / | |
| 175 | if (blsubdiv ision === undefined) | |
| 176 | bl subdivisio n = true; | |
| 177 | ||
| 178 | va r strXML = "<patient >" + | |
| 179 | createNode ("name", t his.patien tname) + | |
| 180 | createNode ("localPid ",this.loc alpid) + | |
| 181 | createNode ("localSit eId", ( bl subdivisio n ? this.g etSubDivis ion() : th is.getSite Id() )); | |
| 182 | st rXML += "< /patient>" ; | |
| 183 | re turn strX ML; | |
| 184 | }; | |
| 185 | PatientTO. prototype. getXMLNode sMpi = fun ction(blsu bdivision) { | |
| 186 | /* default v alue if no t passed * / | |
| 187 | if (blsubdiv ision === undefined) | |
| 188 | bl subdivisio n = true; | |
| 189 | ||
| 190 | va r strXML = "<patient >" + | |
| 191 | createNode ("localPid ",this.loc alpid) + | |
| 192 | createNode ("localSit eId", ( bl subdivisio n ? this.g etSubDivis ion() : th is.getSite Id() )); | |
| 193 | if ( this.mp ipid && th is.mpipid. length > 0 ){ | |
| 194 | strX ML += createNo de("mpiPid ", this.mp ipid); | |
| 195 | } | |
| 196 | st rXML += "< /patient>" ; | |
| 197 | re turn strX ML; | |
| 198 | }; | |
| 199 | ||
| 200 | ||
| 201 | PatientTO. prototype. getSiteId = function () { | |
| 202 | re turn this .localsite id.substr( 0,3); | |
| 203 | }; | |
| 204 | PatientTO. prototype. getSubDivi sion = fun ction() { | |
| 205 | re turn ((thi s.localsit eid.length > 5) ? th is.localsi teid.subst r(3): this .localsite id); | |
| 206 | }; | |
| 207 | ||
| 208 | //Note Tit les | |
| 209 | function N oteTitle() { | |
| 210 | this.i d = ""; | |
| 211 | th is.name = ""; | |
| 212 | th is.fault = ""; | |
| 213 | th is.error = ""; | |
| 214 | th is.value = ""; | |
| 215 | } | |
| 216 | ||
| 217 | //Location | |
| 218 | function L ocation() { | |
| 219 | this.i d = ""; | |
| 220 | th is.name = ""; | |
| 221 | th is.fault = ""; | |
| 222 | th is.error = ""; | |
| 223 | th is.value = ""; | |
| 224 | } | |
| 225 | ||
| 226 | //isConsul t isSurger y | |
| 227 | function V isitTO() { | |
| 228 | this.t ype = ""; | |
| 229 | this.l ocation = new Locati on(); | |
| 230 | this.t imestamp = ""; | |
| 231 | this.s tatus = "" ; | |
| 232 | th is.fault = ""; | |
| 233 | th is.error = ""; | |
| 234 | th is.value = ""; | |
| 235 | } | |
| 236 | ||
| 237 | ||
| 238 | //Write No te | |
| 239 | function N oteResultT O() { | |
| 240 | this.i d = ""; | |
| 241 | th is.totalpa ges = ""; | |
| 242 | th is.lastpag erecd = "" ; | |
| 243 | th is.fault = ""; | |
| 244 | th is.error = ""; | |
| 245 | th is.value = ""; | |
| 246 | } | |
| 247 | ||
| 248 | //isConsul t isSurger y Confiden tiality | |
| 249 | function T extTo() { | |
| 250 | this.t ext = ""; | |
| 251 | th is.fault = ""; | |
| 252 | th is.error = ""; | |
| 253 | th is.value = ""; | |
| 254 | } | |
| 255 | ||
| 256 | ||
| 257 | var consum ingApp; | |
| 258 | var ViaEmr ServiceUrl ; | |
| 259 | ||
| 260 | var callBa ckFunction ; | |
| 261 | ||
| 262 | ||
| 263 | //Start of Namespace | |
| 264 | ||
| 265 | VIAService s = { | |
| 266 | ||
| 267 | ca llService: function (soapMessa ge, on_suc cess, on_e rror) { | |
| 268 | va r resultDa ta = null; | |
| 269 | $. ajax({ | |
| 270 | url: ViaEm rServiceUr l, //TEST: "https:// URL ", | |
| 271 | type: "P OST", | |
| 272 | datatype : "xml", | |
| 273 | data: so apMessage, | |
| 274 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 275 | success: on_succes s, | |
| 276 | error: o n_error | |
| 277 | }) ; | |
| 278 | }, | |
| 279 | ||
| 280 | //VIA SERV ICE: login VIA | |
| 281 | lo ginVIA: fu nction (si teId, acce ssCode, ve rifyCode, callback) { | |
| 282 | var viaLoginWr apper = ne w SoapWrap per("login VIA" ); | |
| 283 | ||
| 284 | va r soapMess age = viaL oginWrappe r.getSoapH eader() + | |
| 285 | "< queryBean> " + | |
| 286 | cons umingApp.g etXMLNodes () + | |
| 287 | "< /queryBean >" + | |
| 288 | cr eateNode(" siteCode", siteId) + | |
| 289 | cr eateNode(" accessCode ", encodeX ml(accessC ode)) + | |
| 290 | cr eateNode(" verifyCode ", encodeX ml(verifyC ode)) + | |
| 291 | viaLog inWrapper. getSoapFoo ter(); | |
| 292 | ||
| 293 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 294 | el se { callB ackFunctio n = ""; } | |
| 295 | VI AServices. callServic e(soapMess age, VIASe rvices.log inVIA_OnSu ccess, VIA Services.l oginVIA_On Error ); | |
| 296 | }, | |
| 297 | ||
| 298 | loginV IA_OnSucce ss: functi on (data, status) { | |
| 299 | //FI ND TAG NAM E: valueN odes.child Nodes[0].c hildNodes[ 2].tagName | |
| 300 | ||
| 301 | //Ch eck for re turn node | |
| 302 | if ( data.getEl ementsByTa gName('ns2 :UserTO'). length > 0 ) { | |
| 303 | var va lueNodes = data.getE lementsByT agName('ns 2:UserTO') [0]; | |
| 304 | ||
| 305 | //Pars e return n ode (inclu ding fault ) | |
| 306 | var re turnUserTO = new Use rTO(); | |
| 307 | return UserTO.nam e = $(valu eNodes.get ElementsBy TagName('n ame')).tex t(); | |
| 308 | return UserTO.ssn = $(value Nodes.getE lementsByT agName('SS N')).text( ); | |
| 309 | return UserTO.duz = $(value Nodes.getE lementsByT agName('DU Z')).text( ); | |
| 310 | return UserTO.sit eid = $(va lueNodes.g etElements ByTagName( 'siteId')) .text(); | |
| 311 | return UserTO.gre eting = $( valueNodes .getElemen tsByTagNam e('greetin g')).text( ); | |
| 312 | return UserTO.vis taduz = $( valueNodes .getElemen tsByTagNam e('vistaDU Z')).text( ); | |
| 313 | return UserTO.fau lt = $(val ueNodes.ge tElementsB yTagName(' fault')).t ext(); | |
| 314 | return UserTO.val ue = $(val ueNodes).t ext(); | |
| 315 | ||
| 316 | _curre ntSiteCode = returnU serTO.getS iteId(); | |
| 317 | ||
| 318 | //chec k if error | |
| 319 | if (re turnUserTO .fault !== "" && ret urnUserTO. fault !== null){ | |
| 320 | returnUs erTO.error = "Login failed"; | |
| 321 | } | |
| 322 | ||
| 323 | } el se { | |
| 324 | //Coul d not find main node | |
| 325 | //Pars e Fault | |
| 326 | var re turnUserTO = new Use rTO(); | |
| 327 | return UserTO.err or = "Coul d not find return da ta in expe cted struc ture"; | |
| 328 | return UserTO.fau lt = $(dat a.getEleme ntsByTagNa me('fault' )).text(); | |
| 329 | return UserTO.val ue = $(dat a.document Element).t ext(); | |
| 330 | } | |
| 331 | ||
| 332 | if ( callBackFu nction !== "") { cal lBackFunct ion(return UserTO); } | |
| 333 | }, | |
| 334 | ||
| 335 | loginV IA_OnError : function (request, status, e rror) { | |
| 336 | //Pa rse Fault | |
| 337 | var returnUser TO = new U serTO(); | |
| 338 | retu rnUserTO.e rror = err or; | |
| 339 | retu rnUserTO.f ault = $ (request.r esponseXML .getElemen tsByTagNam e('faultst ring')).te xt(); | |
| 340 | retu rnUserTO.v alue = $(r equest.res ponseText) .text(); | |
| 341 | ||
| 342 | if (callBack Function ! == "") { c allBackFun ction(retu rnUserTO); } | |
| 343 | }, | |
| 344 | ||
| 345 | //VIA SERV ICE: match | |
| 346 | ma tch: funct ion (userT O, target, callback) { | |
| 347 | // target an d directio n are opti onal per d ocumentati on | |
| 348 | var getMatchWr apper = ne w SoapWrap per("match " ); | |
| 349 | ||
| 350 | va r soapMess age = getM atchWrappe r.getSoapH eader() + | |
| 351 | "< queryBean> " + | |
| 352 | crea teNode("ta rget", enc odeXml(tar get)) + | |
| 353 | crea teNode("di rection", 1) + | |
| 354 | us erTO.getXM LNodes() + | |
| 355 | co nsumingApp .getXMLNod es() + | |
| 356 | "</q ueryBean>" + | |
| 357 | ge tMatchWrap per.getSoa pFooter(); | |
| 358 | ||
| 359 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 360 | el se { callB ackFunctio n = ""; } | |
| 361 | VI AServices. callServic e(soapMess age, VIASe rvices.mat ch_OnSucce ss, VIASer vices.matc h_OnError) ; | |
| 362 | }, | |
| 363 | ||
| 364 | ma tch_OnSucc ess: funct ion (data, status) { | |
| 365 | var returnResu lt = []; | |
| 366 | ||
| 367 | //Ch eck for re turn node | |
| 368 | if ( data.getEl ementsByTa gName("ns2 :TaggedPat ientArray" ).length > 0) { | |
| 369 | var va lueNodes = data.getE lementsByT agName("ns 2:TaggedPa tientArray ")[0].getE lementsByT agName("pa tients")[0 ]; | |
| 370 | ||
| 371 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 372 | //Parse return nod e (includi ng fault) | |
| 373 | var temp PatientTO = new Pati entTO(); | |
| 374 | tempPati entTO.name = $( valueNodes .childNode s[index].g etElements ByTagName( 'name')).t ext(); | |
| 375 | tempPati entTO.ssn = $( valueNodes .childNode s[index].g etElements ByTagName( 'ssn')).te xt() | |
| 376 | tempPati entTO.dob = $( valueNodes .childNode s[index].g etElements ByTagName( 'dob')).te xt(); | |
| 377 | tempPati entTO.pati entname = $(valueNod es.childNo des[index] .getElemen tsByTagNam e('patient Name')).te xt(); | |
| 378 | tempPati entTO.loca lpid = $( valueNodes .childNode s[index].g etElements ByTagName( 'localPid' )).text(); | |
| 379 | ||
| 380 | tempPati entTO.loca lsiteid = _currentSi teCode; | |
| 381 | ||
| 382 | tempPati entTO.pati entflags = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('patien tFlags')). text(); | |
| 383 | tempPati entTO.faul t = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('fau lt')).text (); | |
| 384 | tempPati entTO.valu e =$(value Nodes.chil dNodes[ind ex].getEle mentsByTag Name('pati entTO')).t ext(); | |
| 385 | ||
| 386 | //check if error | |
| 387 | if (temp PatientTO. fault !== "" && temp PatientTO. fault !== null){ | |
| 388 | tempPatien tTO.error = "Get Pat ient Faile d"; | |
| 389 | } | |
| 390 | ||
| 391 | returnRe sult.push( tempPatien tTO); | |
| 392 | }); | |
| 393 | ||
| 394 | } el se { | |
| 395 | //Coul d not find main node | |
| 396 | //Pars e Fault | |
| 397 | var te mpPatientT O = new Pa tientTO(); | |
| 398 | tempPa tientTO.er ror = "Cou ld not fin d return d ata in exp ected stru cture"; | |
| 399 | tempPa tientTO.fa ult = $(da ta.getElem entsByTagN ame('fault ')).text() ; | |
| 400 | tempPa tientTO.va lue = $(da ta.documen tElement). text(); | |
| 401 | ||
| 402 | return Result.pus h(tempPati entTO); | |
| 403 | } | |
| 404 | ||
| 405 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 406 | }, | |
| 407 | ||
| 408 | ma tch_OnErro r: functio n (request , status, error) { | |
| 409 | var returnResu lt = []; | |
| 410 | ||
| 411 | var tempPatien tTO = new PatientTO( ); | |
| 412 | temp PatientTO. value = re quest; | |
| 413 | temp PatientTO. error = er ror; | |
| 414 | ||
| 415 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult.p ush(return PatientTO) ); } | |
| 416 | }, | |
| 417 | ||
| 418 | //VIA SERV ICE: selec t | |
| 419 | se lect: func tion (user TO, patien tTO, targe t, callbac k) { | |
| 420 | var blsubdivis ion = true ; | |
| 421 | ||
| 422 | // target an d directio n are opti onal per d ocumentati on | |
| 423 | var selectWrap per = new SoapWrappe r("select" ); | |
| 424 | ||
| 425 | va r soapMess age = sele ctWrapper. getSoapHea der() + | |
| 426 | "<qu eryBean>" + | |
| 427 | //crea teNode("ta rget", tar get) + | |
| 428 | //crea teNode("di rection", 1) + | |
| 429 | patien tTO.getXML Nodes(blsu bdivision) + | |
| 430 | userTO .getXMLNod es() + | |
| 431 | consum ingApp.get XMLNodes() + | |
| 432 | "</q ueryBean>" + | |
| 433 | se lectWrappe r.getSoapF ooter(); | |
| 434 | ||
| 435 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 436 | el se { callB ackFunctio n = ""; } | |
| 437 | VI AServices. callServic e(soapMess age, VIASe rvices.sel ect_OnSucc ess, VIASe rvices.sel ect_OnErro r); | |
| 438 | ||
| 439 | }, | |
| 440 | ||
| 441 | se lect_OnSuc cess: func tion (data , status) { | |
| 442 | var retur nResult = []; | |
| 443 | ||
| 444 | if ( data.getEl ementsByTa gName("ns2 :selectRes ponse").le ngth > 0) { | |
| 445 | var va lueNodes = data.getE lementsByT agName("ns 2:selectRe sponse")[0 ]; | |
| 446 | ||
| 447 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 448 | var temp PatientTo = new Pat ientTO(); | |
| 449 | ||
| 450 | tempPati entTo.name = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('nam e')).text( ); | |
| 451 | tempPati entTo.ssn = $(value Nodes.chil dNodes[ind ex].getEle mentsByTag Name('ssn' )).text(); | |
| 452 | tempPati entTo.dob = $(value Nodes.chil dNodes[ind ex].getEle mentsByTag Name('dob' )).text(); | |
| 453 | tempPati entTo.pati entname = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('patien tName')).t ext(); | |
| 454 | tempPati entTo.loca lpid = $( valueNodes .childNode s[index].g etElements ByTagName( 'localPid' )).text(); | |
| 455 | ||
| 456 | tempPati entTo.loca lsiteid = _currentSi teCode; | |
| 457 | ||
| 458 | tempPati entTo.pati entflags = $(valueN odes.child Nodes[inde x].getElem entsByTagN ame('patie ntFlags')) .text(); | |
| 459 | ||
| 460 | tempPati entTo.gend er = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('g ender')).t ext(); | |
| 461 | tempPati entTo.mpip id = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('m piPid')).t ext(); | |
| 462 | tempPati entTo.mpic hecksum = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('mpiChe cksum')).t ext(); | |
| 463 | tempPati entTo.loca tion = $( valueNodes .childNode s[index].g etElements ByTagName( 'location' )).text(); | |
| 464 | tempPati entTo.rest ricted = $(valueNod es.childNo des[index] .getElemen tsByTagNam e('restric ted')).tex t(); | |
| 465 | tempPati entTo.conf identialit y = $(val ueNodes.ch ildNodes[i ndex].getE lementsByT agName('co nfidential ity')).tex t(); | |
| 466 | ||
| 467 | //tempPa tientTo.ag e = $(val ueNodes.ch ildNodes[i ndex].getE lementsByT agName('ag e')).text( ); | |
| 468 | //tempPa tientTo.ma ritalStatu s = $(val ueNodes.ch ildNodes[i ndex].getE lementsByT agName('ma ritalStatu s')).text( ); | |
| 469 | //tempPa tientTo.de mographics = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('dem ographics' )).text(); | |
| 470 | //tempPa tientTo.cw ad = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('c wad')).tex t(); | |
| 471 | //tempPa tientTo.se rviceConne cted = $( valueNodes .childNode s[index].g etElements ByTagName( 'serviceCo nnected')) .text(); | |
| 472 | //tempPa tientTo.sc Percent = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('scPerc ent')).tex t(); | |
| 473 | //tempPa tientTo.in patient = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('inpati ent')).tex t(); | |
| 474 | //tempPa tientTo.ne edsMeansTe st = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('n eedsMeansT est')).tex t(); | |
| 475 | //tempPa tientTo.cm orSiteId = $(valueN odes.child Nodes[inde x].getElem entsByTagN ame('cmorS iteId')).t ext(); | |
| 476 | //tempPa tientTo.ac tiveInsura nce = $(v alueNodes. childNodes [index].ge tElementsB yTagName(' activeInsu rance')).t ext(); | |
| 477 | //tempPa tientTo.is TestPatien t = $(val ueNodes.ch ildNodes[i ndex].getE lementsByT agName('is TestPatien t')).text( ); | |
| 478 | //tempPa tientTo.ha sInsurance = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('has Insurance' )).text(); | |
| 479 | //tempPa tientTo.pa tientType = $(value Nodes.chil dNodes[ind ex].getEle mentsByTag Name('pati entType')) .text(); | |
| 480 | //tempPa tientTo.is Veteran = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('isVete ran')).tex t(); | |
| 481 | //tempPa tientTo.is LocallyAss ignedMpiPi d = $(val ueNodes.ch ildNodes[i ndex].getE lementsByT agName('is LocallyAss ignedMpiPi d')).text( ); | |
| 482 | //tempPa tientTo.si tes = $(v alueNodes. childNodes [index].ge tElementsB yTagName(' sites')).t ext(); | |
| 483 | //tempPa tientTo.te am = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('t eam')).tex t(); | |
| 484 | ||
| 485 | tempPati entTo.faul t = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('fau lt')).text (); | |
| 486 | tempPati entTo.valu e = $(valu eNodes.chi ldNodes[in dex]).text (); | |
| 487 | ||
| 488 | //check if error | |
| 489 | if (temp PatientTo. fault !== "" && temp PatientTo. fault !== null){ | |
| 490 | tempPatien tTo.error = "Select Patient Fa iled"; | |
| 491 | } | |
| 492 | ||
| 493 | returnRe sult.push( tempPatien tTo); | |
| 494 | }); | |
| 495 | ||
| 496 | } el se { | |
| 497 | //Coul d not find main node | |
| 498 | //Pars e Fault | |
| 499 | var te mpPatientT o = new P atientTO() ; | |
| 500 | tempPa tientTo.er ror = "Cou ld not fin d return d ata in exp ected stru cture"; | |
| 501 | tempPa tientTo.fa ult = $(da ta.getElem entsByTagN ame('fault ')).text() ; | |
| 502 | tempPa tientTo.va lue = $(da ta.documen tElement). text(); | |
| 503 | ||
| 504 | return Result.pus h(tempPati entTo); | |
| 505 | } | |
| 506 | ||
| 507 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 508 | ||
| 509 | }, | |
| 510 | ||
| 511 | select _OnError: function ( request, s tatus, err or) { | |
| 512 | var returnResu lt = []; | |
| 513 | ||
| 514 | var tempPatien tTo = new PatientTO (); | |
| 515 | temp PatientTo. error = er ror; | |
| 516 | temp PatientTo. fault = $(request. responseXM L.getEleme ntsByTagNa me('faults tring')).t ext(); | |
| 517 | temp PatientTo. value = $( request.re sponseText ).text(); | |
| 518 | ||
| 519 | retu rnResult.p ush(tempPa tientTo); | |
| 520 | ||
| 521 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 522 | }, | |
| 523 | ||
| 524 | ||
| 525 | //VIA SERV ICE: getCo nfidential ity | |
| 526 | // This se rvice was added to t est if we could get back just the sensit ive flag, buit this also retur ns details | |
| 527 | ge tConfident iality: fu nction (us erTO, pati entTO, cal lback) { | |
| 528 | var blsubdivis ion = true ; | |
| 529 | ||
| 530 | // target an d directio n are opti onal per d ocumentati on | |
| 531 | var selectWrap per = new SoapWrappe r("select" ); | |
| 532 | ||
| 533 | va r soapMess age = sele ctWrapper. getSoapHea der() + | |
| 534 | "<qu eryBean>" + | |
| 535 | //crea teNode("ta rget", tar get) + | |
| 536 | //crea teNode("di rection", 1) + | |
| 537 | patien tTO.getXML Nodes(blsu bdivision) + | |
| 538 | userTO .getXMLNod es() + | |
| 539 | consum ingApp.get XMLNodes() + | |
| 540 | "</q ueryBean>" + | |
| 541 | se lectWrappe r.getSoapF ooter(); | |
| 542 | ||
| 543 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 544 | el se { callB ackFunctio n = ""; } | |
| 545 | VI AServices. callServic e(soapMess age, VIASe rvices.get Confidenti ality_OnSu ccess, VIA Services.g etConfiden tiality_On Error); | |
| 546 | ||
| 547 | }, | |
| 548 | ||
| 549 | ge tConfident iality_OnS uccess: fu nction (da ta, status ) { | |
| 550 | var retur nResult = []; | |
| 551 | ||
| 552 | if ( data.getEl ementsByTa gName("ns2 :selectRes ponse").le ngth > 0) { | |
| 553 | var va lueNodes = data.getE lementsByT agName("ns 2:selectRe sponse")[0 ]; | |
| 554 | ||
| 555 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 556 | var temp PatientTo = new Pat ientTO(); | |
| 557 | ||
| 558 | tempPati entTo.name = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('nam e')).text( ); | |
| 559 | tempPati entTo.ssn = $(value Nodes.chil dNodes[ind ex].getEle mentsByTag Name('ssn' )).text(); | |
| 560 | tempPati entTo.dob = $(value Nodes.chil dNodes[ind ex].getEle mentsByTag Name('dob' )).text(); | |
| 561 | tempPati entTo.pati entname = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('patien tName')).t ext(); | |
| 562 | tempPati entTo.loca lpid = $( valueNodes .childNode s[index].g etElements ByTagName( 'localPid' )).text(); | |
| 563 | tempPati entTo.pati entflags = $(valueN odes.child Nodes[inde x].getElem entsByTagN ame('patie ntFlags')) .text(); | |
| 564 | ||
| 565 | ||
| 566 | tempPati entTo.faul t = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('fau lt')).text (); | |
| 567 | tempPati entTo.valu e = $(valu eNodes.chi ldNodes[in dex]).text (); | |
| 568 | ||
| 569 | //check if error | |
| 570 | if (temp PatientTo. fault !== "" && temp PatientTo. fault !== null){ | |
| 571 | tempPatien tTo.error = "Select Patient Fa iled"; | |
| 572 | } | |
| 573 | ||
| 574 | returnRe sult.push( tempPatien tTo); | |
| 575 | }); | |
| 576 | ||
| 577 | } el se { | |
| 578 | //Coul d not find main node | |
| 579 | //Pars e Fault | |
| 580 | var te mpPatientT o = new P atientTO() ; | |
| 581 | tempPa tientTo.er ror = "Cou ld not fin d return d ata in exp ected stru cture"; | |
| 582 | tempPa tientTo.fa ult = $(da ta.getElem entsByTagN ame('fault ')).text() ; | |
| 583 | tempPa tientTo.va lue = $(da ta.documen tElement). text(); | |
| 584 | ||
| 585 | return Result.pus h(tempPati entTo); | |
| 586 | } | |
| 587 | ||
| 588 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 589 | ||
| 590 | }, | |
| 591 | ||
| 592 | getCon fidentiali ty_OnError : function (request, status, e rror) { | |
| 593 | var returnResu lt = []; | |
| 594 | ||
| 595 | var tempPatien tTo = new PatientTO (); | |
| 596 | temp PatientTo. error = er ror; | |
| 597 | temp PatientTo. fault = $(request. responseXM L.getEleme ntsByTagNa me('faults tring')).t ext(); | |
| 598 | temp PatientTo. value = $( request.re sponseText ).text(); | |
| 599 | ||
| 600 | retu rnResult.p ush(tempPa tientTo); | |
| 601 | ||
| 602 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 603 | }, | |
| 604 | ||
| 605 | //VIA SERV ICE: issue Confidenti alityBulle tin | |
| 606 | is sueConfide ntialityBu lletin: fu nction (us erTO, pati entTO, cal lback) { | |
| 607 | var blsubdivis ion = true ; | |
| 608 | ||
| 609 | // target an d directio n are opti onal per d ocumentati on | |
| 610 | var issueConfi dentiality BulletinWr apper = ne w SoapWrap per("issue Confidenti alityBulle tin" ); | |
| 611 | ||
| 612 | va r soapMess age = issu eConfident ialityBull etinWrappe r.getSoapH eader() + | |
| 613 | "<qu eryBean>" + | |
| 614 | patien tTO.getXML NodesMpi(b lsubdivisi on) + | |
| 615 | userTO .getXMLNod es() + | |
| 616 | consum ingApp.get XMLNodes() + | |
| 617 | "</q ueryBean>" + | |
| 618 | is sueConfide ntialityBu lletinWrap per.getSoa pFooter(); | |
| 619 | ||
| 620 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 621 | el se { callB ackFunctio n = ""; } | |
| 622 | VI AServices. callServic e(soapMess age, VIASe rvices.iss ueConfiden tialityBul letin_OnSu ccess, VIA Services.i ssueConfid entialityB ulletin_On Error); | |
| 623 | ||
| 624 | }, | |
| 625 | ||
| 626 | is sueConfide ntialityBu lletin_OnS uccess: fu nction (da ta, status ) { | |
| 627 | var retur nResult = []; | |
| 628 | ||
| 629 | if ( data.getEl ementsByTa gName("res ults").len gth > 0) { | |
| 630 | var va lueNodes = data.getE lementsByT agName("re sults")[0] ; | |
| 631 | ||
| 632 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 633 | var temp TextTo = new TextTo (); | |
| 634 | ||
| 635 | tempText To.name = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('text') ).text(); | |
| 636 | tempText To.fault = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('fault' )).text(); | |
| 637 | tempText To.value = $(valueNo des.childN odes[index ]).text(); | |
| 638 | ||
| 639 | //check if error | |
| 640 | if (temp TextTo.fau lt !== "" && tempTex tTo.fault !== null){ | |
| 641 | tempTextTo .error = " Confidenti ality Fail ed"; | |
| 642 | } | |
| 643 | ||
| 644 | returnRe sult.push( tempTextTo ); | |
| 645 | }); | |
| 646 | ||
| 647 | } el se { | |
| 648 | //Coul d not find main node | |
| 649 | //Pars e Fault | |
| 650 | var te mpTextTo = new Text To(); | |
| 651 | tempTe xtTo.error = "Could not find r eturn data in expect ed structu re"; | |
| 652 | tempTe xtTo.fault = $(data. getElement sByTagName ('fault')) .text(); | |
| 653 | tempTe xtTo.value = $(data. documentEl ement).tex t(); | |
| 654 | ||
| 655 | return Result.pus h(tempText To); | |
| 656 | } | |
| 657 | ||
| 658 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 659 | ||
| 660 | }, | |
| 661 | ||
| 662 | issueC onfidentia lityBullet in_OnError : function (request, status, e rror) { | |
| 663 | var returnResu lt = []; | |
| 664 | ||
| 665 | var tempTextTo = new Te xtTo(); | |
| 666 | temp TextTo.err or = error ; | |
| 667 | temp TextTo.fau lt = $(r equest.res ponseXML.g etElements ByTagName( 'faultstri ng')).text (); | |
| 668 | temp TextTo.val ue = $(req uest.respo nseText).t ext(); | |
| 669 | ||
| 670 | retu rnResult.p ush(tempTe xtTo); | |
| 671 | ||
| 672 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 673 | }, | |
| 674 | ||
| 675 | ||
| 676 | ||
| 677 | ||
| 678 | ||
| 679 | ||
| 680 | ||
| 681 | ||
| 682 | ||
| 683 | //VIA SERV ICE: getNo teTitles | |
| 684 | getNot eTitles: f unction (u serTO, tar get, callb ack) { | |
| 685 | var getNoteTit lesWrapper = new Soa pWrapper(" getNoteTit les" ); | |
| 686 | ||
| 687 | va r soapMess age = getN oteTitlesW rapper.get SoapHeader () + | |
| 688 | "< queryBean> " + | |
| 689 | crea teNode("ta rget", enc odeXml(tar get)) + | |
| 690 | user TO.getXMLN odes() + | |
| 691 | co nsumingApp .getXMLNod es() + | |
| 692 | "< /queryBean >" + | |
| 693 | getNot eTitlesWra pper.getSo apFooter() ; | |
| 694 | ||
| 695 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 696 | el se { callB ackFunctio n = ""; } | |
| 697 | VI AServices. callServic e(soapMess age, VIASe rvices.get NoteTitles _OnSuccess , VIAServi ces.getNot eTitles_On Error); | |
| 698 | }, | |
| 699 | ||
| 700 | ge tNoteTitle s_OnSucces s: functio n (data, s tatus) { | |
| 701 | var returnResu lt = []; | |
| 702 | ||
| 703 | //Ch eck for re turn node | |
| 704 | if ( data.getEl ementsByTa gName("ns2 :TaggedTex tArray").l ength > 0) { | |
| 705 | var va lueNodes = (data.get ElementsBy TagName("n s2:TaggedT extArray") [0]).getEl ementsByTa gName('tag gedResults ')[0]; | |
| 706 | ||
| 707 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 708 | //Parse return nod e (includi ng fault) | |
| 709 | var temp NoteTitle = new Note Title(); | |
| 710 | tempNote Title.id = va lueNodes.c hildNodes[ index].get ElementsBy TagName('t ag')[0].te xtContent; | |
| 711 | // NOTE: 'textArra y' node is duplicate d in struc ture and c annot be g otten by n ame | |
| 712 | tempNote Title.name = va lueNodes.c hildNodes[ index].chi ldNodes[1] .firstChil d.textCont ent; | |
| 713 | tempNote Title.faul t = $(valu eNodes.chi ldNodes[in dex].getEl ementsByTa gName('fau lt')).text (); | |
| 714 | tempNote Title.valu e =$(value Nodes.chil dNodes[ind ex]).text( ); | |
| 715 | ||
| 716 | //check if error | |
| 717 | if (temp NoteTitle. fault !== "" && temp NoteTitle. fault !== null){ | |
| 718 | tempNoteTi tle.error = "Get Not e Titles F ailed"; | |
| 719 | } | |
| 720 | ||
| 721 | returnRe sult.push( tempNoteTi tle); | |
| 722 | }); | |
| 723 | ||
| 724 | } el se { | |
| 725 | //Coul d not find main node | |
| 726 | //Pars e Fault | |
| 727 | var te mpNoteTitl e = new No teTitle(); | |
| 728 | tempNo teTitle.er ror = "Cou ld not fin d return d ata in exp ected stru cture"; | |
| 729 | tempNo teTitle.fa ult = $(da ta.getElem entsByTagN ame('fault ')).text() ; | |
| 730 | tempNo teTitle.va lue = $(da ta.documen tElement). text(); | |
| 731 | ||
| 732 | return Result.pus h(tempNote Title); | |
| 733 | } | |
| 734 | ||
| 735 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 736 | }, | |
| 737 | ||
| 738 | ge tNoteTitle s_OnError: function (request, status, er ror) { | |
| 739 | var returnResu lt = []; | |
| 740 | ||
| 741 | var tempNoteTi tle = new NoteTitle( ); | |
| 742 | temp NoteTitle. error = er ror; | |
| 743 | temp NoteTitle. fault = $(request. responseXM L.getEleme ntsByTagNa me('faults tring')).t ext(); | |
| 744 | temp NoteTitle. value = $( request.re sponseText ).text(); | |
| 745 | ||
| 746 | retu rnResult.p ush(tempNo teTitle); | |
| 747 | ||
| 748 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 749 | }, | |
| 750 | ||
| 751 | //VIA SERV ICE: isCon sultNote | |
| 752 | is ConsultNot e: functio n (userTO, noteId, c allback) { | |
| 753 | // target an d directio n are opti onal per d ocumentati on | |
| 754 | var isConsultN oteWrapper = new Soa pWrapper(" isConsultN ote" ); | |
| 755 | ||
| 756 | va r soapMess age = isCo nsultNoteW rapper.get SoapHeader () + | |
| 757 | "< queryBean> " + | |
| 758 | crea teNode("it emId", not eId) + | |
| 759 | crea teNode("re cordSiteCo de", userT O.getSiteI d()) + | |
| 760 | us erTO.getXM LNodes() + | |
| 761 | co nsumingApp .getXMLNod es() + | |
| 762 | "</q ueryBean>" + | |
| 763 | is ConsultNot eWrapper.g etSoapFoot er(); | |
| 764 | ||
| 765 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 766 | el se { callB ackFunctio n = ""; } | |
| 767 | VI AServices. callServic e(soapMess age, VIASe rvices.isC onsultNote _OnSuccess , VIAServi ces.isCons ultNote_On Error); | |
| 768 | ||
| 769 | }, | |
| 770 | ||
| 771 | is ConsultNot e_OnSucces s: functio n (data, s tatus) { | |
| 772 | var retur nResult = []; | |
| 773 | ||
| 774 | if ( data.getEl ementsByTa gName("ns2 :isConsult NoteRespon se").lengt h > 0) { | |
| 775 | var va lueNodes = data.getE lementsByT agName("ns 2:isConsul tNoteRespo nse")[0]; | |
| 776 | ||
| 777 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 778 | var temp TextTo = new TextTo (); | |
| 779 | ||
| 780 | tempText To.text = $(valueNod es.childNo des[index] .getElemen tsByTagNam e('text')) .text(); | |
| 781 | tempText To.fault = $( valueNodes .childNode s[index].g etElements ByTagName( 'fault')). text(); | |
| 782 | tempText To.value = $(valueNo des.childN odes[index ]).text(); | |
| 783 | ||
| 784 | //check if error | |
| 785 | if (temp TextTo.fau lt !== "" && tempTex tTo.fault !== null){ | |
| 786 | tempTextTo .error = " Is Consult Note Fail ed"; | |
| 787 | } | |
| 788 | ||
| 789 | returnRe sult.push( tempTextTo ); | |
| 790 | }); | |
| 791 | ||
| 792 | } el se { | |
| 793 | //Coul d not find main node | |
| 794 | //Pars e Fault | |
| 795 | var te mpTextTo = new TextT o(); | |
| 796 | tempTe xtTo.error = "Could not find r eturn data in expect ed structu re"; | |
| 797 | tempTe xtTo.fault = $(data. getElement sByTagName ('fault')) .text(); | |
| 798 | tempTe xtTo.value = $(data. documentEl ement).tex t(); | |
| 799 | ||
| 800 | return Result.pus h(tempText To); | |
| 801 | } | |
| 802 | ||
| 803 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 804 | ||
| 805 | }, | |
| 806 | ||
| 807 | isCons ultNote_On Error: fun ction (req uest, stat us, error) { | |
| 808 | var returnResu lt = []; | |
| 809 | ||
| 810 | var tempTextTo = new Te xtTo(); | |
| 811 | temp TextTo.err or = error ; | |
| 812 | temp TextTo.fau lt = $(r equest.res ponseXML.g etElements ByTagName( 'faultstri ng')).text (); | |
| 813 | temp TextTo.val ue = $(req uest.respo nseText).t ext(); | |
| 814 | ||
| 815 | retu rnResult.p ush(tempTe xtTo); | |
| 816 | ||
| 817 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 818 | }, | |
| 819 | ||
| 820 | //VIA SERV ICE: isSur geryNote | |
| 821 | is SurgeryNot e: functio n (userTO, noteId, c allback) { | |
| 822 | // target an d directio n are opti onal per d ocumentati on | |
| 823 | var isSurgeryN oteWrapper = new Soa pWrapper(" isSurgeryN ote" ); | |
| 824 | ||
| 825 | va r soapMess age = isSu rgeryNoteW rapper.get SoapHeader () + | |
| 826 | "< queryBean> " + | |
| 827 | crea teNode("it emId", not eId) + | |
| 828 | crea teNode("re cordSiteCo de", userT O.getSiteI d()) + | |
| 829 | us erTO.getXM LNodes() + | |
| 830 | co nsumingApp .getXMLNod es() + | |
| 831 | "</q ueryBean>" + | |
| 832 | is SurgeryNot eWrapper.g etSoapFoot er(); | |
| 833 | ||
| 834 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 835 | el se { callB ackFunctio n = ""; } | |
| 836 | VI AServices. callServic e(soapMess age, VIASe rvices.isS urgeryNote _OnSuccess , VIAServi ces.isSurg eryNote_On Error); | |
| 837 | ||
| 838 | }, | |
| 839 | ||
| 840 | is SurgeryNot e_OnSucces s: functio n (data, s tatus) { | |
| 841 | var retur nResult = []; | |
| 842 | ||
| 843 | if ( data.getEl ementsByTa gName("ns2 :isSurgery NoteRespon se").lengt h > 0) { | |
| 844 | var va lueNodes = data.getE lementsByT agName("ns 2:isSurger yNoteRespo nse")[0]; | |
| 845 | ||
| 846 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 847 | var temp TextTo = new TextTo (); | |
| 848 | ||
| 849 | tempText To.text = $(valueNod es.childNo des[index] .getElemen tsByTagNam e('text')) .text(); | |
| 850 | tempText To.fault = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('fault' )).text(); | |
| 851 | tempText To.value = $(valueNo des.childN odes[index ]).text(); | |
| 852 | ||
| 853 | //check if error | |
| 854 | if (temp TextTo.fau lt !== "" && tempTex tTo.fault !== null){ | |
| 855 | tempTextTo .error = " Is Surgery Note Fail ed"; | |
| 856 | } | |
| 857 | ||
| 858 | returnRe sult.push( tempTextTo ); | |
| 859 | }); | |
| 860 | ||
| 861 | } el se { | |
| 862 | //Coul d not find main node | |
| 863 | //Pars e Fault | |
| 864 | var te mpTextTo = new TextT o(); | |
| 865 | tempTe xtTo.error = "Could not find r eturn data in expect ed structu re"; | |
| 866 | tempTe xtTo.fault = $(data. getElement sByTagName ('fault')) .text(); | |
| 867 | tempTe xtTo.value = $(data. documentEl ement).tex t(); | |
| 868 | ||
| 869 | return Result.pus h(tempText To); | |
| 870 | } | |
| 871 | ||
| 872 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 873 | ||
| 874 | }, | |
| 875 | ||
| 876 | isSurg eryNote_On Error: fun ction (req uest, stat us, error) { | |
| 877 | var returnResu lt = []; | |
| 878 | ||
| 879 | var tempTextTo = new Te xtTo(); | |
| 880 | temp TextTo.err or = error ; | |
| 881 | temp TextTo.fau lt = $(r equest.res ponseXML.g etElements ByTagName( 'faultstri ng')).text (); | |
| 882 | temp TextTo.val ue = $(req uest.respo nseText).t ext(); | |
| 883 | ||
| 884 | retu rnResult.p ush(tempTe xtTo); | |
| 885 | ||
| 886 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 887 | }, | |
| 888 | ||
| 889 | //VIA SERV ICE: isCos ignerRequi red | |
| 890 | is CosignerRe quired: fu nction (us erTO, note Id, callba ck) { | |
| 891 | // target an d directio n are opti onal per d ocumentati on | |
| 892 | var isCosigner RequiredWr apper = ne w SoapWrap per("isCos ignerRequi red" ); | |
| 893 | ||
| 894 | va r soapMess age = isCo signerRequ iredWrappe r.getSoapH eader() + | |
| 895 | "< queryBean> " + | |
| 896 | crea teNode("it emId", not eId) + //The queryBean. itemId nee ds to be a numeric n ote defini tion ien ( note defin ition id) | |
| 897 | crea teNode("re cordSiteCo de", userT O.getSiteI d()) + | |
| 898 | us erTO.getXM LNodes() + | |
| 899 | co nsumingApp .getXMLNod es() + | |
| 900 | "</q ueryBean>" + | |
| 901 | is CosignerRe quiredWrap per.getSoa pFooter(); | |
| 902 | ||
| 903 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 904 | el se { callB ackFunctio n = ""; } | |
| 905 | VI AServices. callServic e(soapMess age, VIASe rvices.isC osignerReq uired_OnSu ccess, VIA Services.i sCosignerR equired_On Error); | |
| 906 | ||
| 907 | }, | |
| 908 | ||
| 909 | is CosignerRe quired_OnS uccess: fu nction (da ta, status ) { | |
| 910 | var retur nResult = []; | |
| 911 | ||
| 912 | if ( data.getEl ementsByTa gName("ns2 :isCosigne rRequiredR esponse"). length > 0 ) { | |
| 913 | var va lueNodes = data.getE lementsByT agName("ns 2:isCosign erRequired Response") [0]; | |
| 914 | ||
| 915 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 916 | var temp TextTo = new TextTo (); | |
| 917 | ||
| 918 | tempText To.text = $(valueNod es.childNo des[index] .getElemen tsByTagNam e('text')) .text(); | |
| 919 | tempText To.fault = $( valueNodes .childNode s[index].g etElements ByTagName( 'fault')). text(); | |
| 920 | tempText To.value = $(valueNo des.childN odes[index ]).text(); | |
| 921 | ||
| 922 | //check if error | |
| 923 | if (temp TextTo.fau lt !== "" && tempTex tTo.fault !== null){ | |
| 924 | tempTextTo .error = " Is Cosigne r Required Failed"; | |
| 925 | } | |
| 926 | ||
| 927 | returnRe sult.push( tempTextTo ); | |
| 928 | }); | |
| 929 | ||
| 930 | } el se { | |
| 931 | //Coul d not find main node | |
| 932 | //Pars e Fault | |
| 933 | var te mpTextTo = new TextT o(); | |
| 934 | tempTe xtTo.error = "Could not find r eturn data in expect ed structu re"; | |
| 935 | tempTe xtTo.fault = $(data. getElement sByTagName ('fault')) .text(); | |
| 936 | tempTe xtTo.value = $(data. documentEl ement).tex t(); | |
| 937 | ||
| 938 | return Result.pus h(tempText To); | |
| 939 | } | |
| 940 | ||
| 941 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 942 | ||
| 943 | }, | |
| 944 | ||
| 945 | isCosi gnerRequir ed_OnError : function (request, status, e rror) { | |
| 946 | var returnResu lt = []; | |
| 947 | ||
| 948 | var tempTextTo = new Te xtTo(); | |
| 949 | temp TextTo.err or = error ; | |
| 950 | temp TextTo.fau lt = $(r equest.res ponseXML.g etElements ByTagName( 'faultstri ng')).text (); | |
| 951 | temp TextTo.val ue = $(req uest.respo nseText).t ext(); | |
| 952 | ||
| 953 | retu rnResult.p ush(tempTe xtTo); | |
| 954 | ||
| 955 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 956 | }, | |
| 957 | ||
| 958 | //VIA SERV ICE: getLo cations | |
| 959 | ge tLocations : function (userTO, target, ca llback) { | |
| 960 | // target an d directio n are opti onal per d ocumentati on | |
| 961 | var getLocatio nsWrapper = new Soap Wrapper("g etLocation s" ); | |
| 962 | ||
| 963 | va r soapMess age = getL ocationsWr apper.getS oapHeader( ) + | |
| 964 | "< queryBean> " + | |
| 965 | crea teNode("ta rget", enc odeXml(tar get)) + | |
| 966 | crea teNode("di rection", 1) + | |
| 967 | us erTO.getXM LNodes() + | |
| 968 | co nsumingApp .getXMLNod es() + | |
| 969 | "</q ueryBean>" + | |
| 970 | ge tLocations Wrapper.ge tSoapFoote r(); | |
| 971 | ||
| 972 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 973 | el se { callB ackFunctio n = ""; } | |
| 974 | VI AServices. callServic e(soapMess age, VIASe rvices.get Locations_ OnSuccess, VIAServic es.getLoca tions_OnEr ror); | |
| 975 | }, | |
| 976 | ||
| 977 | ge tLocations _OnSuccess : function (data, st atus) { | |
| 978 | var returnResu lt = []; | |
| 979 | ||
| 980 | if ( data.getEl ementsByTa gName("ns2 :TaggedHos pitalLocat ionArray") .length > 0) { | |
| 981 | var va lueNodes = data.getE lementsByT agName("lo cations")[ 0]; | |
| 982 | ||
| 983 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 984 | var temp Location = new Locat ion(); | |
| 985 | tempLoca tion.id = $( valueNodes .childNode s[index].g etElements ByTagName( 'id')).tex t(); | |
| 986 | tempLoca tion.name = $( valueNodes .childNode s[index].g etElements ByTagName( 'name')).t ext(); | |
| 987 | tempLoca tion.fault = $( valueNodes .childNode s[index].g etElements ByTagName( 'fault')). text(); | |
| 988 | tempLoca tion.value = $(value Nodes.chil dNodes[ind ex]).text( ); | |
| 989 | ||
| 990 | //check if error | |
| 991 | if (temp Location.f ault !== " " && tempL ocation.fa ult !== nu ll){ | |
| 992 | tempLocati on.error = "Get Loca tion Faile d"; | |
| 993 | } | |
| 994 | ||
| 995 | returnRe sult.push( tempLocati on); | |
| 996 | }); | |
| 997 | } el se { | |
| 998 | //Coul d not find main node | |
| 999 | //Pars e Fault | |
| 1000 | var te mpLocation = new Loc ation(); | |
| 1001 | tempLo cation.err or = "Coul d not find return da ta in expe cted struc ture"; | |
| 1002 | tempLo cation.fau lt = $(dat a.getEleme ntsByTagNa me('fault' )).text(); | |
| 1003 | tempLo cation.val ue = $(dat a.document Element).t ext(); | |
| 1004 | ||
| 1005 | return Result.pus h(tempLoca tion); | |
| 1006 | } | |
| 1007 | ||
| 1008 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 1009 | }, | |
| 1010 | ||
| 1011 | ge tLocations _OnError: function ( request, s tatus, err or) { | |
| 1012 | var returnResu lt = []; | |
| 1013 | ||
| 1014 | var tempLocati on = new L ocation(); | |
| 1015 | temp Location.e rror = err or; | |
| 1016 | temp Location.f ault = $ (request.r esponseXML .getElemen tsByTagNam e('faultst ring')).te xt(); | |
| 1017 | temp Location.v alue = $(r equest.res ponseText) .text(); | |
| 1018 | ||
| 1019 | retu rnResult.p ush(tempLo cation); | |
| 1020 | ||
| 1021 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 1022 | }, | |
| 1023 | ||
| 1024 | // VIA SERVIC E: getVisi ts | |
| 1025 | ge tVisits: f unction (u serTO, pat ientTO, st artDate, e ndDate, ca llback) { | |
| 1026 | var blsubdivis ion = true ; | |
| 1027 | ||
| 1028 | // target an d directio n are opti onal per d ocumentati on | |
| 1029 | var getVisitsW rapper = n ew SoapWra pper("getV isits" ); | |
| 1030 | ||
| 1031 | va r soapMess age = getV isitsWrapp er.getSoap Header() + | |
| 1032 | "<qu eryBean>" + | |
| 1033 | //crea teNode("ta rget", tar get) + | |
| 1034 | create Node("dire ction", 1) + | |
| 1035 | patien tTO.getXML NodesMpi(b lsubdivisi on) + | |
| 1036 | userTO .getXMLNod es() + | |
| 1037 | create Node("star tDate", st artDate.yy yymmdd()) + | |
| 1038 | create Node("endD ate", endD ate.yyyymm dd()) + | |
| 1039 | consum ingApp.get XMLNodes() + | |
| 1040 | "</q ueryBean>" + | |
| 1041 | ge tVisitsWra pper.getSo apFooter() ; | |
| 1042 | ||
| 1043 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 1044 | el se { callB ackFunctio n = ""; } | |
| 1045 | VI AServices. callServic e(soapMess age, VIASe rvices.get Visits_OnS uccess, VI AServices. getVisits_ OnError); | |
| 1046 | ||
| 1047 | }, | |
| 1048 | ||
| 1049 | ge tVisits_On Success: f unction (d ata, statu s) { | |
| 1050 | var retur nResult = []; | |
| 1051 | ||
| 1052 | // find count: da ta.getElem entsByTagN ame("ns2:g etVisitsRe sponse").l ength | |
| 1053 | "ns2:Tagg edVisitArr ay" | |
| 1054 | ||
| 1055 | if ( data.getEl ementsByTa gName("ns2 :TaggedVis itArray"). length > 0 ) { | |
| 1056 | var va lueNodes = data.getE lementsByT agName("vi sits")[0]; | |
| 1057 | ||
| 1058 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 1059 | var temp VisitTo = new Visit TO(); | |
| 1060 | ||
| 1061 | tempVisi tTo.type = $( valueNodes .childNode s[index].g etElements ByTagName( 'type')).t ext(); | |
| 1062 | tempVisi tTo.locati on.id = $( valueNodes .childNode s[index].g etElements ByTagName( 'id')).tex t(); | |
| 1063 | tempVisi tTo.locati on.name = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('n ame')).tex t(); | |
| 1064 | tempVisi tTo.timest amp = $( valueNodes .childNode s[index].g etElements ByTagName( 'timestamp ')).text() ; | |
| 1065 | tempVisi tTo.status = $( valueNodes .childNode s[index].g etElements ByTagName( 'status')) .text(); | |
| 1066 | tempVisi tTo.fault = $(valueN odes.child Nodes[inde x].getElem entsByTagN ame('fault ')).text() ; | |
| 1067 | tempVisi tTo.value = $(valueN odes.child Nodes[inde x]).text() ; | |
| 1068 | ||
| 1069 | //check if error | |
| 1070 | if (temp VisitTo.fa ult !== "" && tempVi sitTo.faul t !== null ){ | |
| 1071 | tempVisitT o.error = "Get Visit s Failed"; | |
| 1072 | } | |
| 1073 | if (valu eNodes.len gth == 0){ | |
| 1074 | var tempVi sitTo = n ew VisitTO (); | |
| 1075 | tempVisitT o.error = "No Visits Found"; | |
| 1076 | tempVisitT o.fault = "No Visits Found"; | |
| 1077 | tempVisitT o.value = "No Visits Found"; | |
| 1078 | ||
| 1079 | } | |
| 1080 | ||
| 1081 | returnRe sult.push( tempVisitT o); | |
| 1082 | }); | |
| 1083 | ||
| 1084 | } el se { | |
| 1085 | //Coul d not find main node | |
| 1086 | //Pars e Fault | |
| 1087 | var te mpVisitTo = new Visi tTO(); | |
| 1088 | tempVi sitTo.erro r = "Could not find return dat a in expec ted struct ure"; | |
| 1089 | tempVi sitTo.faul t = $(data .getElemen tsByTagNam e('fault') ).text(); | |
| 1090 | tempVi sitTo.valu e = $(data .documentE lement).te xt(); | |
| 1091 | ||
| 1092 | return Result.pus h(tempVisi tTo); | |
| 1093 | } | |
| 1094 | ||
| 1095 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 1096 | ||
| 1097 | }, | |
| 1098 | ||
| 1099 | getVis its_OnErro r: functio n (request , status, error) { | |
| 1100 | var returnResu lt = []; | |
| 1101 | ||
| 1102 | var tempVisitT o = new V isitTO(); | |
| 1103 | temp VisitTo.er ror = erro r; | |
| 1104 | temp VisitTo.fa ult = $( request.re sponseXML. getElement sByTagName ('faultstr ing')).tex t(); | |
| 1105 | temp VisitTo.va lue = $(re quest.resp onseText). text(); | |
| 1106 | ||
| 1107 | retu rnResult.p ush(tempVi sitTo); | |
| 1108 | ||
| 1109 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 1110 | }, | |
| 1111 | ||
| 1112 | //VIA SERV ICE: cprsU serLookup | |
| 1113 | cprsUs erLookup: function ( userTO, ta rget, call back) { | |
| 1114 | var cprsUserLo okupWrappe r = new So apWrapper( "cprsUserL ookup" ); | |
| 1115 | ||
| 1116 | va r soapMess age = cprs UserLookup Wrapper.ge tSoapHeade r() + | |
| 1117 | "< queryBean> " + | |
| 1118 | crea teNode("ta rget", enc odeXml(tar get)) + | |
| 1119 | //cr eateNode(" direction" , 1) + | |
| 1120 | user TO.getXMLN odes() + | |
| 1121 | co nsumingApp .getXMLNod es() + | |
| 1122 | "< /queryBean >" + | |
| 1123 | cprsUs erLookupWr apper.getS oapFooter( ); | |
| 1124 | ||
| 1125 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 1126 | el se { callB ackFunctio n = ""; } | |
| 1127 | VI AServices. callServic e(soapMess age, VIASe rvices.cpr sUserLooku p_OnSucces s, VIAServ ices.cprsU serLookup_ OnError); | |
| 1128 | }, | |
| 1129 | ||
| 1130 | cp rsUserLook up_OnSucce ss: functi on (data, status) { | |
| 1131 | var returnResu lt = []; | |
| 1132 | ||
| 1133 | //Ch eck for re turn node | |
| 1134 | if ( data.getEl ementsByTa gName("use rs").lengt h > 0) { | |
| 1135 | var va lueNodes = (data.get ElementsBy TagName("u sers")[0]) ; | |
| 1136 | ||
| 1137 | //take apeek = da ta.getElem entsByTagN ame("ns2:U serArray") ; | |
| 1138 | //retu rnResult.p ush('Patie nt,' + $(d ata.getEle mentsByTag Name('user s')).text( )); | |
| 1139 | ||
| 1140 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 1141 | //Parse return nod e (includi ng fault) | |
| 1142 | var temp UserTO = n ew UserTO( ); | |
| 1143 | tempUser TO.name = $(valueNod es.childNo des[index] .getElemen tsByTagNam e('name')) .text(); | |
| 1144 | tempUser TO.duz = $ (valueNode s.childNod es[index]. getElement sByTagName ('DUZ')).t ext(); | |
| 1145 | tempUser TO.fault = $(valueNo des.childN odes[index ].getEleme ntsByTagNa me('fault' )).text(); | |
| 1146 | tempUser TO.value = $(valueNo des.childN odes[index ]).text(); | |
| 1147 | ||
| 1148 | //check if error | |
| 1149 | if (temp UserTO.fau lt !== "" && tempUse rTO.fault !== null){ | |
| 1150 | tempUserTO .error = " Get CPRS U sers Faile d"; | |
| 1151 | } | |
| 1152 | ||
| 1153 | returnRe sult.push( tempUserTO ); | |
| 1154 | }); | |
| 1155 | ||
| 1156 | } el se { | |
| 1157 | //Coul d not find main node | |
| 1158 | //Pars e Fault | |
| 1159 | var te mpUserTO = new UserT O(); | |
| 1160 | tempUs erTO.error = "Could not find r eturn data in expect ed structu re"; | |
| 1161 | tempUs erTO.fault = $(data. getElement sByTagName ('fault')) .text(); | |
| 1162 | tempUs erTO.value = $(data. documentEl ement).tex t(); | |
| 1163 | ||
| 1164 | return Result.pus h(tempUser TO); | |
| 1165 | } | |
| 1166 | ||
| 1167 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 1168 | }, | |
| 1169 | ||
| 1170 | cp rsUserLook up_OnError : function (request, status, e rror) { | |
| 1171 | var returnResu lt = []; | |
| 1172 | ||
| 1173 | var tempUserTO = new Use rTO(); | |
| 1174 | temp UserTO.err or = error ; | |
| 1175 | temp UserTO.fau lt = $(r equest.res ponseXML.g etElements ByTagName( 'faultstri ng')).text (); | |
| 1176 | temp UserTO.val ue = $(req uest.respo nseText).t ext(); | |
| 1177 | ||
| 1178 | retu rnResult.p ush(tempUs erTO); | |
| 1179 | ||
| 1180 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 1181 | }, | |
| 1182 | ||
| 1183 | //VIA SERV ICE: write Notes | |
| 1184 | wr iteNote: f unction (u serTO, pat ientTO, ti tleId, enc ounterStri ng, cosign erDUZ, con tent, call back) { | |
| 1185 | var blsubdivis ion = true ; | |
| 1186 | ||
| 1187 | // encounter date | |
| 1188 | var myDate = n ew Date(); | |
| 1189 | var encounterD ate = getV istaDate(n ew Date()) ; | |
| 1190 | //Ch ange lineb reaks | |
| 1191 | cont ent = viaL ineBreaks( content); | |
| 1192 | ||
| 1193 | // t arget and direction are option al per doc umentation | |
| 1194 | var writeNoteW rapper = n ew SoapWra pper("writ eNote" ); | |
| 1195 | ||
| 1196 | va r soapMess age = writ eNoteWrapp er.getSoap Header() + | |
| 1197 | crea teNode("ti tleIEN", t itleId)+ | |
| 1198 | crea teNode("en counterStr ing",encou nterString ); //LOCA TIONIEN;YY YYMMDD;ENC OUNTERTYPE | |
| 1199 | ||
| 1200 | if (co signerDUZ !== undefi ned && cos ignerDUZ ! = null && cosignerDU Z.length > 0){ | |
| 1201 | soapMess age += cr eateNode(" cosignerDU Z",cosigne rDUZ ); | |
| 1202 | } | |
| 1203 | ||
| 1204 | soapMe ssage += createNode ("text", c ontent) + | |
| 1205 | "< queryBean> " + | |
| 1206 | patien tTO.getXML NodesMpi(b lsubdivisi on) + | |
| 1207 | userTO .getXMLNod es() + | |
| 1208 | create Node("reco rdSiteCode ", (blsubd ivision ? patientTO. getSubDivi sion() : p atientTO.g etSiteId() )) + | |
| 1209 | consum ingApp.get XMLNodes() + | |
| 1210 | "< /queryBean >" + | |
| 1211 | wr iteNoteWra pper.getSo apFooter() ; | |
| 1212 | ||
| 1213 | // <encounter String>887 ;3140121.1 63242;E</e ncounterSt ring> | |
| 1214 | // Location ID – Mig ht need to use the V IA service “getHos pitalLocat ions†to retrieve the valid location I Ds by name | |
| 1215 | // 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. | |
| 1216 | // i.e. 313 0715.16324 2 represen ts July 15 , 2013 4:3 2:42. | |
| 1217 | // The Vist A date for mat is Vis taYear + m mdd.hhmmss . | |
| 1218 | // The only weird thi ng is the VistA year . It is ca lculated u sing the c urrent yea r minus 17 00. | |
| 1219 | // So Februar y 7, 2017 08:00 woul d be 31702 07.080000. Where 317 is 2017 â €“ 1700. | |
| 1220 | ||
| 1221 | // Encounter Type – I can be o ne of thre e possible values: | |
| 1222 | // A (AMB ULATORY), | |
| 1223 | // H (HOS PITALIZATI ON) | |
| 1224 | // E (EVE NT- HISTOR ICAL) | |
| 1225 | ||
| 1226 | ||
| 1227 | if (typeof c allback == = "functio n") { call BackFuncti on = callb ack; } | |
| 1228 | el se { callB ackFunctio n = ""; } | |
| 1229 | VI AServices. callServic e(soapMess age, VIASe rvices.wri teNote_OnS uccess, VI AServices. writeNote_ OnError); | |
| 1230 | }, | |
| 1231 | ||
| 1232 | wr iteNote_On Success: f unction (d ata, statu s) { | |
| 1233 | var returnResu lt = []; | |
| 1234 | ||
| 1235 | //Ch eck for re turn node | |
| 1236 | if ( data.getEl ementsByTa gName('soa p:Envelope ').length > 0) { | |
| 1237 | var va lueNodes = data.getE lementsByT agName('so ap:Envelop e')[0].chi ldNodes[0] .childNode s[0]; | |
| 1238 | ||
| 1239 | $(valu eNodes).ch ildren().e ach(functi on (index) { | |
| 1240 | //Parse return nod e (includi ng fault) | |
| 1241 | var note ResultTo = new NoteR esultTO(); | |
| 1242 | noteResu ltTo.id = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('i d')).text( ); | |
| 1243 | noteResu ltTo.total pages = $( valueNodes .childNode s[index].g etElements ByTagName( 'totalPage s')).text( ) | |
| 1244 | noteResu ltTo.lastp agerecd = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('l astPageRec d')).text( ); | |
| 1245 | noteResu ltTo.fault = $(va lueNodes.c hildNodes[ index].get ElementsBy TagName('f ault')).te xt(); | |
| 1246 | noteResu ltTo.value = $( valueNodes .childNode s[index]). text(); | |
| 1247 | ||
| 1248 | //check if error | |
| 1249 | if (note ResultTo.f ault !== " " && noteR esultTo.fa ult !== nu ll){ | |
| 1250 | noteResult To.error = "Note Wri te Failed" ; | |
| 1251 | } | |
| 1252 | ||
| 1253 | returnRe sult.push( noteResult To); | |
| 1254 | }); | |
| 1255 | ||
| 1256 | } el se { | |
| 1257 | //Coul d not find main node | |
| 1258 | //Pars e Fault | |
| 1259 | var no teResultTo = new Not eResultTO( ); | |
| 1260 | noteRe sultTo.err or = "Coul d not find return da ta in expe cted struc ture"; | |
| 1261 | noteRe sultTo.fau lt = $(dat a.getEleme ntsByTagNa me('fault' )).text(); | |
| 1262 | noteRe sultTo.val ue = $(dat a.document Element).t ext(); | |
| 1263 | ||
| 1264 | return Result.pus h(noteResu ltTo); | |
| 1265 | } | |
| 1266 | ||
| 1267 | if ( callBackFu nction !== "") { cal lBackFunct ion(return Result); } | |
| 1268 | ||
| 1269 | }, | |
| 1270 | ||
| 1271 | wr iteNote_On Error: fun ction (req uest, stat us, error) { | |
| 1272 | var returnResu lt = []; | |
| 1273 | ||
| 1274 | var noteResult To = new N oteResultT O(); | |
| 1275 | note ResultTo.e rror = err or; | |
| 1276 | note ResultTo.f ault = $ (request.r esponseXML .getElemen tsByTagNam e('faultst ring')).te xt(); | |
| 1277 | note ResultTo.v alue = $(r equest.res ponseText) .text(); | |
| 1278 | ||
| 1279 | retu rnResult.p ush(noteRe sultTo); | |
| 1280 | ||
| 1281 | if (callBack Function ! == "") { c allBackFun ction(retu rnResult); } | |
| 1282 | ||
| 1283 | }, | |
| 1284 | ||
| 1285 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.