|
8 | 8 |
|
9 | 9 | package application.presenter.api.report |
10 | 10 |
|
11 | | -import entity.surgeryreport.PatientInfo |
12 | | -import entity.surgeryreport.ProcessDate |
| 11 | +import entity.surgeryreport.PatientId |
| 12 | +import entity.surgeryreport.PatientName |
| 13 | +import entity.surgeryreport.PatientSurname |
13 | 14 | import entity.surgeryreport.ProcessId |
14 | | -import entity.surgeryreport.ProcessType |
| 15 | +import entity.surgeryreport.SurgeryDate |
15 | 16 | import entity.surgeryreport.SurgeryReportEntry |
16 | | -import kotlinx.serialization.Contextual |
| 17 | +import entity.surgeryreport.SurgicalProcessDescription |
17 | 18 | import kotlinx.serialization.Serializable |
18 | 19 | import java.time.Instant |
19 | 20 |
|
20 | 21 | /** |
21 | 22 | * Class that model the principal information of a surgery report in the surgery report archive. |
22 | | - * @param processId the id of the surgery process. |
23 | | - * @param patientInfo the name and the surname of the patient. |
24 | | - * @param processType the type of the surgery. |
25 | | - * @param processDate the date of the surgery. |
| 23 | + * @param surgicalProcessID the id of the surgical process. |
| 24 | + * @param patientId the id of the patient. |
| 25 | + * @param patientName the name of the patient. |
| 26 | + * @param patientSurname the surname of the patient. |
| 27 | + * @param surgicalProcessDescription the description of the surgical process. |
| 28 | + * @param surgeryDate the date of the surgical process. |
26 | 29 | */ |
27 | 30 | @Serializable |
28 | 31 | data class SurgeryReportEntryDto( |
29 | | - val processId: String, |
30 | | - val patientInfo: String, |
31 | | - val processType: String, |
32 | | - @Contextual val processDate: Instant, |
| 32 | + val surgicalProcessID: String, |
| 33 | + val patientId: String, |
| 34 | + val patientName: String?, |
| 35 | + val patientSurname: String?, |
| 36 | + val surgicalProcessDescription: String, |
| 37 | + val surgeryDate: String, |
33 | 38 | ) |
34 | 39 |
|
35 | 40 | /** |
36 | 41 | * Extension function to convert a SurgeryReportEntryDto into a SurgeryReportEntry. |
37 | 42 | */ |
38 | 43 | fun SurgeryReportEntryDto.toSurgeryReportEntry(): SurgeryReportEntry = |
39 | 44 | SurgeryReportEntry( |
40 | | - ProcessId(this.processId), |
41 | | - PatientInfo(this.patientInfo), |
42 | | - ProcessType(this.processType), |
43 | | - ProcessDate(this.processDate), |
| 45 | + ProcessId(this.surgicalProcessID), |
| 46 | + PatientId(this.patientId), |
| 47 | + this.patientName?.let { PatientName(it) }, |
| 48 | + this.patientSurname?.let { PatientSurname(it) }, |
| 49 | + SurgicalProcessDescription(this.surgicalProcessDescription), |
| 50 | + SurgeryDate(Instant.parse(this.surgeryDate)), |
44 | 51 | ) |
45 | 52 |
|
46 | 53 | /** |
47 | 54 | * Extension function to convert a SurgeryReportEntry into a SurgeryReportEntryDto. |
48 | 55 | */ |
49 | 56 | fun SurgeryReportEntry.toSurgeryReportEntryDto(): SurgeryReportEntryDto = |
50 | 57 | SurgeryReportEntryDto( |
51 | | - this.processId.id, |
52 | | - this.patientInfo.patientInfo, |
53 | | - this.processType.processType, |
54 | | - this.processDate.processDate, |
| 58 | + this.surgicalProcessID.id, |
| 59 | + this.patientId.id, |
| 60 | + this.patientName?.patientName, |
| 61 | + this.patientSurname?.surname, |
| 62 | + this.surgicalProcessDescription.description, |
| 63 | + this.surgeryDate.date.toString(), |
55 | 64 | ) |
0 commit comments