sba370
(shashi a)
August 25, 2015, 5:42am
1
Platform Version: 1.11.2
OpenMRS Version: 2.2
How can I check for - if a patient is having active visit or not in my .gsp page using java script.
Is there any documentation explaining about how to go about on this or any other example/ link. Please help
raff
(Rafal Korytkowski)
August 25, 2015, 12:19pm
2
You could get that info via REST calling http://demo.openmrs.org/openmrs/ws/rest/v1/visit?patient=94fd268e-9b39-4b30-b150-4c777f077ae8&includeInactive=false
if you use AngularJS then we have a dedicated service for getting visits. See:
angular.module('visitService', ['ngResource', 'uicommons.common'])
.factory('Visit', function($resource) {
return $resource("/" + OPENMRS_CONTEXT_PATH + "/ws/rest/v1/visit/:uuid", {
uuid: '@uuid'
},{
query: { method:'GET', isArray:false } // OpenMRS RESTWS returns { "results": [] }
});
})
.factory('VisitService', function(Visit, $resource) {
return {
/**
* Fetches Visits
*
* @param params to search against
* @returns $promise of array of matching Visits (REST ref representation by default)
*/
getVisits: function(params) {
return Visit.query(params).$promise.then(function(res) {
This file has been truncated. show original
sba370
(shashi a)
August 27, 2015, 5:41am
3
Thank you Rafal for the pointer. It will surely help.