package com.zj365.health.adapter.binddevice

import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zj365.health.R
import com.xty.network.model.BindDevHistoryBean
import java.lang.StringBuilder


class XuetangBindDeviceHistoryAdapter: BindDeviceHistoryAdapter() {
    override fun convert(holder: BaseViewHolder, item: BindDevHistoryBean) {
        super.convert(holder,item)
        holder.setText(R.id.tvNumInfo,parseJson(item.info))
        holder.setText(R.id.tvNumInfoTitle,"数值（mmol/L）")
    }

    fun parseJson(data:String):String{
        var builder = StringBuilder()
        var json = org.json.JSONObject(data)
        if (json.has("bloodsugar")){
            builder.append(json.get("bloodsugar"))
        }
//        builder.append(" mmol/L")
        return builder.toString()
    }
}