Advertisement
temaon_lieto

SQL quality_indicators

Feb 2nd, 2024
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Started GET "/api/v1/quality_indicators" for ::1 at 2024-02-02 11:19:43 +0200
  2. -- Processing by Api::V1::QualityIndicatorsController#index as HTML
  3. -------
  4. SELECT "dbo"."LegalEntities".* FROM "dbo"."LegalEntities" WHERE "dbo"."LegalEntities"."Id" = $1 LIMIT $2  [["Id", 3228], ["LIMIT", 1]]
  5.  
  6. SELECT "mv_stat_legal_entity_total_receptions".* FROM "mv_stat_legal_entity_total_receptions" WHERE "mv_stat_legal_entity_total_receptions"."legal_entity_id" = $1 LIMIT $2  [["legal_entity_id", 3228], ["LIMIT", 1]]
  7.  
  8.  SELECT "mv_stat_legal_entity_total_service_requests".* FROM "mv_stat_legal_entity_total_service_requests" WHERE "mv_stat_legal_entity_total_service_requests"."legal_entity_id" = $1 LIMIT $2  [["legal_entity_id", 3228], ["LIMIT", 1]]
  9.  
  10. SELECT COUNT("mv_stat_employees_parties"."Id") FROM "mv_stat_employees_parties" WHERE ("mv_stat_employees_parties"."LegalEntityId" = 3228) AND ("mv_stat_employees_parties"."EmployeeTypeRefValue" = 'DOCTOR') AND ("mv_stat_employees_parties"."EmployeeStatusRefValue" = 'APPROVED')
  11.  
  12. SELECT "mv_stat_legal_entity_total_completed_service_requests".* FROM "mv_stat_legal_entity_total_completed_service_requests" WHERE "mv_stat_legal_entity_total_completed_service_requests"."legal_entity_id" = $1 LIMIT $2  [["legal_entity_id", 3228], ["LIMIT", 1]]
  13.  
  14. SELECT COUNT("mv_stat_employees_parties"."Id") FROM "mv_stat_employees_parties" WHERE ("mv_stat_employees_parties"."LegalEntityId" = 3228) AND ("mv_stat_employees_parties"."EmployeeTypeRefValue" = 'DOCTOR') AND ("mv_stat_employees_parties"."EmployeeStatusRefValue" = 'APPROVED')
  15.  
  16. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE') AND (EXTRACT(YEAR FROM CAST(asserted_date AS DATE)) = 2024)
  17.  
  18. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE')
  19.  
  20. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE') AND (EXTRACT(YEAR FROM CAST(asserted_date AS DATE)) = 2024)
  21.  
  22.  SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE')
  23.  
  24. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE') AND (EXTRACT(YEAR FROM CAST(asserted_date AS DATE)) = 2024)
  25.  
  26. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE')
  27.  
  28. SELECT COUNT("mv_stat_employees_parties"."Id") FROM "mv_stat_employees_parties" WHERE ("mv_stat_employees_parties"."LegalEntityId" = 3228) AND ("mv_stat_employees_parties"."EmployeeTypeRefValue" = 'DOCTOR') AND ("mv_stat_employees_parties"."EmployeeStatusRefValue" = 'APPROVED')
  29.  
  30. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE')
  31.  
  32. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE') AND (EXTRACT(YEAR FROM CAST(asserted_date AS DATE)) = 2024)
  33.  
  34. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE') AND (EXTRACT(YEAR FROM CAST(asserted_date AS DATE)) = 2024)
  35.  
  36. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE')
  37.  
  38.  SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE')
  39.  
  40. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND ("mv_stat_declarations"."declaration_status_code" = 'ACTIVE') AND (EXTRACT(YEAR FROM CAST(asserted_date AS DATE)) = 2024)
  41.  
  42. SELECT COUNT("mv_stat_declarations"."id") FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228)
  43.  
  44. SELECT COUNT("mv_stat_employees_parties"."Id") FROM "mv_stat_employees_parties" WHERE ("mv_stat_employees_parties"."LegalEntityId" = 3228) AND ("mv_stat_employees_parties"."EmployeeTypeRefValue" = 'DOCTOR') AND ("mv_stat_employees_parties"."EmployeeStatusRefValue" = 'APPROVED')
  45.  
  46. SELECT COUNT("mv_stat_employees_parties"."Id") FROM "mv_stat_employees_parties" WHERE ("mv_stat_employees_parties"."LegalEntityId" = 3228) AND ("mv_stat_employees_parties"."EmployeeTypeRefValue" = 'DOCTOR') AND ("mv_stat_employees_parties"."EmployeeStatusRefValue" = 'APPROVED')
  47.  
  48. SELECT "mv_stat_legal_entity_total_reception_conditions".* FROM "mv_stat_legal_entity_total_reception_conditions" WHERE "mv_stat_legal_entity_total_reception_conditions"."legal_entity_id" = $1 LIMIT $2  [["legal_entity_id", 3228], ["LIMIT", 1]]
  49.  
  50. SELECT COUNT(DISTINCT patient_id) FROM "mv_stat_receptions_conditions" WHERE "mv_stat_receptions_conditions"."legal_entity_id" = $1 AND "mv_stat_receptions_conditions"."legal_entity_id" = $2 AND "mv_stat_receptions_conditions"."prescription_program_id" = $3 AND "mv_stat_receptions_conditions"."medication_prescriptions_ehealth_status" IN ($4, $5)  [["legal_entity_id", 3228], ["legal_entity_id", 3228], ["prescription_program_id", 1], ["medication_prescriptions_ehealth_status", 0], ["medication_prescriptions_ehealth_status", 1]]
  51.   ↳ app/services/calculators/chronic_medication_rate_count_service.rb:27:in `specific_patients_count'
  52.  Views::MvStatEmployeesParty Count (24.8ms)  SELECT COUNT("mv_stat_employees_parties"."Id") FROM "mv_stat_employees_parties" WHERE ("mv_stat_employees_parties"."LegalEntityId" = 3228) AND ("mv_stat_employees_parties"."EmployeeTypeRefValue" = 'ASSISTANT') AND ("mv_stat_employees_parties"."EmployeeStatusRefValue" = 'APPROVED')
  53.  
  54. SELECT COUNT("mv_stat_employees_parties"."Id") FROM "mv_stat_employees_parties" WHERE ("mv_stat_employees_parties"."LegalEntityId" = 3228) AND ("mv_stat_employees_parties"."EmployeeTypeRefValue" = 'DOCTOR') AND ("mv_stat_employees_parties"."EmployeeStatusRefValue" = 'APPROVED')
  55.  
  56. SELECT COUNT(DISTINCT patient_id) AS "count_distinct_patient_id", legal_entity_id, patient_id AS "legal_entity_id_patient_id" FROM "mv_stat_receptions_conditions" WHERE "mv_stat_receptions_conditions"."legal_entity_id" = $1 GROUP BY legal_entity_id, patient_id HAVING (count(icpc2_code_id) = 1)  [["legal_entity_id", 3228]]
  57.  
  58. ELECT COUNT(DISTINCT patient_id) AS "count_distinct_patient_id", legal_entity_id, patient_id AS "legal_entity_id_patient_id" FROM "mv_stat_receptions_conditions" WHERE "mv_stat_receptions_conditions"."legal_entity_id" = $1 AND "mv_stat_receptions_conditions"."prescription_program_id" = $2 AND "mv_stat_receptions_conditions"."medication_prescriptions_ehealth_status" IN ($3, $4) GROUP BY legal_entity_id, patient_id HAVING (count(icpc2_code_id) = 1)  [["legal_entity_id", 3228], ["prescription_program_id", 1], ["medication_prescriptions_ehealth_status", 0], ["medication_prescriptions_ehealth_status", 1]]
  59.  
  60. SELECT COUNT(DISTINCT patient_id) AS "count_distinct_patient_id", legal_entity_id, patient_id AS "legal_entity_id_patient_id" FROM "mv_stat_receptions_conditions" WHERE "mv_stat_receptions_conditions"."legal_entity_id" = $1 AND "mv_stat_receptions_conditions"."prescription_program_id" = $2 AND "mv_stat_receptions_conditions"."medication_prescriptions_ehealth_status" IN ($3, $4) GROUP BY legal_entity_id, patient_id HAVING (count(icpc2_code_id) = 1)  [["legal_entity_id", 3228], ["prescription_program_id", 1], ["medication_prescriptions_ehealth_status", 0], ["medication_prescriptions_ehealth_status", 1]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement