Bahmni Patient Queue

Currently whenever patient visits it will be shown in Clinical module. Is it possible for me to add a numbering / queue number in the UI like below ? If yes, how ?

@abiieez You can add queue number in the UI by adding code

<div>Queue: {{$index +1}}</div>

at /var/www/bahmniapps/common/patient-search/views/patientsList.html file as below

<resize ng-if="search.isTileView()" search-results="search.searchResults"
                visible-results="search.visiblePatients" class="active-visits">
            <ul>
                <li ng-repeat="patient in search.visiblePatients" class="active-patient" ng-click="forwardPatient(patient)">
                    <img class="smallImages" ng-src="{{::patient.image}}" fallback-src='../images/blank-user.png'>
                <div>Queue: {{$index +1}}</div>
                <div class="patient-name">{{::patient.name}}</div>
                <div class="patient-id">{{::patient.identifier}}</div>
                <i class="ipd-indication fa fa-bed" ng-if="::(patient.hasBeenAdmitted===true||patient.hasBeenAdmitted==='true')"></i>
            </li>
            </ul>
        </resize>
5 Likes

Awesome. You saved the day :slight_smile:

Does anybody know how to do it in tabular view?

And maybe add some other column like age or date of birth

@matirp235 ^

DOB listing is not supported. But I thought I saw something for an implementation, don’t know if its custom/fork. @krishnanspace

@angshuonline For tabular view of queues , we can write the query to fetch required information.

Isn’t there a config to display the data in a tabular format? I remember there being one. Displaying the DOB is a small customization

@eddyprasetyo,

We can achieve this Patient Queue tabular format requirement by configuration:

  1. For Patient queue tabular format we should add configuration “view”: “tabular” in the extension.json file in location: openmrs/apps/clinical/extension.json refer Bahmni wiki link
  2. We should update patient search sql query from Openmrs GUI > Administration > > “emrapi.sqlSearch.activePatients” .

Add the following code for adding “Queue” and “Birth Date”

(SELECT @row_number1 := ( @row_number1 + 1 ) AS 'ID' FROM   (SELECT @row_number1 := 0) AS init)            AS 'ID'
 p.birthdate                                            AS 'Birth Date',  

at Openmrs GUI > Administration > “emrapi.sqlSearch.activePatients”

SELECT DISTINCT (SELECT @row_number1 := ( @row_number1 + 1 ) AS 'ID' FROM   (SELECT @row_number1 := 0) AS init)            AS 'ID', 
            pi.identifier                                          AS 'Identifier', 
            Concat(pn.given_name, ' ', Ifnull(pn.family_name, '')) AS 'Name', 
            p.birthdate                                            AS 'Birth Date', 
            Concat("", p.uuid)                                     AS uuid, 
            Concat("", v.uuid)                                     AS activeVisitUuid, 
            IF(va.value_reference = "admitted", "true", "false")   AS hasBeenAdmitted  FROM   visit v 
   JOIN person_name pn 
     ON v.patient_id = pn.person_id 
        AND pn.voided = 0 
   JOIN patient_identifier pi 
     ON v.patient_id = pi.patient_id 
   JOIN patient_identifier_type pit 
     ON pi.identifier_type = pit.patient_identifier_type_id 
   JOIN global_property gp 
     ON gp.property = "bahmni.primaryidentifiertype" 
        AND gp.property_value = pit.uuid 
   JOIN person p 
     ON p.person_id = v.patient_id 
   LEFT OUTER JOIN visit_attribute va 
                ON va.visit_id = v.visit_id 
                   AND va.attribute_type_id = 
                       (SELECT 
                       visit_attribute_type_id 
                                               FROM   visit_attribute_type 
                                               WHERE  name = "admission status" 
                       ) 
                   AND va.voided = 0 WHERE  v.date_stopped IS NULL 
   AND v.voided = 0