Clinical App: Removing patients from Active queue once in consultation

Is there a way for providers to remove patients they are consulting from the active queue, so that other providers know they are already being tended to?

Or is there some other workflow in Bahmni which can achieve this?

1 Like

In a straight forward manner - no. the queues are not really queues as such - nothing goes out. One way to do this, is to capture some value against some concept in a form which the provider needs to fill up. Then you can use that to take into consideration in your SQLs that is used for a “queue”.

I think one must understand the data model, I tried to follow up on the data model detail and I come up with the following query.

>     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,
            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"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 AND encounter_type=1)