| [700e2f9] | 1 | package com.finki.icare.mapper;
|
|---|
| 2 |
|
|---|
| 3 | import com.finki.icare.dto.ConsultationDTO;
|
|---|
| 4 | import com.finki.icare.model.Consultation;
|
|---|
| 5 | import org.mapstruct.Mapper;
|
|---|
| 6 | import org.mapstruct.Mapping;
|
|---|
| 7 | import org.mapstruct.MappingConstants;
|
|---|
| 8 |
|
|---|
| 9 | @Mapper(componentModel = MappingConstants.ComponentModel.SPRING, uses = {TherapyMapper.class})
|
|---|
| 10 | public interface ConsultationMapper {
|
|---|
| 11 |
|
|---|
| 12 | @Mapping(target = "idConsultation", source = "idConsultation")
|
|---|
| 13 | @Mapping(target = "patientId", source = "patient.idUser")
|
|---|
| 14 | @Mapping(target = "patientName", expression = "java(consultation.getPatient().getName() + \" \" + consultation.getPatient().getSurname())")
|
|---|
| 15 | @Mapping(target = "therapistId", source = "therapist.idUser")
|
|---|
| 16 | @Mapping(target = "therapistName", expression = "java(consultation.getTherapist().getName() + \" \" + consultation.getTherapist().getSurname())")
|
|---|
| 17 | @Mapping(target = "date", source = "date")
|
|---|
| 18 | @Mapping(target = "dateOfPayment", source = "dateOfPayment")
|
|---|
| 19 | @Mapping(target = "price", source = "price")
|
|---|
| 20 | @Mapping(target = "advice", source = "advice")
|
|---|
| 21 | @Mapping(target = "therapies", source = "therapies")
|
|---|
| 22 | ConsultationDTO toDTO(Consultation consultation);
|
|---|
| 23 | }
|
|---|