diff --git a/health/src/main/java/com/zj365/health/act/HealthWeekMonthHourReportAct.kt b/health/src/main/java/com/zj365/health/act/HealthWeekMonthHourReportAct.kt index 3a0006b..2737da1 100644 --- a/health/src/main/java/com/zj365/health/act/HealthWeekMonthHourReportAct.kt +++ b/health/src/main/java/com/zj365/health/act/HealthWeekMonthHourReportAct.kt @@ -58,8 +58,10 @@ import com.xty.common.setImageUser import com.xty.common.setOrganStatus import com.xty.common.util.CommonToastUtils import com.xty.common.util.CommonUtils +import com.xty.common.util.DeviceFunctionUtils import com.xty.common.weight.CenterImageSpan import com.xty.common.weight.HealthBodyView +import com.xty.network.model.DeviceFunctionBean import com.zj365.health.R import com.zj365.health.act.exception.BaseExceptionDataAct import com.zj365.health.adapter.DayReportInfoAdapter @@ -139,6 +141,8 @@ class HealthWeekMonthHourReportAct : BaseVmAct() { private val mTitless = mutableListOf() + var functionList = ArrayList() + private val tipDialog by lazy { //-1 建模中 0数据不足 1健康 2亚健康 3疾病 val title = when (mViewModel.infoLive.value!!.data.analyse.status.toInt()) { @@ -223,6 +227,11 @@ class HealthWeekMonthHourReportAct : BaseVmAct() { index = intent.getSerializableExtra("index") as ReportVm.ReportInfoType isDemonstrate = intent.getBooleanExtra("isDemonstrate", false) isEstimate = intent.getBooleanExtra("isEstimate", false) + + if(intent.extras!!.containsKey("functionList")){ + functionList = intent.extras!!.getParcelableArrayList("functionList")!! + } + if (isEstimate) { binding.mTime.setCompoundDrawablesWithIntrinsicBounds( null, // left @@ -336,6 +345,10 @@ class HealthWeekMonthHourReportAct : BaseVmAct() { } } + if(functionList.size == 0){ + mViewModel.getDeviceFunctionList(userId) + } + //设置tab //"用户信息", "健康状态趋势", "器官功能分析", "中医分析", "中医养生指导", "西医分析", "西医指导", // "饮食指导", "运动指导", "睡眠方案建议", "营养处方建议", "统计分析", "综合分析" @@ -1245,7 +1258,7 @@ class HealthWeekMonthHourReportAct : BaseVmAct() { ) ) - if (!isX1X2 || isDemonstrate) { //如果是演示模式都要显示体温 + if (DeviceFunctionUtils.hasFunction(functionList,"temp") || isDemonstrate) { //如果是演示模式都要显示体温 listInfo.add( com.xty.network.model.ReportBean.HrInfo( "体温", @@ -1438,7 +1451,7 @@ class HealthWeekMonthHourReportAct : BaseVmAct() { } list.add(respiratoryMean) - if (!isX1X2 || isDemonstrate) { + if (DeviceFunctionUtils.hasFunction(functionList,"temp") || isDemonstrate) { val tempMean = ReportBean().apply { title = "体温" count = it.data.tempMean.count @@ -1704,6 +1717,10 @@ class HealthWeekMonthHourReportAct : BaseVmAct() { CommonToastUtils.showToast("分享记录失败") } } + + mViewModel.functionLiveData.observe(this){ + functionList.addAll(it.data) + } } private fun goExceptionActivity(exceptionType: Int) { @@ -1941,7 +1958,7 @@ class HealthWeekMonthHourReportAct : BaseVmAct() { binding.analysisTv1.text = "平均心率: " + it.data.analyse.hr binding.analysisTv2.text = "平均血氧: " + it.data.analyse.so binding.analysisTv3.text = "平均呼吸率: " + it.data.analyse.respiratory - if (isX1X2) { + if (!DeviceFunctionUtils.hasFunction(functionList,"temp")) { binding.analysisTv8.visibility = View.GONE } else { binding.analysisTv8.text =