Sha256: b732bb4ae580a09680a28d386a7a64ebb2d10a3408634996e0f311c31cde2b00

Contents?: true

Size: 1.88 KB

Versions: 9

Compression:

Stored size: 1.88 KB

Contents

module AthenaHealth
  module Endpoints
    module Patients
      def all_patients(practice_id:, department_id:, params: {})
        response = @api.call(
          endpoint: "#{practice_id}/patients",
          method: :get,
          params: params.merge!(departmentid: department_id)
        )

        PatientCollection.new(response)
      end

      def find_patient(practice_id:, patient_id:, params: {})
        response = @api.call(
          endpoint: "#{practice_id}/patients/#{patient_id}",
          method: :get,
          params: params
        )

        Patient.new(response.first)
      end

      def create_patient(practice_id:, department_id:, params: {})
        @api.call(
          endpoint: "#{practice_id}/patients",
          method: :post,
          body: params.merge!(departmentid: department_id)
        )
      end

      def update_patient(practice_id:, patient_id:, params: {})
        @api.call(
          endpoint: "#{practice_id}/patients/#{patient_id}",
          method: :put,
          params: params
        )
      end

      def delete_patient(practice_id:, patient_id:)
        @api.call(
          endpoint: "#{practice_id}/patients/#{patient_id}",
          method: :put,
          params: { status: 'deleted' }
        )
      end

      def create_patient_problem(practice_id:, department_id:, patient_id:, snomed_code:, params: {})
        @api.call(
          endpoint: "#{practice_id}/chart/#{patient_id}/problems",
          method: :post,
          body: params.merge!(departmentid: department_id, snomedcode: snomed_code)
        )
      end

      def find_patient_problems(practice_id:, department_id:, patient_id:)
        response = @api.call(
          endpoint: "#{practice_id}/chart/#{patient_id}/problems",
          method: :get,
          params: { departmentid: department_id }
        )

        PatientProblemCollection.new(response)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
athena_health-0.8.7 lib/athena_health/endpoints/patients.rb
athena_health-0.8.6 lib/athena_health/endpoints/patients.rb
athena_health-0.8.5 lib/athena_health/endpoints/patients.rb
athena_health-0.8.4 lib/athena_health/endpoints/patients.rb
athena_health-0.8.3 lib/athena_health/endpoints/patients.rb
athena_health-0.8.2 lib/athena_health/endpoints/patients.rb
athena_health-0.8.1 lib/athena_health/endpoints/patients.rb
athena_health-0.8.0 lib/athena_health/endpoints/patients.rb
athena_health-0.7.0 lib/athena_health/endpoints/patients.rb