Advertisement
temaon_lieto

chronic_diseases/employees SQL

Feb 15th, 2024 (edited)
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Started GET "/api/v1/chronic_diseases/employees" for ::1 at 2024-02-15 09:45:04 +0200
  2.  
  3. MainApplication::Dbo::LegalEntity Load (0.5ms)
  4. SELECT "dbo"."LegalEntities".* FROM "dbo"."LegalEntities" WHERE "dbo"."LegalEntities"."Id" = 3228 LIMIT 1  [["Id", 3228],
  5.  
  6. View::MvStatistic::Level0::Employee Load (2.6ms)
  7. SELECT mv_stat_lvl_0_employees.id,
  8. mv_stat_lvl_0_employees.full_name,
  9. COUNT(DISTINCT mv_stat_lvl_1_declarations.patient_id) AS total_counter,
  10. COUNT(DISTINCT mv_stat_lvl_1_patients.id) filter (WHERE mv_stat_lvl_1_patients.is_smoking = true AND mv_stat_lvl_1_patients.age BETWEEN 18 AND 69) AS smoking_counter,
  11. COUNT(DISTINCT mv_stat_lvl_2_imt_indices.patient_id) filter (WHERE mv_stat_lvl_1_patients.age BETWEEN 18 AND 69 AND mv_stat_lvl_2_imt_indices.imt_index > 25 AND mv_stat_lvl_2_imt_indices.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999' ) AS overweight_counter,
  12. COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) filter (WHERE mv_stat_lvl_1_reception_conditions.code IN ('K85', 'K86', 'K87') AND mv_stat_lvl_1_reception_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999' ) AS hypertension_counter,
  13. COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) filter (WHERE mv_stat_lvl_1_reception_conditions.code IN ('T90') AND mv_stat_lvl_1_reception_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999') AS diabetes_counter,
  14. COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) filter (WHERE mv_stat_lvl_1_reception_conditions.code IN ('R96') AND mv_stat_lvl_1_reception_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999') AS asthma_counter,
  15. COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) filter (WHERE mv_stat_lvl_1_reception_conditions.code LIKE 'P%' AND mv_stat_lvl_1_reception_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999') AS derangement_counter,
  16. COUNT(DISTINCT mv_stat_lvl_0_receptions.patient_id) filter (WHERE mv_stat_lvl_0_receptions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999') AS reception_counter FROM "mv_stat_lvl_0_employees" LEFT OUTER JOIN "mv_stat_lvl_0_receptions" ON "mv_stat_lvl_0_receptions"."employee_id" = "mv_stat_lvl_0_employees"."id" LEFT OUTER JOIN "mv_stat_lvl_1_declarations" ON "mv_stat_lvl_1_declarations"."employee_id" = "mv_stat_lvl_0_employees"."id" LEFT OUTER JOIN "mv_stat_lvl_2_imt_indices" ON "mv_stat_lvl_2_imt_indices"."patient_id" = "mv_stat_lvl_1_declarations"."patient_id" LEFT OUTER JOIN "mv_stat_lvl_1_reception_conditions" ON "mv_stat_lvl_1_reception_conditions"."patient_id" = "mv_stat_lvl_1_declarations"."patient_id" LEFT OUTER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_0_employees"."legal_entity_id" = 3228 AND "mv_stat_lvl_0_employees"."employee_type_ref_value" = 'DOCTOR' GROUP BY mv_stat_lvl_0_employees.id, mv_stat_lvl_0_employees.full_name
  17.  
  18.  
  19. View::MvStatistic::Level1::Declaration Count (0.9ms)
  20. SELECT COUNT(DISTINCT mv_stat_lvl_2_imt_indices.patient_id) FROM "mv_stat_lvl_1_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" INNER JOIN "mv_stat_lvl_2_imt_indices" ON "mv_stat_lvl_2_imt_indices"."patient_id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_1_declarations"."legal_entity_id" = 3228 AND "mv_stat_lvl_1_patients"."age" BETWEEN '18.0' AND '69.0' AND "mv_stat_lvl_2_imt_indices"."asserted_date" BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999'
  21.  
  22. View::MvStatistic::Level1::Declaration Count (0.7ms)
  23. SELECT COUNT("mv_stat_lvl_1_declarations"."id") FROM "mv_stat_lvl_1_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_1_declarations"."legal_entity_id" = 3228
  24.  
  25.  
  26. View::MvStatistic::Level0::Employee Count (0.4ms)
  27. SELECT COUNT("mv_stat_lvl_0_employees"."id") FROM "mv_stat_lvl_0_employees" WHERE "mv_stat_lvl_0_employees"."legal_entity_id" = 3228 AND "mv_stat_lvl_0_employees"."employee_type_ref_value" = 'DOCTOR'
  28.  
  29. View::MvStatistic::Level1::Declaration Count (0.7ms)
  30. SELECT COUNT("mv_stat_lvl_1_patients"."id") FROM "mv_stat_lvl_1_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_1_declarations"."legal_entity_id" = 3228 AND "mv_stat_lvl_1_patients"."age" BETWEEN '18.0' AND '69.0' AND "mv_stat_lvl_1_patients"."is_smoking" = true
  31.  
  32. View::MvStatistic::Level1::Declaration Count (1.1ms)
  33. SELECT COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) FROM "mv_stat_lvl_1_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" INNER JOIN "mv_stat_lvl_1_reception_conditions" ON "mv_stat_lvl_1_reception_conditions"."patient_id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_1_declarations"."legal_entity_id" = 3228 AND "mv_stat_lvl_1_reception_conditions"."code" IN ('K85', 'K86', 'K87') AND "mv_stat_lvl_1_reception_conditions"."asserted_date" BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999'  
  34.  
  35. View::MvStatistic::Level1::Declaration Count (0.9ms)
  36. SELECT COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) FROM "mv_stat_lvl_1_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" INNER JOIN "mv_stat_lvl_1_reception_conditions" ON "mv_stat_lvl_1_reception_conditions"."patient_id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_1_declarations"."legal_entity_id" = 3228 AND "mv_stat_lvl_1_reception_conditions"."code" = 'T90' AND "mv_stat_lvl_1_reception_conditions"."asserted_date" BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999'
  37.  
  38. View::MvStatistic::Level1::Declaration Count (0.9ms)
  39. SELECT COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) FROM "mv_stat_lvl_1_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" INNER JOIN "mv_stat_lvl_1_reception_conditions" ON "mv_stat_lvl_1_reception_conditions"."patient_id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_1_declarations"."legal_entity_id" = 3228 AND "mv_stat_lvl_1_reception_conditions"."code" = 'R96' AND "mv_stat_lvl_1_reception_conditions"."asserted_date" BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999'
  40.  
  41.   View::MvStatistic::Level1::Declaration Count (0.7ms)  SELECT COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) FROM "mv_stat_lvl_1_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" INNER JOIN "mv_stat_lvl_1_reception_conditions" ON "mv_stat_lvl_1_reception_conditions"."patient_id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_1_declarations"."legal_entity_id" = '3228' AND (mv_stat_lvl_1_reception_conditions.code LIKE 'P%') AND "mv_stat_lvl_1_reception_conditions"."asserted_date" BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999'  
  42.  
  43.  
  44. CACHE View::MvStatistic::Level1::Declaration Count (0.0ms)
  45. SELECT COUNT("mv_stat_lvl_1_declarations"."id") FROM "mv_stat_lvl_1_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_1_declarations"."legal_entity_id" = 3228
  46.  
  47.  
  48. View::MvStatistic::Level0::Employee Load (3.8ms)
  49. SELECT mv_stat_lvl_0_employees.id,
  50. mv_stat_lvl_0_employees.full_name,
  51. COUNT(DISTINCT mv_stat_lvl_1_declarations.patient_id) AS total_counter,
  52. COUNT(DISTINCT mv_stat_lvl_1_patients.id) filter (WHERE mv_stat_lvl_1_patients.is_smoking = true AND mv_stat_lvl_1_patients.age BETWEEN 18 AND 69) AS smoking_counter,
  53. COUNT(DISTINCT mv_stat_lvl_2_imt_indices.patient_id) filter (WHERE mv_stat_lvl_1_patients.age BETWEEN 18 AND 69 AND mv_stat_lvl_2_imt_indices.imt_index > 25 AND mv_stat_lvl_2_imt_indices.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999' ) AS overweight_counter,
  54. COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) filter (WHERE mv_stat_lvl_1_reception_conditions.code IN ('K85', 'K86', 'K87') AND mv_stat_lvl_1_reception_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999' ) AS hypertension_counter,
  55. COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) filter (WHERE mv_stat_lvl_1_reception_conditions.code IN ('T90') AND mv_stat_lvl_1_reception_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999') AS diabetes_counter,
  56. COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) filter (WHERE mv_stat_lvl_1_reception_conditions.code IN ('R96') AND mv_stat_lvl_1_reception_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999') AS asthma_counter,
  57. COUNT(DISTINCT mv_stat_lvl_1_reception_conditions.patient_id) filter (WHERE mv_stat_lvl_1_reception_conditions.code LIKE 'P%' AND mv_stat_lvl_1_reception_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999') AS derangement_counter,
  58. COUNT(DISTINCT mv_stat_lvl_0_receptions.patient_id) filter (WHERE mv_stat_lvl_0_receptions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999') AS reception_counter FROM "mv_stat_lvl_0_employees" LEFT OUTER JOIN "mv_stat_lvl_0_receptions" ON "mv_stat_lvl_0_receptions"."employee_id" = "mv_stat_lvl_0_employees"."id" LEFT OUTER JOIN "mv_stat_lvl_1_declarations" ON "mv_stat_lvl_1_declarations"."employee_id" = "mv_stat_lvl_0_employees"."id" LEFT OUTER JOIN "mv_stat_lvl_2_imt_indices" ON "mv_stat_lvl_2_imt_indices"."patient_id" = "mv_stat_lvl_1_declarations"."patient_id" LEFT OUTER JOIN "mv_stat_lvl_1_reception_conditions" ON "mv_stat_lvl_1_reception_conditions"."patient_id" = "mv_stat_lvl_1_declarations"."patient_id" LEFT OUTER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_1_declarations"."patient_id" WHERE "mv_stat_lvl_0_employees"."legal_entity_id" = 3228 AND "mv_stat_lvl_0_employees"."employee_type_ref_value" = 'DOCTOR' GROUP BY mv_stat_lvl_0_employees.id, mv_stat_lvl_0_employees.full_name LIMIT 15 OFFSET 0
  59.  
  60. Completed 200 OK in 41ms (Views: 0.3ms | ActiveRecord: 13.1ms | Allocations: 11806)
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement