Patient Search: List the patient who sees the doctor

Patient queue, Hi! I would like to modify the search query in openmrs to list the patient in the queue who sees the doctor and who doesn’t. Please help.

1 Like

Are you looking for this? https://wiki.openmrs.org/display/docs/Patient+Queueing+Module

@slubwama

Thank you for reply @dkayiwa, I wanted to remove patient from active queue after consultation.

Did you read the users guide? https://wiki.openmrs.org/display/docs/Patient+Queueing+User+Guide

My question was exactly relate to this

@angshuonline Provided the answer am ask if there is any one write the query.

If you are using bahmni, post your question again in the bahmni talk category.

Thank you.

I think i found the solution, I just added the following query in advance setting.

select distinct
          concat(pn.given_name,' ',ifnull(pn.middle_name,''),' ', ifnull(pn.family_name,'')) as name,
          pi.identifier as identifier,
          concat("",p.uuid) as uuid,
          concat("",v.uuid) as activeVisitUuid,
          "false" as hasBeenAdmitted,
          pa.value
        from visit v
        inner join person_name pn on v.patient_id = pn.person_id and pn.voided = 0
        inner join patient_identifier pi on v.patient_id = pi.patient_id and pi.identifier NOT IN (
		select distinct( identifier) from wh_order_sumUp,wh_order_line,patient_identifier where
		patient_identifier.patient_id=wh_order_sumUp.patient_id and wh_order_line.order_id=wh_order_sumUp.order_id and
		wh_order_sumUp.paid_status = 0 and wh_order_sumUp.cancelled_statues = 0 and wh_order_line.location_id NOT IN (18,17,33) and wh_order_line.payment_category=1
		and item_type IN ('consultation') ) 
	inner join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id
        inner join global_property gp on gp.property="bahmni.primaryIdentifierType" and gp.property_value=pit.uuid
        inner join person p on p.person_id = v.patient_id
        inner join person_attribute pa on pa.person_id=pn.person_id and pa.person_attribute_type_id=(SELECT person_attribute_type_id FROM openmrs.person_attribute_type where name='providerInCharge')
        where v.date_stopped is null AND v.voided = 0   and v.visit_id not in (select visit_id from  visit_attribute where 
        attribute_type_id = (select visit_attribute_type_id from visit_attribute_type where name="Admission Status"
        ) and voided = 0 and value_reference = "Admitted")
        and pa.value=(select  name from location loc
		where loc.uuid=${location_uuid}) AND v.visit_id IN (select visit_id from encounter, obs
where encounter.encounter_id=obs.encounter_id)

modify the last statement to be

AND v.visit_id IN (select visit_id from encounter, obs
    where encounter.encounter_id=obs.encounter_id AND encounter_type=1)