Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RESTWS-658:Person web service should allow you to check if the person has a Patient record #438

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import io.swagger.models.properties.IntegerProperty;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;

import org.openmrs.Patient;
import org.openmrs.Person;
import org.openmrs.PersonAddress;
import org.openmrs.PersonAttribute;
Expand Down Expand Up @@ -564,4 +566,18 @@ public SimpleObject getAuditInfo(Person person) throws Exception {
ret.put("dateCreated", ConversionUtil.convertToRepresentation(person.getPersonDateCreated(), Representation.DEFAULT));
return ret;
}
/**
* Adds the link to related {@link Patient} resource to this {@link Person} if its a patient
*
*
*
*/
private DelegatingResourceDescription ifPatientAddLink(DelegatingResourceDescription description,Person person) {
if (person != null && person.isPatient()) {
Patient patient = Context.getPatientService().getPatient(person.getId());
String uri = "/" + RestConstants.VERSION_1 + "/patient/" + patient.getUuid();
description.addLink("patient", uri);
}
return description;
}
}