Produced by Araxis Merge on 10/3/2017 11:16:07 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\data_load_scripts\domain_loaders | medication_outpatient.rb | Tue Jan 10 16:20:50 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\tests\data_load_scripts\domain_loaders | medication_outpatient.rb | Mon Oct 2 20:10:20 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 380 |
| 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 | require 'v istarpc4r' | |
| 2 | require 'c sv' | |
| 3 | ||
| 4 | ||
| 5 | # this scr ipt will a dd an amou nt of pend ing outpat ient medic ation to a patient | |
| 6 | ||
| 7 | # options | |
| 8 | #--------- ---------- ---------- ------- | |
| 9 | serve_ip = " IP " | |
| 10 | meds_amoun t = 12516 | |
| 11 | patient_id = 100841 #alpha tes t | |
| 12 | #--------- ---------- ---------- ------- | |
| 13 | ||
| 14 | @broker = VistaRPC4r ::RPCBroke rConnectio n.new(serv e_ip, 9210 , "PR12345 ", "PR1234 5!!", fals e) | |
| 15 | @broker.co nnect | |
| 16 | @broker.se tContext(' OR CPRS GU I CHART') | |
| 17 | ||
| 18 | vrpc = Vis taRPC4r::V istaRPC.ne w("ORWUL F V4DG", Vis taRPC4r::R PCResponse ::SINGLE_V ALUE) | |
| 19 | ||
| 20 | vrpc.param s = [ | |
| 21 | "U D RX", | |
| 22 | ] | |
| 23 | ||
| 24 | resp = @br oker.execu te(vrpc) | |
| 25 | ||
| 26 | drug_table = resp.va lue.split( '^').first | |
| 27 | ||
| 28 | def get_do se(select_ med, name) | |
| 29 | vr pc = Vista RPC4r::Vis taRPC.new( "ORWDPS2 O ISLCT", Vi staRPC4r:: RPCRespons e::ARRAY) | |
| 30 | ||
| 31 | vr pc.params = [ | |
| 32 | sele ct_med, | |
| 33 | "U", | |
| 34 | "3", | |
| 35 | "Y", | |
| 36 | "Y" | |
| 37 | ] | |
| 38 | ||
| 39 | do ses = [] | |
| 40 | ||
| 41 | re sp = @brok er.execute (vrpc) | |
| 42 | ||
| 43 | is _dose = fa lse | |
| 44 | re sp.value.e ach_with_i ndex do |d , index| | |
| 45 | is_d ose = fals e if d == "~Dispense " | |
| 46 | ||
| 47 | if i s_dose | |
| 48 | array = d.split( '^') | |
| 49 | ||
| 50 | detail s_array = array[3].s plit('&') | |
| 51 | ||
| 52 | # puts "#{select _med} - #{ name} - #{ details_ar ray[5]} - #{array[4] }" # this is the amo unt | |
| 53 | ||
| 54 | dose = {id: deta ils_array[ 5], amount : array[4] , all: arr ay[3]} | |
| 55 | ||
| 56 | doses. push(dose) | |
| 57 | ||
| 58 | end | |
| 59 | is_d ose = true if d == " ~Dosage" | |
| 60 | en d | |
| 61 | do ses | |
| 62 | end | |
| 63 | ||
| 64 | all_drugs = {} | |
| 65 | ||
| 66 | vrpc = Vis taRPC4r::V istaRPC.ne w("ORWUL F VSUB", Vis taRPC4r::R PCResponse ::ARRAY) | |
| 67 | ||
| 68 | vrpc.param s = [ | |
| 69 | dr ug_table, | |
| 70 | "1 ", | |
| 71 | "1 0000" | |
| 72 | ] | |
| 73 | ||
| 74 | resp = @br oker.execu te(vrpc) | |
| 75 | ||
| 76 | resp.value .each do | d| | |
| 77 | array = d.split( '^') | |
| 78 | ||
| 79 | unless array[1]. nil? | |
| 80 | unless a rray[1].in clude?('<' ) | |
| 81 | all_ drugs[arra y[0]] = ar ray[1] | |
| 82 | end | |
| 83 | en d | |
| 84 | end | |
| 85 | ||
| 86 | ||
| 87 | all_dose = [] | |
| 88 | ||
| 89 | all_drugs. each do |k ey, value| | |
| 90 | do se = get_d ose(key, v alue) | |
| 91 | do se.each do |d| | |
| 92 | d[:m ed] = valu e | |
| 93 | d[:m ed_id] = k ey | |
| 94 | all_ dose << d | |
| 95 | en d | |
| 96 | end | |
| 97 | ||
| 98 | def save_m ed(patient _id, dose, schedule, supply, q uantity, r efills, lo cation, ro ute) | |
| 99 | vr pc = Vista RPC4r::Vis taRPC.new( "ORWDX SAV E", VistaR PC4r::RPCR esponse::A RRAY) | |
| 100 | ||
| 101 | vr pc.params = [ | |
| 102 | pati ent_id, | |
| 103 | "991 ", | |
| 104 | loca tion, | |
| 105 | "PSO OERR", | |
| 106 | "4", | |
| 107 | "147 ", | |
| 108 | "", | |
| 109 | [ | |
| 110 | ["4,1" , dose[:me d_id]], | |
| 111 | ["136, 1",dose[:a mount]], | |
| 112 | ["138, 1",dose[:i d]], | |
| 113 | ["386, 1",dose[:a ll]], | |
| 114 | ["384, 1",dose[:a mount]], | |
| 115 | ["137, 1",route], #route | |
| 116 | ["170, 1",schedul e], #schedul e | |
| 117 | ["7,1" ,"9"], #urgency | |
| 118 | ["15,1 ","ORDIALO G(\"WP\",1 5,1)"], | |
| 119 | ["387, 1",supply] , #supply | |
| 120 | ["149, 1",quantit y], #quantit y | |
| 121 | ["150, 1",refills ], #refills | |
| 122 | ["151, 1",""], | |
| 123 | ["148, 1","W"], #pickup location | |
| 124 | ["1358 ,1","ORDIA LOG(\"WP\" ,1358,1)"] , | |
| 125 | ["\"WP \",1358,1, 1,0",""], | |
| 126 | ["385, 1","ORDIAL OG(\"WP\", 385,1)"], | |
| 127 | ["\"WP \",385,1,1 ,0",""], #sig? | |
| 128 | ["\"OR CHECK\""," 2"], | |
| 129 | ["\"OR CHECK\",\" NEW\",\"2\ ",\"1\""," 99^2^Remot e Order Ch ecking not available - checks done on lo cal data o nly"], | |
| 130 | ["\"OR CHECK\",\" NEW\",\"2\ ",\"2\""," 25^2^||636 59,53872,N EW&These c hecks coul d not be c ompleted f or this pa tient: "], | |
| 131 | ["\"OR TS\"","0"] | |
| 132 | ], | |
| 133 | "", | |
| 134 | "", | |
| 135 | "", | |
| 136 | "0" | |
| 137 | ] | |
| 138 | ||
| 139 | re sp = @brok er.execute (vrpc) | |
| 140 | or der_id = r esp.value. first.spli t('^').fir st.split(' ~').last | |
| 141 | ||
| 142 | vr pc = Vista RPC4r::Vis taRPC.new( "ORWDX SEN D", VistaR PC4r::RPCR esponse::A RRAY) | |
| 143 | ||
| 144 | vr pc.params = [ | |
| 145 | pati ent_id, | |
| 146 | "991 ", | |
| 147 | loca tion, | |
| 148 | "", | |
| 149 | [ | |
| 150 | ["1"," #{order_id }^1^1^E"] | |
| 151 | ], | |
| 152 | ] | |
| 153 | ||
| 154 | re sp = @brok er.execute (vrpc) | |
| 155 | end | |
| 156 | ||
| 157 | count = 0 | |
| 158 | while coun t < meds_a mount | |
| 159 | Fi le.open(". /med_list. txt", "r") do |f| | |
| 160 | f.ea ch_line do |line| | |
| 161 | med_do se = line. strip.spli t(" - ") | |
| 162 | med_na me = med_d ose[0] | |
| 163 | amount = med_dos e[1] | |
| 164 | ||
| 165 | schedu le = "BID" | |
| 166 | ||
| 167 | matchi ng_doses = all_dose. select{|d| d[:med] = = med_name && d[:amo unt] == am ount} | |
| 168 | ||
| 169 | supply = "90" | |
| 170 | quanti ty = "180" | |
| 171 | refill s = "2" | |
| 172 | locati on = "298" | |
| 173 | route = "15" | |
| 174 | ||
| 175 | begin | |
| 176 | save_med (patient_i d, matchin g_doses.fi rst, sched ule, suppl y, quantit y, refills , location , route) | |
| 177 | puts "me d created" | |
| 178 | count = count + 1 | |
| 179 | if count >= meds_a mount | |
| 180 | break | |
| 181 | end | |
| 182 | rescue | |
| 183 | puts "me d failed" | |
| 184 | end | |
| 185 | end | |
| 186 | en d | |
| 187 | end | |
| 188 | ||
| 189 | puts "#{co unt} meds created" | |
| 190 | ||
| 191 | @broker.cl ose |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.