Class: Renalware::Admin::PlaygroundsController::Chart
- Inherits:
-
Object
- Object
- Renalware::Admin::PlaygroundsController::Chart
- Defined in:
- app/controllers/renalware/admin/playgrounds_controller.rb
Instance Method Summary collapse
Instance Method Details
#json ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/renalware/admin/playgrounds_controller.rb', line 49 def json return {} if form.patient_id.blank? ActiveRecord::Base.connection.execute( Arel.sql(<<-SQL.squish) select observed_on as x, result as y from renalware.pathology_chart_data(#{form.patient_id}, '#{form.obx_code}', '#{form.start_date}') SQL ).to_a.each_with_object({}) { |h, hash| hash[Date.parse(h["x"])] = h["y"] } end |