Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- http://localhost:4000/api/v1/chronic_diseases/employees
- MainApplication::Dbo::LegalEntity Load (1.8ms)
- SELECT "dbo"."LegalEntities".* FROM "dbo"."LegalEntities" WHERE "dbo"."LegalEntities"."Id" = $1 LIMIT $2 [["Id", 3228], ["LIMIT", 1]]
- View::MvStatistic::Level0::Employee Load (7.4ms)
- SELECT mv_stat_lvl_0_employees.id,
- mv_stat_lvl_0_employees.full_name,
- COUNT(DISTINCT mv_stat_lvl_0_declarations.patient_id) AS total_counter,
- 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,
- 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-12 23:59:59.999999' ) AS overweight_counter,
- COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) filter (WHERE mv_stat_lvl_1_ehr_conditions.code IN ('K85', 'K86', 'K87') AND mv_stat_lvl_1_ehr_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-12 23:59:59.999999' ) AS hypertension_counter,
- COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) filter (WHERE mv_stat_lvl_1_ehr_conditions.code IN ('T90') AND mv_stat_lvl_1_ehr_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-12 23:59:59.999999') AS diabetes_counter,
- COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) filter (WHERE mv_stat_lvl_1_ehr_conditions.code IN ('R96') AND mv_stat_lvl_1_ehr_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-12 23:59:59.999999') AS asthma_counter,
- COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) filter (WHERE mv_stat_lvl_1_ehr_conditions.code LIKE 'P%' AND mv_stat_lvl_1_ehr_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-12 23:59:59.999999') AS derangement_counter,
- 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-12 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_0_declarations" ON "mv_stat_lvl_0_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_0_declarations"."patient_id" LEFT OUTER JOIN "mv_stat_lvl_1_ehr_conditions" ON "mv_stat_lvl_1_ehr_conditions"."patient_id" = "mv_stat_lvl_0_declarations"."patient_id" LEFT OUTER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_employees"."legal_entity_id" = $1 AND "mv_stat_lvl_0_employees"."employee_type_ref_value" = $2 GROUP BY mv_stat_lvl_0_employees.id, mv_stat_lvl_0_employees.full_name [["legal_entity_id", 3228], ["employee_type_ref_value", "DOCTOR"]]
- View::MvStatistic::Level0::Declaration Count (1.0ms)
- SELECT COUNT(DISTINCT mv_stat_lvl_2_imt_indices.patient_id) FROM "mv_stat_lvl_0_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" INNER JOIN "mv_stat_lvl_2_imt_indices" ON "mv_stat_lvl_2_imt_indices"."patient_id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_declarations"."legal_entity_id" = $1 AND "mv_stat_lvl_1_patients"."age" BETWEEN $2 AND $3 AND "mv_stat_lvl_2_imt_indices"."asserted_date" BETWEEN $4 AND $5 [["legal_entity_id", 3228], ["age", "18.0"], ["age", "69.0"], ["asserted_date", "2024-01-01 00:00:00"], ["asserted_date", "2024-02-12 23:59:59.999999"]]
- View::MvStatistic::Level0::Declaration Count (0.5ms)
- SELECT COUNT("mv_stat_lvl_0_declarations"."id") FROM "mv_stat_lvl_0_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_declarations"."legal_entity_id" = $1 [["legal_entity_id", 3228]]
- View::MvStatistic::Level0::Employee Count (0.3ms)
- SELECT COUNT("mv_stat_lvl_0_employees"."id") FROM "mv_stat_lvl_0_employees" WHERE "mv_stat_lvl_0_employees"."legal_entity_id" = $1 AND "mv_stat_lvl_0_employees"."employee_type_ref_value" = $2 [["legal_entity_id", 3228], ["employee_type_ref_value", "DOCTOR"]]
- View::MvStatistic::Level0::Declaration Count (0.5ms)
- SELECT COUNT("mv_stat_lvl_1_patients"."id") FROM "mv_stat_lvl_0_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_declarations"."legal_entity_id" = $1 AND "mv_stat_lvl_1_patients"."age" BETWEEN $2 AND $3 AND "mv_stat_lvl_1_patients"."is_smoking" = $4 [["legal_entity_id", 3228], ["age", "18.0"], ["age", "69.0"], ["is_smoking", true]]
- View::MvStatistic::Level0::Declaration Count (0.7ms)
- SELECT COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) FROM "mv_stat_lvl_0_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" INNER JOIN "mv_stat_lvl_1_ehr_conditions" ON "mv_stat_lvl_1_ehr_conditions"."patient_id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_declarations"."legal_entity_id" = $1 AND "mv_stat_lvl_1_ehr_conditions"."code" IN ($2, $3, $4) AND "mv_stat_lvl_1_ehr_conditions"."asserted_date" BETWEEN $5 AND $6 [["legal_entity_id", 3228], ["code", "K85"], ["code", "K86"], ["code", "K87"], ["asserted_date", "2024-01-01 00:00:00"], ["asserted_date", "2024-02-12 23:59:59.999999"]]
- View::MvStatistic::Level0::Declaration Count (0.6ms)
- SELECT COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) FROM "mv_stat_lvl_0_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" INNER JOIN "mv_stat_lvl_1_ehr_conditions" ON "mv_stat_lvl_1_ehr_conditions"."patient_id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_declarations"."legal_entity_id" = $1 AND "mv_stat_lvl_1_ehr_conditions"."code" = $2 AND "mv_stat_lvl_1_ehr_conditions"."asserted_date" BETWEEN $3 AND $4 [["legal_entity_id", 3228], ["code", "T90"], ["asserted_date", "2024-01-01 00:00:00"], ["asserted_date", "2024-02-12 23:59:59.999999"]]
- View::MvStatistic::Level0::Declaration Count (0.6ms)
- SELECT COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) FROM "mv_stat_lvl_0_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" INNER JOIN "mv_stat_lvl_1_ehr_conditions" ON "mv_stat_lvl_1_ehr_conditions"."patient_id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_declarations"."legal_entity_id" = $1 AND "mv_stat_lvl_1_ehr_conditions"."code" = $2 AND "mv_stat_lvl_1_ehr_conditions"."asserted_date" BETWEEN $3 AND $4 [["legal_entity_id", 3228], ["code", "R96"], ["asserted_date", "2024-01-01 00:00:00"], ["asserted_date", "2024-02-12 23:59:59.999999"]]
- View::MvStatistic::Level0::Declaration Count (0.6ms)
- SELECT COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) FROM "mv_stat_lvl_0_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" INNER JOIN "mv_stat_lvl_1_ehr_conditions" ON "mv_stat_lvl_1_ehr_conditions"."patient_id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_declarations"."legal_entity_id" = $1 AND (mv_stat_lvl_1_ehr_conditions.code LIKE 'P%') AND "mv_stat_lvl_1_ehr_conditions"."asserted_date" BETWEEN $2 AND $3 [["legal_entity_id", 3228], ["asserted_date", "2024-01-01 00:00:00"], ["asserted_date", "2024-02-12 23:59:59.999999"]]
- ↳ app/services/calculators/chronic_diseases/general_count_service.rb:77:in `derangement_counter'
- CACHE View::MvStatistic::Level0::Declaration Count (0.0ms) SELECT COUNT("mv_stat_lvl_0_declarations"."id") FROM "mv_stat_lvl_0_declarations" INNER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_declarations"."legal_entity_id" = $1 [["legal_entity_id", 3228]]
- View::MvStatistic::Level0::Employee Load (2.2ms)
- SELECT mv_stat_lvl_0_employees.id,
- mv_stat_lvl_0_employees.full_name,
- COUNT(DISTINCT mv_stat_lvl_0_declarations.patient_id) AS total_counter,
- 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,
- 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-12 23:59:59.999999' ) AS overweight_counter,
- COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) filter (WHERE mv_stat_lvl_1_ehr_conditions.code IN ('K85', 'K86', 'K87') AND mv_stat_lvl_1_ehr_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-12 23:59:59.999999' ) AS hypertension_counter,
- COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) filter (WHERE mv_stat_lvl_1_ehr_conditions.code IN ('T90') AND mv_stat_lvl_1_ehr_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-12 23:59:59.999999') AS diabetes_counter,
- COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) filter (WHERE mv_stat_lvl_1_ehr_conditions.code IN ('R96') AND mv_stat_lvl_1_ehr_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-12 23:59:59.999999') AS asthma_counter,
- COUNT(DISTINCT mv_stat_lvl_1_ehr_conditions.patient_id) filter (WHERE mv_stat_lvl_1_ehr_conditions.code LIKE 'P%' AND mv_stat_lvl_1_ehr_conditions.asserted_date BETWEEN '2024-01-01 00:00:00' AND '2024-02-12 23:59:59.999999') AS derangement_counter,
- 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-12 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_0_declarations" ON "mv_stat_lvl_0_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_0_declarations"."patient_id" LEFT OUTER JOIN "mv_stat_lvl_1_ehr_conditions" ON "mv_stat_lvl_1_ehr_conditions"."patient_id" = "mv_stat_lvl_0_declarations"."patient_id" LEFT OUTER JOIN "mv_stat_lvl_1_patients" ON "mv_stat_lvl_1_patients"."id" = "mv_stat_lvl_0_declarations"."patient_id" WHERE "mv_stat_lvl_0_employees"."legal_entity_id" = $1 AND "mv_stat_lvl_0_employees"."employee_type_ref_value" = $2 GROUP BY mv_stat_lvl_0_employees.id, mv_stat_lvl_0_employees.full_name LIMIT $3 OFFSET $4 [["legal_entity_id", 3228], ["employee_type_ref_value", "DOCTOR"], ["LIMIT", 15], ["OFFSET", 0]]
- Completed 200 OK in 88ms (Views: 0.4ms | ActiveRecord: 21.5ms | Allocations: 41999)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement