-
Notifications
You must be signed in to change notification settings - Fork 143
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
EA-190 Improve API for retrieving inpatient visits #235
Conversation
@Override | ||
@Transactional(readOnly = true) | ||
public List<InpatientAdmission> getInpatientAdmissions(InpatientAdmissionSearchCriteria criteria) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This basically gets all ADT encounters associated with any active visit, and then groups these by visit into an InpatientAdmission object.
* Represents a hospital Admission | ||
*/ | ||
@Data | ||
public class InpatientAdmission { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provides a mechanism to retrieve InpatientAdmission data and to expose various properties and utility getter methods via standard REST representations.
public DelegatingResourceDescription getResourceDescription(InpatientAdmission req, Representation representation) { | ||
DelegatingResourceDescription ret = super.getResourceDescription(req, representation); | ||
if (representation instanceof DefaultRepresentation) { | ||
DelegatingResourceDescription rep = new DelegatingResourceDescription(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit unconventional, but I went with this to focus on the data that is most relevant to the current use cases. Specifically, this will enable getting timeSinceAdmissionInMinutes
dynamically via firstAdmissionOrTransferEncounter.encounterDatetime
and will enable getting timeAtInpatientLocationInMinutes
dynamically via encounterAssigningToCurrentInpatientLocation.encounterDatetime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Are we excluding the patient because a decent rep of the patient is included in the default rep of the visit?
@@ -18,6 +18,7 @@ | |||
|
|||
@Controller | |||
@RequestMapping(value = "/rest/**/emrapi/inpatient") | |||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have deprecated this for now, but would like to remove this controller altogether once we can get the ward app converted to the new endpoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @mseaton ! added a couple comments but looks great to me, thanks for getting this out so quickly.
public DelegatingResourceDescription getResourceDescription(InpatientAdmission req, Representation representation) { | ||
DelegatingResourceDescription ret = super.getResourceDescription(req, representation); | ||
if (representation instanceof DefaultRepresentation) { | ||
DelegatingResourceDescription rep = new DelegatingResourceDescription(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Are we excluding the patient because a decent rep of the patient is included in the default rep of the visit?
@@ -18,6 +18,7 @@ | |||
|
|||
@Controller | |||
@RequestMapping(value = "/rest/**/emrapi/inpatient") | |||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me
See https://openmrs.atlassian.net/browse/EA-190
This adds a new service method and Java components to facilitate finding and retrieving information about inpatient admissions, and exposes this RESTfully.