Class: MalawiHivProgramReports::Clinic::PregnantPatients

Inherits:
Object
  • Object
show all
Includes:
Utils::CommonSqlQueryUtils
Defined in:
app/services/malawi_hiv_program_reports/clinic/pregnant_patients.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::CommonSqlQueryUtils

#current_occupation_query, #external_client_query, #occupation_filter, #partition_by_site, #process_occupation

Constructor Details

#initialize(start_date:, end_date:, **kwargs) ⇒ PregnantPatients

Returns a new instance of PregnantPatients.



11
12
13
14
15
# File 'app/services/malawi_hiv_program_reports/clinic/pregnant_patients.rb', line 11

def initialize(start_date:, end_date:, **kwargs)
  @start_date = start_date
  @end_date = end_date
  @occupation = kwargs[:occupation]
end

Instance Attribute Details

#end_dateObject (readonly)

Returns the value of attribute end_date.



7
8
9
# File 'app/services/malawi_hiv_program_reports/clinic/pregnant_patients.rb', line 7

def end_date
  @end_date
end

#start_dateObject (readonly)

Returns the value of attribute start_date.



7
8
9
# File 'app/services/malawi_hiv_program_reports/clinic/pregnant_patients.rb', line 7

def start_date
  @start_date
end

Instance Method Details

#find_reportObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/services/malawi_hiv_program_reports/clinic/pregnant_patients.rb', line 17

def find_report
  all_pregnant.map do |patient|
    {
      patient_id: patient.patient_id,
      arv_number: patient.arv_number,
      given_name: patient.given_name,
      family_name: patient.family_name,
      gender: patient.gender,
      birthdate: patient.birthdate,
      last_reported_date: patient.last_reported_date
    }
  end
end