Module: AllscriptsApi::Documents::DocumentMethods

Included in:
Client
Defined in:
lib/allscripts_api/documents/document_methods.rb

Overview

A collection of named convenience methods that map to Allscripts magic actions related to documents. These methods are included in Client and can be accessed from instances of that class.

Instance Method Summary collapse

Instance Method Details

#get_ccda(patient_id, encounter_id, org_id = nil, app_group = nil, referral_text = nil, site_id = nil, document_type = "CCDACCD") ⇒ String, AllscriptsApi::MagicError

gets the CCDA documents for the specified patient and encounter

uses the organization for the specified user CCDACCD (Default) - Returns the Continuity of Care Document. This is the default behavior if nothing is passed in. CCDASOC - Returns the Summary of Care Document CCDACS - Returns the Clinical Summary Document (Visit Summary).

Parameters:

  • patient_id (String)

    patient id

  • encounter_id (String)

    encounter id from which to generate the CCDA

  • org_id (String) (defaults to: nil)

    specifies the organization, by default Unity

  • app_group (String) (defaults to: nil)

    defaults to “TouchWorks”

  • referral_text (String) (defaults to: nil)

    contents of ReferralText are appended

  • site_id (String) (defaults to: nil)

    site id

  • document_type (String) (defaults to: "CCDACCD")

    document type defaults to CCDACCD,

Returns:



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/allscripts_api/documents/document_methods.rb', line 48

def get_ccda(patient_id, encounter_id, org_id = nil,
             app_group = nil, referral_text = nil,
             site_id = nil, document_type = "CCDACCD")
  params =
    MagicParams.format(
      user_id: @allscripts_username,
      patient_id: patient_id,
      parameter1: encounter_id,
      parameter2: org_id,
      parameter3: app_group,
      parameter4: referral_text,
      parameter5: site_id,
      parameter6: document_type
    )
  results = magic("GetCCDA", magic_params: params)
  results["getccdainfo"][0]["ccdaxml"]
end

#save_document_image(patient_id, document_params, document_buffer = nil, base_64_data = nil) ⇒ Hash, MagicError

rubocop:disable LineLength a wrapper around SaveDocumentImage, which saves pdfs to Allscripts

rubocop:Enable LineLength

Parameters:

  • patient_id (String)

    patient id

  • document_params (String)
  • document_buffer (String) (defaults to: nil)

    a byte array of document data for the current chunk.

  • base_64_data (String) (defaults to: nil)

    Alternative to using the Data parameter. If Data parameter is empty/null, Unity will check for presence of content in Base64Data. Note: In the Parameter1 XML, bytesRead is still the number of document bytes and not the base-64 string length.

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/allscripts_api/documents/document_methods.rb', line 19

def save_document_image(patient_id, document_params,
                        document_buffer = nil, base_64_data = nil)
  params =
    MagicParams.format(
      user_id: @allscripts_username,
      patient_id: patient_id,
      parameter1: document_params,
      parameter6: base_64_data,
      data: document_buffer
    )
  results = magic("SaveDocumentImage", magic_params: params)
  results["savedocumentimageinfo"]
end