Class: AllscriptsUnityClient::Client
- Inherits:
-
Object
- Object
- AllscriptsUnityClient::Client
- Defined in:
- lib/allscripts_unity_client/client.rb
Overview
Providers an interface to access Unity endpoints.
Build using a dependency injection pattern. A Client instances takes an instance of ClientDriver and delegates Unity endpoint methods to the ClientDriver.
Instance Attribute Summary collapse
-
#client_driver ⇒ Object
Returns the value of attribute client_driver.
Instance Method Summary collapse
-
#client_type ⇒ Object
Return the client type, either :json or :soap.
- #commit_charges ⇒ Object
- #echo(echo_text) ⇒ Object
- #get_account ⇒ Object
- #get_changed_patients(since = nil) ⇒ Object
- #get_charge_info_by_username ⇒ Object
- #get_charges ⇒ Object
- #get_chart_item_details(userid, patientid, section) ⇒ Object
- #get_clinical_summary(userid, patientid, extra_med_data = false) ⇒ Object
- #get_delegates ⇒ Object
- #get_dictionary(dictionary_name, userid = nil, site = nil) ⇒ Object
- #get_dictionary_sets ⇒ Object
- #get_doc_template ⇒ Object
- #get_document_by_accession ⇒ Object
- #get_document_image ⇒ Object
- #get_document_type ⇒ Object
- #get_documents ⇒ Object
- #get_dur ⇒ Object
- #get_encounter ⇒ Object
- #get_encounter_date ⇒ Object
-
#get_encounter_list(userid, patientid, encounter_type = nil, when_param = nil, nostradamus = 0, show_past_flag = true, billing_provider_user_name = nil, show_all = false) ⇒ Array<Hash>
GetEncounterList helper method.
- #get_hie_document ⇒ Object
- #get_last_patient ⇒ Object
- #get_list_of_dictionaries ⇒ Object
- #get_medication_by_trans_id(userid, patientid, transaction_id) ⇒ Array, Hash
- #get_medication_info(userid, ddid, patientid = nil) ⇒ Object
- #get_order_history ⇒ Object
- #get_organization_id ⇒ Object
- #get_packages ⇒ Object
- #get_patient(userid, patientid, includepix = nil) ⇒ Object
- #get_patient_activity(userid, patientid) ⇒ Object
- #get_patient_by_mrn(userid, mrn) ⇒ Object
- #get_patient_cda ⇒ Object
- #get_patient_diagnosis(userid, patientid, encounter_date = nil, encounter_type = nil, encounter_date_range = nil, encounter_id = nil) ⇒ Object
- #get_patient_full ⇒ Object
- #get_patient_ids ⇒ Object
- #get_patient_list ⇒ Object
- #get_patient_locations ⇒ Object
- #get_patient_pharmacies(patient_id, limit_to_favorites = false) ⇒ Object
- #get_patient_problems(patientid, show_by_encounter_flag = nil, assessed = nil, encounter_id = nil, medcin_id = nil) ⇒ Object
- #get_patient_sections ⇒ Object
- #get_patients_by_icd9(icd9, start = nil, end_param = nil) ⇒ Object
- #get_procedures ⇒ Object
- #get_provider(provider_id = nil, user_name = nil) ⇒ Object
- #get_providers(security_filter = nil, name_filter = nil) ⇒ Object
- #get_ref_providers_by_specialty ⇒ Object
- #get_rounding_list_entries ⇒ Object
- #get_rounding_lists ⇒ Object
- #get_rx_favs ⇒ Object
- #get_schedule ⇒ Object
-
#get_security_token!(parameters = {}) ⇒ Object
Implement Unity’s GetSecurityToken endpoint.
- #get_server_info ⇒ Object
- #get_sigs ⇒ Object
- #get_task(userid, transaction_id) ⇒ Object
-
#get_task_list(userid = nil, since = nil, delegated = nil, task_types = nil, task_statuses = nil) ⇒ Object
delegated is an undocumented parameter.
- #get_user_authentication ⇒ Object
- #get_user_id ⇒ Object
- #get_user_security ⇒ Object
- #get_vaccine_manufacturers ⇒ Object
- #get_vitals ⇒ Object
-
#initialize(client_driver) ⇒ Client
constructor
Constructor.
- #last_logs ⇒ Object
-
#magic(parameters = {}) ⇒ Object
Implement Unity’s Magic endpoint.
- #make_task ⇒ Object
-
#options ⇒ Object
Access client’s options.
-
#retire_security_token!(parameters = {}) ⇒ Object
Implement Unity’s RetireSecurityToken endpoint using Savon.
- #save_admin_task ⇒ Object
- #save_allergy ⇒ Object
- #save_ced ⇒ Object
- #save_charge ⇒ Object
- #save_chart_view_audit ⇒ Object
- #save_diagnosis ⇒ Object
- #save_document_image ⇒ Object
- #save_er_note ⇒ Object
- #save_hie_document ⇒ Object
- #save_history ⇒ Object
- #save_immunization ⇒ Object
- #save_note ⇒ Object
- #save_patient ⇒ Object
- #save_patient_location ⇒ Object
- #save_problem ⇒ Object
- #save_problems_data ⇒ Object
- #save_ref_provider ⇒ Object
- #save_result ⇒ Object
- #save_rx(userid, patientid, rxxml) ⇒ Object
- #save_simple_encounter ⇒ Object
- #save_simple_rx ⇒ Object
- #save_specialist ⇒ Object
- #save_task(userid, patientid, task_type = nil, target_user = nil, work_object_id = nil, comments = nil) ⇒ Object
- #save_task_status(userid, transaction_id = nil, status = nil, delegate_id = nil, comment = nil, taskchanges = nil, patient_id = nil) ⇒ Object
- #save_tiff ⇒ Object
- #save_unstructured_document ⇒ Object
- #save_v10_doc_signature ⇒ Object
- #save_v11_note ⇒ Object
- #save_vitals ⇒ Object
- #save_vitals_data ⇒ Object
- #search_charge_codes ⇒ Object
- #search_diagnosis_codes ⇒ Object
- #search_meds(userid, patientid, search = nil) ⇒ Object
- #search_patients(search) ⇒ Object
- #search_patients_rxhub5 ⇒ Object
- #search_pharmacies(search) ⇒ Object
- #search_problem_codes ⇒ Object
-
#security_token? ⇒ Boolean
Return true if a Unity security token has been fetched and saved.
- #update_encounter ⇒ Object
- #update_order ⇒ Object
- #update_referral_order_status ⇒ Object
Constructor Details
#initialize(client_driver) ⇒ Client
Constructor.
- client_driver
-
An instance of a ClientDriver. Currently only SoapClientDriver and JsonClientDriver
are supported.
16 17 18 19 20 |
# File 'lib/allscripts_unity_client/client.rb', line 16 def initialize(client_driver) raise ArgumentError, 'client_driver can not be nil' if client_driver.nil? @client_driver = client_driver end |
Instance Attribute Details
#client_driver ⇒ Object
Returns the value of attribute client_driver.
10 11 12 |
# File 'lib/allscripts_unity_client/client.rb', line 10 def client_driver @client_driver end |
Instance Method Details
#client_type ⇒ Object
Return the client type, either :json or :soap.
87 88 89 |
# File 'lib/allscripts_unity_client/client.rb', line 87 def client_type @client_driver.client_type end |
#commit_charges ⇒ Object
91 92 93 |
# File 'lib/allscripts_unity_client/client.rb', line 91 def commit_charges raise NotImplementedError, 'CommitCharges magic action not implemented' end |
#echo(echo_text) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/allscripts_unity_client/client.rb', line 95 def echo(echo_text) magic_parameters = { action: 'Echo', userid: echo_text, appname: echo_text, patientid: echo_text, parameter1: echo_text, parameter2: echo_text, parameter3: echo_text, parameter4: echo_text, parameter5: echo_text, parameter6: echo_text } response = magic(magic_parameters) response[:userid] end |
#get_account ⇒ Object
112 113 114 115 116 117 |
# File 'lib/allscripts_unity_client/client.rb', line 112 def get_account magic_parameters = { action: 'GetAccount' } magic(magic_parameters) end |
#get_changed_patients(since = nil) ⇒ Object
119 120 121 122 123 124 125 |
# File 'lib/allscripts_unity_client/client.rb', line 119 def get_changed_patients(since = nil) magic_parameters = { action: 'GetChangedPatients', parameter1: since } magic(magic_parameters) end |
#get_charge_info_by_username ⇒ Object
127 128 129 |
# File 'lib/allscripts_unity_client/client.rb', line 127 def get_charge_info_by_username raise NotImplementedError, 'GetChargeInfoByUsername magic action not implemented' end |
#get_charges ⇒ Object
131 132 133 |
# File 'lib/allscripts_unity_client/client.rb', line 131 def get_charges raise NotImplementedError, 'GetCharges magic action not implemented' end |
#get_chart_item_details(userid, patientid, section) ⇒ Object
135 136 137 138 139 140 141 142 143 |
# File 'lib/allscripts_unity_client/client.rb', line 135 def get_chart_item_details(userid, patientid, section) magic_parameters = { action: 'GetChartItemDetails', userid: userid, patientid: patientid, parameter1: section } magic(magic_parameters) end |
#get_clinical_summary(userid, patientid, extra_med_data = false) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/allscripts_unity_client/client.rb', line 145 def get_clinical_summary(userid, patientid, extra_med_data = false) magic_parameters = { action: 'GetClinicalSummary', userid: userid, patientid: patientid, parameter3: unity_true_or_blank_parameter(extra_med_data) } response = magic(magic_parameters) unless response.is_a?(Array) response = [ response ] end response end |
#get_delegates ⇒ Object
161 162 163 |
# File 'lib/allscripts_unity_client/client.rb', line 161 def get_delegates raise NotImplementedError, 'GetDelegates magic action not implemented' end |
#get_dictionary(dictionary_name, userid = nil, site = nil) ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/allscripts_unity_client/client.rb', line 165 def get_dictionary(dictionary_name, userid = nil, site = nil) magic_parameters = { action: 'GetDictionary', userid: userid, parameter1: dictionary_name, parameter2: site } response = magic(magic_parameters) unless response.is_a?(Array) response = [ response ] end response end |
#get_dictionary_sets ⇒ Object
181 182 183 |
# File 'lib/allscripts_unity_client/client.rb', line 181 def get_dictionary_sets raise NotImplementedError, 'GetDictionarySets magic action not implemented' end |
#get_doc_template ⇒ Object
185 186 187 |
# File 'lib/allscripts_unity_client/client.rb', line 185 def get_doc_template raise NotImplementedError, 'GetDocTemplate magic action not implemented' end |
#get_document_by_accession ⇒ Object
189 190 191 |
# File 'lib/allscripts_unity_client/client.rb', line 189 def get_document_by_accession raise NotImplementedError, 'GetDocumentByAccession magic action not implemented' end |
#get_document_image ⇒ Object
193 194 195 |
# File 'lib/allscripts_unity_client/client.rb', line 193 def get_document_image raise NotImplementedError, 'GetDocumentImage magic action not implemented' end |
#get_document_type ⇒ Object
201 202 203 |
# File 'lib/allscripts_unity_client/client.rb', line 201 def get_document_type raise NotImplementedError, 'GetDocumentType magic action not implemented' end |
#get_documents ⇒ Object
197 198 199 |
# File 'lib/allscripts_unity_client/client.rb', line 197 def get_documents raise NotImplementedError, 'GetDocuments magic action not implemented' end |
#get_dur ⇒ Object
205 206 207 |
# File 'lib/allscripts_unity_client/client.rb', line 205 def get_dur raise NotImplementedError, 'GetDUR magic action not implemented' end |
#get_encounter ⇒ Object
209 210 211 |
# File 'lib/allscripts_unity_client/client.rb', line 209 def get_encounter raise NotImplementedError, 'GetEncounter magic action not implemented' end |
#get_encounter_date ⇒ Object
213 214 215 |
# File 'lib/allscripts_unity_client/client.rb', line 213 def get_encounter_date raise NotImplementedError, 'GetEncounterDate magic action not implemented' end |
#get_encounter_list(userid, patientid, encounter_type = nil, when_param = nil, nostradamus = 0, show_past_flag = true, billing_provider_user_name = nil, show_all = false) ⇒ Array<Hash>
GetEncounterList helper method.
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/allscripts_unity_client/client.rb', line 233 def get_encounter_list( userid, patientid, encounter_type = nil, when_param = nil, nostradamus = 0, show_past_flag = true, billing_provider_user_name = nil, show_all = false) magic_parameters = { action: 'GetEncounterList', userid: userid, patientid: patientid, parameter1: encounter_type, parameter2: when_param, parameter3: nostradamus, parameter4: unity_boolean_parameter(show_past_flag), parameter5: billing_provider_user_name, # According to the developer guide this parameter is no longer # used. parameter6: show_all ? 'all' : nil } response = magic(magic_parameters) unless response.is_a?(Array) response = [ response ] end # Remove nil encounters response.delete_if do |value| value[:id] == '0' && value[:patientid] == '0' end end |
#get_hie_document ⇒ Object
268 269 270 |
# File 'lib/allscripts_unity_client/client.rb', line 268 def get_hie_document raise NotImplementedError, 'GetHIEDocument magic action not implemented' end |
#get_last_patient ⇒ Object
272 273 274 |
# File 'lib/allscripts_unity_client/client.rb', line 272 def get_last_patient raise NotImplementedError, 'GetLastPatient magic action not implemented' end |
#get_list_of_dictionaries ⇒ Object
276 277 278 |
# File 'lib/allscripts_unity_client/client.rb', line 276 def get_list_of_dictionaries raise NotImplementedError, 'GetListOfDictionaries magic action not implemented' end |
#get_medication_by_trans_id(userid, patientid, transaction_id) ⇒ Array, Hash
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/allscripts_unity_client/client.rb', line 291 def get_medication_by_trans_id(userid, patientid, transaction_id) magic_parameters = { action: 'GetMedicationByTransID', userid: userid, patientid: patientid, parameter1: transaction_id } result = magic(magic_parameters) if transaction_id == 0 || transaction_id == '0' # When transaction_id is 0 all medications should be # returned and the result should always be an array. if !result.is_a?(Array) && !result.empty? result = [ result ] elsif result.empty? result = [] end end result end |
#get_medication_info(userid, ddid, patientid = nil) ⇒ Object
320 321 322 323 324 325 326 327 328 |
# File 'lib/allscripts_unity_client/client.rb', line 320 def get_medication_info(userid, ddid, patientid = nil) magic_parameters = { action: 'GetMedicationInfo', userid: userid, patientid: patientid, parameter1: ddid } magic(magic_parameters) end |
#get_order_history ⇒ Object
330 331 332 |
# File 'lib/allscripts_unity_client/client.rb', line 330 def get_order_history raise NotImplementedError, 'GetOrderHistory magic action not implemented' end |
#get_organization_id ⇒ Object
334 335 336 |
# File 'lib/allscripts_unity_client/client.rb', line 334 def get_organization_id raise NotImplementedError, 'GetOrganizationID magic action not implemented' end |
#get_packages ⇒ Object
338 339 340 |
# File 'lib/allscripts_unity_client/client.rb', line 338 def get_packages raise NotImplementedError, 'GetPackages magic action not implemented' end |
#get_patient(userid, patientid, includepix = nil) ⇒ Object
342 343 344 345 346 347 348 349 350 |
# File 'lib/allscripts_unity_client/client.rb', line 342 def get_patient(userid, patientid, includepix = nil) magic_parameters = { action: 'GetPatient', userid: userid, patientid: patientid, parameter1: includepix } magic(magic_parameters) end |
#get_patient_activity(userid, patientid) ⇒ Object
352 353 354 355 356 357 358 359 |
# File 'lib/allscripts_unity_client/client.rb', line 352 def get_patient_activity(userid, patientid) magic_parameters = { action: 'GetPatientActivity', userid: userid, patientid: patientid } magic(magic_parameters) end |
#get_patient_by_mrn(userid, mrn) ⇒ Object
361 362 363 364 365 366 367 368 |
# File 'lib/allscripts_unity_client/client.rb', line 361 def get_patient_by_mrn(userid, mrn) magic_parameters = { action: 'GetPatientByMRN', userid: userid, parameter1: mrn } magic(magic_parameters) end |
#get_patient_cda ⇒ Object
370 371 372 |
# File 'lib/allscripts_unity_client/client.rb', line 370 def get_patient_cda raise NotImplementedError, 'GetPatientCDA magic action not implemented' end |
#get_patient_diagnosis(userid, patientid, encounter_date = nil, encounter_type = nil, encounter_date_range = nil, encounter_id = nil) ⇒ Object
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/allscripts_unity_client/client.rb', line 374 def get_patient_diagnosis(userid, patientid, encounter_date = nil, encounter_type = nil, encounter_date_range = nil, encounter_id = nil) magic_params = { action: 'GetPatientDiagnosis', userid: userid, patientid: patientid, parameter1: encounter_date, parameter2: encounter_type, parameter3: encounter_date_range, parameter4: encounter_id } results = magic(magic_params) if !results.is_a? Array if results.empty? results = [] else results = [results] end end results end |
#get_patient_full ⇒ Object
398 399 400 |
# File 'lib/allscripts_unity_client/client.rb', line 398 def get_patient_full raise NotImplementedError, 'GetPatientFull magic action not implemented' end |
#get_patient_ids ⇒ Object
402 403 404 |
# File 'lib/allscripts_unity_client/client.rb', line 402 def get_patient_ids raise NotImplementedError, 'GetPatientIDs magic action not implemented' end |
#get_patient_list ⇒ Object
406 407 408 |
# File 'lib/allscripts_unity_client/client.rb', line 406 def get_patient_list raise NotImplementedError, 'GetPatientList magic action not implemented' end |
#get_patient_locations ⇒ Object
410 411 412 |
# File 'lib/allscripts_unity_client/client.rb', line 410 def get_patient_locations raise NotImplementedError, 'GetPatientLocations magic action not implemented' end |
#get_patient_pharmacies(patient_id, limit_to_favorites = false) ⇒ Object
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/allscripts_unity_client/client.rb', line 414 def get_patient_pharmacies(patient_id, limit_to_favorites = false) response = magic( action: 'GetPatientPharmacies', patientid: patient_id, parameter1: unity_boolean_parameter(limit_to_favorites) ) # When the patient has only ever used one pharmacy, Unity does # not return a collection of one. Rather, it returns the sole # pharmacy as a Hash. if response.is_a?(Array) response else [response] end end |
#get_patient_problems(patientid, show_by_encounter_flag = nil, assessed = nil, encounter_id = nil, medcin_id = nil) ⇒ Object
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/allscripts_unity_client/client.rb', line 431 def get_patient_problems(patientid, show_by_encounter_flag = nil, assessed = nil, encounter_id = nil, medcin_id = nil) magic_parameters = { action: 'GetPatientProblems', patientid: patientid, parameter1: show_by_encounter_flag, parameter2: assessed, parameter3: encounter_id, parameter4: medcin_id } response = magic(magic_parameters) unless response.is_a?(Array) response = [ response ] end response end |
#get_patient_sections ⇒ Object
459 460 461 |
# File 'lib/allscripts_unity_client/client.rb', line 459 def get_patient_sections raise NotImplementedError, 'GetPatientSections magic action not implemented' end |
#get_patients_by_icd9(icd9, start = nil, end_param = nil) ⇒ Object
449 450 451 452 453 454 455 456 457 |
# File 'lib/allscripts_unity_client/client.rb', line 449 def get_patients_by_icd9(icd9, start = nil, end_param = nil) magic_parameters = { action: 'GetPatientsByICD9', parameter1: icd9, parameter2: start, parameter3: end_param } magic(magic_parameters) end |
#get_procedures ⇒ Object
463 464 465 |
# File 'lib/allscripts_unity_client/client.rb', line 463 def get_procedures raise NotImplementedError, 'GetProcedures magic action not implemented' end |
#get_provider(provider_id = nil, user_name = nil) ⇒ Object
467 468 469 470 471 472 473 474 475 476 477 478 |
# File 'lib/allscripts_unity_client/client.rb', line 467 def get_provider(provider_id = nil, user_name = nil) if provider_id.nil? && user_name.nil? raise ArgumentError, 'provider_id or user_name must be given' end magic_parameters = { action: 'GetProvider', parameter1: provider_id, parameter2: user_name } magic(magic_parameters) end |
#get_providers(security_filter = nil, name_filter = nil) ⇒ Object
480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'lib/allscripts_unity_client/client.rb', line 480 def get_providers(security_filter = nil, name_filter = nil) magic_parameters = { action: 'GetProviders', parameter1: security_filter, parameter2: name_filter } response = magic(magic_parameters) unless response.is_a?(Array) response = [ response ] end response end |
#get_ref_providers_by_specialty ⇒ Object
495 496 497 |
# File 'lib/allscripts_unity_client/client.rb', line 495 def get_ref_providers_by_specialty raise NotImplementedError, 'GetRefProvidersBySpecialty magic action not implemented' end |
#get_rounding_list_entries ⇒ Object
499 500 501 |
# File 'lib/allscripts_unity_client/client.rb', line 499 def get_rounding_list_entries raise NotImplementedError, 'GetRoundingListEntries magic action not implemented' end |
#get_rounding_lists ⇒ Object
503 504 505 |
# File 'lib/allscripts_unity_client/client.rb', line 503 def get_rounding_lists raise NotImplementedError, 'GetRoundingLists magic action not implemented' end |
#get_rx_favs ⇒ Object
507 508 509 |
# File 'lib/allscripts_unity_client/client.rb', line 507 def get_rx_favs raise NotImplementedError, 'GetRXFavs magic action not implemented' end |
#get_schedule ⇒ Object
511 512 513 |
# File 'lib/allscripts_unity_client/client.rb', line 511 def get_schedule raise NotImplementedError, 'GetSchedule magic action not implemented' end |
#get_security_token!(parameters = {}) ⇒ Object
Implement Unity’s GetSecurityToken endpoint.
Stores the results in @security_token.
- parameters
-
A hash of Unity parameters for GetSecurityToken:
{
:username => ...,
:password => ...,
:appname => ...
}
Returns the security token.
64 65 66 |
# File 'lib/allscripts_unity_client/client.rb', line 64 def get_security_token!(parameters = {}) @client_driver.get_security_token!(parameters) end |
#get_server_info ⇒ Object
515 516 517 518 519 520 |
# File 'lib/allscripts_unity_client/client.rb', line 515 def get_server_info magic_parameters = { action: 'GetServerInfo' } magic(magic_parameters) end |
#get_sigs ⇒ Object
522 523 524 |
# File 'lib/allscripts_unity_client/client.rb', line 522 def get_sigs raise NotImplementedError, 'GetSigs magic action not implemented' end |
#get_task(userid, transaction_id) ⇒ Object
526 527 528 529 530 531 532 533 |
# File 'lib/allscripts_unity_client/client.rb', line 526 def get_task(userid, transaction_id) magic_parameters = { action: 'GetTask', userid: userid, parameter1: transaction_id } magic(magic_parameters) end |
#get_task_list(userid = nil, since = nil, delegated = nil, task_types = nil, task_statuses = nil) ⇒ Object
delegated is an undocumented parameter
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
# File 'lib/allscripts_unity_client/client.rb', line 536 def get_task_list(userid = nil, since = nil, delegated = nil, task_types = nil, task_statuses = nil) magic_parameters = { action: 'GetTaskList', userid: userid, parameter1: since, parameter2: task_types, parameter3: task_statuses, parameter4: delegated } response = magic(magic_parameters) unless response.is_a?(Array) response = [ response ] end response end |
#get_user_authentication ⇒ Object
554 555 556 |
# File 'lib/allscripts_unity_client/client.rb', line 554 def get_user_authentication @client_driver.get_user_authentication end |
#get_user_id ⇒ Object
558 559 560 |
# File 'lib/allscripts_unity_client/client.rb', line 558 def get_user_id raise NotImplementedError, 'GetUserID magic action not implemented' end |
#get_user_security ⇒ Object
562 563 564 |
# File 'lib/allscripts_unity_client/client.rb', line 562 def get_user_security raise NotImplementedError, 'GetUserSecurity magic action not implemented' end |
#get_vaccine_manufacturers ⇒ Object
566 567 568 |
# File 'lib/allscripts_unity_client/client.rb', line 566 def get_vaccine_manufacturers raise NotImplementedError, 'GetVaccineManufacturers magic action not implemented' end |
#get_vitals ⇒ Object
570 571 572 |
# File 'lib/allscripts_unity_client/client.rb', line 570 def get_vitals raise NotImplementedError, 'GetVitals magic action not implemented' end |
#last_logs ⇒ Object
574 575 576 577 578 579 |
# File 'lib/allscripts_unity_client/client.rb', line 574 def last_logs magic_parameters = { action: 'LastLogs' } magic(magic_parameters) end |
#magic(parameters = {}) ⇒ Object
Implement Unity’s Magic endpoint
- parameters
-
A Hash of Unity parameters. Takes this form:
{
:action => ...,
:userid => ...,
:appname => ...,
:patientid => ...,
:token => ...,
:parameter1 => ...,
:parameter2 => ...,
:parameter3 => ...,
:parameter4 => ...,
:parameter5 => ...,
:parameter6 => ...,
:data => ...
}
Returns the result of the Magic endpoint as a Hash.
47 48 49 |
# File 'lib/allscripts_unity_client/client.rb', line 47 def magic(parameters = {}) @client_driver.magic(parameters) end |
#make_task ⇒ Object
581 582 583 |
# File 'lib/allscripts_unity_client/client.rb', line 581 def make_task raise NotImplementedError, 'MakeTask magic action not implemented' end |
#options ⇒ Object
Access client’s options. See ClientOptions.
23 24 25 |
# File 'lib/allscripts_unity_client/client.rb', line 23 def @client_driver. end |
#retire_security_token!(parameters = {}) ⇒ Object
Implement Unity’s RetireSecurityToken endpoint using Savon.
- parameters
-
A hash of Unity parameters for RetireSecurityToken. If not given then defaults to
@security_token:
{
:token => ...,
:appname => ...
}
77 78 79 |
# File 'lib/allscripts_unity_client/client.rb', line 77 def retire_security_token!(parameters = {}) @client_driver.retire_security_token!(parameters) end |
#save_admin_task ⇒ Object
585 586 587 |
# File 'lib/allscripts_unity_client/client.rb', line 585 def save_admin_task raise NotImplementedError, 'SaveAdminTask magic action not implemented' end |
#save_allergy ⇒ Object
589 590 591 |
# File 'lib/allscripts_unity_client/client.rb', line 589 def save_allergy raise NotImplementedError, 'SaveAllergy magic action not implemented' end |
#save_ced ⇒ Object
593 594 595 |
# File 'lib/allscripts_unity_client/client.rb', line 593 def save_ced raise NotImplementedError, 'SaveCED magic action not implemented' end |
#save_charge ⇒ Object
597 598 599 |
# File 'lib/allscripts_unity_client/client.rb', line 597 def save_charge raise NotImplementedError, 'SaveCharge magic action not implemented' end |
#save_chart_view_audit ⇒ Object
601 602 603 |
# File 'lib/allscripts_unity_client/client.rb', line 601 def save_chart_view_audit raise NotImplementedError, 'SaveChartViewAudit magic action not implemented' end |
#save_diagnosis ⇒ Object
605 606 607 |
# File 'lib/allscripts_unity_client/client.rb', line 605 def save_diagnosis raise NotImplementedError, 'SaveDiagnosis magic action not implemented' end |
#save_document_image ⇒ Object
609 610 611 |
# File 'lib/allscripts_unity_client/client.rb', line 609 def save_document_image raise NotImplementedError, 'SaveDocumentImage magic action not implemented' end |
#save_er_note ⇒ Object
613 614 615 |
# File 'lib/allscripts_unity_client/client.rb', line 613 def save_er_note raise NotImplementedError, 'SaveERNote magic action not implemented' end |
#save_hie_document ⇒ Object
617 618 619 |
# File 'lib/allscripts_unity_client/client.rb', line 617 def save_hie_document raise NotImplementedError, 'SaveHIEDocument magic action not implemented' end |
#save_history ⇒ Object
621 622 623 |
# File 'lib/allscripts_unity_client/client.rb', line 621 def save_history raise NotImplementedError, 'SaveHistory magic action not implemented' end |
#save_immunization ⇒ Object
625 626 627 |
# File 'lib/allscripts_unity_client/client.rb', line 625 def save_immunization raise NotImplementedError, 'SaveImmunization magic action not implemented' end |
#save_note ⇒ Object
629 630 631 |
# File 'lib/allscripts_unity_client/client.rb', line 629 def save_note raise NotImplementedError, 'SaveNote magic action not implemented' end |
#save_patient ⇒ Object
633 634 635 |
# File 'lib/allscripts_unity_client/client.rb', line 633 def save_patient raise NotImplementedError, 'SavePatient magic action not implemented' end |
#save_patient_location ⇒ Object
637 638 639 |
# File 'lib/allscripts_unity_client/client.rb', line 637 def save_patient_location raise NotImplementedError, 'SavePatientLocation magic action not implemented' end |
#save_problem ⇒ Object
641 642 643 |
# File 'lib/allscripts_unity_client/client.rb', line 641 def save_problem raise NotImplementedError, 'SaveProblem magic action not implemented' end |
#save_problems_data ⇒ Object
645 646 647 |
# File 'lib/allscripts_unity_client/client.rb', line 645 def save_problems_data raise NotImplementedError, 'SaveProblemsData magic action not implemented' end |
#save_ref_provider ⇒ Object
649 650 651 |
# File 'lib/allscripts_unity_client/client.rb', line 649 def save_ref_provider raise NotImplementedError, 'SaveRefProvider magic action not implemented' end |
#save_result ⇒ Object
653 654 655 |
# File 'lib/allscripts_unity_client/client.rb', line 653 def save_result raise NotImplementedError, 'SaveResult magic action not implemented' end |
#save_rx(userid, patientid, rxxml) ⇒ Object
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 |
# File 'lib/allscripts_unity_client/client.rb', line 657 def save_rx(userid, patientid, rxxml) # Generate XML structure for rxxml builder = Nokogiri::XML::Builder.new do |xml| xml.saverx { xml.field('name' => 'transid', 'value' => rxxml[:transid]) unless rxxml[:transid] xml.field('name' => 'PharmID', 'value' => rxxml[:pharmid]) unless rxxml[:pharmid] xml.field('name' => 'DDI', 'value' => rxxml[:ddi]) unless rxxml[:ddi] xml.field('name' => 'GPPCCode', 'value' => rxxml[:gppccode]) unless rxxml[:gppccode] xml.field('name' => 'GPPCText', 'value' => rxxml[:gppctext]) unless rxxml[:gppctext] xml.field('name' => 'GPPCCustom', 'value' => rxxml[:gppccustom]) unless rxxml[:gppccustom] xml.field('name' => 'Sig', 'value' => rxxml[:sig]) unless rxxml[:sig] xml.field('name' => 'QuanPresc', 'value' => rxxml[:quanpresc]) unless rxxml[:quanpresc] xml.field('name' => 'Refills', 'value' => rxxml[:refills]) unless rxxml[:refills] xml.field('name' => 'DAW', 'value' => rxxml[:daw]) unless rxxml[:daw] xml.field('name' => 'DaysSupply', 'value' => rxxml[:dayssupply]) unless rxxml[:dayssupply] xml.field('name' => 'startdate', 'value' => utc_to_local(Date.parse(rxxml[:startdate].to_s))) unless rxxml[:startdate] xml.field('name' => 'historicalflag', 'value' => rxxml[:historicalflag]) unless rxxml[:historicalflag] xml.field('name' => 'rxaction', 'value' => rxxml[:rxaction]) unless rxxml[:rxaction] xml.field('name' => 'delivery', 'value' => rxxml[:delivery]) unless rxxml[:delivery] xml.field('name' => 'ignorepharmzero', 'value' => rxxml[:ignorepharmzero]) unless rxxml[:ignorepharmzero] xml.field('name' => 'orderedbyid', 'value' => rxxml[:orderedbyid]) unless rxxml[:orderedbyid] xml.field('name' => 'newqty', 'value' => rxxml[:newqty]) unless rxxml[:newqty] xml.field('name' => 'newrefills', 'value' => rxxml[:newrefills]) unless rxxml[:newrefills] xml.field('name' => 'comments', 'value' => rxxml[:comments]) unless rxxml[:comments] xml.field('name' => 'orderstatus', 'value' => rxxml[:order_status]) unless rxxml[:order_status] if rxxml[:problems] rxxml[:problems].each do |problem| xml.field('name' => 'Problem', 'value' => problem) end end } end magic_parameters = { action: 'SaveRX', userid: userid, patientid: patientid, parameter1: nokogiri_to_string(builder) } magic(magic_parameters) end |
#save_simple_encounter ⇒ Object
700 701 702 |
# File 'lib/allscripts_unity_client/client.rb', line 700 def save_simple_encounter raise NotImplementedError, 'SaveSimpleEncounter magic action not implemented' end |
#save_simple_rx ⇒ Object
704 705 706 |
# File 'lib/allscripts_unity_client/client.rb', line 704 def save_simple_rx raise NotImplementedError, 'SaveSimpleRX magic action not implemented' end |
#save_specialist ⇒ Object
708 709 710 |
# File 'lib/allscripts_unity_client/client.rb', line 708 def save_specialist raise NotImplementedError, 'SaveSpecialist magic action not implemented' end |
#save_task(userid, patientid, task_type = nil, target_user = nil, work_object_id = nil, comments = nil) ⇒ Object
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 |
# File 'lib/allscripts_unity_client/client.rb', line 712 def save_task(userid, patientid, task_type = nil, target_user = nil, work_object_id = nil, comments = nil) if task_type.nil? && target_user.nil? && work_object_id.nil? && comments.nil? raise ArgumentError, 'task_type, target_user, work_object_id, and comments can not all be nil' end magic_parameters = { action: 'SaveTask', userid: userid, patientid: patientid, parameter1: task_type, parameter2: target_user, parameter3: work_object_id, parameter4: comments } magic(magic_parameters) end |
#save_task_status(userid, transaction_id = nil, status = nil, delegate_id = nil, comment = nil, taskchanges = nil, patient_id = nil) ⇒ Object
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
# File 'lib/allscripts_unity_client/client.rb', line 729 def save_task_status(userid, transaction_id = nil, status = nil, delegate_id = nil, comment = nil, taskchanges = nil, patient_id = nil) if transaction_id.nil? && delegate_id.nil? && comment.nil? raise ArgumentError, 'transaction_id, delegate_id, and comment can not all be nil' end # Generate XML structure for rxxml builder = Nokogiri::XML::Builder.new do |xml| xml.taskchanges { xml.refills('value' => taskchanges[:refills]) unless taskchanges.nil? || taskchanges[:refills].nil? xml.days('value' => taskchanges[:days]) unless taskchanges.nil? || taskchanges[:days].nil? xml.qty('value' => taskchanges[:qty]) unless taskchanges.nil? || taskchanges[:qty].nil? xml.tasktype('value' => taskchanges[:tasktype]) unless taskchanges.nil? || taskchanges[:tasktype].nil? xml.delegated('value' => taskchanges[:delegated]) unless taskchanges.nil? || taskchanges[:delegated].nil? xml.taskstatus('value' => taskchanges[:taskstatus]) unless taskchanges.nil? || taskchanges[:taskstatus].nil? xml.removereason('value' => taskchanges[:removereason]) unless taskchanges.nil? || taskchanges[:removereason].nil? xml.denyreason('value' => taskchanges[:denyreason]) unless taskchanges.nil? || taskchanges[:denyreason].nil? } end new_status = if taskchanges.nil? "" else nokogiri_to_string(builder) end magic_parameters = { action: 'SaveTaskStatus', userid: userid, parameter1: transaction_id, parameter2: status, parameter3: delegate_id, parameter4: comment, parameter6: new_status } if patient_id magic_parameters.update(patientid: patient_id) end magic(magic_parameters) end |
#save_tiff ⇒ Object
772 773 774 |
# File 'lib/allscripts_unity_client/client.rb', line 772 def save_tiff raise NotImplementedError, 'SaveTiff magic action not implemented' end |
#save_unstructured_document ⇒ Object
776 777 778 |
# File 'lib/allscripts_unity_client/client.rb', line 776 def save_unstructured_document raise NotImplementedError, 'SaveUnstructuredDocument magic action not implemented' end |
#save_v10_doc_signature ⇒ Object
780 781 782 |
# File 'lib/allscripts_unity_client/client.rb', line 780 def save_v10_doc_signature raise NotImplementedError, 'SaveV10DocSignature magic action not implemented' end |
#save_v11_note ⇒ Object
784 785 786 |
# File 'lib/allscripts_unity_client/client.rb', line 784 def save_v11_note raise NotImplementedError, 'SaveV11Note magic action not implemented' end |
#save_vitals ⇒ Object
788 789 790 |
# File 'lib/allscripts_unity_client/client.rb', line 788 def save_vitals raise NotImplementedError, 'SaveVitals magic action not implemented' end |
#save_vitals_data ⇒ Object
792 793 794 |
# File 'lib/allscripts_unity_client/client.rb', line 792 def save_vitals_data raise NotImplementedError, 'SaveVitalsData magic action not implemented' end |
#search_charge_codes ⇒ Object
796 797 798 |
# File 'lib/allscripts_unity_client/client.rb', line 796 def search_charge_codes raise NotImplementedError, 'SearchChargeCodes magic action not implemented' end |
#search_diagnosis_codes ⇒ Object
800 801 802 |
# File 'lib/allscripts_unity_client/client.rb', line 800 def search_diagnosis_codes raise NotImplementedError, 'SearchDiagnosisCodes magic action not implemented' end |
#search_meds(userid, patientid, search = nil) ⇒ Object
804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
# File 'lib/allscripts_unity_client/client.rb', line 804 def search_meds(userid, patientid, search = nil) magic_parameters = { action: 'SearchMeds', userid: userid, patientid: patientid, parameter1: search } response = magic(magic_parameters) unless response.is_a?(Array) response = [ response ] end response end |
#search_patients(search) ⇒ Object
821 822 823 824 825 826 827 |
# File 'lib/allscripts_unity_client/client.rb', line 821 def search_patients(search) magic_parameters = { action: 'SearchPatients', parameter1: search } magic(magic_parameters) end |
#search_patients_rxhub5 ⇒ Object
829 830 831 |
# File 'lib/allscripts_unity_client/client.rb', line 829 def search_patients_rxhub5 raise NotImplementedError, 'SearchPatientsRXHub5 magic action not implemented' end |
#search_pharmacies(search) ⇒ Object
833 834 835 836 837 838 839 |
# File 'lib/allscripts_unity_client/client.rb', line 833 def search_pharmacies(search) magic_parameters = { action: 'SearchPharmacies', parameter1: search } magic(magic_parameters) end |
#search_problem_codes ⇒ Object
841 842 843 |
# File 'lib/allscripts_unity_client/client.rb', line 841 def search_problem_codes raise NotImplementedError, 'SearchProblemCodes magic action not implemented' end |
#security_token? ⇒ Boolean
Return true if a Unity security token has been fetched and saved.
82 83 84 |
# File 'lib/allscripts_unity_client/client.rb', line 82 def security_token? @client_driver.security_token? end |
#update_encounter ⇒ Object
845 846 847 |
# File 'lib/allscripts_unity_client/client.rb', line 845 def update_encounter raise NotImplementedError, 'UpdateEncounter magic action not implemented' end |
#update_order ⇒ Object
849 850 851 |
# File 'lib/allscripts_unity_client/client.rb', line 849 def update_order raise NotImplementedError, 'UpdateOrder magic action not implemented' end |
#update_referral_order_status ⇒ Object
853 854 855 |
# File 'lib/allscripts_unity_client/client.rb', line 853 def update_referral_order_status raise NotImplementedError, 'UpdateReferralOrderStatus magic action not implemented' end |