Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: java
jdk: oraclejdk8
jdk: openjdk8

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/ffc/entity/Entity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>()
var tags = mutableSetOf<String>()

@JsonExclude
val bundle: ConcurrentHashMap<String, Any> = ConcurrentHashMap()

Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/ffc/entity/Person.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -44,6 +45,7 @@ class Person(
var chronics = mutableListOf<Chronic>()
var disabilities = mutableListOf<Disability>()
val haveChronic: Boolean get() = chronics.firstOrNull { it.isActive } != null
var behavior: Behavior? = null
var avatarUrl: String? = null
set(url) {
if (url != null) checkValidUrl(url)
Expand Down Expand Up @@ -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 {
Expand Down
29 changes: 29 additions & 0 deletions src/main/kotlin/ffc/entity/healthcare/Behavior.kt
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions src/main/kotlin/ffc/entity/healthcare/HealthCareService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<Diagnosis> = mutableListOf()
var note: String? = null
var photosUrl: URLs = URLs()
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/ffc/entity/PersonTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class PersonTest {
with(copyPerson) {
id `should be` "piruin"
name `should equal` "นายพิรุณ พานิชผล"
age `should be` 25
age `should be` 27
}
}

Expand Down