Module: Qrda::Export::Helper::PatientViewHelper
- Included in:
- QdmPatient, Qrda1R5, Qrda3
- Defined in:
- lib/qrda-export/helper/patient_view_helper.rb
Instance Method Summary collapse
- #birthdate ⇒ Object
- #ethnic_group ⇒ Object
- #expiration ⇒ Object
- #gender ⇒ Object
- #given_name ⇒ Object
- #mrn ⇒ Object
- #patient ⇒ Object
- #payer ⇒ Object
- #provider ⇒ Object
- #provider_ccn ⇒ Object
- #provider_npi ⇒ Object
- #provider_street ⇒ Object
- #provider_tin ⇒ Object
- #provider_type_code ⇒ Object
- #race ⇒ Object
Instance Method Details
#birthdate ⇒ Object
53 54 55 56 57 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 53 def birthdate birthdate_elements = @qdmPatient.dataElements.select { |de| de._type == "QDM::PatientCharacteristicBirthdate" } return "None" if birthdate_elements.empty? birthdate_elements.first['birthDatetime'] end |
#ethnic_group ⇒ Object
71 72 73 74 75 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 71 def ethnic_group ethnic_elements = @qdmPatient.dataElements.select { |de| de._type == "QDM::PatientCharacteristicEthnicity" } return if ethnic_elements.empty? ethnic_elements.first.dataElementCodes.first['code'] end |
#expiration ⇒ Object
59 60 61 62 63 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 59 def expiration expired_elements = @qdmPatient.dataElements.select { |de| de._type == "QDM::PatientCharacteristicExpired" } return "None" if expired_elements.empty? expired_elements.first['expiredDatetime'] end |
#gender ⇒ Object
47 48 49 50 51 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 47 def gender gender_elements = @qdmPatient.dataElements.select { |de| de._type == "QDM::PatientCharacteristicSex" } return if gender_elements.empty? gender_elements.first.dataElementCodes.first['code'] end |
#given_name ⇒ Object
43 44 45 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 43 def given_name self['givenNames'].join(' ') end |
#mrn ⇒ Object
39 40 41 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 39 def mrn @patient.id.to_s end |
#patient ⇒ Object
9 10 11 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 9 def patient JSON.parse(@patient.to_json) end |
#payer ⇒ Object
77 78 79 80 81 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 77 def payer payer_elements = @qdmPatient.dataElements.select { |de| de._type == "QDM::PatientCharacteristicPayer" } return if payer_elements.empty? payer_elements.first.dataElementCodes.first['code'] end |
#provider ⇒ Object
5 6 7 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 5 def provider JSON.parse(@provider.to_json) if @provider end |
#provider_ccn ⇒ Object
29 30 31 32 33 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 29 def provider_ccn return nil unless self['ids'] self['ids'].map { |id| id if id['namingSystem'] == '2.16.840.1.113883.4.336' }.compact end |
#provider_npi ⇒ Object
17 18 19 20 21 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 17 def provider_npi return nil unless self['ids'] self['ids'].map { |id| id if id['namingSystem'] == '2.16.840.1.113883.4.6' }.compact end |
#provider_street ⇒ Object
13 14 15 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 13 def provider_street self['street'].join('') end |
#provider_tin ⇒ Object
23 24 25 26 27 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 23 def provider_tin return nil unless self['ids'] self['ids'].map { |id| id if id['namingSystem'] == '2.16.840.1.113883.4.2' }.compact end |
#provider_type_code ⇒ Object
35 36 37 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 35 def provider_type_code self['specialty'] end |
#race ⇒ Object
65 66 67 68 69 |
# File 'lib/qrda-export/helper/patient_view_helper.rb', line 65 def race race_elements = @qdmPatient.dataElements.select { |de| de._type == "QDM::PatientCharacteristicRace" } return if race_elements.empty? race_elements.first.dataElementCodes.first['code'] end |