...
In this example, we call the DWREncounterService.findCountAndEncounters(String, boolean, Integer, Integer, boolean) method and below is how it would look like the code snippet belowcould like like:
Code Block |
---|
public Map<String, Object> findCountAndEncounters(String phrase, boolean includeVoided, Integer start, Integer length, boolean getMatchCount) throws APIException { //Map to return Map<String, Object> resultsMap = new HashMap<String, Object>(); Vector<Object> objectList = new Vector<Object>(); try { EncounterService es = Context.getEncounterService(); int encounterCount = 0; if (getMatchCount) encounterCount += es.getCountOfEncounters(phrase, includeVoided); //If we have any matches, fetch them or if this is not the first ajax call //for displaying the results on the first page, the getMatchCount is expected to be zero if (encounterCount > 0 || !getMatchCount) objectList = findBatchOfEncounters(phrase, includeVoided, start, length); resultsMap.put("count", encounterCount); resultsMap.put("objectList", objectList); } catch (Exception e) { objectList.clear(); objectList.add("Error while searching for encounters"); resultsMap.put("count", 0); resultsMap.put("objectList", objectList); } return resultsMap; } |
...