Skip to content
Draft
Show file tree
Hide file tree
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 @@ -41,6 +41,7 @@
import org.openmrs.module.webservices.rest.web.response.ResponseException;
import org.openmrs.module.webservices.validation.ValidateUtil;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
Expand Down Expand Up @@ -137,6 +138,11 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
description.addProperty("person", Representation.FULL);
description.addProperty("voided");
description.addProperty("auditInfo");
try {
description.addProperty("fhir", this.getClass().getMethod("toFhirResource", Patient.class));
} catch(ReflectiveOperationException e) {
log.warn(">>>> reflection failed", e);
}
description.addSelfLink();
return description;
}
Expand Down Expand Up @@ -366,5 +372,5 @@ public Patient getPatientForUpdate(String uuid, Map<String, Object> propertiesTo
personResource.getUpdatableProperties(), false);
return patient;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9;

import java.lang.reflect.Method;
import java.util.List;

import org.openmrs.Patient;
Expand Down Expand Up @@ -40,4 +41,11 @@ public void delete(Patient patient, String reason, RequestContext context) throw
super.delete(patient, reason, context);
}

public Object toFhirResource(Patient patient) throws ReflectiveOperationException {
Class translatorClass = Context.loadClass("org.openmrs.module.fhir2.api.translators.impl.PatientTranslatorImpl");
Method m = translatorClass.getDeclaredMethod("toFhirResource", Patient.class);
Object translator = translatorClass.newInstance();
m.setAccessible(true);
return m.invoke(translator, patient);
}
}
Loading