Produced by Araxis Merge on 12/4/2017 8:32:33 AM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | VCCM.zip\VCCM\CRM_solutions\VCCMResources\VCCMResources_1_0_0_15.zip\WebResources | ftp_ViaServiceLibraryjsViaServiceLibraryjsA18A07F9-F9E3-E611-944A-0050568D743D | Fri May 19 20:29:42 2017 UTC |
| 2 | VCCM.zip\VCCM\CRM_solutions\VCCMResources\VCCMResources_1_0_0_15.zip\WebResources | ftp_ViaServiceLibraryjsViaServiceLibraryjsA18A07F9-F9E3-E611-944A-0050568D743D | Thu Nov 30 17:19:03 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1124 |
| 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 | //ViaServi ceLibrary. js | |
| 2 | //Contains functions that inte ract with the VIA Se rvices | |
| 3 | ||
| 4 | var vialib _soapHeade rStartText = "<soape nv:Envelop e xmlns:so apenv='htt p://schema s.xmlsoap. org/soap/e nvelope/' " + | |
| 5 | "xmlns:ser ='http:// DNS . URL /'><soapen v:Header/> <soapenv:B ody>"; | |
| 6 | var vialib _soapHeade rEndText = "</soapen v:Body></s oapenv:Env elope>"; | |
| 7 | ||
| 8 | function v ialib_logi nVIA(viali b_requesti ngApp, via lib_consum ingAppToke n, vialib_ consumingA ppPassword , vialib_b aseService EndpointUr l, vialib_ accessCode , vialib_v erifyCode, vialib_si teCode, vi alib_respo nseCallbac k) { | |
| 9 | //This function is used to perform a login to VIA and re turns an o bject cont aining the DUZ/Token and Full Name plus other data | |
| 10 | //vial ib_request ingApp: Th is is the VIA Applic ation Code | |
| 11 | //vial ib_consumi ngAppToken : This is the VIA Ap plication Token | |
| 12 | //vial ib_consumi ngAppPassw ord: This is the VIA Applicati on Passwor d | |
| 13 | //vial ib_baseSer viceEndpoi ntUrl: Thi st is the VIA Servic e URL | |
| 14 | //vial ib_accessC ode: This is the VIA /VistA Use rId | |
| 15 | //vial ib_verifyC ode: This is the VIA /VistA Pas sword | |
| 16 | //vial ib_siteCod e: This is the Facil ity Number /Id e.g. 5 16 represe nting the facility t he VIA/Vis tA user be longs to | |
| 17 | //vial ib_respons eCallback: This is t he name of the funct ion to ret urn the qu ery result to | |
| 18 | ||
| 19 | //Retu rn Values: | |
| 20 | //1. e rror text (null when no error) | |
| 21 | //2. t he VIA Ser vice data object ret urned (nul l when err or occured ) | |
| 22 | ||
| 23 | try { | |
| 24 | // Construct Login Soap message | |
| 25 | va r vialib_s oapMessage = vialib_ soapHeader StartText + "<ser:lo ginVIA>" + "<queryBe an>" + | |
| 26 | "<reques tingApp>" + vialib_e ncodeStrin g(vialib_r equestingA pp) + "</r equestingA pp>" + | |
| 27 | "<cons umingAppTo ken>" + vi alib_encod eString(vi alib_consu mingAppTok en) + "</c onsumingAp pToken>" + | |
| 28 | "<cons umingAppPa ssword>" + vialib_en codeString (vialib_co nsumingApp Password) + "</consu mingAppPas sword>" + "</queryBe an>" + | |
| 29 | "<access Code>" + v ialib_enco deString(v ialib_acce ssCode) + "</accessC ode>" + | |
| 30 | "<veri fyCode>" + vialib_en codeString (vialib_ve rifyCode) + "</verif yCode>" + | |
| 31 | "<siteCo de>" + via lib_siteCo de + "</si teCode>" + | |
| 32 | "</ser:l oginVIA>" + vialib_s oapHeaderE ndText; | |
| 33 | ||
| 34 | // Call VIA S ervices | |
| 35 | va r vialib_l oginRespon se = null; | |
| 36 | $. ajax({ | |
| 37 | url: via lib_baseSe rviceEndpo intUrl + " /EmrServic e", | |
| 38 | type: "P OST", | |
| 39 | datatype : "xml", | |
| 40 | data: vi alib_soapM essage, | |
| 41 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 42 | dataType : "xml", | |
| 43 | success: function (data) { | |
| 44 | vial ib_loginRe sponse = d ata; | |
| 45 | vial ib_respons eCallback( null, vial ib_loginRe sponse); | |
| 46 | }, | |
| 47 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 48 | //Sy stem Error | |
| 49 | vial ib_respons eCallback( textStatus , errorThr own.messag e); | |
| 50 | }, | |
| 51 | async: f alse, | |
| 52 | cache: f alse | |
| 53 | }) ; | |
| 54 | } | |
| 55 | catch (err) { | |
| 56 | // Return fun ction erro r to callb ack functi on | |
| 57 | vi alib_respo nseCallbac k("ViaServ iceLibrary .js Functi on Error(v ialib_logi nVIA): " + err.messa ge, null); | |
| 58 | } | |
| 59 | } | |
| 60 | ||
| 61 | function v ialib_getN oteTitles( vialib_req uestingApp , vialib_c onsumingAp pToken, vi alib_consu mingAppPas sword, via lib_baseSe rviceEndpo intUrl, vi alib_provi derName, v ialib_Duz, vialib_lo ginSiteCod e, vialib_ Target, vi alib_Direc tion, vial ib_respons eCallback, vialib_ex ternalObje ct) { | |
| 62 | //This function is used to retrieve VIA Note T itles, use d in the N otes Write process | |
| 63 | //vial ib_request ingApp: Th is is the VIA Applic ation Code | |
| 64 | //vial ib_consumi ngAppToken : This is the VIA Ap plication Token | |
| 65 | //vial ib_consumi ngAppPassw ord: This is the VIA Applicati on Passwor d | |
| 66 | //vial ib_baseSer viceEndpoi ntUrl: Thi st is the VIA Servic e URL | |
| 67 | //vial ib_provide rName: Thi s is the f ull VIA/Vi stA userna me as retu rned by th e loginVIA service | |
| 68 | //vial ib_Duz: Th is is the VIA sessio n/token as returned by the log inVIA serv ice | |
| 69 | //vial ib_loginSi teCode: Th is is the facility i d e.g. 516 as a text string | |
| 70 | //vial ib_Target: This is t he search parameter leave as b lank for a ll or a si ngle lette r for note titles st arting wit h that let ter | |
| 71 | //vial ib_Directi on: This i s the sort order 1=A SC -1=DESC | |
| 72 | //vial ib_respons eCallback: This is t he name of the funct ion to ret urn the qu ery result to | |
| 73 | //vial ib_externa lObject: T his is an external o bject not used by th is functio n. This ob ject can b e returned to the re sponse fun ction if n eeded | |
| 74 | ||
| 75 | //Retu rn Values: | |
| 76 | //1. e rror text (null when no error) | |
| 77 | //2. t he VIA Ser vice data object ret urned (nul l when err or occured ) | |
| 78 | //3. t he externa lObject | |
| 79 | ||
| 80 | try { | |
| 81 | // Construct getNoteTit les Soap m essage | |
| 82 | va r vialib_s oapMessage = vialib_ soapHeader StartText + "<ser:ge tNoteTitle s>" + "<qu eryBean>" + | |
| 83 | "<reques tingApp>" + vialib_e ncodeStrin g(vialib_r equestingA pp) + "</r equestingA pp>" + | |
| 84 | "<cons umingAppTo ken>" + vi alib_encod eString(vi alib_consu mingAppTok en) + "</c onsumingAp pToken>" + | |
| 85 | "<cons umingAppPa ssword>" + vialib_en codeString (vialib_co nsumingApp Password) + "</consu mingAppPas sword>" + | |
| 86 | "<provid er>" + "<n ame>" + vi alib_encod eString(vi alib_provi derName) + "</name>" + "<login SiteCode>" + vialib_ loginSiteC ode + "</l oginSiteCo de>" + | |
| 87 | "<userId >" + viali b_encodeSt ring(viali b_Duz) + " </userId>" + "</prov ider>" + | |
| 88 | "<target >" + encod eURICompon ent(vialib _Target) + "</target >" + "<dir ection>" + vialib_Di rection + "</directi on>" + "</ queryBean> " + | |
| 89 | "</ser:g etNoteTitl es>" + via lib_soapHe aderEndTex t; | |
| 90 | ||
| 91 | // Call VIA S ervices | |
| 92 | va r vialib_n otetitlesR esponse = null; | |
| 93 | $. ajax({ | |
| 94 | url: via lib_baseSe rviceEndpo intUrl + " /EmrServic e", | |
| 95 | type: "P OST", | |
| 96 | datatype : "xml", | |
| 97 | data: vi alib_soapM essage, | |
| 98 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 99 | dataType : "xml", | |
| 100 | success: function (data) { | |
| 101 | vial ib_notetit lesRespons e = data; | |
| 102 | vial ib_respons eCallback( null, vial ib_notetit lesRespons e, vialib_ externalOb ject); | |
| 103 | }, | |
| 104 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 105 | //Sy stem Error | |
| 106 | vial ib_respons eCallback( textStatus , errorThr own.messag e, vialib_ externalOb ject); | |
| 107 | }, | |
| 108 | async: t rue, | |
| 109 | cache: f alse | |
| 110 | }) ; | |
| 111 | } | |
| 112 | catch (err) { | |
| 113 | // Return fun ction erro r to callb ack functi on | |
| 114 | vi alib_respo nseCallbac k("ViaServ iceLibrary .js Functi on Error(v ialib_getN oteTitles) : " + err. message, n ull, viali b_external Object); | |
| 115 | } | |
| 116 | } | |
| 117 | ||
| 118 | function v ialib_getL ocations(v ialib_requ estingApp, vialib_co nsumingApp Token, via lib_consum ingAppPass word, vial ib_baseSer viceEndpoi ntUrl, via lib_provid erName, vi alib_Duz, vialib_log inSiteCode , vialib_T arget, via lib_Direct ion, viali b_response Callback, vialib_ext ernalObjec t) { | |
| 119 | //This function is used to retrieve VIA Locati ons, used in the Not es Write p rocess | |
| 120 | //vial ib_request ingApp: Th is is the VIA Applic ation Code | |
| 121 | //vial ib_consumi ngAppToken : This is the VIA Ap plication Token | |
| 122 | //vial ib_consumi ngAppPassw ord: This is the VIA Applicati on Passwor d | |
| 123 | //vial ib_baseSer viceEndpoi ntUrl: Thi st is the VIA Servic e URL | |
| 124 | //vial ib_provide rName: Thi s is the f ull VIA/Vi stA userna me as retu rned by th e loginVIA service | |
| 125 | //vial ib_Duz: Th is is the VIA sessio n/token as returned by the log inVIA serv ice | |
| 126 | //vial ib_loginSi teCode: Th is is the facility i d e.g. 516 as a text string | |
| 127 | //vial ib_Target: This is t he search parameter leave as b lank for a ll or a si ngle lette r for note titles st arting wit h that let ter | |
| 128 | //vial ib_Directi on: This i s the sort order 1=A SC -1=DESC | |
| 129 | //vial ib_respons eCallback: This is t he name of the funct ion to ret urn the qu ery result to | |
| 130 | //vial ib_externa lObject: T his is an external o bject not used by th is functio n. This ob ject can b e returned to the re sponse fun ction if n eeded | |
| 131 | ||
| 132 | //Retu rn Values: | |
| 133 | //1. e rror text (null when no error) | |
| 134 | //2. t he VIA Ser vice data object ret urned (nul l when err or occured ) | |
| 135 | //3. t he externa lObject | |
| 136 | ||
| 137 | try { | |
| 138 | // Construct getLocatio ns Soap me ssage | |
| 139 | va r vialib_s oapMessage = vialib_ soapHeader StartText + "<ser:ge tLocations >" + "<que ryBean>" + | |
| 140 | "<reques tingApp>" + vialib_e ncodeStrin g(vialib_r equestingA pp) + "</r equestingA pp>" + | |
| 141 | "<cons umingAppTo ken>" + vi alib_encod eString(vi alib_consu mingAppTok en) + "</c onsumingAp pToken>" + | |
| 142 | "<cons umingAppPa ssword>" + vialib_en codeString (vialib_co nsumingApp Password) + "</consu mingAppPas sword>" + | |
| 143 | "<provid er>" + "<n ame>" + vi alib_encod eString(vi alib_provi derName) + "</name>" + "<login SiteCode>" + vialib_ loginSiteC ode + "</l oginSiteCo de>" + | |
| 144 | "<userId >" + viali b_encodeSt ring(viali b_Duz) + " </userId>" + "</prov ider>" + | |
| 145 | "<target >" + encod eURICompon ent(vialib _Target) + "</target >" + "<dir ection>" + vialib_Di rection + "</directi on>" + "</ queryBean> " + | |
| 146 | "</ser:g etLocation s>" + vial ib_soapHea derEndText ; | |
| 147 | ||
| 148 | // Call VIA S ervices | |
| 149 | va r vialib_l ocationsRe sponse = n ull; | |
| 150 | $. ajax({ | |
| 151 | url: via lib_baseSe rviceEndpo intUrl + " /EmrServic e", | |
| 152 | type: "P OST", | |
| 153 | datatype : "xml", | |
| 154 | data: vi alib_soapM essage, | |
| 155 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 156 | dataType : "xml", | |
| 157 | success: function (data) { | |
| 158 | vial ib_locatio nsResponse = data; | |
| 159 | vial ib_respons eCallback( null, vial ib_locatio nsResponse , vialib_e xternalObj ect); | |
| 160 | }, | |
| 161 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 162 | //Sy stem Error | |
| 163 | vial ib_respons eCallback( textStatus , errorThr own.messag e, vialib_ externalOb ject); | |
| 164 | }, | |
| 165 | async: t rue, | |
| 166 | cache: f alse | |
| 167 | }) ; | |
| 168 | } | |
| 169 | catch (err) { | |
| 170 | // Return fun ction erro r to callb ack functi on | |
| 171 | vi alib_respo nseCallbac k("ViaServ iceLibrary .js Functi on Error(v ialib_getL ocations): " + err.m essage, nu ll, vialib _externalO bject); | |
| 172 | } | |
| 173 | } | |
| 174 | ||
| 175 | function v ialib_writ eNote(vial ib_request ingApp, vi alib_consu mingAppTok en, vialib _consuming AppPasswor d, vialib_ baseServic eEndpointU rl, vialib _providerN ame, viali b_Duz, via lib_loginS iteCode, v ialib_note TitleIen, vialib_loc ationIen, vialib_enc ounterDate , vialib_e ncounterTy pe, vialib _patientId , vialib_n oteText, v ialib_resp onseCallba ck) { | |
| 176 | //This function is used to create a new note i n VistA/CP RS | |
| 177 | //vial ib_request ingApp: Th is is the VIA Applic ation Code | |
| 178 | //vial ib_consumi ngAppToken : This is the VIA Ap plication Token | |
| 179 | //vial ib_consumi ngAppPassw ord: This is the VIA Applicati on Passwor d | |
| 180 | //vial ib_baseSer viceEndpoi ntUrl: Thi st is the VIA Servic e URL | |
| 181 | //vial ib_provide rName: Thi s is the f ull VIA/Vi stA userna me as retu rned by th e loginVIA service | |
| 182 | //vial ib_Duz: Th is is the VIA sessio n/token as returned by the log inVIA serv ice | |
| 183 | //vial ib_loginSi teCode: Th is is the facility i d e.g. 516 as a text string | |
| 184 | //vial ib_noteTit leIen: Thi s is the I EN for the Note Titl e | |
| 185 | //vial ib_locatio nIen: This is the IE N for the Location | |
| 186 | //vial ib_encount erDate: Th is is the encounter date, a da tetime str ing format ted in a V istA/VIA d atetime fo rmat | |
| 187 | //vial ib_encount erType: Th is is the encounter type A-His torical, E -Non-Histo rical | |
| 188 | //vial ib_patient Id: This i s the pati ent identi fier | |
| 189 | //vial ib_noteTex t: This is the text for the no te | |
| 190 | //vial ib_respons eCallback: This is t he name of the funct ion to ret urn the qu ery result to | |
| 191 | ||
| 192 | //Retu rn Values: | |
| 193 | //1. e rror text (null when no error) | |
| 194 | //2. t he VIA Ser vice data object ret urned (nul l when err or occured ) | |
| 195 | ||
| 196 | try { | |
| 197 | // Construct writeNote Soap messa ge | |
| 198 | va r vialib_s oapMessage = vialib_ soapHeader StartText + "<ser:wr iteNote>" + | |
| 199 | "<titleI EN>" + via lib_noteTi tleIen + " </titleIEN >" + | |
| 200 | "<encoun terString> " + vialib _locationI en + ";" + vialib_en counterDat e + ";" + vialib_enc ounterType + "</enco unterStrin g>" + | |
| 201 | "<text>" + vialib_ encodeStri ng(vialib_ noteText) + "</text> " + | |
| 202 | "<queryB ean>" + | |
| 203 | "<patien t>" + "<lo calPid>" + vialib_pa tientId + "</localPi d>" + "</p atient>" + | |
| 204 | "<provid er>" + "<n ame>" + vi alib_encod eString(vi alib_provi derName) + "</name>" + "<login SiteCode>" + vialib_ loginSiteC ode + "</l oginSiteCo de>" + | |
| 205 | "<userId >" + viali b_encodeSt ring(viali b_Duz) + " </userId>" + "</prov ider>" + | |
| 206 | "<record SiteCode>" + vialib_ loginSiteC ode + "</r ecordSiteC ode>" + | |
| 207 | "<reques tingApp>" + vialib_e ncodeStrin g(vialib_r equestingA pp) + "</r equestingA pp>" + | |
| 208 | "<cons umingAppTo ken>" + vi alib_encod eString(vi alib_consu mingAppTok en) + "</c onsumingAp pToken>" + | |
| 209 | "<cons umingAppPa ssword>" + vialib_en codeString (vialib_co nsumingApp Password) + "</consu mingAppPas sword>" + | |
| 210 | "</query Bean>" + | |
| 211 | "</ser:w riteNote>" + vialib_ soapHeader EndText; | |
| 212 | ||
| 213 | // Call VIA S ervices | |
| 214 | va r vialib_w riteNoteRe sponse = n ull; | |
| 215 | $. ajax({ | |
| 216 | url: via lib_baseSe rviceEndpo intUrl + " /EmrServic e", | |
| 217 | type: "P OST", | |
| 218 | datatype : "xml", | |
| 219 | data: vi alib_soapM essage, | |
| 220 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 221 | dataType : "xml", | |
| 222 | success: function (data) { | |
| 223 | vial ib_writeNo teResponse = data; | |
| 224 | vial ib_respons eCallback( null, vial ib_writeNo teResponse ); | |
| 225 | }, | |
| 226 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 227 | //Sy stem Error | |
| 228 | vial ib_respons eCallback( textStatus , errorThr own.messag e); | |
| 229 | }, | |
| 230 | async: t rue, | |
| 231 | cache: f alse | |
| 232 | }) ; | |
| 233 | } | |
| 234 | catch (err) { | |
| 235 | // Return fun ction erro r to callb ack functi on | |
| 236 | vi alib_respo nseCallbac k("ViaServ iceLibrary .js Functi on Error(v ialib_writ eNote): " + err.mess age, null) ; | |
| 237 | } | |
| 238 | } | |
| 239 | ||
| 240 | function v ialib_matc h(vialib_r equestingA pp, vialib _consuming AppToken, vialib_con sumingAppP assword, v ialib_base ServiceEnd pointUrl, vialib_pro viderName, vialib_Du z, vialib_ loginSiteC ode, viali b_Target, vialib_res ponseCallb ack) { | |
| 241 | //This function is used to get a lis t of patie nts matchi ng target entered | |
| 242 | //vial ib_request ingApp: Th is is the VIA Applic ation Code | |
| 243 | //vial ib_consumi ngAppToken : This is the VIA Ap plication Token | |
| 244 | //vial ib_consumi ngAppPassw ord: This is the VIA Applicati on Passwor d | |
| 245 | //vial ib_baseSer viceEndpoi ntUrl: Thi st is the VIA Servic e URL | |
| 246 | //vial ib_provide rName: Thi s is the f ull VIA/Vi stA userna me as retu rned by th e loginVIA service | |
| 247 | //vial ib_Duz: Th is is the VIA sessio n/token as returned by the log inVIA serv ice | |
| 248 | //vial ib_loginSi teCode: Th is is the facility i d e.g. 516 as a text string | |
| 249 | //vial ib_Target: This is t he search parameter which shou ld be: SS N or LAST, FIRST or LXXXX (fir st letter of last na me followe d by last four digit s of SSN) | |
| 250 | //vial ib_respons eCallback: This is t he name of the funct ion to ret urn the qu ery result to | |
| 251 | ||
| 252 | //Retu rn Values: | |
| 253 | //1. e rror text (null when no error) | |
| 254 | //2. t he VIA Ser vice data object ret urned (nul l when err or occured ) | |
| 255 | ||
| 256 | try { | |
| 257 | // Construct match Soap message | |
| 258 | va r vialib_s oapMessage = vialib_ soapHeader StartText + "<ser:ma tch>" + "< queryBean> " + | |
| 259 | "<reques tingApp>" + vialib_e ncodeStrin g(vialib_r equestingA pp) + "</r equestingA pp>" + | |
| 260 | "<cons umingAppTo ken>" + vi alib_encod eString(vi alib_consu mingAppTok en) + "</c onsumingAp pToken>" + | |
| 261 | "<cons umingAppPa ssword>" + vialib_en codeString (vialib_co nsumingApp Password) + "</consu mingAppPas sword>" + | |
| 262 | "<provid er>" + "<n ame>" + vi alib_encod eString(vi alib_provi derName) + "</name>" + "<login SiteCode>" + vialib_ loginSiteC ode + "</l oginSiteCo de>" + | |
| 263 | "<userId >" + viali b_encodeSt ring(viali b_Duz) + " </userId>" + "</prov ider>" + | |
| 264 | "<target >" + encod eURICompon ent(vialib _Target) + "</target >" + "</qu eryBean>" + | |
| 265 | "</ser:m atch>" + v ialib_soap HeaderEndT ext; | |
| 266 | ||
| 267 | // Call VIA S ervices | |
| 268 | va r vialib_m atchRespon se = null; | |
| 269 | $. ajax({ | |
| 270 | url: via lib_baseSe rviceEndpo intUrl + " /EmrServic e", | |
| 271 | type: "P OST", | |
| 272 | datatype : "xml", | |
| 273 | data: vi alib_soapM essage, | |
| 274 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 275 | dataType : "xml", | |
| 276 | success: function (data) { | |
| 277 | vial ib_matchRe sponse = d ata; | |
| 278 | vial ib_respons eCallback( null, vial ib_matchRe sponse); | |
| 279 | }, | |
| 280 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 281 | //Sy stem Error | |
| 282 | vial ib_respons eCallback( textStatus , errorThr own.messag e); | |
| 283 | }, | |
| 284 | async: t rue, | |
| 285 | cache: f alse | |
| 286 | }) ; | |
| 287 | } | |
| 288 | catch (err) { | |
| 289 | // Return fun ction erro r to callb ack functi on | |
| 290 | vi alib_respo nseCallbac k("ViaServ iceLibrary .js Functi on Error(v ialib_matc h): " + er r.message, null); | |
| 291 | } | |
| 292 | } | |
| 293 | ||
| 294 | function v ialib_save NoteAndEnc ounter(via lib_reques tingApp, v ialib_cons umingAppTo ken, viali b_consumin gAppPasswo rd, vialib _baseServi ceEndpoint Url, viali b_provider Name, vial ib_Duz, vi alib_login SiteCode, vialib_not eTitleIen, vialib_lo cationIen, vialib_pa tientId, v ialib_note Text, vial ib_startDa te, vialib _patientLo calSiteNo, vialib_In patient, v ialib_CptA rrayText, vialib_Dia gnosisArra yText, via lib_eSignC ode, viali b_signingP roviders, vialib_ser viceCatego ry, vialib _responseC allback) { | |
| 295 | //This function is used to create a new note a nd encount er in Vist A/CPRS | |
| 296 | //vial ib_request ingApp: Th is is the VIA Applic ation Code | |
| 297 | //vial ib_consumi ngAppToken : This is the VIA Ap plication Token | |
| 298 | //vial ib_consumi ngAppPassw ord: This is the VIA Applicati on Passwor d | |
| 299 | //vial ib_baseSer viceEndpoi ntUrl: Thi st is the VIA Servic e URL | |
| 300 | //vial ib_provide rName: Thi s is the f ull VIA/Vi stA userna me as retu rned by th e loginVIA service | |
| 301 | //vial ib_Duz: Th is is the VIA sessio n/token as returned by the log inVIA serv ice | |
| 302 | //vial ib_loginSi teCode: Th is is the facility i d e.g. 516 as a text string | |
| 303 | //vial ib_noteTit leIen: Thi s is the I EN for the Note Titl e | |
| 304 | //vial ib_locatio nIen: This is the IE N for the Location | |
| 305 | //vial ib_patient Id: This i s the pati ent identi fier | |
| 306 | //vial ib_noteTex t: This is the text for the no te | |
| 307 | //vial ib_startDa te: This i s the note date | |
| 308 | //vial ib_patient LocalSiteN o: This is the patie nt's local Site/Faci lity No e. g. 613 as a text str ing | |
| 309 | //vial ib_Inpatie nt: Inpati ent = 1, N ot Inpatie nt = 0 | |
| 310 | //vial ib_CptArra yText: Thi s is the s tring pass ed as <pro cedures>, is made up of CPT Co des and De scription formatted per specs | |
| 311 | //vial ib_Diagnos isArrayTex t: This is the strin g passed a s <diagnos es>, is ma de up of D iagnosis C odes and D escription formatted per specs | |
| 312 | //vial ib_eSignCo de: The eS ignature C ode (A uni que signat ure code a ssigned in Vista to the VIA lo gged in us er. (Not the IEN or DUZ value s)) | |
| 313 | //vial ib_signing Providers: The IENs for additi onal signe rs/provide rs. A com ma delimit ed string of IENs | |
| 314 | //vial ib_service Category: A, H or E | |
| 315 | //vial ib_respons eCallback: This is t he name of the funct ion to ret urn the qu ery result to | |
| 316 | ||
| 317 | //Retu rn Values: | |
| 318 | //1. e rror text (null when no error) | |
| 319 | //2. t he VIA Ser vice data object ret urned (nul l when err or occured ) | |
| 320 | ||
| 321 | try { | |
| 322 | // Construct saveNoteAn dEncounter Soap mess age | |
| 323 | // NOTE: Adde d default of '<visit RelatedTos >SC</visit RelatedTos >' below, to correct service i ssue per J essica Rom eroll 02/1 6/2017 | |
| 324 | va r vialib_s oapMessage = vialib_ soapHeader StartText + "<ser:sa veNoteAndE ncounter>" + | |
| 325 | "<noteAn dEncounter >" + | |
| 326 | "<locati onIen>" + vialib_loc ationIen + "</locati onIen>" + | |
| 327 | "<noteTi tleIen>" + vialib_no teTitleIen + "</note TitleIen>" + | |
| 328 | "<servic eCategory> " + vialib _encodeStr ing(vialib _serviceCa tegory) + "</service Category>" + | |
| 329 | "<proced ures>" + v ialib_enco deString(v ialib_CptA rrayText) + "</proce dures>" + | |
| 330 | "<diagno ses>" + vi alib_encod eString(vi alib_Diagn osisArrayT ext) + "</ diagnoses> " + | |
| 331 | "<noteBo dy>" + via lib_encode String(via lib_noteTe xt) + "</n oteBody>" + | |
| 332 | "<eSig>" + vialib_ encodeStri ng(vialib_ eSignCode) + "</eSig >" + | |
| 333 | "<provid ers>" + vi alib_signi ngProvider s + "</pro viders>" + | |
| 334 | "<visitR elatedTos> SC</visitR elatedTos> " + | |
| 335 | "</noteA ndEncounte r>" + | |
| 336 | "<queryB ean>" + | |
| 337 | "<patien t>" + "<lo calPid>" + vialib_pa tientId + "</localPi d>" + "<lo calSiteId> " + vialib _patientLo calSiteNo + "</local SiteId>" + | |
| 338 | "<inPati ent>" + vi alib_Inpat ient + "</ inPatient> " + "</pat ient>" + | |
| 339 | "<provid er>" + "<n ame>" + vi alib_encod eString(vi alib_provi derName) + "</name>" + "<login SiteCode>" + vialib_ loginSiteC ode + "</l oginSiteCo de>" + | |
| 340 | "<userId >" + viali b_encodeSt ring(viali b_Duz) + " </userId>" + "</prov ider>" + | |
| 341 | "<record SiteCode>" + vialib_ loginSiteC ode + "</r ecordSiteC ode>" + | |
| 342 | "<reques tingApp>" + vialib_e ncodeStrin g(vialib_r equestingA pp) + "</r equestingA pp>" + | |
| 343 | "<cons umingAppTo ken>" + vi alib_encod eString(vi alib_consu mingAppTok en) + "</c onsumingAp pToken>" + | |
| 344 | "<cons umingAppPa ssword>" + vialib_en codeString (vialib_co nsumingApp Password) + "</consu mingAppPas sword>" + | |
| 345 | "<startD ate>" + vi alib_start Date + "</ startDate> " + | |
| 346 | "</query Bean>" + | |
| 347 | "</ser:s aveNoteAnd Encounter> " + vialib _soapHeade rEndText; | |
| 348 | ||
| 349 | // Call VIA S ervices | |
| 350 | va r vialib_s aveNoteAnd EncounterR esponse = null; | |
| 351 | $. ajax({ | |
| 352 | url: via lib_baseSe rviceEndpo intUrl + " /TiuNotesS ervice", | |
| 353 | type: "P OST", | |
| 354 | datatype : "xml", | |
| 355 | data: vi alib_soapM essage, | |
| 356 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 357 | dataType : "xml", | |
| 358 | success: function (data) { | |
| 359 | vial ib_saveNot eAndEncoun terRespons e = data; | |
| 360 | vial ib_respons eCallback( null, vial ib_saveNot eAndEncoun terRespons e, vialib_ noteText); | |
| 361 | }, | |
| 362 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 363 | //Sy stem Error | |
| 364 | vial ib_respons eCallback( textStatus , errorThr own.messag e, vialib_ noteText); | |
| 365 | }, | |
| 366 | async: t rue, | |
| 367 | cache: f alse | |
| 368 | }) ; | |
| 369 | } | |
| 370 | catch (err) { | |
| 371 | // Return fun ction erro r to callb ack functi on | |
| 372 | vi alib_respo nseCallbac k("ViaServ iceLibrary .js Functi on Error(v ialib_save NoteAndEnc ounter): " + err.mes sage, null ); | |
| 373 | } | |
| 374 | } | |
| 375 | ||
| 376 | function v ialib_getN ote(vialib _requestin gApp, vial ib_consumi ngAppToken , vialib_c onsumingAp pPassword, vialib_ba seServiceE ndpointUrl , vialib_p roviderNam e, vialib_ Duz, viali b_loginSit eCode, via lib_search NoteId, vi alib_searc hSiteId, v ialib_sear chPatientI d, vialib_ searchPati entSiteId, vialib_re sponseCall back) { | |
| 377 | //This function is used to retrieve an existin g VIA Note | |
| 378 | //vial ib_request ingApp: Th is is the VIA Applic ation Code | |
| 379 | //vial ib_consumi ngAppToken : This is the VIA Ap plication Token | |
| 380 | //vial ib_consumi ngAppPassw ord: This is the VIA Applicati on Passwor d | |
| 381 | //vial ib_baseSer viceEndpoi ntUrl: Thi st is the VIA Servic e URL | |
| 382 | //vial ib_provide rName: Thi s is the f ull VIA/Vi stA userna me as retu rned by th e loginVIA service | |
| 383 | //vial ib_Duz: Th is is the VIA sessio n/token as returned by the log inVIA serv ice | |
| 384 | //vial ib_loginSi teCode: Th is is the facility i d e.g. 516 as a text string | |
| 385 | //vial ib_searchN oteId: Thi s is the N ote Id/Ite m Id for a n existing note | |
| 386 | //vial ib_searchS iteId: Thi s is the S ite Id/rec ordSiteCod e that the note is a ssociated with | |
| 387 | //vial ib_searchP atientId: This is th e Patient Id | |
| 388 | //vial ib_searchP atientSite Id: This i s the Pati ent's loca l Site Id e.g. 613 a s a text s tring | |
| 389 | //vial ib_respons eCallback: This is t he name of the funct ion to ret urn the qu ery result to | |
| 390 | ||
| 391 | //Retu rn Values: | |
| 392 | //1. e rror text (null when no error) | |
| 393 | //2. t he VIA Ser vice data object ret urned (nul l when err or occured ) | |
| 394 | ||
| 395 | try { | |
| 396 | // Construct getNote So ap message | |
| 397 | va r vialib_s oapMessage = vialib_ soapHeader StartText + "<ser:ge tNote>" + "<queryBea n>" + | |
| 398 | "<reques tingApp>" + vialib_e ncodeStrin g(vialib_r equestingA pp) + "</r equestingA pp>" + | |
| 399 | "<cons umingAppTo ken>" + vi alib_encod eString(vi alib_consu mingAppTok en) + "</c onsumingAp pToken>" + | |
| 400 | "<cons umingAppPa ssword>" + vialib_en codeString (vialib_co nsumingApp Password) + "</consu mingAppPas sword>" + | |
| 401 | "<provid er>" + "<n ame>" + vi alib_encod eString(vi alib_provi derName) + "</name>" + "<login SiteCode>" + vialib_ loginSiteC ode + "</l oginSiteCo de>" + | |
| 402 | "<userId >" + viali b_encodeSt ring(viali b_Duz) + " </userId>" + "</prov ider>" + | |
| 403 | "<itemId >" + viali b_searchNo teId + "</ itemId>" + | |
| 404 | "<record SiteCode>" + vialib_ encodeStri ng(vialib_ searchSite Id) + "</r ecordSiteC ode>" + | |
| 405 | "<patien t>" + "<lo calPid>" + vialib_se archPatien tId + "</l ocalPid>" + "<localS iteId>" + vialib_sea rchPatient SiteId + " </localSit eId>" + "< /patient>" + | |
| 406 | "</query Bean>" + | |
| 407 | "</ser:g etNote>" + vialib_so apHeaderEn dText; | |
| 408 | ||
| 409 | // Call VIA S ervices | |
| 410 | va r vialib_n oteRespons e = null; | |
| 411 | $. ajax({ | |
| 412 | url: via lib_baseSe rviceEndpo intUrl + " /EmrServic e", | |
| 413 | type: "P OST", | |
| 414 | datatype : "xml", | |
| 415 | data: vi alib_soapM essage, | |
| 416 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 417 | dataType : "xml", | |
| 418 | success: function (data) { | |
| 419 | vial ib_noteRes ponse = da ta; | |
| 420 | vial ib_respons eCallback( null, vial ib_noteRes ponse); | |
| 421 | }, | |
| 422 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 423 | //Sy stem Error | |
| 424 | vial ib_respons eCallback( textStatus , errorThr own.messag e); | |
| 425 | }, | |
| 426 | async: t rue, | |
| 427 | cache: f alse | |
| 428 | }) ; | |
| 429 | } | |
| 430 | catch (err) { | |
| 431 | // Return fun ction erro r to callb ack functi on | |
| 432 | vi alib_respo nseCallbac k("ViaServ iceLibrary .js Functi on Error(v ialib_getN ote): " + err.messag e, null); | |
| 433 | } | |
| 434 | } | |
| 435 | ||
| 436 | function v ialib_cprs UserLookup (vialib_re questingAp p, vialib_ consumingA ppToken, v ialib_cons umingAppPa ssword, vi alib_baseS erviceEndp ointUrl, v ialib_prov iderName, vialib_Duz , vialib_l oginSiteCo de, vialib _Target, v ialib_resp onseCallba ck, vialib _externalO bject) { | |
| 437 | //This function is used to retrieve VIA Users | |
| 438 | //vial ib_request ingApp: Th is is the VIA Applic ation Code | |
| 439 | //vial ib_consumi ngAppToken : This is the VIA Ap plication Token | |
| 440 | //vial ib_consumi ngAppPassw ord: This is the VIA Applicati on Passwor d | |
| 441 | //vial ib_baseSer viceEndpoi ntUrl: Thi st is the VIA Servic e URL | |
| 442 | //vial ib_provide rName: Thi s is the f ull VIA/Vi stA userna me as retu rned by th e loginVIA service | |
| 443 | //vial ib_Duz: Th is is the VIA sessio n/token as returned by the log inVIA serv ice | |
| 444 | //vial ib_loginSi teCode: Th is is the facility i d e.g. 516 as a text string | |
| 445 | //vial ib_Target: This is t he search parameter usually co nsist of l astname, f irstname ( does parti al lastnam e search) | |
| 446 | //vial ib_respons eCallback: This is t he name of the funct ion to ret urn the qu ery result to | |
| 447 | //vial ib_externa lObject: T his is an external o bject not used by th is functio n. This ob ject can b e returned to the re sponse fun ction if n eeded | |
| 448 | ||
| 449 | //Retu rn Values: | |
| 450 | //1. e rror text (null when no error) | |
| 451 | //2. t he VIA Ser vice data object ret urned (nul l when err or occured ) | |
| 452 | //3. t he externa lObject | |
| 453 | ||
| 454 | try { | |
| 455 | // Construct cprsUserLo okup Soap message | |
| 456 | va r vialib_s oapMessage = vialib_ soapHeader StartText + "<ser:cp rsUserLook up>" + "<q ueryBean>" + | |
| 457 | "<reques tingApp>" + vialib_e ncodeStrin g(vialib_r equestingA pp) + "</r equestingA pp>" + | |
| 458 | "<cons umingAppTo ken>" + vi alib_encod eString(vi alib_consu mingAppTok en) + "</c onsumingAp pToken>" + | |
| 459 | "<cons umingAppPa ssword>" + vialib_en codeString (vialib_co nsumingApp Password) + "</consu mingAppPas sword>" + | |
| 460 | "<provid er>" + "<n ame>" + vi alib_encod eString(vi alib_provi derName) + "</name>" + "<login SiteCode>" + vialib_ loginSiteC ode + "</l oginSiteCo de>" + | |
| 461 | "<userId >" + viali b_encodeSt ring(viali b_Duz) + " </userId>" + "</prov ider>" + | |
| 462 | "<target >" + encod eURICompon ent(vialib _Target) + "</target >" + "</qu eryBean>" + | |
| 463 | "</ser:c prsUserLoo kup>" + vi alib_soapH eaderEndTe xt; | |
| 464 | ||
| 465 | // Call VIA S ervices | |
| 466 | va r vialib_u serlookupR esponse = null; | |
| 467 | $. ajax({ | |
| 468 | url: via lib_baseSe rviceEndpo intUrl + " /EmrServic e", | |
| 469 | type: "P OST", | |
| 470 | datatype : "xml", | |
| 471 | data: vi alib_soapM essage, | |
| 472 | contentT ype: "text /xml; char set=\'utf- 8'", | |
| 473 | dataType : "xml", | |
| 474 | success: function (data) { | |
| 475 | vial ib_userloo kupRespons e = data; | |
| 476 | vial ib_respons eCallback( null, vial ib_userloo kupRespons e, vialib_ externalOb ject); | |
| 477 | }, | |
| 478 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 479 | //Sy stem Error | |
| 480 | vial ib_respons eCallback( textStatus , errorThr own.messag e, vialib_ externalOb ject); | |
| 481 | }, | |
| 482 | async: t rue, | |
| 483 | cache: f alse | |
| 484 | }) ; | |
| 485 | } | |
| 486 | catch (err) { | |
| 487 | // Return fun ction erro r to callb ack functi on | |
| 488 | vi alib_respo nseCallbac k("ViaServ iceLibrary .js Functi on Error(v ialib_cprs UserLookup ): " + err .message, null, vial ib_externa lObject); | |
| 489 | } | |
| 490 | } | |
| 491 | ||
| 492 | //Related utility fu nctions | |
| 493 | function v ialib_form atTwoDigit s(vialib_n umberToFor mat) { | |
| 494 | //This function takes an i nteger and reformats it with a '0' prefi x if the v alue is le ss than 10 | |
| 495 | //vial ib_numberT oFormat is the integ er value | |
| 496 | try { | |
| 497 | va r vialib_p refixValue = "0"; | |
| 498 | if (vialib_n umberToFor mat < 10) { return ( vialib_pre fixValue + vialib_nu mberToForm at.toStrin g()); } | |
| 499 | el se { retur n vialib_n umberToFor mat.toStri ng(); } | |
| 500 | } | |
| 501 | catch (err) { | |
| 502 | // Display er ror | |
| 503 | al ert("ViaSe rviceLibra ry.js Func tion Error (vialib_fo rmatTwoDig its): " + err.messag e); | |
| 504 | re turn null; | |
| 505 | } | |
| 506 | } | |
| 507 | ||
| 508 | function v ialib_conv ertToVista DateTime(v ialib_date timeToConv ert) { | |
| 509 | //This function takes a Ja vaScript D ateTime Ob ject and r eformats i t for use as a Vista /VIA datet ime value | |
| 510 | //vial ib_datetim eToConvert : This is a JavaScri pt datetim e object e .g. (new D ate()) | |
| 511 | try { | |
| 512 | va r vialib_d ay = viali b_formatTw oDigits(vi alib_datet imeToConve rt.getDate ()); | |
| 513 | va r vialib_m onth = via lib_format TwoDigits( vialib_dat etimeToCon vert.getMo nth() + 1) ; | |
| 514 | va r vialib_y ear = (via lib_dateti meToConver t.getFullY ear() - 17 00).toStri ng(); | |
| 515 | va r vialib_h our = vial ib_formatT woDigits(v ialib_date timeToConv ert.getHou rs()); | |
| 516 | va r vialib_m inute = vi alib_forma tTwoDigits (vialib_da tetimeToCo nvert.getM inutes()); | |
| 517 | va r vialib_s econd = vi alib_forma tTwoDigits (vialib_da tetimeToCo nvert.getS econds()); | |
| 518 | va r vialib_v istaDateTi me = (vial ib_year + vialib_mon th + viali b_day + ". " + vialib _hour + vi alib_minut e + vialib _second); | |
| 519 | re turn viali b_vistaDat eTime; | |
| 520 | } | |
| 521 | catch (err) { | |
| 522 | // Display er ror | |
| 523 | al ert("ViaSe rviceLibra ry.js Func tion Error (vialib_co nvertToVis taDateTime ): " + err .message); | |
| 524 | re turn null; | |
| 525 | } | |
| 526 | } | |
| 527 | ||
| 528 | function v ialib_conv ertToStrin gDateTime( vialib_dat etimeToCon vert) { | |
| 529 | //This function takes a Ja vaScript D ateTime Ob ject and r eformats i t as a str ing date i n the form at yyyymmd d.hhmmss | |
| 530 | //vial ib_datetim eToConvert : This is a JavaScri pt datetim e object e .g. (new D ate()) | |
| 531 | try { | |
| 532 | va r vialib_d ay = viali b_formatTw oDigits(vi alib_datet imeToConve rt.getDate ()); | |
| 533 | va r vialib_m onth = via lib_format TwoDigits( vialib_dat etimeToCon vert.getMo nth() + 1) ; | |
| 534 | va r vialib_y ear = (via lib_dateti meToConver t.getFullY ear()).toS tring(); | |
| 535 | va r vialib_h our = vial ib_formatT woDigits(v ialib_date timeToConv ert.getHou rs()); | |
| 536 | va r vialib_m inute = vi alib_forma tTwoDigits (vialib_da tetimeToCo nvert.getM inutes()); | |
| 537 | va r vialib_s econd = vi alib_forma tTwoDigits (vialib_da tetimeToCo nvert.getS econds()); | |
| 538 | va r vialib_s tringDateT ime = (via lib_year + vialib_mo nth + vial ib_day + " ." + viali b_hour + v ialib_minu te + viali b_second); | |
| 539 | re turn viali b_stringDa teTime; | |
| 540 | } | |
| 541 | catch (err) { | |
| 542 | // Display er ror | |
| 543 | al ert("ViaSe rviceLibra ry.js Func tion Error (vialib_co nvertToStr ingDateTim e): " + er r.message) ; | |
| 544 | re turn null; | |
| 545 | } | |
| 546 | } | |
| 547 | ||
| 548 | function v ialib_enco deString(v ialib_unen codedStrin g) { | |
| 549 | if (vi alib_unenc odedString == undefi ned || via lib_unenco dedString == null || vialib_un encodedStr ing == '') { return ''; } | |
| 550 | //This function takes a st ring and e ncodes for use in XM L | |
| 551 | try { | |
| 552 | re turn viali b_unencode dString.re place(/&/g , '&') | |
| 553 | .repl ace(/</g, '<') | |
| 554 | .repl ace(/>/g, '>') | |
| 555 | .repl ace(/"/g, '"') | |
| 556 | .repl ace(/'/g, '''); | |
| 557 | } | |
| 558 | catch (err) { | |
| 559 | // Display Er ror | |
| 560 | al ert("ViaSe rviceLibra ry.js Func tion Error (vialib_en codeString ): " + err .message); | |
| 561 | re turn null; | |
| 562 | } | |
| 563 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.