/** POST /evolutionPrescriptions -> Create a new evolutionPrescription. */
 @RequestMapping(
     value = "/episodes/{episode_id}/evolutionPrescriptions",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<EvolutionPrescription> createByEpisode(
     @PathVariable(value = "episode_id") Long episodeId,
     @RequestBody EvolutionPrescription evolutionPrescription)
     throws URISyntaxException {
   log.debug("REST request to save EvolutionPrescription : {}", evolutionPrescription);
   if (evolutionPrescription.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new evolutionPrescription cannot already have an ID")
         .body(null);
   }
   Episode episode = new Episode();
   episode.setId(episodeId);
   evolutionPrescription.setEpisode(episode);
   EvolutionPrescription result = evolutionPrescriptionRepository.save(evolutionPrescription);
   return ResponseEntity.created(
           new URI("/api/episodes/" + episodeId + "/evolutionPrescriptions/" + result.getId()))
       .headers(
           HeaderUtil.createEntityCreationAlert(
               "evolutionPrescription", result.getId().toString()))
       .body(result);
 }
Ejemplo n.º 2
0
 /** POST /clinicHistorys -> Create a new clinicHistory. */
 @RequestMapping(
     value = "/clinicHistorys",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<ClinicHistory> create(@RequestBody ClinicHistory clinicHistory)
     throws URISyntaxException {
   log.debug("REST request to save ClinicHistory : {}", clinicHistory);
   if (clinicHistory.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new clinicHistory cannot already have an ID")
         .body(null);
   }
   ClinicHistory result = clinicHistoryRepository.save(clinicHistory);
   return ResponseEntity.created(new URI("/api/clinicHistorys/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("clinicHistory", result.getId().toString()))
       .body(result);
 }