Script for identifying duplicate Registration Numbers
From release 1.3, we have added a check for uniquely identifying the reg num of a treatment, when a user enters a duplicate reg num the system throws an error.
Prior to 1.3 if there are any patients which have the same reg num, they can be identified using the below query
SELECT ppa.value_reference AS 'Duplicate Identifiers' from patient_program_attribute ppa INNER JOIN program_attribute_type pat ON pat.name = 'Registration Number' AND pat.program_attribute_type_id = ppa.attribute_type_id GROUP BY ppa.value_reference HAVING count(*) >= 2;
If any treatments are returned in this query, then one must change the reg num of the treatment in a way that it should be unique to be able to see this treatment on the "Patient Records" page.
Please look at the sample query below to do that
Sample query
update patient_program_attribute set value_reference = '<unique_reg_num>' where patient_program_id ='<existing patient program id>';
The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)