Module: AllscriptsApi::Orders::OrderingMethods

Included in:
Client
Defined in:
lib/allscripts_api/orders/ordering_methods.rb

Overview

A collection convenience methods for ordering that map to Allscripts magic actions. Some of these methods wrap multiple actions. These methods are included in Client and can be accessed from instances of that class.

Instance Method Summary collapse

Instance Method Details

#get_order_workflow(patient_id, xml_string, order_trans_id = "0", order_category = "ProcedureOrder", problem_id = "", problem_trans_id = "") ⇒ Array<Hash>, ...

a wrapper around GetOrderWorkflow

Parameters:

  • patient_id (String)

    patient id

  • xml_string (String)

    xml from build_xml_for_order_workflow method

  • order_trans_id (String) (defaults to: "0")

    order_activity_header.ID when calling for an existing order

  • order_category (String) (defaults to: "ProcedureOrder")

    determines what order field data to send back.

  • problem_id (String) (defaults to: "")

    problem dictionary id

  • problem_trans_id (String) (defaults to: "")

    problem_header id

Returns:

  • (Array<Hash>, Array, MagicError)

    a list of encounters



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/allscripts_api/orders/ordering_methods.rb', line 52

def get_order_workflow(patient_id, xml_string,
                       order_trans_id = "0", order_category = "ProcedureOrder",
                       problem_id = "", problem_trans_id = "")
  params =
    MagicParams.format(
      user_id: @allscripts_username,
      patient_id: patient_id,
      parameter1: xml_string,
      parameter2: order_trans_id,
      parameter3: order_category,
      parameter4: problem_id,
      parameter5: problem_trans_id
    )
  results = magic("GetOrderWorkflow", magic_params: params)
  results["getorderworkflow"]
end

#save_order(patient_id, xml, order_category, dictionary_id, problem_id = nil, trans_id = nil) ⇒ Hash|MagicError

a wrapper around SaveOrder, which save and order of the sepcified category, among: AdministeredMedication, Immunization, InstructionOrder, ProcedureOrder, Referral, SuppliesOrder.

xml can be constructed with AllscriptsApi::Orders::Order.build_xml

Immunization, InstructionOrder, ProcedureOrder, Referral, SuppliesOrder. may be passed in as part of the xml necessary when updating a past order

Parameters:

  • patient_id (String)
  • xml (String)

    xml containing saveorderxml fields and values

  • order_category (String)

    one of AdministeredMedication,

  • dictionary_id (String)

    id of the dictionary from SearchOrder TODO: look into how to doc this better

  • problem_id (String|Nil) (defaults to: nil)

    problem to associate with the order,

  • trans_id (String|Nil) (defaults to: nil)

    the original OrderID,

Returns:

  • (Hash|MagicError)

    order confirmation or error



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/allscripts_api/orders/ordering_methods.rb', line 29

def save_order(patient_id, xml, order_category, dictionary_id,
              problem_id = nil, trans_id = nil)
  params = MagicParams.format(
    user_id: @allscripts_username,
    patient_id: patient_id,
    parameter1: xml,
    parameter2: order_category,
    parameter3: dictionary_id,
    parameter4: problem_id,
    parameter5: trans_id
  )
  magic("SaveOrder", magic_params: params)
end