templates/patient_extension.rb.erb in cqm-models-0.8.0 vs templates/patient_extension.rb.erb in cqm-models-0.8.1
- old
+ new
@@ -21,10 +21,21 @@
# match the given QRDA data criteria OID.
def get_by_qrda_oid(qrda_oid)
dataElements.where(qrdaOid: qrda_oid) || []
end
+ # Shift all data element fields that deal with dates by the given value.
+ # Given value should be in seconds. Positive values shift forward, negative
+ # values shift backwards.
+ #
+ # Note: This will shift dates of the birthdate and
+ # dates on the data elements that exist on the patient.
+ def shift_dates(seconds)
+ self.birthDatetime = (birthDatetime.utc.to_time + seconds.seconds).to_datetime
+ dataElements.each { |element| element.shift_dates(seconds) }
+ end
+
# Returns an array of elements that exist on this patient. Optionally
# takes a category and/or, which returns all elements of that QDM
# category. Example: patient.get_data_elements('encounters')
# will return all Encounter QDM data types active on the patient.
def get_data_elements(category = nil, status = nil)
@@ -189,6 +200,6 @@
# Include '_type' in any JSON output. This is necessary for deserialization.
def to_json(options = nil)
serializable_hash(methods: :_type).to_json(options)
end
-end
+end
\ No newline at end of file