Hi,
I am trying to implement Bahmni on a polyclinic setting. One of the user requirement is that providers can only see patients they were assigned to or referred to. How can I configure OpenMrs to meet that requirement ?
Best,
Hi,
I am trying to implement Bahmni on a polyclinic setting. One of the user requirement is that providers can only see patients they were assigned to or referred to. How can I configure OpenMrs to meet that requirement ?
Best,
Right now the application doesnât have a specific ability to configure query of patient list queue based on the logged in user.
However using a few of other features, one solution to achieve your use case right now could be, to configure multiple patient lists as mentioned in the wiki below. Each query would have hardcoded provider name in the query and then you can control the visibility of the patient queue based on privileges.
Refer the documentation to configure the patient queue. https://bahmni.atlassian.net/wiki/display/BAH/Configure+Patient+Lists
For assigning patients to providers you can use one of the two
Obs form having coded answers as provider names to a question, which you can later use in the query mentioned above.
I like the suggestion on using some Obs form. Would it be better if we use a Visit Attribute instead and the registration person can set that while starting visit. That way, the registration clerk wonât need access to Clinical App.
I donât think we should be using Patient Relationships for this. These are for linking family members of patients like Mother and Child etc. Also these are at the Patient level and not expected to change per visit.
Also can you please share how âyou can control the visibility of the patient queue based on privileges.â?
Relationship can also be used to relate a Doctor and a patient which is termed as Provider relationship.
In âextension.jsonâ under the key ârequiredPrivilegeâ you can specify the privilege required to view the queue. Please refer this https://bahmni.atlassian.net/wiki/display/BAH/Configure+Patient+Lists
Thank you all.
Making sure some of the things said here are correct.
>> Right now the application doesnât have flexibility to configure query of patient list queue based on the logged in user. One solution would be hardcode the patient list query with provider name and then control the visibility of the patient queue based on privileges This is not correct. You can do this. Patient listing can be defined based on current logged in provider. To do that you can define query like the following: https://github.com/Bahmni/jss-config/blob/master/openmrs/migrations/liquibase.xml#L1263 Notice âpr.uuid=${provider_uuid}â in the query this is passed dyanmically. And you define the patient listing like this: https://github.com/Bahmni/jss-config/blob/master/openmrs/apps/clinical/extension.json#L83 So, you donât need to create query per provider. I have updated the documentation https://bahmni.atlassian.net/wiki/display/BAH/Configure+Patient+Lists for this.
>> Relationship can also be used to relate a Doctor and a patient which is termed as Provider relationship. One can do this. Except that you will have to change this every time the provider changes.
Hi Vivek, Can you help me with instructions on how to perform this step: To do that you can define query like the following: https://github.com/Bahmni/jss-config/blob/master/openmrs/migrations/liquibase.xml#L1263 ? The other 2 steps are clear to me where to make the changes, but for the first one I donât have any idea (Iâm a biochemist, not a programmer, sorry) Thanks in advance for your help.
Hi German Acevedo,
Step 1 : Go to https://{{your-ip}}/openmrs -> click on Administration -> Advanced Settings Step 2 : Click on âAdd Propertyâ which is at the bottom of the page. Step 3 : Under Name, please add âemrapi.sqlSearch.todaysPatientsByProviderâ and also add the below query under value then click on save
select distinct concat(pn.given_name," â, pn.family_name) as name, pi.identifier as identifier, concat(â",p.uuid) as uuid, concat("",v.uuid) as activeVisitUuid from visit v join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 and v.voided=0 join patient_identifier pi on v.patient_id = pi.patient_id and pi.voided=0 join person p on p.person_id = v.patient_id and p.voided=0 join encounter en on en.visit_id = v.visit_id and en.voided=0 join encounter_provider ep on ep.encounter_id = en.encounter_id and ep.voided=0 join provider pr on ep.provider_id=pr.provider_id and pr.retired=0 join person per on pr.person_id=per.person_id and per.voided=0 where date(en.encounter_datetime)=curdate() and pr.uuid=${provider_uuid} order by en.encounter_datetime desc;
Step 4: Add the below section in /var/www/bahmni_config/openmrs/apps/clinical/extension.json
âbahmniClinicalPatientsSearchTodaysPatientsByProviderâ: { âidâ: âbahmni.clinical.patients.search.allPatientsâ, âextensionPointIdâ: âorg.bahmni.patient.searchâ, âtypeâ: âconfigâ, âextensionParamsâ: { âsearchHandlerâ: âemrapi.sqlSearch.todaysPatientsByProviderâ, âdisplayâ: âMy Patientsâ, âforwardUrlâ: â#/default/patient/{{patientUuid}}/dashboard?encounterUuid=activeâ, âlabelâ:âMy Patientsâ }, âlabelâ: âMy Patientsâ, âorderâ: 2, ârequiredPrivilegeâ: âapp:clinicalâ }
Please refer the documentation link https://bahmni.atlassian.net/wiki/display/BAH/Configure+Patient+Lists
Thanks, I have now it working, but something strange is happening:
I have created a new user with Bahmni Doctor and Registration Clerk roles (in our organization the doctor makes the registration of the patient also). First there were only 1 patient showing: Test CloseVisit (GAN200061). Then I created a new patient, and it showed in My Patients tab as expected. I created a 2nd. patient, but now there are 4 patients in my patients tab, but more strange is that I have 2 My Patients tabs inside Clinical, as you can see in this screenshot:
Now also appears another patient (that is not associated with my new doctor) with ID Test DrugDataOne (GAN200000) and my new doctor can add consultations tho this patient and see all his medical history. Is there any way to filter also the registered patients to the provider? Regards, GermanIn the screenshot you shared, i could see 3 patients under âMy patientsâ tab. If your requirement is to show only âMy Patientsâ tab to the Doctors, you can remove the other tabs from the configuration (extension.json). Can you please share the extension.json content ?
Thanks for your help, sure I want to show only My Patients tab for Bahmni Doctors.
This is the content of /opt/bahmni-web/etc/bahmni_config/openmrs/apps/clinical/extension.json:
{ âobservationsâ: { âidâ: âbahmni.clinical.consultation.observationsâ, âextensionPointIdâ: âorg.bahmni.clinical.consultation.boardâ, âtypeâ: âlinkâ, âlabelâ: âObservationsâ, âtranslationKeyâ:âOBSERVATIONS_BOARD_LABEL_KEYâ, âurlâ: âconcept-set-group/observationsâ, âdefaultâ: true, âiconâ: âfa-user-mdâ, âorderâ: 1, ârequiredPrivilegeâ: âapp:clinical:observationTabâ }, âdiagnosisâ: { âidâ: âbahmni.clinical.consultation.diagnosisâ, âextensionPointIdâ: âorg.bahmni.clinical.consultation.boardâ, âtypeâ: âlinkâ, âlabelâ: âDiagnosisâ, âtranslationKeyâ:âDIAGNOSIS_BOARD_LABEL_KEYâ, âurlâ: âdiagnosisâ, âiconâ: âfa-user-mdâ, âorderâ: 2, ârequiredPrivilegeâ: âapp:clinical:diagnosisTabâ }, âdispositionâ: { âidâ: âbahmni.clinical.consultation.dispositionâ, âextensionPointIdâ: âorg.bahmni.clinical.consultation.boardâ, âtypeâ: âlinkâ, âlabelâ: âDispositionâ, âtranslationKeyâ:âDISPOSITION_BOARD_LABEL_KEYâ, âurlâ: âdispositionâ, âiconâ: âfa-user-mdâ, âorderâ: 3, ârequiredPrivilegeâ: âapp:clinical:dispositionTabâ }, âconsultationSummaryâ: { âidâ: âbahmni.clinical.consultation.summaryâ, âextensionPointIdâ: âorg.bahmni.clinical.consultation.boardâ, âtypeâ: âlinkâ, âlabelâ: âConsultationâ, âtranslationKeyâ:âCONSULTATION_BOARD_LABEL_KEYâ, âurlâ: âconsultationâ, âiconâ: âfa-user-mdâ, âorderâ: 5, ârequiredPrivilegeâ: âapp:clinical:consultationTabâ }, âbahmniClinicalOrdersPendingâ: { âidâ: âbahmni.clinical.orders.pendingâ, âextensionPointIdâ: âorg.bahmni.clinical.ordersâ, âtypeâ: âlinkâ, âlabelâ: âPending Ordersâ, âurlâ: âpendingOrdersâ, âiconâ: âfa-user-mdâ, âorderâ: 5, ârequiredPrivilegeâ: âapp:radiologyOrdersâ }, âbahmniClinicalPatientsSearchAllActivePatientsâ: { âidâ: âbahmni.clinical.patients.search.allActivePatientsâ, âextensionPointIdâ: âorg.bahmni.patient.searchâ, âtypeâ: âconfigâ, âextensionParamsâ: { âsearchHandlerâ: âemrapi.sqlSearch.activePatientsâ, âtranslationKeyâ: âMODULE_LABEL_ACTIVE_KEYâ, âforwardUrlâ: â#/default/patient/{{patientUuid}}/dashboardâ }, âlabelâ: âActiveâ, âorderâ: 1, ârequiredPrivilegeâ: âapp:clinicalâ }, âbahmniClinicalPatientsSearchActivePatientsForProgramsâ: { âidâ: âbahmni.clinical.patients.search.activePatientsâ, âextensionPointIdâ: âorg.bahmni.patient.searchâ, âtypeâ: âconfigâ, âextensionParamsâ: { âsearchHandlerâ: âemrapi.sqlSearch.activePatientsâ, âtranslationKeyâ: âMODULE_LABEL_PROGRAMS_KEYâ, âforwardUrlâ: â#/default/patient/{{patientUuid}}/consultationContextâ }, âlabelâ: âActiveâ, âorderâ: 1, ârequiredPrivilegeâ: âapp:clinicalâ }, âbahmniClinicalPatientsASearchActivePatientsByProviderâ: { âidâ: âbahmni.clinical.patients.search.activePatientsByProviderâ, âextensionPointIdâ: âorg.bahmni.patient.searchâ, âtypeâ: âconfigâ, âextensionParamsâ: { âsearchHandlerâ: âemrapi.sqlSearch.activePatientsByProviderâ, âtranslationKeyâ: âMODULE_LABEL_MY_PATIENTS_KEYâ, âforwardUrlâ: â#/default/patient/{{patientUuid}}/dashboardâ }, âlabelâ: âActiveâ, âorderâ: 2, ârequiredPrivilegeâ: âapp:clinicalâ }, âbahmniClinicalPatientsSearchOPDActivePatientsByProviderâ: { âidâ: âbahmni.clinical.patients.search.OPDActivePatientsByProviderâ, âextensionPointIdâ: âorg.bahmni.patient.searchâ, âtypeâ: âconfigâ, âextensionParamsâ: { âsearchHandlerâ: âemrapi.sqlSearch.activePatientsByProviderâ, âtranslationKeyâ: âMODULE_LABEL_OPD_1_KEYâ, âforwardUrlâ: â#/default/patient/{{patientUuid}}/consultationContextâ }, âlabelâ: âOPD-1â, âorderâ: 3, ârequiredPrivilegeâ: âapp:clinicalâ }, âactivePatientsByLocationâ: { âidâ: âbahmni.clinical.patients.search.activePatientsByLocationâ, âextensionPointIdâ: âorg.bahmni.patient.searchâ, âtypeâ: âconfigâ, âextensionParamsâ: { âsearchHandlerâ: âemrapi.sqlSearch.activePatientsByLocationâ, âtranslationKeyâ: âMODULE_LABEL_ACTIVE_PATIENTS_BY_LOCATIONâ, âforwardUrlâ: â#/default/patient/{{patientUuid}}/dashboardâ }, âlabelâ: âActiveâ, âorderâ: 4, ârequiredPrivilegeâ: âapp:clinicalâ }, âbahmniClinicalPatientsSearchAllPatientsâ: { âidâ: âbahmni.clinical.patients.search.allPatientsâ, âextensionPointIdâ: âorg.bahmni.patient.searchâ, âtypeâ: âconfigâ, âextensionParamsâ: { âtranslationKeyâ: âMODULE_LABEL_ALL_KEYâ, âforwardUrlâ: â#/default/patient/{{patientUuid}}/dashboardâ }, âlabelâ: âAllâ, âorderâ: 5, ârequiredPrivilegeâ: âapp:clinicalâ }, âbahmniClinicalConceptSetGroupObservationsHistoryâ: { âidâ: âbahmni.clinical.conceptSetGroup.observations.historyâ, âextensionPointIdâ: âorg.bahmni.clinical.conceptSetGroup.observationsâ, âtypeâ: âconfigâ, âextensionParamsâ: { âconceptNameâ: âHistory and Examinationâ, âdefaultâ: true }, âorderâ: 1, ârequiredPrivilegeâ: âapp:clinical:historyâ }, âbahmniClinicalConceptSetGroupObservationsVitalsâ: { âidâ: âbahmni.clinical.conceptSetGroup.observations.vitalsâ, âextensionPointIdâ: âorg.bahmni.clinical.conceptSetGroup.observationsâ, âtypeâ: âconfigâ, âextensionParamsâ: { âdefaultâ: true, âconceptNameâ: âVitalsâ }, âorderâ: 2, ârequiredPrivilegeâ: âapp:clinicalâ }, âbahmniClinicalConceptSetGroupObservationsSecondVitalsâ: { âidâ: âbahmni.clinical.conceptSetGroup.observations.secondVitalsâ, âextensionPointIdâ: âorg.bahmni.clinical.conceptSetGroup.observationsâ, âtypeâ: âconfigâ, âextensionParamsâ: { âconceptNameâ: âSecond Vitalsâ, âshowIfâ: [ âvar visitTypes = [];â, âif(visitTypes.length === 0) return true;â, âvar visitTypeName = context.visitType ? context.visitType.name : null;â, âreturn visitTypes.indexOf(visitTypeName) !== -1;â ] }, âorderâ: 3, ârequiredPrivilegeâ: âapp:clinicalâ }, âbahmniClinicalConceptSetGroupObservationsObstetricsâ: { âidâ: âbahmni.clinical.conceptSetGroup.observations.obstetricsâ, âextensionPointIdâ: âorg.bahmni.clinical.conceptSetGroup.observationsâ, âtypeâ: âconfigâ, âextensionParamsâ: { âconceptNameâ: âObstetricsâ }, âorderâ: 4, ârequiredPrivilegeâ: âapp:clinicalâ }, âbahmniClinicalConceptSetGroupObservationsGynaecologyâ: { âidâ: âbahmni.clinical.conceptSetGroup.observations.gynaecologyâ, âextensionPointIdâ: âorg.bahmni.clinical.conceptSetGroup.observationsâ, âtypeâ: âconfigâ, âextensionParamsâ: { âconceptNameâ: âGynaecologyâ }, âorderâ: 5, ârequiredPrivilegeâ: âapp:clinicalâ }, âbahmniClinicalConceptSetGroupObservationsDischargeSummaryâ: { âidâ: âbahmni.clinical.conceptSetGroup.observations.dischargeSummaryâ, âextensionPointIdâ: âorg.bahmni.clinical.conceptSetGroup.observationsâ, âtypeâ: âconfigâ, âextensionParamsâ: { âconceptNameâ: âDischarge Summaryâ }, âorderâ: 6, ârequiredPrivilegeâ: âDischarge Summaryâ }, âbahmniClinicalBillingTreatmentâ: { âidâ: âbahmni.clinical.billing.treatmentâ, âextensionPointIdâ: âorg.bahmni.clinical.consultation.boardâ, âtypeâ: âlinkâ, âlabelâ: âMedicationsâ, âtranslationKeyâ:âMEDICATIONS_BOARD_LABEL_KEYâ, âextensionParamsâ:{ âtabConfigNameâ: âallMedicationTabConfigâ }, âurlâ: âtreatmentâ, âiconâ: âfa-user-mdâ, âorderâ: 7, ârequiredPrivilegeâ: âapp:clinical:consultationTabâ }, âbahmniClinicalConsultationOrdersâ: { âidâ: âbahmni.clinical.consultation.ordersâ, âextensionPointIdâ: âorg.bahmni.clinical.consultation.boardâ, âtypeâ: âlinkâ, âlabelâ: âOrdersâ, âtranslationKeyâ:âORDERS_BOARD_LABEL_KEYâ, âurlâ: âordersâ, âiconâ: âicon-user-mdâ, âorderâ: 6, ârequiredPrivilegeâ: âapp:clinical:diagnosisTabâ }, âbahmniClinicalConsultationBacteriologyâ: { âidâ: âbahmni.clinical.consultation.bacteriologyâ, âextensionPointIdâ: âorg.bahmni.clinical.consultation.boardâ, âtypeâ: âlinkâ, âlabelâ: âBacteriologyâ, âtranslationKeyâ:âBACTERIOLOGY_BOARD_LABEL_KEYâ, âurlâ: âbacteriologyâ, âiconâ: âicon-user-mdâ, âorderâ: 7, ârequiredPrivilegeâ: âapp:clinical:diagnosisTabâ }, âbahmniClinicalPatientsSearchTodaysPatientsByProviderâ: { âidâ: âbahmni.clinical.patients.search.allPatientsâ, âextensionPointIdâ: âorg.bahmni.patient.searchâ, âtypeâ: âconfigâ, âextensionParamsâ: { âsearchHandlerâ: âemrapi.sqlSearch.todaysPatientsByProviderâ, âdisplayâ: âMy Patientsâ, âforwardUrlâ: â#/default/patient/{{patientUuid}}/dashboard?encounterUuid=activeâ, âlabelâ:âMy Patientsâ }, âlabelâ: âMy Patientsâ, âorderâ: 2, ârequiredPrivilegeâ: âapp:clinicalâ } }
According to your requirement, if you want only one tab i.eâŠ, tab that shows the active patients per Doctor, then you can remove the below quoted sections from your extension.json.
@sravanthi17 I believe we can utilize the Appointment module to see a patientâs list under certain provider/clinic through filtering appointments by providers/clinics.
When a patient walks in to a clinic, she can be checked-in as a âwalk-in appointmentâ, then provider/clinic will have access to the appointment page and can filter patients under her name.
Just a thought.
Regards,
You can configure it that way.
But the use case here is in different modules⊠not the appointment module. For example: Doctor accessing clinical module, wants to see the active patients for that Doctor in the patient search page.
I came across this as I havenât still managed to get the appointment module working with 0.88. The sql query supplied with the demo database wasnât working for the provider, so I replaced it with the one suggested here. However that still didnât work as expected. To make it clear, I have regone as receptionist who assigns a provider(doctorone) to a patient while starting the visit. When the doctorone logs in, he doesnât see any patients in âMyPatientsâ list. Trying to troubleshoot this, I ran the query without the provider uuid criteria mysql> select distinct concat(pn.given_name," â, pn.family_name) as name, pi.identifier as identifier, concat(â",p.uuid) as uuid, concat("",v.uuid) as activeVisitUuid, pr.provider_id as provider from visit v join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 and v.voided=0 join patient_identifier pi on v.patient_id = pi.patient_id and pi.voided=0 join person p on p.person_id = v.patient_id and p.voided=0 join encounter en on en.visit_id = v.visit_id and en.voided=0 join encounter_provider ep on ep.encounter_id = en.encounter_id and ep.voided=0 join provider pr on ep.provider_id=pr.provider_id and pr.retired=0 join person per on pr.person_id=per.person_id and per.voided=0 where date(en.encounter_datetime)=curdate() order by en.encounter_datetime desc; ±------------±--------------±-------------------------------------±-------------------------------------±---------+ | name | identifier | uuid | activeVisitUuid | provider | ±------------±--------------±-------------------------------------±-------------------------------------±---------+ | Vijay Kumar | PNV-KKL203003 | b04b88b2-e5fc-4134-8871-f29552059fe0 | a7778368-8eba-4a20-836a-be5ca558d78f | 12 | | Vijay Kumar | 2804 | b04b88b2-e5fc-4134-8871-f29552059fe0 | a7778368-8eba-4a20-836a-be5ca558d78f | 12 | | Vijay Kumar | PNV-KKL203003 | b04b88b2-e5fc-4134-8871-f29552059fe0 | 8e1ec7d2-be9f-4ba4-81c2-cdd9ddba3920 | 12 | | Vijay Kumar | 2804 | b04b88b2-e5fc-4134-8871-f29552059fe0 | 8e1ec7d2-be9f-4ba4-81c2-cdd9ddba3920 | 12 | ±------------±--------------±-------------------------------------±-------------------------------------±---------+
That is listing the visits(It is odd to see two visits created, one for patient identifier and one for national id).
However it didnât look like provider id was right. Looking at it further mysql> select distinct concat(pn.given_name," ", pn.family_name) as name from person p join person_name pn on p.person_id = pn.person_id join provider pr on pr.person_id=p.person_id where provider_id=12; ±-----------+ | name | ±-----------+ | RegOne Rao | ±-----------+ 1 row in set (0.00 sec)
That is the user who started the visit rather than the assigned doctor. Normally, I wouldnât treat registration user as provider, however I had to create provider account for registration user due to some login issue. Wondering whether I have done something wrong or it is defect.
this doesnât mean there are two visits⊠The query returns multiple results for same visit because there are 2 patient identifiers for a patient. Instead if you modify the query to filter based on primary identifier as shown below (type 3 is primary identifier), you could see only one result.
patient_identifier pi on v.patient_id = pi.patient_id and pi.voided=0 and pi.identifier_type=3
In the system, the provider is the one who created the visit. In this case registration user is the one who created the visit. this is what the query also defines⊠As of now the system doesnât support assigning a patient to a doctor during registration.
Thanks, Its been ages since I last used sql!
hmm, that is disappointing as it wonât work for patient queues unless the doctor also takes the role of a registration user. It looks more of a defect rather than system limitation. Wondering where else Provider relationship is used if not for patient queuesâŠ
Can still be used in the case of patient queues. For instance, as a provider I would like to see all the patient list for whom I have given consultation. In this case the encounter provider is the doctor and not the registration person.
Thanks @sravanthi17,
I am recording the patient<->provider(encounter provider?) relationship as a registration user. I would like to get that info when logged in as encounter provider, so that the doctor can see the list of patients who are going to get consulted. He isnât really interested in the registration user that created the encounter.
I tried some variation of the query by using encounter_provider_id instead of provider_id. However that didnât make any difference. Could you please help in getting this working? I looked at the encounter_provider and provider tables, but couldnât really find good links to get this done myself
If the information is captured as relationships, then the query should pull out data from relationship table which is were the data is recorded into