中建365-二期开发-企业资料/健康档案
parent
8921ed3cfa
commit
dd733d9367
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,17 @@
|
||||
package com.zj365.mime.adapter
|
||||
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.ruffian.library.widget.RImageView
|
||||
import com.xty.base.adapter.BaseAdapter
|
||||
import com.xty.common.setImage
|
||||
import com.xty.network.model.EnterpriseInfoHomeBean
|
||||
import com.zj365.mime.R
|
||||
|
||||
class EnterpriseInformationChildAdapter : BaseAdapter<Any>(R.layout.item_enterprise_info_child) {
|
||||
override fun convert(holder: BaseViewHolder, item: Any) {
|
||||
class EnterpriseInformationChildAdapter : BaseAdapter<EnterpriseInfoHomeBean.EnterpriseInfoChildBean>(R.layout.item_enterprise_info_child) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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…
Reference in New Issue