}
@RequestMapping(value = "gethealthposts", method = RequestMethod.GET)
public @ResponseBody CustomHealthPostResponse fetchHealthPosts(@RequestParam("centerId") int centerId,
@RequestParam("rows") int rows, @RequestParam("page") int page) {
CustomHealthPostResponse response = new CustomHealthPostResponse();
//HealthCenter healthCenter = healthCenterService.findById(centerId);
StringBuilder sb = new StringBuilder();
List<HealthPost> healthPosts = healthPostService.getHealthPostsForCenter(centerId, rows, page, sb);
List<HealthPostDTO> hps = new ArrayList<HealthPostDTO>();
for (HealthPost hp : healthPosts) {
HealthPostDTO healthPost = new HealthPostDTO();
healthPost.setPostId(hp.getPostId());
healthPost.setPostName(hp.getPostName());
healthPost.setKebele(hp.getKebele());
healthPost.setCenterId(centerId);
hps.add(healthPost);
}
response.setPage(String.valueOf(page));
response.setRows(hps);
response.setTotal(sb.toString());
response.setRecords(String.valueOf(hps.size()));
return response;
}