Produced by Araxis Merge on 10/3/2017 11:16:06 AM Central 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 | ehmp.zip\ehmp\ehmp\product\tests\acceptance-tests\features\steps | vx-sync-writeback.rb | Tue Jan 10 16:20:50 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\tests\acceptance-tests\features\steps | vx-sync-writeback.rb | Tue Oct 3 13:46:50 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 1740 |
| Changed | 2 | 6 |
| 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 | require 'V erifyJsonR untimeValu e.rb' | |
| 2 | require 'v istarpc4r' | |
| 3 | require 't ime' | |
| 4 | ||
| 5 | Given(/^sa ve the tot alItems$/) do | |
| 6 | @jds_res ponse = @r esponse | |
| 7 | p @total _items = f ind_total_ items(@jds _response) | |
| 8 | end | |
| 9 | ||
| 10 | Given(/^a client con nect to Vi stA using "(.*?)"$/) do |site_ name| | |
| 11 | @recorde _exisit = false | |
| 12 | site_nam e = site_n ame.upcase | |
| 13 | fail "Ch eck you co de or the site name #{site_nam e}! Just P ANORAMA an d KODAK ar e define i n this cod e." unless ["PANORAM A", "KODAK "].include ? site_nam e | |
| 14 | # p site _name | |
| 15 | if site_ name == "P ANORAMA" | |
| 16 | @site_ name = "9E 7A" | |
| 17 | p base _url = Def aultLogin. panorama_u rl | |
| 18 | else | |
| 19 | @site_ name = "C8 77" | |
| 20 | p base _url = Def aultLogin. kodak_url | |
| 21 | end | |
| 22 | ||
| 23 | base = b ase_url.sp lit":" | |
| 24 | ip_addre ss = base[ 0] | |
| 25 | port = b ase[1].to_ i | |
| 26 | ||
| 27 | access_c ode = Defa ultLogin.a ccess_code | |
| 28 | verify_c ode = Defa ultLogin.v erify_code | |
| 29 | ||
| 30 | @broker = VistaRPC 4r::RPCBro kerConnect ion.new(ip _address, port, acce ss_code, v erify_code , false) | |
| 31 | @broker. connect | |
| 32 | ||
| 33 | p "*"*62 | |
| 34 | p connec tion_mes = "* The RP C Broker C onnection status is #{@broker. isConnecte d} for sit e #{site_n ame} *" | |
| 35 | p "*"*62 | |
| 36 | ||
| 37 | fail con nection_me s unless @ broker.isC onnected | |
| 38 | @broker. setContext ('HMP UI C ONTEXT') | |
| 39 | end | |
| 40 | ||
| 41 | Then(/^the client re ceive the VistA writ e\-back re sponse$/) do | |
| 42 | # p "thi s is the r esponse va lue" | |
| 43 | response _value = @ vista_resp onse.value | |
| 44 | fail "Th e VistA wr ite-back's response is empty. Response v alue: #{re sponse_val ue}" if re sponse_val ue.nil? || response_ value.empt y? | |
| 45 | ||
| 46 | if @reco rde_exisit == true | |
| 47 | p "^ M essage"* 1 0 | |
| 48 | p @vis ta_obj_msg = respons e_value | |
| 49 | @dupli cated = tr ue | |
| 50 | @dupli cate_messa ge = "It's duplicate d entry. T his step d id not run ." | |
| 51 | expect ed_data = ["No dupli cates allo wed", "alr eady exist ", "entere d in error "] | |
| 52 | result = expecte d_data.any ? { |x| @v ista_obj_m sg.include ?(x) } | |
| 53 | fail " The record exisit, t he system should dis play error message. Response v alue: #{re sponse_val ue}" unles s result | |
| 54 | else | |
| 55 | json_o bject = fi nd_object_ from_respo nse(@vista _response, "value") | |
| 56 | p "^ o bject"* 10 | |
| 57 | p @vis ta_obj_msg = json_ob ject["obje ct"] | |
| 58 | p "^ o bject"* 10 | |
| 59 | @dupli cated = fa lse | |
| 60 | fail " The record does not exisit, th e system s hould disp lay Json O bject body . Response value: #{ response_v alue}" if @vista_obj _msg.nil? || @vista_ obj_msg.em pty? | |
| 61 | end | |
| 62 | ||
| 63 | end | |
| 64 | ||
| 65 | Then(/^the new "(.*? )" record added for the patien t "(.*?)" in VPR for mat$/) do |domain, p id| | |
| 66 | ||
| 67 | domain = check_dom ain_name(d omain) | |
| 68 | ||
| 69 | max_inde x_run = 60 | |
| 70 | sleep_ti me = 3 | |
| 71 | index = 0 | |
| 72 | total_ma tch = fals e | |
| 73 | # p "9"* 80 | |
| 74 | # p uid_ value_for_ new_record = @vista_ obj_msg["u id"] | |
| 75 | ||
| 76 | while to tal_match == false & & @recorde _exisit == false && index < ma x_index_ru n | |
| 77 | @jds_r esponse = nil | |
| 78 | sleep sleep_time | |
| 79 | ||
| 80 | vpr_fo rmate = Vp rFormate.n ew | |
| 81 | @jds_r esponse = vpr_format e.call_vpr _formate(d omain, pid ) | |
| 82 | ||
| 83 | new_to tal_items = find_tot al_items(@ jds_respon se) | |
| 84 | p @tot al_items+ 1 | |
| 85 | p new_ total_item s | |
| 86 | total_ match = tr ue if new_ total_item s == @tota l_items + 1 | |
| 87 | ||
| 88 | index = index + sleep_time | |
| 89 | end | |
| 90 | ||
| 91 | if @reco rde_exisit == false | |
| 92 | expect (new_total _items).to eq @total _items + 1 | |
| 93 | @total _items = @ total_item s + 1 | |
| 94 | else | |
| 95 | p @dup licate_mes sage | |
| 96 | fail " Your code did not ch eck if the recorde a lready exi sit. Chang e your cod e please!" if @dupli cate_messa ge.nil? | |
| 97 | end | |
| 98 | ||
| 99 | end | |
| 100 | ||
| 101 | When(/^the update "( .*?)" writ e back rec ord for th e patient "(.*?)" di spaly in V PR format with value of$/) do |domain, p id, table| | |
| 102 | domain = check_dom ain_name(d omain) | |
| 103 | vpr_form ate = VprF ormate.new | |
| 104 | json_ver ify = Veri fyJsonRunt imeValue.n ew | |
| 105 | ||
| 106 | max_inde x_run = 60 | |
| 107 | sleep_ti me = 3 | |
| 108 | index = 0 | |
| 109 | results_ match = fa lse | |
| 110 | ||
| 111 | table_ro ws = table .rows | |
| 112 | local_id = table_r ows[0][1]. downcase | |
| 113 | ||
| 114 | if local _id.start_ with? 'abo ve' | |
| 115 | table_ rows[0][1] = @vista_ local_id.t o_s | |
| 116 | end | |
| 117 | ||
| 118 | while re sults_matc h == false && index < max_inde x_run | |
| 119 | @jds_r esponse = nil | |
| 120 | sleep sleep_time | |
| 121 | ||
| 122 | @jds_r esponse = vpr_format e.call_vpr _formate(d omain, pid ) | |
| 123 | json_o bject = JS ON.parse(@ jds_respon se.body) | |
| 124 | result _array = j son_object ["data"][" items"] | |
| 125 | ||
| 126 | p resu lts_match = json_ver ify.verify _json_runt ime_vlaue_ for_array( result_arr ay, table_ rows, red_ flog_on = false) | |
| 127 | ||
| 128 | index = index + sleep_time | |
| 129 | end | |
| 130 | p "The a bove local id is: #{ @vista_loc al_id.to_s }" | |
| 131 | unless r esults_mat ch | |
| 132 | json_v erify.veri fy_json_ru ntime_vlau e_for_arra y(result_a rray, tabl e_rows) | |
| 133 | end | |
| 134 | end | |
| 135 | ||
| 136 | Then(/^the "(.*?)" r ecord with local id "(.*?)" re moved for the patien t "(.*?)" in VPR for mat$/) do |domain, l ocal_id, p id| | |
| 137 | domain = check_dom ain_name(d omain) | |
| 138 | vpr_form ate = VprF ormate.new | |
| 139 | ||
| 140 | max_inde x_run = 12 0 | |
| 141 | sleep_ti me = 3 | |
| 142 | index = 0 | |
| 143 | total_ma tch = fals e | |
| 144 | ||
| 145 | while to tal_match == false & & index < max_index_ run | |
| 146 | @respo nse = nil | |
| 147 | sleep sleep_time | |
| 148 | ||
| 149 | @jds_r esponse = vpr_format e.call_vpr _formate(d omain, pid ) | |
| 150 | ||
| 151 | remove d_value = find_remov ed_value_f or_uid(@jd s_response , local_id , @site_na me) | |
| 152 | ||
| 153 | total_ match = tr ue if remo ved_value == "true" | |
| 154 | ||
| 155 | index = index + sleep_time | |
| 156 | end | |
| 157 | expect(r emoved_val ue).to eq( "true"), " Expected t o find rem oved=true for reorde #{local_i d}, but di d not find it.\n rep onse body: \n #{@jds _response} " | |
| 158 | end | |
| 159 | ||
| 160 | Then(/^the above "(. *?)" recor d removed for the pa tient "(.* ?)"$/) do |domain, p id| | |
| 161 | domain = check_dom ain_name(d omain) | |
| 162 | vpr_form ate = VprF ormate.new | |
| 163 | ||
| 164 | max_inde x_run = 12 0 | |
| 165 | sleep_ti me = 3 | |
| 166 | index = 0 | |
| 167 | total_ma tch = fals e | |
| 168 | ||
| 169 | while to tal_match == false & & index < max_index_ run | |
| 170 | @respo nse = nil | |
| 171 | sleep sleep_time | |
| 172 | ||
| 173 | @jds_r esponse = vpr_format e.call_vpr _formate(d omain, pid ) | |
| 174 | ||
| 175 | p remo ved_value = find_rem oved_value _for_uid(@ jds_respon se, @local _id, @site _name) | |
| 176 | ||
| 177 | total_ match = tr ue if remo ved_value == "true" | |
| 178 | ||
| 179 | index = index + sleep_time | |
| 180 | end | |
| 181 | expect(r emoved_val ue).to eq( "true"), " Expected t o find rem oved=true for reorde #{@local_ id}, but d id not fin d it.\n re ponse body : \n #{@jd s_response }" | |
| 182 | end | |
| 183 | ||
| 184 | Then(/^the stamp tim e get upda te for rec orde Enter ed in Erro r$/) do | |
| 185 | p err_ms g = "The s tamp time after the recorde EI E #{@stamp _time} to be equal o r greater than befor the recor de EIE #{@ old_stamp_ time}" | |
| 186 | err_msg = "The las t up date time shoul d get up t o date clo se to the current ti me.\n" + e rr_msg | |
| 187 | fail err _msg unles s @stamp_t ime.to_i > = @old_sta mp_time.to _i | |
| 188 | end | |
| 189 | ||
| 190 | When(/^the client us e the vx\- sync write \-back to save the r ecord$/) d o | |
| 191 | if @reco rde_exisit == true | |
| 192 | p @dup licate_mes sage | |
| 193 | fail " Your code did not ch eck if the recorde a lready exi sit. Chang e your cod e please!" if @dupli cate_messa ge.nil? | |
| 194 | else | |
| 195 | base_j ds_url = D efaultLogi n.wb_vx_sy nc_url | |
| 196 | p path = "#{base _jds_url}/ writeback" | |
| 197 | @vxsyn c_response = nil | |
| 198 | ||
| 199 | # This is just f or test pr opose. NO one allowe d to make change to Last Updat e Time. | |
| 200 | # In t wo differe nt times t he data ge t save. On e time by Vista and one time b y vx-sync. | |
| 201 | # to m ake sure i n our test the recod e get save by vx-syn c the last UpdateTime been chag ned. | |
| 202 | p upda te_time = @vista_obj _msg["last UpdateTime "] | |
| 203 | update _time = up date_time. to_s | |
| 204 | ||
| 205 | update _time = Ti me.parse(u pdate_time ) | |
| 206 | added_ date = upd ate_time + 3 | |
| 207 | new_ti me = added _date.strf time("%Y%m %d%H%M%S") | |
| 208 | sleep 3 | |
| 209 | p "*** ****** The new lastU pdateTime is #{new_t ime.to_i} *******" | |
| 210 | @vista _obj_msg[" lastUpdate Time"] = n ew_time.to _i | |
| 211 | ||
| 212 | param = @vista_o bj_msg.to_ json | |
| 213 | # p pa th | |
| 214 | # p pa ram | |
| 215 | p "VXS ync writeB ack Respon se" + "^*" * 20 | |
| 216 | p @vxs ync_respon se = HTTPa rtyWithBas icAuth.pos t_write_ba ck(path, p aram) | |
| 217 | p "VXS ync writeB ack Respon se" + "^*" * 20 | |
| 218 | end | |
| 219 | end | |
| 220 | ||
| 221 | Then(/^the responce is success ful$/) do | |
| 222 | if @reco rde_exisit == false | |
| 223 | fail " Expected r esponse co de 200, re ceived #{@ vxsync_res ponse.code } \n respo nse body: #{@vxsync_ response.b ody} \n pa rams: #{@v ista_obj_m sg}" unles s @vxsync_ response.c ode == 200 | |
| 224 | else | |
| 225 | p @dup licate_mes sage | |
| 226 | fail " Your code did not ch eck if the recorde a lready exi sit. Chang e your cod e please!" if @dupli cate_messa ge.nil? | |
| 227 | end | |
| 228 | end | |
| 229 | ||
| 230 | Then(/^the new write back reco rd dispaly in VPR fo rmat with value of$/ ) do |tabl e| | |
| 231 | # if @re corde_exis it == fals e | |
| 232 | json_obj ect = JSON .parse(@jd s_response .body) | |
| 233 | result_a rray = jso n_object[" data"]["it ems"] | |
| 234 | ||
| 235 | json_ver ify = Veri fyJsonRunt imeValue.n ew | |
| 236 | json_ver ify.verify _json_runt ime_vlaue( result_arr ay, table) | |
| 237 | end | |
| 238 | ||
| 239 | Then(/^Vis tA write-b ack genera te a new l ocalId wit h values r ecord disp aly in VPR format$/) do |table | | |
| 240 | table_ro ws = table .rows | |
| 241 | ||
| 242 | if @reco rde_exisit == false | |
| 243 | p "^ l ocalId"* 1 0 | |
| 244 | p @vis ta_local_i d = @vista _obj_msg[" localId"] | |
| 245 | p "^ l ocalId"* 1 0 | |
| 246 | expect (@vista_lo cal_id.to_ i).to be > 0, "The l ocal id sh ould be gr eater than zero. \n Vista resp onse: #{@v ista_obj_m sg}" | |
| 247 | table_ rows.inser t(0, ["loc alId", @vi sta_local_ id.to_s]) | |
| 248 | else | |
| 249 | p @dup licate_mes sage | |
| 250 | fail " Your code did not ch eck if the recorde a lready exi sit. Chang e your cod e please!" if @dupli cate_messa ge.nil? | |
| 251 | end | |
| 252 | ||
| 253 | json_obj ect = JSON .parse(@jd s_response .body) | |
| 254 | result_a rray = jso n_object[" data"]["it ems"] | |
| 255 | ||
| 256 | json_ver ify = Veri fyJsonRunt imeValue.n ew | |
| 257 | results_ match = js on_verify. verify_jso n_runtime_ vlaue_for_ array(resu lt_array, table_rows ) | |
| 258 | end | |
| 259 | ||
| 260 | Then(/^the above rec ord dispal y in VPR f ormat with value of$ /) do |tab le| | |
| 261 | table_ro ws = table .rows | |
| 262 | ||
| 263 | if @loca l_id.empty ? | |
| 264 | fail " Please sel ect anothe r patient, there is no local i d found fo r this pat ient!" | |
| 265 | else | |
| 266 | table_ rows.inser t(0, ["loc alId", @lo cal_id.to_ s]) | |
| 267 | end | |
| 268 | ||
| 269 | json_obj ect = JSON .parse(@jd s_response .body) | |
| 270 | result_a rray = jso n_object[" data"]["it ems"] | |
| 271 | ||
| 272 | json_ver ify = Veri fyJsonRunt imeValue.n ew | |
| 273 | results_ match = js on_verify. verify_jso n_runtime_ vlaue_for_ array(resu lt_array, table_rows ) | |
| 274 | end | |
| 275 | ||
| 276 | Then(/^the client re ceive the error mess age$/) do | |
| 277 | err_mesg = "The re corde alre ady exist, error mes sage shoul d display. \n VistA response: #{@vista_o bj_msg}" | |
| 278 | ||
| 279 | expect(@ vista_obj_ msg).not_t o be_empty , err_mesg | |
| 280 | ||
| 281 | expected _data = [" No duplica tes allowe d", "alrea dy exist"] | |
| 282 | ||
| 283 | p result = expecte d_data.any ? { |x| @v ista_obj_m sg.include ?(x) } | |
| 284 | fail err _mesg unle ss result | |
| 285 | end | |
| 286 | ||
| 287 | Then(/^the client re ceive the "(.*?)" er ror messag e$/) do |e rror_msg| | |
| 288 | response _value = @ vista_resp onse.value | |
| 289 | fail "Ex pected err or message : #{error_ msg} \n Go t: #{respo nse_value} " unless response_v alue.inclu de? error_ msg | |
| 290 | end | |
| 291 | ||
| 292 | When(/^the client se arch for " (.*?)" rel ated Order IENs$/) d o |order_i en| | |
| 293 | rpc_name = "HMP GE T RELATED ORDERS" | |
| 294 | @vista_r esponse = "" | |
| 295 | ||
| 296 | data = order_ien | |
| 297 | params = [data] | |
| 298 | ||
| 299 | p @vista _response = rpc_writ e_back(rpc _name, par ams) | |
| 300 | end | |
| 301 | ||
| 302 | Then(/^the client re ceive the whole set of related IENs and what their relations hip is$/) do |table| | |
| 303 | vista_ob j_message = find_obj ect_from_r esponse(@v ista_respo nse, "valu e") | |
| 304 | table_ro ws = table .rows | |
| 305 | table_ha shes = {} | |
| 306 | table_ro ws.each do |id, val| | |
| 307 | array_ val = val. split(',') | |
| 308 | array_ val_i = [] | |
| 309 | ||
| 310 | array_ val.each d o |value| | |
| 311 | valu e_i = valu e.to_i | |
| 312 | valu e = value_ i unless v alue_i ==0 | |
| 313 | arra y_val_i << value | |
| 314 | end | |
| 315 | ||
| 316 | array_ val_i = ar ray_val_i[ 0] if arra y_val_i.si ze < 2 | |
| 317 | table_ hashes[id] = array_v al_i | |
| 318 | end | |
| 319 | ||
| 320 | expect(v ista_obj_m essage).to eq table_ hashes | |
| 321 | end | |
| 322 | ||
| 323 | # -------- ---------- ---------- ---------- ---- | |
| 324 | When(/^the client ad d new Vita l record f or patient with DFN "(.*?)"$/) do |dfn, table| | |
| 325 | expected _array = % W[referenc e_date qua lified_nam e result] | |
| 326 | table_to _hash = co nvert_tabl e_to_hash( table, exp ected_arra y) | |
| 327 | hash_tab le = table _to_hash[0 ] | |
| 328 | hash_tab le_dec = t able_to_ha sh[1] | |
| 329 | referenc e_date = h ash_table[ "reference _date"] | |
| 330 | referenc e_date = c hange_date (reference _date) | |
| 331 | ||
| 332 | rpc_name = "HMP WR ITEBACK VI TAL" | |
| 333 | # p data = "315061 6.0900^"+d fn+"^1;"+v alue+";^23 ^100000002 24*2:38:50 :75" | |
| 334 | data = r eference_d ate + "^" + dfn + "^ " + hash_t able["qual ified_name "] + hash_ table["res ult"] + "; ^23^100000 00224*2:38 :50:75" | |
| 335 | ||
| 336 | @recorde _exisit = false | |
| 337 | params = ["0", dfn , data] | |
| 338 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 339 | end | |
| 340 | ||
| 341 | When(/^the client ma rked a Vit al record with local id "(.*?) " as Enter ed in Erro r with EIE Reason$/) do |local _id, table | | |
| 342 | removed_ value = fi nd_removed _value_for _uid(@resp onse, loca l_id, @sit e_name) | |
| 343 | @recorde _exisit = false | |
| 344 | @recorde _exisit = true if re moved_valu e == "true " | |
| 345 | ||
| 346 | table = table.rows | |
| 347 | eie_reas on = table [0][1] | |
| 348 | ||
| 349 | @old_sta mp_time = @stamp_tim e | |
| 350 | ||
| 351 | rpc_name = "HMP WR ITEBACK VI TAL EIE" | |
| 352 | ||
| 353 | data = local_id + "^" + eie _reason | |
| 354 | params = [data] | |
| 355 | ||
| 356 | p @vista _response = rpc_writ e_back(rpc _name, par ams) | |
| 357 | ||
| 358 | @current _time_for_ domain = T ime.new | |
| 359 | end | |
| 360 | ||
| 361 | When(/^the client ma rked the a bvoe Vital record as Entered i n Error wi th EIE Rea son "(.*?) "$/) do |e ie_reason_ code| | |
| 362 | @local_i d = @vista _local_id. to_s | |
| 363 | # remove d_value = find_remov ed_value_f or_uid(@re sponse, lo cal_id, @s ite_name) | |
| 364 | @recorde _exisit = false | |
| 365 | # @recor de_exisit = true if removed_va lue == "tr ue" | |
| 366 | ||
| 367 | eie_reas on_code = eie_reason _code.spli t";" | |
| 368 | eie_code = eie_rea son_code[1 ] | |
| 369 | ||
| 370 | @old_sta mp_time = @stamp_tim e | |
| 371 | ||
| 372 | rpc_name = "HMP WR ITEBACK VI TAL EIE" | |
| 373 | ||
| 374 | data = @local_id + "^" + ei e_code | |
| 375 | params = [data] | |
| 376 | ||
| 377 | p @vista _response = rpc_writ e_back(rpc _name, par ams) | |
| 378 | ||
| 379 | @current _time_for_ domain = T ime.new | |
| 380 | end | |
| 381 | ||
| 382 | When(/^the client ma rked a All ergy recor d for pati ent with l ocal id "( .*?)" as E ntered in Error$/) d o |local_i d| | |
| 383 | removed_ value = fi nd_removed _value_for _uid(@resp onse, loca l_id, @sit e_name) | |
| 384 | @recorde _exisit = false | |
| 385 | @recorde _exisit = true if re moved_valu e == "true " | |
| 386 | ||
| 387 | @old_sta mp_time = @stamp_tim e | |
| 388 | ||
| 389 | rpc_name = "HMP WR ITEBACK AL LERGY EIE" | |
| 390 | ||
| 391 | # data = local_id + "^" + d fn + "^YES ^1^3150813 .144304^1^ Test - Ent ered in Er ror" | |
| 392 | data = local_id + "^YES^1^3 150813.144 304^1^Test - Entered in Error" | |
| 393 | ||
| 394 | params = [data] | |
| 395 | p @vista _response = rpc_writ e_back(rpc _name, par ams) | |
| 396 | end | |
| 397 | ||
| 398 | When(/^the client ma rk abvoe A llergy rec ord as Ent ered in Er ror with c omment "(. *?)"$/) do |comment_ value| | |
| 399 | # @local _id = "" | |
| 400 | # p @loc al_id = pi ck_local_i d_that_has _removed_v alue_false (@response , @site_na me) | |
| 401 | ||
| 402 | @local_i d = @vista _local_id. to_s | |
| 403 | p "the l ocal id th at been ch osen to ma rk as EIE is: #{@loc al_id}" | |
| 404 | ||
| 405 | @old_sta mp_time = @stamp_tim e | |
| 406 | ||
| 407 | rpc_name = "HMP WR ITEBACK AL LERGY EIE" | |
| 408 | ||
| 409 | # data = local_id + "^" + d fn + "^YES ^1^3150813 .144304^1^ Test - Ent ered in Er ror" | |
| 410 | data = @local_id + "^YES^1^ 3150813.14 4304^1^" + comment_v alue | |
| 411 | ||
| 412 | params = [data] | |
| 413 | p @vista _response = rpc_writ e_back(rpc _name, par ams) | |
| 414 | end | |
| 415 | ||
| 416 | When(/^the client ad d new Lab Order reco rd by usin g write\-b ack for pa tient with DFN "(.*? )" orderin g PTT test $/) do |df n| | |
| 417 | rpc_name = "HMP WR ITEBACK LA B ORDERS" | |
| 418 | data = ' XIU,MARGAR ET^AUDIOLO GY^PTT^BLO OD^SERUM^A SAP^SP^TOD AY^ONE TIM E^^foo' | |
| 419 | ||
| 420 | params = ["0", dfn , data] | |
| 421 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 422 | end | |
| 423 | ||
| 424 | When(/^the client ad d new Lab Order reco rd by usin g write\-b ack for pa tient with DFN "(.*? )" orderin g THEOPHYL LINE test$ /) do |dfn | | |
| 425 | rpc_name = "HMP WR ITEBACK LA B ORDERS" | |
| 426 | data = ' XIU,MARGAR ET^AUDIOLO GY^THEOPHY LLINE^BLOO D^SERUM^RO UTINE^SP^T ODAY^ONE T IME^^07/07 /15 04:00; 07/07/15 0 6:00' | |
| 427 | ||
| 428 | params = ["0", dfn , data] | |
| 429 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 430 | end | |
| 431 | ||
| 432 | When(/^the client ad d new Lab Order reco rd by usin g write\-b ack for pa tient with DFN "(.*? )" orderin g GAS AND CARBON MON OXIDE PANE L test$/) do |dfn| | |
| 433 | rpc_name = "HMP WR ITEBACK LA B ORDERS" | |
| 434 | data = ' XIU,MARGAR ET^AUDIOLO GY^GAS AND CARBON MO NOXIDE PAN EL^BLOOD^B LOOD^ROUTI NE^SP^TODA Y^ONE TIME ^^foo' | |
| 435 | ||
| 436 | params = ["0", dfn , data] | |
| 437 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 438 | end | |
| 439 | ||
| 440 | When(/^the client ad d new Lab Order reco rd by usin g write\-b ack for pa tient with DFN "(.*? )" orderin g GENTAMIC IN test$/) do |dfn| | |
| 441 | rpc_name = "HMP WR ITEBACK LA B ORDERS" | |
| 442 | data = ' XIU,MARGAR ET^AUDIOLO GY^GENTAMI CIN^BLOOD^ SERUM^ROUT INE^SP^TOD AY^ONE TIM E^^PEAK;fo o' | |
| 443 | ||
| 444 | params = ["0", dfn , data] | |
| 445 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 446 | end | |
| 447 | ||
| 448 | When(/^the client ad d new prob lem record by using write\-bac k for pati ent with D FN "(.*?)" $/) do |df n| | |
| 449 | rpc_name = "HMP WR ITEBACK PR OBLEM" | |
| 450 | # dfn = "66" | |
| 451 | prv = "9 014" | |
| 452 | vamc = " 500" | |
| 453 | flds = [ | |
| 454 | [".01", "9777"], | |
| 455 | [".03", "0"], | |
| 456 | [".05", "^Numbness "], | |
| 457 | [".08", "3150729"] , | |
| 458 | [".12", "A"], | |
| 459 | ["10,\"N EW\",1", " Farid11 Lo ss of feel ing in ext remities"] , | |
| 460 | ["10,0", "1"], | |
| 461 | [".13", "3150720"] , | |
| 462 | ["1.01", "7078563" ], | |
| 463 | ["1.02", "T"], | |
| 464 | ["1.03", "1"], | |
| 465 | ["1.04", "9014"], | |
| 466 | ["1.05", "9025"], | |
| 467 | ["1.06", "9"], | |
| 468 | ["1.07", "3150730" ], | |
| 469 | ["1.08", "23"], | |
| 470 | ["1.09", "3150721" ], | |
| 471 | ["1.1", "0"], | |
| 472 | ["1.11", "0"], | |
| 473 | ["1.12", "0"], | |
| 474 | ["1.13", "0"], | |
| 475 | ["1.14", "C"], | |
| 476 | ["1.15", "0"], | |
| 477 | ["1.16", "0"], | |
| 478 | ["1.17", "1"], | |
| 479 | ["1.18", "0"] | |
| 480 | ] | |
| 481 | ||
| 482 | params = [dfn, prv , vamc, fl ds] | |
| 483 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 484 | end | |
| 485 | ||
| 486 | When(/^the client (? :add new|t ry to add existing) Drug Aller gy record for patien t with DFN "(.*?)"$/ ) do |dfn, table| | |
| 487 | expected _array = % W[referenc e_date cau sative_age nt histori cal author _dictator type_name nature_of_ reaction s ymptom1 sy mptom2 sev erity comm ent] | |
| 488 | table_to _hash = co nvert_tabl e_to_hash( table, exp ected_arra y) | |
| 489 | hash_tab le = table _to_hash[0 ] | |
| 490 | hash_tab le_dec = t able_to_ha sh[1] | |
| 491 | referenc e_date = h ash_table[ "reference _date"] | |
| 492 | referenc e_date = c hange_date (reference _date) | |
| 493 | ||
| 494 | rpc_name = "HMP WR ITEBACK AL LERGY" | |
| 495 | flds = [ | |
| 496 | ["\"GMRA CHT\",0", "1"], | |
| 497 | ["\"GMRA CHT\",1", reference_ date], | |
| 498 | ["\"GMRA GNT\"", ha sh_table[" causative_ agent"]], | |
| 499 | ["\"GMRA OBHX\"", h ash_table[ "historica l"]], | |
| 500 | ["\"GMRA ORDT\"", r eference_d ate], | |
| 501 | ["\"GMRA ORIG\"", h ash_table[ "author_di ctator"]], | |
| 502 | ["\"GMRA ORDT\"", r eference_d ate], | |
| 503 | ["\"GMRA SEVR\"", " 2"], | |
| 504 | ["\"GMRA TYPE\"", h ash_table[ "type_name "]], | |
| 505 | ["\"GMRA NATR\"", h ash_table[ "nature_of _reaction" ]], | |
| 506 | ["\"GMRA SYMP\",0", "2"], | |
| 507 | ["\"GMRA SYMP\",1", hash_tabl e["symptom 1"]], | |
| 508 | ["\"GMRA SYMP\",2", hash_tabl e["symptom 2"]], | |
| 509 | ["\"GMRA RDT\"", re ference_da te], | |
| 510 | ["\"GMRA CMTS\",0", hash_tabl e["severit y"]], | |
| 511 | ["\"GMRA CMTS\",1", hash_tabl e["comment "]] | |
| 512 | ] | |
| 513 | ||
| 514 | data = h ash_table_ dec["causa tive_agent "] | |
| 515 | @recorde _exisit = check_data _exisit_fo r_allergy( data) | |
| 516 | ||
| 517 | params = ["0", dfn , flds] | |
| 518 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 519 | end | |
| 520 | ||
| 521 | When(/^the client ad d (?:new|s ame) Immun ization re cord for p atient wit h DFN "(.* ?)" enter$ /) do |dfn , table| | |
| 522 | hash_tab le = {} | |
| 523 | hash_tab le_dec = { } | |
| 524 | table.ro ws.each do |field, d ec, value| | |
| 525 | hash_t able[field ] = value | |
| 526 | hash_t able_dec[f ield] = d ec | |
| 527 | end | |
| 528 | ||
| 529 | table_ke ys = hash_ table.keys | |
| 530 | table_ke ys = table _keys.map( &:downcase ) | |
| 531 | expected _array = % W[contra s eries reac tion contr aindicated comment] | |
| 532 | expect(t able_keys) .to match_ array(expe cted_array ), "Please check you r code. \n expected array: #{e xpected_ar ray} \n go t: #{table _keys} " | |
| 533 | ||
| 534 | rpc_name = "HMP WR ITEBACK IM MUNIZATION " | |
| 535 | # data=" DFN^IEN^ho spitalLoca tion^date/ time^A^991 ^IMM^immun izationTyp e^series^R ESULT CODE ^comments date^react ion^CONTRA INDICATED" | |
| 536 | hash_tab le["commen t"] = hash _table["co mment"] + " at " + T ime.new.to _s | |
| 537 | p data = dfn + "^0 ^229^31508 25.171130^ A^991^IMM^ " + hash_t able["cont ra"] + "^" + hash_ta ble["serie s"] + "^1^ " + hash_t able["comm ent"] + "^ " + hash_t able["reac tion"] + " ^" + hash_ table["con traindicat ed"] | |
| 538 | ||
| 539 | # p @res ponse | |
| 540 | data_che ck = [["cp tName", ha sh_table_d ec["contra "]], ["adm inisteredD ateTime", "201508251 71130"]] | |
| 541 | @recorde _exisit = check_data _exisit(da ta_check) | |
| 542 | ||
| 543 | params = ["0", dfn , data] | |
| 544 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 545 | end | |
| 546 | ||
| 547 | When(/^new the clien t add (?:n ew|same) I mmunizatio n record f or patient with DFN "(.*?)" en ter$/) do |dfn, tabl e| | |
| 548 | expected _array = % W[inpatien t location date_time service_c ategory pr ovider_ien immunizat ion_ien ca tegory nar rative_of_ immunizati on] | |
| 549 | expected _array = e xpected_ar ray + %W[s eries enco unter_prov ider react ion contra indicated next_comme nt_sequenc e cvx_code event dos e route ad min_site] | |
| 550 | expected _array = e xpected_ar ray + %W[l ot manufac turer expi ration_dat e event_da te orderin g_provider vis remar ks non_kno w] | |
| 551 | # expect ed_array = %W[refere nce_date c ontra seri es reactio n contrain dicated co mment resu lt_code lo t_number e xpiration_ date manuf acturer in fo_source order_prov ider route dose vis_ date] | |
| 552 | ||
| 553 | table_to _hash = co nvert_tabl e_to_hash( table, exp ected_arra y) | |
| 554 | piece = table_to_h ash[0] | |
| 555 | piece_de c = table_ to_hash[1] | |
| 556 | ||
| 557 | # p piec e["date_ti me"] = cha nge_date(p iece["date _time"]) | |
| 558 | ||
| 559 | rpc_name = "HMP WR ITEBACK IM MUNIZATION " | |
| 560 | p piece[ "next_comm ent_sequen ce"] | |
| 561 | # piece[ "next_comm ent_sequen ce"] = pie ce["next_c omment_seq uence"] + " at " + T ime.new.to _s | |
| 562 | ||
| 563 | # DATA=" DFNEncount erPatient^ EncounterI npatient^E ncounterLo cation^Enc ounterDate Time^Encou nterServic eCategory^ ProviderIE N^IMM^Immu nizationIE N^Category ^ | |
| 564 | # Narrat iveOfImmun ization^Se ries^Encou nterProvid er^Reactio n^Contrain dicated^^N extComment Sequence^C VXCode^Eve ntInfoSour ce;HL7Code ;IEN^Dose; Units;Unit sIEN^ | |
| 565 | # RouteN ame;HL7Cod e;IEN^Admi nSiteName; HL7Code;IE N^Lot#;IEN ^Manufactu rer^Expira tionDate^E ventDateTi me^Orderin gProvider^ VIS^Remark s" | |
| 566 | ||
| 567 | data = d fn + "^" + piece["in patient"] + "^" + pi ece["locat ion"] + "^ " + piece[ "date_time "] + "^" + piece["se rvice_cate gory"] + " ^" + piece ["provider _ien"] | |
| 568 | data = d ata + "^IM M^" + piec e["immuniz ation_ien" ] + "^" + piece["cat egory"] + "^" + piec e["narrati ve_of_immu nization"] + "^" + p iece["seri es"] | |
| 569 | data = d ata + "^" + piece["e ncounter_p rovider"] + "^" + pi ece["react ion"] + "^ " + piece[ "contraind icated"] + "^" + pie ce["non_kn ow"] + "^" + piece[" next_comme nt_sequenc e"] | |
| 570 | data = d ata + "^" + piece["c vx_code"] + "^" + pi ece["event "] + "^" + piece["do se"] + "^" + piece[" route"] + "^" + piec e["admin_s ite"] | |
| 571 | data = d ata + "^" + piece["l ot"] + "^" + piece[" manufactur er"] + "^" + piece[" expiration _date"] + "^" + piec e["event_d ate"] | |
| 572 | p data = data + "^ " + piece[ "ordering_ provider"] + "^" + p iece["vis" ] + "^" + piece["rem arks"] | |
| 573 | # p "Orl ando date" | |
| 574 | # p data _o = dfn + "^0^229^3 151020.145 115^A^991^ IMM^15^^DT AP^3^^FEVE R^1^^COMME NT^1^Histo rical info rmation -s ource unsp ecified;ID ;1^DOSE^OR AL^1^EHMP0 001^ABBOTT LABORATOR IES^OCT 20 ,2015^3151 022.145115 ^86^315102 7.174303^O neRemark" | |
| 575 | # p "Tim date" | |
| 576 | # p data _t = dfn + "^0^229^3 150121.174 303^A^991^ IMM^35^3^1 ^This is a comment!^ FEVER^0^EH MP0001;1^3 151201.000 000^ABBOTT LABORATOR IES^0;1^1^ INTRADERMA L;ID;1^DOS E^1/311071 4.000000;2 /3100310.0 00000" | |
| 577 | # # p @r esponse | |
| 578 | # p "Orl ando date" | |
| 579 | # p data = dfn + " ^0^229^315 0522.17430 3^A^991^IM M^1020^^DT AP^3^^FEVE R^1^^COMME NT^1^2^.25 ;mg;1^NASA L^LD^EHMP0 001;1^ABBO TT LABORAT ORIES^OCT 20,2015^OC T 21,2015^ 229^MEASLE S/MUMPS/RU BELLA VIS^ 1" | |
| 580 | ||
| 581 | data_che ck = [["cp tName", pi ece_dec["i mmunizatio n_ien"]], ["administ eredDateTi me", piece _dec["even t_date"]], ["uid", " CONTAINS " + @site_n ame]] | |
| 582 | @recorde _exisit = check_data _exisit(da ta_check) | |
| 583 | ||
| 584 | params = ["0", dfn , data] | |
| 585 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 586 | end | |
| 587 | ||
| 588 | When(/^the client ad d (?:new|s ame) Immun ization re cord using Encounter Form for patient wi th DFN "(. *?)" enter $/) do |df n, table| | |
| 589 | # @respo nse = @jds _response | |
| 590 | expected _array = % W[contra s eries reac tion contr aindicated comment] | |
| 591 | ||
| 592 | hash_tab le_return = convert_ table_to_h ash(table, expected_ array) | |
| 593 | hash_tab le = hash_ table_retu rn[0] | |
| 594 | hash_tab le_dec = h ash_table_ return[1] | |
| 595 | ||
| 596 | rpc_name = "HMP WR ITEBACK EN COUNTERS" | |
| 597 | hash_tab le["commen t"] = hash _table["co mment"] + " at " + T ime.new.to _s | |
| 598 | ||
| 599 | sub_data _a = dfn + "^0^229^3 150925.171 135^A^991^ IMM^" | |
| 600 | sub_data _b = hash_ table["con tra"] + "^ " + hash_t able["seri es"] + "^1 ^" + hash_ table["com ment"] + " ^" + hash_ table["rea ction"] + "^" + hash _table["co ntraindica ted"] | |
| 601 | p data = sub_data_ a + sub_da ta_b | |
| 602 | ||
| 603 | data_che ck = [["cp tName", ha sh_table_d ec["contra "]], ["adm inisteredD ateTime", "201509251 71135"], [ "uid", "CO NTAINS " + @site_nam e]] | |
| 604 | @recorde _exisit = check_data _exisit(da ta_check) | |
| 605 | ||
| 606 | params = ["0", dfn , data] | |
| 607 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 608 | end | |
| 609 | ||
| 610 | When(/^the client ad d (?:new|s ame) CPT r ecord usin g Encounte r Form for patient w ith DFN "( .*?)" ente r$/) do |d fn, table| | |
| 611 | # @respo nse = @jds _response | |
| 612 | expected _array = % W[procedur e modifier s provider quantity comment en tered proc edure_code ] | |
| 613 | ||
| 614 | hash_tab le_return = convert_ table_to_h ash(table, expected_ array) | |
| 615 | p hash_t able = has h_table_re turn[1] | |
| 616 | p hash_t able_dec = hash_tabl e_return[0 ] | |
| 617 | ||
| 618 | # data = dfn + "^0 ^32^307101 5.1507^X^9 83^CPT^" + "82000^^2 ^USER,PANO RAMA" | |
| 619 | # CPT^CP T code^Mod ifier1 cod e;Modifier 2 code;... ^Quantity^ Provider n ame^Commen t | |
| 620 | rpc_name = "HMP WR ITEBACK EN COUNTERS" | |
| 621 | hash_tab le["commen t"] = hash _table["co mment"] + " at " + T ime.new.to _s | |
| 622 | ||
| 623 | p entere d = hash_t able["ente red"] | |
| 624 | p entere d_time = e ntered.gsu b(".", "") | |
| 625 | len = en tered.leng th | |
| 626 | p last_u pdate_time = "3" + e ntered[2.. len] | |
| 627 | ||
| 628 | ||
| 629 | sub_data _a = dfn + "^0^32^" + last_upd ate_time + "^X^983^C PT^" | |
| 630 | sub_data _b = hash_ table["pro cedure_cod e"] + "^" + hash_tab le["modifi ers"] + "^ " + hash_t able["quan tity"] + " ^" + hash_ table["pro vider"] + "^" + hash _table["co mment"] | |
| 631 | p data = sub_data_ a + sub_da ta_b | |
| 632 | # data = dfn + "^0 ^32^307101 5.1507^X^9 83^CPT^" + "82000^^2 ^USER,PANO RAMA" | |
| 633 | ||
| 634 | data_che ck = [["na me", hash_ table["pro cedure"]], ["entered ", entered _time], [" uid", "CON TAINS " + @site_name ]] | |
| 635 | @recorde _exisit = check_data _exisit(da ta_check) | |
| 636 | # p "Doe s the reco rd exist? #{@record e_exisit}" | |
| 637 | ||
| 638 | params = ["0", dfn , data] | |
| 639 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 640 | end | |
| 641 | ||
| 642 | When(/^the client cr eate new N ote Stub r ecord for patient wi th DFN "(. *?)" enter $/) do |df n, table| | |
| 643 | sub_data = [] | |
| 644 | expected _array = % W[document _type auth or_dictato r referenc e_date com ment] | |
| 645 | table_to _hash = co nvert_tabl e_to_hash( table, exp ected_arra y) | |
| 646 | hash_tab le = table _to_hash[1 ] | |
| 647 | hash_tab le_dec = t able_to_ha sh[0] | |
| 648 | referenc e_date = h ash_table[ "reference _date"] | |
| 649 | referenc e_date = c hange_date (reference _date) | |
| 650 | ||
| 651 | hash_tab le["commen t"] = hash _table["co mment"] + " At: " + Time.new.t o_s | |
| 652 | ||
| 653 | p data = dfn + "^" + hash_ta ble["docum ent_type"] + "^^^^" + hash_tab le["author _dictator" ] + "^" + reference_ date + "^^ " | |
| 654 | ||
| 655 | sub_data [0] = ["\" data\"", d ata] | |
| 656 | sub_data [1] = ["\" text\",1", hash_tabl e["comment "]] | |
| 657 | ||
| 658 | p data = [sub_data [0], sub_d ata[1]] | |
| 659 | ||
| 660 | rpc_name = "HMP SA VE NOTE ST UB" | |
| 661 | ||
| 662 | params = [data] | |
| 663 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 664 | end | |
| 665 | ||
| 666 | When(/^the client (? :save|upda te the abo ve) TIU No te record for patien t with DFN "(.*?)" e nter$/) do |dfn, tab le| | |
| 667 | sub_data = [] | |
| 668 | expected _array = % W[ien docu ment_type visit_date visit_ien author_di ctator ref erence_dat e subject service_ca tegory com ment] | |
| 669 | table_to _hash = co nvert_tabl e_to_hash( table, exp ected_arra y) | |
| 670 | hash_tab le = table _to_hash[1 ] | |
| 671 | hash_tab le_dec = t able_to_ha sh[0] | |
| 672 | referenc e_date = h ash_table[ "reference _date"] | |
| 673 | referenc e_date = c hange_date (reference _date) | |
| 674 | ||
| 675 | hash_tab le["commen t"] = hash _table["co mment"] + " At: " + Time.new.t o_s | |
| 676 | ||
| 677 | data1 = dfn + "^" + hash_tab le["docume nt_type"] + "^" + ha sh_table[" visit_date "] + "^67^ " + hash_t able["visi t_ien"] + "^" | |
| 678 | data2 = hash_table ["author_d ictator"] + "^" + re ference_da te + "^" + hash_tabl e["subject "] + "^67; " + refere nce_date + ";" + has h_table["s ervice_cat egory"] | |
| 679 | p data12 = data1 + data2 | |
| 680 | sub_data [0] = ["\" data\"", d ata12] | |
| 681 | sub_data [1] = ["\" text\",1", hash_tabl e["comment "]] | |
| 682 | ||
| 683 | p data = [sub_data [0], sub_d ata[1]] | |
| 684 | ||
| 685 | rpc_name = "HMP WR ITEBACK TI U NOTE SAV E" | |
| 686 | ||
| 687 | p ien = hash_table ["ien"] | |
| 688 | p ien = @vista_loc al_id.to_s | |
| 689 | params = [ien, dat a] | |
| 690 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 691 | end | |
| 692 | ||
| 693 | When(/^the client si gn TIU Not e record f or patient with DFN "(.*?)" en ter$/) do |dfn, tabl e| | |
| 694 | ien = @v ista_local _id | |
| 695 | p rpc_na me = "HMP WRITEBACK SIGN TIU N OTE" | |
| 696 | access_cod e = " REDACTED " | |
| 697 | verify_cod e = " REDACTED " | |
| 698 | ||
| 699 | # ien = "11597" | |
| 700 | esig = " REDACTED " | |
| 701 | ||
| 702 | vista_rp c = VistaR PC4r::Vist aRPC.new(e sig) | |
| 703 | p esig = vista_rpc .encrypt(e sig) | |
| 704 | ||
| 705 | # data_c heck = [[" name", has h_table["p rocedure"] ], ["enter ed", enter ed_time], ["uid", "C ONTAINS " + @site_na me]] | |
| 706 | # @recor de_exisit = check_da ta_exisit( data_check ) | |
| 707 | p ien | |
| 708 | params = [ien, esi g] | |
| 709 | @vista_r esponse = rpc_write_ back(rpc_n ame, param s) | |
| 710 | end | |
| 711 | ||
| 712 | Then(/^sav e the loca l id from VistA writ e\-back re sponse$/) do | |
| 713 | p "^ loc alId"* 10 | |
| 714 | p @vista _local_id = @vista_o bj_msg["lo calId"] | |
| 715 | p "^ loc alId"* 10 | |
| 716 | expect(@ vista_loca l_id.to_i) .to be > 0 , "The loc al id shou ld be grea ter than z ero. \n Vi sta respon se: #{@vis ta_obj_msg }" | |
| 717 | end | |
| 718 | ||
| 719 | # -------- ---------- ---------- -- | |
| 720 | ||
| 721 | def rpc_wr ite_back(r pc_name, p arams) | |
| 722 | # @broke r.setConte xt('HMP UI CONTEXT') | |
| 723 | response = "" | |
| 724 | ||
| 725 | vrpc = V istaRPC4r: :VistaRPC. new(rpc_na me, VistaR PC4r::RPCR esponse::S INGLE_VALU E) | |
| 726 | ||
| 727 | i = 0 | |
| 728 | p params | |
| 729 | params.e ach do |pa ram| | |
| 730 | vrpc.p arams[i] = param | |
| 731 | i += 1 | |
| 732 | end | |
| 733 | ||
| 734 | # p vrpc | |
| 735 | p "* res ponse "* 10 | |
| 736 | p respon se = @brok er.execute (vrpc) | |
| 737 | p "* res ponse "* 10 | |
| 738 | ||
| 739 | p respon se if resp onse.value .empty? | |
| 740 | fail "Er ror: PLeas e read the above err or message #{respons e}" if res ponse.valu e.empty? | |
| 741 | return r esponse | |
| 742 | end | |
| 743 | ||
| 744 | def find_t otal_items (jds_respo nse) | |
| 745 | begin | |
| 746 | json_o bject = JS ON.parse(j ds_respons e.body) | |
| 747 | rescue E xception = > e | |
| 748 | err_me sf = "An e rror has o ccured at JSON::Pars er." + e.t o_s | |
| 749 | raise err_mesf | |
| 750 | end | |
| 751 | ||
| 752 | return j son_object ["data"][" totalItems "] | |
| 753 | end | |
| 754 | ||
| 755 | def check_ domain_nam e(domain) | |
| 756 | all_doma ins = { | |
| 757 | "ALLER GY" => "al lergy", "L AB" => "la b", "VITAL " => "vita l", "LAB O RDER" => " order", "V LER DOCUME NT" => "vl erdocument ", | |
| 758 | "MEDS" => "med", "CONSULT" => "consu lt", "PROB LEM LIST" => "proble m", "PROCE DURE" => " procedure" , | |
| 759 | "PURPO SE OF VISI T" => "pov ", "DOCUME NT" => "do cument", " APPOINTMEN T" => "app ointment", "PATIENT DEMOGRAPHI CS" => "pa tient", | |
| 760 | "EDUCA TION" => " education" , "VISIT" => "visit" , "FACTOR" => "facto r", "CPT" => "cpt", "SURGERY" => "surger y", | |
| 761 | "SKIN" => "skin" , "MENTAL HEALTH" => "mh", "EX AM" => "ex am", "IMMU NIZATION" =>"immuniz ation", "I MAGE" => " image" | |
| 762 | } | |
| 763 | domain_n ame = all_ domains[do main.upcas e] | |
| 764 | fail "Pl ease check your step ruby file . \n This domain: #{ domain} do es not spe cify in ou r test. \n #{all_dom ains.keys} " if domai n_name.nil ? || domai n_name.emp ty? | |
| 765 | return d omain.down case | |
| 766 | end | |
| 767 | ||
| 768 | def find_r emoved_val ue_for_uid (response, local_id, site_name ) | |
| 769 | json_obj ect = JSON .parse(res ponse.body ) | |
| 770 | updated = json_obj ect["data" ]["updated "] | |
| 771 | result_a rray = jso n_object[" data"]["it ems"] | |
| 772 | p result _array.siz e | |
| 773 | result_a rray.each do |object | | |
| 774 | ||
| 775 | if (ob ject["uid" ].include? local_id) && (objec t["uid"].i nclude? si te_name) | |
| 776 | p "T his is the last acce ss time #{ updated}" | |
| 777 | p "T his is the uid of th e patieont that EIE: #{object[ "uid"]}" | |
| 778 | p "T his is the value of removed ob ject for t he patieon t that EIE : #{object ["removed" ]}" | |
| 779 | p "T his is the stanp tim e of the p atieont th at EIE: #{ object["st ampTime"]} " | |
| 780 | remo ved_value = object[" removed"] | |
| 781 | remo ved_value = removed_ value.to_s | |
| 782 | @sta mp_time = object["st ampTime"] | |
| 783 | retu rn removed _value | |
| 784 | end | |
| 785 | ||
| 786 | end | |
| 787 | return " false" | |
| 788 | end | |
| 789 | ||
| 790 | def pick_l ocal_id_th at_has_rem oved_value _false(res ponse, sit e_name) | |
| 791 | json_obj ect = JSON .parse(res ponse.body ) | |
| 792 | updated = json_obj ect["data" ]["updated "] | |
| 793 | result_a rray = jso n_object[" data"]["it ems"] | |
| 794 | result_a rray.each do |object | | |
| 795 | p remo ved_value = object[" removed"] | |
| 796 | if (re moved_valu e.nil?) && (object[" uid"].incl ude? site_ name) | |
| 797 | retu rn object[ "localId"] | |
| 798 | end | |
| 799 | ||
| 800 | end | |
| 801 | fail "Pl ease selec t another patient. T his patien t does not have any recodr ro mark them as EIE" | |
| 802 | end | |
| 803 | ||
| 804 | def check_ data_exisi t(table) | |
| 805 | if @tota l_items > 0 | |
| 806 | value_ field = Ve rifyJsonRu ntimeValue .new | |
| 807 | runtim e_json_obj ect = find _object_fr om_respons e(@jds_res ponse) | |
| 808 | runtim e_json_obj ect = runt ime_json_o bject["dat a"]["items "] | |
| 809 | ||
| 810 | data_e xist = val ue_field.v erify_json _runtime_v laue_for_a rray(runti me_json_ob ject, tabl e, false) | |
| 811 | p "The data foun d in the r ecord: #{d ata_exist} " | |
| 812 | return data_exis t | |
| 813 | else | |
| 814 | return false | |
| 815 | end | |
| 816 | end | |
| 817 | ||
| 818 | def check_ data_exisi t_for_alle rgy(data) | |
| 819 | return f alse unles s @total_i tems > 0 | |
| 820 | ||
| 821 | value_fi eld = Veri fyJsonRunt imeValue.n ew | |
| 822 | runtime_ json_objec t = find_o bject_from _response( @jds_respo nse) | |
| 823 | runtime_ json_objec t = runtim e_json_obj ect["data" ]["items"] | |
| 824 | ||
| 825 | runtime_ json_objec t.each do |object| | |
| 826 | ||
| 827 | if obj ect["remov ed"] == ni l && objec t["product s"][0]["na me"] == da ta | |
| 828 | p "T he patient allready has #{data } on uid: #{object[" uid"]}" | |
| 829 | data _exist = t rue | |
| 830 | retu rn true | |
| 831 | end | |
| 832 | ||
| 833 | end | |
| 834 | return f alse | |
| 835 | end | |
| 836 | ||
| 837 | def find_o bject_from _response( response, for_value_ or_body = "body") | |
| 838 | # return nil if @r ecorde_exi sit | |
| 839 | if for_v alue_or_bo dy == "bod y" | |
| 840 | respon se = respo nse.body | |
| 841 | else | |
| 842 | respon se = respo nse.value | |
| 843 | end | |
| 844 | ||
| 845 | begin | |
| 846 | json_o bject = JS ON.parse(r esponse) | |
| 847 | rescue E xception = > e | |
| 848 | err_me sf = "PLea se check y our VistA response. An error h as occured at JSON:: Parser." + e.to_s + "\n VistA response: " + respon se | |
| 849 | raise err_mesf | |
| 850 | end | |
| 851 | return j son_object | |
| 852 | end | |
| 853 | ||
| 854 | def conver t_table_to _hash(tabl e, expecte d_array) | |
| 855 | hash_tab le = {} | |
| 856 | hash_tab le_dec = { } | |
| 857 | table.ro ws.each do |field, d ec, value| | |
| 858 | hash_t able[field ] = value | |
| 859 | hash_t able_dec[f ield] = d ec | |
| 860 | end | |
| 861 | ||
| 862 | table_ke ys = hash_ table.keys | |
| 863 | table_ke ys = table _keys.map( &:downcase ) | |
| 864 | ||
| 865 | expect(t able_keys) .to match_ array(expe cted_array ), "Please check you r code. \n expected array: #{e xpected_ar ray} \n go t: #{table _keys} " | |
| 866 | return h ash_table, hash_tabl e_dec | |
| 867 | end | |
| 868 | ||
| 869 | def change _date(date ) | |
| 870 | len = da te.length | |
| 871 | date = " 3" + date[ 2..len] | |
| 872 | return d ate | |
| 873 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.