@RequestMapping(value = "/{name}", method = RequestMethod.GET) public @ResponseBody ClinicVO getClinc(@PathVariable("name") String name) { try { return clinicService.getClinicByName(name); } catch (ServiceException e) { e.printStackTrace(); } return null; }
@RequestMapping(value = "/all", method = RequestMethod.GET, produces = "application/json") @ResponseBody() public List<ClinicVO> getAll() { try { return clinicService.getAllClinics(); } catch (ServiceException e) { e.printStackTrace(); } return null; }
@RequestMapping(value = "/delete/{id}", method = RequestMethod.PUT) @ResponseBody public String deleteClinic(@PathVariable("id") String clinicId) { try { clinicService.deleteClinic(clinicId); } catch (ServiceException e) { e.printStackTrace(); return "clinic deleted failed"; } return "clinic delete successfully"; }
@RequestMapping( value = "/create", method = RequestMethod.POST, consumes = "application/json", produces = "application/json") @ResponseBody() public Object createEmployee(@RequestBody ClinicVO clinicVO) { // logger.info("Start createEmployee."); try { return clinicService.saveClinic(clinicVO); } catch (Exception e) { if (e instanceof DataIntegrityViolationException) { return "invalid clinic name or clinic already exists"; } else { return e.getMessage(); } } // return null; }