112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/hqmf-parser/1.0/restriction.rb', line 112
def value
value = nil
type = attr_val('./cda:observation/cda:value/@xsi:type') || 'CD'
case type
when 'IVL_PQ'
value = HQMF1::Range.new(@entry.xpath('./cda:observation/cda:value'))
when 'PQ'
value = HQMF1::Value.new(@entry.xpath('./cda:observation/cda:value'))
when 'CD'
if field && field.downcase == 'status'
code = attr_val('./cda:observation/cda:value/@displayName').downcase
value = HQMF::Coded.for_single_code('status',code,code)
elsif attr_val('./cda:observation/cda:value/@code')
oid = attr_val('./cda:observation/cda:value/@code')
title = attr_val('./cda:observation/cda:value/@displayName')
value = HQMF::Coded.for_code_list(oid,title)
elsif attr_val('./cda:encounter/cda:participant/cda:roleParticipant/cda:code/@code')
oid = attr_val('./cda:encounter/cda:participant/cda:roleParticipant/cda:code/@code')
title = attr_val('./cda:encounter/cda:participant/cda:roleParticipant/cda:code/@displayName')
value = HQMF::Coded.for_code_list(oid,title)
end
when 'ANYNonNull'
value = HQMF::AnyValue.new
else
raise "Unknown restriction value type #{type}"
end if type
value
end
|