I am working on a dashboard that displays a few counters and I am somewhat stuck in a particular one. I would like to know: “All encounters uniquely(based on the encounter_type) recorded for patients”
i.e. I would like to get a count of all the unique combinations of the patient and the encounter_type per encounter.
A sql translation of the problem statement could be:
SELECT SUM(x1.enc_type) AS total_encounter FROM patient INNER JOIN (SELECT DISTINCT (encounter_type), patient_id, COUNT(DISTINCT (encounter_type)) AS enc_type FROM encounterEncounter Search: Unique combinations of the Patient and the EncounterType per Encounter GROUP BY encounter_type , patient_id) x1 ON patient.patient_id = x1.patient_id;
Is there an existing service that I might use for this? I tried using the EncounterSearchCriteria but wasn’t quite able to get the desired results.