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.
feat: add medical devices application services
- Loading branch information
1 parent
e11cf91
commit c8840d5
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
src/main/kotlin/application/service/MedicalDeviceServices.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,62 @@ | ||
/* | ||
* 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.service | ||
|
||
import entity.medicaldevice.MedicalDeviceData | ||
import entity.process.ProcessData | ||
import entity.process.SurgicalProcess | ||
import usecase.repository.MedicalDeviceRepository | ||
import java.time.Instant | ||
|
||
/** | ||
* Module that wraps all the application services of medical devices. | ||
*/ | ||
object MedicalDeviceServices { | ||
|
||
/** | ||
* The [ApplicationService] to add the usage of a medical device. | ||
*/ | ||
class AddMedicalDeviceUsage( | ||
private val medicalDeviceId: MedicalDeviceData.ImplantableMedicalDeviceId, | ||
private val processId: ProcessData.ProcessId, | ||
private val medicalDeviceRepository: MedicalDeviceRepository | ||
) : ApplicationService<Boolean> { | ||
override fun execute(): Boolean = this.medicalDeviceRepository.addMedicalDeviceUsage(medicalDeviceId, processId) | ||
} | ||
|
||
/** | ||
* The [ApplicationService] to add the usage of a medical technology. | ||
*/ | ||
class AddMedicalTechnologyUsage( | ||
private val medicalTechnologyId: MedicalDeviceData.MedicalTechnologyId, | ||
private val processId: ProcessData.ProcessId, | ||
private val dateTime: Instant, | ||
private val inUse: Boolean, | ||
private val medicalDeviceRepository: MedicalDeviceRepository | ||
) : ApplicationService<Boolean> { | ||
override fun execute(): Boolean = this.medicalDeviceRepository.addMedicalTechnologyUsage( | ||
medicalTechnologyId, | ||
processId, | ||
dateTime, | ||
inUse | ||
) | ||
} | ||
|
||
/** | ||
* The [ApplicationService] to find a surgical process by a medical technology. | ||
*/ | ||
class FindProcessByMedicalTechnology( | ||
private val medicalTechnologyId: MedicalDeviceData.MedicalTechnologyId, | ||
private val medicalDeviceRepository: MedicalDeviceRepository | ||
) : ApplicationService<SurgicalProcess?> { | ||
|
||
override fun execute(): SurgicalProcess? = | ||
this.medicalDeviceRepository.findSurgicalProcessByMedicalTechnology(medicalTechnologyId) | ||
} | ||
} |