lib/health-data-standards/export/ccr.rb in health-data-standards-0.7.0 vs lib/health-data-standards/export/ccr.rb in health-data-standards-0.7.1
- old
+ new
@@ -34,10 +34,11 @@
to_ccr_immunizations(xml, patient)
to_ccr_vitals(xml, patient)
to_ccr_results(xml, patient)
to_ccr_procedures(xml, patient)
to_ccr_encounters(xml, patient)
+ to_ccr_socialhistory(xml, patient)
end
to_ccr_actors(xml, patient)
end
end
@@ -167,18 +168,19 @@
xml.Text("Start date")
end
#time
xml.ExactDateTime(convert_to_ccr_time_string(res.time))
end
- xml.Description do
- xml.Text(res.description)
- code_section(xml, res.codes)
- end
-
+
xml.Source
xml.Test do
xml.CCRDataObjectID("#{ccr_id}TestResult")
+ xml.Description do
+ xml.Text(res.description)
+ code_section(xml, res.codes)
+ end
+
xml.Source
xml.TestResult do
xml.Value(res.value["scalar"])
xml.Units do
xml.Unit(res.value["units"])
@@ -313,9 +315,32 @@
end
xml.Status do
xml.Text("Current")
end
xml.Source
+ end
+ end
+ end
+ end
+ end
+
+ # Builds the XML snippet for the social history section inside the CCR standard
+ #
+ # @return [Builder::XmlMarkup] CCR XML representation of patient data
+ def to_ccr_socialhistory(xml, patient)
+ if patient.social_history.present?
+ xml.SocialHistory do
+ patient.social_history.each_with_index do |history, index|
+ xml.SocialHistoryElement do
+ xml.CCRDataObjectID("SH000#{index + 1}")
+
+
+ xml.Description do
+ xml.Text(history.description)
+ code_section(xml, history.codes)
+ end
+
+
end
end
end
end
end
\ No newline at end of file