Пример #1
0
 /**
  * REST service for deleting a patient.
  *
  * @param patientId the patient id
  */
 @Path("deletePatient")
 @DELETE
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)
 public void deletePatient(@QueryParam(value = "patientId") long patientId) {
   patientService.remove(patientId);
 }
Пример #2
0
  /**
   * REST service for getting an patient with a specified id.
   *
   * @param patientId the specified patient id
   * @return the patient with the specified id.
   */
  @GET
  @Path("getPatient/{patientId}")
  @Produces(MediaType.APPLICATION_JSON)
  public Patient getPatientById(@PathParam(value = "patientId") long patientId) {
    Patient patient = patientService.findById(patientId);

    return patient;
  }
Пример #3
0
  /**
   * REST service for getting all patients.
   *
   * @return list with all patients.
   */
  @GET
  @Path("getPatients")
  @Produces(MediaType.APPLICATION_JSON)
  public List<Patient> getAllPatients() {
    List<Patient> patientsList = patientService.findAll();

    return patientsList;
  }
Пример #4
0
  /**
   * REST service for creating a patient.
   *
   * @param patient patient to be created.
   * @return created patient.
   */
  @Path("updatePatient")
  @POST
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  public Patient updatePatient(Patient patient) {
    Patient updated = patientService.update(patient);

    return updated;
  }
Пример #5
0
  /**
   * REST service for creating a patient.
   *
   * @param patient patient to be created.
   * @return created patient.
   */
  @Path("createPatient")
  @PUT
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  public Patient createPatient(Patient patient) {
    Patient persisted = patientService.create(patient);

    return persisted;
  }