Module: Extensions::HL7::Segments::ORC::InstanceMethods

Defined in:
lib/core_ext/segments/orc.rb

Instance Method Summary collapse

Instance Method Details

#obr_listObject



29
30
31
32
33
# File 'lib/core_ext/segments/orc.rb', line 29

def obr_list
  # a = to_hash["OBR"]["array"].collect {|obr| ::HL7::Message::Segment.from_hash("OBR", obr)}
  # a.to_enum(:each)            
  to_hash["OBR"]["segment_array"].to_enum(:each)
end

#order_control_textObject



16
17
18
# File 'lib/core_ext/segments/orc.rb', line 16

def order_control_text
  OrderControl.t(self.order_control) rescue nil
end

#ordering_provider_hashObject



12
13
14
# File 'lib/core_ext/segments/orc.rb', line 12

def ordering_provider_hash
  to_hash["orderingProvider"]
end

#ordering_provider_nameObject



20
21
22
23
24
25
26
27
# File 'lib/core_ext/segments/orc.rb', line 20

def ordering_provider_name
  last_name = to_hash["orderingProvider"]["lastName"]
  if last_name
    "#{to_hash["orderingProvider"]["lastName"]}, #{@hash["orderingProvider"]["firstName"]}#{@hash["orderingProvider"]["middleInitOrName"].blank? ? "" : " #{@hash["orderingProvider"]["middleInitOrName"]}"}"
  else
    nil
  end
end

#to_hashObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/core_ext/segments/orc.rb', line 35

def to_hash
  return @hash if @hash
  
  @hash = super.to_hash
  
  placer_order_number = self.placer_order_number.split("^") rescue Array.new(10) {|i|""}
  filler_order_number = self.filler_order_number.split("^") rescue Array.new(10) {|i|""}
  placer_group_number = self.placer_group_number.split("^") rescue Array.new(10) {|i|""}
  quantity_timing = self.quantity_timing.split("^") rescue Array.new(15) {|i|""}
  parent = self.parent..split("^") rescue Array.new(20) {|i|""}
  orderingProvider = self.ordering_provider.split("^") rescue Array.new(20) {|i|""}
  
  @hash.merge!({"orderControl" => self.order_control,
                "placerOrderNumber" => {"entityIdentifier" => placer_order_number[0],
                                        "namespaceID" => placer_order_number[1],
                                        "universalID" => placer_order_number[2],
                                        "universalIDType" => placer_order_number[3]},
                "fillerOrderNumber" => {"entityIdentifier" => filler_order_number[0],
                                        "namespaceID" => filler_order_number[1],
                                        "universalID" => filler_order_number[2],
                                        "universalIDType" => filler_order_number[3]},
                "placerGroupNumber" => {"entityIdentifier" => placer_group_number[0],
                                          "namespaceID" => placer_group_number[1],
                                          "universalID" => placer_group_number[2],
                                          "universalIDType" => placer_group_number[3]},
                "orderStatus" => self.order_status,
                "responseFlag" => self.response_flag,
                "quantityTiming" => {"quantity" => quantity_timing[0], "interval" => quantity_timing[1], "duration" => quantity_timing[2],
                                      "startDateTime" => quantity_timing[3], "endDateTime" => quantity_timing[4], "priority" => quantity_timing[5],
                                      "condition" => quantity_timing[6], "text" => quantity_timing[7], "conjunction" => quantity_timing[8], "orderSequencing" => quantity_timing[9]},
                "parent" => self.parent,
                "dateTimeOfTransaction" => self.date_time_of_transaction,
                "enteredBy" => self.entered_by,
                "verifiedBy" => self.verified_by,
                "orderingProvider" => {"id" => orderingProvider[0],
                                       "lastName" => orderingProvider[1],
                                       "firstName" => orderingProvider[2],
                                       "middleInitOrName" => orderingProvider[3],
                                       "suffix" => orderingProvider[4],
                                       "prefix" => orderingProvider[5],
                                       "degree" => orderingProvider[6],
                                       "sourceTable" => orderingProvider[7],
                                       "assigningAuthority" => orderingProvider[8],
                                       "nameTypeCode" => orderingProvider[9],
                                       "identifierCheckDigit" => orderingProvider[10],
                                       "checkDigitScheme" => orderingProvider[11],
                                       "idTypeCode" => orderingProvider[12],
                                       "isTypeCode" => orderingProvider[13],
                                       "assigningFacility" => orderingProvider[14],
                                       "providerType" => "OP"},
                "enterersLocation" => self.enterers_location,
                "callBackPhoneNumber" => self.call_back_phone_number,
                "orderEffectiveDateTime" => self.order_effective_date_time,
                "orderControlCodeReason" => self.order_control_code_reason,
                "enteringOrganization" => self.entering_organization,
                "enteringDevice" => self.entering_device,
                "actionBy" => self.action_by,
                "advancedBeneficiaryNoticeCode" => self.advanced_beneficiary_notice_code,
                "orderingFacilityName" => self.ordering_facility_name,
                "orderingFacilityAddress" => self.ordering_facility_address,
                "orderingFacilityPhoneNumber" => self.ordering_facility_phone_number,
                "orderingProviderAddress" => self.ordering_provider_address,
                "orderStatusModifier" => self.order_status_modifier,
                "advancedBeneficiaryNoticeOverrideReason" => self.advanced_beneficiary_notice_override_reason,
                "fillersExpectedAvailabilityDateTime" => self.fillers_expected_availability_date_time,
                "confidentialityCode" => self.confidentiality_code,
                "orderType" => self.order_type,
                "entererAuthorizationMode" => self.enterer_authorization_mode,
                "parentUniversalServiceIdentifier" => self.parent_universal_service_identifier})
                
  @hash              
end