Searching for patients by program enrollment

I’m trying to understand and find the best way to make use of the Programs app.

Currently it is configured as described here:, but I’m not sure how this should be used with multiple different programs, e.g. we will have HIV, TB, Malnutrition programs. Currently it appears as if the PROGRAM tabs of the clinical search doesn’t make a difference between the different programs.

Would it make sense to break the one programs search into separate ones for each program? Or is there another intended use for it?

Hi Christian,

Bahmni Search Queues are very generic. You can configure your own queries for Search queues using searchHandler in Config whose value is set to the OpenMRS Global Property holding the SQL Query. So for Programs tab also you can edit the query and make it different from other tabs and different tab for each program.

You can use below query for example : select distinct concat(pn.given_name,’ ', pn.family_name) as name, pi.identifier as identifier, concat("",p.uuid) as uuid,, ps.state, pws.concept_id, cv.concept_full_name, cv.concept_short_name from patient_program pp join person_name pn on pp.patient_id = pn.person_id join patient_identifier pi on pp.patient_id = pi.patient_id join person p on pp.patient_id = p.person_id join program prgm on prgm.program_id = pp.program_id join patient_state ps on ps.patient_program_id = pp.program_id and ps.date_changed is null join program_workflow_state pws on pws.program_workflow_state_id = ps.state join concept_view cv on cv.concept_id = pws.concept_id where = ‘Program_Name’ and cv.concept_full_name=‘ProgramWorkFlowState_Name’ ;

Regards Sandeep, Swathi pairing

1 Like