Пример #1
0
 @Override
 public IPatient createNewPatient(IPatient patient) {
   Origin patientOrigin = (Origin) originService.getOriginById(patient.getOriginId());
   Patient newPatient =
       PatientBuilder.builder()
           .name(patient.getName())
           .surname(patient.getSurname())
           .birthday(patient.getBirthday())
           .phone(patient.getPhone())
           .email(patient.getEmail())
           .origin(patientOrigin)
           .build();
   return patientDao.save(newPatient);
 }
Пример #2
0
 private Patient getPatient(final Long id) {
   return patientDao.get(id);
 }
Пример #3
0
 @Override
 public IPatient updatePatient(final Long id, IPatient patient) {
   Patient patientToUpdate = this.getPatient(id);
   BeanUtils.copyProperties(patient, patientToUpdate, "id");
   return patientDao.save(patientToUpdate);
 }