View difference between Paste ID: mxdy9TpT and iaP3nZyy
SHOW: | | - or go back to the newest paste.
1-
Started GET "/api/v1/chronic_diseases/employees" for ::1 at 2024-02-15 09:45:04 +0200
1+
Started GET "/api/v1/chronic_diseases/patients" for ::1 at 2024-02-15 09:49:20 +0200
2
3-
MainApplication::Dbo::LegalEntity Load (0.5ms)
3+
MainApplication::Dbo::LegalEntity Load (0.7ms)
4-
SELECT "dbo"."LegalEntities".* FROM "dbo"."LegalEntities" WHERE "dbo"."LegalEntities"."Id" = 3228 LIMIT 1  [["Id", 3228], 
4+
SELECT "dbo"."LegalEntities".* FROM "dbo"."LegalEntities" WHERE "dbo"."LegalEntities"."Id" = 3228 LIMIT 1
5
6-
View::MvStatistic::Level0::Employee Load (2.6ms)
6+
View::MvStatistic::Level1::Declaration Load (0.7ms)
7-
SELECT mv_stat_lvl_0_employees.id,
7+
SELECT DISTINCT "mv_stat_lvl_1_declarations".* 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" = $1 AND "mv_stat_lvl_1_declarations"."legal_entity_id" = $2  [["legal_entity_id", 3228], ["legal_entity_id", 3228]]
8-
mv_stat_lvl_0_employees.full_name,
8+
9-
COUNT(DISTINCT mv_stat_lvl_1_declarations.patient_id) AS total_counter,
9+
View::MvStatistic::Level1::Patient Load (0.6ms)
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,
10+
SELECT "mv_stat_lvl_1_patients".* FROM "mv_stat_lvl_1_patients" WHERE "mv_stat_lvl_1_patients"."id" IN (11395822, 11395824, 11464974, 11464976, 11464994)
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,
11+
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,
12+
View::MvStatistic::Level0::Employee Load (0.5ms)
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,
13+
SELECT "mv_stat_lvl_0_employees".* FROM "mv_stat_lvl_0_employees" WHERE "mv_stat_lvl_0_employees"."id" IN (180499, 181286)  
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,
14+
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,
15+
View::MvStatistic::Level0::Reception Load (2.1ms) 
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
16+
SELECT mv_stat_lvl_0_receptions.patient_id as patient_id, COUNT(DISTINCT mv_stat_lvl_0_receptions.patient_id) as counter FROM "mv_stat_lvl_0_receptions" WHERE "mv_stat_lvl_0_receptions"."asserted_date" BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999' AND "mv_stat_lvl_0_receptions"."patient_id" IN (11395822, 11395824, 11464974, 11464976, 11464994) GROUP BY date(mv_stat_lvl_0_receptions.asserted_date), mv_stat_lvl_0_receptions.patient_id
17
18
View::MvStatistic::Level2::ImtIndex Load (0.5ms)
19-
View::MvStatistic::Level1::Declaration Count (0.9ms)
19+
SELECT "mv_stat_lvl_2_imt_indices".* FROM "mv_stat_lvl_2_imt_indices" WHERE "mv_stat_lvl_2_imt_indices"."asserted_date" BETWEEN '2024-01-01 00:00:00' AND '2024-01-01 00:00:00' AND "mv_stat_lvl_2_imt_indices"."patient_id" IN (11395822, 11395824, 11464974, 11464976, 11464994)
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'
20+
21
View::MvStatistic::Level1::ReceptionCondition Load (0.6ms)
22-
View::MvStatistic::Level1::Declaration Count (0.7ms)
22+
SELECT "mv_stat_lvl_1_reception_conditions".* FROM "mv_stat_lvl_1_reception_conditions" WHERE "mv_stat_lvl_1_reception_conditions"."asserted_date" BETWEEN '2024-01-01 00:00:00' AND '2024-02-15 23:59:59.999999' AND "mv_stat_lvl_1_reception_conditions"."patient_id" IN (11395822, 11395824, 11464974, 11464976, 11464994)
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
23+
24
Completed 200 OK in 31ms (Views: 0.5ms | ActiveRecord: 5.8ms | Allocations: 8496)