Query | Affected | Num. rows | Took (ms) | Actions |
---|
SELECT `County`.`county_name`, COUNT(*) as cnt, `County`.`id` FROM `pvers`.`medications` AS `Medication` LEFT JOIN `pvers`.`counties` AS `County` ON (`Medication`.`county_id` = `County`.`id`) WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY `County`.`county_name`, `County`.`id` HAVING COUNT(*) > 0 | 12 | 12 | 4 | maybe slow |
SELECT `County`.`id`, `County`.`county_name` FROM `pvers`.`counties` AS `County` WHERE 1 = 1 ORDER BY `County`.`county_name` ASC | 47 | 47 | 0 | |
SELECT `Medication`.`gender`, COUNT(*) as cnt FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY gender HAVING COUNT(*) > 0 | 2 | 2 | 1 | maybe slow |
SELECT ((case
when trim(age_years) in ('neonate', 'infant', 'child', 'adolescent', 'adult', 'elderly') then age_years
when year(now()) - right(date_of_birth, 4) between 0 and 1 then 'infant'
when year(now()) - right(date_of_birth, 4) between 1 and 10 then 'child'
when year(now()) - right(date_of_birth, 4) between 18 and 65 then 'adult'
when year(now()) - right(date_of_birth, 4) between 10 and 18 then 'adolescent'
when year(now()) - right(date_of_birth, 4) between 65 and 155 then 'elderly'
else 'unknown'
end)) as ager, COUNT(*) as cnt FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY ((case
when trim(age_years) in ('neonate', 'infant', 'child', 'adolescent', 'adult', 'elderly') then age_years
when year(now()) - right(date_of_birth, 4) between 0 and 1 then 'infant'
when year(now()) - right(date_of_birth, 4) between 1 and 10 then 'child'
when year(now()) - right(date_of_birth, 4) between 18 and 65 then 'adult'
when year(now()) - right(date_of_birth, 4) between 10 and 18 then 'adolescent'
when year(now()) - right(date_of_birth, 4) between 65 and 155 then 'elderly'
else 'unknown'
end)) HAVING COUNT(*) > 0 | 5 | 5 | 2 | maybe slow |
SELECT year(ifnull(created, created)) as year, COUNT(*) as cnt FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY year(ifnull(created, created)) HAVING COUNT(*) > 0 ORDER BY `year` ASC | 4 | 4 | 1 | maybe slow |
SELECT DATE_FORMAT(created, "%b %Y") as month, month(ifnull(created, created)) as salit, COUNT(*) as cnt FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY DATE_FORMAT(created, "%b %Y"), salit HAVING COUNT(*) > 0 ORDER BY `salit` ASC | 10 | 10 | 2 | maybe slow |
SELECT `Medication`.`name_of_institution`, COUNT(*) as cnt FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY name_of_institution HAVING COUNT(*) > 0 ORDER BY COUNT(*) DESC | 23 | 23 | 1 | |
SELECT `Medication`.`process_occur`, COUNT(*) as cnt FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY process_occur HAVING COUNT(*) > 0 ORDER BY COUNT(*) DESC | 4 | 4 | 1 | maybe slow |
SELECT ((case
when outcome in ('Potential error, circumstances/events have potential to cause incident') then 'NO ERROR'
when outcome in ('Treatment /intervention required-caused temporary harm', 'Initial/prolonged hospitalization-caused temporary harm', 'Caused permanent harm', 'Near death event') then 'ERROR, HARM'
when outcome in ('Actual error-did not reach patient', 'Actual error-caused no harm', 'Additional monitoring required-caused no harm') then 'ERROR, NO HARM'
when outcome in ('Death') then 'ERROR, DEATH'
else 'N/A'
end)) as error, COUNT(*) as cnt FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY ((case
when outcome in ('Potential error, circumstances/events have potential to cause incident') then 'NO ERROR'
when outcome in ('Treatment /intervention required-caused temporary harm', 'Initial/prolonged hospitalization-caused temporary harm', 'Caused permanent harm', 'Near death event') then 'ERROR, HARM'
when outcome in ('Actual error-did not reach patient', 'Actual error-caused no harm', 'Additional monitoring required-caused no harm') then 'ERROR, NO HARM'
when outcome in ('Death') then 'ERROR, DEATH'
else 'N/A'
end)) HAVING COUNT(*) > 0 | 5 | 5 | 1 | maybe slow |
SELECT `Designation`.`name`, COUNT(*) as cnt, `Designation`.`id` FROM `pvers`.`medications` AS `Medication` LEFT JOIN `pvers`.`designations` AS `Designation` ON (`Medication`.`designation_id` = `Designation`.`id`) WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY `Designation`.`name`, `Designation`.`id` HAVING COUNT(*) > 0 | 11 | 11 | 2 | maybe slow |
SELECT ((case
when error_cause_inexperience = 1 or error_cause_knowledge = 1 or error_cause_distraction = 1 then 'Staff factors'
when error_cause_medication = 1 or error_cause_packaging = 1 or error_cause_sound = 1 then 'Medication related'
when error_cause_workload = 1 or error_cause_peak = 1 or error_cause_stock = 1 then 'Work and environment'
when error_cause_procedure = 1 or error_cause_abbreviations = 1 or error_cause_illegible = 1 or error_cause_inaccurate = 1 or error_cause_labelling = 1 or error_cause_computer = 1 or error_cause_other = 1 then 'Task and technology'
else 'N/A'
end)) as factor, COUNT(*) as cnt FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` IN (1, 2) AND `Medication`.`copied` != 1 AND `Medication`.`deleted` = '' AND `Medication`.`archived` = '' AND `Medication`.`reach_patient` = 'Yes' GROUP BY ((case
when error_cause_inexperience = 1 or error_cause_knowledge = 1 or error_cause_distraction = 1 then 'Staff factors'
when error_cause_medication = 1 or error_cause_packaging = 1 or error_cause_sound = 1 then 'Medication related'
when error_cause_workload = 1 or error_cause_peak = 1 or error_cause_stock = 1 then 'Work and environment'
when error_cause_procedure = 1 or error_cause_abbreviations = 1 or error_cause_illegible = 1 or error_cause_inaccurate = 1 or error_cause_labelling = 1 or error_cause_computer = 1 or error_cause_other = 1 then 'Task and technology'
else 'N/A'
end)) HAVING COUNT(*) > 0 | 5 | 5 | 1 | maybe slow |
SELECT `Medication`.`id` FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` = 2 AND `Medication`.`copied` != 1 AND `Medication`.`report_type` != 'Followup' | 205 | 205 | 1 | |
SELECT `MedicationProduct`.`product_name_i` AS `product_name_i`, COUNT(distinct MedicationProduct.medication_id) as cnt FROM `pvers`.`medication_products` AS `MedicationProduct` WHERE `MedicationProduct`.`medication_id` IN (3, 6, 47, 52, 71, 83, 88, 104, 106, 122, 142, 145, 146, 148, 152, 153, 157, 165, 172, 186, 187, 189, 192, 193, 196, 221, 222, 223, 224, 232, 234, 235, 237, 238, 241, 247, 249, 252, 253, 262, 263, 273, 280, 283, 284, 299, 341, 384, 387, 390, 439, 463, 469, 471, 473, 476, 482, 483, 486, 487, 488, 490, 497, 499, 501, 503, 508, 514, 519, 520, 522, 525, 526, 529, 532, 546, 553, 557, 562, 563, 565, 574, 576, 577, 579, 580, 581, 584, 585, 586, 590, 592, 593, 594, 595, 596, 597, 599, 602, 605, 608, 610, 614, 616, 623, 664, 665, 666, 668, 672, 673, 674, 680, 683, 741, 778, 780, 781, 783, 785, 786, 791, 792, 793, 794, 796, 805, 808, 811, 812, 813, 814, 817, 818, 819, 821, 824, 827, 828, 829, 831, 832, 833, 835, 838, 845, 847, 849, 852, 853, 855, 869, 870, 871, 873, 876, 882, 886, 900, 901, 911, 912, 913, 914, 915, 916, 917, 919, 921, 922, 939, 943, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 958, 960, 962, 963, 964, 968, 971, 974, 976, 980, 988, 989, 990, 991, 992, 993, 1002, 1004, 1005, 1016, 1017, 1021, 1022) GROUP BY `MedicationProduct`.`product_name_i` HAVING COUNT(distinct `MedicationProduct`.`medication_id`) > 0 | 40 | 40 | 6 | maybe slow |
SELECT `Medication`.`id` FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` = 2 AND `Medication`.`copied` != 1 AND `Medication`.`report_type` != 'Followup' | 205 | 205 | 3 | |
SELECT `MedicationProduct`.`product_name_ii` AS `product_name_ii`, COUNT(distinct MedicationProduct.medication_id) as cnt FROM `pvers`.`medication_products` AS `MedicationProduct` WHERE `MedicationProduct`.`medication_id` IN (3, 6, 47, 52, 71, 83, 88, 104, 106, 122, 142, 145, 146, 148, 152, 153, 157, 165, 172, 186, 187, 189, 192, 193, 196, 221, 222, 223, 224, 232, 234, 235, 237, 238, 241, 247, 249, 252, 253, 262, 263, 273, 280, 283, 284, 299, 341, 384, 387, 390, 439, 463, 469, 471, 473, 476, 482, 483, 486, 487, 488, 490, 497, 499, 501, 503, 508, 514, 519, 520, 522, 525, 526, 529, 532, 546, 553, 557, 562, 563, 565, 574, 576, 577, 579, 580, 581, 584, 585, 586, 590, 592, 593, 594, 595, 596, 597, 599, 602, 605, 608, 610, 614, 616, 623, 664, 665, 666, 668, 672, 673, 674, 680, 683, 741, 778, 780, 781, 783, 785, 786, 791, 792, 793, 794, 796, 805, 808, 811, 812, 813, 814, 817, 818, 819, 821, 824, 827, 828, 829, 831, 832, 833, 835, 838, 845, 847, 849, 852, 853, 855, 869, 870, 871, 873, 876, 882, 886, 900, 901, 911, 912, 913, 914, 915, 916, 917, 919, 921, 922, 939, 943, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 958, 960, 962, 963, 964, 968, 971, 974, 976, 980, 988, 989, 990, 991, 992, 993, 1002, 1004, 1005, 1016, 1017, 1021, 1022) GROUP BY `MedicationProduct`.`product_name_ii` HAVING COUNT(distinct `MedicationProduct`.`medication_id`) > 0 | 34 | 34 | 1 | |
SELECT `Medication`.`id` FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` = 2 AND `Medication`.`copied` != 1 AND `Medication`.`report_type` != 'Followup' | 205 | 205 | 1 | |
SELECT `MedicationProduct`.`generic_name_i` AS `generic_name_i`, COUNT(distinct MedicationProduct.medication_id) as cnt FROM `pvers`.`medication_products` AS `MedicationProduct` WHERE `MedicationProduct`.`created` > '2020-04-01 08:08:08' AND `MedicationProduct`.`generic_name_i` > '' AND `MedicationProduct`.`medication_id` IN (3, 6, 47, 52, 71, 83, 88, 104, 106, 122, 142, 145, 146, 148, 152, 153, 157, 165, 172, 186, 187, 189, 192, 193, 196, 221, 222, 223, 224, 232, 234, 235, 237, 238, 241, 247, 249, 252, 253, 262, 263, 273, 280, 283, 284, 299, 341, 384, 387, 390, 439, 463, 469, 471, 473, 476, 482, 483, 486, 487, 488, 490, 497, 499, 501, 503, 508, 514, 519, 520, 522, 525, 526, 529, 532, 546, 553, 557, 562, 563, 565, 574, 576, 577, 579, 580, 581, 584, 585, 586, 590, 592, 593, 594, 595, 596, 597, 599, 602, 605, 608, 610, 614, 616, 623, 664, 665, 666, 668, 672, 673, 674, 680, 683, 741, 778, 780, 781, 783, 785, 786, 791, 792, 793, 794, 796, 805, 808, 811, 812, 813, 814, 817, 818, 819, 821, 824, 827, 828, 829, 831, 832, 833, 835, 838, 845, 847, 849, 852, 853, 855, 869, 870, 871, 873, 876, 882, 886, 900, 901, 911, 912, 913, 914, 915, 916, 917, 919, 921, 922, 939, 943, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 958, 960, 962, 963, 964, 968, 971, 974, 976, 980, 988, 989, 990, 991, 992, 993, 1002, 1004, 1005, 1016, 1017, 1021, 1022) GROUP BY `MedicationProduct`.`generic_name_i` HAVING COUNT(distinct `MedicationProduct`.`medication_id`) > 0 | 72 | 72 | 1 | |
SELECT `Medication`.`id` FROM `pvers`.`medications` AS `Medication` WHERE `Medication`.`submitted` = 2 AND `Medication`.`copied` != 1 AND `Medication`.`report_type` != 'Followup' | 205 | 205 | 1 | |
SELECT `MedicationProduct`.`generic_name_ii` AS `generic_name_ii`, COUNT(distinct MedicationProduct.medication_id) as cnt FROM `pvers`.`medication_products` AS `MedicationProduct` WHERE `MedicationProduct`.`created` > '2020-04-01 08:08:08' AND `MedicationProduct`.`generic_name_ii` > '' AND `MedicationProduct`.`medication_id` IN (3, 6, 47, 52, 71, 83, 88, 104, 106, 122, 142, 145, 146, 148, 152, 153, 157, 165, 172, 186, 187, 189, 192, 193, 196, 221, 222, 223, 224, 232, 234, 235, 237, 238, 241, 247, 249, 252, 253, 262, 263, 273, 280, 283, 284, 299, 341, 384, 387, 390, 439, 463, 469, 471, 473, 476, 482, 483, 486, 487, 488, 490, 497, 499, 501, 503, 508, 514, 519, 520, 522, 525, 526, 529, 532, 546, 553, 557, 562, 563, 565, 574, 576, 577, 579, 580, 581, 584, 585, 586, 590, 592, 593, 594, 595, 596, 597, 599, 602, 605, 608, 610, 614, 616, 623, 664, 665, 666, 668, 672, 673, 674, 680, 683, 741, 778, 780, 781, 783, 785, 786, 791, 792, 793, 794, 796, 805, 808, 811, 812, 813, 814, 817, 818, 819, 821, 824, 827, 828, 829, 831, 832, 833, 835, 838, 845, 847, 849, 852, 853, 855, 869, 870, 871, 873, 876, 882, 886, 900, 901, 911, 912, 913, 914, 915, 916, 917, 919, 921, 922, 939, 943, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 958, 960, 962, 963, 964, 968, 971, 974, 976, 980, 988, 989, 990, 991, 992, 993, 1002, 1004, 1005, 1016, 1017, 1021, 1022) GROUP BY `MedicationProduct`.`generic_name_ii` HAVING COUNT(distinct `MedicationProduct`.`medication_id`) > 0 | 86 | 86 | 1 | |
3 duplicate queries run.