Encounters have a patient property which is mapped to the patient_id column, but also a separate patientId property mapped to the same column. The patientId property doesn't get updated when patient is updated, which can lead to consistency problems, and breaks methods like EncounterService.getAllEncounters(Cohort)
The patientId field should be deprecated and eventually removed. Hibernate HQL queries which use this property can use patient.personId instead.
We could also as a temporary measure update patientId in setPatient to keep them more consistent.
- Deprecate the getters/setters for patientId and removed it from Encounters.hbm.xml