Sha256: d37d59a5bbb820c87a55c390a8d33a58c6f031f72d1e002955b23b1d60e6e2e1
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
module LifenFhir class CommunicationRequest < Base attribute :uuid, String attribute :number_communications, Integer attribute :sender, LifenFhir::Practitioner attribute :recipients, [LifenFhir::Practitioner] attribute :category, LifenFhir::Category, default: LifenFhir::Category.new attribute :medium, [LifenFhir::Medium] attribute :patient, LifenFhir::Patient attribute :attachment, LifenFhir::Attachment attribute :binary, LifenFhir::Binary attribute :content_string, LifenFhir::ContentString def send json = application_client.post("fhir/CommunicationRequest", fhir_payload) self.uuid = json["id"] self.number_communications = Array(json["issue"]).length self end private def fhir_payload payload = { resourceType: "CommunicationRequest", sender: [ sender.fhir_payload ], recipient: recipients.map(&:fhir_payload), contained: [], medium: medium.map(&:fhir_payload) , category: [ category.fhir_payload], payload: [ document_content ] } if patient payload[:contained] << patient.fhir_payload payload[:subject] = [ {reference: "patient"} ] end if content_string payload[:payload] << content_string.fhir_payload end payload end def document_content if !attachment.nil? attachment.fhir_payload else binary.fhir_payload end end def application_client @application_client ||= AppAuthenticatedClient.new end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lifen_fhir-0.2.0 | lib/lifen_fhir/communication_request.rb |
lifen_fhir-0.1.1 | lib/lifen_fhir/communication_request.rb |