private void mergePersonAttributes(Patient preferred, Patient notPreferred, PersonMergeLogData mergedData) { // copy person attributes for (PersonAttribute attr : notPreferred.getAttributes()) { if (!attr.getVoided()) { PersonAttribute tmpAttr = attr.copy(); tmpAttr.setPerson(null); tmpAttr.setUuid(UUID.randomUUID().toString()); preferred.addAttribute(tmpAttr); mergedData.addCreatedAttribute(tmpAttr.getUuid()); } } }
patient.addAttribute(newHealthCenter);
personAttribute.setAttributeType(attributeType); personAttribute.setValue(attributes.get(attribute)); patient.addAttribute(personAttribute); patientService.savePatient(patient);
tmpAttr.setPerson(null); tmpAttr.setUuid(UUID.randomUUID().toString()); preferred.addAttribute(tmpAttr); mergedData.addCreatedAttribute(tmpAttr.getUuid());
attribute.setValue("5089"); attribute.setAttributeType(personService.getPersonAttributeType(1)); notPreferred.addAttribute(attribute); patientService.savePatient(notPreferred);
private void setPersonAttributes(MRSPatient patient, Patient openMRSPatient, List<PersonAttributeType> allPersonAttributeTypes) { MRSPerson mrsPerson = patient.getPerson(); if (CollectionUtils.isNotEmpty(mrsPerson.getAttributes())) { for (MRSAttribute attribute : mrsPerson.getAttributes()) { PersonAttributeType attributeType = (PersonAttributeType) selectUnique(allPersonAttributeTypes, having(on(PersonAttributeType.class).getName(), equalTo(attribute.getName()))); openMRSPatient.addAttribute(new PersonAttribute(attributeType, attribute.getValue())); } } } }
demo.addAttribute(new PersonAttribute(type, "Test " + type.getName() + " Attribute"));
openMrsPatient.removeAttribute(personAttribute); openMrsPatient.addAttribute(new PersonAttribute(personService.getPersonAttributeTypeByName(attribute.getName()), attribute.getValue()));