diff --git a/.travis.yml b/.travis.yml index 189f952..55e03d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: java -jdk: oraclejdk8 +jdk: openjdk8 before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock diff --git a/build.gradle.kts b/build.gradle.kts index 295424a..d7a8d9d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,6 +31,7 @@ repositories { dependencies { implementation(kotlin("stdlib-jdk7")) + // implementation("ca.uhn.hapi.fhir:org.hl7.fhir.r4:5.0.19") implementation("joda-time:joda-time:2.9.9") implementation("com.github.piruin.geok:geok:1.0.0") implementation("com.github.piruin.geok:geok-gson:1.0.0") diff --git a/src/main/kotlin/ffc/entity/Entity.kt b/src/main/kotlin/ffc/entity/Entity.kt index e36bc03..0d598fe 100644 --- a/src/main/kotlin/ffc/entity/Entity.kt +++ b/src/main/kotlin/ffc/entity/Entity.kt @@ -30,6 +30,9 @@ open class Entity(id: String = generateTempId()) : Cloneable { val type = javaClass.simpleName var timestamp: DateTime = DateTime.now() internal set + var allowUserId = mutableSetOf() + var tags = mutableSetOf() + @JsonExclude val bundle: ConcurrentHashMap = ConcurrentHashMap() diff --git a/src/main/kotlin/ffc/entity/Person.kt b/src/main/kotlin/ffc/entity/Person.kt index efc0f99..2f15e49 100644 --- a/src/main/kotlin/ffc/entity/Person.kt +++ b/src/main/kotlin/ffc/entity/Person.kt @@ -17,6 +17,7 @@ package ffc.entity +import ffc.entity.healthcare.Behavior import ffc.entity.healthcare.Chronic import ffc.entity.healthcare.Disability import ffc.entity.healthcare.Disease @@ -44,6 +45,7 @@ class Person( var chronics = mutableListOf() var disabilities = mutableListOf() val haveChronic: Boolean get() = chronics.firstOrNull { it.isActive } != null + var behavior: Behavior? = null var avatarUrl: String? = null set(url) { if (url != null) checkValidUrl(url) @@ -80,6 +82,7 @@ class Person( val relate: Relate, val id: String, val name: String, + @Deprecated("ยกเลิกใช้งาน") val age: Int? = null, val avatarUrl: String? = null ) : Cloneable { diff --git a/src/main/kotlin/ffc/entity/healthcare/Behavior.kt b/src/main/kotlin/ffc/entity/healthcare/Behavior.kt new file mode 100644 index 0000000..9a3532f --- /dev/null +++ b/src/main/kotlin/ffc/entity/healthcare/Behavior.kt @@ -0,0 +1,29 @@ +package ffc.entity.healthcare + +import org.joda.time.DateTime + +data class Behavior( + var smoke: Frequency? = null, + var alcohol: Frequency? = null, + var exercise: Frequency? = null, + var bigaccidentever: Boolean? = null, + var tonic: Boolean? = null, + var habitfoming: Boolean? = null, + var drugbyyourseft: Boolean? = null, + var sugar: Boolean? = null, + var salt: Boolean? = null +) { + var timestamp: DateTime = DateTime.now() + internal set +} + +fun Behavior.update( + timestamp: DateTime = DateTime.now(), + block: Behavior.() -> Unit +): Behavior { + with(this) { + this.timestamp = timestamp + apply(block) + } + return this +} diff --git a/src/main/kotlin/ffc/entity/healthcare/HealthCareService.kt b/src/main/kotlin/ffc/entity/healthcare/HealthCareService.kt index 2d637b7..883f781 100644 --- a/src/main/kotlin/ffc/entity/healthcare/HealthCareService.kt +++ b/src/main/kotlin/ffc/entity/healthcare/HealthCareService.kt @@ -44,6 +44,7 @@ open class HealthCareService( var pulseRate: Double? = null var respiratoryRate: Double? = null var bodyTemperature: Double? = null + var sugarLab: Double? = null var diagnosises: MutableList = mutableListOf() var note: String? = null var photosUrl: URLs = URLs() diff --git a/src/test/kotlin/ffc/entity/PersonTest.kt b/src/test/kotlin/ffc/entity/PersonTest.kt index 57cfa8e..e328afe 100644 --- a/src/test/kotlin/ffc/entity/PersonTest.kt +++ b/src/test/kotlin/ffc/entity/PersonTest.kt @@ -118,7 +118,7 @@ class PersonTest { with(copyPerson) { id `should be` "piruin" name `should equal` "นายพิรุณ พานิชผล" - age `should be` 25 + age `should be` 27 } }