Ejemplo n.º 1
0
  /**
   * GET /clinicHistorys -> get all the clinicHistorys.
   *
   * @throws URISyntaxException
   */
  @RequestMapping(
      value = "/clinicHistorys",
      method = RequestMethod.GET,
      produces = MediaType.APPLICATION_JSON_VALUE)
  @Timed
  public ResponseEntity<List<ClinicHistory>> getAllByFilter(
      @RequestParam(value = "page", required = false) Integer offset,
      @RequestParam(value = "per_page", required = false) Integer limit,
      @RequestParam(value = "firstName", required = false) String firstName,
      @RequestParam(value = "secondName", required = false) String secondName,
      @RequestParam(value = "paternalSurname", required = false) String paternalSurname,
      @RequestParam(value = "maternalSurname", required = false) String maternalSurname,
      @RequestParam(value = "cedula", required = false) String cedula)
      throws URISyntaxException {
    log.debug("REST request to get all ClinicHistorys");
    firstName = firstName == null ? "%" : "%" + firstName + "%";
    secondName = secondName == null ? "%" : "%" + secondName + "%";
    paternalSurname = paternalSurname == null ? "%" : "%" + paternalSurname + "%";
    maternalSurname = maternalSurname == null ? "%" : "%" + maternalSurname + "%";
    cedula = cedula == null ? "%" : cedula + "%";

    Page<ClinicHistory> page =
        clinicHistoryRepository.findByFilter(
            firstName,
            secondName,
            paternalSurname,
            maternalSurname,
            cedula,
            PaginationUtil.generatePageRequest(offset, limit));
    HttpHeaders headers =
        PaginationUtil.generatePaginationHttpHeaders(page, "/api/clinicHistorys", offset, limit);
    return new ResponseEntity<List<ClinicHistory>>(page.getContent(), headers, HttpStatus.OK);
  }
  /** GET /evolutionPrescriptions -> get all the evolutionPrescriptions. */
  @RequestMapping(
      value = "/episodes/{episode_id}/evolutionPrescriptions",
      method = RequestMethod.GET,
      produces = MediaType.APPLICATION_JSON_VALUE)
  @Timed
  public ResponseEntity<List<EvolutionPrescription>> getAllByEpisode(
      @PathVariable(value = "episode_id") Long episodeId,
      @RequestParam(value = "page", required = false) Integer offset,
      @RequestParam(value = "per_page", required = false) Integer limit)
      throws URISyntaxException {
    Page<EvolutionPrescription> page;

    if (episodeId != null && episodeId > 0) {
      page =
          evolutionPrescriptionRepository.findByEpisode(
              episodeId, PaginationUtil.generatePageRequest(offset, limit));
    } else {
      page =
          evolutionPrescriptionRepository.findAll(
              PaginationUtil.generatePageRequest(offset, limit));
    }
    HttpHeaders headers =
        PaginationUtil.generatePaginationHttpHeaders(
            page, "/api/episodes/" + episodeId + "/evolutionPrescriptions", offset, limit);
    return new ResponseEntity<List<EvolutionPrescription>>(
        page.getContent(), headers, HttpStatus.OK);
  }
 /** GET /evolutionPrescriptions -> get all the evolutionPrescriptions. */
 @RequestMapping(
     value = "/evolutionPrescriptions",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<List<EvolutionPrescription>> getAll(
     @RequestParam(value = "page", required = false) Integer offset,
     @RequestParam(value = "per_page", required = false) Integer limit)
     throws URISyntaxException {
   Page<EvolutionPrescription> page;
   page =
       evolutionPrescriptionRepository.findAll(PaginationUtil.generatePageRequest(offset, limit));
   HttpHeaders headers =
       PaginationUtil.generatePaginationHttpHeaders(
           page, "/api/evolutionPrescriptions", offset, limit);
   return new ResponseEntity<List<EvolutionPrescription>>(
       page.getContent(), headers, HttpStatus.OK);
 }