Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b06a08b029 | ||
|
|
3c90d9f1d3 | ||
|
|
5a2963ce32 | ||
|
|
7a591579a8 | ||
|
|
41fadb7b75 | ||
|
|
c504f23052 | ||
|
|
aee280cf86 | ||
|
|
c044b8cbdc | ||
|
|
14f7542037 | ||
|
|
7cca7e0b79 | ||
|
|
b29c46b906 | ||
|
|
4b5da9269d | ||
|
|
7a830c3272 | ||
|
|
b609f07240 | ||
|
|
c33c76f732 | ||
|
|
bb23c00e9c | ||
|
|
f5be575491 | ||
|
|
4ff52c0465 | ||
|
|
f4578f94b1 | ||
|
|
9aa64d5996 | ||
|
|
a4bce0ff23 | ||
|
|
e76474b74e | ||
|
|
72f4c21b3a | ||
|
|
222c1e4570 | ||
|
|
06352cbf11 | ||
|
|
d0a92cea60 | ||
|
|
c6b5966261 | ||
|
|
008408470a | ||
|
|
967aff4103 | ||
|
|
dc55c65b87 | ||
|
|
e2d53f851d | ||
|
|
9c91839520 | ||
|
|
dcb53f344a | ||
|
|
53f33b35e0 | ||
|
|
960791ff4d | ||
|
|
f095e182e5 | ||
|
|
dad08d5ea4 | ||
|
|
0d539aeef0 | ||
|
|
cb87a289f9 | ||
|
|
fa22549496 | ||
|
|
e8118708c3 | ||
|
|
73f25d9e18 |
@@ -89,7 +89,6 @@ android {
|
|||||||
main {
|
main {
|
||||||
jniLibs.srcDirs = ['libs']
|
jniLibs.srcDirs = ['libs']
|
||||||
res.srcDirs = [
|
res.srcDirs = [
|
||||||
'src/main/res-login',
|
|
||||||
'src/main/res-health-check',
|
'src/main/res-health-check',
|
||||||
'src/main/res-health-record',
|
'src/main/res-health-record',
|
||||||
// 'src/main/res-intervention',
|
// 'src/main/res-intervention',
|
||||||
@@ -138,5 +137,5 @@ dependencies {
|
|||||||
//JSoup
|
//JSoup
|
||||||
api 'org.jsoup:jsoup:1.12.1'
|
api 'org.jsoup:jsoup:1.12.1'
|
||||||
|
|
||||||
|
implementation 'com.tencent.mm.opensdk:wechat-sdk-android:+'
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.WebActivity"
|
android:name=".ui.activity.WebActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.UserInfoSettingActivity"
|
android:name=".ui.activity.UserInfoSettingActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
@@ -184,7 +184,22 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name="com.sw.healthyclients.ui.guidance.ViewLocationActivity"
|
android:name="com.sw.healthyclients.ui.guidance.ViewLocationActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.SimulateUserActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.home.HomeNoticeListActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.home.HomeNoticeDetailActivity"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
|
<activity android:name=".ui.activity.home.HomeBannerDetailActivity"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
|
<activity android:name=".ui.activity.home.MyBankLActivity"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
|
<activity android:name=".ui.activity.EmptyActivity"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
|
<activity android:name=".ui.activity.ProposalActivity"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -9,6 +9,12 @@
|
|||||||
"tabs": [
|
"tabs": [
|
||||||
{
|
{
|
||||||
"tabName": "首页",
|
"tabName": "首页",
|
||||||
|
"tabTag": "key_home_fragment",
|
||||||
|
"iconNormal": "main_home_tab_home_normal",
|
||||||
|
"iconSelected": "main_home_tab_home_selected"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tabName": "咨询",
|
||||||
"tabTag": "key_guidance_fragment",
|
"tabTag": "key_guidance_fragment",
|
||||||
"iconNormal": "main_home_tab_index_normal",
|
"iconNormal": "main_home_tab_index_normal",
|
||||||
"iconSelected": "main_home_tab_index_selected"
|
"iconSelected": "main_home_tab_index_selected"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.annotation.SuppressLint
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Message
|
import android.os.Message
|
||||||
|
import android.util.Log
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -19,17 +20,29 @@ import com.permissionx.guolindev.PermissionX
|
|||||||
import com.sw.healthyclients.data.local.DataStoreManager
|
import com.sw.healthyclients.data.local.DataStoreManager
|
||||||
import com.sw.healthyclients.utils.CustomActivityManager
|
import com.sw.healthyclients.utils.CustomActivityManager
|
||||||
import com.sw.healthyclients.view.CustomToast
|
import com.sw.healthyclients.view.CustomToast
|
||||||
|
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX
|
||||||
|
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage
|
||||||
|
import com.tencent.mm.opensdk.modelmsg.WXWebpageObject
|
||||||
|
import com.tencent.mm.opensdk.openapi.IWXAPI
|
||||||
|
import com.tencent.mm.opensdk.openapi.WXAPIFactory
|
||||||
import com.tencent.qcloud.tuicore.TUICore
|
import com.tencent.qcloud.tuicore.TUICore
|
||||||
import com.tencent.qcloud.tuikit.tuichat.TUIChatService
|
import com.tencent.qcloud.tuikit.tuichat.TUIChatService
|
||||||
import com.tencent.qcloud.tuikit.tuichat.classicui.event.IMChatEvent
|
import com.tencent.qcloud.tuikit.tuichat.classicui.event.IMChatEvent
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.interfaces.FileBaseUrlListener
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.interfaces.ShareToWeChatListener
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.presenter.FileBaseUrlHelper
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.presenter.WeChatShareHelper
|
||||||
import com.xjjk.healthyclients.base.BaseVMBActivity
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
import com.xjjk.healthyclients.bean.CardInfoBean
|
import com.xjjk.healthyclients.bean.CardInfoBean
|
||||||
import com.xjjk.healthyclients.bottomtab.HomeBottomTabLayout
|
import com.xjjk.healthyclients.bottomtab.HomeBottomTabLayout
|
||||||
import com.xjjk.healthyclients.databinding.ActivityMainBinding
|
import com.xjjk.healthyclients.databinding.ActivityMainBinding
|
||||||
|
import com.xjjk.healthyclients.event.HomeTabChangeEvent
|
||||||
import com.xjjk.healthyclients.event.RefreshEvent
|
import com.xjjk.healthyclients.event.RefreshEvent
|
||||||
import com.xjjk.healthyclients.fragment.EmergencyFragment
|
import com.xjjk.healthyclients.fragment.EmergencyFragment
|
||||||
import com.xjjk.healthyclients.fragment.GuidanceFragment
|
import com.xjjk.healthyclients.fragment.GuidanceFragment
|
||||||
|
import com.xjjk.healthyclients.fragment.HomeFragment
|
||||||
import com.xjjk.healthyclients.fragment.MonitorFragment
|
import com.xjjk.healthyclients.fragment.MonitorFragment
|
||||||
|
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||||
import com.xjjk.healthyclients.superfuntion.loginIm
|
import com.xjjk.healthyclients.superfuntion.loginIm
|
||||||
import com.xjjk.healthyclients.superfuntion.startAllDoctorActivity
|
import com.xjjk.healthyclients.superfuntion.startAllDoctorActivity
|
||||||
import com.xjjk.healthyclients.superfuntion.startLoginActivity
|
import com.xjjk.healthyclients.superfuntion.startLoginActivity
|
||||||
@@ -48,6 +61,7 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
|||||||
HomeBottomTabLayout.HomeBottomTabLayoutCallback {
|
HomeBottomTabLayout.HomeBottomTabLayoutCallback {
|
||||||
|
|
||||||
//每个tab对应的tag,和json配置文件中保持一致
|
//每个tab对应的tag,和json配置文件中保持一致
|
||||||
|
val TAG_HOME = "key_home_fragment"
|
||||||
val TAG_GUIDANCE = "key_guidance_fragment"
|
val TAG_GUIDANCE = "key_guidance_fragment"
|
||||||
val TAG_EMERGENCY = "key_emergency_fragment"
|
val TAG_EMERGENCY = "key_emergency_fragment"
|
||||||
val TAG_MONITOR = "key_monitor_fragment"
|
val TAG_MONITOR = "key_monitor_fragment"
|
||||||
@@ -65,6 +79,42 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
|||||||
Manifest.permission.POST_NOTIFICATIONS
|
Manifest.permission.POST_NOTIFICATIONS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val APP_ID: String = "wxb33cd60beda0a212"
|
||||||
|
private var api: IWXAPI? = null
|
||||||
|
private val shareToWeChatListener = ShareToWeChatListener { lat, lon, desc ->
|
||||||
|
val url = ("https://ditu.amap.com/regeo?lng=" + lon
|
||||||
|
+ "&lat=" + lat + "&name=" + desc + "&src=uriapi&innersrc=uriapi")
|
||||||
|
Log.i("TAGG", url)
|
||||||
|
val webpage = WXWebpageObject()
|
||||||
|
webpage.webpageUrl = url
|
||||||
|
|
||||||
|
val msg = WXMediaMessage(webpage)
|
||||||
|
msg.title = desc
|
||||||
|
msg.description = desc
|
||||||
|
|
||||||
|
val req = SendMessageToWX.Req()
|
||||||
|
req.transaction = System.currentTimeMillis().toString()
|
||||||
|
req.message = msg
|
||||||
|
req.scene = SendMessageToWX.Req.WXSceneSession
|
||||||
|
|
||||||
|
api?.sendReq(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val fileBaseUrlListener = FileBaseUrlListener { UrlConfig.IMAGE_BASE_URL }
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
regToWx()
|
||||||
|
WeChatShareHelper.getInstance().setListener(shareToWeChatListener)
|
||||||
|
FileBaseUrlHelper.getInstance().setListener(fileBaseUrlListener)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun regToWx() {
|
||||||
|
// 通过 WXAPIFactory 工厂,获取 IWXAPI 的实例
|
||||||
|
api = WXAPIFactory.createWXAPI(this, APP_ID, false);
|
||||||
|
// 将应用的 appId 注册到微信
|
||||||
|
api?.registerApp(APP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
UpdateBuilder.create().check()// 启动更新任务
|
UpdateBuilder.create().check()// 启动更新任务
|
||||||
@@ -78,9 +128,9 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
|||||||
// main_tab_layout.setUnreadTip(TAG_INDEX, "99+")
|
// main_tab_layout.setUnreadTip(TAG_INDEX, "99+")
|
||||||
// main_tab_layout.setUnreadTip(TAG_COLLECT, null, false)
|
// main_tab_layout.setUnreadTip(TAG_COLLECT, null, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
// if(DataStoreManager.isLogin()){
|
// if(DataStoreManager.isLogin()){
|
||||||
// getAppViewModel().getIMSig(successCall = {
|
// getAppViewModel().getIMSig(successCall = {
|
||||||
@@ -269,15 +319,12 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
|||||||
super.onPause()
|
super.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
|
||||||
super.onSaveInstanceState(Bundle())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFragmentByTag(tabTag: String): Fragment? {
|
override fun getFragmentByTag(tabTag: String): Fragment? {
|
||||||
when (tabTag) {
|
when (tabTag) {
|
||||||
// TAG_GUIDANCE -> {
|
TAG_HOME -> {
|
||||||
// return HomeFragment()
|
return HomeFragment()
|
||||||
// }
|
}
|
||||||
|
|
||||||
TAG_GUIDANCE -> {
|
TAG_GUIDANCE -> {
|
||||||
return GuidanceFragment()
|
return GuidanceFragment()
|
||||||
@@ -310,6 +357,11 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun changeTab(index: Int) {
|
||||||
|
mBinding.mainTabLayout.changeTab(index)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun transparentStatusBar(): Boolean {
|
override fun transparentStatusBar(): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -403,6 +455,10 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
|||||||
mViewModel.selectTfHelper(event.doctor)
|
mViewModel.selectTfHelper(event.doctor)
|
||||||
println("头像id"+doctorId)
|
println("头像id"+doctorId)
|
||||||
}
|
}
|
||||||
|
}else if (event is HomeTabChangeEvent) {
|
||||||
|
if (event.index >= 0){
|
||||||
|
changeTab(event.index)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.lifecycle.ViewModelStore
|
import androidx.lifecycle.ViewModelStore
|
||||||
import androidx.lifecycle.ViewModelStoreOwner
|
import androidx.lifecycle.ViewModelStoreOwner
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.bumptech.glide.load.model.GlideUrl
|
|
||||||
import com.lzy.ninegrid.NineGridView
|
import com.lzy.ninegrid.NineGridView
|
||||||
import com.orhanobut.logger.AndroidLogAdapter
|
import com.orhanobut.logger.AndroidLogAdapter
|
||||||
import com.orhanobut.logger.Logger
|
import com.orhanobut.logger.Logger
|
||||||
@@ -47,7 +45,6 @@ import com.xjjk.healthyclients.utils.updateplugin.CustomDownloadNotifier
|
|||||||
import com.xjjk.healthyclients.utils.updateplugin.CustomInstallNotifier
|
import com.xjjk.healthyclients.utils.updateplugin.CustomInstallNotifier
|
||||||
import com.xjjk.healthyclients.utils.updateplugin.CustomUpdateNotifier
|
import com.xjjk.healthyclients.utils.updateplugin.CustomUpdateNotifier
|
||||||
import com.xjjk.healthyclients.view.AppraiseDialog
|
import com.xjjk.healthyclients.view.AppraiseDialog
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.lzh.framework.updatepluginlib.UpdateConfig
|
import org.lzh.framework.updatepluginlib.UpdateConfig
|
||||||
@@ -75,7 +72,8 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
|||||||
Log.i(TAG, "onCreate")
|
Log.i(TAG, "onCreate")
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
ConstantUtils.mIsCloseDialog=true
|
ConstantUtils.mIsCloseDialog=true
|
||||||
LocationMessageHolder.mapKey = "a87b89a2b4a32ed31da04d0996035cc1"
|
// LocationMessageHolder.mapKey = "a87b89a2b4a32ed31da04d0996035cc1"
|
||||||
|
LocationMessageHolder.mapKey = "e9926badd26aaa766d13439c88a83f2d"
|
||||||
Logger.addLogAdapter(AndroidLogAdapter())
|
Logger.addLogAdapter(AndroidLogAdapter())
|
||||||
appContext = this
|
appContext = this
|
||||||
DownloadFileUtil.init(this)
|
DownloadFileUtil.init(this)
|
||||||
@@ -98,9 +96,6 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
|||||||
registerActivityLifecycleCallbacks(AdjustLifecycleCallbacks())
|
registerActivityLifecycleCallbacks(AdjustLifecycleCallbacks())
|
||||||
val androidId = DevicesInfoUtils.getAndroidId(this)
|
val androidId = DevicesInfoUtils.getAndroidId(this)
|
||||||
println("设备id:${androidId}")
|
println("设备id:${androidId}")
|
||||||
if (UrlConfig.testDeviceList.contains(androidId)) {
|
|
||||||
UrlConfig.isTestDevice = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun attachBaseContext(base: Context) {
|
override fun attachBaseContext(base: Context) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.xjjk.healthyclients.R
|
|||||||
import com.xjjk.healthyclients.adapter.common.BaseDataBindingAdapter
|
import com.xjjk.healthyclients.adapter.common.BaseDataBindingAdapter
|
||||||
import com.xjjk.healthyclients.bean.CvdMainBean
|
import com.xjjk.healthyclients.bean.CvdMainBean
|
||||||
import com.xjjk.healthyclients.databinding.ItemCvdMainBinding
|
import com.xjjk.healthyclients.databinding.ItemCvdMainBinding
|
||||||
|
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||||
|
|
||||||
class CvdMainAdapter :
|
class CvdMainAdapter :
|
||||||
BaseDataBindingAdapter<CvdMainBean.dataBean, ItemCvdMainBinding>(
|
BaseDataBindingAdapter<CvdMainBean.dataBean, ItemCvdMainBinding>(
|
||||||
@@ -46,7 +47,7 @@ class CvdMainAdapter :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mBinding.valueTv.text = item.dataValue
|
mBinding.valueTv.text = item.dataValue.orEmptyDefault()
|
||||||
mBinding.nameTv.text = item.wdTypeName
|
mBinding.nameTv.text = item.wdTypeName
|
||||||
mBinding.dateTv.text = item.dataDate
|
mBinding.dateTv.text = item.dataDate
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.xjjk.healthyclients.adapter
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.bean.home.ArticleBean
|
||||||
|
import com.xjjk.healthyclients.superfuntion.loadRoundedImage
|
||||||
|
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康咨询列表 Adapter
|
||||||
|
*/
|
||||||
|
class HealthConsultationAdapter :
|
||||||
|
BaseQuickAdapter<ArticleBean, BaseViewHolder>(R.layout.item_health_consultation) {
|
||||||
|
|
||||||
|
override fun convert(holder: BaseViewHolder, item: ArticleBean) {
|
||||||
|
// 标题
|
||||||
|
holder.setText(R.id.tv_title, item.articleTitle.orEmptyDefault())
|
||||||
|
// 收藏和分享数
|
||||||
|
holder.setText(R.id.tv_meta, "收藏 ${item.favoriteCount} 分享 ${item.likeCount}")
|
||||||
|
// 封面图片 80x60 圆角8
|
||||||
|
holder.getView<ImageView>(R.id.iv_cover)?.loadRoundedImage(
|
||||||
|
item.articleHeaderimage, 8f,R.mipmap.ic_placeholder_rectangle
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.xjjk.healthyclients.adapter
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.sw.healthyclients.utils.DateUtil
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.bean.home.ArticleBean
|
||||||
|
import com.xjjk.healthyclients.superfuntion.loadRoundedImage
|
||||||
|
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康知识列表 Adapter
|
||||||
|
*/
|
||||||
|
class HealthKnowledgeAdapter :
|
||||||
|
BaseQuickAdapter<ArticleBean, BaseViewHolder>(R.layout.item_health_knowledge) {
|
||||||
|
|
||||||
|
override fun convert(holder: BaseViewHolder, item: ArticleBean) {
|
||||||
|
// 封面图片 100x100 圆角15
|
||||||
|
holder.getView<ImageView>(R.id.iv_cover)?.loadRoundedImage(
|
||||||
|
item.articleHeaderimage, 15f, R.mipmap.ic_placeholder_square,
|
||||||
|
)
|
||||||
|
// 标题
|
||||||
|
holder.setText(R.id.tv_title, item.articleTitle.orEmptyDefault())
|
||||||
|
// 摘要
|
||||||
|
holder.setText(R.id.tv_detail, item.articleSubtitle.orEmptyDefault(""))
|
||||||
|
// 标签文本
|
||||||
|
holder.setText(R.id.tv_tag, item.articleTag.orEmptyDefault())
|
||||||
|
// 日期
|
||||||
|
holder.setText(R.id.tv_date, DateUtil.long2ShortDateStr(item.createTime))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.xjjk.healthyclients.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.adapter.common.BaseDataBindingAdapter
|
||||||
|
import com.xjjk.healthyclients.bean.UserListBean
|
||||||
|
import com.xjjk.healthyclients.databinding.ItemUserListBinding
|
||||||
|
import com.xjjk.healthyclients.superfuntion.loadRoundedImage
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author nanfeifei
|
||||||
|
* @time 2023/7/17 16:40
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
class UserListAdapter : BaseDataBindingAdapter<UserListBean.RecordsDTO, ItemUserListBinding>(
|
||||||
|
R.layout.item_user_list
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: BaseDataBindingHolder<ItemUserListBinding>,
|
||||||
|
item: UserListBean.RecordsDTO
|
||||||
|
) {
|
||||||
|
val mBinding = holder.dataBinding
|
||||||
|
mBinding?.let {
|
||||||
|
it.tvAccount.text = item.username
|
||||||
|
it.tvName.text = item.realname
|
||||||
|
it.userNum.text = "员工编号:" + item.workNo + " 手机号:" + item.phone
|
||||||
|
it.userIdCard.text = "身份证号:" + item.idCard
|
||||||
|
if (!item.departTree.isNullOrEmpty()) {
|
||||||
|
if (item.departTree.size > 2) {
|
||||||
|
it.tvUnit.text = item.departTree.get(1)
|
||||||
|
it.tvClass.text = item.departTree.get(2)
|
||||||
|
} else if (item.departTree.size > 1) {
|
||||||
|
it.tvUnit.text = item.departTree.get(0)
|
||||||
|
it.tvClass.text = item.departTree.get(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it.ivHead.loadRoundedImage(item.avatar, 5.0f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xjjk.healthyclients.adapter.home
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.module.LoadMoreModule
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.sw.healthyclients.utils.DateUtil
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeNoticeBean
|
||||||
|
|
||||||
|
class HomeMessageAdapter :
|
||||||
|
BaseQuickAdapter<HomeNoticeBean, BaseViewHolder>(R.layout.item_home_message), LoadMoreModule {
|
||||||
|
|
||||||
|
override fun convert(holder: BaseViewHolder, item: HomeNoticeBean) {
|
||||||
|
holder.setText(R.id.tv_title, item.title)
|
||||||
|
.setText(R.id.tv_date, DateUtil.dateStrToStrMiddle(item.createTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.xjjk.healthyclients.bankRequest
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeBankBean
|
||||||
|
import com.xjjk.healthyclients.data.api.HomeApi
|
||||||
|
import com.xjjk.healthyclients.data.bean.ApiResponse
|
||||||
|
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||||
|
import com.xjjk.healthyclients.superfuntion.toJson
|
||||||
|
import com.xjjk.healthyclients.utils.SignatureUtils
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.Callback
|
||||||
|
import retrofit2.Response
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 银行积分网络请求封装类
|
||||||
|
* 负责处理签名生成、请求头构造、API 调用等逻辑
|
||||||
|
*/
|
||||||
|
class BankPointRequest(private val api: HomeApi) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取银行积分详情
|
||||||
|
*
|
||||||
|
* @param userId 用户 ID
|
||||||
|
* @param onSuccess 成功回调
|
||||||
|
* @param onFailure 失败回调
|
||||||
|
*/
|
||||||
|
fun getBankPointDetail(
|
||||||
|
userId: String,
|
||||||
|
onSuccess: (HomeBankBean?) -> Unit,
|
||||||
|
onFailure: (Throwable) -> Unit
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
// 生成时间戳(秒级)
|
||||||
|
val timestamp = System.currentTimeMillis() / 1000
|
||||||
|
|
||||||
|
// 构造请求体
|
||||||
|
val bodyString = """{"userId":"$userId"}"""
|
||||||
|
|
||||||
|
// 生成签名
|
||||||
|
val sign = SignatureUtils.generateSignature(
|
||||||
|
timestamp,
|
||||||
|
bodyString,
|
||||||
|
UrlConfig.SECRET_KEY
|
||||||
|
)
|
||||||
|
|
||||||
|
// 构造请求头
|
||||||
|
val headers = buildHeaders(timestamp, sign)
|
||||||
|
|
||||||
|
// 构造请求体 Map
|
||||||
|
val body = mapOf("userId" to userId)
|
||||||
|
|
||||||
|
// 发送请求
|
||||||
|
api.postUserPointDetail(headers, body.toJson().toRequestBody())
|
||||||
|
.enqueue(object : Callback<ApiResponse<HomeBankBean>> {
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<ApiResponse<HomeBankBean>>,
|
||||||
|
response: Response<ApiResponse<HomeBankBean>>
|
||||||
|
) {
|
||||||
|
if (response.code()==200) {
|
||||||
|
val data = response.body()?.data
|
||||||
|
onSuccess(data)
|
||||||
|
} else {
|
||||||
|
val error = Exception("HTTP ${response.code()}: ${response.message()}")
|
||||||
|
onFailure(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(call: Call<ApiResponse<HomeBankBean>>, t: Throwable) {
|
||||||
|
onFailure(t)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (e: Exception) {
|
||||||
|
onFailure(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造请求头
|
||||||
|
*
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @param sign 签名
|
||||||
|
* @return 请求头 Map
|
||||||
|
*/
|
||||||
|
private fun buildHeaders(timestamp: Long, sign: String): Map<String, String> {
|
||||||
|
return mapOf(
|
||||||
|
"Content-Type" to "application/json; charset=utf-8",
|
||||||
|
"X-Timestamp" to timestamp.toString(),
|
||||||
|
"X-Sign" to sign
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
package com.xjjk.healthyclients.bankRequest
|
||||||
|
|
||||||
|
import com.sw.healthyclients.data.local.DataStoreManager
|
||||||
|
import com.xjjk.healthyclients.bean.home.ArticleBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.ArticleListBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.CategoryBean
|
||||||
|
import com.xjjk.healthyclients.data.api.CategoryListResponse
|
||||||
|
import com.xjjk.healthyclients.data.api.HealthInfoApi
|
||||||
|
import com.xjjk.healthyclients.data.api.TokenResponse
|
||||||
|
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||||
|
import com.xjjk.healthyclients.retrofit.getBankRetrofit
|
||||||
|
import com.xjjk.healthyclients.superfuntion.toJson
|
||||||
|
import com.xjjk.healthyclients.utils.SignatureUtils
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.Callback
|
||||||
|
import retrofit2.Response
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康资讯网络请求封装类
|
||||||
|
* 负责 Token 获取(签名认证)、栏目列表、文章列表的 API 调用
|
||||||
|
*/
|
||||||
|
class HealthInfoRequest {
|
||||||
|
|
||||||
|
private val api: HealthInfoApi = getBankRetrofit()
|
||||||
|
.create(HealthInfoApi::class.java)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
/** 缓存的 Token,避免重复请求 */
|
||||||
|
private var cachedToken: String? = null
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 Token(带 HMAC-SHA256 签名)
|
||||||
|
*/
|
||||||
|
fun fetchToken(
|
||||||
|
onSuccess: (String) -> Unit,
|
||||||
|
onFailure: (Throwable) -> Unit
|
||||||
|
) {
|
||||||
|
// 如果已有缓存 Token,直接返回
|
||||||
|
cachedToken?.let {
|
||||||
|
onSuccess(it)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
val timestamp = System.currentTimeMillis() / 1000
|
||||||
|
val userId = DataStoreManager.getUserId() ?: ""
|
||||||
|
val workNo = DataStoreManager.getUserInfo()?.workNo ?: ""
|
||||||
|
val bodyString = """{"userId":"$userId","workNo":"$workNo"}"""
|
||||||
|
val sign = SignatureUtils.generateSignature(timestamp, bodyString, UrlConfig.SECRET_KEY)
|
||||||
|
|
||||||
|
val headers = mapOf(
|
||||||
|
"Content-Type" to "application/json; charset=utf-8",
|
||||||
|
"X-Timestamp" to timestamp.toString(),
|
||||||
|
"X-Sign" to sign
|
||||||
|
)
|
||||||
|
|
||||||
|
val body = mapOf("userId" to userId, "workNo" to workNo)
|
||||||
|
|
||||||
|
api.getToken(headers, body.toJson().toRequestBody())
|
||||||
|
.enqueue(object : Callback<TokenResponse> {
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<TokenResponse>,
|
||||||
|
response: Response<TokenResponse>
|
||||||
|
) {
|
||||||
|
if (response.code() == 200) {
|
||||||
|
val token = response.body()?.data?.token
|
||||||
|
if (!token.isNullOrEmpty()) {
|
||||||
|
cachedToken = token
|
||||||
|
onSuccess(token)
|
||||||
|
} else {
|
||||||
|
onFailure(Exception("Token 为空"))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
onFailure(Exception("HTTP ${response.code()}: ${response.message()}"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(
|
||||||
|
call: Call<TokenResponse>,
|
||||||
|
t: Throwable
|
||||||
|
) {
|
||||||
|
onFailure(t)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (e: Exception) {
|
||||||
|
onFailure(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取栏目列表
|
||||||
|
*/
|
||||||
|
fun fetchCategoryList(
|
||||||
|
token: String,
|
||||||
|
onSuccess: (MutableList<CategoryBean>) -> Unit,
|
||||||
|
onFailure: (Throwable) -> Unit
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
val headers = mapOf("token" to token)
|
||||||
|
|
||||||
|
api.getCategoryList(headers)
|
||||||
|
.enqueue(object : Callback<CategoryListResponse> {
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<CategoryListResponse>,
|
||||||
|
response: Response<CategoryListResponse>
|
||||||
|
) {
|
||||||
|
if (response.code() == 200) {
|
||||||
|
val data = response.body()?.data ?: mutableListOf()
|
||||||
|
onSuccess(data)
|
||||||
|
} else {
|
||||||
|
onFailure(Exception("HTTP ${response.code()}: ${response.message()}"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(
|
||||||
|
call: Call<CategoryListResponse>,
|
||||||
|
t: Throwable
|
||||||
|
) {
|
||||||
|
onFailure(t)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (e: Exception) {
|
||||||
|
onFailure(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询文章列表
|
||||||
|
*
|
||||||
|
* @param token 认证 Token
|
||||||
|
* @param categoryId 栏目 ID
|
||||||
|
* @param pageNum 页码
|
||||||
|
* @param pageSize 每页数量
|
||||||
|
* @param articleType 文章类型,"0"-图文,"1"-视频,不传则全部
|
||||||
|
*/
|
||||||
|
fun fetchArticleList(
|
||||||
|
token: String,
|
||||||
|
categoryId: Int,
|
||||||
|
pageNum: Int = 1,
|
||||||
|
pageSize: Int = 3,
|
||||||
|
onSuccess: (MutableList<ArticleBean>?) -> Unit,
|
||||||
|
onFailure: (Throwable) -> Unit
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
val headers = mapOf("token" to token)
|
||||||
|
val params = mapOf(
|
||||||
|
"categoryId" to categoryId.toString(),
|
||||||
|
"pageNum" to pageNum.toString(),
|
||||||
|
"pageSize" to pageSize.toString(),
|
||||||
|
"showAppHomepage" to "Y"
|
||||||
|
)
|
||||||
|
|
||||||
|
api.getArticleList(headers, params)
|
||||||
|
.enqueue(object : Callback<ArticleListBean> {
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<ArticleListBean>,
|
||||||
|
response: Response<ArticleListBean>
|
||||||
|
) {
|
||||||
|
if (response.code() == 200) {
|
||||||
|
val body = response.body()
|
||||||
|
onSuccess(body?.rows)
|
||||||
|
} else {
|
||||||
|
onFailure(Exception("HTTP ${response.code()}: ${response.message()}"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(call: Call<ArticleListBean>, t: Throwable) {
|
||||||
|
onFailure(t)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (e: Exception) {
|
||||||
|
onFailure(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 清除缓存的 Token(登录态变化时调用) */
|
||||||
|
fun clearToken() {
|
||||||
|
cachedToken = null
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,15 +70,6 @@ abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private
|
|||||||
var mEmpty: View?=null
|
var mEmpty: View?=null
|
||||||
var mRootView:RelativeLayout?=null
|
var mRootView:RelativeLayout?=null
|
||||||
|
|
||||||
/**
|
|
||||||
* 重写getResources()方法,让APP的字体不受系统设置字体大小影响
|
|
||||||
*/
|
|
||||||
override fun getResources(): Resources? {
|
|
||||||
val config = Configuration()
|
|
||||||
config.setToDefaults()
|
|
||||||
createConfigurationContext(config)
|
|
||||||
return super.getResources()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|||||||
@@ -56,15 +56,21 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
|||||||
private var mIsFirstLoading = true
|
private var mIsFirstLoading = true
|
||||||
var dialog: LoadingDialog? = null
|
var dialog: LoadingDialog? = null
|
||||||
protected lateinit var mViewModel: VM
|
protected lateinit var mViewModel: VM
|
||||||
lateinit var mBinding: B
|
|
||||||
|
/** ViewDataBinding 可空 backing field,onDestroyView 时置 null 防止内存泄漏 */
|
||||||
|
private var _mBinding: B? = null
|
||||||
|
|
||||||
|
/** 对外暴露的非空 getter,仅在 onCreateView ~ onDestroyView 生命周期内有效 */
|
||||||
|
val mBinding: B get() = _mBinding!!
|
||||||
|
|
||||||
var mEmpty: View? = null
|
var mEmpty: View? = null
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
mBinding = DataBindingUtil.inflate(inflater, contentViewResId, container, false)
|
_mBinding = DataBindingUtil.inflate(inflater, contentViewResId, container, false)
|
||||||
return mBinding.root
|
return _mBinding!!.root
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
@@ -306,13 +312,15 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
mBinding == null
|
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
|
// 置 null 释放 View 引用,防止 Fragment 回退栈期间内存泄漏
|
||||||
|
_mBinding = null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
if (!EventBus.getDefault().isRegistered(this)) {
|
// 已注册才执行注销,避免 EventBus 持有 Fragment 引用
|
||||||
|
if (EventBus.getDefault().isRegistered(this)) {
|
||||||
EventBus.getDefault().unregister(this)
|
EventBus.getDefault().unregister(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -350,12 +358,6 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
|||||||
activity?.startActivity(intent)
|
activity?.startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 历史遗留方法,懒得改以前的了,新页面无视即可
|
|
||||||
*/
|
|
||||||
open fun getStatusbarStyle(): Int {
|
|
||||||
return 0
|
|
||||||
} // 0 主题色+白字 1白底黑字
|
|
||||||
|
|
||||||
private fun createDialog() {
|
private fun createDialog() {
|
||||||
dialog = LoadingDialog(
|
dialog = LoadingDialog(
|
||||||
|
|||||||
@@ -1,113 +0,0 @@
|
|||||||
package com.xjjk.healthyclients.bean;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class CvdMainBean {
|
|
||||||
|
|
||||||
private ArrayList<dataBean> indexItemVos;
|
|
||||||
private String days;
|
|
||||||
private long distance;
|
|
||||||
private double aveSleep;
|
|
||||||
|
|
||||||
public ArrayList<dataBean> getIndexItemVos() {
|
|
||||||
return indexItemVos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIndexItemVos(ArrayList<dataBean> indexItemVos) {
|
|
||||||
this.indexItemVos = indexItemVos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDays() {
|
|
||||||
return days;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDays(String days) {
|
|
||||||
this.days = days;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getDistance() {
|
|
||||||
return distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDistance(long distance) {
|
|
||||||
this.distance = distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getAveSleep() {
|
|
||||||
return aveSleep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAveSleep(double aveSleep) {
|
|
||||||
this.aveSleep = aveSleep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class dataBean {
|
|
||||||
|
|
||||||
private String wdType;
|
|
||||||
private String wdTypeName;
|
|
||||||
private String dataDate;
|
|
||||||
private String dataValue;
|
|
||||||
private String warnMin;
|
|
||||||
private String warnMax;
|
|
||||||
|
|
||||||
public dataBean(String wdType, String wdTypeName,String dataDate,String dataValue) {
|
|
||||||
this.wdType = wdType;
|
|
||||||
this.wdTypeName = wdTypeName;
|
|
||||||
this.dataDate = dataDate;
|
|
||||||
this.dataValue = dataValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public dataBean() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWdType() {
|
|
||||||
return wdType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWdType(String wdType) {
|
|
||||||
this.wdType = wdType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWdTypeName() {
|
|
||||||
return wdTypeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWdTypeName(String wdTypeName) {
|
|
||||||
this.wdTypeName = wdTypeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDataDate() {
|
|
||||||
return dataDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataDate(String dataDate) {
|
|
||||||
this.dataDate = dataDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDataValue() {
|
|
||||||
return dataValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataValue(String dataValue) {
|
|
||||||
this.dataValue = dataValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWarnMin() {
|
|
||||||
return warnMin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWarnMin(String warnMin) {
|
|
||||||
this.warnMin = warnMin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWarnMax() {
|
|
||||||
return warnMax;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWarnMax(String warnMax) {
|
|
||||||
this.warnMax = warnMax;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.xjjk.healthyclients.bean
|
||||||
|
|
||||||
|
class CvdMainBean {
|
||||||
|
var indexItemVos: ArrayList<dataBean>? = null
|
||||||
|
var days: String? = null
|
||||||
|
var distance: Long = 0
|
||||||
|
var aveSleep: Double = 0.0
|
||||||
|
|
||||||
|
inner class dataBean(
|
||||||
|
var wdType: String?,
|
||||||
|
var wdTypeName: String?,
|
||||||
|
var dataDate: String?,
|
||||||
|
var dataValue: String?
|
||||||
|
) {
|
||||||
|
var warnMin: String? = null
|
||||||
|
var warnMax: String? = null
|
||||||
|
var dataMax: String? = null
|
||||||
|
var dataMin: String? = null
|
||||||
|
var dataAvg: String? = null
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.xjjk.healthyclients.bean
|
||||||
|
|
||||||
|
class CvdMainBeanNew {
|
||||||
|
var indexItemVos: ArrayList<CvdMainBean.dataBean>? = null
|
||||||
|
var days: String? = null
|
||||||
|
var distance: Long = 0
|
||||||
|
var aveSleep: Double = 0.0
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.xjjk.healthyclients.bean.emergency
|
||||||
|
|
||||||
|
data class GroupInfo(
|
||||||
|
val orderId: String,
|
||||||
|
val sessionId: String,
|
||||||
|
val salvageUserName: String,
|
||||||
|
val salvageUserSex: String,
|
||||||
|
val salvageUserAvatar: String,
|
||||||
|
val salvageUserAge: Int,
|
||||||
|
val salvageUserMobile: String,
|
||||||
|
val orgName: String,
|
||||||
|
val deptName: String,
|
||||||
|
val orderStatus: String,
|
||||||
|
val initTime: String
|
||||||
|
)
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.xjjk.healthyclients.bean.home
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 token 响应
|
||||||
|
*/
|
||||||
|
data class TokenBean(
|
||||||
|
@SerializedName("token") val token: String? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 栏目分类
|
||||||
|
*/
|
||||||
|
data class CategoryBean(
|
||||||
|
@SerializedName("categoryId") val categoryId: Int = 0,
|
||||||
|
@SerializedName("categoryName") val categoryName: String? = null,
|
||||||
|
@SerializedName("categoryStatus") val categoryStatus: String? = null,
|
||||||
|
@SerializedName("children") val children: MutableList<CategoryBean>? = null,
|
||||||
|
@SerializedName("parentId") val parentId: Int = 0,
|
||||||
|
@SerializedName("sortOrder") val sortOrder: Int = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章
|
||||||
|
*/
|
||||||
|
data class ArticleBean(
|
||||||
|
@SerializedName("articleId") val articleId: Int = 0,
|
||||||
|
@SerializedName("articleTitle") val articleTitle: String? = null,
|
||||||
|
@SerializedName("articleSubtitle") val articleSubtitle: String? = null,
|
||||||
|
@SerializedName("articleTag") val articleTag: String? = null,
|
||||||
|
@SerializedName("articleHeaderimage") val articleHeaderimage: String? = null,
|
||||||
|
@SerializedName("articleType") val articleType: String? = null,
|
||||||
|
@SerializedName("articleExcerpt") val articleExcerpt: String? = null,
|
||||||
|
@SerializedName("articleContent") val articleContent: String? = null,
|
||||||
|
@SerializedName("articleVideo") val articleVideo: String? = null,
|
||||||
|
@SerializedName("favoriteCount") val favoriteCount: Int = 0,
|
||||||
|
@SerializedName("likeCount") val likeCount: Int = 0,
|
||||||
|
@SerializedName("viewCount") val viewCount: Int = 0,
|
||||||
|
@SerializedName("createTime") val createTime: String? = null,
|
||||||
|
@SerializedName("categoryId") val categoryId: Int = 0,
|
||||||
|
@SerializedName("articleScore") val articleScore: Double = 0.0,
|
||||||
|
@SerializedName("articleStatus") val articleStatus: String? = null,
|
||||||
|
@SerializedName("showAppHomepage") val showAppHomepage: String? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章列表分页响应
|
||||||
|
*/
|
||||||
|
data class ArticleListBean(
|
||||||
|
@SerializedName("rows") val rows: MutableList<ArticleBean>? = null,
|
||||||
|
@SerializedName("total") val total: Int = 0
|
||||||
|
)
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
package com.xjjk.healthyclients.bean.home
|
||||||
|
|
||||||
|
|
||||||
|
data class HomeNoticeBean(
|
||||||
|
val content: String,
|
||||||
|
val createBy: String,
|
||||||
|
val createTime: String,
|
||||||
|
val delFlag: String,
|
||||||
|
val departScopeList: List<DepartScope>,
|
||||||
|
val endTime: String,
|
||||||
|
val id: String,
|
||||||
|
val noticeStatus: Int,
|
||||||
|
val orgCode: String,
|
||||||
|
val scopeType: Int,
|
||||||
|
val startTime: String,
|
||||||
|
val title: String,
|
||||||
|
val updateBy: String,
|
||||||
|
val updateTime: String,
|
||||||
|
val userScopeList: List<DepartScope>,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class DepartScope(
|
||||||
|
val id: String,
|
||||||
|
val noticeId: String,
|
||||||
|
val record: String,
|
||||||
|
val scopeId: String,
|
||||||
|
val type: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
data class HomeBannerBean(
|
||||||
|
val createBy: String,
|
||||||
|
val createTime: String,
|
||||||
|
val delFlag: String,
|
||||||
|
val endTime: String,
|
||||||
|
val id: String,
|
||||||
|
val isLongTermEffective: String,
|
||||||
|
val jumpUrl: String,
|
||||||
|
val memo: String,
|
||||||
|
val name: String,
|
||||||
|
val pageNo: Int,
|
||||||
|
val pageSize: Int,
|
||||||
|
val photoUrl: String?,
|
||||||
|
val showLocation: String,
|
||||||
|
val sort: Int,
|
||||||
|
val startTime: String,
|
||||||
|
val status: String,
|
||||||
|
val tfJump: String,
|
||||||
|
val updateBy: String,
|
||||||
|
val updateTime: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class EncryptInfoBean(
|
||||||
|
val encryptData: String?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class HomeBankBean(
|
||||||
|
val todayPoints: String?,
|
||||||
|
val totalPoints: String?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class ProposalBean(
|
||||||
|
val id: String,
|
||||||
|
val empId: String,
|
||||||
|
val name: String,
|
||||||
|
val age: Int,
|
||||||
|
val sexCode: String?,
|
||||||
|
val workUnit: String?,
|
||||||
|
val careLiaisonName: String?,
|
||||||
|
val idNo: String?,
|
||||||
|
val phone: String?,
|
||||||
|
val careStatus: String,
|
||||||
|
val dataLevel: Int,
|
||||||
|
val negativeList: String,
|
||||||
|
val caseInfo: String,
|
||||||
|
val riskLevel: String,
|
||||||
|
val year: String,
|
||||||
|
val flagFat: Int,
|
||||||
|
val bmi: String,
|
||||||
|
val height: String,
|
||||||
|
val weight: String,
|
||||||
|
val targetWeight: String,
|
||||||
|
val targetBmi: String,
|
||||||
|
val bmiCurrent: String,
|
||||||
|
val waistNew: String,
|
||||||
|
val bodyFatPercentNew: String,
|
||||||
|
val weightRiskType: String,
|
||||||
|
val hypertension: Int,
|
||||||
|
val systolicPressureAvg: String?,
|
||||||
|
val systolicPressureTarget: String?,
|
||||||
|
val systolicPressureCurrent: String?,
|
||||||
|
val diastolicPressureAvg: String?,
|
||||||
|
val diastolicPressureTarget: String?,
|
||||||
|
val diastolicPressureCurrent: String?,
|
||||||
|
val diabetes: Int,
|
||||||
|
val glu: String,
|
||||||
|
val bloodSugarTarget: String?,
|
||||||
|
val bloodSugarCurrent: String?,
|
||||||
|
val ldl: String,
|
||||||
|
val ldlTarget: String,
|
||||||
|
val tc: String,
|
||||||
|
val tcTarget: String,
|
||||||
|
val tg: String,
|
||||||
|
val tgTarget: String,
|
||||||
|
val uricAcid: String,
|
||||||
|
val uricAcidTarget: String,
|
||||||
|
val homocysteine: String,
|
||||||
|
val homocysteineTarget: String,
|
||||||
|
val bloodK: String,
|
||||||
|
val chd: String,
|
||||||
|
val cvd: String,
|
||||||
|
val af: String,
|
||||||
|
val ca: String,
|
||||||
|
val indicatorListStr: String,
|
||||||
|
val indicatorListStrOrigin: String,
|
||||||
|
val screeningProjects: String,
|
||||||
|
val treatPlan: String,
|
||||||
|
val treatPlanResponse: String,
|
||||||
|
val dietSuggestion: String,
|
||||||
|
val dietSuggestionResponse: String,
|
||||||
|
val sportGuide: String,
|
||||||
|
val sportGuideResponse: String,
|
||||||
|
val lifeManage: String,
|
||||||
|
val lifeManageResponse: String,
|
||||||
|
val cabinOpinion: String?,
|
||||||
|
val cabinOpinionTime: String,
|
||||||
|
val cabinOpinionUserName: String,
|
||||||
|
val expertOpinion: String?,
|
||||||
|
val expertOpinionTime: String,
|
||||||
|
val expertOpinionUserName: String
|
||||||
|
)
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.xjjk.healthyclients.bean.home
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页-手表数据
|
||||||
|
*/
|
||||||
|
class HomeWatchAllDataBean {
|
||||||
|
var name: String? = null
|
||||||
|
var latest: String? = null
|
||||||
|
var max: String? = null
|
||||||
|
var min: String? = null
|
||||||
|
var avg: String? = null
|
||||||
|
var type: Int? = null
|
||||||
|
|
||||||
|
var latestTime: String? = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
data class WatchInfoBean(
|
||||||
|
val bindDate: String,
|
||||||
|
val hasWatch: Boolean,
|
||||||
|
val lastUploadDate: String,
|
||||||
|
val watchModel: String,
|
||||||
|
val watchNo: String
|
||||||
|
)
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.xjjk.healthyclients.bean.user
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的积分
|
||||||
|
*/
|
||||||
|
data class UserPointBean(
|
||||||
|
|
||||||
|
val addPointsSum: Int,
|
||||||
|
val exchangePointsSum: Int,
|
||||||
|
val points: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
data class PointDetailBean<T>(
|
||||||
|
val current: Int,
|
||||||
|
val pages: Int,
|
||||||
|
val records: MutableList<T>?,
|
||||||
|
val size: Int,
|
||||||
|
val total: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分明细
|
||||||
|
*/
|
||||||
|
data class PointRecord(
|
||||||
|
val businessInfo: String,
|
||||||
|
val createMonthStr: String,
|
||||||
|
val createTime: String,
|
||||||
|
val id: Int,
|
||||||
|
val points: Int,
|
||||||
|
val remark: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分榜
|
||||||
|
*/
|
||||||
|
data class PointRank(
|
||||||
|
val avatar: String,
|
||||||
|
val deptName: String,
|
||||||
|
val orgName: String,
|
||||||
|
val pointSum: Int,
|
||||||
|
val ranking: Int,
|
||||||
|
val realName: String,
|
||||||
|
val sex: Int,
|
||||||
|
val userId: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分打卡-入参
|
||||||
|
*/
|
||||||
|
data class CheckInBean(
|
||||||
|
val businessId: Int,
|
||||||
|
val points: Int,
|
||||||
|
val remark: String,
|
||||||
|
val sourceType: String,
|
||||||
|
val userId: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分任务
|
||||||
|
*/
|
||||||
|
data class PointsTask(
|
||||||
|
val clockInStatus: Int,
|
||||||
|
val frequency: Int,
|
||||||
|
val icon: String,
|
||||||
|
val points: Int,
|
||||||
|
val ruleCategory: Int,
|
||||||
|
val ruleDesc: String,
|
||||||
|
val ruleId: Int
|
||||||
|
)
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
package com.xjjk.healthyclients.data.api
|
package com.xjjk.healthyclients.data.api
|
||||||
|
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.EmployeeBean
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.ExpertBean
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.GroupMemberBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.BigDiseaseBean
|
import com.xjjk.healthyclients.bean.emergency.BigDiseaseBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.BigDiseaseDetailsBean
|
import com.xjjk.healthyclients.bean.emergency.BigDiseaseDetailsBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo
|
import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo
|
||||||
import com.xjjk.healthyclients.bean.emergency.GetOrderBySessionIdBean
|
import com.xjjk.healthyclients.bean.emergency.GetOrderBySessionIdBean
|
||||||
|
import com.xjjk.healthyclients.bean.emergency.GroupInfo
|
||||||
import com.xjjk.healthyclients.bean.emergency.HospitalBean
|
import com.xjjk.healthyclients.bean.emergency.HospitalBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.LocationResourceBean
|
import com.xjjk.healthyclients.bean.emergency.LocationResourceBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.OrderThroughBean
|
import com.xjjk.healthyclients.bean.emergency.OrderThroughBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean
|
import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.ProposalBean
|
||||||
import com.xjjk.healthyclients.data.bean.ApiResponse
|
import com.xjjk.healthyclients.data.bean.ApiResponse
|
||||||
|
import com.xjjk.healthyclients.data.bean.PageBean
|
||||||
import okhttp3.RequestBody
|
import okhttp3.RequestBody
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
@@ -82,5 +88,51 @@ interface EmergencyApi {
|
|||||||
*/
|
*/
|
||||||
@GET("/health-emergency/api/emergency/createGroupMag")
|
@GET("/health-emergency/api/emergency/createGroupMag")
|
||||||
suspend fun getIMGroupInfo(@QueryMap params: MutableMap<String, Any?>): ApiResponse<EmergencyGroupInfo>
|
suspend fun getIMGroupInfo(@QueryMap params: MutableMap<String, Any?>): ApiResponse<EmergencyGroupInfo>
|
||||||
|
/**
|
||||||
|
* 获取急救员群组信息
|
||||||
|
*/
|
||||||
|
@GET("/health-emergency/api/emergency/createGroupMagFirstAider")
|
||||||
|
suspend fun getParamedicGroupInfo(@QueryMap params: MutableMap<String, Any?>): ApiResponse<EmergencyGroupInfo>
|
||||||
|
/**
|
||||||
|
* 搜索专家(专业人员)
|
||||||
|
*/
|
||||||
|
@GET("/health-emergency/api/emergency/order/searchExpert")
|
||||||
|
suspend fun searchExpert(@QueryMap params: MutableMap<String, Any?>): ApiResponse<PageBean<ExpertBean>>
|
||||||
|
/**
|
||||||
|
* 搜索员工
|
||||||
|
*/
|
||||||
|
@GET("/health-emergency/api/emergency/order/searchEmployee")
|
||||||
|
suspend fun searchEmployee(@QueryMap params: MutableMap<String, Any?>): ApiResponse<PageBean<EmployeeBean>>
|
||||||
|
/**
|
||||||
|
* 实际群成员列表
|
||||||
|
*/
|
||||||
|
@GET("/health-emergency/api/emergency/order/getActualGroupMemberList")
|
||||||
|
suspend fun getActualGroupMemberList(@QueryMap params: MutableMap<String, Any?>): ApiResponse<List<GroupMemberBean>>
|
||||||
|
/**
|
||||||
|
* 邀请进群
|
||||||
|
*/
|
||||||
|
@POST("/health-emergency/api/emergency/addGroupUser")
|
||||||
|
suspend fun addGroupUser(@Body requestBody: RequestBody): ApiResponse<Boolean>
|
||||||
|
/**
|
||||||
|
* 移除群成员
|
||||||
|
*/
|
||||||
|
@POST("/health-emergency/api/emergency/removeGroupUser")
|
||||||
|
suspend fun removeGroupUser(@Body requestBody: RequestBody): ApiResponse<Boolean>
|
||||||
|
/**
|
||||||
|
* 获取一人一案
|
||||||
|
*/
|
||||||
|
@GET("/health-emergency/emergency/LargeScreenNew/onePersonCase")
|
||||||
|
suspend fun getProposalInfo(): ApiResponse<ProposalBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关爱联络员身份判断
|
||||||
|
*/
|
||||||
|
@GET("/health-emergency/emergency/LargeScreenNew/isLiaisonUser")
|
||||||
|
suspend fun isLiaisonUser(): ApiResponse<Boolean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前登录人参与的应急工单列表
|
||||||
|
*/
|
||||||
|
@GET("/health-emergency/api/emergency/order/myParticipatedOrders")
|
||||||
|
suspend fun getParticipatedOrders (): ApiResponse<PageBean<GroupInfo>>
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.xjjk.healthyclients.data.api
|
package com.xjjk.healthyclients.data.api
|
||||||
|
|
||||||
import com.xjjk.healthyclients.bean.CvdMainBean
|
import com.xjjk.healthyclients.bean.CvdMainBeanNew
|
||||||
import com.xjjk.healthyclients.bean.CvdRiskInfoBean
|
|
||||||
import com.xjjk.healthyclients.bean.CvdWarningHistoryBean
|
import com.xjjk.healthyclients.bean.CvdWarningHistoryBean
|
||||||
import com.xjjk.healthyclients.retrofit.intervention.CustomInterventionResponseResult
|
import com.xjjk.healthyclients.retrofit.intervention.CustomInterventionResponseResult
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
@@ -203,8 +202,10 @@ interface HealthCheckNetApi {
|
|||||||
/**
|
/**
|
||||||
* 查询心血管首页数据
|
* 查询心血管首页数据
|
||||||
*/
|
*/
|
||||||
@GET("health-watch/watchH5Api/indexDataNew")
|
// @GET("health-watch/watchH5Api/indexDataNew")
|
||||||
fun getCvdHomeData(@Query("userId") userId: String): Call<CustomInterventionResponseResult<CvdMainBean>>
|
// fun getCvdHomeData(@Query("userId") userId: String): Call<CustomInterventionResponseResult<CvdMainBean>>
|
||||||
|
@GET("health-watch/watchH5Api/indexDataNew/v2")
|
||||||
|
fun getCvdHomeData(@Query("userId") userId: String): Call<CustomInterventionResponseResult<CvdMainBeanNew>>
|
||||||
// /**
|
// /**
|
||||||
// * 防范心梗 查询是否填写问卷
|
// * 防范心梗 查询是否填写问卷
|
||||||
// */
|
// */
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.xjjk.healthyclients.data.api
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.bean.home.ArticleListBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.CategoryBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.TokenBean
|
||||||
|
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||||
|
import okhttp3.RequestBody
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.http.Body
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.HeaderMap
|
||||||
|
import retrofit2.http.POST
|
||||||
|
import retrofit2.http.QueryMap
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康资讯 API 接口(使用银行 Retrofit 实例,baseUrl 为 getDefaultBankBaseUrl())
|
||||||
|
*/
|
||||||
|
interface HealthInfoApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 Token(带签名认证)
|
||||||
|
*/
|
||||||
|
@POST("${UrlConfig.middleCheck}pe/frontend/init")
|
||||||
|
fun getToken(
|
||||||
|
@HeaderMap headers: Map<String, String>,
|
||||||
|
@Body requestBody: RequestBody
|
||||||
|
): Call<TokenResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取栏目列表
|
||||||
|
*/
|
||||||
|
@GET("${UrlConfig.middleCheck}cms/frontend/category/list")
|
||||||
|
fun getCategoryList(
|
||||||
|
@HeaderMap headers: Map<String, String>
|
||||||
|
): Call<CategoryListResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询文章列表
|
||||||
|
*/
|
||||||
|
@GET("${UrlConfig.middleCheck}cms/frontend/articleList")
|
||||||
|
fun getArticleList(
|
||||||
|
@HeaderMap headers: Map<String, String>,
|
||||||
|
@QueryMap params: Map<String, String>
|
||||||
|
): Call<ArticleListBean>
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Token 接口响应外层
|
||||||
|
*/
|
||||||
|
data class TokenResponse(
|
||||||
|
val msg: String? = null,
|
||||||
|
val code: Int = 0,
|
||||||
|
val data: TokenBean? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 栏目列表接口响应外层
|
||||||
|
*/
|
||||||
|
data class CategoryListResponse(
|
||||||
|
val msg: String? = null,
|
||||||
|
val code: Int = 0,
|
||||||
|
val data: MutableList<CategoryBean>? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package com.xjjk.healthyclients.data.api
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.bean.home.EncryptInfoBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeBankBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeBannerBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeNoticeBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeWatchAllDataBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.WatchInfoBean
|
||||||
|
import com.xjjk.healthyclients.bean.user.CheckInBean
|
||||||
|
import com.xjjk.healthyclients.bean.user.PointDetailBean
|
||||||
|
import com.xjjk.healthyclients.bean.user.PointRank
|
||||||
|
import com.xjjk.healthyclients.bean.user.PointRecord
|
||||||
|
import com.xjjk.healthyclients.bean.user.PointsTask
|
||||||
|
import com.xjjk.healthyclients.bean.user.UserPointBean
|
||||||
|
import com.xjjk.healthyclients.data.bean.ApiResponse
|
||||||
|
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||||
|
import okhttp3.RequestBody
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.http.Body
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.HeaderMap
|
||||||
|
import retrofit2.http.POST
|
||||||
|
import retrofit2.http.QueryMap
|
||||||
|
|
||||||
|
interface HomeApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取首页消息通知列表
|
||||||
|
*/
|
||||||
|
@GET("/health-system/app/sys/message/notice/list")
|
||||||
|
suspend fun getHomeNoticeList(@QueryMap params: MutableMap<String, Any?>): ApiResponse<MutableList<HomeNoticeBean>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息通知-通过id查询
|
||||||
|
*/
|
||||||
|
@GET("/health-system/app/sys/message/notice/queryById")
|
||||||
|
suspend fun getHomeNoticeDetail(@QueryMap params: MutableMap<String, Any?>): ApiResponse<HomeNoticeBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页banner
|
||||||
|
*/
|
||||||
|
// @GET("/sys/api/banner/selectBannerList")
|
||||||
|
@GET("/sys/api/banner/selectAllBannerList")
|
||||||
|
suspend fun getHomeBannerList(@QueryMap params: MutableMap<String, Any?>): ApiResponse<MutableList<HomeBannerBean>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分信息-我的积分
|
||||||
|
*/
|
||||||
|
@GET("/health-system/bank/userPoints/app/myPoints")
|
||||||
|
suspend fun getUserPoints(@QueryMap params: MutableMap<String, Any?>): ApiResponse<MutableList<UserPointBean>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分信息-积分任务
|
||||||
|
*/
|
||||||
|
@GET("/health-system/bank/userPoints/app/pointsTaskList")
|
||||||
|
suspend fun getUserPointsTask(@QueryMap params: MutableMap<String, Any?>): ApiResponse<PointsTask>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分信息-积分明细
|
||||||
|
*/
|
||||||
|
@POST("/health-system/bank/userPoints/app/pointRecord")
|
||||||
|
suspend fun postUserPointsRecord(@Body requestBody: RequestBody): ApiResponse<PointDetailBean<PointRecord>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分信息-积分榜
|
||||||
|
*/
|
||||||
|
@POST("/health-system/bank/userPoints/app/pointRanking")
|
||||||
|
suspend fun postUserPointsRank(@Body requestBody: RequestBody): ApiResponse<PointDetailBean<PointRank>>
|
||||||
|
/**
|
||||||
|
* 用户积分信息-积分打卡
|
||||||
|
*/
|
||||||
|
@POST("/health-system/bank/userPoints/app/pointCheckIn")
|
||||||
|
suspend fun postUserPointsCheckIn(@Body requestBody: RequestBody): ApiResponse<CheckInBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心理帮助图片url
|
||||||
|
*/
|
||||||
|
@GET("/health-consultation/consultation/conSession/getPicUrl")
|
||||||
|
suspend fun getConSessionPicUrl(@QueryMap params: MutableMap<String, Any?>): ApiResponse<String>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页-用户手表数据
|
||||||
|
*/
|
||||||
|
@GET("/health-watch/api/watchData/userWatchDataAll")
|
||||||
|
suspend fun getHomeWatchData(@QueryMap params: MutableMap<String, Any?>): ApiResponse<MutableList<HomeWatchAllDataBean>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页-用户是否有手表
|
||||||
|
*/
|
||||||
|
@GET("/health-watch/api/watchData/findWatchInfo")
|
||||||
|
suspend fun getHomeWatchInfo(@QueryMap params: MutableMap<String, Any?>): ApiResponse<WatchInfoBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* weburl参数加密
|
||||||
|
*/
|
||||||
|
@GET("/health-system/api/sys/encryptInfo")
|
||||||
|
suspend fun getSysEnCryptInfo(@QueryMap params: MutableMap<String, Any?>): ApiResponse<EncryptInfoBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定手表
|
||||||
|
*/
|
||||||
|
@GET("/health-watch/watch/watchDevice/app/bindDevice")
|
||||||
|
suspend fun getBindDevice(@QueryMap params: MutableMap<String, Any?>): ApiResponse<String>
|
||||||
|
/**
|
||||||
|
* 解绑手表
|
||||||
|
*/
|
||||||
|
@GET("/health-watch/watch/watchDevice/app/unbundleDevice")
|
||||||
|
suspend fun getUnbundleDevice(@QueryMap params: MutableMap<String, Any?>): ApiResponse<String>
|
||||||
|
/**
|
||||||
|
* 获取首页银行积分
|
||||||
|
*/
|
||||||
|
@POST("${UrlConfig.middle}api/v1/users/point-details")
|
||||||
|
fun postUserPointDetail(@HeaderMap headers :Map<String, String>, @Body requestBody: RequestBody): Call<ApiResponse<HomeBankBean>>
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.xjjk.healthyclients.data.api
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.bean.UserListBean
|
||||||
|
import com.xjjk.healthyclients.data.bean.ApiResponse
|
||||||
|
import okhttp3.RequestBody
|
||||||
|
import retrofit2.http.Body
|
||||||
|
import retrofit2.http.FieldMap
|
||||||
|
import retrofit2.http.FormUrlEncoded
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.POST
|
||||||
|
import retrofit2.http.QueryMap
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author nanfeifei
|
||||||
|
* @time 2023/5/24 15:08
|
||||||
|
* @description 工作台接口定义
|
||||||
|
*/
|
||||||
|
interface OtherApi {
|
||||||
|
/**
|
||||||
|
* 获取模拟用户列表
|
||||||
|
*/
|
||||||
|
@GET("/health-system/sys/user/listAll")
|
||||||
|
suspend fun listAll(@QueryMap params: MutableMap<String, Any?>): ApiResponse<UserListBean>
|
||||||
|
/**
|
||||||
|
* 模拟用户信息
|
||||||
|
*/
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("/health-system/test/fake")
|
||||||
|
suspend fun fake(@FieldMap params: MutableMap<String, Any?>): ApiResponse<Boolean>
|
||||||
|
/**
|
||||||
|
* 获取模拟用户信息
|
||||||
|
*/
|
||||||
|
@POST("/health-system/test/fakeUser")
|
||||||
|
suspend fun fakeUser(@Body requestBody: RequestBody): ApiResponse<UserListBean.RecordsDTO>
|
||||||
|
/**
|
||||||
|
* 重置模拟
|
||||||
|
*/
|
||||||
|
@POST("/health-system/test/restore")
|
||||||
|
suspend fun restore(@Body requestBody: RequestBody): ApiResponse<Boolean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验token是否过期
|
||||||
|
*/
|
||||||
|
@GET("/health-consultation/api/consult/msgRecord/selectTokenExpire")
|
||||||
|
suspend fun selectTokenExpire(@QueryMap params: MutableMap<String, Any?>): ApiResponse<Boolean>
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.xjjk.healthyclients.data.bean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用分页数据包装类
|
||||||
|
*
|
||||||
|
* 用于后端返回 MyBatis-Plus 风格的分页结构,实际列表数据位于 [records] 字段中。
|
||||||
|
*
|
||||||
|
* @param T 列表元素类型
|
||||||
|
*/
|
||||||
|
data class PageBean<T>(
|
||||||
|
/** 数据列表 */
|
||||||
|
val records: List<T>?,
|
||||||
|
/** 总记录数 */
|
||||||
|
val total: Int = 0,
|
||||||
|
/** 每页大小 */
|
||||||
|
val size: Int = 0,
|
||||||
|
/** 当前页码 */
|
||||||
|
val current: Int = 0,
|
||||||
|
/** 总页数 */
|
||||||
|
val pages: Int = 0
|
||||||
|
)
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.xjjk.healthyclients.data.repository
|
package com.xjjk.healthyclients.data.repository
|
||||||
|
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.EmployeeBean
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.ExpertBean
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.GroupMemberBean
|
||||||
import com.xjjk.healthyclients.base.repository.BaseRepository
|
import com.xjjk.healthyclients.base.repository.BaseRepository
|
||||||
import com.xjjk.healthyclients.bean.CommonSettingMenuBean
|
import com.xjjk.healthyclients.bean.CommonSettingMenuBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.AddBigDiseaseSubmitBean
|
import com.xjjk.healthyclients.bean.emergency.AddBigDiseaseSubmitBean
|
||||||
@@ -7,12 +10,15 @@ import com.xjjk.healthyclients.bean.emergency.BigDiseaseBean
|
|||||||
import com.xjjk.healthyclients.bean.emergency.BigDiseaseDetailsBean
|
import com.xjjk.healthyclients.bean.emergency.BigDiseaseDetailsBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo
|
import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo
|
||||||
import com.xjjk.healthyclients.bean.emergency.GetOrderBySessionIdBean
|
import com.xjjk.healthyclients.bean.emergency.GetOrderBySessionIdBean
|
||||||
|
import com.xjjk.healthyclients.bean.emergency.GroupInfo
|
||||||
import com.xjjk.healthyclients.bean.emergency.HospitalBean
|
import com.xjjk.healthyclients.bean.emergency.HospitalBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.LocationResourceBean
|
import com.xjjk.healthyclients.bean.emergency.LocationResourceBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.OrderThroughBean
|
import com.xjjk.healthyclients.bean.emergency.OrderThroughBean
|
||||||
import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean
|
import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.ProposalBean
|
||||||
import com.xjjk.healthyclients.data.api.EmergencyApi
|
import com.xjjk.healthyclients.data.api.EmergencyApi
|
||||||
import com.xjjk.healthyclients.data.bean.ApiResponse
|
import com.xjjk.healthyclients.data.bean.ApiResponse
|
||||||
|
import com.xjjk.healthyclients.data.bean.PageBean
|
||||||
import com.xjjk.healthyclients.retrofit.RetrofitManager
|
import com.xjjk.healthyclients.retrofit.RetrofitManager
|
||||||
import com.xjjk.healthyclients.retrofit.RetrofitManager.toRequestBody
|
import com.xjjk.healthyclients.retrofit.RetrofitManager.toRequestBody
|
||||||
import com.xjjk.healthyclients.superfuntion.toJson
|
import com.xjjk.healthyclients.superfuntion.toJson
|
||||||
@@ -107,8 +113,6 @@ object EmergencyRepository : BaseRepository() {
|
|||||||
return CommonRepository.getCommonSettingMenuList("category")
|
return CommonRepository.getCommonSettingMenuList("category")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
suspend fun getIMGroupInfo(groupName: String, longitude: Double,
|
suspend fun getIMGroupInfo(groupName: String, longitude: Double,
|
||||||
latitude: Double): ApiResponse<EmergencyGroupInfo> {
|
latitude: Double): ApiResponse<EmergencyGroupInfo> {
|
||||||
var map = mutableMapOf<String, Any?>()
|
var map = mutableMapOf<String, Any?>()
|
||||||
@@ -118,4 +122,68 @@ object EmergencyRepository : BaseRepository() {
|
|||||||
return apiCall { service.getIMGroupInfo(map) }
|
return apiCall { service.getIMGroupInfo(map) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getParamedicGroupInfo(groupName: String, longitude: Double,
|
||||||
|
latitude: Double): ApiResponse<EmergencyGroupInfo> {
|
||||||
|
var map = mutableMapOf<String, Any?>()
|
||||||
|
map["longitude"] = longitude
|
||||||
|
map["latitude"] = latitude
|
||||||
|
map["name"] = groupName //群聊名称改为后台生成
|
||||||
|
return apiCall { service.getParamedicGroupInfo(map) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun searchExpert(realname: String, centerId: String, excludeSessionId: String, pageNo: Int, pageSize: Int): ApiResponse<PageBean<ExpertBean>> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["realname"] = realname
|
||||||
|
map["centerId"] = centerId
|
||||||
|
map["excludeSessionId"] = excludeSessionId
|
||||||
|
map["pageNo"] = pageNo
|
||||||
|
map["pageSize"] = pageSize
|
||||||
|
return apiCall { service.searchExpert(map) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun searchEmployee(realname: String, orgCode: String, workNo: String, phone: String, excludeSessionId: String, pageNo: Int, pageSize: Int): ApiResponse<PageBean<EmployeeBean>> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["realname"] = realname
|
||||||
|
map["orgCode"] = orgCode
|
||||||
|
map["workNo"] = workNo
|
||||||
|
map["phone"] = phone
|
||||||
|
map["excludeSessionId"] = excludeSessionId
|
||||||
|
map["pageNo"] = pageNo
|
||||||
|
map["pageSize"] = pageSize
|
||||||
|
return apiCall { service.searchEmployee(map) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getActualGroupMemberList(sessionId: String): ApiResponse<List<GroupMemberBean>> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["sessionId"] = sessionId
|
||||||
|
return apiCall { service.getActualGroupMemberList(map) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun addGroupUser(groupId: String, memberList: List<String>,
|
||||||
|
memberType: Int): ApiResponse<Boolean> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["groupId"] = groupId
|
||||||
|
map["memberList"] = memberList
|
||||||
|
map["memberType"] = memberType
|
||||||
|
return apiCall { service.addGroupUser(map.toJson().toRequestBody()) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun removeGroupUser(groupId: String, memberList: List<String>): ApiResponse<Boolean> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["groupId"] = groupId
|
||||||
|
map["memberList"] = memberList
|
||||||
|
return apiCall { service.removeGroupUser(map.toJson().toRequestBody()) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getProposalInfo(): ApiResponse<ProposalBean> {
|
||||||
|
return apiCall { service.getProposalInfo() }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun isLiaisonUser(): ApiResponse<Boolean> {
|
||||||
|
return apiCall { service.isLiaisonUser() }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getParticipatedOrders(): ApiResponse<PageBean<GroupInfo>> {
|
||||||
|
return apiCall { service.getParticipatedOrders() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package com.xjjk.healthyclients.data.repository
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.base.repository.BaseRepository
|
||||||
|
import com.xjjk.healthyclients.bean.home.EncryptInfoBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeBannerBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeNoticeBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeWatchAllDataBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.WatchInfoBean
|
||||||
|
import com.xjjk.healthyclients.bean.user.CheckInBean
|
||||||
|
import com.xjjk.healthyclients.bean.user.PointDetailBean
|
||||||
|
import com.xjjk.healthyclients.bean.user.PointRank
|
||||||
|
import com.xjjk.healthyclients.bean.user.PointRecord
|
||||||
|
import com.xjjk.healthyclients.bean.user.PointsTask
|
||||||
|
import com.xjjk.healthyclients.bean.user.UserPointBean
|
||||||
|
import com.xjjk.healthyclients.data.api.HomeApi
|
||||||
|
import com.xjjk.healthyclients.data.bean.ApiResponse
|
||||||
|
import com.xjjk.healthyclients.retrofit.RetrofitManager
|
||||||
|
import com.xjjk.healthyclients.retrofit.RetrofitManager.toRequestBody
|
||||||
|
import com.xjjk.healthyclients.superfuntion.toJson
|
||||||
|
|
||||||
|
object HomeRepository : BaseRepository() {
|
||||||
|
|
||||||
|
private val service by lazy { RetrofitManager.getService(HomeApi::class.java) }
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun getHomeNoticeList(
|
||||||
|
pageNo: Int,
|
||||||
|
pageSize: Int
|
||||||
|
): ApiResponse<MutableList<HomeNoticeBean>> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["pageNo"] = pageNo
|
||||||
|
map["pageSize"] = pageSize
|
||||||
|
|
||||||
|
return apiCall { service.getHomeNoticeList(map) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getHomeNoticeDetail(id: String): ApiResponse<HomeNoticeBean> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["id"] = id
|
||||||
|
return apiCall { service.getHomeNoticeDetail(map) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getHomeBannerList(): ApiResponse<MutableList<HomeBannerBean>> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
// map["showLocation"] = showLocation
|
||||||
|
return apiCall { service.getHomeBannerList(map) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getUserPoints(): ApiResponse<MutableList<UserPointBean>> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
return apiCall { service.getUserPoints(map) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getUserPointsTask(): ApiResponse<PointsTask> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
return apiCall { service.getUserPointsTask(map) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun postUserPointsRecord(changeType: Int): ApiResponse<PointDetailBean<PointRecord>> {
|
||||||
|
val params = mutableMapOf<String, Any?>()
|
||||||
|
params["changeType"] = changeType
|
||||||
|
return apiCall { service.postUserPointsRecord(params.toJson().toRequestBody()) }
|
||||||
|
}
|
||||||
|
|
||||||
|
// rankType(榜单类型,1周榜,2月榜,10总榜)
|
||||||
|
suspend fun postUserPointsRank(
|
||||||
|
pageNo: Int,
|
||||||
|
pageSize: Int,
|
||||||
|
rankType: Int
|
||||||
|
): ApiResponse<PointDetailBean<PointRank>> {
|
||||||
|
val params = mutableMapOf<String, Any?>()
|
||||||
|
params["pageNo"] = pageNo
|
||||||
|
params["pageSize"] = pageSize
|
||||||
|
params["rankType"] = rankType
|
||||||
|
return apiCall { service.postUserPointsRank(params.toJson().toRequestBody()) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun postUserPointsCheckIn(checkInBean: CheckInBean): ApiResponse<CheckInBean> {
|
||||||
|
return apiCall { service.postUserPointsCheckIn(checkInBean.toJson().toRequestBody()) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getConSessionPicUrl(): ApiResponse<String> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
return apiCall { service.getConSessionPicUrl(map) }
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 首页-用户手表数据
|
||||||
|
*/
|
||||||
|
suspend fun getHomeWatchData(date:String): ApiResponse<MutableList<HomeWatchAllDataBean>> {
|
||||||
|
return apiCall {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["date"] = date
|
||||||
|
service.getHomeWatchData(map)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getHomeWatchInfo(userId: String?): ApiResponse<WatchInfoBean> {
|
||||||
|
return apiCall {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["userId"] = userId
|
||||||
|
service.getHomeWatchInfo(map)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getSysEnCryptInfo(str: String?): ApiResponse<EncryptInfoBean> {
|
||||||
|
return apiCall {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["str"] = str
|
||||||
|
service.getSysEnCryptInfo(map)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
suspend fun getBindDevice(watchNo: String?): ApiResponse<String> {
|
||||||
|
return apiCall {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["watchNo"] = watchNo
|
||||||
|
service.getBindDevice(map)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
suspend fun getUnbundleDevice(watchNo: String?): ApiResponse<String> {
|
||||||
|
return apiCall {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map["watchNo"] = watchNo
|
||||||
|
service.getUnbundleDevice(map)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.xjjk.healthyclients.data.repository
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.base.repository.BaseRepository
|
||||||
|
import com.xjjk.healthyclients.bean.UserListBean
|
||||||
|
import com.xjjk.healthyclients.data.api.OtherApi
|
||||||
|
import com.xjjk.healthyclients.data.bean.ApiResponse
|
||||||
|
import com.xjjk.healthyclients.retrofit.RetrofitManager
|
||||||
|
import com.xjjk.healthyclients.retrofit.RetrofitManager.toRequestBody
|
||||||
|
import com.xjjk.healthyclients.superfuntion.toJson
|
||||||
|
|
||||||
|
|
||||||
|
object OtherRepository : BaseRepository() {
|
||||||
|
private val service by lazy { RetrofitManager.getService(OtherApi::class.java) }
|
||||||
|
suspend fun getList(
|
||||||
|
username: String
|
||||||
|
): ApiResponse<UserListBean> {
|
||||||
|
val params = mutableMapOf<String, Any?>()
|
||||||
|
params["personType"] = 1
|
||||||
|
params["username"] = username
|
||||||
|
params["pageNo"] = 1
|
||||||
|
params["pageSize"] = 100
|
||||||
|
return apiCall {
|
||||||
|
service.listAll(params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun simulateUser(
|
||||||
|
userId: String
|
||||||
|
): ApiResponse<Boolean> {
|
||||||
|
val params = mutableMapOf<String, Any?>()
|
||||||
|
params["userId"] = userId
|
||||||
|
return apiCall { service.fake(params) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun fakeUser(
|
||||||
|
|
||||||
|
): ApiResponse<UserListBean.RecordsDTO> {
|
||||||
|
val params = mutableMapOf<String, Any?>()
|
||||||
|
// params["X-Access-Token"] = DataStoreManager.getToken()
|
||||||
|
return apiCall { service.fakeUser(params.toJson().toRequestBody()) }
|
||||||
|
}
|
||||||
|
suspend fun restore(
|
||||||
|
): ApiResponse<Boolean> {
|
||||||
|
val params = mutableMapOf<String, Any?>()
|
||||||
|
// params["userId"] = userId
|
||||||
|
return apiCall { service.restore(params.toJson().toRequestBody()) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验token有效性
|
||||||
|
*/
|
||||||
|
suspend fun selectTokenExpire(token:String): ApiResponse<Boolean> {
|
||||||
|
return apiCall {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
map.put("token",token)
|
||||||
|
service.selectTokenExpire(map)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xjjk.healthyclients.event
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页tab切换
|
||||||
|
*/
|
||||||
|
class HomeTabChangeEvent {
|
||||||
|
var index: Int = -1
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.xjjk.healthyclients.event
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeWatchAllDataBean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手表数据变更事件
|
||||||
|
* 用于 HomeWatchView → WatchItemFragment 的数据通知
|
||||||
|
* @param dataList 接口返回的手表各项健康数据列表(按索引对应各 Tab)
|
||||||
|
*/
|
||||||
|
class WatchDataChangeEvent {
|
||||||
|
var dataList: MutableList<HomeWatchAllDataBean>? = null
|
||||||
|
}
|
||||||
@@ -1,19 +1,26 @@
|
|||||||
package com.xjjk.healthyclients.fragment
|
package com.xjjk.healthyclients.fragment
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
|
import android.app.Dialog
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import android.graphics.Rect
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.WindowManager
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
|
import androidx.core.util.Consumer
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.amap.api.location.AMapLocation
|
import com.amap.api.location.AMapLocation
|
||||||
import com.amap.api.location.AMapLocationClient
|
import com.amap.api.location.AMapLocationClient
|
||||||
import com.amap.api.location.AMapLocationClientOption
|
import com.amap.api.location.AMapLocationClientOption
|
||||||
@@ -30,12 +37,23 @@ import com.amap.api.maps.model.Marker
|
|||||||
import com.amap.api.maps.model.MarkerOptions
|
import com.amap.api.maps.model.MarkerOptions
|
||||||
import com.amap.api.maps.model.MyLocationStyle
|
import com.amap.api.maps.model.MyLocationStyle
|
||||||
import com.permissionx.guolindev.PermissionX
|
import com.permissionx.guolindev.PermissionX
|
||||||
|
import com.tencent.qcloud.tuicore.util.SPUtils
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.TUIChatConstants.CHAT_IS_LIAISON_USER
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.EmployeeBean
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.ExpertBean
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.GroupMemberBean
|
||||||
import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean
|
import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.classicui.interfaces.OnParamedicOperateListener
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.presenter.ParamedicOperateHelper
|
||||||
import com.xjjk.healthyclients.R
|
import com.xjjk.healthyclients.R
|
||||||
import com.xjjk.healthyclients.base.BaseVMBFragment
|
import com.xjjk.healthyclients.base.BaseVMBFragment
|
||||||
import com.xjjk.healthyclients.bean.emergency.EmergencyDictBean
|
import com.xjjk.healthyclients.bean.emergency.EmergencyDictBean
|
||||||
|
import com.xjjk.healthyclients.bean.emergency.GroupInfo
|
||||||
import com.xjjk.healthyclients.bean.emergency.LocationResourceBean
|
import com.xjjk.healthyclients.bean.emergency.LocationResourceBean
|
||||||
|
import com.xjjk.healthyclients.data.repository.EmergencyRepository
|
||||||
|
import com.xjjk.healthyclients.databinding.DialogGroupInfoListBinding
|
||||||
import com.xjjk.healthyclients.databinding.FragmentEmergencyBinding
|
import com.xjjk.healthyclients.databinding.FragmentEmergencyBinding
|
||||||
|
import com.xjjk.healthyclients.fragment.adapter.GroupInfoAdapter
|
||||||
import com.xjjk.healthyclients.superfuntion.getMarkerInfo
|
import com.xjjk.healthyclients.superfuntion.getMarkerInfo
|
||||||
import com.xjjk.healthyclients.superfuntion.startGroupChat
|
import com.xjjk.healthyclients.superfuntion.startGroupChat
|
||||||
import com.xjjk.healthyclients.ui.viewmodel.EmergencyViewModel
|
import com.xjjk.healthyclients.ui.viewmodel.EmergencyViewModel
|
||||||
@@ -43,8 +61,12 @@ import com.xjjk.healthyclients.utils.IMInputActionSettingUtils
|
|||||||
import com.xjjk.healthyclients.utils.MapUtils
|
import com.xjjk.healthyclients.utils.MapUtils
|
||||||
import com.xjjk.healthyclients.utils.SystemFuntion.goNavigation
|
import com.xjjk.healthyclients.utils.SystemFuntion.goNavigation
|
||||||
import com.xjjk.healthyclients.utils.TUIUtils
|
import com.xjjk.healthyclients.utils.TUIUtils
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,6 +98,100 @@ class EmergencyFragment :
|
|||||||
)
|
)
|
||||||
var mListener: LocationSource.OnLocationChangedListener? = null
|
var mListener: LocationSource.OnLocationChangedListener? = null
|
||||||
|
|
||||||
|
private val paramedicOperateListener = object : OnParamedicOperateListener {
|
||||||
|
override fun addGroupUser(
|
||||||
|
groupId: String,
|
||||||
|
memberList: List<String>,
|
||||||
|
memberType: Int,
|
||||||
|
callback: Consumer<Boolean>
|
||||||
|
) {
|
||||||
|
// 通过 successCall 把 ViewModel 的操作结果回传给 tuichat 模块
|
||||||
|
mViewModel.addGroupUser(groupId, memberList, memberType) { success ->
|
||||||
|
callback.accept(success)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun removeGroupUser(groupId: String, memberList: List<String>) {
|
||||||
|
mViewModel.removeGroupUser(groupId, memberList)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun searchEmployee(
|
||||||
|
realname: String?,
|
||||||
|
orgCode: String?,
|
||||||
|
workNo: String?,
|
||||||
|
phone: String?,
|
||||||
|
excludeSessionId: String?,
|
||||||
|
pageNo: Int,
|
||||||
|
pageSize: Int
|
||||||
|
): List<EmployeeBean?>? {
|
||||||
|
return runBlocking(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val deferred = async {
|
||||||
|
EmergencyRepository.searchEmployee(
|
||||||
|
realname ?: "",
|
||||||
|
orgCode ?: "",
|
||||||
|
workNo ?: "",
|
||||||
|
phone ?: "",
|
||||||
|
excludeSessionId ?: "",
|
||||||
|
pageNo,
|
||||||
|
pageSize
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val response = withTimeoutOrNull(10000L) { deferred.await() }
|
||||||
|
?: return@runBlocking emptyList<EmployeeBean>()
|
||||||
|
|
||||||
|
response.takeIf { it.success }?.result?.records ?: emptyList()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun searchExpert(
|
||||||
|
realname: String?,
|
||||||
|
centerId: String?,
|
||||||
|
excludeSessionId: String?,
|
||||||
|
pageNo: Int,
|
||||||
|
pageSize: Int
|
||||||
|
): List<ExpertBean?>? {
|
||||||
|
return runBlocking(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val deferred = async {
|
||||||
|
EmergencyRepository.searchExpert(
|
||||||
|
realname ?: "",
|
||||||
|
centerId ?: "",
|
||||||
|
excludeSessionId ?: "",
|
||||||
|
pageNo,
|
||||||
|
pageSize
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val response = withTimeoutOrNull(10000L) { deferred.await() }
|
||||||
|
?: return@runBlocking emptyList<ExpertBean>()
|
||||||
|
|
||||||
|
response.takeIf { it.success }?.result?.records ?: emptyList()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getActualGroupMemberList(sessionId: String): List<GroupMemberBean?>? {
|
||||||
|
return runBlocking(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val deferred = async {
|
||||||
|
EmergencyRepository.getActualGroupMemberList(sessionId)
|
||||||
|
}
|
||||||
|
val response = withTimeoutOrNull(10000L) { deferred.await() }
|
||||||
|
?: return@runBlocking emptyList<GroupMemberBean>()
|
||||||
|
|
||||||
|
response.takeIf { it.success }?.result ?: emptyList()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
// fitTransparentStatusBar(mBinding.tvTitle)
|
// fitTransparentStatusBar(mBinding.tvTitle)
|
||||||
MapsInitializer.updatePrivacyShow(context, true, true)
|
MapsInitializer.updatePrivacyShow(context, true, true)
|
||||||
@@ -88,6 +204,15 @@ class EmergencyFragment :
|
|||||||
PermissionX.init(this@EmergencyFragment)
|
PermissionX.init(this@EmergencyFragment)
|
||||||
.permissions(mPermissionList)
|
.permissions(mPermissionList)
|
||||||
.request { allGranted, grantedList, deniedList -> setUpMap() }
|
.request { allGranted, grantedList, deniedList -> setUpMap() }
|
||||||
|
|
||||||
|
ParamedicOperateHelper.getInstance().setListener(paramedicOperateListener)
|
||||||
|
|
||||||
|
mViewModel.isLiaisonUser { result ->
|
||||||
|
if (!result) {
|
||||||
|
mBinding.fragmentEmergencyParamedic.visibility = View.GONE
|
||||||
|
}
|
||||||
|
SPUtils.getInstance().put(CHAT_IS_LIAISON_USER, result)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
@@ -97,13 +222,13 @@ class EmergencyFragment :
|
|||||||
// 0.0,
|
// 0.0,
|
||||||
// 0.0
|
// 0.0
|
||||||
// )
|
// )
|
||||||
var mHeadType= mutableListOf<EmergencyDictBean>()
|
var mHeadType = mutableListOf<EmergencyDictBean>()
|
||||||
// mHeadType.add(EmergencyDictBean("全部","全部","全部","0",true))
|
// mHeadType.add(EmergencyDictBean("全部","全部","全部","0",true))
|
||||||
mHeadType.add(EmergencyDictBean("油田医院","油田医院","油田医院","1",true))
|
mHeadType.add(EmergencyDictBean("油田医院", "油田医院", "油田医院", "1", true))
|
||||||
// mHeadType.add(EmergencyDictBean("合作医院","合作医院","合作医院","2",false))
|
// mHeadType.add(EmergencyDictBean("合作医院","合作医院","合作医院","2",false))
|
||||||
mHeadType.add(EmergencyDictBean("健康小屋","健康小屋","健康小屋","3",false))
|
mHeadType.add(EmergencyDictBean("健康小屋", "健康小屋", "健康小屋", "3", false))
|
||||||
mHeadType.add(EmergencyDictBean("AED","AED","AED","4",false))
|
mHeadType.add(EmergencyDictBean("AED", "AED", "AED", "4", false))
|
||||||
mHeadType.add(EmergencyDictBean("救护车","救护车","救护车","5",false))
|
mHeadType.add(EmergencyDictBean("救护车", "救护车", "救护车", "5", false))
|
||||||
|
|
||||||
mBinding.fragmentEmergencyHeadRv.setHeadData(mHeadType) { titleBean ->
|
mBinding.fragmentEmergencyHeadRv.setHeadData(mHeadType) { titleBean ->
|
||||||
// if (titleBean.value.equals("3")) {
|
// if (titleBean.value.equals("3")) {
|
||||||
@@ -119,6 +244,8 @@ class EmergencyFragment :
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
titleId = mHeadType[0].value
|
||||||
|
mViewModel.getEmergencyData(mHeadType[0].value, mCurrentLat, mCurrentLon)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createObserve() {
|
override fun createObserve() {
|
||||||
@@ -168,6 +295,7 @@ class EmergencyFragment :
|
|||||||
super.onResume()
|
super.onResume()
|
||||||
mMapView?.onResume()
|
mMapView?.onResume()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
mMapView?.onPause()
|
mMapView?.onPause()
|
||||||
@@ -180,6 +308,10 @@ class EmergencyFragment :
|
|||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
|
// 主动停止并销毁定位客户端,防止 Fragment 销毁后 GPS 定位服务持续运行造成资源浪费
|
||||||
|
mlocationClient?.stopLocation()
|
||||||
|
mlocationClient?.onDestroy()
|
||||||
|
mlocationClient = null
|
||||||
mMapView?.onDestroy()
|
mMapView?.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,6 +355,7 @@ class EmergencyFragment :
|
|||||||
fragmentEmergencyPhone.setOnClickListener(this@EmergencyFragment)
|
fragmentEmergencyPhone.setOnClickListener(this@EmergencyFragment)
|
||||||
fragmentEmergencyCardNavigation.setOnClickListener(this@EmergencyFragment)
|
fragmentEmergencyCardNavigation.setOnClickListener(this@EmergencyFragment)
|
||||||
fragmentEmergencyMarkerInfo.setOnClickListener(this@EmergencyFragment)
|
fragmentEmergencyMarkerInfo.setOnClickListener(this@EmergencyFragment)
|
||||||
|
fragmentEmergencyParamedic.setOnClickListener(this@EmergencyFragment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,6 +413,25 @@ class EmergencyFragment :
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R.id.fragment_emergency_paramedic -> {
|
||||||
|
mViewModel.getParticipatedOrders { result ->
|
||||||
|
when {
|
||||||
|
result.records.isNullOrEmpty() -> {
|
||||||
|
showToast("暂无参与的应急就医工单")
|
||||||
|
}
|
||||||
|
result.records.size == 1 -> {
|
||||||
|
startParamedicChat(result.records[0])
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
showChatListDialog(result.records) { groupInfo ->
|
||||||
|
startParamedicChat(groupInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
R.id.fragment_emergency_marker_info -> {
|
R.id.fragment_emergency_marker_info -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -289,10 +441,6 @@ class EmergencyFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStatusbarStyle(): Int {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLocationChanged(amapLocation: AMapLocation?) {
|
override fun onLocationChanged(amapLocation: AMapLocation?) {
|
||||||
if (mListener != null && amapLocation != null) {
|
if (mListener != null && amapLocation != null) {
|
||||||
if (amapLocation != null
|
if (amapLocation != null
|
||||||
@@ -317,6 +465,90 @@ class EmergencyFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动 medic 应急就医群聊:拉取群成员 → 配置 IM 输入态 → 进入群聊界面
|
||||||
|
*/
|
||||||
|
private fun startParamedicChat(groupInfo: GroupInfo) {
|
||||||
|
mViewModel.getActualGroupMemberList(groupInfo.sessionId, successCall = { groupMemberBeans ->
|
||||||
|
IMInputActionSettingUtils.createEmergencySetting(true)
|
||||||
|
activity?.startGroupChat(
|
||||||
|
groupInfo.sessionId,
|
||||||
|
getString(R.string.title_paramedic_group),
|
||||||
|
false,
|
||||||
|
groupMemberBeans.map { it.userId }.toList() as ArrayList<String>?,
|
||||||
|
workBean = WorkBean(groupInfo.orderId, TUIUtils.WORK_TYPE_EMERGENCY)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展示急救工单选择Dialog(Figma设计稿)
|
||||||
|
*/
|
||||||
|
private fun showChatListDialog(
|
||||||
|
records: List<GroupInfo>,
|
||||||
|
onChatSelected: (GroupInfo) -> Unit
|
||||||
|
) {
|
||||||
|
context?.let { ctx ->
|
||||||
|
val dialog = Dialog(ctx, com.xjjk.healthyclients.R.style.EmergencyDialogTheme)
|
||||||
|
val binding = DialogGroupInfoListBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
|
val adapter = GroupInfoAdapter(records) { selectedPos ->
|
||||||
|
// 选中变化时更新确认按钮状态
|
||||||
|
val hasSelection = selectedPos >= 0
|
||||||
|
binding.tvConfirm.isEnabled = hasSelection
|
||||||
|
binding.tvConfirm.alpha = if (hasSelection) 1.0f else 0.4f
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.rvGroupList.layoutManager = LinearLayoutManager(ctx)
|
||||||
|
binding.rvGroupList.adapter = adapter.apply {
|
||||||
|
// 初始禁用确认按钮
|
||||||
|
binding.tvConfirm.isEnabled = false
|
||||||
|
binding.tvConfirm.alpha = 0.4f
|
||||||
|
}
|
||||||
|
|
||||||
|
// 列表项间距
|
||||||
|
val spacing = ctx.resources.getDimensionPixelSize(com.xjjk.healthyclients.R.dimen.dp_12)
|
||||||
|
binding.rvGroupList.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||||
|
override fun getItemOffsets(
|
||||||
|
outRect: Rect,
|
||||||
|
view: View,
|
||||||
|
parent: RecyclerView,
|
||||||
|
state: RecyclerView.State
|
||||||
|
) {
|
||||||
|
outRect.bottom = spacing
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 确认按钮点击
|
||||||
|
binding.tvConfirm.setOnClickListener {
|
||||||
|
adapter.selectedItem?.let { item ->
|
||||||
|
onChatSelected(item)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 右上角X关闭
|
||||||
|
binding.ivClose.setOnClickListener { dialog.dismiss() }
|
||||||
|
|
||||||
|
// 点击卡片外部区域关闭
|
||||||
|
binding.flRoot.setOnClickListener { dialog.dismiss() }
|
||||||
|
|
||||||
|
dialog.setContentView(binding.root)
|
||||||
|
dialog.setCanceledOnTouchOutside(true)
|
||||||
|
dialog.setCancelable(true)
|
||||||
|
|
||||||
|
dialog.window?.let { window ->
|
||||||
|
window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
|
window.decorView.setBackgroundColor(Color.TRANSPARENT)
|
||||||
|
window.setLayout(
|
||||||
|
WindowManager.LayoutParams.MATCH_PARENT,
|
||||||
|
WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
}
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun setMarker(markerList: MutableList<LocationResourceBean>) {
|
fun setMarker(markerList: MutableList<LocationResourceBean>) {
|
||||||
mAMap?.clear() //清除点位
|
mAMap?.clear() //清除点位
|
||||||
if (markerList.isNullOrEmpty()) {
|
if (markerList.isNullOrEmpty()) {
|
||||||
@@ -350,7 +582,11 @@ class EmergencyFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (markerList.size == 1) {
|
if (markerList.size == 1) {
|
||||||
MapUtils.setMapZoonloAndZoom(mAMap, LatLng(markerList.get(0).latitude, markerList.get(0).longitude),11)
|
MapUtils.setMapZoonloAndZoom(
|
||||||
|
mAMap,
|
||||||
|
LatLng(markerList.get(0).latitude, markerList.get(0).longitude),
|
||||||
|
11
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
MapUtils.setMapZoonlo(mAMap, 200, ArrayList(newlist))
|
MapUtils.setMapZoonlo(mAMap, 200, ArrayList(newlist))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
import com.sw.healthyclients.data.local.DataStoreManager
|
import com.sw.healthyclients.data.local.DataStoreManager
|
||||||
import com.sw.healthyclients.utils.StatusbarUtil
|
|
||||||
import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean
|
import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean
|
||||||
import com.xjjk.healthyclients.R
|
import com.xjjk.healthyclients.R
|
||||||
import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter
|
import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter
|
||||||
@@ -197,6 +196,9 @@ class GuidanceFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// R.id.banner->{
|
||||||
|
// toActivity(HomeBannerDetailActivity::class.java)
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,14 +208,11 @@ class GuidanceFragment :
|
|||||||
ivLeft?.setOnClickListener(this@GuidanceFragment)
|
ivLeft?.setOnClickListener(this@GuidanceFragment)
|
||||||
ivRight?.setOnClickListener(this@GuidanceFragment)
|
ivRight?.setOnClickListener(this@GuidanceFragment)
|
||||||
tvDoctorMore?.setOnClickListener(this@GuidanceFragment)
|
tvDoctorMore?.setOnClickListener(this@GuidanceFragment)
|
||||||
|
// banner?.setOnClickListener(this@GuidanceFragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStatusbarStyle(): Int {
|
|
||||||
activity?.let { StatusbarUtil.customColorMode(it, "#2dcac1", false) }
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRefresh() {
|
override fun onRefresh() {
|
||||||
mBinding.swipeRefresh.isRefreshing = false
|
mBinding.swipeRefresh.isRefreshing = false
|
||||||
|
|||||||
@@ -0,0 +1,754 @@
|
|||||||
|
package com.xjjk.healthyclients.fragment
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.view.View
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
import com.sw.healthyclients.data.local.DataStoreManager
|
||||||
|
import com.sw.healthyclients.utils.DateUtil
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter
|
||||||
|
import com.xjjk.healthyclients.bankRequest.BankPointRequest
|
||||||
|
import com.xjjk.healthyclients.bankRequest.HealthInfoRequest
|
||||||
|
import com.xjjk.healthyclients.base.BaseVMBFragment
|
||||||
|
import com.xjjk.healthyclients.bean.guidance.GuidanceListBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.CategoryBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.WatchInfoBean
|
||||||
|
import com.xjjk.healthyclients.data.api.HomeApi
|
||||||
|
import com.xjjk.healthyclients.databinding.FragmentHomeBinding
|
||||||
|
import com.xjjk.healthyclients.event.HomeTabChangeEvent
|
||||||
|
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||||
|
import com.xjjk.healthyclients.retrofit.getBankRetrofit
|
||||||
|
import com.xjjk.healthyclients.superfuntion.initColors
|
||||||
|
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||||
|
import com.xjjk.healthyclients.superfuntion.showBanner
|
||||||
|
import com.xjjk.healthyclients.superfuntion.startAppointmentWaitAffirmActivity
|
||||||
|
import com.xjjk.healthyclients.superfuntion.startGroupChat
|
||||||
|
import com.xjjk.healthyclients.superfuntion.startLoginActivity
|
||||||
|
import com.xjjk.healthyclients.superfuntion.startMyGuidanceActivity
|
||||||
|
import com.xjjk.healthyclients.superfuntion.startWebActivity
|
||||||
|
import com.xjjk.healthyclients.superfuntion.toZeroDefault
|
||||||
|
import com.xjjk.healthyclients.ui.activity.EmptyActivity
|
||||||
|
import com.xjjk.healthyclients.ui.activity.LoginActivity
|
||||||
|
import com.xjjk.healthyclients.ui.activity.ProposalActivity
|
||||||
|
import com.xjjk.healthyclients.ui.activity.guidance.adapter.GuidanceFragmentDoctorAdapter
|
||||||
|
import com.xjjk.healthyclients.ui.activity.home.HomeBannerDetailActivity
|
||||||
|
import com.xjjk.healthyclients.ui.activity.home.HomeNoticeListActivity
|
||||||
|
import com.xjjk.healthyclients.ui.viewmodel.HomeViewModel
|
||||||
|
import com.xjjk.healthyclients.utils.ConstantUtils
|
||||||
|
import com.xjjk.healthyclients.utils.IMInputActionSettingUtils
|
||||||
|
import com.xjjk.healthyclients.utils.TUIUtils
|
||||||
|
import com.xjjk.healthyclients.view.WatchBindDialog
|
||||||
|
import kotlinx.coroutines.Job
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页fragment
|
||||||
|
*/
|
||||||
|
class HomeFragment :
|
||||||
|
BaseVMBFragment<HomeViewModel, FragmentHomeBinding>(R.layout.fragment_home),
|
||||||
|
SwipeRefreshLayout.OnRefreshListener {
|
||||||
|
|
||||||
|
private var mApi = getBankRetrofit().create(HomeApi::class.java)
|
||||||
|
|
||||||
|
var watchBindDialog: WatchBindDialog? = null
|
||||||
|
|
||||||
|
var stringList: MutableList<String> = mutableListOf()
|
||||||
|
var mDoctorList = arrayListOf<GuidanceListBean>()
|
||||||
|
var mGuidanceFragmentDoctorAdapter: GuidanceFragmentDoctorAdapter? = null
|
||||||
|
|
||||||
|
var REQUEST_DURATION = 1000 * 120L
|
||||||
|
var noticeTime = REQUEST_DURATION
|
||||||
|
var watchInfo: WatchInfoBean? = null
|
||||||
|
|
||||||
|
/** 健康资讯请求 */
|
||||||
|
private var mHealthInfoRequest: HealthInfoRequest? = null
|
||||||
|
|
||||||
|
/** 健康资讯 Token */
|
||||||
|
private var mHealthToken: String? = null
|
||||||
|
|
||||||
|
/** 健康知识子栏目列表 */
|
||||||
|
private var mKnowledgeCategories: MutableList<CategoryBean> = mutableListOf()
|
||||||
|
|
||||||
|
/** 通知轮播协程 Job,重新启动前先取消旧任务,防止多协程并发叠加 */
|
||||||
|
private var noticeJob: Job? = null
|
||||||
|
|
||||||
|
|
||||||
|
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
|
mBinding.swipeRefresh.initColors()
|
||||||
|
mBinding.swipeRefresh.setOnRefreshListener(this@HomeFragment)
|
||||||
|
watchBindDialog = WatchBindDialog(requireContext()) { watchName, type ->
|
||||||
|
// 0 绑定 1 解绑
|
||||||
|
if (type == 0) {
|
||||||
|
mViewModel.getBindDevice(watchName)
|
||||||
|
// } else {
|
||||||
|
// mViewModel.getUnbundleDevice(watchName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var manager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
mBinding.layoutItem3.fragmentGuidanceRvDoctor.layoutManager = manager
|
||||||
|
mGuidanceFragmentDoctorAdapter =
|
||||||
|
GuidanceFragmentDoctorAdapter(
|
||||||
|
requireContext(),
|
||||||
|
R.layout.item_fragment_doctor,
|
||||||
|
mDoctorList
|
||||||
|
) {}
|
||||||
|
mGuidanceFragmentDoctorAdapter!!.setOnItemClickListener(object :
|
||||||
|
MultiItemTypeAdapter.OnItemClickListener {
|
||||||
|
override fun onItemClick(
|
||||||
|
view: View?,
|
||||||
|
holder: RecyclerView.ViewHolder?,
|
||||||
|
position: Int,
|
||||||
|
) {
|
||||||
|
var bean = mDoctorList[position]
|
||||||
|
if (bean.contentType == "1") {
|
||||||
|
var isSelf = false
|
||||||
|
//大于等于4 不可发消息
|
||||||
|
var status = 0
|
||||||
|
var sendMessage = false
|
||||||
|
try {
|
||||||
|
status = bean.contentStatus.toInt()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
}
|
||||||
|
sendMessage = status >= 4
|
||||||
|
IMInputActionSettingUtils.createImageTextConsultSetting(
|
||||||
|
isSelf,
|
||||||
|
disableSendMessage = sendMessage,
|
||||||
|
disableEvaluate = status == 5
|
||||||
|
)
|
||||||
|
requireContext().startGroupChat(
|
||||||
|
bean.imId, "图文咨询", consultantId = bean.memberId,
|
||||||
|
workBean = WorkBean(bean.id, TUIUtils.WORK_TYPE_IMAGE_TEXT_CONSULT)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
requireContext()?.let {
|
||||||
|
startAppointmentWaitAffirmActivity(
|
||||||
|
it,
|
||||||
|
bean.id,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onItemLongClick(
|
||||||
|
view: View?,
|
||||||
|
holder: RecyclerView.ViewHolder?,
|
||||||
|
position: Int,
|
||||||
|
): Boolean {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
mBinding.layoutItem3.fragmentGuidanceRvDoctor.adapter = mGuidanceFragmentDoctorAdapter
|
||||||
|
mBinding.watchView.init(this@HomeFragment)
|
||||||
|
setupHealthViews()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
mBinding.homeMarqueeView.setOnItemClickListener { position, textView ->
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
toActivity(HomeNoticeListActivity::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
mBinding.apply {
|
||||||
|
addClickViews(
|
||||||
|
layoutItem4.imgLeft, layoutItem4.imgRight,
|
||||||
|
layoutItem1.homeHeadTab1, layoutItem1.homeHeadTab2, layoutItem1.homeHeadTab3,
|
||||||
|
layoutItem1.homeHeadTab4, layoutItem3.tvDoctorMore
|
||||||
|
)
|
||||||
|
}
|
||||||
|
mBinding.watchView.mBinding.imgWatchMore.setOnClickListener {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
if (watchInfo?.hasWatch == true) {
|
||||||
|
EventBus.getDefault().post(HomeTabChangeEvent().apply { index = 3 })
|
||||||
|
} else {
|
||||||
|
showWatchBindDialog()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toActivity(LoginActivity::class.java)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mBinding.watchView.mBinding.watchName.setOnClickListener {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
// if (watchInfo?.hasWatch==true){
|
||||||
|
// showWatchBindDialog(watchInfo?.watchNo)
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
toActivity(LoginActivity::class.java)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.watchView.mBinding.btnBindWatch.setOnClickListener {
|
||||||
|
showWatchBindDialog()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showWatchBindDialog(watchId: String? = null) {
|
||||||
|
watchBindDialog?.showWatchInfo(watchId)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(v: View?) {
|
||||||
|
when (v?.id) {
|
||||||
|
R.id.img_left -> {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
val value = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (TextUtils.isEmpty(value)) {
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
showToast("网络错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
UrlConfig.getWeightManagementH5Url() + "?param=" + value,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.img_right -> {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putString("title", "一人一案")
|
||||||
|
toActivity(ProposalActivity::class.java, bundle)
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.home_head_tab1 -> {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
val value = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (TextUtils.isEmpty(value)) {
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
showToast("网络错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
UrlConfig.getHealthFileH5Url() + "?param=" + value,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.home_head_tab2 -> {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
val value = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (TextUtils.isEmpty(value)) {
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
showToast("网络错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
UrlConfig.getHealthCheckH5Url() + "?param=" + value,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "健康体检",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.home_head_tab4 -> {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
val value = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (TextUtils.isEmpty(value)) {
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
showToast("网络错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
UrlConfig.getBankH5Url() + "?param=" + value,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "健康银行",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.home_head_tab3 -> {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
EventBus.getDefault().post(HomeTabChangeEvent().apply { index = 2 })
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.tv_doctor_more -> {
|
||||||
|
if (ConstantUtils.mCheckToken) {
|
||||||
|
if (DataStoreManager.getToken().isNullOrEmpty()) {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
} else {
|
||||||
|
startMyGuidanceActivity(requireContext(), "")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
mBinding.healthKnowledgeView.clearSearchFocus()
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
mBinding.tvHi.visibility = View.VISIBLE
|
||||||
|
// mBinding.layoutNotice.visibility = View.VISIBLE
|
||||||
|
mBinding.tvHi.text = "hi~ ${DataStoreManager.getUserInfo().realname}"
|
||||||
|
} else {
|
||||||
|
// mBinding.layoutNotice.visibility = View.GONE
|
||||||
|
mBinding.tvHi.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.homeBannerList.collectLatest {
|
||||||
|
if (it.isNullOrEmpty()) {
|
||||||
|
return@collectLatest
|
||||||
|
}
|
||||||
|
val bannerList1 = it.filter { homeBannerBean ->
|
||||||
|
homeBannerBean.showLocation.equals("1")
|
||||||
|
}.sortedBy { homeBannerBean -> homeBannerBean.sort }
|
||||||
|
|
||||||
|
val bannerList2 = it.filter { homeBannerBean ->
|
||||||
|
homeBannerBean.showLocation.equals("2")
|
||||||
|
}.sortedBy { homeBannerBean -> homeBannerBean.sort }
|
||||||
|
|
||||||
|
val bannerList3 = it.filter { homeBannerBean ->
|
||||||
|
homeBannerBean.showLocation.equals("3")
|
||||||
|
}.sortedBy { homeBannerBean -> homeBannerBean.sort }
|
||||||
|
|
||||||
|
val bannerList4 = it.filter { homeBannerBean ->
|
||||||
|
homeBannerBean.showLocation.equals("4")
|
||||||
|
}.sortedBy { homeBannerBean -> homeBannerBean.sort }
|
||||||
|
|
||||||
|
showBanner(mBinding.banner1, bannerList1) {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
val value = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (TextUtils.isEmpty(value)) {
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
showToast("网络错误")
|
||||||
|
} else {
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
UrlConfig.getHealthCheckH5Url() + "?param=" + value,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "健康体检",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showBanner(mBinding.banner2, bannerList2) {
|
||||||
|
|
||||||
|
toActivity(HomeBannerDetailActivity::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
showBanner(mBinding.banner3, bannerList3) {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
EventBus.getDefault().post(HomeTabChangeEvent().apply { index = 1 })
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showBanner(mBinding.banner4, bannerList4) {banner->
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
if (banner.jumpUrl.isEmpty()) {
|
||||||
|
toActivity(EmptyActivity::class.java, Bundle())
|
||||||
|
} else {
|
||||||
|
val value = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (TextUtils.isEmpty(value)) {
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
showToast("网络错误")
|
||||||
|
} else {
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
banner.jumpUrl + "?param=" + value,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "健康体检",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.homeNoticeRepeat.collectLatest {
|
||||||
|
stringList.clear()
|
||||||
|
if (it.isNullOrEmpty()) {
|
||||||
|
mBinding.layoutNotice.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
it.forEach { noticeData ->
|
||||||
|
stringList.add(noticeData.title)
|
||||||
|
}
|
||||||
|
mBinding.layoutNotice.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
mBinding.homeMarqueeView.stopFlipping()
|
||||||
|
delay(100)
|
||||||
|
mBinding.homeMarqueeView.startWithList(stringList)
|
||||||
|
// getNoticeMessage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.mDoctorList.collectLatest { list ->
|
||||||
|
mBinding.apply {
|
||||||
|
if (list.size == 0) {
|
||||||
|
layoutItem3.fragmentGuidanceRvDoctor.visibility = View.GONE
|
||||||
|
layoutItem3.llEmpty.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
layoutItem3.fragmentGuidanceRvDoctor.visibility = View.VISIBLE
|
||||||
|
layoutItem3.llEmpty.visibility = View.GONE
|
||||||
|
mDoctorList.clear()
|
||||||
|
mDoctorList.addAll(list)
|
||||||
|
}
|
||||||
|
mGuidanceFragmentDoctorAdapter?.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.watchInfo.collectLatest { bean ->
|
||||||
|
watchInfo = bean
|
||||||
|
mBinding.watchView.setWatchInfo(bean)
|
||||||
|
if (bean?.hasWatch == true) {//有手表的情况下去获取手表数据
|
||||||
|
mViewModel.getHomeWatchData(DateUtil.nowStringDateShort)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.watchAllData.collectLatest { bean ->
|
||||||
|
mBinding.watchView.setWatchAllData(bean)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.watchBindStatus.collectLatest {
|
||||||
|
showToast(it)
|
||||||
|
watchBindDialog?.cancel()
|
||||||
|
mViewModel.getHomeWatchInfo(DataStoreManager.getUserId())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// lifecycleScope.launch{
|
||||||
|
// repeatOnLifecycle(Lifecycle.State.CREATED){
|
||||||
|
// mViewModel.enCryptInfoUrl.collectLatest { url ->
|
||||||
|
// requireContext().startWebActivity(
|
||||||
|
// UrlConfig.HOME_BANK_H5+"?param="+url,
|
||||||
|
// myTitle = "健康银行"
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取银行积分详情
|
||||||
|
*/
|
||||||
|
private fun getBankPointDetail() {
|
||||||
|
val bankPointRequest = BankPointRequest(mApi)
|
||||||
|
|
||||||
|
bankPointRequest.getBankPointDetail(
|
||||||
|
DataStoreManager.getUserId().orEmptyDefault(""),
|
||||||
|
onSuccess = { bean ->
|
||||||
|
// 处理成功响应
|
||||||
|
mBinding.layoutItem1.tvTodayPoints.text = "${bean?.todayPoints.toZeroDefault()}"
|
||||||
|
mBinding.layoutItem1.tvTotalPoints.text = "${bean?.totalPoints.toZeroDefault()}"
|
||||||
|
},
|
||||||
|
onFailure = { error ->
|
||||||
|
showToast("网络错误")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
mViewModel.getHomeBannerList()
|
||||||
|
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
homeNoticeStartRepeat()
|
||||||
|
mViewModel.selectDoctorRecommendHome()
|
||||||
|
mViewModel.getHomeWatchInfo(DataStoreManager.getUserId())
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
getBankPointDetail()
|
||||||
|
loadHealthInfoData()
|
||||||
|
} else {
|
||||||
|
mBinding.healthKnowledgeView.mBinding.tabLayout.visibility = View.GONE
|
||||||
|
mBinding.healthKnowledgeView.mBinding.tvEmpty.visibility = View.VISIBLE
|
||||||
|
mBinding.healthKnowledgeView.mBinding.tvEmpty.text = "暂未登录"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun homeNoticeStartRepeat() {
|
||||||
|
// 取消旧的轮询协程,防止多次调用时多个协程并发叠加
|
||||||
|
noticeJob?.cancel()
|
||||||
|
noticeJob = lifecycleScope.launch {
|
||||||
|
repeat(500) {
|
||||||
|
mViewModel.getHomeNoticeListRepeat()
|
||||||
|
delay(noticeTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onRefresh() {
|
||||||
|
mBinding.swipeRefresh.isRefreshing = false
|
||||||
|
mViewModel.getHomeBannerList()
|
||||||
|
if (ConstantUtils.mCheckToken) {
|
||||||
|
mViewModel.selectDoctorRecommendHome()
|
||||||
|
}
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
mViewModel.getHomeNoticeListRepeat()
|
||||||
|
mViewModel.selectDoctorRecommendHome()
|
||||||
|
mViewModel.getHomeWatchInfo(DataStoreManager.getUserId())
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
getBankPointDetail()
|
||||||
|
loadHealthInfoData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 健康资讯相关 ====================
|
||||||
|
|
||||||
|
/** 初始化健康资讯两个 View 的事件回调 */
|
||||||
|
private fun setupHealthViews() {
|
||||||
|
mHealthInfoRequest = HealthInfoRequest()
|
||||||
|
|
||||||
|
// 健康知识 - Tab 切换加载对应栏目文章
|
||||||
|
mBinding.healthKnowledgeView.setOnTabSelectedListener { category ->
|
||||||
|
loadKnowledgeArticles(category.categoryId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 健康知识 - 列表项点击 → 跳转文章详情 H5
|
||||||
|
mBinding.healthKnowledgeView.setOnItemClickListener { article ->
|
||||||
|
navigateToArticleDetail(article.articleId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 健康知识 - 更多按钮 → 跳转健康知识 H5 页面
|
||||||
|
mBinding.healthKnowledgeView.setOnMoreClickListener {
|
||||||
|
navigateToHealthKnowledgeMore()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 健康知识 - 搜索
|
||||||
|
mBinding.healthKnowledgeView.setOnSearchClickListener {
|
||||||
|
navigateToHealthKnowledgeSearch(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 健康咨询 - 列表项点击 → 跳转文章详情 H5
|
||||||
|
mBinding.healthConsultationView.setOnItemClickListener { article ->
|
||||||
|
navigateToArticleDetail(article.articleId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 健康咨询 - 更多按钮 → 跳转健康咨询 H5 页面
|
||||||
|
mBinding.healthConsultationView.setOnMoreClickListener {
|
||||||
|
navigateToHealthConsultationMore()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 加载健康资讯数据(Token → 栏目 → 文章) */
|
||||||
|
private fun loadHealthInfoData() {
|
||||||
|
mBinding.healthKnowledgeView.mBinding.tabLayout.visibility = View.VISIBLE
|
||||||
|
mBinding.healthKnowledgeView.mBinding.tvEmpty.visibility = View.GONE
|
||||||
|
mBinding.healthKnowledgeView.mBinding.tvEmpty.text = "暂无健康知识"
|
||||||
|
|
||||||
|
mHealthInfoRequest?.fetchToken(
|
||||||
|
onSuccess = { token ->
|
||||||
|
mHealthToken = token
|
||||||
|
loadCategories(token)
|
||||||
|
},
|
||||||
|
onFailure = { /* Token 获取失败,静默处理 */ }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 加载栏目列表并设置健康知识 Tab */
|
||||||
|
private fun loadCategories(token: String) {
|
||||||
|
mHealthInfoRequest?.fetchCategoryList(
|
||||||
|
token,
|
||||||
|
onSuccess = { categories ->
|
||||||
|
// 查找健康知识栏目(categoryId=1)的子栏目
|
||||||
|
val knowledgeCategory = categories.find { it.categoryId == 1 }
|
||||||
|
mKnowledgeCategories.clear()
|
||||||
|
knowledgeCategory?.children?.let { mKnowledgeCategories.addAll(it) }
|
||||||
|
mBinding.healthKnowledgeView.setupTabs(mKnowledgeCategories)
|
||||||
|
|
||||||
|
// 默认加载第一个子栏目文章
|
||||||
|
if (mKnowledgeCategories.isNotEmpty()) {
|
||||||
|
loadKnowledgeArticles(mKnowledgeCategories[0].categoryId)
|
||||||
|
}
|
||||||
|
if (categories.isNotEmpty() && categories.size >= 2) {
|
||||||
|
loadConsultationArticles(categories[1].categoryId)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onFailure = { /* 栏目加载失败,静默处理 */ }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 加载健康知识指定栏目下的文章列表 */
|
||||||
|
private fun loadKnowledgeArticles(categoryId: Int) {
|
||||||
|
mHealthToken?.let { token ->
|
||||||
|
mHealthInfoRequest?.fetchArticleList(
|
||||||
|
token, categoryId,
|
||||||
|
onSuccess = { articles ->
|
||||||
|
mBinding.healthKnowledgeView.setArticles(articles)
|
||||||
|
},
|
||||||
|
onFailure = { /* 文章加载失败,静默处理 */ }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 加载健康咨询文章列表(categoryId) */
|
||||||
|
private fun loadConsultationArticles(categoryId: Int) {
|
||||||
|
mHealthToken?.let { token ->
|
||||||
|
mHealthInfoRequest?.fetchArticleList(
|
||||||
|
token, categoryId,
|
||||||
|
onSuccess = { articles ->
|
||||||
|
mBinding.healthConsultationView.setArticles(articles)
|
||||||
|
},
|
||||||
|
onFailure = { /* 文章加载失败,静默处理 */ }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 跳转文章详情 H5 */
|
||||||
|
private fun navigateToArticleDetail(articleId: Int) {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
val param = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (param.isNullOrEmpty()) {
|
||||||
|
showToast("网络错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val url = "${UrlConfig.getHealthNewsDetailH5Url()}?param=$param&articleId=$articleId"
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
url,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "文章详情",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
showToast("请先登录")
|
||||||
|
toActivity(LoginActivity::class.java)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 跳转健康知识更多 H5 */
|
||||||
|
private fun navigateToHealthKnowledgeMore() {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
val param = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (param.isNullOrEmpty()) {
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
showToast("网络错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val url = "${UrlConfig.getHealthKnowledgeH5Url()}?param=$param"
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
url,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "健康知识",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
showToast("请先登录")
|
||||||
|
toActivity(LoginActivity::class.java)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 跳转健康知识 搜索 */
|
||||||
|
private fun navigateToHealthKnowledgeSearch(key: String) {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
|
||||||
|
val param = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (param.isNullOrEmpty()) {
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
showToast("网络错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val url = "${UrlConfig.getHealthNewsSearchH5Url()}?param=$param&secrchVal=$key"
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
url,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "搜索",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
showToast("请先登录")
|
||||||
|
toActivity(LoginActivity::class.java)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 跳转健康咨询更多 H5 */
|
||||||
|
private fun navigateToHealthConsultationMore() {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
|
||||||
|
val param = mViewModel.enCryptInfoUrl.value
|
||||||
|
if (param.isNullOrEmpty()) {
|
||||||
|
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||||
|
showToast("网络错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val url = "${UrlConfig.getHealthConsultationH5Url()}?param=$param"
|
||||||
|
requireContext().startWebActivity(
|
||||||
|
url,
|
||||||
|
isFull = true,
|
||||||
|
myTitle = "健康咨询",
|
||||||
|
hideStatus = true
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
showToast("请先登录")
|
||||||
|
toActivity(LoginActivity::class.java)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ import com.xjjk.healthyclients.adapter.CvdMainAdapter
|
|||||||
import com.xjjk.healthyclients.base.BaseVMBFragment
|
import com.xjjk.healthyclients.base.BaseVMBFragment
|
||||||
import com.xjjk.healthyclients.base.viewmodel.TestViewModel
|
import com.xjjk.healthyclients.base.viewmodel.TestViewModel
|
||||||
import com.xjjk.healthyclients.bean.CvdMainBean
|
import com.xjjk.healthyclients.bean.CvdMainBean
|
||||||
import com.xjjk.healthyclients.bean.TitleTagBean
|
import com.xjjk.healthyclients.bean.CvdMainBeanNew
|
||||||
import com.xjjk.healthyclients.chart.DoubleWheelBPicker
|
import com.xjjk.healthyclients.chart.DoubleWheelBPicker
|
||||||
import com.xjjk.healthyclients.chart.HeartRateProvider
|
import com.xjjk.healthyclients.chart.HeartRateProvider
|
||||||
import com.xjjk.healthyclients.chart.TemperatureProvider
|
import com.xjjk.healthyclients.chart.TemperatureProvider
|
||||||
@@ -23,6 +23,7 @@ import com.xjjk.healthyclients.databinding.FragmentMonitorBinding
|
|||||||
import com.xjjk.healthyclients.retrofit.getHealthCheckRetrofit
|
import com.xjjk.healthyclients.retrofit.getHealthCheckRetrofit
|
||||||
import com.xjjk.healthyclients.retrofit.intervention.CallbackInterventionManager
|
import com.xjjk.healthyclients.retrofit.intervention.CallbackInterventionManager
|
||||||
import com.xjjk.healthyclients.superfuntion.initColors
|
import com.xjjk.healthyclients.superfuntion.initColors
|
||||||
|
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||||
import com.xjjk.healthyclients.ui.activity.CvdWarningHistoryActivity
|
import com.xjjk.healthyclients.ui.activity.CvdWarningHistoryActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.InterventionWebActivity
|
import com.xjjk.healthyclients.ui.activity.InterventionWebActivity
|
||||||
import com.xjjk.healthyclients.utils.ConstantUtils
|
import com.xjjk.healthyclients.utils.ConstantUtils
|
||||||
@@ -108,7 +109,6 @@ class MonitorFragment: BaseVMBFragment<TestViewModel, FragmentMonitorBinding>(R.
|
|||||||
mBinding.let {
|
mBinding.let {
|
||||||
addClickViews(it.stepLayout, it.sleepLayout)
|
addClickViews(it.stepLayout, it.sleepLayout)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// titleTextAdapter.setOnItemClickListener { adapter, view, position ->
|
// titleTextAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
@@ -117,29 +117,29 @@ class MonitorFragment: BaseVMBFragment<TestViewModel, FragmentMonitorBinding>(R.
|
|||||||
|
|
||||||
cvdMainAdapter.setOnItemClickListener { adapter, view, position ->
|
cvdMainAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
var data = adapter.data[position] as CvdMainBean.dataBean
|
var data = adapter.data[position] as CvdMainBean.dataBean
|
||||||
when (position) {
|
when (data.wdType) {
|
||||||
0 -> {
|
"heart_rate" -> {
|
||||||
var bundle = Bundle()
|
var bundle = Bundle()
|
||||||
bundle.putString("path", "heartRate")
|
bundle.putString("path", "heartRate")
|
||||||
bundle.putString("date", data.dataDate)
|
bundle.putString("date", data.dataDate)
|
||||||
toActivity(InterventionWebActivity::class.java, bundle)
|
toActivity(InterventionWebActivity::class.java, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
1 -> {
|
"spo2" -> {
|
||||||
var bundle = Bundle()
|
var bundle = Bundle()
|
||||||
bundle.putString("path", "oxygenSaturation")
|
bundle.putString("path", "oxygenSaturation")
|
||||||
bundle.putString("date", data.dataDate)
|
bundle.putString("date", data.dataDate)
|
||||||
toActivity(InterventionWebActivity::class.java, bundle)
|
toActivity(InterventionWebActivity::class.java, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
2 -> {
|
"stress" -> {
|
||||||
var bundle = Bundle()
|
var bundle = Bundle()
|
||||||
bundle.putString("path", "pressure")
|
bundle.putString("path", "pressure")
|
||||||
bundle.putString("date", data.dataDate)
|
bundle.putString("date", data.dataDate)
|
||||||
toActivity(InterventionWebActivity::class.java, bundle)
|
toActivity(InterventionWebActivity::class.java, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
3 -> {
|
"temperature" -> {
|
||||||
var bundle = Bundle()
|
var bundle = Bundle()
|
||||||
bundle.putString("path", "temperature")
|
bundle.putString("path", "temperature")
|
||||||
bundle.putString("date", data.dataDate)
|
bundle.putString("date", data.dataDate)
|
||||||
@@ -198,51 +198,59 @@ class MonitorFragment: BaseVMBFragment<TestViewModel, FragmentMonitorBinding>(R.
|
|||||||
private fun getHomePageUserInfo() {
|
private fun getHomePageUserInfo() {
|
||||||
dialog?.show()
|
dialog?.show()
|
||||||
var getCvdHomeData = mApi.getCvdHomeData(mUserId)
|
var getCvdHomeData = mApi.getCvdHomeData(mUserId)
|
||||||
getCvdHomeData.enqueue(object : CallbackInterventionManager<CvdMainBean>() {
|
getCvdHomeData.enqueue(object : CallbackInterventionManager<CvdMainBeanNew>() {
|
||||||
|
|
||||||
override fun onSuccess(
|
override fun onSuccess(
|
||||||
code: Int,
|
code: Int,
|
||||||
result: CvdMainBean?,
|
result: CvdMainBeanNew?,
|
||||||
message: String,
|
message: String,
|
||||||
ok: Boolean
|
ok: Boolean
|
||||||
) {
|
) {
|
||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
result?.let {
|
result?.let {
|
||||||
|
|
||||||
|
|
||||||
mBinding.sleepValue2Tv.text =
|
mBinding.sleepValue2Tv.text =
|
||||||
"平均睡眠${result.aveSleep.toInt() / 60}小时${result.aveSleep.toInt() % 60}分钟"
|
"平均睡眠${result.aveSleep.toInt() / 60}小时${result.aveSleep.toInt() % 60}分钟"
|
||||||
mBinding.stepValue2Tv.text = "累计约步行${result.distance / 1000}公里"
|
mBinding.stepValue2Tv.text = "累计约步行${result.distance / 1000}公里"
|
||||||
|
if (result.indexItemVos==null) {
|
||||||
|
return@let
|
||||||
|
}
|
||||||
|
|
||||||
var indexItemVos = result.indexItemVos
|
var indexItemVos = result.indexItemVos
|
||||||
|
|
||||||
val iterator = indexItemVos.iterator()
|
val iterator = indexItemVos!!.iterator()
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
val dataBean = iterator.next()
|
val dataBean = iterator.next()
|
||||||
if (dataBean.wdType.equals("sleep")) {
|
if (dataBean.wdType.equals("sleep")) {
|
||||||
mBinding.sleepDateTv.text = dataBean.dataDate
|
mBinding.sleepDateTv.text = dataBean.dataDate
|
||||||
var minutes: Float? = dataBean.dataValue.toFloatOrNull()
|
|
||||||
|
if (TextUtils.isEmpty(dataBean.dataValue)) {
|
||||||
|
mBinding.sleepValueHourTv.text = "--"
|
||||||
|
mBinding.sleepValueMinuteTv.text = "--"
|
||||||
|
} else {
|
||||||
|
var minutes: Float? = dataBean.dataValue?.toFloatOrNull()
|
||||||
mBinding.sleepValueHourTv.text =
|
mBinding.sleepValueHourTv.text =
|
||||||
"${minutes?.div(60)?.toUInt()}"
|
"${minutes?.div(60)?.toUInt()}"
|
||||||
mBinding.sleepValueMinuteTv.text =
|
mBinding.sleepValueMinuteTv.text =
|
||||||
"${minutes?.rem(60)?.toUInt()}"
|
"${minutes?.rem(60)?.toUInt()}"
|
||||||
|
}
|
||||||
iterator.remove()
|
iterator.remove()
|
||||||
}
|
}
|
||||||
if (dataBean.wdType.equals("steps")) {
|
if (dataBean.wdType.equals("steps")) {
|
||||||
mBinding.stepDateTv.text = dataBean.dataDate
|
mBinding.stepDateTv.text = dataBean.dataDate
|
||||||
mBinding.stepValueTv.text = "${dataBean.dataValue}"
|
mBinding.stepValueTv.text = "${dataBean.dataValue.orEmptyDefault()}"
|
||||||
|
|
||||||
iterator.remove()
|
iterator.remove()
|
||||||
}
|
}
|
||||||
if (dataBean.wdType.equals(TYPE_HEART_RATE)) {
|
if (dataBean.wdType.equals(TYPE_HEART_RATE)) {
|
||||||
if (!TextUtils.isEmpty(dataBean.warnMin) && !TextUtils.isEmpty(dataBean.warnMax)) {
|
if (!TextUtils.isEmpty(dataBean.warnMin) && !TextUtils.isEmpty(dataBean.warnMax)) {
|
||||||
heartRateDefaultMin = "${dataBean.warnMin.toFloat().toInt()}次/分钟"
|
heartRateDefaultMin = "${dataBean.warnMin!!.toFloat().toInt()}次/分钟"
|
||||||
heartRateDefaultMax = "${dataBean.warnMax.toFloat().toInt()}次/分钟"
|
heartRateDefaultMax = "${dataBean.warnMax!!.toFloat().toInt()}次/分钟"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dataBean.wdType.equals(TYPE_SPO2)) {
|
if (dataBean.wdType.equals(TYPE_SPO2)) {
|
||||||
if (!TextUtils.isEmpty(dataBean.warnMin)) {
|
if (!TextUtils.isEmpty(dataBean.warnMin)) {
|
||||||
spo2DefaultMin = dataBean.warnMin.toFloat().toInt()
|
spo2DefaultMin = dataBean.warnMin!!.toFloat().toInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dataBean.wdType.equals(TYPE_TEMPERATURE)) {
|
if (dataBean.wdType.equals(TYPE_TEMPERATURE)) {
|
||||||
@@ -253,7 +261,7 @@ class MonitorFragment: BaseVMBFragment<TestViewModel, FragmentMonitorBinding>(R.
|
|||||||
}
|
}
|
||||||
if (dataBean.wdType.equals(TYPE_STRESS)) {
|
if (dataBean.wdType.equals(TYPE_STRESS)) {
|
||||||
if (!TextUtils.isEmpty(dataBean.warnMax)) {
|
if (!TextUtils.isEmpty(dataBean.warnMax)) {
|
||||||
StressDefaultMin = dataBean.warnMax.toFloat().toInt()
|
StressDefaultMin = dataBean.warnMax!!.toFloat().toInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,12 @@ import com.xjjk.healthyclients.superfuntion.loadCircle
|
|||||||
import com.xjjk.healthyclients.superfuntion.startConsultantManagerActivity
|
import com.xjjk.healthyclients.superfuntion.startConsultantManagerActivity
|
||||||
import com.xjjk.healthyclients.superfuntion.startEmergencySeekDoctorActivity
|
import com.xjjk.healthyclients.superfuntion.startEmergencySeekDoctorActivity
|
||||||
import com.xjjk.healthyclients.superfuntion.startLoginActivity
|
import com.xjjk.healthyclients.superfuntion.startLoginActivity
|
||||||
|
import com.xjjk.healthyclients.superfuntion.startSimulateUserActivity
|
||||||
import com.xjjk.healthyclients.superfuntion.startUserInfoSettingActivity
|
import com.xjjk.healthyclients.superfuntion.startUserInfoSettingActivity
|
||||||
import com.xjjk.healthyclients.superfuntion.startUserMyGuidanceActivity
|
import com.xjjk.healthyclients.superfuntion.startUserMyGuidanceActivity
|
||||||
import com.xjjk.healthyclients.superfuntion.startUserSettingActivity
|
import com.xjjk.healthyclients.superfuntion.startUserSettingActivity
|
||||||
import com.xjjk.healthyclients.superfuntion.startUserSoSContactsActivity
|
import com.xjjk.healthyclients.superfuntion.startUserSoSContactsActivity
|
||||||
|
import com.xjjk.healthyclients.ui.activity.home.HomeNoticeListActivity
|
||||||
import com.xjjk.healthyclients.ui.viewmodel.UserInfoFragmentViewModel
|
import com.xjjk.healthyclients.ui.viewmodel.UserInfoFragmentViewModel
|
||||||
import com.xjjk.healthyclients.utils.ConstantUtils
|
import com.xjjk.healthyclients.utils.ConstantUtils
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
@@ -53,7 +55,8 @@ class UserInfoFragment :
|
|||||||
mList.clear()
|
mList.clear()
|
||||||
mList.add(UserMenuBean(1, "咨询人管理", R.drawable.ic_user_personnel_manager, View.VISIBLE))
|
mList.add(UserMenuBean(1, "咨询人管理", R.drawable.ic_user_personnel_manager, View.VISIBLE))
|
||||||
mList.add(UserMenuBean(3, "应急就医", R.drawable.ic_user_sos, View.VISIBLE))
|
mList.add(UserMenuBean(3, "应急就医", R.drawable.ic_user_sos, View.VISIBLE))
|
||||||
mList.add(UserMenuBean(8,"紧急联系人",R.drawable.ic_user_contacts,View.INVISIBLE))
|
mList.add(UserMenuBean(8,"紧急联系人",R.drawable.ic_user_contacts,View.VISIBLE))
|
||||||
|
mList.add(UserMenuBean(4, "消息通知", R.drawable.ic_user_message, View.INVISIBLE))
|
||||||
|
|
||||||
|
|
||||||
mUserMenuAdapter =
|
mUserMenuAdapter =
|
||||||
@@ -72,7 +75,7 @@ class UserInfoFragment :
|
|||||||
if (mHits[0] >= (SystemClock.uptimeMillis() - time)) {
|
if (mHits[0] >= (SystemClock.uptimeMillis() - time)) {
|
||||||
//数组重新初始化
|
//数组重新初始化
|
||||||
mHits = LongArray(mCount)
|
mHits = LongArray(mCount)
|
||||||
// startSimulateUserActivity(requireContext())
|
startSimulateUserActivity(requireContext())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +171,9 @@ class UserInfoFragment :
|
|||||||
3 -> {
|
3 -> {
|
||||||
context?.let { startEmergencySeekDoctorActivity(it) }
|
context?.let { startEmergencySeekDoctorActivity(it) }
|
||||||
}
|
}
|
||||||
|
4 -> {
|
||||||
|
toActivity(HomeNoticeListActivity::class.java)
|
||||||
|
}
|
||||||
8 -> {
|
8 -> {
|
||||||
requireContext().startUserSoSContactsActivity()
|
requireContext().startUserSoSContactsActivity()
|
||||||
}
|
}
|
||||||
@@ -188,10 +194,6 @@ class UserInfoFragment :
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStatusbarStyle(): Int {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
when (v?.id) {
|
when (v?.id) {
|
||||||
R.id.user_tv_look_all -> {
|
R.id.user_tv_look_all -> {
|
||||||
|
|||||||
@@ -0,0 +1,191 @@
|
|||||||
|
package com.xjjk.healthyclients.fragment
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.view.View
|
||||||
|
import com.sw.healthyclients.utils.DateUtil
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.base.BaseVMBFragment
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeWatchAllDataBean
|
||||||
|
import com.xjjk.healthyclients.databinding.FragmentItemWatchBinding
|
||||||
|
import com.xjjk.healthyclients.event.WatchDataChangeEvent
|
||||||
|
import com.xjjk.healthyclients.superfuntion.floatToInt
|
||||||
|
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||||
|
import com.xjjk.healthyclients.ui.viewmodel.HomeViewModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手表item
|
||||||
|
* 数据类型:0=心率 1=血氧 2=压力 3=体温 4=睡眠
|
||||||
|
*/
|
||||||
|
class WatchItemFragment :
|
||||||
|
BaseVMBFragment<HomeViewModel, FragmentItemWatchBinding>(R.layout.fragment_item_watch) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* 创建 WatchItemFragment 实例,通过 arguments 传入 Tab 位置
|
||||||
|
* @param position Tab 位置(0=心率 1=血氧 2=压力 3=体温 4=睡眠)
|
||||||
|
*/
|
||||||
|
fun newInstance(position: Int): WatchItemFragment {
|
||||||
|
val args = Bundle()
|
||||||
|
args.putInt("position", position)
|
||||||
|
return WatchItemFragment().apply {
|
||||||
|
arguments = args
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var position: Int = -1
|
||||||
|
|
||||||
|
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
|
position = arguments?.getInt("position") ?: -1
|
||||||
|
mBinding.watchTypeImg.setImageResource(getWatchTypeImg(position))
|
||||||
|
|
||||||
|
if (position != 4) {
|
||||||
|
mBinding.watchType.text = "" + mBinding.watchType.getText() + getWatchTypeText(position)
|
||||||
|
mBinding.watchLeftText.text = getWatchTypeText(position) + "范围"
|
||||||
|
mBinding.watchRightText.text = "平均" + getWatchTypeText(position)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mBinding.watchType.text = "睡眠总时长"
|
||||||
|
mBinding.watchLeftText.text = "深睡时长"
|
||||||
|
mBinding.watchRightText.text = "浅睡时长"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mBinding.watchValueUnit.text = getWatchUnitText(position)
|
||||||
|
mBinding.watchLeftUnit.text = getWatchUnitText(position)
|
||||||
|
mBinding.watchRightUnit.text = getWatchUnitText(position)
|
||||||
|
|
||||||
|
refreshWatchData(null)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(v: View?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收手表数据变更事件,按当前 Tab position 取出对应数据并刷新界面
|
||||||
|
*/
|
||||||
|
override fun onMessageEvent(event: Any?) {
|
||||||
|
super.onMessageEvent(event)
|
||||||
|
if (event is WatchDataChangeEvent) {
|
||||||
|
event.dataList?.sortBy { it.type }
|
||||||
|
val bean = event.dataList?.getOrNull(position ?: -1)
|
||||||
|
refreshWatchData(bean)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将接口数据填充到各 UI 控件
|
||||||
|
* @param bean 当前 Tab 对应的一条手表健康数据
|
||||||
|
*/
|
||||||
|
private fun refreshWatchData(bean: HomeWatchAllDataBean?) {
|
||||||
|
// 采集时间
|
||||||
|
mBinding.watchTime.text = bean?.latestTime.orEmptyDefault()
|
||||||
|
|
||||||
|
if (position == 1 || position == 2 || position == 0) {
|
||||||
|
// 最新值 + 单位
|
||||||
|
if (TextUtils.isEmpty(bean?.latest)) {
|
||||||
|
mBinding.watchValue.text = "--"
|
||||||
|
} else {
|
||||||
|
mBinding.watchValue.text = "${bean?.latest.floatToInt()}"
|
||||||
|
}
|
||||||
|
// 范围:min ~ max
|
||||||
|
if (TextUtils.isEmpty(bean?.min)) {
|
||||||
|
mBinding.watchLeftValue.text = "--"
|
||||||
|
} else {
|
||||||
|
mBinding.watchLeftValue.text =
|
||||||
|
"${bean?.min.floatToInt()}-${bean?.max.floatToInt()}"
|
||||||
|
}
|
||||||
|
// 平均值
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(bean?.avg)) {
|
||||||
|
mBinding.watchRightValue.text = "--"
|
||||||
|
} else {
|
||||||
|
mBinding.watchRightValue.text = "${bean?.avg.floatToInt()}"
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (position == 3) {
|
||||||
|
// 最新值 + 单位
|
||||||
|
mBinding.watchValue.text = bean?.latest.orEmptyDefault()
|
||||||
|
// 范围:min ~ max
|
||||||
|
if (TextUtils.isEmpty(bean?.min)) {
|
||||||
|
mBinding.watchLeftValue.text = "--"
|
||||||
|
} else {
|
||||||
|
mBinding.watchLeftValue.text =
|
||||||
|
"${bean?.min.orEmptyDefault()}-${bean?.max.orEmptyDefault()}"
|
||||||
|
}
|
||||||
|
// 平均值
|
||||||
|
mBinding.watchRightValue.text = bean?.avg.orEmptyDefault()
|
||||||
|
|
||||||
|
} else if (position == 4) {
|
||||||
|
|
||||||
|
//睡眠数据单独处理
|
||||||
|
if (bean == null) {
|
||||||
|
mBinding.watchValue.text = "--"
|
||||||
|
mBinding.watchLeftValue.text = "--"
|
||||||
|
mBinding.watchRightValue.text = "--"
|
||||||
|
} else {
|
||||||
|
if (TextUtils.isEmpty(bean.latest)||bean.latest.floatToInt()==0) {
|
||||||
|
mBinding.watchValue.text = "--分钟"
|
||||||
|
} else {
|
||||||
|
mBinding.watchValue.text =
|
||||||
|
DateUtil.timeDiff(bean.latest!!.floatToInt().toLong() * 1000 * 60)
|
||||||
|
.orEmptyDefault()
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(bean.max)||bean.max.floatToInt()==0) {
|
||||||
|
mBinding.watchLeftValue.text = "--分钟"
|
||||||
|
} else {
|
||||||
|
mBinding.watchLeftValue.text =
|
||||||
|
DateUtil.timeDiff(bean.max!!.floatToInt().toLong() * 1000 * 60)
|
||||||
|
.orEmptyDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(bean.min)||bean.min.floatToInt()==0) {
|
||||||
|
mBinding.watchRightValue.text = "--分钟"
|
||||||
|
} else {
|
||||||
|
mBinding.watchRightValue.text =
|
||||||
|
DateUtil.timeDiff(bean.min!!.floatToInt().toLong() * 1000 * 60)
|
||||||
|
.orEmptyDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getWatchTypeImg(type: Int?): Int {
|
||||||
|
return when (type) {
|
||||||
|
0 -> R.mipmap.ic_home_watch_tab1
|
||||||
|
1 -> R.mipmap.ic_home_watch_tab2
|
||||||
|
2 -> R.mipmap.ic_home_watch_tab3
|
||||||
|
3 -> R.mipmap.ic_home_watch_tab4
|
||||||
|
4 -> R.mipmap.ic_home_watch_tab5
|
||||||
|
else -> R.mipmap.ic_home_watch_tab1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getWatchTypeText(type: Int?): String {
|
||||||
|
return when (type) {
|
||||||
|
0 -> "心率"
|
||||||
|
1 -> "血氧"
|
||||||
|
2 -> "压力"
|
||||||
|
3 -> "体温"
|
||||||
|
else -> ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getWatchUnitText(type: Int?): String {
|
||||||
|
return when (type) {
|
||||||
|
0 -> "次/分钟"
|
||||||
|
1 -> "%"
|
||||||
|
2 -> ""
|
||||||
|
3 -> "℃"
|
||||||
|
|
||||||
|
else -> ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package com.xjjk.healthyclients.fragment.adapter
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.xjjk.healthyclients.bean.emergency.GroupInfo
|
||||||
|
import com.xjjk.healthyclients.databinding.ItemGroupInfoBinding
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 急救工单选择适配器,支持单选
|
||||||
|
*/
|
||||||
|
class GroupInfoAdapter(
|
||||||
|
private val items: List<GroupInfo>,
|
||||||
|
private val onSelectionChanged: (Int) -> Unit
|
||||||
|
) : RecyclerView.Adapter<GroupInfoAdapter.ViewHolder>() {
|
||||||
|
|
||||||
|
/** 当前选中位置,-1 表示无选中 */
|
||||||
|
var selectedPosition = -1
|
||||||
|
private set
|
||||||
|
|
||||||
|
/** 获取当前选中的工单 */
|
||||||
|
val selectedItem: GroupInfo?
|
||||||
|
get() = if (selectedPosition in items.indices) items[selectedPosition] else null
|
||||||
|
|
||||||
|
/** 选中主色 */
|
||||||
|
private var colorPrimary = 0
|
||||||
|
/** 未选中灰色 */
|
||||||
|
private var colorGray = 0
|
||||||
|
private var colorDark = 0
|
||||||
|
private var colorBody = 0
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
val binding = ItemGroupInfoBinding.inflate(
|
||||||
|
LayoutInflater.from(parent.context), parent, false
|
||||||
|
)
|
||||||
|
// 初始化颜色值
|
||||||
|
if (colorPrimary == 0) {
|
||||||
|
colorPrimary = ContextCompat.getColor(parent.context, com.xjjk.healthyclients.R.color.emergency_primary)
|
||||||
|
colorGray = ContextCompat.getColor(parent.context, com.xjjk.healthyclients.R.color.emergency_text_gray)
|
||||||
|
colorDark = ContextCompat.getColor(parent.context, com.xjjk.healthyclients.R.color.emergency_text_dark)
|
||||||
|
colorBody = ContextCompat.getColor(parent.context, com.xjjk.healthyclients.R.color.emergency_text_body)
|
||||||
|
}
|
||||||
|
return ViewHolder(binding)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
holder.bind(items[position], position == selectedPosition)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount(): Int = items.size
|
||||||
|
|
||||||
|
inner class ViewHolder(private val binding: ItemGroupInfoBinding) :
|
||||||
|
RecyclerView.ViewHolder(binding.root) {
|
||||||
|
|
||||||
|
private var currentPosition = -1
|
||||||
|
|
||||||
|
init {
|
||||||
|
binding.rootItem.setOnClickListener {
|
||||||
|
val oldPos = selectedPosition
|
||||||
|
if (oldPos == currentPosition) {
|
||||||
|
// 取消选中
|
||||||
|
selectedPosition = -1
|
||||||
|
notifyItemChanged(currentPosition)
|
||||||
|
onSelectionChanged(-1)
|
||||||
|
} else {
|
||||||
|
selectedPosition = currentPosition
|
||||||
|
notifyItemChanged(oldPos)
|
||||||
|
notifyItemChanged(currentPosition)
|
||||||
|
onSelectionChanged(currentPosition)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bind(groupInfo: GroupInfo, isSelected: Boolean) {
|
||||||
|
currentPosition = adapterPosition
|
||||||
|
val ctx = binding.root.context
|
||||||
|
|
||||||
|
// 姓名
|
||||||
|
binding.tvUserName.text = groupInfo.salvageUserName
|
||||||
|
|
||||||
|
// 部门标签
|
||||||
|
binding.tvDeptName.text = groupInfo.deptName
|
||||||
|
|
||||||
|
// 地址
|
||||||
|
binding.tvOrgName.text = groupInfo.orgName
|
||||||
|
|
||||||
|
// 时间
|
||||||
|
binding.tvInitTime.text = "求助时间:${groupInfo.initTime}"
|
||||||
|
|
||||||
|
if (isSelected) {
|
||||||
|
// 选中态
|
||||||
|
binding.rootItem.setBackgroundResource(com.xjjk.healthyclients.R.drawable.bg_emergency_item_selected)
|
||||||
|
binding.ivRadio.setImageResource(com.xjjk.healthyclients.R.drawable.ic_emergency_radio_selected)
|
||||||
|
|
||||||
|
binding.tvDeptName.setTextColor(colorPrimary)
|
||||||
|
binding.tvDeptName.setBackgroundResource(com.xjjk.healthyclients.R.drawable.bg_dept_badge_selected)
|
||||||
|
|
||||||
|
binding.tvInitTime.setTextColor(colorPrimary)
|
||||||
|
binding.ivLocation.imageTintList = ColorStateList.valueOf(colorPrimary)
|
||||||
|
binding.ivClock.imageTintList = ColorStateList.valueOf(colorPrimary)
|
||||||
|
} else {
|
||||||
|
// 未选中态
|
||||||
|
binding.rootItem.setBackgroundResource(com.xjjk.healthyclients.R.drawable.bg_emergency_item_unselected)
|
||||||
|
binding.ivRadio.setImageResource(com.xjjk.healthyclients.R.drawable.ic_emergency_radio_unselected)
|
||||||
|
|
||||||
|
binding.tvDeptName.setTextColor(colorGray)
|
||||||
|
binding.tvDeptName.setBackgroundResource(com.xjjk.healthyclients.R.drawable.bg_dept_badge_unselected)
|
||||||
|
|
||||||
|
binding.tvInitTime.setTextColor(colorGray)
|
||||||
|
binding.ivLocation.imageTintList = ColorStateList.valueOf(colorGray)
|
||||||
|
binding.ivClock.imageTintList = ColorStateList.valueOf(colorGray)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.xjjk.healthyclients.retrofit
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.retrofit.UrlConfig.getDefaultBankBaseUrl
|
||||||
|
import com.xjjk.healthyclients.utils.ApiDns
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import retrofit2.Retrofit
|
||||||
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
fun getBankRetrofit(): Retrofit {
|
||||||
|
val builder = OkHttpClient.Builder()
|
||||||
|
builder.connectTimeout(30, TimeUnit.SECONDS)
|
||||||
|
builder.readTimeout(30, TimeUnit.SECONDS)
|
||||||
|
// builder.addInterceptor(LoggingInterceptor2())
|
||||||
|
builder.dns(ApiDns())
|
||||||
|
var baseUrl = getDefaultBankBaseUrl()
|
||||||
|
return Retrofit.Builder()
|
||||||
|
.baseUrl(baseUrl)
|
||||||
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.client(builder.build())
|
||||||
|
.build()
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.xjjk.healthyclients.retrofit
|
package com.xjjk.healthyclients.retrofit
|
||||||
|
|
||||||
import com.sw.healthyclients.data.local.DataStoreManager
|
import com.sw.healthyclients.data.local.DataStoreManager
|
||||||
import com.xjjk.healthyclients.utils.UrlH5RouteUtils
|
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
|
|
||||||
object UrlConfig {
|
object UrlConfig {
|
||||||
@@ -13,24 +12,49 @@ object UrlConfig {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://192.168.1.23/" // 开发环境
|
private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://192.168.1.47" // 开发环境
|
||||||
private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://api-xj.tri.dt.io/" // 开发环境
|
// private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://api-xj.tri.dt.io/" // 开发环境
|
||||||
private const val TEST_DEFAULT_IP_ADDRESS_REMOTE = "https://api-xj.tri.icdat.cn" // 测试环境
|
// private const val TEST_DEFAULT_IP_ADDRESS_REMOTE = "https://xj-api.mcrm.vip:8888" // 测试环境
|
||||||
|
private const val TEST_DEFAULT_IP_ADDRESS_REMOTE = "https://xj-api.yixiong-tech.com:8081" // 测试环境
|
||||||
// private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "https://api.xjygjk.com" // 正式环境
|
// private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "https://api.xjygjk.com" // 正式环境
|
||||||
private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "https://api-jkglpt.iosp.ydpt.tech" // 正式环境
|
private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "https://api-jkglpt.iosp.ydpt.tech" // 正式环境
|
||||||
|
|
||||||
private const val DEBUG_H5_ADDRESS_REMOTE = "http://console-xj.tri.dt.io" // 开发环境
|
private const val DEBUG_H5_ADDRESS_REMOTE = "http://console-xj.tri.dt.io" // 开发环境
|
||||||
private const val TEST_H5_ADDRESS_REMOTE = "https://console-xj.tri.icdat.cn" // 测试环境
|
private const val TEST_H5_ADDRESS_REMOTE = "http://10.10.10.228:23006" // 测试环境
|
||||||
// private const val PRODUCT_H5_ADDRESS_REMOTE = "https://console.xjygjk.com" // 正式环境
|
// private const val PRODUCT_H5_ADDRESS_REMOTE = "https://console.xjygjk.com" // 正式环境
|
||||||
private const val PRODUCT_H5_ADDRESS_REMOTE = "https://console-jkglpt.iosp.ydpt.tech" // 正式环境
|
private const val PRODUCT_H5_ADDRESS_REMOTE = "https://console-jkglpt.iosp.ydpt.tech" // 正式环境
|
||||||
//2025年10月23日 14:37 冯普说改为阿里云的地址,给油田部署的正式地址还没有启用
|
//2025年10月23日 14:37 冯普说改为阿里云的地址,给油田部署的正式地址还没有启用
|
||||||
// 2025年11月5日 09:27 冯普说改为给油田部署的正式地址并打包加固
|
// 2025年11月5日 09:27 冯普说改为给油田部署的正式地址并打包加固
|
||||||
|
|
||||||
|
// 安眼修改密码
|
||||||
|
const val ANYAN_CHANGE_PASSWORD_H5 = "https://sso.iosp.ydpt.tech/SSOManageClient/userController/changePassword"
|
||||||
|
|
||||||
|
//健康银行
|
||||||
|
private const val TEST_HOME_BANK_H5 = "https://gstest.superwx.cn/healthbank/index.html"
|
||||||
|
private const val PRODUCT_HOME_BANK_H5 = "https://console-jkglpt.iosp.ydpt.tech/hb/healthweb/index.html"
|
||||||
|
|
||||||
|
//健康体检
|
||||||
|
private const val PRODUCT_HOME_HEALTH_CHECK_H5 = "https://console-jkglpt.iosp.ydpt.tech/hb/healthcheckweb/index.html"
|
||||||
|
private const val TEST_HOME_HEALTH_CHECK_H5 = "https://gstest.superwx.cn/healthcheckweb/index.html"
|
||||||
|
|
||||||
|
//体重智能管理
|
||||||
|
private const val PRODUCT_HOME_WEIGHT_MANAGEMENT_H5 = "https://console-jkglpt.iosp.ydpt.tech/hb/healthweightweb/index.html"
|
||||||
|
//健康档案
|
||||||
|
private const val PRODUCT_HOME_HEALTH_FILE_H5 = "https://console-jkglpt.iosp.ydpt.tech/hb/healthfileweb/index.html"
|
||||||
|
|
||||||
|
|
||||||
|
//手机银行
|
||||||
|
const val SECRET_KEY = "XJp3EHpcnwReXc1A"
|
||||||
|
private const val TEST_HOME_BANK_IP = "https://gstest.superwx.cn/"
|
||||||
|
|
||||||
|
|
||||||
val baseUrlType: BaseUrlType = BaseUrlType.PRODUCT
|
val baseUrlType: BaseUrlType = BaseUrlType.PRODUCT
|
||||||
|
|
||||||
var testDeviceList = mutableListOf("7e8e7e49a26340b1","bb2d17cc138d109f")//测试设备列表 荣耀 oppo vivo
|
// const val middle = "xj_health/" //test
|
||||||
var isTestDevice: Boolean = false
|
// const val middleCheck = "healthcheck/" //test
|
||||||
|
const val middle = "hb/" //product
|
||||||
|
const val middleCheck = "hb/" //product
|
||||||
|
|
||||||
var isOpenIm: Boolean = true
|
var isOpenIm: Boolean = true
|
||||||
|
|
||||||
enum class BaseUrlType(val type: Int) {
|
enum class BaseUrlType(val type: Int) {
|
||||||
@@ -54,6 +78,19 @@ object UrlConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getBankBaseUrl(baseUrlType: BaseUrlType = BaseUrlType.PRODUCT): String {
|
||||||
|
return when (baseUrlType) {
|
||||||
|
BaseUrlType.DEBUG, BaseUrlType.TEST -> {
|
||||||
|
TEST_HOME_BANK_IP
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseUrlType.PRODUCT -> {
|
||||||
|
PRODUCT_DEFAULT_IP_ADDRESS_REMOTE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun getH5BaseUrl(baseUrlType: BaseUrlType = BaseUrlType.PRODUCT): String {
|
fun getH5BaseUrl(baseUrlType: BaseUrlType = BaseUrlType.PRODUCT): String {
|
||||||
return when (baseUrlType) {
|
return when (baseUrlType) {
|
||||||
BaseUrlType.DEBUG -> {
|
BaseUrlType.DEBUG -> {
|
||||||
@@ -69,6 +106,97 @@ object UrlConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getH5BaseXjUrl(baseUrlType: BaseUrlType = BaseUrlType.PRODUCT): String {
|
||||||
|
return when (baseUrlType) {
|
||||||
|
BaseUrlType.DEBUG, BaseUrlType.TEST -> {
|
||||||
|
TEST_HOME_BANK_IP
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseUrlType.PRODUCT -> {
|
||||||
|
"$PRODUCT_H5_ADDRESS_REMOTE/hb/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBankH5Url(baseUrlType: BaseUrlType = BaseUrlType.PRODUCT): String {
|
||||||
|
return when (baseUrlType) {
|
||||||
|
BaseUrlType.DEBUG, BaseUrlType.TEST-> {
|
||||||
|
TEST_HOME_BANK_H5
|
||||||
|
}
|
||||||
|
BaseUrlType.PRODUCT -> {
|
||||||
|
PRODUCT_HOME_BANK_H5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getHealthCheckH5Url(baseUrlType: BaseUrlType = BaseUrlType.PRODUCT): String {
|
||||||
|
return when (baseUrlType) {
|
||||||
|
BaseUrlType.DEBUG, BaseUrlType.TEST-> {
|
||||||
|
TEST_HOME_HEALTH_CHECK_H5
|
||||||
|
}
|
||||||
|
BaseUrlType.PRODUCT -> {
|
||||||
|
PRODUCT_HOME_HEALTH_CHECK_H5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getWeightManagementH5Url(baseUrlType: BaseUrlType = BaseUrlType.PRODUCT): String {
|
||||||
|
return when (baseUrlType) {
|
||||||
|
BaseUrlType.DEBUG, BaseUrlType.TEST-> {
|
||||||
|
PRODUCT_HOME_WEIGHT_MANAGEMENT_H5
|
||||||
|
}
|
||||||
|
BaseUrlType.PRODUCT -> {
|
||||||
|
PRODUCT_HOME_WEIGHT_MANAGEMENT_H5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun getHealthFileH5Url(baseUrlType: BaseUrlType = BaseUrlType.PRODUCT): String {
|
||||||
|
return when (baseUrlType) {
|
||||||
|
BaseUrlType.DEBUG, BaseUrlType.TEST-> {
|
||||||
|
PRODUCT_HOME_HEALTH_FILE_H5
|
||||||
|
}
|
||||||
|
BaseUrlType.PRODUCT -> {
|
||||||
|
PRODUCT_HOME_HEALTH_FILE_H5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康资讯 H5 页面基础地址
|
||||||
|
*/
|
||||||
|
fun getHealthNewsH5BaseUrl(): String {
|
||||||
|
return getH5BaseXjUrl() + "healthnewsweb/"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康知识 H5 页面地址
|
||||||
|
*/
|
||||||
|
fun getHealthKnowledgeH5Url(): String {
|
||||||
|
return getHealthNewsH5BaseUrl() + "healthKnow.html"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康咨询 H5 页面地址
|
||||||
|
*/
|
||||||
|
fun getHealthConsultationH5Url(): String {
|
||||||
|
return getHealthNewsH5BaseUrl() + "healthNews.html"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康资讯详情 H5 页面地址
|
||||||
|
*/
|
||||||
|
fun getHealthNewsDetailH5Url(): String {
|
||||||
|
return getHealthNewsH5BaseUrl() + "healthNewsDetail.html"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康资讯搜索 H5 页面地址
|
||||||
|
*/
|
||||||
|
fun getHealthNewsSearchH5Url(): String {
|
||||||
|
return getHealthNewsH5BaseUrl() + "healthSecrch.html"
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 方便后续加一些其他逻辑
|
* 方便后续加一些其他逻辑
|
||||||
*/
|
*/
|
||||||
@@ -76,6 +204,13 @@ object UrlConfig {
|
|||||||
return getBaseUrl(baseUrlType)
|
return getBaseUrl(baseUrlType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机银行
|
||||||
|
*/
|
||||||
|
fun getDefaultBankBaseUrl(): String {
|
||||||
|
return getBankBaseUrl(baseUrlType)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 方便在APP运行之后切换环境所以用 get获取
|
* 方便在APP运行之后切换环境所以用 get获取
|
||||||
*/
|
*/
|
||||||
@@ -97,67 +232,38 @@ object UrlConfig {
|
|||||||
return getH5BaseUrl(baseUrlType) + "/static/monitor/index.html?"
|
return getH5BaseUrl(baseUrlType) + "/static/monitor/index.html?"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取评估报告模块地址
|
* 手机银行外链h5 参数
|
||||||
* @param type 0,健康风险 1,心理评估
|
|
||||||
*/
|
*/
|
||||||
|
fun getHomeBankH5Url(): String{
|
||||||
|
var httpUrl = getDefaultBaseUrl().toHttpUrl()
|
||||||
|
|
||||||
// fun getEvaluationReportUrl(type: Int): String {
|
return "scheme=" + httpUrl.scheme +
|
||||||
|
"&host=" + httpUrl.host +
|
||||||
|
"&tokenF=" + DataStoreManager.getToken()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun urlReplace(): String {
|
||||||
|
return getDefaultBaseUrl().replace("http://", "")
|
||||||
|
.replace("https://", "")
|
||||||
|
.replace("/", "")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// fun getKnowledgeDetailUrl(@UrlH5RouteUtils.RouteType routeType: String, map: MutableMap<String, Any?> = mutableMapOf()):String{
|
||||||
|
//// return "http://192.168.1.22:9000/#/rich-text?id=sacsacasc&value=123132132"
|
||||||
|
// var params=""
|
||||||
|
// map.mapKeys {
|
||||||
|
// params += "&${it.key}=${it.value}"
|
||||||
|
// }
|
||||||
// var httpUrl = getDefaultBaseUrl().toHttpUrl()
|
// var httpUrl = getDefaultBaseUrl().toHttpUrl()
|
||||||
// return getH5Url() +
|
// return getH5Url() + "/" +routeType+
|
||||||
// "/?scheme=" + httpUrl.scheme +
|
// "?scheme=" + httpUrl.scheme +
|
||||||
// "&host=" + httpUrl.host +
|
// "&host=" + httpUrl.host +
|
||||||
// "&mobile=0" +
|
|
||||||
// "&tokenF=" + DataStoreManager.getToken() +
|
// "&tokenF=" + DataStoreManager.getToken() +
|
||||||
// "&type=" + type
|
// params
|
||||||
// }
|
|
||||||
fun getKnowledgeDetailUrl(@UrlH5RouteUtils.RouteType routeType: String, map: MutableMap<String, Any?> = mutableMapOf()):String{
|
|
||||||
// return "http://192.168.1.22:9000/#/rich-text?id=sacsacasc&value=123132132"
|
|
||||||
var params=""
|
|
||||||
map.mapKeys {
|
|
||||||
params += "&${it.key}=${it.value}"
|
|
||||||
}
|
|
||||||
var httpUrl = getDefaultBaseUrl().toHttpUrl()
|
|
||||||
return getH5Url() + "/" +routeType+
|
|
||||||
"?scheme=" + httpUrl.scheme +
|
|
||||||
"&host=" + httpUrl.host +
|
|
||||||
"&tokenF=" + DataStoreManager.getToken() +
|
|
||||||
params
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取健康干预-膳食 接口地址
|
|
||||||
*/
|
|
||||||
// fun getInterventionFoodUrl():String {
|
|
||||||
// return when (baseUrlType) {
|
|
||||||
// BaseUrlType.DEBUG,BaseUrlType.TEST -> {
|
|
||||||
// "https://vip.shuziweidao.com"
|
|
||||||
// }
|
|
||||||
// BaseUrlType.PRODUCT -> {
|
|
||||||
// "https://yyjk.shuziweidao.com/"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
|
||||||
* H5访问地址
|
|
||||||
*/
|
|
||||||
fun getH5PdfUrl(): String {
|
|
||||||
// https://jkgy.wcrcnet.cn/static/mobile/indexSon?
|
|
||||||
// // scheme=http
|
|
||||||
// // s&host=jkgy.wcrcnet.cn
|
|
||||||
// // &hostAfter=gateway
|
|
||||||
// // &pdfUrl=temp/20240530/AED%E4%BD%BF%E7%94%A8.pdf_1717056401896.pdf
|
|
||||||
|
|
||||||
val baseUrl = getH5BaseUrl(baseUrlType) + "/static/mobile/indexSon?"
|
|
||||||
var httpUrl = getDefaultBaseUrl().toHttpUrl()
|
|
||||||
return baseUrl +
|
|
||||||
"scheme=" + httpUrl.scheme +
|
|
||||||
"&host=" + httpUrl.host +
|
|
||||||
"&title=" + "文件详情" +
|
|
||||||
"&pdfUrl="
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.xjjk.healthyclients.superfuntion
|
||||||
|
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageView
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeBannerBean
|
||||||
|
import com.youth.banner.Banner
|
||||||
|
import com.youth.banner.adapter.BannerAdapter
|
||||||
|
import com.youth.banner.adapter.BannerImageAdapter
|
||||||
|
import com.youth.banner.config.IndicatorConfig
|
||||||
|
import com.youth.banner.holder.BannerImageHolder
|
||||||
|
import com.youth.banner.indicator.CircleIndicator
|
||||||
|
|
||||||
|
fun Fragment.showBanner(
|
||||||
|
banner: Banner<Any, BannerAdapter<Any, *>>,
|
||||||
|
bannerDataList: List<HomeBannerBean>,
|
||||||
|
listener: ((HomeBannerBean)-> Unit)? = null
|
||||||
|
) {
|
||||||
|
val bannerImageAdapter = object : BannerImageAdapter<HomeBannerBean>(bannerDataList) {
|
||||||
|
override fun onBindView(
|
||||||
|
holder: BannerImageHolder?,
|
||||||
|
data: HomeBannerBean?,
|
||||||
|
position: Int,
|
||||||
|
size: Int
|
||||||
|
) {
|
||||||
|
context?.let {
|
||||||
|
holder!!.imageView.load(data?.photoUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateHolder(parent: ViewGroup?, viewType: Int): BannerImageHolder {
|
||||||
|
val imageView = ImageView(parent?.context)
|
||||||
|
//注意,必须设置为match_parent,这个是viewpager2强制要求的
|
||||||
|
val params = ViewGroup.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
imageView.layoutParams = params
|
||||||
|
// imageView.scaleType = ImageView.ScaleType.CENTER_CROP
|
||||||
|
imageView.adjustViewBounds = true
|
||||||
|
imageView.scaleType = ImageView.ScaleType.FIT_XY
|
||||||
|
return BannerImageHolder(imageView)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
banner.addBannerLifecycleObserver(this)
|
||||||
|
.setAdapter(bannerImageAdapter, true)
|
||||||
|
.setLoopTime(4000)
|
||||||
|
.setBannerRound(6f)
|
||||||
|
.isAutoLoop(true)
|
||||||
|
.setIndicator(CircleIndicator(requireContext()))
|
||||||
|
.setIndicatorGravity(IndicatorConfig.Direction.CENTER)
|
||||||
|
.setIndicatorSelectedWidth(15)
|
||||||
|
|
||||||
|
banner.setOnBannerListener { data, position ->
|
||||||
|
data as HomeBannerBean
|
||||||
|
listener?.invoke(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import com.xjjk.healthyclients.ui.activity.EmergencyContactActivity
|
|||||||
import com.xjjk.healthyclients.ui.activity.FullScreenImageActivity
|
import com.xjjk.healthyclients.ui.activity.FullScreenImageActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.LoginActivity
|
import com.xjjk.healthyclients.ui.activity.LoginActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.RetrievePassWordActivity
|
import com.xjjk.healthyclients.ui.activity.RetrievePassWordActivity
|
||||||
|
import com.xjjk.healthyclients.ui.activity.SimulateUserActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.UserInfoSettingActivity
|
import com.xjjk.healthyclients.ui.activity.UserInfoSettingActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.UserSettingActivity
|
import com.xjjk.healthyclients.ui.activity.UserSettingActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.UserSoSContactsActivity
|
import com.xjjk.healthyclients.ui.activity.UserSoSContactsActivity
|
||||||
@@ -25,7 +26,6 @@ import com.xjjk.healthyclients.ui.activity.guidance.BaseHealthyInfoAddActivity
|
|||||||
import com.xjjk.healthyclients.ui.activity.guidance.ConsultArchivesDetailActivity
|
import com.xjjk.healthyclients.ui.activity.guidance.ConsultArchivesDetailActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.guidance.ConsultantManagerActivity
|
import com.xjjk.healthyclients.ui.activity.guidance.ConsultantManagerActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.guidance.DoctorAllAppraiseActivity
|
import com.xjjk.healthyclients.ui.activity.guidance.DoctorAllAppraiseActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.guidance.DoctorHomepageActivity
|
|
||||||
import com.xjjk.healthyclients.ui.activity.guidance.EditConsultantActivity
|
import com.xjjk.healthyclients.ui.activity.guidance.EditConsultantActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.guidance.GeneralPracticeGuidanceActivity
|
import com.xjjk.healthyclients.ui.activity.guidance.GeneralPracticeGuidanceActivity
|
||||||
import com.xjjk.healthyclients.ui.activity.guidance.GuidanceNoticeActivity
|
import com.xjjk.healthyclients.ui.activity.guidance.GuidanceNoticeActivity
|
||||||
@@ -793,16 +793,16 @@ fun startEmergencySeekDoctorDetailsActivity(context: Context, id: String, sessio
|
|||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
/**
|
/**
|
||||||
* Web页面 source == 1 绿色主题 darkStyle=false 白色顶部
|
* Web页面 darkStyle=false 白色顶部
|
||||||
*/
|
*/
|
||||||
fun Context.startWebActivity(url: String, scale: Boolean = false,myTitle:String="", source: Int = 0,darkStyle: Boolean = true,isFull:Boolean=false) {
|
fun Context.startWebActivity(url: String, scale: Boolean = false,myTitle:String="",darkStyle: Boolean = true,isFull:Boolean=false,hideStatus:Boolean=false) {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString("url", url)
|
bundle.putString("url", url)
|
||||||
bundle.putBoolean("Scale", scale)
|
bundle.putBoolean("Scale", scale)
|
||||||
bundle.putInt("source", source)
|
|
||||||
bundle.putString("title", myTitle)
|
bundle.putString("title", myTitle)
|
||||||
bundle.putBoolean("darkStyle", darkStyle)//主题
|
bundle.putBoolean("darkStyle", darkStyle)//主题
|
||||||
bundle.putBoolean("isFull", isFull)//是否全屏
|
bundle.putBoolean("isFull", isFull)//是否全屏
|
||||||
|
bundle.putBoolean("hideStatus", hideStatus)//是否隐藏状态栏
|
||||||
startActivity(this, bundle = bundle, targetClass = WebActivity::class.java)
|
startActivity(this, bundle = bundle, targetClass = WebActivity::class.java)
|
||||||
}
|
}
|
||||||
///**
|
///**
|
||||||
@@ -1373,9 +1373,9 @@ fun Context.startAllDoctorActivity(id:String) {
|
|||||||
///**
|
///**
|
||||||
// * 模拟用户
|
// * 模拟用户
|
||||||
// */
|
// */
|
||||||
//fun startSimulateUserActivity(context: Context){
|
fun startSimulateUserActivity(context: Context){
|
||||||
// startActivity(context, targetClass = SimulateUserActivity::class.java)
|
startActivity(context, targetClass = SimulateUserActivity::class.java)
|
||||||
//}
|
}
|
||||||
//
|
//
|
||||||
///**
|
///**
|
||||||
// * 自由训练记录列表
|
// * 自由训练记录列表
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ fun String?.floatToInt(i: Int = 0): Int {
|
|||||||
i
|
i
|
||||||
} else {
|
} else {
|
||||||
if (this!!.toFloatOrNull() != null) {
|
if (this!!.toFloatOrNull() != null) {
|
||||||
this.toFloatOrNull()!!.toInt()
|
this.toFloatOrNull()!!.roundToInt()
|
||||||
} else {
|
} else {
|
||||||
i
|
i
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
import android.widget.RelativeLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
@@ -523,7 +524,7 @@ fun ViewPager2.init(
|
|||||||
*/
|
*/
|
||||||
fun TabLayout.onCreateTab(
|
fun TabLayout.onCreateTab(
|
||||||
tabList: Array<String>,
|
tabList: Array<String>,
|
||||||
tabStyle: Int = 2,
|
tabStyle: Int = 1,
|
||||||
listener: (TabLayout.Tab?) -> Unit
|
listener: (TabLayout.Tab?) -> Unit
|
||||||
) {
|
) {
|
||||||
for (tabTitle in tabList) {
|
for (tabTitle in tabList) {
|
||||||
@@ -547,11 +548,12 @@ fun TabLayout.onCreateTab(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun onConfigureTab(context: Context, tab: TabLayout.Tab, tabTitle: String, tabStyle: Int) {
|
private fun onConfigureTab(context: Context,tab: TabLayout.Tab, tabTitle: String,tabStyle: Int) {
|
||||||
val textView = LayoutInflater.from(context)
|
val tabView = LayoutInflater.from(context)
|
||||||
.inflate(getTabStyle(tabStyle), null) as TextView
|
.inflate(getTabStyle(tabStyle), null) as RelativeLayout
|
||||||
textView.text = tabTitle
|
val tabText = tabView.findViewById<TextView>(R.id.tv_text)
|
||||||
tab.customView = textView
|
tabText.text = tabTitle
|
||||||
|
tab.customView = tabView
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -583,13 +585,12 @@ fun TabLayout.attachViewPager(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* tab 样式
|
* tab 样式
|
||||||
* 1:通用样式 2:癌症结论tab样式
|
* 1:通用样式 绿色/灰色
|
||||||
*/
|
*/
|
||||||
fun getTabStyle(i: Int): Int {
|
fun getTabStyle(i: Int): Int {
|
||||||
return when (i) {
|
return when (i) {
|
||||||
1 -> R.layout.item_tablayout_group_title
|
1 -> R.layout.item_tablayout_group_title
|
||||||
2 -> R.layout.item_tablayout_group_title2
|
2 -> R.layout.item_tablayout_group_index_theme//有下标线的绿色
|
||||||
102 -> R.layout.item_home_tab_group//首页
|
|
||||||
else -> R.layout.item_tablayout_group_title
|
else -> R.layout.item_tablayout_group_title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.activity
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
|
import com.xjjk.healthyclients.databinding.ActivityEmptyBinding
|
||||||
|
import com.xjjk.healthyclients.ui.viewmodel.HomeViewModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 空布局
|
||||||
|
*/
|
||||||
|
class EmptyActivity :
|
||||||
|
BaseVMBActivity<HomeViewModel, ActivityEmptyBinding>(R.layout.activity_empty) {
|
||||||
|
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
val stringExtra = intent.getStringExtra("title")
|
||||||
|
mBinding.toolbarLay.title=stringExtra
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun processClick(paramView: View?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.xjjk.healthyclients.ui.activity
|
|||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.webkit.WebChromeClient
|
import android.webkit.WebChromeClient
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
@@ -109,6 +110,7 @@ class InterventionWebActivity() :
|
|||||||
// Log.e("mzf","file:///android_asset/dist/index.html?p=$path&r=${url}&t=${mToken}&id=${mUserId}&d=${date}")
|
// Log.e("mzf","file:///android_asset/dist/index.html?p=$path&r=${url}&t=${mToken}&id=${mUserId}&d=${date}")
|
||||||
// Log.e("mzf", "$localAdress&d=${date}")
|
// Log.e("mzf", "$localAdress&d=${date}")
|
||||||
mBinding.webView.loadUrl("$localAdress&d=${date}&h=${urlType}")
|
mBinding.webView.loadUrl("$localAdress&d=${date}&h=${urlType}")
|
||||||
|
Log.i("InterventionWebActivity", "url: "+mBinding.webView.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTitleText(path: String?): String {
|
private fun getTitleText(path: String?): String {
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import com.xjjk.healthyclients.ui.viewmodel.LoginViewModel
|
|||||||
import com.xjjk.healthyclients.utils.CommonUtils
|
import com.xjjk.healthyclients.utils.CommonUtils
|
||||||
import com.xjjk.healthyclients.utils.ConstantUtils
|
import com.xjjk.healthyclients.utils.ConstantUtils
|
||||||
import com.xjjk.healthyclients.view.TextViewDialog
|
import com.xjjk.healthyclients.view.TextViewDialog
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
@@ -49,24 +48,27 @@ import retrofit2.Callback
|
|||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
|
|
||||||
class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R.layout.activity_login_new) {
|
class LoginActivity :
|
||||||
|
BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R.layout.activity_login_new) {
|
||||||
var mApi = RetrofitManager.getRetrofits().create(CommonApi::class.java)
|
var mApi = RetrofitManager.getRetrofits().create(CommonApi::class.java)
|
||||||
|
|
||||||
var isRead=false
|
var isRead = false
|
||||||
var mTextViewDialog : TextViewDialog?=null
|
var mTextViewDialog: TextViewDialog? = null
|
||||||
|
|
||||||
var time: Long = 2000
|
var time: Long = 2000
|
||||||
var mCount = 5
|
var mCount = 5
|
||||||
var mLastTime = 0L
|
var mLastTime = 0L
|
||||||
var mHits = LongArray(mCount)
|
var mHits = LongArray(mCount)
|
||||||
var isAdminEnable=false
|
var isAdminEnable = false
|
||||||
var loginType = 1
|
var loginType = 1
|
||||||
|
|
||||||
|
var loginClickTime = 0L
|
||||||
|
|
||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
CommonUtils.logoutClearData()
|
CommonUtils.logoutClearData()
|
||||||
initAgreement()
|
initAgreement()
|
||||||
mTextViewDialog= TextViewDialog(this)
|
mTextViewDialog = TextViewDialog(this)
|
||||||
mBinding?.let {
|
mBinding?.let {
|
||||||
// it.loginEtUserName.setText("test8")
|
// it.loginEtUserName.setText("test8")
|
||||||
// it.loginEtUserPassword.setText("Aa123456")
|
// it.loginEtUserPassword.setText("Aa123456")
|
||||||
@@ -80,15 +82,14 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
var state= DataStoreManager.isAgreePrivacyPolicyStatus()
|
var state = DataStoreManager.isAgreePrivacyPolicyStatus()
|
||||||
if (state) {
|
if (state) {
|
||||||
if (state) {
|
if (state) {
|
||||||
isRead=true
|
isRead = true
|
||||||
mBinding.loginIvReadState.setImageResource(R.drawable.ic_login_green_select)
|
mBinding.loginIvReadState.setImageResource(R.drawable.ic_login_green_select)
|
||||||
}else{
|
} else {
|
||||||
isRead=false
|
isRead = false
|
||||||
mBinding.loginIvReadState.setImageResource(R.drawable.ic_login_no_select)
|
mBinding.loginIvReadState.setImageResource(R.drawable.ic_login_no_select)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,24 +106,38 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
mViewModel.list.collectLatest { list ->
|
mViewModel.list.collectLatest { list ->
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
list?.let {
|
list?.let {
|
||||||
for (index in 0 until it.size){
|
for (index in 0 until it.size) {
|
||||||
when(it[index].value){
|
when (it[index].value) {
|
||||||
"1" -> {
|
"1" -> {
|
||||||
//用户协议
|
//用户协议
|
||||||
if (it[index].text.isNotEmpty()) {
|
if (it[index].text.isNotEmpty()) {
|
||||||
DataStoreManager.saveUserAgreementUrl(UrlConfig.getH5BaseUrl(UrlConfig.baseUrlType)+it[index].text)
|
DataStoreManager.saveUserAgreementUrl(
|
||||||
|
UrlConfig.getH5BaseUrl(
|
||||||
|
UrlConfig.baseUrlType
|
||||||
|
) + it[index].text
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"2" -> {
|
"2" -> {
|
||||||
//隐私政策
|
//隐私政策
|
||||||
if (it[index].text.isNotEmpty()) {
|
if (it[index].text.isNotEmpty()) {
|
||||||
DataStoreManager.savePrivacyAgreementUrl(UrlConfig.getH5BaseUrl(UrlConfig.baseUrlType)+it[index].text)
|
DataStoreManager.savePrivacyAgreementUrl(
|
||||||
|
UrlConfig.getH5BaseUrl(
|
||||||
|
UrlConfig.baseUrlType
|
||||||
|
) + it[index].text
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"3" -> {
|
"3" -> {
|
||||||
//相关法律说明
|
//相关法律说明
|
||||||
if (it[index].text.isNotEmpty()) {
|
if (it[index].text.isNotEmpty()) {
|
||||||
DataStoreManager.saveLawUrl(UrlConfig.getH5BaseUrl(UrlConfig.baseUrlType)+it[index].text)
|
DataStoreManager.saveLawUrl(
|
||||||
|
UrlConfig.getH5BaseUrl(
|
||||||
|
UrlConfig.baseUrlType
|
||||||
|
) + it[index].text
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,8 +154,8 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
override fun bindEvent() {
|
override fun bindEvent() {
|
||||||
mBinding?.apply {
|
mBinding?.apply {
|
||||||
addClickViews(
|
addClickViews(
|
||||||
loginSubmit,loginIvReadState,loginAgreementRoot,loginRetrievePassword,testBtn,
|
loginSubmit, loginIvReadState, loginAgreementRoot, loginRetrievePassword,
|
||||||
tvDebug,tvProd,tvTest,tvLoginHealthy,tvLoginPlatform
|
tvLoginHealthy, tvLoginPlatform
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
mTextViewDialog?.let {
|
mTextViewDialog?.let {
|
||||||
@@ -167,9 +182,9 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
if (mHits[0] >= (SystemClock.uptimeMillis() - time)) {
|
if (mHits[0] >= (SystemClock.uptimeMillis() - time)) {
|
||||||
//数组重新初始化
|
//数组重新初始化
|
||||||
mHits = LongArray(mCount)
|
mHits = LongArray(mCount)
|
||||||
isAdminEnable=true
|
isAdminEnable = true
|
||||||
mBinding.loginEtUserName.setText("admin")
|
mBinding.loginEtUserName.setText("admin")
|
||||||
mBinding.loginEtUserPassword.setInputContext("&ZzW$3**@VLA")
|
mBinding.loginEtUserPassword.setInputContext("#fCjW%x2dv@a")
|
||||||
showToast("已开启专业模式")
|
showToast("已开启专业模式")
|
||||||
mCount = 5
|
mCount = 5
|
||||||
|
|
||||||
@@ -178,7 +193,7 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun processClick(paramView: View?) {
|
override fun processClick(paramView: View?) {
|
||||||
when(paramView?.id){
|
when (paramView?.id) {
|
||||||
R.id.login_submit -> {
|
R.id.login_submit -> {
|
||||||
// var passWord=mBinding.loginEtUserPassword.text.toString().trim()
|
// var passWord=mBinding.loginEtUserPassword.text.toString().trim()
|
||||||
// if (!passWord.formatCheck()) {
|
// if (!passWord.formatCheck()) {
|
||||||
@@ -195,64 +210,61 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
// } else if ((passwordLength < 12 || passwordLength > 32)&&loginType==2) {
|
// } else if ((passwordLength < 12 || passwordLength > 32)&&loginType==2) {
|
||||||
// mTextViewDialog?.show()
|
// mTextViewDialog?.show()
|
||||||
} else {
|
} else {
|
||||||
|
if (System.currentTimeMillis() - loginClickTime > 3000) {
|
||||||
|
loginClickTime = System.currentTimeMillis()
|
||||||
login(
|
login(
|
||||||
mBinding.loginEtUserName.text.toString().trim(),
|
mBinding.loginEtUserName.text.toString().trim(),
|
||||||
mBinding.loginEtUserPassword.getInputContext()
|
mBinding.loginEtUserPassword.getInputContext()
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
showToast("您的操作过于频繁,请稍后再试!")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
R.id.login_iv_read_state,R.id.login_agreement_root -> {
|
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.login_iv_read_state, R.id.login_agreement_root -> {
|
||||||
mBinding?.let {
|
mBinding?.let {
|
||||||
if (isRead) {
|
if (isRead) {
|
||||||
isRead=false
|
isRead = false
|
||||||
it.loginIvReadState.setImageResource(R.drawable.ic_login_no_select)
|
it.loginIvReadState.setImageResource(R.drawable.ic_login_no_select)
|
||||||
}else{
|
} else {
|
||||||
isRead=true
|
isRead = true
|
||||||
it.loginIvReadState.setImageResource(R.drawable.ic_login_green_select)
|
it.loginIvReadState.setImageResource(R.drawable.ic_login_green_select)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.login_retrieve_password -> {
|
R.id.login_retrieve_password -> {
|
||||||
//找回密码
|
//找回密码
|
||||||
if (loginType == 1) {
|
if (loginType == 1) {
|
||||||
startWebActivity("https://sso.iosp.ydpt.tech/SSOManageClient/userController/changePassword")
|
startWebActivity(url = UrlConfig.ANYAN_CHANGE_PASSWORD_H5)
|
||||||
} else {
|
} else {
|
||||||
mContext?.startRetrievePassWordActivity()
|
mContext?.startRetrievePassWordActivity()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
R.id.test_btn->{
|
|
||||||
if (isAdminEnable) {
|
|
||||||
mCount-=1
|
|
||||||
if (mCount==0) {
|
|
||||||
mBinding.testLayout.visibility=View.VISIBLE
|
|
||||||
lifecycleScope.launch {
|
|
||||||
delay(2000)
|
|
||||||
mBinding.testLayout.visibility=View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// R.id.iv_icon_img->{
|
// R.id.iv_icon_img->{
|
||||||
// if (isAdminEnable) {
|
// if (isAdminEnable) {
|
||||||
// mBinding.testBtn.visibility = View.VISIBLE
|
// mBinding.testBtn.visibility = View.VISIBLE
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
R.id.tv_debug->{
|
R.id.tv_debug -> {
|
||||||
DataStoreManager.saveCurrentConfig(1)
|
DataStoreManager.saveCurrentConfig(1)
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.tv_test->{
|
R.id.tv_test -> {
|
||||||
DataStoreManager.saveCurrentConfig(2)
|
DataStoreManager.saveCurrentConfig(2)
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.tv_prod->{
|
R.id.tv_prod -> {
|
||||||
DataStoreManager.saveCurrentConfig(3)
|
DataStoreManager.saveCurrentConfig(3)
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.tv_login_platform -> {
|
R.id.tv_login_platform -> {
|
||||||
loginType = 1
|
loginType = 1
|
||||||
mBinding.tvLoginPlatform.setBackgroundResource(R.mipmap.ic_login_platform_bg_green)
|
mBinding.tvLoginPlatform.setBackgroundResource(R.mipmap.ic_login_platform_bg_green)
|
||||||
@@ -290,15 +302,14 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun transparentStatusBar(): Boolean {
|
override fun transparentStatusBar(): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initAgreement() {
|
private fun initAgreement() {
|
||||||
// var text="已阅读并同意《用户协议》、《隐私政策》和《相关法律说明》"
|
// var text="已阅读并同意《用户协议》、《隐私政策》和《相关法律说明》"
|
||||||
var text="已阅读并同意《用户协议》和《隐私政策》"
|
var text = "已阅读并同意用户协议和隐私政策"
|
||||||
var span= SpannableString(text)
|
var span = SpannableString(text)
|
||||||
span.setSpan(object : ClickableSpan() {
|
span.setSpan(object : ClickableSpan() {
|
||||||
|
|
||||||
override fun onClick(widget: View) {
|
override fun onClick(widget: View) {
|
||||||
@@ -309,11 +320,15 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 表示点击整个text的长度都有效触发这个事件
|
// 表示点击整个text的长度都有效触发这个事件
|
||||||
}, 6, 12, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
}, 6, 10, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||||
mContext?.let{
|
mContext?.let {
|
||||||
span.setSpan(NoUnderlineSpan(),6 , 12, Spanned.SPAN_MARK_MARK)
|
span.setSpan(NoUnderlineSpan(), 6, 10, Spanned.SPAN_MARK_MARK)
|
||||||
span.setSpan(
|
span.setSpan(
|
||||||
ForegroundColorSpan(it.resources.getColor(R.color.theme_color)),6, 12, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
ForegroundColorSpan(it.resources.getColor(R.color.theme_color)),
|
||||||
|
6,
|
||||||
|
10,
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
span.setSpan(object : ClickableSpan() {
|
span.setSpan(object : ClickableSpan() {
|
||||||
@@ -326,11 +341,15 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 表示点击整个text的长度都有效触发这个事件
|
// 表示点击整个text的长度都有效触发这个事件
|
||||||
}, 13, 19, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
}, 11, 15, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||||
mContext?.let{
|
mContext?.let {
|
||||||
span.setSpan(NoUnderlineSpan(),13 , 19, Spanned.SPAN_MARK_MARK)
|
span.setSpan(NoUnderlineSpan(), 11, 15, Spanned.SPAN_MARK_MARK)
|
||||||
span.setSpan(
|
span.setSpan(
|
||||||
ForegroundColorSpan(it.resources.getColor(R.color.theme_color)),13, 19, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
ForegroundColorSpan(it.resources.getColor(R.color.theme_color)),
|
||||||
|
11,
|
||||||
|
15,
|
||||||
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE
|
||||||
|
)
|
||||||
}
|
}
|
||||||
// span.setSpan(object : ClickableSpan() {
|
// span.setSpan(object : ClickableSpan() {
|
||||||
//
|
//
|
||||||
@@ -352,41 +371,49 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
mBinding?.loginTvAgreement?.setMovementMethod(LinkMovementMethod.getInstance())
|
mBinding?.loginTvAgreement?.setMovementMethod(LinkMovementMethod.getInstance())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun login(name:String,password:String){
|
fun login(name: String, password: String) {
|
||||||
dialog?.show()
|
dialog?.show()
|
||||||
var bean= LoginBean()
|
var bean = LoginBean()
|
||||||
try {
|
try {
|
||||||
bean.deviceType="${DevicesInfoUtils.getDeviceBrand()}"
|
bean.deviceType = "${DevicesInfoUtils.getDeviceBrand()}"
|
||||||
if ("HUAWEI"== DevicesInfoUtils.getDeviceBrand()) {
|
if ("HUAWEI" == DevicesInfoUtils.getDeviceBrand()) {
|
||||||
if ("12"== DevicesInfoUtils.getDeviceAndroidVersion()){
|
if ("12" == DevicesInfoUtils.getDeviceAndroidVersion()) {
|
||||||
bean.deviceSystem="${DevicesInfoUtils.getDeviceModel()}(Android:12||Harmony:${DevicesInfoUtils.getDeviceHarmonyOsVersion()})"
|
bean.deviceSystem =
|
||||||
}else{
|
"${DevicesInfoUtils.getDeviceModel()}(Android:12||Harmony:${DevicesInfoUtils.getDeviceHarmonyOsVersion()})"
|
||||||
bean.deviceSystem="${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})"
|
} else {
|
||||||
|
bean.deviceSystem =
|
||||||
|
"${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})"
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
bean.deviceSystem="${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})"
|
bean.deviceSystem =
|
||||||
|
"${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})"
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
bean.username=name
|
bean.username = name
|
||||||
bean.password=RSACipherStrategy().encrypt(ConstantUtils.mRSAKey,password)
|
bean.password = RSACipherStrategy().encrypt(ConstantUtils.mRSAKey, password)
|
||||||
// bean.password=password
|
// bean.password=password
|
||||||
var login: Call<JsonObject>?=null
|
var login: Call<JsonObject>? = null
|
||||||
if (loginType == 1) {
|
|
||||||
login = mApi.mLoginAnYan(bean)
|
if (loginType == 2 || isAdminEnable) {
|
||||||
} else if (loginType == 2) {
|
|
||||||
login = mApi.mLogin(bean)
|
login = mApi.mLogin(bean)
|
||||||
|
} else if (loginType == 1) {
|
||||||
|
login = mApi.mLoginAnYan(bean)
|
||||||
}
|
}
|
||||||
login!!.enqueue(object : Callback<JsonObject>{
|
|
||||||
|
login!!.enqueue(object : Callback<JsonObject> {
|
||||||
override fun onResponse(call: Call<JsonObject>, response: Response<JsonObject>) {
|
override fun onResponse(call: Call<JsonObject>, response: Response<JsonObject>) {
|
||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
try {
|
try {
|
||||||
var bean= Gson().fromJson<LoginResponseBean>(response.body().toString(),LoginResponseBean::class.java)
|
var bean = Gson().fromJson<LoginResponseBean>(
|
||||||
if (bean.code==200) {
|
response.body().toString(),
|
||||||
if(bean.result.userInfo.personType!=null&&bean.result.userInfo.personType=="1"||isAdminEnable) {
|
LoginResponseBean::class.java
|
||||||
ConstantUtils.mCheckToken=true
|
)
|
||||||
|
if (bean.code == 200) {
|
||||||
|
if (bean.result.userInfo.personType != null && bean.result.userInfo.personType == "1" || isAdminEnable) {
|
||||||
|
ConstantUtils.mCheckToken = true
|
||||||
CustomActivityManager.getInstance()
|
CustomActivityManager.getInstance()
|
||||||
.finishActivity(MainActivity::class.java)
|
.finishActivity(MainActivity::class.java)
|
||||||
if (bean != null && bean.result != null) {
|
if (bean != null && bean.result != null) {
|
||||||
@@ -401,10 +428,10 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
showToast("账号或登录密码错误,请重试")
|
showToast("账号或登录密码错误,请重试")
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
showToast(bean.message)
|
showToast(bean.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,7 +452,7 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// fun setNoBootomLine(span:SpannableString){
|
// fun setNoBootomLine(span:SpannableString){
|
||||||
// span.setSpan(noUnderlineSpan,0 , trim.length(), Spanned.SPAN_MARK_MARK)
|
// span.setSpan(noUnderlineSpan,0 , trim.length(), Spanned.SPAN_MARK_MARK)
|
||||||
// }
|
// }
|
||||||
internal class NoUnderlineSpan : UnderlineSpan() {
|
internal class NoUnderlineSpan : UnderlineSpan() {
|
||||||
@@ -442,6 +469,7 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R
|
|||||||
isExit = false
|
isExit = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun exit() {
|
private fun exit() {
|
||||||
if (!isExit) {
|
if (!isExit) {
|
||||||
isExit = true
|
isExit = true
|
||||||
|
|||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.activity
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.core.text.isDigitsOnly
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
|
import com.xjjk.healthyclients.bean.home.ProposalBean
|
||||||
|
import com.xjjk.healthyclients.databinding.ActivityProposalBinding
|
||||||
|
import com.xjjk.healthyclients.ui.viewmodel.ProposalViewModel
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一人一案(健康档案)页面
|
||||||
|
*/
|
||||||
|
class ProposalActivity :
|
||||||
|
BaseVMBActivity<ProposalViewModel, ActivityProposalBinding>(R.layout.activity_proposal) {
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
val stringExtra = intent.getStringExtra("title")
|
||||||
|
mBinding.toolbarLay.title = stringExtra ?: "一人一案"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
// 加载健康档案数据
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.proposalInfo.collectLatest {
|
||||||
|
setProposalInfo(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 手机号中间4位脱敏
|
||||||
|
*/
|
||||||
|
fun String?.maskPhone(): String {
|
||||||
|
val phone = this ?: return "--"
|
||||||
|
// 判断是否标准11位
|
||||||
|
return if (phone.length == 11) {
|
||||||
|
phone.replaceRange(3, 7, "****")
|
||||||
|
} else {
|
||||||
|
phone
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setProposalInfo(proposalBean: ProposalBean?) {
|
||||||
|
proposalBean?.let {
|
||||||
|
mBinding.llDocumentBuild.visibility = View.VISIBLE
|
||||||
|
mBinding.llMostCare.visibility = View.VISIBLE
|
||||||
|
// 患者信息
|
||||||
|
mBinding.tvPatientName.text = it.name
|
||||||
|
mBinding.tvPatientGenderAge.text = formatNullString(it.sexCode) + " · " + it.age + "岁"
|
||||||
|
//mBinding.tvDocumentStatus.text = it.careStatus
|
||||||
|
mBinding.tvPatientCompany.text = formatNullString(it.workUnit)
|
||||||
|
mBinding.tvIdNumber.text = formatNullString(it.idNo)
|
||||||
|
mBinding.tvPhone.text = formatNullString(it.phone).maskPhone()
|
||||||
|
|
||||||
|
// 关爱管理信息
|
||||||
|
//mBinding.tvLevel.text = it.dataLevel.toString()
|
||||||
|
mBinding.tvLiaisonName.text = formatNullString(it.careLiaisonName)
|
||||||
|
mBinding.tvNegativeList.text = formatNullString(it.negativeList)
|
||||||
|
|
||||||
|
|
||||||
|
// 档案与标签
|
||||||
|
if (it.flagFat == 1) {
|
||||||
|
mBinding.llFatTag.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
val weight = formatNullString(it.weight)
|
||||||
|
val formatWeight = weight.toDoubleOrNull()?.let {
|
||||||
|
String.format("%.2f", it)
|
||||||
|
} ?: weight
|
||||||
|
val standardWeight = formatNullString(it.targetWeight)
|
||||||
|
val targetWeight = standardWeight.toDoubleOrNull()?.let {
|
||||||
|
String.format("%.2f", it)
|
||||||
|
} ?: standardWeight
|
||||||
|
mBinding.tvWeight.text = formatWeight
|
||||||
|
mBinding.tvHeight.text = formatNullString(it.height)
|
||||||
|
mBinding.tvBmi.text = formatNullString(it.bmiCurrent)
|
||||||
|
mBinding.tvStandardWeight.text = targetWeight
|
||||||
|
|
||||||
|
// 心血管健康
|
||||||
|
if (it.hypertension == 1) {
|
||||||
|
mBinding.llHighPressureTag.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
mBinding.tvSystolicAvg.text = formatNullString(it.systolicPressureAvg)
|
||||||
|
mBinding.tvSystolicTarget.text = formatNullString(it.systolicPressureTarget)
|
||||||
|
mBinding.tvSystolic.text = formatNullString(it.systolicPressureCurrent)
|
||||||
|
if (it.systolicPressureTarget?.toDoubleOrNull() !=null && it.systolicPressureCurrent?.toDoubleOrNull() !=null
|
||||||
|
&& it.systolicPressureTarget.toDouble() < it.systolicPressureCurrent.toDouble()
|
||||||
|
) {
|
||||||
|
mBinding.tvSystolic.setTextColor(getColor(R.color.red_f2))
|
||||||
|
}
|
||||||
|
mBinding.tvDiastolicAvg.text = formatNullString(it.diastolicPressureAvg)
|
||||||
|
mBinding.tvDiastolicTarget.text = formatNullString(it.diastolicPressureTarget)
|
||||||
|
mBinding.tvDiastolic.text = formatNullString(it.diastolicPressureCurrent)
|
||||||
|
|
||||||
|
// 代谢指标
|
||||||
|
// 心血管健康
|
||||||
|
if (it.diabetes == 1) {
|
||||||
|
mBinding.llDiabetesTag.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
mBinding.tvFbsValue.text = formatNullString(it.glu)
|
||||||
|
mBinding.tvFbsTarget.text = formatNullString(it.bloodSugarTarget)
|
||||||
|
mBinding.tvFbsCurrent.text = formatNullString(it.bloodSugarCurrent)
|
||||||
|
|
||||||
|
// 血脂四项
|
||||||
|
mBinding.tvTcValue.text = it.tc
|
||||||
|
mBinding.tvTcTarget.text = it.tcTarget
|
||||||
|
mBinding.tvTcCurrent.text = it.tc
|
||||||
|
mBinding.tvTgValue.text = it.tg
|
||||||
|
mBinding.tvTgTarget.text = it.tgTarget
|
||||||
|
mBinding.tvTgCurrent.text = it.tg
|
||||||
|
mBinding.tvLdlValue.text = it.ldl
|
||||||
|
mBinding.tvLdlTarget.text = it.ldlTarget
|
||||||
|
mBinding.tvLdlCurrent.text = it.ldl
|
||||||
|
|
||||||
|
// 肾脏与骨骼代谢
|
||||||
|
mBinding.tvUaValue.text = it.uricAcid
|
||||||
|
mBinding.tvUaTarget.text = it.uricAcidTarget
|
||||||
|
mBinding.tvUaCurrent.text = it.uricAcid
|
||||||
|
|
||||||
|
// 特殊代谢指标
|
||||||
|
mBinding.tvHcyValue.text = it.homocysteine
|
||||||
|
mBinding.tvHcyTarget.text = it.homocysteineTarget
|
||||||
|
mBinding.tvHcyCurrent.text = it.homocysteine
|
||||||
|
|
||||||
|
// 医疗意见与记录
|
||||||
|
mBinding.tvCabinOpinion.text = it.cabinOpinion ?: "暂无小屋意见"
|
||||||
|
mBinding.tvCabinTime.text = it.cabinOpinionTime
|
||||||
|
mBinding.tvCabinReporter.text = it.cabinOpinionUserName
|
||||||
|
mBinding.tvExpertOpinion.text = it.expertOpinion ?: "暂无专家医生意见"
|
||||||
|
mBinding.tvExpertOpinionTime.text = it.expertOpinionTime
|
||||||
|
mBinding.tvExpertOpinionUserName.text = it.expertOpinionUserName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun formatNullString(input: String?): String {
|
||||||
|
return input?.ifEmpty {
|
||||||
|
"--"
|
||||||
|
} ?: "--"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
// 绑定事件
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(paramView: View?) {
|
||||||
|
// 处理点击事件
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun transparentStatusBar(): Boolean {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun statusBarDarkFont(): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,11 @@ import com.amap.api.maps.model.CameraPosition
|
|||||||
import com.amap.api.maps.model.LatLng
|
import com.amap.api.maps.model.LatLng
|
||||||
import com.amap.api.maps.model.MarkerOptions
|
import com.amap.api.maps.model.MarkerOptions
|
||||||
import com.amap.api.maps.model.MyLocationStyle
|
import com.amap.api.maps.model.MyLocationStyle
|
||||||
|
import com.amap.api.services.core.LatLonPoint
|
||||||
|
import com.amap.api.services.geocoder.GeocodeResult
|
||||||
|
import com.amap.api.services.geocoder.GeocodeSearch
|
||||||
|
import com.amap.api.services.geocoder.RegeocodeQuery
|
||||||
|
import com.amap.api.services.geocoder.RegeocodeResult
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.permissionx.guolindev.PermissionX
|
import com.permissionx.guolindev.PermissionX
|
||||||
import com.tencent.qcloud.tuicore.util.ToastUtil
|
import com.tencent.qcloud.tuicore.util.ToastUtil
|
||||||
@@ -38,6 +43,7 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
|||||||
var aMap: AMap? = null
|
var aMap: AMap? = null
|
||||||
var mCurrentLat: Double = 0.0
|
var mCurrentLat: Double = 0.0
|
||||||
var mCurrentLon: Double = 0.0
|
var mCurrentLon: Double = 0.0
|
||||||
|
var desc: String = ""
|
||||||
var mPermissionList= arrayListOf(
|
var mPermissionList= arrayListOf(
|
||||||
Manifest.permission.ACCESS_COARSE_LOCATION,
|
Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION)
|
Manifest.permission.ACCESS_FINE_LOCATION)
|
||||||
@@ -72,6 +78,34 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
|||||||
override fun initData() {
|
override fun initData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun initGeocoderSearch() {
|
||||||
|
val geocodeSearch = GeocodeSearch(this@SelectLocationActivity)
|
||||||
|
val query = RegeocodeQuery(LatLonPoint(mCurrentLat, mCurrentLon), 200f, GeocodeSearch.AMAP)
|
||||||
|
geocodeSearch.getFromLocationAsyn(query)
|
||||||
|
geocodeSearch.setOnGeocodeSearchListener(object : GeocodeSearch.OnGeocodeSearchListener {
|
||||||
|
override fun onRegeocodeSearched(
|
||||||
|
regeocodeResult: RegeocodeResult?,
|
||||||
|
resultID: Int
|
||||||
|
) {
|
||||||
|
if (regeocodeResult != null) {
|
||||||
|
val regeocodeAddress = regeocodeResult.regeocodeAddress
|
||||||
|
desc = regeocodeAddress.getFormatAddress()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onGeocodeSearched(
|
||||||
|
geocodeResult: GeocodeResult?,
|
||||||
|
resultID: Int
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (geocodeResult != null) {
|
||||||
|
val geocodeAddressList = geocodeResult.geocodeAddressList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
private fun setUpMap() {
|
private fun setUpMap() {
|
||||||
// 自定义系统定位小蓝点
|
// 自定义系统定位小蓝点
|
||||||
val myLocationStyle = MyLocationStyle()
|
val myLocationStyle = MyLocationStyle()
|
||||||
@@ -91,6 +125,9 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
|||||||
aMap?.setOnMyLocationChangeListener {
|
aMap?.setOnMyLocationChangeListener {
|
||||||
mCurrentLat = it.latitude
|
mCurrentLat = it.latitude
|
||||||
mCurrentLon = it.longitude
|
mCurrentLon = it.longitude
|
||||||
|
|
||||||
|
initGeocoderSearch()
|
||||||
|
|
||||||
val markerOption = MarkerOptions()
|
val markerOption = MarkerOptions()
|
||||||
markerOption.position(LatLng(mCurrentLat, mCurrentLon))
|
markerOption.position(LatLng(mCurrentLat, mCurrentLon))
|
||||||
aMap?.moveCamera(CameraUpdateFactory.newLatLng(LatLng(mCurrentLat, mCurrentLon)))
|
aMap?.moveCamera(CameraUpdateFactory.newLatLng(LatLng(mCurrentLat, mCurrentLon)))
|
||||||
@@ -108,6 +145,8 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
|||||||
marker?.position = cameraPosition.target
|
marker?.position = cameraPosition.target
|
||||||
mCurrentLat = cameraPosition.target.latitude
|
mCurrentLat = cameraPosition.target.latitude
|
||||||
mCurrentLon = cameraPosition.target.longitude
|
mCurrentLon = cameraPosition.target.longitude
|
||||||
|
|
||||||
|
initGeocoderSearch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,6 +183,7 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
|||||||
var locationMessageBean = LocationMessageBean()
|
var locationMessageBean = LocationMessageBean()
|
||||||
locationMessageBean.longitude = mCurrentLon
|
locationMessageBean.longitude = mCurrentLon
|
||||||
locationMessageBean.latitude = mCurrentLat
|
locationMessageBean.latitude = mCurrentLat
|
||||||
|
locationMessageBean.desc = desc
|
||||||
intent.putExtra(ChatLayoutSetting.KEY_CUSTOM_MESSAGE, locationMessageBean.toJson())
|
intent.putExtra(ChatLayoutSetting.KEY_CUSTOM_MESSAGE, locationMessageBean.toJson())
|
||||||
setResult(ChatLayoutSetting.RESULT_CODE_LOCATION, intent)
|
setResult(ChatLayoutSetting.RESULT_CODE_LOCATION, intent)
|
||||||
finish()
|
finish()
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.activity
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.sw.healthyclients.data.local.DataStoreManager
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.adapter.UserListAdapter
|
||||||
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
|
import com.xjjk.healthyclients.bean.UserListBean
|
||||||
|
import com.xjjk.healthyclients.databinding.ActivitySumilateBinding
|
||||||
|
import com.xjjk.healthyclients.event.UserInfoEvent
|
||||||
|
import com.xjjk.healthyclients.superfuntion.getEmptyView
|
||||||
|
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||||
|
import com.xjjk.healthyclients.ui.viewmodel.SimulateUserViewModel
|
||||||
|
import com.xjjk.healthyclients.utils.CommonUtils
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author nanfeifei
|
||||||
|
* @time 2023/7/17 16:20
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
class SimulateUserActivity: BaseVMBActivity<SimulateUserViewModel, ActivitySumilateBinding>(R.layout.activity_sumilate),
|
||||||
|
SwipeRefreshLayout.OnRefreshListener, OnItemClickListener {
|
||||||
|
private val mAdapter: UserListAdapter = UserListAdapter()
|
||||||
|
var userName=""
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.apply {
|
||||||
|
val linearLayoutManager = LinearLayoutManager(this@SimulateUserActivity
|
||||||
|
)
|
||||||
|
rvList.layoutManager = linearLayoutManager
|
||||||
|
csvSearch.initView("请输入模拟用户账号")
|
||||||
|
csvSearch.setOnCustomClickListener {
|
||||||
|
userName= it
|
||||||
|
onRefresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
btnReset.setOnClickListener {
|
||||||
|
var bean2= DataStoreManager.getUserInfo2()
|
||||||
|
CommonUtils.loginSaveData(bean2)
|
||||||
|
mViewModel.restore()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
mViewModel.fakeUser(){}
|
||||||
|
}
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
mBinding.apply {
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.userList.collectLatest { list ->
|
||||||
|
list?.let {
|
||||||
|
mAdapter.setNewInstance(list.records)
|
||||||
|
mAdapter.notifyDataSetChanged()
|
||||||
|
if (rvList.adapter == null) {
|
||||||
|
mAdapter.setEmptyView(rvList.getEmptyView())
|
||||||
|
mAdapter.setOnItemClickListener(this@SimulateUserActivity)
|
||||||
|
// initLoadMore()
|
||||||
|
rvList.adapter = mAdapter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.isSimuLateState.collectLatest { state ->
|
||||||
|
if (state){
|
||||||
|
mViewModel.fakeUser(){bean->
|
||||||
|
DataStoreManager.saveUserInfo2(Gson().toJson(DataStoreManager.getUserInfo()))
|
||||||
|
var bean2= DataStoreManager.getUserInfo()
|
||||||
|
bean2.id=bean.id
|
||||||
|
bean2.username=bean.username
|
||||||
|
bean2.orgCode=bean.orgCode
|
||||||
|
bean2.birthday=bean.birthday
|
||||||
|
bean2.phone=bean.phone
|
||||||
|
bean2.avatar=bean.avatar
|
||||||
|
bean2.idCard=bean.idCard
|
||||||
|
bean2.workNo=bean.workNo
|
||||||
|
bean2.realname=bean.realname
|
||||||
|
bean2.sex=bean.sex
|
||||||
|
CommonUtils.loginSaveData(bean2)
|
||||||
|
EventBus.getDefault().post(UserInfoEvent())
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.isResetState.collectLatest { state ->
|
||||||
|
if (state){
|
||||||
|
mBinding.tvUserName.text="当前模拟的用户:--"
|
||||||
|
EventBus.getDefault().post(UserInfoEvent())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.userBean.collectLatest { bean ->
|
||||||
|
if (bean!=null){
|
||||||
|
// mBinding.llUser.visibility=View.VISIBLE
|
||||||
|
mBinding.tvUserName.text="当前模拟的用户:"+bean.realname.orEmptyDefault()
|
||||||
|
}else{
|
||||||
|
// mBinding.llUser.visibility=View.GONE
|
||||||
|
mBinding.tvUserName.text="当前模拟的用户:--"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
override fun bindEvent() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRefresh() {
|
||||||
|
mViewModel.getMessageList(userName)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||||
|
var bean=mAdapter?.getItem(position) as UserListBean.RecordsDTO
|
||||||
|
mViewModel.simulateUser(bean.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ import com.xjjk.healthyclients.BuildConfig
|
|||||||
import com.xjjk.healthyclients.R
|
import com.xjjk.healthyclients.R
|
||||||
import com.xjjk.healthyclients.base.BaseVMBActivity
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
import com.xjjk.healthyclients.databinding.ActivitySettingBinding
|
import com.xjjk.healthyclients.databinding.ActivitySettingBinding
|
||||||
import com.xjjk.healthyclients.superfuntion.startRetrievePassWordActivity
|
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||||
import com.xjjk.healthyclients.superfuntion.startWebActivity
|
import com.xjjk.healthyclients.superfuntion.startWebActivity
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -55,7 +55,8 @@ class UserSettingActivity :
|
|||||||
override fun processClick(paramView: View?) {
|
override fun processClick(paramView: View?) {
|
||||||
when (paramView?.id) {
|
when (paramView?.id) {
|
||||||
R.id.setting_edit_password -> {
|
R.id.setting_edit_password -> {
|
||||||
mContext?.startRetrievePassWordActivity()
|
// mContext?.startRetrievePassWordActivity()
|
||||||
|
startWebActivity(url = UrlConfig.ANYAN_CHANGE_PASSWORD_H5)
|
||||||
}
|
}
|
||||||
R.id.setting_user_agreement -> {
|
R.id.setting_user_agreement -> {
|
||||||
DataStoreManager.getUserAgreementUrl()?.let {
|
DataStoreManager.getUserAgreementUrl()?.let {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.xjjk.healthyclients.ui.activity
|
|||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Color
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -66,26 +65,27 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
|||||||
.ready()
|
.ready()
|
||||||
.go(getUrl())
|
.go(getUrl())
|
||||||
mAgentWeb.agentWebSettings.webSettings.javaScriptEnabled = true
|
mAgentWeb.agentWebSettings.webSettings.javaScriptEnabled = true
|
||||||
|
mAgentWeb.agentWebSettings.webSettings.cacheMode = WebSettings.LOAD_NO_CACHE
|
||||||
mAgentWeb.jsInterfaceHolder.addJavaObject("android", androidInterface)
|
mAgentWeb.jsInterfaceHolder.addJavaObject("android", androidInterface)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dataBindingFinish() {
|
override fun dataBindingFinish() {
|
||||||
val source = intent.getIntExtra("source", 0)
|
|
||||||
customTitle = intent.getStringExtra("title")
|
customTitle = intent.getStringExtra("title")
|
||||||
if (source == 1) {//深绿色
|
|
||||||
mBinding.toolbarLay.rlTitleLay.setBackgroundColor(Color.parseColor("#117474"))
|
|
||||||
}
|
|
||||||
mBinding.toolbarLay.darkStyle = intent.getBooleanExtra("darkStyle", true)
|
mBinding.toolbarLay.darkStyle = intent.getBooleanExtra("darkStyle", true)
|
||||||
if (intent.getBooleanExtra("isFull", false)) {
|
if (intent.getBooleanExtra("isFull", false)) {
|
||||||
mBinding.toolbarLay.root.visibility = View.GONE
|
mBinding.toolbarLay.root.visibility = View.GONE
|
||||||
|
if (intent.getBooleanExtra("hideStatus", false)) {
|
||||||
|
mBinding.statusView.visibility = View.GONE
|
||||||
|
setTransparentStatusBar(true,false)
|
||||||
|
} else {
|
||||||
mBinding.statusView.visibility = View.VISIBLE
|
mBinding.statusView.visibility = View.VISIBLE
|
||||||
|
|
||||||
val statusBarHeight = StatusbarUtil.getStatusBarHeight(this)
|
val statusBarHeight = StatusbarUtil.getStatusBarHeight(this)
|
||||||
val layoutParams = mBinding.statusView.layoutParams
|
val layoutParams = mBinding.statusView.layoutParams
|
||||||
layoutParams.height = statusBarHeight
|
layoutParams.height = statusBarHeight
|
||||||
mBinding.statusView.layoutParams = layoutParams
|
mBinding.statusView.layoutParams = layoutParams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
mIsScale = intent.getBooleanExtra("Scale", false)
|
mIsScale = intent.getBooleanExtra("Scale", false)
|
||||||
@@ -110,11 +110,13 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
|||||||
override fun onBackEvent() {
|
override fun onBackEvent() {
|
||||||
if (!mAgentWeb.back()) {
|
if (!mAgentWeb.back()) {
|
||||||
if (jsAffirmBack.isNullOrEmpty()) {
|
if (jsAffirmBack.isNullOrEmpty()) {
|
||||||
|
mAgentWeb.webCreator.webView?.stopLoading()
|
||||||
super.onBackEvent()
|
super.onBackEvent()
|
||||||
} else {
|
} else {
|
||||||
mAgentWeb.jsAccessEntrace.quickCallJs("interceptBack",
|
mAgentWeb.jsAccessEntrace.quickCallJs("interceptBack",
|
||||||
{ value ->
|
{ value ->
|
||||||
if ("1" != value) {
|
if ("1" != value) {
|
||||||
|
mAgentWeb.webCreator.webView?.stopLoading()
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -273,14 +275,10 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var isRefresh = false
|
|
||||||
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
mAgentWeb.webLifeCycle.onResume()
|
mAgentWeb.webLifeCycle.onResume()
|
||||||
if (getUrl().contains("motionClock")&&isRefresh) {//动打卡链接,同步微信步数再次刷新界面
|
|
||||||
mAgentWeb.urlLoader.reload()
|
|
||||||
}
|
|
||||||
super.onResume()
|
super.onResume()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +291,6 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
|||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
mAgentWeb.webLifeCycle.onPause()
|
mAgentWeb.webLifeCycle.onPause()
|
||||||
isRefresh = true
|
|
||||||
super.onPause()
|
super.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class UserMyGuidanceActivity : BaseVMBActivity<MyGuidanceActivityViewModel, Acti
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1 待开始 3 进行中 5已完成
|
* 1 待开始 3 进行中 5已完成 6 历史
|
||||||
*/
|
*/
|
||||||
fun orderState(state:Int){
|
fun orderState(state:Int){
|
||||||
mTitleState="$state"
|
mTitleState="$state"
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.activity.home
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
|
import com.xjjk.healthyclients.databinding.ActivityHomeBannerBinding
|
||||||
|
import com.xjjk.healthyclients.superfuntion.load
|
||||||
|
import com.xjjk.healthyclients.ui.viewmodel.HomeViewModel
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页banner
|
||||||
|
*/
|
||||||
|
class HomeBannerDetailActivity :
|
||||||
|
BaseVMBActivity<HomeViewModel, ActivityHomeBannerBinding>(R.layout.activity_home_banner) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
mViewModel.getConSessionPicUrl()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.sessionPicUrl.collectLatest {
|
||||||
|
if (it.isNullOrEmpty()) {
|
||||||
|
return@collectLatest
|
||||||
|
}
|
||||||
|
mBinding.imgBanner.load(it,false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(paramView: View?) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.activity.home
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.view.View
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import com.sw.healthyclients.utils.DateUtil
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
|
import com.xjjk.healthyclients.databinding.ActivityNoticeDetailBinding
|
||||||
|
import com.xjjk.healthyclients.superfuntion.addImgHeader
|
||||||
|
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||||
|
import com.xjjk.healthyclients.ui.viewmodel.HomeViewModel
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页通知消息详情
|
||||||
|
*/
|
||||||
|
class HomeNoticeDetailActivity :
|
||||||
|
BaseVMBActivity<HomeViewModel, ActivityNoticeDetailBinding>(R.layout.activity_notice_detail) {
|
||||||
|
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
val stringExtra = intent.getStringExtra("id")
|
||||||
|
if (TextUtils.isEmpty(stringExtra)) {
|
||||||
|
finish()
|
||||||
|
} else {
|
||||||
|
mViewModel.getHomeNoticeDetail(stringExtra!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.homeNoticeDetail.collectLatest {
|
||||||
|
if (TextUtils.isEmpty(it?.content)) {
|
||||||
|
return@collectLatest
|
||||||
|
}
|
||||||
|
mBinding.tvTitle.text = it?.title.orEmptyDefault()
|
||||||
|
mBinding.tvDate.text = DateUtil.dateStrToStrMiddle(it?.createTime)
|
||||||
|
|
||||||
|
var content = it?.content
|
||||||
|
|
||||||
|
mBinding.apply {
|
||||||
|
var css = "<style>img{max-width: 100%;}</style>"
|
||||||
|
var html = css + content
|
||||||
|
|
||||||
|
webContent.loadDataWithBaseURL(
|
||||||
|
null,
|
||||||
|
html.addImgHeader(),
|
||||||
|
"text/html",
|
||||||
|
"UTF-8",
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(paramView: View?) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.activity.home
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.adapter.home.HomeMessageAdapter
|
||||||
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeNoticeBean
|
||||||
|
import com.xjjk.healthyclients.databinding.ActivityNoticeListBinding
|
||||||
|
import com.xjjk.healthyclients.superfuntion.initColors
|
||||||
|
import com.xjjk.healthyclients.ui.viewmodel.HomeViewModel
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页通知消息列表
|
||||||
|
*/
|
||||||
|
class HomeNoticeListActivity :
|
||||||
|
BaseVMBActivity<HomeViewModel, ActivityNoticeListBinding>(R.layout.activity_notice_list),
|
||||||
|
SwipeRefreshLayout.OnRefreshListener {
|
||||||
|
|
||||||
|
val mAdapter: HomeMessageAdapter by lazy { HomeMessageAdapter() }
|
||||||
|
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.apply {
|
||||||
|
rvList.adapter = mAdapter
|
||||||
|
swipeRefresh.initColors()
|
||||||
|
swipeRefresh.setOnRefreshListener(this@HomeNoticeListActivity)
|
||||||
|
initLoadMore()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
mViewModel.getHomeNoticeList()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initLoadMore() {
|
||||||
|
mAdapter.loadMoreModule.setOnLoadMoreListener {
|
||||||
|
mViewModel.getHomeNoticeList()
|
||||||
|
}
|
||||||
|
mAdapter.loadMoreModule.isAutoLoadMore = true
|
||||||
|
//当自动加载开启,同时数据不满一屏时,是否继续执行自动加载更多(默认为true)
|
||||||
|
mAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
mAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
val homeNoticeBean = adapter.data.get(position) as HomeNoticeBean
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putString("id", homeNoticeBean.id)
|
||||||
|
|
||||||
|
toActivity(HomeNoticeDetailActivity::class.java, bundle)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.homeNoticeList.collectLatest {
|
||||||
|
if (it.isNullOrEmpty()) {
|
||||||
|
return@collectLatest
|
||||||
|
}
|
||||||
|
mBinding.emptyView.visibility = View.GONE
|
||||||
|
if (mViewModel.pageIndex.value <= 1) {
|
||||||
|
mAdapter.setNewInstance(it)
|
||||||
|
} else {
|
||||||
|
mAdapter.addData(it)
|
||||||
|
}
|
||||||
|
mAdapter.loadMoreModule.loadMoreComplete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.isLoadMoreEnd.collectLatest {
|
||||||
|
if (it) {
|
||||||
|
mAdapter.loadMoreModule?.loadMoreEnd(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.isRefreshing.collectLatest {
|
||||||
|
mBinding.swipeRefresh.isRefreshing = it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(paramView: View?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRefresh() {
|
||||||
|
mViewModel.getHomeNoticeList(true)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.activity.home
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.adapter.home.HomeMessageAdapter
|
||||||
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
|
import com.xjjk.healthyclients.databinding.ActivityBankBinding
|
||||||
|
import com.xjjk.healthyclients.ui.viewmodel.HomeViewModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的银行
|
||||||
|
*/
|
||||||
|
class MyBankLActivity :
|
||||||
|
BaseVMBActivity<HomeViewModel, ActivityBankBinding>(R.layout.activity_bank) {
|
||||||
|
|
||||||
|
val mAdapter: HomeMessageAdapter by lazy { HomeMessageAdapter() }
|
||||||
|
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.apply {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(paramView: View?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,8 +1,13 @@
|
|||||||
package com.xjjk.healthyclients.ui.viewmodel
|
package com.xjjk.healthyclients.ui.viewmodel
|
||||||
|
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.EmployeeBean
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.ExpertBean
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.bean.GroupMemberBean
|
||||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||||
import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo
|
import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo
|
||||||
|
import com.xjjk.healthyclients.bean.emergency.GroupInfo
|
||||||
import com.xjjk.healthyclients.bean.emergency.LocationResourceBean
|
import com.xjjk.healthyclients.bean.emergency.LocationResourceBean
|
||||||
|
import com.xjjk.healthyclients.data.bean.PageBean
|
||||||
import com.xjjk.healthyclients.data.repository.EmergencyRepository
|
import com.xjjk.healthyclients.data.repository.EmergencyRepository
|
||||||
import com.xjjk.healthyclients.superfuntion.handleRequest
|
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||||
import com.xjjk.healthyclients.superfuntion.launch
|
import com.xjjk.healthyclients.superfuntion.launch
|
||||||
@@ -42,6 +47,35 @@ class EmergencyViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isLiaisonUser(successCall: (Boolean) -> Unit = {}){
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
EmergencyRepository.isLiaisonUser(),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.let { it1 ->
|
||||||
|
successCall.invoke(it1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getParticipatedOrders(successCall: (PageBean<GroupInfo>) -> Unit = {}){
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
EmergencyRepository.getParticipatedOrders(),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.let { it1 ->
|
||||||
|
successCall.invoke(it1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fun getEmergencyCall(
|
fun getEmergencyCall(
|
||||||
callType: String,
|
callType: String,
|
||||||
resourceId: String,
|
resourceId: String,
|
||||||
@@ -99,6 +133,101 @@ class EmergencyViewModel : BaseViewModel() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getParamedicGroupInfo(
|
||||||
|
groupName: String, longitude: Double,
|
||||||
|
latitude: Double, successCall: (EmergencyGroupInfo) -> Unit = {}
|
||||||
|
) {
|
||||||
|
launch({
|
||||||
|
handleRequest(
|
||||||
|
EmergencyRepository.getParamedicGroupInfo(groupName, longitude, latitude),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.let { it1 ->
|
||||||
|
successCall.invoke(it1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun searchExpert(
|
||||||
|
realname: String, centerId: String, excludeSessionId: String, pageNo: Int, pageSize: Int, successCall: (List<ExpertBean>) -> Unit = {}
|
||||||
|
) {
|
||||||
|
launch({
|
||||||
|
handleRequest(
|
||||||
|
EmergencyRepository.searchExpert(realname, centerId, excludeSessionId, pageNo, pageSize),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.records?.let { it1 ->
|
||||||
|
successCall.invoke(it1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun searchEmployee(
|
||||||
|
realname: String, orgCode: String, workNo: String, phone: String, excludeSessionId: String, pageNo: Int, pageSize: Int,
|
||||||
|
successCall: (List<EmployeeBean>) -> Unit = {}) {
|
||||||
|
launch({
|
||||||
|
handleRequest(
|
||||||
|
EmergencyRepository.searchEmployee(realname, orgCode, workNo, phone, excludeSessionId, pageNo, pageSize),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.records?.let { it1 ->
|
||||||
|
successCall.invoke(it1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getActualGroupMemberList(sessionId: String, successCall: (List<GroupMemberBean>) -> Unit = {}
|
||||||
|
) {
|
||||||
|
launch({
|
||||||
|
handleRequest(
|
||||||
|
EmergencyRepository.getActualGroupMemberList(sessionId),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.let { it1 ->
|
||||||
|
successCall.invoke(it1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请成员加入群组。
|
||||||
|
*
|
||||||
|
* @param groupId 群组 ID
|
||||||
|
* @param memberList 成员 userId 列表
|
||||||
|
* @param memberType 成员类型
|
||||||
|
* @param successCall 结果回调:true 表示服务器写入成功,false 表示失败(网络异常、业务错误、result 为空或 false)
|
||||||
|
* 回调在协程上下文触发,调用方需自行切回主线程
|
||||||
|
*/
|
||||||
|
fun addGroupUser(groupId: String, memberList: List<String>,
|
||||||
|
memberType: Int, successCall: (Boolean) -> Unit = {}
|
||||||
|
) {
|
||||||
|
launch({
|
||||||
|
handleRequest(
|
||||||
|
EmergencyRepository.addGroupUser(groupId, memberList, memberType),
|
||||||
|
successBlock = {
|
||||||
|
// result 为空或 false 都视为失败,便于调用方串行后续动作(如刷新列表)
|
||||||
|
successCall.invoke(it.result == true)
|
||||||
|
},
|
||||||
|
errorBlock = {
|
||||||
|
successCall.invoke(false)
|
||||||
|
false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun removeGroupUser(groupId: String, memberList: List<String>, successCall: (Boolean) -> Unit = {}
|
||||||
|
) {
|
||||||
|
launch({
|
||||||
|
handleRequest(
|
||||||
|
EmergencyRepository.removeGroupUser(groupId, memberList),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.let { it1 ->
|
||||||
|
successCall.invoke(it1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * 附近医疗点
|
// * 附近医疗点
|
||||||
|
|||||||
@@ -0,0 +1,206 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.viewmodel
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||||
|
import com.xjjk.healthyclients.bean.guidance.GuidanceListBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeBannerBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeNoticeBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeWatchAllDataBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.WatchInfoBean
|
||||||
|
import com.xjjk.healthyclients.data.repository.GuidanceRepository
|
||||||
|
import com.xjjk.healthyclients.data.repository.HomeRepository
|
||||||
|
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||||
|
import com.xjjk.healthyclients.superfuntion.launch
|
||||||
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
|
class HomeViewModel : BaseViewModel() {
|
||||||
|
|
||||||
|
var mDoctorList = MutableStateFlow(ArrayList<GuidanceListBean>())
|
||||||
|
|
||||||
|
var homeNoticeRepeat = MutableSharedFlow<MutableList<HomeNoticeBean>?>()
|
||||||
|
var homeNoticeList = MutableSharedFlow<MutableList<HomeNoticeBean>?>()
|
||||||
|
var homeNoticeDetail = MutableSharedFlow<HomeNoticeBean?>()
|
||||||
|
var homeBannerList = MutableSharedFlow<MutableList<HomeBannerBean>?>()
|
||||||
|
var sessionPicUrl = MutableSharedFlow<String?>()
|
||||||
|
|
||||||
|
var enCryptInfoUrl = MutableStateFlow<String?>(null)
|
||||||
|
|
||||||
|
//手表
|
||||||
|
var watchInfo = MutableSharedFlow<WatchInfoBean?>()
|
||||||
|
var watchAllData = MutableSharedFlow<MutableList<HomeWatchAllDataBean>?>()
|
||||||
|
var watchBindStatus = MutableSharedFlow<String?>()
|
||||||
|
|
||||||
|
|
||||||
|
var isRefreshing = MutableStateFlow(false)
|
||||||
|
var isLoadMoreEnd = MutableSharedFlow<Boolean>()
|
||||||
|
var pageIndex = MutableStateFlow(1)
|
||||||
|
private val pageSize = 20
|
||||||
|
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun selectDoctorRecommendHome() {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
GuidanceRepository.selectDoctorRecommend(1,3),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.let{ result ->
|
||||||
|
if (result.isNotEmpty()) {
|
||||||
|
mDoctorList.emit(result)
|
||||||
|
}else{
|
||||||
|
mDoctorList.emit(ArrayList<GuidanceListBean>())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取首页消息通知列表
|
||||||
|
*/
|
||||||
|
fun getHomeNoticeList(isRefresh: Boolean = false) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
if (isRefresh) {
|
||||||
|
isRefreshing.emit(true)
|
||||||
|
isLoadMoreEnd.emit(false)
|
||||||
|
pageIndex.emit(1)
|
||||||
|
}
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getHomeNoticeList(pageIndex.value, pageSize),
|
||||||
|
successBlock = {
|
||||||
|
if (it.result.isNullOrEmpty()) {
|
||||||
|
isLoadMoreEnd.emit(true)
|
||||||
|
homeNoticeList.emit(mutableListOf())
|
||||||
|
} else {
|
||||||
|
homeNoticeList.emit(it.result)
|
||||||
|
pageIndex.value++
|
||||||
|
if (it.result.size < pageSize) {
|
||||||
|
isLoadMoreEnd.emit(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, finallyBlock = {
|
||||||
|
isRefreshing.emit(false)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页消息轮询
|
||||||
|
*/
|
||||||
|
fun getHomeNoticeListRepeat() {
|
||||||
|
launch(
|
||||||
|
showDialog = false,
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getHomeNoticeList(1, 20),
|
||||||
|
successBlock = {
|
||||||
|
homeNoticeRepeat.emit(it.result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getHomeNoticeDetail(id: String) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getHomeNoticeDetail(id),
|
||||||
|
successBlock = {
|
||||||
|
homeNoticeDetail.emit(it.result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getHomeBannerList() {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getHomeBannerList(),
|
||||||
|
successBlock = {
|
||||||
|
homeBannerList.emit(it.result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getConSessionPicUrl() {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getConSessionPicUrl(),
|
||||||
|
successBlock = {
|
||||||
|
sessionPicUrl.emit(it.result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getHomeWatchData(date:String) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getHomeWatchData(date),
|
||||||
|
successBlock = {
|
||||||
|
watchAllData.emit(it.result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getHomeWatchInfo(userId: String?) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getHomeWatchInfo(userId),
|
||||||
|
successBlock = {
|
||||||
|
watchInfo.emit(it.result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSysEnCryptInfo(str: String?) {
|
||||||
|
launch(showDialog = false,
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getSysEnCryptInfo(str),
|
||||||
|
successBlock = {
|
||||||
|
enCryptInfoUrl.emit(it.result?.encryptData)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
fun getBindDevice(str: String?) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getBindDevice(str),
|
||||||
|
successBlock = {
|
||||||
|
watchBindStatus.emit(it.result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
fun getUnbundleDevice(str: String?) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getUnbundleDevice(str),
|
||||||
|
successBlock = {
|
||||||
|
watchBindStatus.emit(it.result)
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.viewmodel
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||||
|
import com.xjjk.healthyclients.bean.user.CheckInBean
|
||||||
|
import com.xjjk.healthyclients.data.repository.HomeRepository
|
||||||
|
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||||
|
import com.xjjk.healthyclients.superfuntion.launch
|
||||||
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机银行
|
||||||
|
*/
|
||||||
|
class PointsViewModel : BaseViewModel() {
|
||||||
|
|
||||||
|
|
||||||
|
var isRefreshing = MutableStateFlow(false)
|
||||||
|
var isLoadMoreEnd = MutableSharedFlow<Boolean>()
|
||||||
|
var pageIndex = MutableStateFlow(1)
|
||||||
|
private val pageSize = 20
|
||||||
|
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getUserPoints() {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getUserPoints(),
|
||||||
|
successBlock = {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getUserPointsTask() {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getUserPointsTask(),
|
||||||
|
successBlock = {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun postUserPointsRecord(changeType: Int) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.postUserPointsRecord(changeType),
|
||||||
|
successBlock = {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
fun postUserPointsRank(changeType: Int) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.postUserPointsRank(pageIndex.value,pageSize,changeType),
|
||||||
|
successBlock = {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun postUserPointsCheckIn(checkInBean: CheckInBean) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.postUserPointsCheckIn(checkInBean),
|
||||||
|
successBlock = {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.viewmodel
|
||||||
|
|
||||||
|
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||||
|
import com.xjjk.healthyclients.bean.home.ProposalBean
|
||||||
|
import com.xjjk.healthyclients.data.repository.EmergencyRepository
|
||||||
|
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||||
|
import com.xjjk.healthyclients.superfuntion.launch
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一人一案(健康档案)ViewModel
|
||||||
|
*/
|
||||||
|
class ProposalViewModel : BaseViewModel() {
|
||||||
|
var proposalInfo = MutableStateFlow<ProposalBean?>(null)
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
// 初始化逻辑
|
||||||
|
getProposalInfo()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getProposalInfo() {
|
||||||
|
launch({
|
||||||
|
handleRequest(
|
||||||
|
EmergencyRepository.getProposalInfo(),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.let { it1 ->
|
||||||
|
proposalInfo.emit(it1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package com.xjjk.healthyclients.ui.viewmodel
|
||||||
|
|
||||||
|
import com.sw.healthyclients.data.local.DataStoreManager
|
||||||
|
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||||
|
import com.xjjk.healthyclients.bean.UserListBean
|
||||||
|
import com.xjjk.healthyclients.data.repository.OtherRepository
|
||||||
|
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||||
|
import com.xjjk.healthyclients.superfuntion.launch
|
||||||
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author nanfeifei
|
||||||
|
* @time 2023/7/17 16:19
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
class SimulateUserViewModel: BaseViewModel() {
|
||||||
|
var userList = MutableSharedFlow<UserListBean>()
|
||||||
|
var userBean = MutableSharedFlow<UserListBean.RecordsDTO>()
|
||||||
|
var pageIndex = MutableStateFlow(1)
|
||||||
|
var isRefreshing = MutableStateFlow(false)
|
||||||
|
var isSimuLateState = MutableSharedFlow<Boolean>()
|
||||||
|
var isResetState = MutableStateFlow(false)
|
||||||
|
var isLoadMoreEnd = MutableSharedFlow<Boolean>()
|
||||||
|
var tokenOverdue = MutableSharedFlow<Boolean>()
|
||||||
|
private val pageSize = 20
|
||||||
|
override fun init() {
|
||||||
|
getMessageList("")
|
||||||
|
}
|
||||||
|
fun getMessageList(username: String){
|
||||||
|
launch(tryBlock = {
|
||||||
|
handleRequest(OtherRepository.getList(username), successBlock = {
|
||||||
|
if(it.result == null){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
userList.emit(it.result!!)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, finallyBlock = {
|
||||||
|
isRefreshing.emit(false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun simulateUser(userid: String){
|
||||||
|
launch(tryBlock = {
|
||||||
|
handleRequest(OtherRepository.simulateUser(userid), successBlock = {
|
||||||
|
if (it.result == true){
|
||||||
|
isSimuLateState.emit(true)
|
||||||
|
}else{
|
||||||
|
isSimuLateState.emit(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, finallyBlock = {
|
||||||
|
isRefreshing.emit(false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
fun fakeUser(method:(bean: UserListBean.RecordsDTO)->Unit){
|
||||||
|
launch(tryBlock = {
|
||||||
|
handleRequest(OtherRepository.fakeUser(), successBlock = {
|
||||||
|
if (it.result !=null){
|
||||||
|
method(it.result!!)
|
||||||
|
userBean.emit(it.result!!)
|
||||||
|
}else{
|
||||||
|
userBean.emit(UserListBean.RecordsDTO())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, finallyBlock = {
|
||||||
|
isRefreshing.emit(false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
fun restore(){
|
||||||
|
launch(tryBlock = {
|
||||||
|
handleRequest(OtherRepository.restore(), successBlock = {
|
||||||
|
if (it.result == true){
|
||||||
|
isResetState.emit(true)
|
||||||
|
}else{
|
||||||
|
isResetState.emit(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, finallyBlock = {
|
||||||
|
isRefreshing.emit(false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token有效性
|
||||||
|
*/
|
||||||
|
fun selectTokenExpire() {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
OtherRepository.selectTokenExpire(DataStoreManager.getToken()),
|
||||||
|
successBlock = {
|
||||||
|
it.result?.let { result ->
|
||||||
|
tokenOverdue.emit(result)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,7 +56,6 @@ class AndroidInterface(val agentWeb: AgentWeb, val context: Activity) {
|
|||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
fun finishActivity() {
|
fun finishActivity() {
|
||||||
context.runOnUiThread {
|
context.runOnUiThread {
|
||||||
EventBus.getDefault().post(WebReloadEvent())
|
|
||||||
context.finish()
|
context.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ object ConstantUtils {
|
|||||||
var mCurrentLon = 87.627704
|
var mCurrentLon = 87.627704
|
||||||
var mNutritionMonitor = false
|
var mNutritionMonitor = false
|
||||||
var mIsCloseDialog = false
|
var mIsCloseDialog = false
|
||||||
|
|
||||||
|
val APP_ID: String = "wxb33cd60beda0a212"
|
||||||
var mPrivacy = "本平台由西安联链科技有限公司开发和运维,平台深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则,保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。同时,我们承诺将采取相应的安全保护措施来保护您的个人信息。请在使用平台服务前,仔细阅读并了解本隐私权政策,我们将按照本政策收集、处理及披露您的信息。\n" +
|
var mPrivacy = "本平台由西安联链科技有限公司开发和运维,平台深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则,保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。同时,我们承诺将采取相应的安全保护措施来保护您的个人信息。请在使用平台服务前,仔细阅读并了解本隐私权政策,我们将按照本政策收集、处理及披露您的信息。\n" +
|
||||||
"本政策将帮助您了解以下内容:\n" +
|
"本政策将帮助您了解以下内容:\n" +
|
||||||
"1、定义\n" +
|
"1、定义\n" +
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ object IMInputActionSettingUtils {
|
|||||||
/**
|
/**
|
||||||
* 应急就医IM功能配置
|
* 应急就医IM功能配置
|
||||||
*/
|
*/
|
||||||
fun createEmergencySetting(){
|
fun createEmergencySetting(firstAid: Boolean = false){//是否为急救员
|
||||||
var inputActionSetting = InputActionSetting.createInstance()
|
var inputActionSetting = InputActionSetting.createInstance()
|
||||||
inputActionSetting.packageName = BuildConfig.APPLICATION_ID
|
inputActionSetting.packageName = BuildConfig.APPLICATION_ID
|
||||||
inputActionSetting.CurrentResourceHost = UrlConfig.IMAGE_BASE_URL
|
inputActionSetting.CurrentResourceHost = UrlConfig.IMAGE_BASE_URL
|
||||||
@@ -20,6 +20,7 @@ object IMInputActionSettingUtils {
|
|||||||
inputActionSetting.isDisableMedicalExaminationReport = true
|
inputActionSetting.isDisableMedicalExaminationReport = true
|
||||||
inputActionSetting.isDisableSendMessage = false
|
inputActionSetting.isDisableSendMessage = false
|
||||||
inputActionSetting.isDisableFinishSession = false
|
inputActionSetting.isDisableFinishSession = false
|
||||||
|
inputActionSetting.isFirstAid = firstAid
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 图文咨询IM功能配置
|
* 图文咨询IM功能配置
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.xjjk.healthyclients.utils
|
||||||
|
|
||||||
|
import javax.crypto.Mac
|
||||||
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签名工具类
|
||||||
|
* 用于生成 HMAC-SHA256 签名,支持 API 请求的身份验证
|
||||||
|
*/
|
||||||
|
object SignatureUtils {
|
||||||
|
|
||||||
|
private const val ALGORITHM = "HmacSHA256"
|
||||||
|
private const val HEX_CHARS = "0123456789abcdef"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成签名
|
||||||
|
*
|
||||||
|
* @param timestamp 时间戳(秒级)
|
||||||
|
* @param bodyString 请求体原始 JSON 字符串
|
||||||
|
* @param secretKey 密钥
|
||||||
|
* @return 64 位小写十六进制签名字符串
|
||||||
|
*/
|
||||||
|
fun generateSignature(timestamp: Long, bodyString: String, secretKey: String): String {
|
||||||
|
// 构造待签名字符串:timestamp + bodyString
|
||||||
|
val stringToSign = "$timestamp$bodyString"
|
||||||
|
|
||||||
|
// 使用 HMAC-SHA256 算法加密
|
||||||
|
val mac = Mac.getInstance(ALGORITHM)
|
||||||
|
val secretKeySpec = SecretKeySpec(secretKey.toByteArray(), ALGORITHM)
|
||||||
|
mac.init(secretKeySpec)
|
||||||
|
|
||||||
|
// 获取签名字节数组
|
||||||
|
val signatureBytes = mac.doFinal(stringToSign.toByteArray())
|
||||||
|
|
||||||
|
// 转换为十六进制小写字符串
|
||||||
|
return bytesToHex(signatureBytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字节数组转换为十六进制小写字符串
|
||||||
|
*
|
||||||
|
* @param bytes 字节数组
|
||||||
|
* @return 十六进制小写字符串
|
||||||
|
*/
|
||||||
|
private fun bytesToHex(bytes: ByteArray): String {
|
||||||
|
val result = StringBuilder(bytes.size * 2)
|
||||||
|
for (byte in bytes) {
|
||||||
|
val octet = byte.toInt()
|
||||||
|
result.append(HEX_CHARS[octet shr 4 and 0xF])
|
||||||
|
result.append(HEX_CHARS[octet and 0xF])
|
||||||
|
}
|
||||||
|
return result.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证签名是否正确
|
||||||
|
*
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @param bodyString 请求体原始 JSON 字符串
|
||||||
|
* @param secretKey 密钥
|
||||||
|
* @param signature 待验证的签名
|
||||||
|
* @return true 签名正确,false 签名错误
|
||||||
|
*/
|
||||||
|
fun verifySignature(timestamp: Long, bodyString: String, secretKey: String, signature: String): Boolean {
|
||||||
|
val generatedSignature = generateSignature(timestamp, bodyString, secretKey)
|
||||||
|
return generatedSignature.equals(signature, ignoreCase = false)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
package com.xjjk.healthyclients.utils
|
|
||||||
|
|
||||||
import androidx.annotation.StringDef
|
|
||||||
|
|
||||||
object UrlH5RouteUtils {
|
|
||||||
/**
|
|
||||||
* 知识库文章详情
|
|
||||||
*/
|
|
||||||
const val RICH_TEXT = "knowledge-page"
|
|
||||||
/**
|
|
||||||
* 岗位健康详情页
|
|
||||||
*/
|
|
||||||
const val JOBDETAILS = "jobDetails"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 知识库健-康答题
|
|
||||||
*/
|
|
||||||
const val HEALTH_QUESTION = "mergeQuestion/physical-questions"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 知识库答题记录
|
|
||||||
*/
|
|
||||||
const val ANSWER_RECORDSLIST = "answer-recordsList"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 膳食-慢病预警测评结果
|
|
||||||
*/
|
|
||||||
const val DISEASE_ASSESSMENT_RESULT = "disease-assessment-result"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 膳食-体重管理
|
|
||||||
*/
|
|
||||||
const val FOOD_OVERWEIGHT_INTERVENTION = "overweightIntervention"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运动-运动平台
|
|
||||||
*/
|
|
||||||
const val SPORT_PLATFORM = "sports-platform"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运动-运动排名
|
|
||||||
*/
|
|
||||||
const val SPORT_RANKING = "sport-ranking"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 步数
|
|
||||||
*/
|
|
||||||
const val STEP_STATISTICS = "step-statistics"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 心理-心理评估
|
|
||||||
*/
|
|
||||||
const val MENTAL_PSYCHOLOGICAL_ASSESSMENT = "assessment-home"
|
|
||||||
/**
|
|
||||||
* 心理-心理评估-基础信息basic-information
|
|
||||||
*/
|
|
||||||
const val MENTAL_PSYCHOLOGICAL_ASSESSMENT_BASIC_INFORMATION = "basic-information"
|
|
||||||
/**
|
|
||||||
* 心理-心理评估-测评模式self-evaluation
|
|
||||||
*/
|
|
||||||
const val MENTAL_PSYCHOLOGICAL_ASSESSMENT_SELF_EVALUATION = "self-evaluation"
|
|
||||||
/**
|
|
||||||
* 心理-知识答题-答题模式
|
|
||||||
*/
|
|
||||||
const val MENTAL_KNOWLEDGE_CHOOSE_TOPIC = "choose-topic"
|
|
||||||
/**
|
|
||||||
* 心理-心理评估-测评历史reportHistory
|
|
||||||
*/
|
|
||||||
const val MENTAL_PSYCHOLOGICAL_ASSESSMENT_REPORTHISTORY = "reportHistory"
|
|
||||||
/**
|
|
||||||
* 心理-知识答题-答题历史
|
|
||||||
*/
|
|
||||||
const val MENTAL_KNOWLEDGE_ANSWER_HISTORY = "answer-history"
|
|
||||||
/**
|
|
||||||
* 心理-心理评估-单位组织task
|
|
||||||
*/
|
|
||||||
const val MENTAL_PSYCHOLOGICAL_ASSESSMENT_TASK = "task"
|
|
||||||
/**
|
|
||||||
* 心理-知识答题-单位组织task
|
|
||||||
*/
|
|
||||||
const val MENTAL_KNOWLEDGE_TASK_TOPIC = "task-topic"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 心理-规律起居
|
|
||||||
*/
|
|
||||||
const val MENTAL_REGULAR_LIVING = "livingIndependent"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 糖尿病-血糖监测
|
|
||||||
*/
|
|
||||||
const val DIABETES_BLOOD_GLUCOSE_MONITORING = "bloodGlucose"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 糖尿病-信号预警
|
|
||||||
*/
|
|
||||||
const val DIABETES_SIGNAL_WARNING = "health"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 癌症-病因溯源
|
|
||||||
*/
|
|
||||||
const val CANCER_ETIOLOGICAL_TRACING = "etiological"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 癌症-免疫预警
|
|
||||||
*/
|
|
||||||
const val CANCER_IMMUNE_EARLY_WARNING = "immuneWarning"
|
|
||||||
/**
|
|
||||||
* 知识-体检可视化
|
|
||||||
*/
|
|
||||||
const val PHYSICAL_EXAMINATION_HOME = "physicalExaminationIndex"
|
|
||||||
/**
|
|
||||||
* 心血管-吃动平衡
|
|
||||||
*/
|
|
||||||
const val CARDIOVASCULAR_EATING_BALANCE = "healthIndependentC"
|
|
||||||
/**
|
|
||||||
* 随访记录详情
|
|
||||||
*/
|
|
||||||
const val INTERVENTION_FOLLOW = "follow"
|
|
||||||
/**
|
|
||||||
* 就诊记录详情
|
|
||||||
*/
|
|
||||||
const val INTERVENTION_TREATMENTDETAIL = "treatmentDetail"
|
|
||||||
/**
|
|
||||||
* 急救培训开始答题
|
|
||||||
*/
|
|
||||||
const val HEALTH_ANSWER = "mergeQuestion/physical-answer"
|
|
||||||
/**
|
|
||||||
* 癌症-信号预判
|
|
||||||
*/
|
|
||||||
const val CANCER_SIGNAL_PREDICTION = "mergeQuestion/home-prediction"
|
|
||||||
/**
|
|
||||||
* 癌症-免疫预警
|
|
||||||
*/
|
|
||||||
const val INTERVENTION_IMMUNE_WARNING = "mergeQuestion/immune-warning"
|
|
||||||
/**
|
|
||||||
* 病因溯源填写问卷
|
|
||||||
*/
|
|
||||||
const val IMAGE_TRACEABILITY = "mergeQuestion/image-traceability"
|
|
||||||
/**
|
|
||||||
* 急救培训答题回顾
|
|
||||||
*/
|
|
||||||
const val HEALTH_ANSWER_REVIEW = "mergeQuestion/physical-review"
|
|
||||||
/**
|
|
||||||
* 吃动平衡问卷调查
|
|
||||||
*/
|
|
||||||
const val Eating_ANSWER_REVIEW = "mergeQuestion/eating-balance"
|
|
||||||
/**
|
|
||||||
* 心理知识答题-知识详情
|
|
||||||
*/
|
|
||||||
const val KNOWLEDGE_DETAIL = "knowledge-detail"
|
|
||||||
/**
|
|
||||||
* 心血管-防范心梗问卷
|
|
||||||
*/
|
|
||||||
const val HEART_ATTACK = "heart-attack"
|
|
||||||
/**
|
|
||||||
* 心血管-风险详情
|
|
||||||
*/
|
|
||||||
const val HEART_FACTORS = "heart-factors"
|
|
||||||
|
|
||||||
|
|
||||||
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD, AnnotationTarget.FUNCTION)
|
|
||||||
@MustBeDocumented
|
|
||||||
@StringDef(
|
|
||||||
RICH_TEXT,
|
|
||||||
JOBDETAILS, HEALTH_QUESTION, ANSWER_RECORDSLIST, DISEASE_ASSESSMENT_RESULT,
|
|
||||||
SPORT_RANKING, STEP_STATISTICS, MENTAL_PSYCHOLOGICAL_ASSESSMENT, SPORT_PLATFORM, MENTAL_REGULAR_LIVING,
|
|
||||||
DIABETES_BLOOD_GLUCOSE_MONITORING, DIABETES_SIGNAL_WARNING, CANCER_ETIOLOGICAL_TRACING,
|
|
||||||
CANCER_IMMUNE_EARLY_WARNING, FOOD_OVERWEIGHT_INTERVENTION, PHYSICAL_EXAMINATION_HOME,
|
|
||||||
CARDIOVASCULAR_EATING_BALANCE,
|
|
||||||
INTERVENTION_FOLLOW,
|
|
||||||
INTERVENTION_TREATMENTDETAIL,
|
|
||||||
HEALTH_ANSWER,
|
|
||||||
CANCER_SIGNAL_PREDICTION,
|
|
||||||
INTERVENTION_IMMUNE_WARNING,
|
|
||||||
IMAGE_TRACEABILITY,
|
|
||||||
HEALTH_ANSWER_REVIEW,
|
|
||||||
Eating_ANSWER_REVIEW
|
|
||||||
,
|
|
||||||
INTERVENTION_TREATMENTDETAIL,
|
|
||||||
MENTAL_PSYCHOLOGICAL_ASSESSMENT_BASIC_INFORMATION,
|
|
||||||
MENTAL_PSYCHOLOGICAL_ASSESSMENT_SELF_EVALUATION,
|
|
||||||
MENTAL_PSYCHOLOGICAL_ASSESSMENT_REPORTHISTORY,
|
|
||||||
MENTAL_PSYCHOLOGICAL_ASSESSMENT_TASK,
|
|
||||||
KNOWLEDGE_DETAIL,MENTAL_KNOWLEDGE_CHOOSE_TOPIC,MENTAL_KNOWLEDGE_ANSWER_HISTORY,MENTAL_KNOWLEDGE_TASK_TOPIC,HEART_ATTACK,HEART_FACTORS
|
|
||||||
)
|
|
||||||
@kotlin.annotation.Retention(AnnotationRetention.SOURCE)
|
|
||||||
annotation class RouteType
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import android.app.AlertDialog
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -21,17 +20,11 @@ import com.xjjk.healthyclients.databinding.DialogAppraiseBinding
|
|||||||
class AppraiseDialog constructor(
|
class AppraiseDialog constructor(
|
||||||
context: Context
|
context: Context
|
||||||
) : AlertDialog(context) {
|
) : AlertDialog(context) {
|
||||||
lateinit var mOnSubmitClickListener: OnSubmitClickListener
|
// 提交点击监听器
|
||||||
|
var mOnSubmitClickListener: OnSubmitClickListener?=null
|
||||||
|
// 数据绑定对象
|
||||||
lateinit var binding: DialogAppraiseBinding
|
lateinit var binding: DialogAppraiseBinding
|
||||||
|
|
||||||
init {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
create()
|
|
||||||
} else {
|
|
||||||
onCreate(null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = DataBindingUtil.inflate(
|
binding = DataBindingUtil.inflate(
|
||||||
@@ -47,19 +40,15 @@ class AppraiseDialog constructor(
|
|||||||
);//设置对话框大小
|
);//设置对话框大小
|
||||||
window?.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
|
window?.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
|
||||||
binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
if (getRating()==0F) {
|
if (getRating() == 0F) {
|
||||||
CustomToast.makeText(context, "您还没有选择星级评分", Toast.LENGTH_SHORT).show()
|
CustomToast.makeText(context, "您还没有选择星级评分", Toast.LENGTH_SHORT).show()
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
if (this::mOnSubmitClickListener.isInitialized) {
|
|
||||||
mOnSubmitClickListener?.onSubmitClick(this@AppraiseDialog)
|
mOnSubmitClickListener?.onSubmitClick(this@AppraiseDialog)
|
||||||
}
|
|
||||||
this.cancel()
|
this.cancel()
|
||||||
}
|
}
|
||||||
binding.btnClose.setOnClickListener {
|
binding.btnClose.setOnClickListener {
|
||||||
if (this::mOnSubmitClickListener.isInitialized) {
|
|
||||||
mOnSubmitClickListener?.onCancelClick(this@AppraiseDialog)
|
mOnSubmitClickListener?.onCancelClick(this@AppraiseDialog)
|
||||||
}
|
|
||||||
this.cancel()
|
this.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,11 +59,26 @@ class AppraiseDialog constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评分提交回调接口
|
||||||
|
*/
|
||||||
interface OnSubmitClickListener {
|
interface OnSubmitClickListener {
|
||||||
|
/**
|
||||||
|
* 提交按钮点击回调
|
||||||
|
*/
|
||||||
fun onSubmitClick(viewDialog: AppraiseDialog)
|
fun onSubmitClick(viewDialog: AppraiseDialog)
|
||||||
|
/**
|
||||||
|
* 关闭按钮点击回调
|
||||||
|
*/
|
||||||
fun onCancelClick(viewDialog: AppraiseDialog){}
|
fun onCancelClick(viewDialog: AppraiseDialog){}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置对话框标题
|
||||||
|
* @param title 标题文本
|
||||||
|
* @param titleSize 标题字体大小,默认 18f
|
||||||
|
* @return 返回当前对象,支持链式调用
|
||||||
|
*/
|
||||||
fun setDialogTitle(title: String, titleSize: Float = 18f): AppraiseDialog {
|
fun setDialogTitle(title: String, titleSize: Float = 18f): AppraiseDialog {
|
||||||
binding.tvTitle.visibility = View.VISIBLE
|
binding.tvTitle.visibility = View.VISIBLE
|
||||||
binding.tvTitle.text = title
|
binding.tvTitle.text = title
|
||||||
@@ -82,35 +86,67 @@ class AppraiseDialog constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置评价内容输入框提示文本
|
||||||
|
* @param text 提示文本
|
||||||
|
* @param textSize 字体大小,默认 13f
|
||||||
|
* @return 返回当前对象,支持链式调用
|
||||||
|
*/
|
||||||
fun setContentHint(text: String, textSize: Float = 13f): AppraiseDialog {
|
fun setContentHint(text: String, textSize: Float = 13f): AppraiseDialog {
|
||||||
binding.etAppraise.hint = text
|
binding.etAppraise.hint = text
|
||||||
binding.etAppraise.textSize = textSize
|
binding.etAppraise.textSize = textSize
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置提交按钮文本
|
||||||
|
* @param text 按钮文本
|
||||||
|
* @param btnTextSize 字体大小,默认 18f
|
||||||
|
* @return 返回当前对象,支持链式调用
|
||||||
|
*/
|
||||||
fun setBtnText(text: String, btnTextSize: Float = 18f): AppraiseDialog {
|
fun setBtnText(text: String, btnTextSize: Float = 18f): AppraiseDialog {
|
||||||
binding.btnSubmit.text = text
|
binding.btnSubmit.text = text
|
||||||
binding.btnSubmit.textSize = btnTextSize
|
binding.btnSubmit.textSize = btnTextSize
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置对话框是否可取消
|
||||||
|
* @param flag true 可取消,false 不可取消
|
||||||
|
* @return 返回当前对象,支持链式调用
|
||||||
|
*/
|
||||||
fun setDialogCancelable(flag: Boolean): AppraiseDialog {
|
fun setDialogCancelable(flag: Boolean): AppraiseDialog {
|
||||||
setCancelable(flag)
|
setCancelable(flag)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户输入的评价内容
|
||||||
|
* @return 评价文本
|
||||||
|
*/
|
||||||
fun getAppraiseContext(): String {
|
fun getAppraiseContext(): String {
|
||||||
return binding.etAppraise.text.trim().toString()
|
return binding.etAppraise.text.trim().toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取评分条控件
|
||||||
|
* @return RatingBar 对象
|
||||||
|
*/
|
||||||
fun getRatingBar(): RatingBar {
|
fun getRatingBar(): RatingBar {
|
||||||
return binding.ratingBar
|
return binding.ratingBar
|
||||||
}
|
}
|
||||||
fun getRating(): Float {
|
|
||||||
return getRatingBar().rating
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 获取匿名状态
|
* 获取用户选择的星级评分
|
||||||
|
* @return 评分值(0-5)
|
||||||
|
*/
|
||||||
|
fun getRating(): Float {
|
||||||
|
return binding.ratingBar.rating
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取匿名评价状态
|
||||||
|
* @return true 为匿名,false 为非匿名
|
||||||
*/
|
*/
|
||||||
fun getAnonymityStatus(): Boolean {
|
fun getAnonymityStatus(): Boolean {
|
||||||
return binding.cbAnonymity.isChecked
|
return binding.cbAnonymity.isChecked
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.xjjk.healthyclients.view
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.text.Editable
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.text.TextWatcher
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
|
import android.widget.EditText
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.sw.healthyclients.utils.KeyboardUtil.hideSoftInput
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.databinding.CustomSearchViewBinding
|
||||||
|
|
||||||
|
class CustomSearchView : RelativeLayout {
|
||||||
|
|
||||||
|
var mContext:Context?=null
|
||||||
|
lateinit var mBinding: CustomSearchViewBinding
|
||||||
|
constructor(context: Context?,attrs : AttributeSet?): super(context, attrs,0){
|
||||||
|
mContext=context
|
||||||
|
if(isInEditMode){
|
||||||
|
LayoutInflater.from(context).inflate(R.layout.custom_search_view, this, true)
|
||||||
|
}else{
|
||||||
|
mBinding = DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
R.layout.custom_search_view, this,true)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
fun initView(hint:String){
|
||||||
|
mBinding.customSearchEt.hint="$hint"
|
||||||
|
}
|
||||||
|
fun initEtContext(value:String?){
|
||||||
|
mBinding.customSearchEt.setText(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setPerformClick(){
|
||||||
|
mBinding.customSearchTv.performClick()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnCustomClickListener(method: (searchContent: String) -> Unit): String {
|
||||||
|
mBinding.customSearchTv.setOnClickListener {
|
||||||
|
hideSoftInput(context, mBinding.customSearchEt)
|
||||||
|
var value = mBinding.customSearchEt.text.trim().toString()
|
||||||
|
method(value)
|
||||||
|
}
|
||||||
|
//输入内容为空时回调
|
||||||
|
mBinding.customSearchEt.addTextChangedListener(object : TextWatcher {
|
||||||
|
override fun beforeTextChanged(
|
||||||
|
s: CharSequence?,
|
||||||
|
start: Int,
|
||||||
|
count: Int,
|
||||||
|
after: Int
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||||
|
if (TextUtils.isEmpty(s)) {
|
||||||
|
// method("")
|
||||||
|
mBinding.customSearchTv.performClick()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun afterTextChanged(s: Editable?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
mBinding.customSearchEt.setOnEditorActionListener { v, actionId, event ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||||
|
//点击搜索的时候隐藏软键盘
|
||||||
|
hideSoftInput(context, v as EditText)
|
||||||
|
var value = mBinding.customSearchEt.text.trim().toString()
|
||||||
|
method(value)
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
return mBinding.customSearchEt.text.trim().toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setFocusListener(method: (hasFocus:Boolean) -> Unit){
|
||||||
|
mBinding.customSearchEt.setOnFocusChangeListener(object: OnFocusChangeListener{
|
||||||
|
override fun onFocusChange(v: View?, hasFocus: Boolean) {
|
||||||
|
method(hasFocus)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getInoputText():String{
|
||||||
|
return mBinding.customSearchEt.text.toString().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.xjjk.healthyclients.view
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.adapter.HealthConsultationAdapter
|
||||||
|
import com.xjjk.healthyclients.bean.home.ArticleBean
|
||||||
|
import com.xjjk.healthyclients.databinding.LayoutHealthConsultationBinding
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康咨询 View 组件
|
||||||
|
* 头部标题 + 列表(左侧标题+收藏分享信息 / 右侧图片)
|
||||||
|
*/
|
||||||
|
class HealthConsultationView(context: Context?, attrs: AttributeSet?) :
|
||||||
|
RelativeLayout(context, attrs, 0) {
|
||||||
|
|
||||||
|
var mContext: Context? = context
|
||||||
|
var mBinding: LayoutHealthConsultationBinding = DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
R.layout.layout_health_consultation, this, true
|
||||||
|
)
|
||||||
|
|
||||||
|
private val mAdapter = HealthConsultationAdapter()
|
||||||
|
private var mOnItemClickListener: ((ArticleBean) -> Unit)? = null
|
||||||
|
private var mOnMoreClickListener: (() -> Unit)? = null
|
||||||
|
|
||||||
|
init {
|
||||||
|
mBinding.rvList.layoutManager = LinearLayoutManager(mContext)
|
||||||
|
mBinding.rvList.adapter = mAdapter
|
||||||
|
|
||||||
|
// 列表项点击
|
||||||
|
mAdapter.setOnItemClickListener { _, _, position ->
|
||||||
|
mAdapter.getItem(position)?.let { mOnItemClickListener?.invoke(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 头部更多按钮点击
|
||||||
|
mBinding.ivMore.setOnClickListener {
|
||||||
|
mOnMoreClickListener?.invoke()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 设置文章列表数据(替换),最多取前 2 条 */
|
||||||
|
fun setArticles(articles: List<ArticleBean>?) {
|
||||||
|
if (articles.isNullOrEmpty()) {
|
||||||
|
mBinding.rvList.visibility = GONE
|
||||||
|
mBinding.tvEmpty.visibility = VISIBLE
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
mBinding.rvList.visibility = VISIBLE
|
||||||
|
mBinding.tvEmpty.visibility = GONE
|
||||||
|
}
|
||||||
|
val topTwo = articles.take(2).toMutableList()
|
||||||
|
mAdapter.setNewInstance(topTwo)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 追加文章列表数据(分页加载) */
|
||||||
|
fun addArticles(articles: List<ArticleBean>) {
|
||||||
|
mAdapter.addData(articles)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnItemClickListener(listener: (ArticleBean) -> Unit) {
|
||||||
|
mOnItemClickListener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnMoreClickListener(listener: () -> Unit) {
|
||||||
|
mOnMoreClickListener = listener
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
package com.xjjk.healthyclients.view
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.KeyEvent
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
|
import android.view.inputmethod.InputMethodManager
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.sw.healthyclients.view.CustomToast
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.adapter.HealthKnowledgeAdapter
|
||||||
|
import com.xjjk.healthyclients.bean.home.ArticleBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.CategoryBean
|
||||||
|
import com.xjjk.healthyclients.databinding.LayoutHealthKnowledgeBinding
|
||||||
|
import com.xjjk.healthyclients.superfuntion.onCreateTab
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健康知识 View 组件
|
||||||
|
* 头部标题 + 搜索栏 + TabLayout(医生说/体检/保健/药品/疾病) + 列表
|
||||||
|
*/
|
||||||
|
class HealthKnowledgeView(context: Context?, attrs: AttributeSet?) :
|
||||||
|
RelativeLayout(context, attrs, 0) {
|
||||||
|
|
||||||
|
var mContext: Context? = context
|
||||||
|
var mBinding: LayoutHealthKnowledgeBinding = DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
R.layout.layout_health_knowledge, this, true
|
||||||
|
)
|
||||||
|
|
||||||
|
private val mAdapter = HealthKnowledgeAdapter()
|
||||||
|
private var mCategoryList: MutableList<CategoryBean> = mutableListOf()
|
||||||
|
private var mOnTabSelectedListener: ((CategoryBean) -> Unit)? = null
|
||||||
|
private var mOnItemClickListener: ((ArticleBean) -> Unit)? = null
|
||||||
|
private var mOnMoreClickListener: (() -> Unit)? = null
|
||||||
|
private var mOnSearchClickListener: ((String) -> Unit)? = null
|
||||||
|
|
||||||
|
init {
|
||||||
|
mBinding.rvList.layoutManager = LinearLayoutManager(mContext)
|
||||||
|
mBinding.rvList.adapter = mAdapter
|
||||||
|
|
||||||
|
// 列表项点击
|
||||||
|
mAdapter.setOnItemClickListener { _, _, position ->
|
||||||
|
mAdapter.getItem(position)?.let { mOnItemClickListener?.invoke(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 头部更多按钮点击
|
||||||
|
mBinding.ivMore.setOnClickListener {
|
||||||
|
mOnMoreClickListener?.invoke()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 健康知识 - 搜索
|
||||||
|
mBinding.searchView.customSearchTv.setOnClickListener {
|
||||||
|
val toString = mBinding.searchView.customSearchEt.text.toString()
|
||||||
|
if (toString.isEmpty()) {
|
||||||
|
CustomToast.makeText(context, "请输入搜索内容", CustomToast.LENGTH_SHORT).show()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
mOnSearchClickListener?.invoke(toString)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 键盘搜索键监听
|
||||||
|
mBinding.searchView.customSearchEt.setOnEditorActionListener { _, actionId, event ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH
|
||||||
|
|| (event != null && event.keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_DOWN)
|
||||||
|
) {
|
||||||
|
val keyword = mBinding.searchView.customSearchEt.text.toString()
|
||||||
|
if (keyword.isEmpty()) {
|
||||||
|
CustomToast.makeText(context, "请输入搜索内容", CustomToast.LENGTH_SHORT).show()
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
// 隐藏键盘
|
||||||
|
val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
||||||
|
imm?.hideSoftInputFromWindow(mBinding.searchView.customSearchEt.windowToken, 0)
|
||||||
|
mOnSearchClickListener?.invoke(keyword)
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据栏目列表设置 TabLayout
|
||||||
|
* @param categories 子栏目列表(健康知识 categoryId=1 的 children)
|
||||||
|
*/
|
||||||
|
fun setupTabs(categories: MutableList<CategoryBean>) {
|
||||||
|
mCategoryList.clear()
|
||||||
|
mCategoryList.addAll(categories)
|
||||||
|
if (categories.isEmpty()) {
|
||||||
|
mBinding.tabLayout.visibility = GONE
|
||||||
|
mBinding.tvEmpty.visibility = VISIBLE
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.tabLayout.visibility = VISIBLE
|
||||||
|
mBinding.tvEmpty.visibility = GONE
|
||||||
|
|
||||||
|
mBinding.tabLayout.removeAllTabs()
|
||||||
|
val array = Array<String>(categories.size) {
|
||||||
|
categories[it].categoryName?:""
|
||||||
|
}
|
||||||
|
mBinding.tabLayout.onCreateTab(array,2){index->
|
||||||
|
mOnTabSelectedListener?.invoke(categories[index!!.position]) ?: return@onCreateTab
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 设置文章列表数据(替换) */
|
||||||
|
fun setArticles(articles: MutableList<ArticleBean>?) {
|
||||||
|
if (articles.isNullOrEmpty()) {
|
||||||
|
mBinding.rvList.visibility = GONE
|
||||||
|
mBinding.tvEmpty.visibility = VISIBLE
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.rvList.visibility = VISIBLE
|
||||||
|
mBinding.tvEmpty.visibility = GONE
|
||||||
|
|
||||||
|
articles.take(3).let {
|
||||||
|
mAdapter.setNewInstance(it.toMutableList()) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 追加文章列表数据(分页加载) */
|
||||||
|
fun addArticles(articles: List<ArticleBean>) {
|
||||||
|
mAdapter.addData(articles)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setOnTabSelectedListener(listener: (CategoryBean) -> Unit) {
|
||||||
|
mOnTabSelectedListener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnItemClickListener(listener: (ArticleBean) -> Unit) {
|
||||||
|
mOnItemClickListener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnMoreClickListener(listener: () -> Unit) {
|
||||||
|
mOnMoreClickListener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnSearchClickListener(listener: (keyword: String) -> Unit) {
|
||||||
|
mOnSearchClickListener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除搜索框焦点,防止onResume时自动弹出键盘
|
||||||
|
fun clearSearchFocus() {
|
||||||
|
mBinding.searchView.customSearchEt.clearFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
package com.xjjk.healthyclients.view
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import com.sw.healthyclients.adapter.common.ViewPagerAdapter
|
||||||
|
import com.sw.healthyclients.bean.common.TabItemBean
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.bean.home.HomeWatchAllDataBean
|
||||||
|
import com.xjjk.healthyclients.bean.home.WatchInfoBean
|
||||||
|
import com.xjjk.healthyclients.databinding.LayoutHomeItemWatchBinding
|
||||||
|
import com.xjjk.healthyclients.event.WatchDataChangeEvent
|
||||||
|
import com.xjjk.healthyclients.fragment.WatchItemFragment
|
||||||
|
import com.xjjk.healthyclients.superfuntion.init
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
|
||||||
|
class HomeWatchView(context: Context?, attrs: AttributeSet?) :
|
||||||
|
RelativeLayout(context, attrs, 0), ViewPagerAdapter.OnCreateFragmentListener {
|
||||||
|
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
/** 自动轮播间隔时间(毫秒) */
|
||||||
|
private const val AUTO_PLAY_INTERVAL = 5000L
|
||||||
|
}
|
||||||
|
private var hasWatch: Boolean = false
|
||||||
|
// private var tabIndex: Int? = 0
|
||||||
|
|
||||||
|
|
||||||
|
var mContext: Context? = context
|
||||||
|
var mBinding: LayoutHomeItemWatchBinding = DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
R.layout.layout_home_item_watch, this, true
|
||||||
|
)
|
||||||
|
|
||||||
|
/** 自动轮播 Handler */
|
||||||
|
private val autoPlayHandler = Handler(Looper.getMainLooper())
|
||||||
|
|
||||||
|
/** 自动轮播 Runnable,每隔5s循环滚动到下一页 */
|
||||||
|
private val autoPlayRunnable = object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
val itemCount = mBinding.viewPager.adapter?.itemCount ?: 0
|
||||||
|
if (itemCount > 0) {
|
||||||
|
val nextItem = (mBinding.viewPager.currentItem + 1) % itemCount
|
||||||
|
if (nextItem == 0) {
|
||||||
|
mBinding.viewPager.setCurrentItem(nextItem, false)
|
||||||
|
} else {
|
||||||
|
mBinding.viewPager.setCurrentItem(nextItem, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
autoPlayHandler.postDelayed(this, AUTO_PLAY_INTERVAL)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun init(fragment: Fragment) {
|
||||||
|
// val arrayOf = arrayOf("心脑血管", "癌症", "慢呼", "糖尿病", "亚健康")
|
||||||
|
// mBinding.watchTabLayout.onCreateTab(arrayOf, 1) { tab ->
|
||||||
|
// tabIndex =tab?.position
|
||||||
|
// if (tab?.position != 0) {
|
||||||
|
// mBinding.emptyText.visibility = View.VISIBLE
|
||||||
|
// mBinding.emptyText.text = "紧急开发中"
|
||||||
|
// mBinding.viewPager.visibility = View.GONE
|
||||||
|
// mBinding.layoutNoWatch.visibility = View.GONE
|
||||||
|
// stopAutoPlay()
|
||||||
|
// } else {
|
||||||
|
// if (!DataStoreManager.isLogin()) {
|
||||||
|
// showLoginEmpty()
|
||||||
|
// } else if (hasWatch) {
|
||||||
|
// mBinding.viewPager.visibility = View.VISIBLE
|
||||||
|
// mBinding.emptyText.visibility = View.GONE
|
||||||
|
// mBinding.layoutNoWatch.visibility = View.GONE
|
||||||
|
// startAutoPlay()
|
||||||
|
// } else {
|
||||||
|
// showNoWatchPlaceholder()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
val tabList: MutableList<TabItemBean> = mutableListOf()
|
||||||
|
(0..4).forEach { _ ->
|
||||||
|
tabList.add(TabItemBean())
|
||||||
|
}
|
||||||
|
mBinding.viewPager.init(fragment, tabList.toTypedArray(), this, 5)
|
||||||
|
startAutoPlay()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 启动自动轮播 */
|
||||||
|
fun startAutoPlay() {
|
||||||
|
autoPlayHandler.removeCallbacks(autoPlayRunnable)
|
||||||
|
autoPlayHandler.postDelayed(autoPlayRunnable, AUTO_PLAY_INTERVAL)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 停止自动轮播 */
|
||||||
|
fun stopAutoPlay() {
|
||||||
|
autoPlayHandler.removeCallbacks(autoPlayRunnable)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow()
|
||||||
|
// View 移除时停止轮播,防止内存泄漏
|
||||||
|
stopAutoPlay()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setWatchInfo(watchInfo: WatchInfoBean?) {
|
||||||
|
// if (tabIndex != 0) {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
if (watchInfo?.hasWatch == true) {
|
||||||
|
hasWatch = true
|
||||||
|
mBinding.viewPager.visibility = View.VISIBLE
|
||||||
|
mBinding.emptyText.visibility = View.GONE
|
||||||
|
mBinding.layoutNoWatch.visibility = View.GONE
|
||||||
|
mBinding.watchName.setTextColor(Color.parseColor("#14BEBE"))
|
||||||
|
mBinding.watchName.text = "监测工具编码:${watchInfo.watchNo}"
|
||||||
|
} else {
|
||||||
|
hasWatch = false
|
||||||
|
mBinding.watchName.setTextColor(Color.parseColor("#808080"))
|
||||||
|
mBinding.watchName.text = "监测工具编码:暂无信息"
|
||||||
|
mBinding.viewPager.visibility = View.GONE
|
||||||
|
showNoWatchPlaceholder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 展示未登录占位文字 */
|
||||||
|
private fun showLoginEmpty() {
|
||||||
|
mBinding.viewPager.visibility = View.GONE
|
||||||
|
mBinding.emptyText.visibility = View.VISIBLE
|
||||||
|
mBinding.emptyText.text = "暂未登录"
|
||||||
|
mBinding.layoutNoWatch.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 展示已登录但未绑定手表的图文占位视图 */
|
||||||
|
private fun showNoWatchPlaceholder() {
|
||||||
|
mBinding.viewPager.visibility = View.GONE
|
||||||
|
mBinding.emptyText.visibility = View.GONE
|
||||||
|
mBinding.layoutNoWatch.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收手表详细数据并通过 EventBus 通知各 WatchItemFragment 刷新
|
||||||
|
* @param dataList 接口返回的手表各项健康数据列表(索引与 Tab position 对应)
|
||||||
|
*/
|
||||||
|
fun setWatchAllData(dataList: MutableList<HomeWatchAllDataBean>?) {
|
||||||
|
EventBus.getDefault().post(WatchDataChangeEvent().apply {
|
||||||
|
this.dataList = dataList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createFragment(position: Int): Fragment {
|
||||||
|
return WatchItemFragment.newInstance(position)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.xjjk.healthyclients.view
|
||||||
|
|
||||||
|
import android.app.AlertDialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.WindowManager
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.sw.healthyclients.data.local.DataStoreManager
|
||||||
|
import com.sw.healthyclients.view.CustomToast
|
||||||
|
import com.xjjk.healthyclients.R
|
||||||
|
import com.xjjk.healthyclients.databinding.DialogBindWatchBinding
|
||||||
|
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||||
|
|
||||||
|
class WatchBindDialog(context: Context, var listener: (String,Int) -> Unit) : AlertDialog(context) {
|
||||||
|
lateinit var binding: DialogBindWatchBinding
|
||||||
|
private var type = 0 // 0 绑定 1 解绑
|
||||||
|
|
||||||
|
init {
|
||||||
|
create()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
R.layout.dialog_bind_watch, null, false
|
||||||
|
)
|
||||||
|
setContentView(binding.root)
|
||||||
|
window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))//设置dialog背景透明
|
||||||
|
window?.setGravity(Gravity.BOTTOM)
|
||||||
|
window?.setLayout(
|
||||||
|
context.resources.displayMetrics.widthPixels,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
);//设置对话框大小
|
||||||
|
window?.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
|
||||||
|
setCanceledOnTouchOutside(true)
|
||||||
|
binding.confirm.setOnClickListener {
|
||||||
|
if (binding.etWatchid.text.toString().isEmpty()) {
|
||||||
|
CustomToast.makeText(context, "请输入序列号", Toast.LENGTH_SHORT).show()
|
||||||
|
} else {
|
||||||
|
listener.invoke(binding.etWatchid.text.toString(),type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.btnClose.setOnClickListener {
|
||||||
|
this.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun showWatchInfo(watchId: String? = null) {
|
||||||
|
show()
|
||||||
|
binding.etUserid.setText(DataStoreManager.getUserInfo().workNo)
|
||||||
|
binding.etUsername.setText(DataStoreManager.getUserInfo().realname)
|
||||||
|
binding.etWatchid.setText(watchId.orEmptyDefault(""))
|
||||||
|
if (TextUtils.isEmpty(watchId)) {
|
||||||
|
binding.etWatchid.isEnabled = true
|
||||||
|
binding.confirm.setText("绑定")
|
||||||
|
// type = 0
|
||||||
|
} else {
|
||||||
|
binding.etWatchid.isEnabled = false
|
||||||
|
binding.confirm.isEnabled = false
|
||||||
|
binding.confirm.alpha = 0.3F
|
||||||
|
// binding.confirm.setText("解绑")
|
||||||
|
// type = 1
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:color="@color/text_black_33" android:state_selected="true" />
|
|
||||||
<item android:color="#77849E" android:state_selected="false"/>
|
|
||||||
<item android:color="#77849E"/>
|
|
||||||
</selector>
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="@color/theme_color" android:state_selected="true" />
|
||||||
|
<item android:color="@color/text_black_60" />
|
||||||
|
</selector>
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:color="#117474" android:state_selected="true" />
|
|
||||||
<item android:color="#83CDCD" android:state_selected="false"/>
|
|
||||||
<item android:color="#83CDCD"/>
|
|
||||||
</selector>
|
|
||||||
|
After Width: | Height: | Size: 633 B |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
@@ -4,5 +4,5 @@
|
|||||||
<item android:drawable="@drawable/rectangle_round_corner20_theme" android:state_checked="true"/>
|
<item android:drawable="@drawable/rectangle_round_corner20_theme" android:state_checked="true"/>
|
||||||
<item android:drawable="@drawable/rectangle_round_corner20_theme" android:state_selected="true"/>
|
<item android:drawable="@drawable/rectangle_round_corner20_theme" android:state_selected="true"/>
|
||||||
<!-- 默认状态-->
|
<!-- 默认状态-->
|
||||||
<item android:drawable="@drawable/rectangle_round_corner20_white"/>
|
<item android:drawable="@drawable/rectangle_round_corner20_white_home"/>
|
||||||
</selector>
|
</selector>
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<!-- 选中状态-->
|
|
||||||
<item android:drawable="@drawable/bg_white_background_shap" android:state_checked="true"/>
|
|
||||||
<item android:drawable="@drawable/bg_white_background_shap" android:state_selected="true"/>
|
|
||||||
<!-- 默认状态-->
|
|
||||||
<item android:drawable="@drawable/bg_action_grey_radius5"/>
|
|
||||||
</selector>
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- 选中状态-->
|
||||||
|
<item android:drawable="@color/theme_color" android:state_checked="true"/>
|
||||||
|
<item android:drawable="@color/theme_color" android:state_selected="true"/>
|
||||||
|
<!-- 默认状态-->
|
||||||
|
<item android:drawable="@color/text_black_60"/>
|
||||||
|
</selector>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- 选中状态-->
|
||||||
|
<item android:drawable="@drawable/bg_theme_background_shape3" android:state_checked="true"/>
|
||||||
|
<item android:drawable="@drawable/bg_theme_background_shape3" android:state_selected="true"/>
|
||||||
|
<!-- 默认状态-->
|
||||||
|
<item android:drawable="@color/colorWhite"/>
|
||||||
|
</selector>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#1A2EB8B2" />
|
||||||
|
<corners android:radius="4dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#1A77859E" />
|
||||||
|
<corners android:radius="4dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="@color/emergency_close_bg" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/emergency_primary" />
|
||||||
|
<corners android:radius="12dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@android:color/white" />
|
||||||
|
<corners android:radius="12dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/emergency_card_selected_bg" />
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="@color/emergency_card_selected_border" />
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@android:color/white" />
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="@color/emergency_card_unselected_border" />
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 渐变下划线装饰:白色 → 主题青色,用于医疗意见章节标题下方 -->
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:startColor="#FFFFFF"
|
||||||
|
android:endColor="#2EB8B2"
|
||||||
|
android:angle="0" />
|
||||||
|
<size android:height="2dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 渐变下划线装饰:白色 → 主题青色,用于医疗意见章节标题下方 -->
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:startColor="#2EB8B2"
|
||||||
|
android:endColor="#FFFFFF"
|
||||||
|
android:angle="0" />
|
||||||
|
<size android:height="2dp" />
|
||||||
|
</shape>
|
||||||