| 1 | package com.finki.icare.model;
|
|---|
| 2 |
|
|---|
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
|---|
| 4 | import jakarta.persistence.*;
|
|---|
| 5 | import lombok.AllArgsConstructor;
|
|---|
| 6 | import lombok.Data;
|
|---|
| 7 | import lombok.NoArgsConstructor;
|
|---|
| 8 |
|
|---|
| 9 | import java.math.BigDecimal;
|
|---|
| 10 | import java.time.LocalDate;
|
|---|
| 11 | import java.util.List;
|
|---|
| 12 |
|
|---|
| 13 | @Entity
|
|---|
| 14 | @Table(name = "consultation")
|
|---|
| 15 | @Data
|
|---|
| 16 | @NoArgsConstructor
|
|---|
| 17 | @AllArgsConstructor
|
|---|
| 18 | public class Consultation {
|
|---|
| 19 |
|
|---|
| 20 | @Id
|
|---|
| 21 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
|---|
| 22 | @Column(name = "id_consultation")
|
|---|
| 23 | private Integer idConsultation;
|
|---|
| 24 |
|
|---|
| 25 | @ManyToOne
|
|---|
| 26 | @JoinColumn(name = "id_patient", nullable = false)
|
|---|
| 27 | private Patient patient;
|
|---|
| 28 |
|
|---|
| 29 | @ManyToOne
|
|---|
| 30 | @JoinColumn(name = "id_therapist", nullable = false)
|
|---|
| 31 | private Therapist therapist;
|
|---|
| 32 |
|
|---|
| 33 | @Column(name = "date", nullable = false)
|
|---|
| 34 | private LocalDate date;
|
|---|
| 35 |
|
|---|
| 36 | @Column(name = "date_of_payment")
|
|---|
| 37 | private LocalDate dateOfPayment;
|
|---|
| 38 |
|
|---|
| 39 | @Column(name = "price", nullable = false, precision = 10, scale = 2)
|
|---|
| 40 | private BigDecimal price;
|
|---|
| 41 |
|
|---|
| 42 | @Column(name = "advice", columnDefinition = "TEXT")
|
|---|
| 43 | private String advice;
|
|---|
| 44 |
|
|---|
| 45 | @JsonIgnore
|
|---|
| 46 | @OneToMany(mappedBy = "consultation", cascade = CascadeType.ALL, orphanRemoval = true)
|
|---|
| 47 | private List<Therapy> therapies;
|
|---|
| 48 | }
|
|---|