This is caused by the patient having a duplicated medical institution in the database
Steps to fix the duplicated medical institution
Select * from patientmedinst where patientid = xxx
From the next option there are 2 or more entries you need to look in Orginisers find the ID number of the instution
you want to keep and then delete the other.
Delete from Patientmedinst where patientmedinstid = XXXX
NOTE: Copy database first.
Here’s a query to find all duplications
SELECT Count(*) As Total, PatientID FROM PatientMedinst Group By PatientID Having Count(*) > 1