中建365-二期开发-企业资料/健康档案

develop
wlh 1 year ago
parent 8921ed3cfa
commit dd733d9367

@ -309,7 +309,8 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){ if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT) RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else { }else {
CommonToastUtils.showToast("敬请期待") RouteManager.goAct(ARouterUrl.ENTERPRISE_INFO)
// CommonToastUtils.showToast("敬请期待")
} }
} }

@ -25,17 +25,17 @@ ext {
url = [ url = [
// //
debug_url : "https://app.zhongjian365.com/app/", /*debug_url : "https://app.zhongjian365.com/app/",
release_url: "https://app.zhongjian365.com/app/", release_url: "https://app.zhongjian365.com/app/",
h5_debug_url : "https://built.zhongjian365.com/", h5_debug_url : "https://built.zhongjian365.com/",
h5_release_url : "https://built.zhongjian365.com/" h5_release_url : "https://built.zhongjian365.com/"*/
// //
/* debug_url : "http://java01.zhongjian365.com/app/", debug_url : "http://java01.zhongjian365.com/app/",
release_url: "http://java01.zhongjian365.com/app/", release_url: "http://java01.zhongjian365.com/app/",
h5_debug_url : "http://testbuilt.zhongjian365.com/", h5_debug_url : "http://testbuilt.zhongjian365.com/",
h5_release_url : "http://testbuilt.zhongjian365.com/"*/ h5_release_url : "http://testbuilt.zhongjian365.com/"
] ]

@ -315,6 +315,9 @@
<activity android:name=".act.healthrecord.UploadHealthRecordAct" <activity android:name=".act.healthrecord.UploadHealthRecordAct"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity android:name=".act.healthrecord.HealthRecordsListAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
</application> </application>

@ -52,6 +52,15 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
binding.proCho.progress = it.data.cho_percent.toInt() binding.proCho.progress = it.data.cho_percent.toInt()
binding.proFat.progress = it.data.fat_percent binding.proFat.progress = it.data.fat_percent
binding.proProtein.progress = it.data.protein_percent binding.proProtein.progress = it.data.protein_percent
binding.tvProteinPro.text = "${it.data.protein_percent}%"
binding.tvFatPro.text = "${it.data.fat_percent}%"
binding.tvChoPro.text = "${it.data.cho_percent}%"
}
mViewModel.healthArchiveLiveData.observe(this){
binding.tvBmi.text = "${it.data.bmiInfo.bmi}"
binding.tvBmiDesc.text = it.data.bmiInfo.levelName
mAdapter.setNewInstance(it.data.healData)
} }
} }
@ -66,6 +75,8 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
mViewModel.getBalanceDiet() mViewModel.getBalanceDiet()
mViewModel.getHealthArchive()
initTab() initTab()
initSurvey() initSurvey()
initAdapter() initAdapter()
@ -155,10 +166,9 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
} }
binding.xTablayout.setOnTabSelectedListener(object : XTabLayout.OnTabSelectedListener{ binding.xTablayout.setOnTabSelectedListener(object : XTabLayout.OnTabSelectedListener{
override fun onTabSelected(tab: XTabLayout.Tab?) { override fun onTabSelected(tab: XTabLayout.Tab) {
if (!isScrollTable) { if (!isScrollTable) {
Log.e("HealthRecordMainAct", "选择的${tab?.position!!}")
isSelectTable = true isSelectTable = true
if (launch != null) { if (launch != null) {
launch?.cancel() launch?.cancel()
@ -213,7 +223,6 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
binding.scrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { _, _, scrollY, _, _ -> binding.scrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { _, _, scrollY, _, _ ->
if (mTitles.size > 0) { if (mTitles.size > 0) {
if (!isSelectTable) { if (!isSelectTable) {
Log.e("HealthRecordMainAct", "移动的${scrollY}")
isScrollTable = true isScrollTable = true
val selectedTabPosition = binding.xTablayout.selectedTabPosition val selectedTabPosition = binding.xTablayout.selectedTabPosition
if (scrollY >= binding.clHealthRecording.top) { if (scrollY >= binding.clHealthRecording.top) {

@ -10,9 +10,10 @@ import com.xty.common.arouter.RouteManager
import com.zj365.health.adapter.healthrecord.HealthRecordsAdapter import com.zj365.health.adapter.healthrecord.HealthRecordsAdapter
import com.zj365.health.databinding.ActHealthRecordBinding import com.zj365.health.databinding.ActHealthRecordBinding
import com.zj365.health.databinding.ActHealthRecordsListBinding import com.zj365.health.databinding.ActHealthRecordsListBinding
import com.zj365.health.vm.HealthRecordsListVm
@Route(path = ARouterUrl.FAMILY_REPORT_LIST_ACT) @Route(path = ARouterUrl.FAMILY_REPORT_LIST_ACT)
class HealthRecordsListAct : BaseListAct<BaseVm>() { class HealthRecordsListAct : BaseListAct<HealthRecordsListVm>() {
val binding by lazy { ActHealthRecordsListBinding.inflate(layoutInflater) } val binding by lazy { ActHealthRecordsListBinding.inflate(layoutInflater) }
@ -24,6 +25,8 @@ class HealthRecordsListAct : BaseListAct<BaseVm>() {
} }
override fun loadData() { override fun loadData() {
mViewModel.getHealthRecordList()
} }
override fun initView() { override fun initView() {
@ -39,6 +42,9 @@ class HealthRecordsListAct : BaseListAct<BaseVm>() {
} }
override fun liveObserver() { override fun liveObserver() {
mViewModel.healthReportListLiveData.observe(this){
mAdapter.setNewInstance(it.data.records)
}
} }
override fun setLayout() = binding.root override fun setLayout() = binding.root

@ -16,20 +16,39 @@ import com.xty.common.TimeSelect
import com.xty.common.arouter.ARouterUrl import com.xty.common.arouter.ARouterUrl
import com.xty.common.picture.PictureUtils import com.xty.common.picture.PictureUtils
import com.xty.common.util.CommonToastUtils import com.xty.common.util.CommonToastUtils
import com.xty.network.model.EatTypeBean
import com.zj365.health.R import com.zj365.health.R
import com.zj365.health.adapter.PictureAdapter import com.zj365.health.adapter.UploadPicAdapter
import com.zj365.health.databinding.ActUploadHealthRecordBinding import com.zj365.health.databinding.ActUploadHealthRecordBinding
import com.zj365.health.vm.UploadHealthRecordVm
import com.zj365.health.weight.EatTypeDialog
import java.lang.StringBuilder
@Route(path = ARouterUrl.FAMILY_REPORT_UPLOAD_ACT) @Route(path = ARouterUrl.FAMILY_REPORT_UPLOAD_ACT)
class UploadHealthRecordAct : BaseVmAct<BaseVm>() { class UploadHealthRecordAct : BaseVmAct<UploadHealthRecordVm>() {
val binding by lazy { ActUploadHealthRecordBinding.inflate(layoutInflater) } val binding by lazy { ActUploadHealthRecordBinding.inflate(layoutInflater) }
private val mAdapter by lazy { PictureAdapter() } private val mAdapter by lazy { UploadPicAdapter() }
private var isCheck = false private var isCheck = false
private var delete = arrayListOf<String>() private var delete = arrayListOf<String>()
var reportType : String = ""
var reportTime:String = ""
var reportTitle:String = ""
var reportExplain:String =""
private var result = mutableListOf<String>()
private val uploadTypeData = arrayOf(
EatTypeBean("体检报告", "1"),
EatTypeBean("病历报告", "2"),
EatTypeBean("CT或其他影像", "3")
)
private val timSelect by lazy { private val timSelect by lazy {
TimeSelect(this) { TimeSelect(this) {
@ -45,6 +64,17 @@ class UploadHealthRecordAct : BaseVmAct<BaseVm>() {
} }
override fun liveObserver() { override fun liveObserver() {
mViewModel.imageLive1.observe(this){
var strBuilder = StringBuilder()
it.data.forEachIndexed { index, s ->
strBuilder.append(it.data[index])
if (index < it.data.size -1 ){
strBuilder.append(",")
}
}
mViewModel.submitReport(reportTitle,reportType,reportTime,strBuilder.toString(),reportExplain)
}
} }
@ -61,13 +91,19 @@ class UploadHealthRecordAct : BaseVmAct<BaseVm>() {
timSelect.selectTime(it, "yyyy-MM-dd HH:mm") timSelect.selectTime(it, "yyyy-MM-dd HH:mm")
} }
binding.tvUploadType.setOnClickListener {
RxKeyboardTool.hideSoftInput(this)
uploadTypeSelect.setWheelViewData(uploadTypeData.toMutableList())
uploadTypeSelect.show()
}
binding.recycler.layoutManager = GridLayoutManager(this, 4) binding.recycler.layoutManager = GridLayoutManager(this, 4)
binding.recycler.adapter = mAdapter binding.recycler.adapter = mAdapter
mAdapter.addChildClickViewIds(R.id.ivImage, R.id.ivDelete) mAdapter.addChildClickViewIds(R.id.ivImage, R.id.ivDelete)
mAdapter.setOnItemChildClickListener { adapter, view, position -> mAdapter.setOnItemChildClickListener { adapter, view, position ->
when (view.id) { when (view.id) {
R.id.ivImage -> { R.id.ivImage -> {
if (adapter.data.size < 5) { if (adapter.data.size -1 < 5) {
isCheck = true isCheck = true
val item = adapter.getItem(position) as String val item = adapter.getItem(position) as String
if (TextUtils.isEmpty(item)) { if (TextUtils.isEmpty(item)) {
@ -91,6 +127,48 @@ class UploadHealthRecordAct : BaseVmAct<BaseVm>() {
} }
mAdapter.addData("") mAdapter.addData("")
binding.tvSave.setOnClickListener {
reportTime= binding.tvUploadTime.text.toString()
reportTitle = binding.etReportTitle.text.toString()
if (TextUtils.isEmpty(reportTitle)) {
CommonToastUtils.showToast("请填写报告标题")
return@setOnClickListener
}
if (TextUtils.isEmpty(reportType)) {
CommonToastUtils.showToast("请选择报告类型")
return@setOnClickListener
}
if (TextUtils.isEmpty(reportTime)) {
CommonToastUtils.showToast("请选择报告时间")
return@setOnClickListener
}
result.clear()
for (datum in mAdapter.data) {
if (TextUtils.isEmpty(datum)) {
continue
}
if (!datum.contains("http")) {
result.add(datum)
}
}
if (result.size <= 0) {
CommonToastUtils.showToast("请上传报告图片")
return@setOnClickListener
}
reportExplain = binding.etReportExplain.text.toString()
if (result.size > 0) {
mViewModel.uploadImagesFiles(result)
}
}
}
private val uploadTypeSelect by lazy {
EatTypeDialog(this,"选择报告类型") { selectValue, selectKey ->
binding.tvUploadType.text = selectKey
reportType = selectValue
}
} }
override fun setLayout() = binding.root override fun setLayout() = binding.root
@ -113,6 +191,8 @@ class UploadHealthRecordAct : BaseVmAct<BaseVm>() {
} }
} }
} }
binding.tvNumDesc.text = "重要内容拍照存储(${mAdapter.data.size -1}/5"
} }
isCheck = false isCheck = false
} }

@ -0,0 +1,24 @@
package com.zj365.health.adapter
import android.widget.ImageView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.xty.common.setRoundImage
import com.zj365.health.R
class UploadPicAdapter : BaseAdapter<String>(R.layout.item_picture) {
override fun convert(holder: BaseViewHolder, item: String) {
holder.setGone(R.id.tvNumb,true)
if (item.isEmpty()){
holder.itemView.findViewById<ImageView>(R.id.ivImage).setImageResource(R.mipmap.changctup)
holder.setGone(R.id.ivDelete,true)
} else {
holder.setGone(R.id.ivDelete,false)
holder.getView<ImageView>(R.id.ivImage)
.apply {
setRoundImage(context, item)
}
}
}
}

@ -4,10 +4,29 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter import com.xty.base.adapter.BaseAdapter
import com.xty.network.model.HealthReportListBean
import com.zj365.health.R import com.zj365.health.R
class HealthRecordsAdapter : BaseAdapter<Any>(R.layout.item_health_report_record) { class HealthRecordsAdapter : BaseAdapter<HealthReportListBean.HealthReportBean>(R.layout.item_health_report_record) {
override fun convert(holder: BaseViewHolder, item: Any) {
override fun convert(holder: BaseViewHolder, item: HealthReportListBean.HealthReportBean) {
holder.setText(R.id.tv_report_title,item.title)
holder.setText(R.id.tv_report_time,item.reportTime)
when(item.reportType){
1->{
holder.setText(R.id.tv_report_type,"体检")
}
2->{
holder.setText(R.id.tv_report_type,"病例")
}
else->{
holder.setText(R.id.tv_report_type,"CT或其他影像")
}
}
var imgAdapter = HealthRecordsChildAdapter() var imgAdapter = HealthRecordsChildAdapter()
var recycler = holder.getView<RecyclerView>(R.id.recycler) var recycler = holder.getView<RecyclerView>(R.id.recycler)

@ -3,15 +3,26 @@ package com.zj365.health.vm
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm import com.xty.base.vm.BaseVm
import com.xty.network.model.BalanceDietBean import com.xty.network.model.BalanceDietBean
import com.xty.network.model.HealthArchiveBean
import com.xty.network.model.RespBody import com.xty.network.model.RespBody
class HealthRecordMainVm : BaseVm() { class HealthRecordMainVm : BaseVm() {
val balanceDietBeanLiveData by lazy { MutableLiveData<RespBody<BalanceDietBean>>() } val balanceDietBeanLiveData by lazy { MutableLiveData<RespBody<BalanceDietBean>>() }
val healthArchiveLiveData by lazy { MutableLiveData<RespBody<HealthArchiveBean>>() }
fun getBalanceDiet(){ fun getBalanceDiet(){
startHttp { startHttp (false){
var response = apiInterface().getBalanceDiet() var response = apiInterface().getBalanceDiet()
response.getCodeStatus(balanceDietBeanLiveData, nowData) response.getCodeStatus(balanceDietBeanLiveData, nowData)
} }
} }
fun getHealthArchive(){
startHttp {
var response = apiInterface().getHealthArchive()
response.getCodeStatus(healthArchiveLiveData, nowData)
}
}
} }

@ -0,0 +1,18 @@
package com.zj365.health.vm
import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm
import com.xty.network.model.HealthReportListBean
import com.xty.network.model.RespBody
class HealthRecordsListVm : BaseVm() {
val healthReportListLiveData by lazy { MutableLiveData<RespBody<HealthReportListBean>>() }
fun getHealthRecordList(){
startHttp {
var response = apiInterface().getHealthReportList()
response.getCodeStatus(healthReportListLiveData, nowData)
}
}
}

@ -0,0 +1,59 @@
package com.zj365.health.vm
import androidx.lifecycle.MutableLiveData
import com.alibaba.fastjson.JSONObject
import com.xty.base.vm.BaseVm
import com.xty.network.model.RespBody
import okhttp3.MultipartBody
import java.io.File
class UploadHealthRecordVm : BaseVm() {
val imageLive1 by lazy { MutableLiveData<RespBody<MutableList<String>>>() }
val submitLiveData by lazy { MutableLiveData<RespBody<Any>>() }
/**
* 上传图片
*/
fun uploadImagesFiles(path: List<String>) {
if (path.isEmpty()) {
return
}
val list = mutableListOf<MultipartBody.Part>()
for (s in path) {
if (s.contains("http")) {
continue
}
val f = File(s)
val rb =
MultipartBody.Part.createFormData("files", f.name, retrofits.getMultiPartFileRb(f))
list.add(rb)
}
if (list.isEmpty()) {
return
}
startHttp {
val body = apiInterface().uploadImagesFile(list)
body.getCodeStatus(imageLive1, nowData)
}
}
fun submitReport(title:String,reportType:String,reportTime:String,pic:String,remark:String){
startHttp {
var json = JSONObject()
json.put("title",title)
json.put("reportType",reportType)
json.put("reportTime",reportTime)
json.put("pic",pic)
json.put("remark",remark)
var response = apiInterface().submitHealthReport(retrofits.getRequestBody(json.toString()))
response.getCodeStatus(submitLiveData, nowData)
}
}
}

@ -122,6 +122,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/col_313" android:textColor="@color/col_313"
android:textSize="@dimen/sp_18" android:textSize="@dimen/sp_18"
android:text="--"
tools:text="31"/> tools:text="31"/>
<TextView <TextView
@ -146,6 +147,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/col_313" android:textColor="@color/col_313"
android:textSize="@dimen/sp_18" android:textSize="@dimen/sp_18"
android:text="--"
tools:text="31"/> tools:text="31"/>
<TextView <TextView
@ -347,6 +349,7 @@
android:progressDrawable="@drawable/progress_bg_info" /> android:progressDrawable="@drawable/progress_bg_info" />
<TextView <TextView
android:id="@+id/tv_cho_pro"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/sp_15" android:textSize="@dimen/sp_15"
@ -380,6 +383,7 @@
android:progressDrawable="@drawable/progress_bg_info" /> android:progressDrawable="@drawable/progress_bg_info" />
<TextView <TextView
android:id="@+id/tv_protein_pro"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/sp_15" android:textSize="@dimen/sp_15"
@ -413,6 +417,7 @@
android:progressDrawable="@drawable/progress_bg_info" /> android:progressDrawable="@drawable/progress_bg_info" />
<TextView <TextView
android:id="@+id/tv_fat_pro"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/sp_15" android:textSize="@dimen/sp_15"
@ -457,6 +462,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/recycler" android:id="@+id/recycler"
android:layout_marginTop="@dimen/dp_20"
app:layout_constraintTop_toBottomOf="@+id/mTvHealthMonitoring" app:layout_constraintTop_toBottomOf="@+id/mTvHealthMonitoring"
app:layout_constraintLeft_toLeftOf="parent"/> app:layout_constraintLeft_toLeftOf="parent"/>

@ -15,10 +15,10 @@
android:layout_height="@dimen/dp_36" android:layout_height="@dimen/dp_36"
android:layout_marginLeft="@dimen/dp_16" android:layout_marginLeft="@dimen/dp_16"
android:layout_marginRight="@dimen/dp_16" android:layout_marginRight="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_3" android:layout_marginTop="@dimen/dp_12"
app:corner_radius="@dimen/dp_18" app:corner_radius="@dimen/dp_18"
android:layout_below="@+id/title" android:layout_below="@+id/title"
app:background_normal="@color/col_2F2"> app:background_normal="@color/white">
<ImageView <ImageView
android:id="@+id/img_search" android:id="@+id/img_search"

@ -49,6 +49,7 @@
tools:ignore="UseCompatTextViewDrawableXml" /> tools:ignore="UseCompatTextViewDrawableXml" />
<TextView <TextView
android:id="@+id/tv_num_desc"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="重要内容拍照存储0/5" android:text="重要内容拍照存储0/5"
@ -96,11 +97,13 @@
/> />
<EditText <EditText
android:id="@+id/et_report_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/sp_15" android:textSize="@dimen/sp_15"
android:textColor="@color/col_313" android:textColor="@color/col_313"
android:background="@null" android:background="@null"
android:gravity="right"
android:textColorHint="@color/col_6B6" android:textColorHint="@color/col_6B6"
android:hint="例:血常规报告" android:hint="例:血常规报告"
android:layout_centerVertical="true" android:layout_centerVertical="true"
@ -127,12 +130,14 @@
/> />
<TextView <TextView
android:id="@+id/tv_upload_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/sp_15" android:textSize="@dimen/sp_15"
android:textColor="@color/col_313" android:textColor="@color/col_313"
android:background="@null" android:background="@null"
android:textColorHint="@color/col_6B6" android:textColorHint="@color/col_6B6"
android:gravity="right"
android:hint="请选择报告类型" android:hint="请选择报告类型"
android:drawablePadding="@dimen/dp_5" android:drawablePadding="@dimen/dp_5"
android:drawableRight="@mipmap/icon_arrow_right" android:drawableRight="@mipmap/icon_arrow_right"
@ -204,7 +209,7 @@
tools:ignore="UseCompatTextViewDrawableXml" /> tools:ignore="UseCompatTextViewDrawableXml" />
<EditText <EditText
android:id="@+id/mZyDesc" android:id="@+id/et_report_explain"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/shape_round_gray" android:background="@drawable/shape_round_gray"

@ -19,6 +19,7 @@
android:textSize="@dimen/sp_25" android:textSize="@dimen/sp_25"
android:textColor="@color/white" android:textColor="@color/white"
android:textStyle="bold" android:textStyle="bold"
android:text="--"
tools:text="67"/> tools:text="67"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

@ -5,17 +5,16 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseListAct import com.xty.base.act.BaseListAct
import com.xty.base.vm.BaseVm
import com.xty.common.SizeUtil
import com.xty.common.arouter.ARouterUrl import com.xty.common.arouter.ARouterUrl
import com.zj365.mime.adapter.EnterpriseInformationAdapter import com.zj365.mime.adapter.EnterpriseInformationAdapter
import com.zj365.mime.databinding.ActEnterpriseInformationBinding import com.zj365.mime.databinding.ActEnterpriseInformationBinding
import com.zj365.mime.vm.EnterpriseInformationVm
/** /**
* 企业资料 * 企业资料
*/ */
@Route(path = ARouterUrl.ENTERPRISE_INFO) @Route(path = ARouterUrl.ENTERPRISE_INFO)
class EnterpriseInformationAct : BaseListAct<BaseVm>() { class EnterpriseInformationAct : BaseListAct<EnterpriseInformationVm>() {
val binding by lazy { ActEnterpriseInformationBinding.inflate(layoutInflater) } val binding by lazy { ActEnterpriseInformationBinding.inflate(layoutInflater) }
val mAdapter by lazy { EnterpriseInformationAdapter() } val mAdapter by lazy { EnterpriseInformationAdapter() }
@ -23,20 +22,16 @@ class EnterpriseInformationAct : BaseListAct<BaseVm>() {
binding.recyclerView.layoutManager = LinearLayoutManager(this) binding.recyclerView.layoutManager = LinearLayoutManager(this)
binding.recyclerView.adapter = mAdapter binding.recyclerView.adapter = mAdapter
setRecycleRefresh(binding.recyclerView,binding.mRefresh,true) setRecycleRefresh(binding.recyclerView,binding.mRefresh,true)
/* binding.recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() { binding.recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() {
override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) { override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) {
super.getItemOffsets(outRect, itemPosition, parent) super.getItemOffsets(outRect, itemPosition, parent)
if (itemPosition == 0){ outRect.bottom = 12
}else{
outRect.set(0, SizeUtil.dp2px(this@EnterpriseInformationAct,12f))
}
} }
})*/ })
} }
override fun loadData() { override fun loadData() {
mViewModel.getEnterpriseInformationHomeList()
} }
override fun initView() { override fun initView() {
@ -50,6 +45,10 @@ class EnterpriseInformationAct : BaseListAct<BaseVm>() {
override fun liveObserver() { override fun liveObserver() {
mViewModel.enterpriseInfoHomeLiveData.observe(this){
mAdapter.setNewInstance(it.data)
}
} }
override fun setLayout() = binding.root override fun setLayout() = binding.root

@ -4,17 +4,21 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter import com.xty.base.adapter.BaseAdapter
import com.xty.network.model.EnterpriseInfoHomeBean
import com.zj365.mime.R import com.zj365.mime.R
class EnterpriseInformationAdapter : BaseAdapter<Any>(R.layout.item_enterprise_info) { class EnterpriseInformationAdapter : BaseAdapter<EnterpriseInfoHomeBean>(R.layout.item_enterprise_info) {
val mAdapter by lazy { EnterpriseInformationChildAdapter() } override fun convert(holder: BaseViewHolder, item: EnterpriseInfoHomeBean) {
override fun convert(holder: BaseViewHolder, item: Any) {
holder.setText(R.id.tv_info_name,item.typeName)
var mAdapter = EnterpriseInformationChildAdapter()
var recyclerView = holder.getView<RecyclerView>(R.id.recycler) var recyclerView = holder.getView<RecyclerView>(R.id.recycler)
recyclerView.layoutManager = LinearLayoutManager(context) recyclerView.layoutManager = LinearLayoutManager(context)
recyclerView.adapter = mAdapter recyclerView.adapter = mAdapter
mAdapter.setNewInstance(item.list)
} }

@ -1,11 +1,17 @@
package com.zj365.mime.adapter package com.zj365.mime.adapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ruffian.library.widget.RImageView
import com.xty.base.adapter.BaseAdapter import com.xty.base.adapter.BaseAdapter
import com.xty.common.setImage
import com.xty.network.model.EnterpriseInfoHomeBean
import com.zj365.mime.R import com.zj365.mime.R
class EnterpriseInformationChildAdapter : BaseAdapter<Any>(R.layout.item_enterprise_info_child) { class EnterpriseInformationChildAdapter : BaseAdapter<EnterpriseInfoHomeBean.EnterpriseInfoChildBean>(R.layout.item_enterprise_info_child) {
override fun convert(holder: BaseViewHolder, item: Any) { override fun convert(holder: BaseViewHolder, item: EnterpriseInfoHomeBean.EnterpriseInfoChildBean) {
holder.setText(R.id.tv_info_title,item.title)
holder.setText(R.id.mTime,item.createTime)
holder.getView<RImageView>(R.id.img_cover).setImage(context,item.pic)
} }
} }

@ -0,0 +1,19 @@
package com.zj365.mime.vm
import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm
import com.xty.network.model.EnterpriseInfoHomeBean
import com.xty.network.model.RespBody
class EnterpriseInformationVm : BaseVm() {
val enterpriseInfoHomeLiveData by lazy { MutableLiveData<RespBody<MutableList<EnterpriseInfoHomeBean>>>() }
fun getEnterpriseInformationHomeList(){
startHttp {
var response=apiInterface().getEnterpriseInfoHomeList()
response.getCodeStatus(enterpriseInfoHomeLiveData,nowData)
}
}
}

@ -22,6 +22,7 @@
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginLeft="@dimen/dp_14" android:layout_marginLeft="@dimen/dp_14"
android:layout_marginRight="@dimen/dp_14"/> android:layout_marginRight="@dimen/dp_14"/>

@ -1461,9 +1461,31 @@ interface ApiInterface {
@POST("pay/toPay") @POST("pay/toPay")
suspend fun toPay(@Body rb: RequestBody):RespBody<PayBean> suspend fun toPay(@Body rb: RequestBody):RespBody<PayBean>
/**
* 标准均衡饮食
*/
@POST("customer/meals/balanceDiet") @POST("customer/meals/balanceDiet")
suspend fun getBalanceDiet():RespBody<BalanceDietBean> suspend fun getBalanceDiet():RespBody<BalanceDietBean>
/**
* 获取健康档案数据
*/
@POST("customer/user/getHealthArchive")
suspend fun getHealthArchive():RespBody<HealthArchiveBean>
/**
* 获取报告记录
*/
@POST("customer/reportData/list")
suspend fun getHealthReportList():RespBody<HealthReportListBean>
/**
* 添加报告记录
*/
@POST("customer/reportData/add")
suspend fun submitHealthReport(@Body rb: RequestBody):RespBody<Any>
/** /**
* 商品信息接口 * 商品信息接口
*/ */
@ -1800,4 +1822,10 @@ interface ApiInterface {
*/ */
@POST("customer/user/getDeviceTypeList") @POST("customer/user/getDeviceTypeList")
suspend fun getDeviceTypeList(@Body rb:RequestBody):RespBody<MutableList<DeviceBean>> suspend fun getDeviceTypeList(@Body rb:RequestBody):RespBody<MutableList<DeviceBean>>
/**
* 企业资料首页
*/
@POST("customer/material/index")
suspend fun getEnterpriseInfoHomeList():RespBody<MutableList<EnterpriseInfoHomeBean>>
} }

@ -0,0 +1,19 @@
package com.xty.network.model
data class EnterpriseInfoHomeBean(
var typeName:String,
var type:Int,
var list:ArrayList<EnterpriseInfoChildBean>
) {
data class EnterpriseInfoChildBean(
var title:String,
var id:Long,
var fileFormat:Int,
var type:Int,
var pic:String,
var fileUrl:String,
var contentText:String,
var createTime:String
)
}

@ -0,0 +1,6 @@
package com.xty.network.model
data class HealthArchiveBean(var bmiInfo:BMIInfo,var healData:ArrayList<FamilyHealthBean.FamilyTargetBean>){
data class BMIInfo(var levelName:String,var bmi:Float)
}

@ -0,0 +1,16 @@
package com.xty.network.model
data class HealthReportListBean(var records:ArrayList<HealthReportBean>) {
data class HealthReportBean(
var orgIds:Long,
var id:Long,
var userId:Long,
var title:String,
var reportType:Int,
var reportTime:String,
var pic:String,
var remark:String,
var createTime:String
)
}
Loading…
Cancel
Save