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.
- Loading branch information
1 parent
91ed793
commit 464f585
Showing
1 changed file
with
97 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* 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 entity.patient | ||
|
||
/** Module with all necessary data for [Patient]. */ | ||
object PatientData { | ||
|
||
/** The [id] of the [Patient]. */ | ||
data class PatientId(val id: String) { | ||
init { | ||
require(this.id.isNotEmpty()) { | ||
"Patient id code can not be empty!" | ||
} | ||
} | ||
} | ||
|
||
/** The [bpm] of the [Patient]. */ | ||
data class HeartBeat(val bpm: Int) { | ||
init { | ||
require(this.bpm >= 0) { | ||
"Beat per minute cannot be negative" | ||
} | ||
} | ||
} | ||
|
||
/** The Diastolic blood [pressure] of the [Patient]. */ | ||
data class DiastolicBloodPressure(val pressure: Int) { | ||
init { | ||
require(this.pressure >= 0) { | ||
"Diastolic blood pressure cannot be negative" | ||
} | ||
} | ||
} | ||
|
||
/** The Systolic blood [pressure] of the [Patient]. */ | ||
data class SystolicBloodPressure(val pressure: Int) { | ||
init { | ||
require(this.pressure >= 0) { | ||
"Systolic blood pressure cannot be negative" | ||
} | ||
} | ||
} | ||
|
||
/** The Respiratory [rate] of the [Patient]. */ | ||
data class RespiratoryRate(val rate: Int) { | ||
init { | ||
require(this.rate >= 0) { | ||
"Respiratory rate cannot be negative" | ||
} | ||
} | ||
} | ||
|
||
/** The Saturation [percentage] of the [Patient]. */ | ||
data class SaturationPercentage(val percentage: Int) { | ||
init { | ||
require(this.percentage >= 0) { | ||
"Saturation percentage cannot be negative" | ||
} | ||
} | ||
} | ||
|
||
/** The [degree] of body temperature of the [Patient] with the specific temperature [unit]. */ | ||
data class BodyTemperature(val degree: Double, val unit: TemperatureUnit = TemperatureUnit.CELSIUS) { | ||
init { | ||
require(this.degree >= 0) { | ||
"Body temperature cannot be negative" | ||
} | ||
} | ||
} | ||
|
||
/** The Temperature Unit. */ | ||
enum class TemperatureUnit { | ||
CELSIUS | ||
} | ||
|
||
/** Wrap all the medical data of the [Patient] such as: | ||
* the [heartBeat], | ||
* the [diastolicBloodPressure], | ||
* the [systolicBloodPressure], | ||
* the [respiratoryRate], | ||
* the [saturationPercentage], | ||
* the [bodyTemperature]. */ | ||
data class MedicalData( | ||
val heartBeat: HeartBeat? = null, | ||
val diastolicBloodPressure: DiastolicBloodPressure? = null, | ||
val systolicBloodPressure: SystolicBloodPressure? = null, | ||
val respiratoryRate: RespiratoryRate? = null, | ||
val saturationPercentage: SaturationPercentage? = null, | ||
val bodyTemperature: BodyTemperature? = null | ||
) | ||
} |