Sha256: b9f89a750e5f0800c77fec5ddbe62078c52c20783cd14c9105b774c3a3308aee

Contents?: true

Size: 1.13 KB

Versions: 177

Compression:

Stored size: 1.13 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,
(SELECT COUNT(*) FROM "letter_contacts" WHERE "letter_contacts"."patient_id" = patients.id) as contacts_count
FROM patients

Version data entries

177 entries across 177 versions & 1 rubygems

Version Path
renalware-core-2.0.104 db/views/patient_summaries_v02.sql
renalware-core-2.0.103 db/views/patient_summaries_v02.sql
renalware-core-2.0.102 db/views/patient_summaries_v02.sql
renalware-core-2.0.101 db/views/patient_summaries_v02.sql
renalware-core-2.0.100 db/views/patient_summaries_v02.sql
renalware-core-2.0.99 db/views/patient_summaries_v02.sql
renalware-core-2.0.98 db/views/patient_summaries_v02.sql
renalware-core-2.0.97 db/views/patient_summaries_v02.sql
renalware-core-2.0.96 db/views/patient_summaries_v02.sql
renalware-core-2.0.95 db/views/patient_summaries_v02.sql
renalware-core-2.0.94 db/views/patient_summaries_v02.sql
renalware-core-2.0.93 db/views/patient_summaries_v02.sql
renalware-core-2.0.92 db/views/patient_summaries_v02.sql
renalware-core-2.0.91 db/views/patient_summaries_v02.sql
renalware-core-2.0.90 db/views/patient_summaries_v02.sql
renalware-core-2.0.89 db/views/patient_summaries_v02.sql
renalware-core-2.0.88 db/views/patient_summaries_v02.sql
renalware-core-2.0.87 db/views/patient_summaries_v02.sql
renalware-core-2.0.86 db/views/patient_summaries_v02.sql
renalware-core-2.0.85 db/views/patient_summaries_v02.sql