generated from SmartOperatingBlock/kotlin-template-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: create dto for surgery report event
- Loading branch information
1 parent
3b0de8d
commit 8c9593d
Showing
2 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/kotlin/application/presenter/event/serialization/SurgeryReportDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2023. Smart Operating Block | ||
* | ||
* Use of this source code is governed by an MIT-style | ||
* license that can be found in the LICENSE file or at | ||
* https://opensource.org/licenses/MIT. | ||
*/ | ||
|
||
package application.presenter.event.serialization | ||
|
||
import entity.medicaldevice.ImplantableMedicalDevice | ||
import entity.medicaldevice.MedicalTechnology | ||
import entity.patient.PatientData | ||
import entity.process.ProcessData | ||
import entity.report.SurgeryReport | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* The DTO of th Report of the Surgical Process. | ||
* It includes: | ||
* - the [processId] | ||
* - the [processType] | ||
* - the [patientId] | ||
* - the [patientTaxCode] | ||
* - the [healthProfessionalId] | ||
* - the [preOperatingRoomId] | ||
* - the [operatingRoomId] | ||
* - the [processStates] | ||
* - the [processSteps] | ||
* - the [patientMedicalData] | ||
* - the [medicalDeviceUsage] | ||
* - the [medicalTechnologyUsage] | ||
*/ | ||
@Serializable | ||
data class SurgeryReportDto( | ||
val processId: String, | ||
val processType: String, | ||
val patientId: String, | ||
val patientTaxCode: String, | ||
val healthProfessionalId: String, | ||
val preOperatingRoomId: String, | ||
val operatingRoomId: String, | ||
val processStates: List<Pair<String, ProcessData.ProcessState>>, | ||
val processSteps: List<Pair<String, ProcessData.ProcessStep>>, | ||
val patientMedicalData: List<Pair<String, PatientData.MedicalData>>, | ||
val medicalDeviceUsage: List<ImplantableMedicalDevice>, | ||
val medicalTechnologyUsage: List<Pair<String, MedicalTechnology>>, | ||
) | ||
|
||
/** | ||
* Extension function to convert a [SurgeryReport] to its [SurgeryReportDto]. | ||
*/ | ||
fun SurgeryReport.toSurgeryReportDto() = | ||
SurgeryReportDto( | ||
this.processId.id, | ||
this.processType, | ||
this.patientId.id, | ||
this.patientTaxCode?.code ?: "null", | ||
this.healthProfessionalId?.id ?: "null", | ||
this.preOperatingRoom?.id?.id ?: "null", | ||
this.operatingRoom?.id?.id ?: "null", | ||
this.processStates.map { Pair(it.first.toString(), it.second) }, | ||
this.processSteps.map { Pair(it.first.toString(), it.second) }, | ||
this.patientMedicalData.map { Pair(it.first.toString(), it.second) }, | ||
this.medicalDeviceUsage, | ||
this.medicalTechnologyUsage.map { Pair(it.first.toString(), it.second) }, | ||
|
||
) |