Sha256: 718aedc9035a6c519219b1d46602d57903940efbc71bf28c36cbad270eb3e838

Contents?: true

Size: 1.02 KB

Versions: 177

Compression:

Stored size: 1.02 KB

Contents

select
patients.id as patient_id,
(SELECT COUNT(*) FROM "events" WHERE "events"."patient_id" = patients.id) as events_count,
(SELECT COUNT(*) FROM "clinic_visits" WHERE "clinic_visits"."patient_id" = patients.id) as clinic_visits_count,
(SELECT COUNT(*) FROM "letter_letters" WHERE "letter_letters"."patient_id" = patients.id) as letters_count,
(SELECT COUNT(*) FROM "access_profiles" WHERE "access_profiles"."patient_id" = patients.id) as access_profiles_count,
(SELECT COUNT(*) FROM "modality_modalities" WHERE "modality_modalities"."patient_id" = patients.id) as modalities_count,
(SELECT COUNT(*) FROM "problem_problems" WHERE "problem_problems"."deleted_at" IS NULL AND "problem_problems"."patient_id" = patients.id) as problems_count,
(SELECT COUNT(*) FROM "pathology_observation_requests" WHERE "pathology_observation_requests"."patient_id" = patients.id) as observation_requests_count,
(SELECT COUNT(*) FROM "medication_prescriptions" WHERE "medication_prescriptions"."patient_id" = patients.id) as prescriptions_count
from patients

Version data entries

177 entries across 177 versions & 1 rubygems

Version Path
renalware-core-2.0.84 db/views/patient_summaries_v01.sql
renalware-core-2.0.83 db/views/patient_summaries_v01.sql
renalware-core-2.0.82 db/views/patient_summaries_v01.sql
renalware-core-2.0.81 db/views/patient_summaries_v01.sql
renalware-core-2.0.80 db/views/patient_summaries_v01.sql
renalware-core-2.0.79 db/views/patient_summaries_v01.sql
renalware-core-2.0.78 db/views/patient_summaries_v01.sql
renalware-core-2.0.77 db/views/patient_summaries_v01.sql
renalware-core-2.0.76 db/views/patient_summaries_v01.sql
renalware-core-2.0.75 db/views/patient_summaries_v01.sql
renalware-core-2.0.74 db/views/patient_summaries_v01.sql
renalware-core-2.0.73 db/views/patient_summaries_v01.sql
renalware-core-2.0.72 db/views/patient_summaries_v01.sql
renalware-core-2.0.71 db/views/patient_summaries_v01.sql
renalware-core-2.0.70 db/views/patient_summaries_v01.sql
renalware-core-2.0.69 db/views/patient_summaries_v01.sql
renalware-core-2.0.68 db/views/patient_summaries_v01.sql
renalware-core-2.0.67 db/views/patient_summaries_v01.sql
renalware-core-2.0.64 db/views/patient_summaries_v01.sql
renalware-core-2.0.63 db/views/patient_summaries_v01.sql