Esempio n. 1
0
 @RequestMapping(
     value = "/autoComplete",
     method = RequestMethod.GET,
     produces = "application/json")
 public List<PatientDTO> autoComplete(@RequestParam String filter) {
   return patientRepository
       .findByNameStartsWith(filter)
       .stream()
       .map(x -> new PatientDTO(x))
       .collect(Collectors.toList());
 }
Esempio n. 2
0
  @RequestMapping(
      value = "/{mail}/",
      method = RequestMethod.GET,
      produces = MediaType.APPLICATION_JSON_VALUE)
  public List<? extends OpSlotListDTO> getOpSlots(
      @PathVariable("mail") String mail,
      @RequestParam(value = "from", required = false)
          @DateTimeFormat(pattern = Constants.DATETIME_FORMAT_STRING_WITH_TZ)
          Date dateFrom,
      @RequestParam(value = "to", required = false)
          @DateTimeFormat(pattern = Constants.DATETIME_FORMAT_STRING_WITH_TZ)
          Date dateTo,
      HttpServletResponse response) {

    Patient patient = patientRepository.findByEmail(mail);

    if (patient == null) {
      response.setStatus(404);
      return null;
    }

    return opSlotService.getFilteredOpSlots(Patient.class, null, patient, null, dateFrom, dateTo);
  }