16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/core_ext/segments/obx.rb', line 16
def to_hash
return @hash if @hash
@hash = super.to_hash
identifier = self.observation_id.split("^") rescue Array.new(10) {|i|""}
producer = self.producer_id.split("^") rescue Array.new(10) {|i|""}
responsibleObserver = self.responsible_observer rescue Array.new(10) {|i|""}
@hash.merge!({"setId" => self.set_id,
"valueType" => self.value_type,
"identifier" => {
"id" => identifier[0],
"text" => identifier[1],
"codingSystem" => identifier[2],
"alternateId" => identifier[3],
"alternateText" => identifier[4],
"alternateCodingSystem" => identifier[5]
},
"subId" => self.observation_sub_id,
"observationValue" => self.observation_value,
"units" => self.units,
"referenceRange" => self.references_range,
"abnormalFlags" => self.abnormal_flags,
"probability" => self.probability,
"natureOfAbnormal" => self.nature_of_abnormal_test,
"observeResultStatus" => self.observation_result_status,
"effectiveDateLastNormalValue" => self.effective_date_of_reference_range,
"definedAccessChecks" => self.user_defined_access_checks,
"observationDate" => self.observation_date,
"producerId" => {
"identifier" => producer[0],
"text" => producer[1]
},
"responsibleObserver" => {
"id" => responsibleObserver[0],
"lastName" => responsibleObserver[1],
"firstName" => responsibleObserver[2]
},
"method" => self.observation_method})
@hash
end
|