allscripts_unity_client 1.3.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +66 -66
- data/allscripts_unity_client.gemspec +32 -32
- data/lib/allscripts_unity_client/client.rb +215 -205
- data/lib/allscripts_unity_client/client_driver.rb +15 -42
- data/lib/allscripts_unity_client/client_options.rb +68 -0
- data/lib/allscripts_unity_client/json_client_driver.rb +46 -50
- data/lib/allscripts_unity_client/json_unity_request.rb +20 -20
- data/lib/allscripts_unity_client/json_unity_response.rb +1 -1
- data/lib/allscripts_unity_client/soap_client_driver.rb +29 -29
- data/lib/allscripts_unity_client/timezone.rb +15 -10
- data/lib/allscripts_unity_client/unity_request.rb +17 -17
- data/lib/allscripts_unity_client/unity_response.rb +3 -3
- data/lib/allscripts_unity_client/utilities.rb +5 -5
- data/lib/allscripts_unity_client/version.rb +1 -1
- data/lib/allscripts_unity_client.rb +21 -25
- data/spec/allscripts_unity_client_spec.rb +12 -16
- data/spec/client_driver_spec.rb +1 -49
- data/spec/client_options_spec.rb +134 -0
- data/spec/client_spec.rb +9 -9
- data/spec/factories/allscripts_unity_client_parameters_factory.rb +2 -2
- data/spec/factories/client_driver_factory.rb +4 -5
- data/spec/factories/client_factory.rb +2 -2
- data/spec/factories/client_options.rb +13 -0
- data/spec/factories/json_client_driver_factory.rb +1 -1
- data/spec/factories/json_unity_request_factory.rb +1 -1
- data/spec/factories/json_unity_response_factory.rb +1 -1
- data/spec/factories/magic_request_factory.rb +4 -4
- data/spec/factories/soap_client_driver_factory.rb +1 -1
- data/spec/factories/timezone_factory.rb +2 -2
- data/spec/factories/unity_request_factory.rb +3 -3
- data/spec/factories/unity_response_factory.rb +2 -2
- data/spec/json_client_driver_spec.rb +18 -86
- data/spec/json_unity_request_spec.rb +7 -7
- data/spec/json_unity_response_spec.rb +6 -6
- data/spec/soap_client_driver_spec.rb +20 -82
- data/spec/spec_helper.rb +5 -9
- data/spec/support/shared_examples_for_client_driver.rb +37 -58
- data/spec/support/shared_examples_for_unity_request.rb +13 -13
- data/spec/support/shared_examples_for_unity_response.rb +4 -4
- data/spec/timezone_spec.rb +31 -11
- data/spec/unity_request_spec.rb +7 -7
- data/spec/unity_response_spec.rb +4 -4
- data/spec/utilities_spec.rb +2 -2
- metadata +30 -57
@@ -1,15 +1,19 @@
|
|
1
|
-
require
|
1
|
+
require 'nokogiri'
|
2
2
|
|
3
3
|
module AllscriptsUnityClient
|
4
4
|
class Client
|
5
5
|
attr_accessor :client_driver
|
6
6
|
|
7
7
|
def initialize(client_driver)
|
8
|
-
raise ArgumentError,
|
8
|
+
raise ArgumentError, 'client_driver can not be nil' if client_driver.nil?
|
9
9
|
|
10
10
|
@client_driver = client_driver
|
11
11
|
end
|
12
12
|
|
13
|
+
def options
|
14
|
+
@client_driver.options
|
15
|
+
end
|
16
|
+
|
13
17
|
def magic(parameters = {})
|
14
18
|
@client_driver.magic(parameters)
|
15
19
|
end
|
@@ -27,79 +31,85 @@ module AllscriptsUnityClient
|
|
27
31
|
end
|
28
32
|
|
29
33
|
def client_type
|
30
|
-
|
34
|
+
@client_driver.client_type
|
31
35
|
end
|
32
36
|
|
33
37
|
def commit_charges
|
34
|
-
raise NotImplementedError,
|
38
|
+
raise NotImplementedError, 'CommitCharges magic action not implemented'
|
35
39
|
end
|
36
40
|
|
37
41
|
def echo(echo_text)
|
38
42
|
magic_parameters = {
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
43
|
+
action: 'Echo',
|
44
|
+
userid: echo_text,
|
45
|
+
appname: echo_text,
|
46
|
+
patientid: echo_text,
|
47
|
+
parameter1: echo_text,
|
48
|
+
parameter2: echo_text,
|
49
|
+
parameter3: echo_text,
|
50
|
+
parameter4: echo_text,
|
51
|
+
parameter5: echo_text,
|
52
|
+
parameter6: echo_text
|
49
53
|
}
|
50
54
|
response = magic(magic_parameters)
|
51
55
|
response[:userid]
|
52
56
|
end
|
53
57
|
|
54
58
|
def get_account
|
55
|
-
raise NotImplementedError,
|
59
|
+
raise NotImplementedError, 'GetAccount magic action not implemented'
|
56
60
|
end
|
57
61
|
|
58
62
|
def get_changed_patients(since = nil)
|
59
63
|
magic_parameters = {
|
60
|
-
:
|
61
|
-
:
|
64
|
+
action: 'GetChangedPatients',
|
65
|
+
parameter1: since
|
62
66
|
}
|
63
67
|
magic(magic_parameters)
|
64
68
|
end
|
65
69
|
|
66
70
|
def get_charge_info_by_username
|
67
|
-
raise NotImplementedError,
|
71
|
+
raise NotImplementedError, 'GetChargeInfoByUsername magic action not implemented'
|
68
72
|
end
|
69
73
|
|
70
74
|
def get_charges
|
71
|
-
raise NotImplementedError,
|
75
|
+
raise NotImplementedError, 'GetCharges magic action not implemented'
|
72
76
|
end
|
73
77
|
|
74
78
|
def get_chart_item_details(userid, patientid, section)
|
75
79
|
magic_parameters = {
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
79
|
-
:
|
80
|
+
action: 'GetChartItemDetails',
|
81
|
+
userid: userid,
|
82
|
+
patientid: patientid,
|
83
|
+
parameter1: section
|
80
84
|
}
|
81
85
|
magic(magic_parameters)
|
82
86
|
end
|
83
87
|
|
84
88
|
def get_clinical_summary(userid, patientid)
|
85
89
|
magic_parameters = {
|
86
|
-
:
|
87
|
-
:
|
88
|
-
:
|
90
|
+
action: 'GetClinicalSummary',
|
91
|
+
userid: userid,
|
92
|
+
patientid: patientid
|
89
93
|
}
|
90
|
-
magic(magic_parameters)
|
94
|
+
response = magic(magic_parameters)
|
95
|
+
|
96
|
+
unless response.is_a?(Array)
|
97
|
+
response = [ response ]
|
98
|
+
end
|
99
|
+
|
100
|
+
response
|
91
101
|
end
|
92
102
|
|
93
103
|
def get_delegates
|
94
|
-
raise NotImplementedError,
|
104
|
+
raise NotImplementedError, 'GetDelegates magic action not implemented'
|
95
105
|
end
|
96
106
|
|
97
107
|
def get_dictionary(dictionary_name, userid = nil, site = nil)
|
98
108
|
magic_parameters = {
|
99
|
-
:
|
100
|
-
:
|
101
|
-
:
|
102
|
-
:
|
109
|
+
action: 'GetDictionary',
|
110
|
+
userid: userid,
|
111
|
+
parameter1: dictionary_name,
|
112
|
+
parameter2: site
|
103
113
|
}
|
104
114
|
response = magic(magic_parameters)
|
105
115
|
|
@@ -111,51 +121,51 @@ module AllscriptsUnityClient
|
|
111
121
|
end
|
112
122
|
|
113
123
|
def get_dictionary_sets
|
114
|
-
raise NotImplementedError,
|
124
|
+
raise NotImplementedError, 'GetDictionarySets magic action not implemented'
|
115
125
|
end
|
116
126
|
|
117
127
|
def get_doc_template
|
118
|
-
raise NotImplementedError,
|
128
|
+
raise NotImplementedError, 'GetDocTemplate magic action not implemented'
|
119
129
|
end
|
120
130
|
|
121
131
|
def get_document_by_accession
|
122
|
-
raise NotImplementedError,
|
132
|
+
raise NotImplementedError, 'GetDocumentByAccession magic action not implemented'
|
123
133
|
end
|
124
134
|
|
125
135
|
def get_document_image
|
126
|
-
raise NotImplementedError,
|
136
|
+
raise NotImplementedError, 'GetDocumentImage magic action not implemented'
|
127
137
|
end
|
128
138
|
|
129
139
|
def get_documents
|
130
|
-
raise NotImplementedError,
|
140
|
+
raise NotImplementedError, 'GetDocuments magic action not implemented'
|
131
141
|
end
|
132
142
|
|
133
143
|
def get_document_type
|
134
|
-
raise NotImplementedError,
|
144
|
+
raise NotImplementedError, 'GetDocumentType magic action not implemented'
|
135
145
|
end
|
136
146
|
|
137
147
|
def get_dur
|
138
|
-
raise NotImplementedError,
|
148
|
+
raise NotImplementedError, 'GetDUR magic action not implemented'
|
139
149
|
end
|
140
150
|
|
141
151
|
def get_encounter
|
142
|
-
raise NotImplementedError,
|
152
|
+
raise NotImplementedError, 'GetEncounter magic action not implemented'
|
143
153
|
end
|
144
154
|
|
145
155
|
def get_encounter_date
|
146
|
-
raise NotImplementedError,
|
156
|
+
raise NotImplementedError, 'GetEncounterDate magic action not implemented'
|
147
157
|
end
|
148
158
|
|
149
159
|
def get_encounter_list(userid, patientid, encounter_type, when_param = nil, nostradamus = nil, show_past_flag = nil, billing_provider_user_name = nil)
|
150
160
|
magic_parameters = {
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
156
|
-
:
|
157
|
-
:
|
158
|
-
:
|
161
|
+
action: 'GetEncounterList',
|
162
|
+
userid: userid,
|
163
|
+
patientid: patientid,
|
164
|
+
parameter1: encounter_type,
|
165
|
+
parameter2: when_param,
|
166
|
+
parameter3: nostradamus,
|
167
|
+
parameter4: show_past_flag,
|
168
|
+
parameter5: billing_provider_user_name
|
159
169
|
}
|
160
170
|
response = magic(magic_parameters)
|
161
171
|
|
@@ -165,113 +175,113 @@ module AllscriptsUnityClient
|
|
165
175
|
|
166
176
|
# Remove nil encounters
|
167
177
|
response.delete_if do |value|
|
168
|
-
value[:id] ==
|
178
|
+
value[:id] == '0' && value[:patientid] == '0'
|
169
179
|
end
|
170
180
|
end
|
171
181
|
|
172
182
|
def get_hie_document
|
173
|
-
raise NotImplementedError,
|
183
|
+
raise NotImplementedError, 'GetHIEDocument magic action not implemented'
|
174
184
|
end
|
175
185
|
|
176
186
|
def get_last_patient
|
177
|
-
raise NotImplementedError,
|
187
|
+
raise NotImplementedError, 'GetLastPatient magic action not implemented'
|
178
188
|
end
|
179
189
|
|
180
190
|
def get_list_of_dictionaries
|
181
|
-
raise NotImplementedError,
|
191
|
+
raise NotImplementedError, 'GetListOfDictionaries magic action not implemented'
|
182
192
|
end
|
183
193
|
|
184
194
|
def get_medication_by_trans_id(userid, patientid, transaction_id)
|
185
195
|
magic_parameters = {
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
189
|
-
:
|
196
|
+
action: 'GetMedicationByTransID',
|
197
|
+
userid: userid,
|
198
|
+
patientid: patientid,
|
199
|
+
parameter1: transaction_id
|
190
200
|
}
|
191
201
|
magic(magic_parameters)
|
192
202
|
end
|
193
203
|
|
194
204
|
def get_medication_info(userid, ddid, patientid = nil)
|
195
205
|
magic_parameters = {
|
196
|
-
:
|
197
|
-
:
|
198
|
-
:
|
199
|
-
:
|
206
|
+
action: 'GetMedicationInfo',
|
207
|
+
userid: userid,
|
208
|
+
patientid: patientid,
|
209
|
+
parameter1: ddid
|
200
210
|
}
|
201
211
|
magic(magic_parameters)
|
202
212
|
end
|
203
213
|
|
204
214
|
def get_order_history
|
205
|
-
raise NotImplementedError,
|
215
|
+
raise NotImplementedError, 'GetOrderHistory magic action not implemented'
|
206
216
|
end
|
207
217
|
|
208
218
|
def get_organization_id
|
209
|
-
raise NotImplementedError,
|
219
|
+
raise NotImplementedError, 'GetOrganizationID magic action not implemented'
|
210
220
|
end
|
211
221
|
|
212
222
|
def get_packages
|
213
|
-
raise NotImplementedError,
|
223
|
+
raise NotImplementedError, 'GetPackages magic action not implemented'
|
214
224
|
end
|
215
225
|
|
216
226
|
def get_patient(userid, patientid, includepix = nil)
|
217
227
|
magic_parameters = {
|
218
|
-
:
|
219
|
-
:
|
220
|
-
:
|
221
|
-
:
|
228
|
+
action: 'GetPatient',
|
229
|
+
userid: userid,
|
230
|
+
patientid: patientid,
|
231
|
+
parameter1: includepix
|
222
232
|
}
|
223
233
|
magic(magic_parameters)
|
224
234
|
end
|
225
235
|
|
226
236
|
def get_patient_activity(userid, patientid)
|
227
237
|
magic_parameters = {
|
228
|
-
:
|
229
|
-
:
|
230
|
-
:
|
238
|
+
action: 'GetPatientActivity',
|
239
|
+
userid: userid,
|
240
|
+
patientid: patientid
|
231
241
|
}
|
232
242
|
magic(magic_parameters)
|
233
243
|
end
|
234
244
|
|
235
245
|
def get_patient_by_mrn
|
236
|
-
raise NotImplementedError,
|
246
|
+
raise NotImplementedError, 'GetPatientByMRN magic action not implemented'
|
237
247
|
end
|
238
248
|
|
239
249
|
def get_patient_cda
|
240
|
-
raise NotImplementedError,
|
250
|
+
raise NotImplementedError, 'GetPatientCDA magic action not implemented'
|
241
251
|
end
|
242
252
|
|
243
253
|
def get_patient_diagnosis
|
244
|
-
raise NotImplementedError,
|
254
|
+
raise NotImplementedError, 'GetPatientDiagnosis magic action not implemented'
|
245
255
|
end
|
246
256
|
|
247
257
|
def get_patient_full
|
248
|
-
raise NotImplementedError,
|
258
|
+
raise NotImplementedError, 'GetPatientFull magic action not implemented'
|
249
259
|
end
|
250
260
|
|
251
261
|
def get_patient_ids
|
252
|
-
raise NotImplementedError,
|
262
|
+
raise NotImplementedError, 'GetPatientIDs magic action not implemented'
|
253
263
|
end
|
254
264
|
|
255
265
|
def get_patient_list
|
256
|
-
raise NotImplementedError,
|
266
|
+
raise NotImplementedError, 'GetPatientList magic action not implemented'
|
257
267
|
end
|
258
268
|
|
259
269
|
def get_patient_locations
|
260
|
-
raise NotImplementedError,
|
270
|
+
raise NotImplementedError, 'GetPatientLocations magic action not implemented'
|
261
271
|
end
|
262
272
|
|
263
273
|
def get_patient_pharmacies
|
264
|
-
raise NotImplementedError,
|
274
|
+
raise NotImplementedError, 'GetPatientPharmacies magic action not implemented'
|
265
275
|
end
|
266
276
|
|
267
277
|
def get_patient_problems(patientid, show_by_encounter_flag = nil, assessed = nil, encounter_id = nil, medcin_id = nil)
|
268
278
|
magic_parameters = {
|
269
|
-
:
|
270
|
-
:
|
271
|
-
:
|
272
|
-
:
|
273
|
-
:
|
274
|
-
:
|
279
|
+
action: 'GetPatientProblems',
|
280
|
+
patientid: patientid,
|
281
|
+
parameter1: show_by_encounter_flag,
|
282
|
+
parameter2: assessed,
|
283
|
+
parameter3: encounter_id,
|
284
|
+
parameter4: medcin_id
|
275
285
|
}
|
276
286
|
response = magic(magic_parameters)
|
277
287
|
|
@@ -284,40 +294,40 @@ module AllscriptsUnityClient
|
|
284
294
|
|
285
295
|
def get_patients_by_icd9(icd9, start = nil, end_param = nil)
|
286
296
|
magic_parameters = {
|
287
|
-
:
|
288
|
-
:
|
289
|
-
:
|
290
|
-
:
|
297
|
+
action: 'GetPatientsByICD9',
|
298
|
+
parameter1: icd9,
|
299
|
+
parameter2: start,
|
300
|
+
parameter3: end_param
|
291
301
|
}
|
292
302
|
magic(magic_parameters)
|
293
303
|
end
|
294
304
|
|
295
305
|
def get_patient_sections
|
296
|
-
raise NotImplementedError,
|
306
|
+
raise NotImplementedError, 'GetPatientSections magic action not implemented'
|
297
307
|
end
|
298
308
|
|
299
309
|
def get_procedures
|
300
|
-
raise NotImplementedError,
|
310
|
+
raise NotImplementedError, 'GetProcedures magic action not implemented'
|
301
311
|
end
|
302
312
|
|
303
313
|
def get_provider(provider_id = nil, user_name = nil)
|
304
314
|
if provider_id.nil? && user_name.nil?
|
305
|
-
raise ArgumentError,
|
315
|
+
raise ArgumentError, 'provider_id or user_name must be given'
|
306
316
|
end
|
307
317
|
|
308
318
|
magic_parameters = {
|
309
|
-
:
|
310
|
-
:
|
311
|
-
:
|
319
|
+
action: 'GetProvider',
|
320
|
+
parameter1: provider_id,
|
321
|
+
parameter2: user_name
|
312
322
|
}
|
313
323
|
magic(magic_parameters)
|
314
324
|
end
|
315
325
|
|
316
326
|
def get_providers(security_filter = nil, name_filter = nil)
|
317
327
|
magic_parameters = {
|
318
|
-
:
|
319
|
-
:
|
320
|
-
:
|
328
|
+
action: 'GetProviders',
|
329
|
+
parameter1: security_filter,
|
330
|
+
parameter2: name_filter
|
321
331
|
}
|
322
332
|
response = magic(magic_parameters)
|
323
333
|
|
@@ -329,50 +339,50 @@ module AllscriptsUnityClient
|
|
329
339
|
end
|
330
340
|
|
331
341
|
def get_ref_providers_by_specialty
|
332
|
-
raise NotImplementedError,
|
342
|
+
raise NotImplementedError, 'GetRefProvidersBySpecialty magic action not implemented'
|
333
343
|
end
|
334
344
|
|
335
345
|
def get_rounding_list_entries
|
336
|
-
raise NotImplementedError,
|
346
|
+
raise NotImplementedError, 'GetRoundingListEntries magic action not implemented'
|
337
347
|
end
|
338
348
|
|
339
349
|
def get_rounding_lists
|
340
|
-
raise NotImplementedError,
|
350
|
+
raise NotImplementedError, 'GetRoundingLists magic action not implemented'
|
341
351
|
end
|
342
352
|
|
343
353
|
def get_rx_favs
|
344
|
-
raise NotImplementedError,
|
354
|
+
raise NotImplementedError, 'GetRXFavs magic action not implemented'
|
345
355
|
end
|
346
356
|
|
347
357
|
def get_schedule
|
348
|
-
raise NotImplementedError,
|
358
|
+
raise NotImplementedError, 'GetSchedule magic action not implemented'
|
349
359
|
end
|
350
360
|
|
351
361
|
def get_server_info
|
352
362
|
magic_parameters = {
|
353
|
-
:
|
363
|
+
action: 'GetServerInfo'
|
354
364
|
}
|
355
365
|
magic(magic_parameters)
|
356
366
|
end
|
357
367
|
|
358
368
|
def get_sigs
|
359
|
-
raise NotImplementedError,
|
369
|
+
raise NotImplementedError, 'GetSigs magic action not implemented'
|
360
370
|
end
|
361
371
|
|
362
372
|
def get_task(userid, transaction_id)
|
363
373
|
magic_parameters = {
|
364
|
-
:
|
365
|
-
:
|
366
|
-
:
|
374
|
+
action: 'GetTask',
|
375
|
+
userid: userid,
|
376
|
+
parameter1: transaction_id
|
367
377
|
}
|
368
378
|
magic(magic_parameters)
|
369
379
|
end
|
370
380
|
|
371
381
|
def get_task_list(userid = nil, since = nil)
|
372
382
|
magic_parameters = {
|
373
|
-
:
|
374
|
-
:
|
375
|
-
:
|
383
|
+
action: 'GetTaskList',
|
384
|
+
userid: userid,
|
385
|
+
parameter1: since
|
376
386
|
}
|
377
387
|
response = magic(magic_parameters)
|
378
388
|
|
@@ -384,238 +394,238 @@ module AllscriptsUnityClient
|
|
384
394
|
end
|
385
395
|
|
386
396
|
def get_user_authentication
|
387
|
-
raise NotImplementedError,
|
397
|
+
raise NotImplementedError, 'GetUserAuthentication magic action not implemented'
|
388
398
|
end
|
389
399
|
|
390
400
|
def get_user_id
|
391
|
-
raise NotImplementedError,
|
401
|
+
raise NotImplementedError, 'GetUserID magic action not implemented'
|
392
402
|
end
|
393
403
|
|
394
404
|
def get_user_security
|
395
|
-
raise NotImplementedError,
|
405
|
+
raise NotImplementedError, 'GetUserSecurity magic action not implemented'
|
396
406
|
end
|
397
407
|
|
398
408
|
def get_vaccine_manufacturers
|
399
|
-
raise NotImplementedError,
|
409
|
+
raise NotImplementedError, 'GetVaccineManufacturers magic action not implemented'
|
400
410
|
end
|
401
411
|
|
402
412
|
def get_vitals
|
403
|
-
raise NotImplementedError,
|
413
|
+
raise NotImplementedError, 'GetVitals magic action not implemented'
|
404
414
|
end
|
405
415
|
|
406
416
|
def last_logs
|
407
417
|
magic_parameters = {
|
408
|
-
:
|
418
|
+
action: 'LastLogs'
|
409
419
|
}
|
410
420
|
magic(magic_parameters)
|
411
421
|
end
|
412
422
|
|
413
423
|
def make_task
|
414
|
-
raise NotImplementedError,
|
424
|
+
raise NotImplementedError, 'MakeTask magic action not implemented'
|
415
425
|
end
|
416
426
|
|
417
427
|
def save_admin_task
|
418
|
-
raise NotImplementedError,
|
428
|
+
raise NotImplementedError, 'SaveAdminTask magic action not implemented'
|
419
429
|
end
|
420
430
|
|
421
431
|
def save_allergy
|
422
|
-
raise NotImplementedError,
|
432
|
+
raise NotImplementedError, 'SaveAllergy magic action not implemented'
|
423
433
|
end
|
424
434
|
|
425
435
|
def save_ced
|
426
|
-
raise NotImplementedError,
|
436
|
+
raise NotImplementedError, 'SaveCED magic action not implemented'
|
427
437
|
end
|
428
438
|
|
429
439
|
def save_charge
|
430
|
-
raise NotImplementedError,
|
440
|
+
raise NotImplementedError, 'SaveCharge magic action not implemented'
|
431
441
|
end
|
432
442
|
|
433
443
|
def save_chart_view_audit
|
434
|
-
raise NotImplementedError,
|
444
|
+
raise NotImplementedError, 'SaveChartViewAudit magic action not implemented'
|
435
445
|
end
|
436
446
|
|
437
447
|
def save_diagnosis
|
438
|
-
raise NotImplementedError,
|
448
|
+
raise NotImplementedError, 'SaveDiagnosis magic action not implemented'
|
439
449
|
end
|
440
450
|
|
441
451
|
def save_document_image
|
442
|
-
raise NotImplementedError,
|
452
|
+
raise NotImplementedError, 'SaveDocumentImage magic action not implemented'
|
443
453
|
end
|
444
454
|
|
445
455
|
def save_er_note
|
446
|
-
raise NotImplementedError,
|
456
|
+
raise NotImplementedError, 'SaveERNote magic action not implemented'
|
447
457
|
end
|
448
458
|
|
449
459
|
def save_hie_document
|
450
|
-
raise NotImplementedError,
|
460
|
+
raise NotImplementedError, 'SaveHIEDocument magic action not implemented'
|
451
461
|
end
|
452
462
|
|
453
463
|
def save_history
|
454
|
-
raise NotImplementedError,
|
464
|
+
raise NotImplementedError, 'SaveHistory magic action not implemented'
|
455
465
|
end
|
456
466
|
|
457
467
|
def save_immunization
|
458
|
-
raise NotImplementedError,
|
468
|
+
raise NotImplementedError, 'SaveImmunization magic action not implemented'
|
459
469
|
end
|
460
470
|
|
461
471
|
def save_note
|
462
|
-
raise NotImplementedError,
|
472
|
+
raise NotImplementedError, 'SaveNote magic action not implemented'
|
463
473
|
end
|
464
474
|
|
465
475
|
def save_patient
|
466
|
-
raise NotImplementedError,
|
476
|
+
raise NotImplementedError, 'SavePatient magic action not implemented'
|
467
477
|
end
|
468
478
|
|
469
479
|
def save_patient_location
|
470
|
-
raise NotImplementedError,
|
480
|
+
raise NotImplementedError, 'SavePatientLocation magic action not implemented'
|
471
481
|
end
|
472
482
|
|
473
483
|
def save_problem
|
474
|
-
raise NotImplementedError,
|
484
|
+
raise NotImplementedError, 'SaveProblem magic action not implemented'
|
475
485
|
end
|
476
486
|
|
477
487
|
def save_problems_data
|
478
|
-
raise NotImplementedError,
|
488
|
+
raise NotImplementedError, 'SaveProblemsData magic action not implemented'
|
479
489
|
end
|
480
490
|
|
481
491
|
def save_ref_provider
|
482
|
-
raise NotImplementedError,
|
492
|
+
raise NotImplementedError, 'SaveRefProvider magic action not implemented'
|
483
493
|
end
|
484
494
|
|
485
495
|
def save_result
|
486
|
-
raise NotImplementedError,
|
496
|
+
raise NotImplementedError, 'SaveResult magic action not implemented'
|
487
497
|
end
|
488
498
|
|
489
499
|
def save_rx(userid, patientid, rxxml)
|
490
500
|
# Generate XML structure for rxxml
|
491
501
|
builder = Nokogiri::XML::Builder.new do |xml|
|
492
502
|
xml.saverx {
|
493
|
-
xml.field(
|
494
|
-
xml.field(
|
495
|
-
xml.field(
|
496
|
-
xml.field(
|
497
|
-
xml.field(
|
498
|
-
xml.field(
|
499
|
-
xml.field(
|
500
|
-
xml.field(
|
501
|
-
xml.field(
|
502
|
-
xml.field(
|
503
|
-
xml.field(
|
504
|
-
xml.field(
|
505
|
-
xml.field(
|
506
|
-
xml.field(
|
507
|
-
xml.field(
|
508
|
-
xml.field(
|
509
|
-
xml.field(
|
510
|
-
xml.field(
|
511
|
-
xml.field(
|
512
|
-
xml.field(
|
503
|
+
xml.field('name' => 'transid', 'value' => rxxml[:transid]) unless rxxml[:transid].nil?
|
504
|
+
xml.field('name' => 'PharmID', 'value' => rxxml[:pharmid]) unless rxxml[:pharmid].nil?
|
505
|
+
xml.field('name' => 'DDI', 'value' => rxxml[:ddi]) unless rxxml[:ddi].nil?
|
506
|
+
xml.field('name' => 'GPPCCode', 'value' => rxxml[:gppccode]) unless rxxml[:gppccode].nil?
|
507
|
+
xml.field('name' => 'GPPCText', 'value' => rxxml[:gppctext]) unless rxxml[:gppctext].nil?
|
508
|
+
xml.field('name' => 'GPPCCustom', 'value' => rxxml[:gppccustom]) unless rxxml[:gppccustom].nil?
|
509
|
+
xml.field('name' => 'Sig', 'value' => rxxml[:sig]) unless rxxml[:sig].nil?
|
510
|
+
xml.field('name' => 'QuanPresc', 'value' => rxxml[:quanpresc]) unless rxxml[:quanpresc].nil?
|
511
|
+
xml.field('name' => 'Refills', 'value' => rxxml[:refills]) unless rxxml[:refills].nil?
|
512
|
+
xml.field('name' => 'DAW', 'value' => rxxml[:daw]) unless rxxml[:daw].nil?
|
513
|
+
xml.field('name' => 'DaysSupply', 'value' => rxxml[:dayssupply]) unless rxxml[:dayssupply].nil?
|
514
|
+
xml.field('name' => 'startdate', 'value' => utc_to_local(Date.parse(rxxml[:startdate].to_s))) unless rxxml[:startdate].nil?
|
515
|
+
xml.field('name' => 'historicalflag', 'value' => rxxml[:historicalflag]) unless rxxml[:historicalflag].nil?
|
516
|
+
xml.field('name' => 'rxaction', 'value' => rxxml[:rxaction]) unless rxxml[:rxaction].nil?
|
517
|
+
xml.field('name' => 'delivery', 'value' => rxxml[:delivery]) unless rxxml[:delivery].nil?
|
518
|
+
xml.field('name' => 'ignorepharmzero', 'value' => rxxml[:ignorepharmzero]) unless rxxml[:ignorepharmzero].nil?
|
519
|
+
xml.field('name' => 'orderedbyid', 'value' => rxxml[:orderedbyid]) unless rxxml[:orderedbyid].nil?
|
520
|
+
xml.field('name' => 'newqty', 'value' => rxxml[:newqty]) unless rxxml[:newqty].nil?
|
521
|
+
xml.field('name' => 'newrefills', 'value' => rxxml[:newrefills]) unless rxxml[:newrefills].nil?
|
522
|
+
xml.field('name' => 'comments', 'value' => rxxml[:comments]) unless rxxml[:comments].nil?
|
513
523
|
}
|
514
524
|
end
|
515
525
|
|
516
526
|
magic_parameters = {
|
517
|
-
:
|
518
|
-
:
|
519
|
-
:
|
520
|
-
:
|
527
|
+
action: 'SaveRX',
|
528
|
+
userid: userid,
|
529
|
+
patientid: patientid,
|
530
|
+
parameter1: nokogiri_to_string(builder)
|
521
531
|
}
|
522
532
|
magic(magic_parameters)
|
523
533
|
end
|
524
534
|
|
525
535
|
def save_simple_encounter
|
526
|
-
raise NotImplementedError,
|
536
|
+
raise NotImplementedError, 'SaveSimpleEncounter magic action not implemented'
|
527
537
|
end
|
528
538
|
|
529
539
|
def save_simple_rx
|
530
|
-
raise NotImplementedError,
|
540
|
+
raise NotImplementedError, 'SaveSimpleRX magic action not implemented'
|
531
541
|
end
|
532
542
|
|
533
543
|
def save_specialist
|
534
|
-
raise NotImplementedError,
|
544
|
+
raise NotImplementedError, 'SaveSpecialist magic action not implemented'
|
535
545
|
end
|
536
546
|
|
537
547
|
def save_task(userid, patientid, task_type = nil, target_user = nil, work_object_id = nil, comments = nil)
|
538
548
|
if task_type.nil? && target_user.nil? && work_object_id.nil? && comments.nil?
|
539
|
-
raise ArugmentError,
|
549
|
+
raise ArugmentError, 'task_type, target_user, work_object_id, and comments can not all be nil'
|
540
550
|
end
|
541
551
|
|
542
552
|
magic_parameters = {
|
543
|
-
:
|
544
|
-
:
|
545
|
-
:
|
546
|
-
:
|
547
|
-
:
|
548
|
-
:
|
549
|
-
:
|
553
|
+
action: 'SaveTask',
|
554
|
+
userid: userid,
|
555
|
+
patientid: patientid,
|
556
|
+
parameter1: task_type,
|
557
|
+
parameter2: target_user,
|
558
|
+
parameter3: work_object_id,
|
559
|
+
parameter4: comments
|
550
560
|
}
|
551
561
|
magic(magic_parameters)
|
552
562
|
end
|
553
563
|
|
554
564
|
def save_task_status(userid, transaction_id = nil, status = nil, delegate_id = nil, comment = nil, taskchanges = nil)
|
555
565
|
if transaction_id.nil? && param.nil? && delegate_id.nil? && comment.nil?
|
556
|
-
raise ArugmentError,
|
566
|
+
raise ArugmentError, 'task_type, target_user, work_object_id, and comments can not all be nil'
|
557
567
|
end
|
558
568
|
|
559
569
|
# Generate XML structure for rxxml
|
560
570
|
builder = Nokogiri::XML::Builder.new do |xml|
|
561
571
|
xml.taskchanges {
|
562
|
-
xml.refills(
|
563
|
-
xml.days(
|
564
|
-
xml.qty(
|
565
|
-
xml.tasktype(
|
572
|
+
xml.refills('value' => taskchanges[:refills]) unless taskchanges.nil? || taskchanges[:refills].nil?
|
573
|
+
xml.days('value' => taskchanges[:days]) unless taskchanges.nil? || taskchanges[:days].nil?
|
574
|
+
xml.qty('value' => taskchanges[:qty]) unless taskchanges.nil? || taskchanges[:qty].nil?
|
575
|
+
xml.tasktype('value' => taskchanges[:tasktype]) unless taskchanges.nil? || taskchanges[:tasktype].nil?
|
566
576
|
}
|
567
577
|
end
|
568
578
|
|
569
579
|
magic_parameters = {
|
570
|
-
:
|
571
|
-
:
|
572
|
-
:
|
573
|
-
:
|
574
|
-
:
|
575
|
-
:
|
576
|
-
:
|
580
|
+
action: 'SaveTaskStatus',
|
581
|
+
userid: userid,
|
582
|
+
parameter1: transaction_id,
|
583
|
+
parameter2: status,
|
584
|
+
parameter3: delegate_id,
|
585
|
+
parameter4: comment,
|
586
|
+
parameter6: nokogiri_to_string(builder)
|
577
587
|
}
|
578
588
|
magic(magic_parameters)
|
579
589
|
end
|
580
590
|
|
581
591
|
def save_tiff
|
582
|
-
raise NotImplementedError,
|
592
|
+
raise NotImplementedError, 'SaveTiff magic action not implemented'
|
583
593
|
end
|
584
594
|
|
585
595
|
def save_unstructured_document
|
586
|
-
raise NotImplementedError,
|
596
|
+
raise NotImplementedError, 'SaveUnstructuredDocument magic action not implemented'
|
587
597
|
end
|
588
598
|
|
589
599
|
def save_v10_doc_signature
|
590
|
-
raise NotImplementedError,
|
600
|
+
raise NotImplementedError, 'SaveV10DocSignature magic action not implemented'
|
591
601
|
end
|
592
602
|
|
593
603
|
def save_v11_note
|
594
|
-
raise NotImplementedError,
|
604
|
+
raise NotImplementedError, 'SaveV11Note magic action not implemented'
|
595
605
|
end
|
596
606
|
|
597
607
|
def save_vitals
|
598
|
-
raise NotImplementedError,
|
608
|
+
raise NotImplementedError, 'SaveVitals magic action not implemented'
|
599
609
|
end
|
600
610
|
|
601
611
|
def save_vitals_data
|
602
|
-
raise NotImplementedError,
|
612
|
+
raise NotImplementedError, 'SaveVitalsData magic action not implemented'
|
603
613
|
end
|
604
614
|
|
605
615
|
def search_charge_codes
|
606
|
-
raise NotImplementedError,
|
616
|
+
raise NotImplementedError, 'SearchChargeCodes magic action not implemented'
|
607
617
|
end
|
608
618
|
|
609
619
|
def search_diagnosis_codes
|
610
|
-
raise NotImplementedError,
|
620
|
+
raise NotImplementedError, 'SearchDiagnosisCodes magic action not implemented'
|
611
621
|
end
|
612
622
|
|
613
623
|
def search_meds(userid, patientid, search = nil)
|
614
624
|
magic_parameters = {
|
615
|
-
:
|
616
|
-
:
|
617
|
-
:
|
618
|
-
:
|
625
|
+
action: 'SearchMeds',
|
626
|
+
userid: userid,
|
627
|
+
patientid: patientid,
|
628
|
+
parameter1: search
|
619
629
|
}
|
620
630
|
|
621
631
|
response = magic(magic_parameters)
|
@@ -629,44 +639,44 @@ module AllscriptsUnityClient
|
|
629
639
|
|
630
640
|
def search_patients(search)
|
631
641
|
magic_parameters = {
|
632
|
-
:
|
633
|
-
:
|
642
|
+
action: 'SearchPatients',
|
643
|
+
parameter1: search
|
634
644
|
}
|
635
645
|
magic(magic_parameters)
|
636
646
|
end
|
637
647
|
|
638
648
|
def search_patients_rxhub5
|
639
|
-
raise NotImplementedError,
|
649
|
+
raise NotImplementedError, 'SearchPatientsRXHub5 magic action not implemented'
|
640
650
|
end
|
641
651
|
|
642
652
|
def search_pharmacies(search)
|
643
653
|
magic_parameters = {
|
644
|
-
:
|
645
|
-
:
|
654
|
+
action: 'SearchPharmacies',
|
655
|
+
parameter1: search
|
646
656
|
}
|
647
657
|
magic(magic_parameters)
|
648
658
|
end
|
649
659
|
|
650
660
|
def search_problem_codes
|
651
|
-
raise NotImplementedError,
|
661
|
+
raise NotImplementedError, 'SearchProblemCodes magic action not implemented'
|
652
662
|
end
|
653
663
|
|
654
664
|
def update_encounter
|
655
|
-
raise NotImplementedError,
|
665
|
+
raise NotImplementedError, 'UpdateEncounter magic action not implemented'
|
656
666
|
end
|
657
667
|
|
658
668
|
def update_order
|
659
|
-
raise NotImplementedError,
|
669
|
+
raise NotImplementedError, 'UpdateOrder magic action not implemented'
|
660
670
|
end
|
661
671
|
|
662
672
|
def update_referral_order_status
|
663
|
-
raise NotImplementedError,
|
673
|
+
raise NotImplementedError, 'UpdateReferralOrderStatus magic action not implemented'
|
664
674
|
end
|
665
675
|
|
666
676
|
private
|
667
677
|
|
668
678
|
def nokogiri_to_string(builder)
|
669
|
-
builder.to_xml(:
|
679
|
+
builder.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION).strip
|
670
680
|
end
|
671
681
|
end
|
672
682
|
end
|