package com.yidianling.medical.archives.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yidianling.im.R
import com.yidianling.medical.archives.bean.MedicalArchivesListBean

/**
 * 图文问诊 患者adapter
 * */
class MedicalUserArchivesFlow2Adapter :
    BaseQuickAdapter<MedicalArchivesListBean?, BaseViewHolder>(R.layout.medical_item_archives_flow2_list) {

    override fun convert(helper: BaseViewHolder, item: MedicalArchivesListBean?) {

        if (item?.isAdd == true) {
            helper.setBackgroundRes(R.id.bg, R.drawable.medical_bg_edit_f2f5f8)
            helper.setGone(R.id.name, false)
            helper.setGone(R.id.perfect, false)
            helper.setGone(R.id.sex, false)
            helper.setGone(R.id.age, false)

            helper.setGone(R.id.iv_bottom_check, false)
            helper.setGone(R.id.iv_bottom_check, false)
            helper.setGone(R.id.group_add, true)

        } else {
            helper.setGone(R.id.group_add, false)
            helper.setGone(R.id.name, true)
            if (item?.needEdit == 1){
                helper.setGone(R.id.perfect, true)
                helper.setGone(R.id.sex, false)
                helper.setGone(R.id.age, false)
            }else{
                helper.setGone(R.id.perfect, false)
                helper.setGone(R.id.sex, true)
                helper.setGone(R.id.age, true)
            }

            if (item?.isCheck == true) {
                helper.setBackgroundRes(R.id.bg, R.drawable.medical_list_check_bg)
                helper.setGone(R.id.iv_bottom_check, true)
            } else {
                helper.setBackgroundRes(R.id.bg, R.drawable.medical_bg_edit_f2f5f8)
                helper.setGone(R.id.iv_bottom_check, false)
            }

            helper.setText(R.id.name, item?.name)
            helper.setText(R.id.sex, item?.genderName)
            helper.setText(R.id.age, "${item?.age}岁")
        }


    }

}