Added Device Data and HemoCube Schema
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package com.example.hpostesting.data.dao
|
package com.example.hpostesting.data.dao
|
||||||
|
|
||||||
import androidx.room.TypeConverter
|
import androidx.room.TypeConverter
|
||||||
import com.example.hpostesting.data.model.patient.HemoCubeTestData
|
|
||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
|
|
||||||
@@ -25,23 +24,23 @@ class Converters {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TypeConverter
|
// @TypeConverter
|
||||||
fun fromLocation(value: String?): HemoCubeTestData.Location? {
|
// fun fromLocation(value: String?): UserData.Location? {
|
||||||
return if (value != null) {
|
// return if (value != null) {
|
||||||
gson.fromJson(value, HemoCubeTestData.Location::class.java)
|
// gson.fromJson(value, UserData.Location::class.java)
|
||||||
} else {
|
// } else {
|
||||||
null
|
// null
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
@TypeConverter
|
// @TypeConverter
|
||||||
fun toLocation(location: HemoCubeTestData.Location?): String? {
|
// fun toLocation(location: UserData.Location?): String? {
|
||||||
return if (location != null) {
|
// return if (location != null) {
|
||||||
gson.toJson(location)
|
// gson.toJson(location)
|
||||||
} else {
|
// } else {
|
||||||
null
|
// null
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ data class HemoCubeTestData(
|
|||||||
var name: String = "",
|
var name: String = "",
|
||||||
var birthYear: String = "",
|
var birthYear: String = "",
|
||||||
var userImageURL: String = "",
|
var userImageURL: String = "",
|
||||||
var location: Location? = null,
|
var location: UserData.Location? = null,
|
||||||
var reportUploadTime: String? = "",
|
var reportUploadTime: String? = "",
|
||||||
var testType: String? = "HEMOCUBE",
|
var testType: String? = "HEMOCUBE",
|
||||||
var testTime: String? = "",
|
var testTime: String? = "",
|
||||||
@@ -26,9 +26,4 @@ data class HemoCubeTestData(
|
|||||||
var led2Avarage: Double? = null,
|
var led2Avarage: Double? = null,
|
||||||
var deviceRatio: Double? = null,
|
var deviceRatio: Double? = null,
|
||||||
var calculatedRatio: Double? = null
|
var calculatedRatio: Double? = null
|
||||||
){
|
|
||||||
data class Location(
|
|
||||||
var latitude: Double? = null,
|
|
||||||
var longitude: Double? = null
|
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|||||||
@@ -42,14 +42,5 @@ fun UserData.toHemoCubeTestData() = HemoCubeTestData(
|
|||||||
name = name,
|
name = name,
|
||||||
birthYear = birthYear,
|
birthYear = birthYear,
|
||||||
userImageURL = userImageURL,
|
userImageURL = userImageURL,
|
||||||
location = location,
|
|
||||||
createdBy = createdBy,
|
|
||||||
reportUploadTime = reportUploadTime,
|
|
||||||
testTime = testTime,
|
|
||||||
testStatus = testStatus,
|
testStatus = testStatus,
|
||||||
mobileId = mobileId,
|
|
||||||
deviceSerialNumber = deviceSerialNumber,
|
|
||||||
kitSerial = kitSerial,
|
|
||||||
reportPath = reportPath,
|
|
||||||
resultRatio = resultRatio,
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class HemoCubeViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addResultTestToDb() {
|
private fun addResultTestToDb() {
|
||||||
testDetails?.resultRatio = DataHolder.hemocubeResult
|
testDetails?.deviceRatio = DataHolder.hemocubeResult
|
||||||
testDetails?.resultData = DataHolder.hemoCubeTestData?.resultData.toString()
|
testDetails?.resultData = DataHolder.hemoCubeTestData?.resultData.toString()
|
||||||
testDetails?.location = DataHolder.location
|
testDetails?.location = DataHolder.location
|
||||||
testDetails?.testTime = SimpleDateFormat(
|
testDetails?.testTime = SimpleDateFormat(
|
||||||
|
|||||||
Reference in New Issue
Block a user