Compare commits
61
Commits
aa827ba25d
..
master
| 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 | ||
|
|
ca0e318bd0 | ||
|
|
ca2bff5149 | ||
|
|
e862ea6a1a | ||
|
|
d4b540e588 | ||
|
|
932ab56ce3 | ||
|
|
ebb187e30f | ||
|
|
3b4b54d7e4 | ||
|
|
b270260707 | ||
|
|
b38ea562ba | ||
|
|
b602a61636 | ||
|
|
38e50f2264 | ||
|
|
b0f7576221 | ||
|
|
89017139cb | ||
|
|
e30121c1ce | ||
|
|
f2026f63d6 | ||
|
|
cb29fd5678 | ||
|
|
cf849ecfcf | ||
|
|
7907cb65f3 | ||
|
|
b29c4bc9cc |
+8
-9
@@ -54,13 +54,13 @@ android {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
// android.applicationVariants.all { variant ->
|
||||
// variant.outputs.all { output ->
|
||||
// def sourceFile = "app-release"
|
||||
// def replaceFile = "app-yixiong_v${defaultConfig.versionName}"
|
||||
// outputFileName = output.outputFile.name.replace(sourceFile, replaceFile)
|
||||
// }
|
||||
// }
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
def sourceFile = "app-release"
|
||||
def replaceFile = "app-xinjiang_user_v${defaultConfig.versionName}"
|
||||
outputFileName = output.outputFile.name.replace(sourceFile, replaceFile)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -89,7 +89,6 @@ android {
|
||||
main {
|
||||
jniLibs.srcDirs = ['libs']
|
||||
res.srcDirs = [
|
||||
'src/main/res-login',
|
||||
'src/main/res-health-check',
|
||||
'src/main/res-health-record',
|
||||
// 'src/main/res-intervention',
|
||||
@@ -138,5 +137,5 @@ dependencies {
|
||||
//JSoup
|
||||
api 'org.jsoup:jsoup:1.12.1'
|
||||
|
||||
|
||||
implementation 'com.tencent.mm.opensdk:wechat-sdk-android:+'
|
||||
}
|
||||
@@ -61,11 +61,11 @@
|
||||
android:name=".MyApplication"
|
||||
android:allowBackup="false"
|
||||
android:allowNativeHeapPointerTagging="false"
|
||||
android:icon="@drawable/ic_icon"
|
||||
android:icon="@drawable/ic_icon3"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:resizeableActivity="false"
|
||||
android:roundIcon="@drawable/ic_icon"
|
||||
android:roundIcon="@drawable/ic_icon3"
|
||||
android:supportsRtl="true"
|
||||
android:taskAffinity="com.xjjk.healthyclients"
|
||||
android:theme="@style/Theme.HearthyClients"
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
<meta-data
|
||||
android:name="com.amap.api.v2.apikey"
|
||||
android:value="0771c9b6ed759235927c3738ff4c070b" />
|
||||
android:value="c9972a2b09fbbdef0eb8075418bc1dab" />
|
||||
<!--高德定位服务-->
|
||||
<service android:name="com.amap.api.location.APSService" />
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.WebActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
<activity
|
||||
android:name=".ui.activity.UserInfoSettingActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@@ -127,18 +127,9 @@
|
||||
<activity
|
||||
android:name=".ui.activity.guidance.AppointmentDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.guidance.DoctorsGuidanceActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.guidance.DoctorHomepageActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.guidance.FilterSearchDoctorActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.guidance.SeekDoctorSearchActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.guidance.SelectConsultantActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@@ -163,9 +154,6 @@
|
||||
<activity
|
||||
android:name=".ui.activity.emergency.EmergencySeekDoctorDetailsActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.emergency.AddBigDiseaseActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.guidance.GeneralPracticeGuidanceActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@@ -193,8 +181,25 @@
|
||||
<activity
|
||||
android:name=".ui.activity.guidance.IMSelectArchivesActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name="com.sw.healthyclients.ui.guidance.ViewLocationActivity" />
|
||||
|
||||
<activity
|
||||
android:name="com.sw.healthyclients.ui.guidance.ViewLocationActivity"
|
||||
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>
|
||||
|
||||
</manifest>
|
||||
@@ -9,6 +9,12 @@
|
||||
"tabs": [
|
||||
{
|
||||
"tabName": "首页",
|
||||
"tabTag": "key_home_fragment",
|
||||
"iconNormal": "main_home_tab_home_normal",
|
||||
"iconSelected": "main_home_tab_home_selected"
|
||||
},
|
||||
{
|
||||
"tabName": "咨询",
|
||||
"tabTag": "key_guidance_fragment",
|
||||
"iconNormal": "main_home_tab_index_normal",
|
||||
"iconSelected": "main_home_tab_index_selected"
|
||||
|
||||
@@ -9,7 +9,9 @@ import com.tencent.qcloud.tuicore.util.ToastUtil
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIGroupChatActivity
|
||||
import com.xjjk.healthyclients.MyApplication.Companion.appContext
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||
import com.xjjk.healthyclients.bean.AppUpdateBean
|
||||
import com.xjjk.healthyclients.bean.im.IMInfoBean
|
||||
import com.xjjk.healthyclients.data.repository.CommonRepository
|
||||
import com.xjjk.healthyclients.data.repository.GuidanceRepository
|
||||
import com.xjjk.healthyclients.data.repository.IMRepository
|
||||
import com.xjjk.healthyclients.event.AppraiseFinishEvent
|
||||
@@ -33,6 +35,8 @@ class AppViewModel: BaseViewModel() {
|
||||
var imUserId = MutableStateFlow("")
|
||||
var imAppId = MutableStateFlow("")
|
||||
var userHaveWatch = MutableSharedFlow<Boolean?>()
|
||||
var mAppUpdateBean = MutableStateFlow<AppUpdateBean?>(null)
|
||||
|
||||
override fun init() {
|
||||
}
|
||||
fun getIMSig(successCall: (IMInfoBean) -> Unit = {}){
|
||||
@@ -114,5 +118,17 @@ class AppViewModel: BaseViewModel() {
|
||||
})
|
||||
}
|
||||
|
||||
fun getAppVersionInfo() {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
CommonRepository.getAppUpdateInfo(),
|
||||
successBlock = {
|
||||
mAppUpdateBean.emit(it.result)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
@@ -19,25 +20,35 @@ import com.permissionx.guolindev.PermissionX
|
||||
import com.sw.healthyclients.data.local.DataStoreManager
|
||||
import com.sw.healthyclients.utils.CustomActivityManager
|
||||
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.tuikit.tuichat.TUIChatService
|
||||
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.bean.CardInfoBean
|
||||
import com.xjjk.healthyclients.bottomtab.HomeBottomTabLayout
|
||||
import com.xjjk.healthyclients.databinding.ActivityMainBinding
|
||||
import com.xjjk.healthyclients.event.HomeTabChangeEvent
|
||||
import com.xjjk.healthyclients.event.RefreshEvent
|
||||
import com.xjjk.healthyclients.event.UserNoticeBean
|
||||
import com.xjjk.healthyclients.fragment.EmergencyFragment
|
||||
import com.xjjk.healthyclients.fragment.GuidanceFragment
|
||||
import com.xjjk.healthyclients.fragment.HomeFragment
|
||||
import com.xjjk.healthyclients.fragment.MonitorFragment
|
||||
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||
import com.xjjk.healthyclients.superfuntion.loginIm
|
||||
import com.xjjk.healthyclients.superfuntion.startAllDoctorActivity
|
||||
import com.xjjk.healthyclients.superfuntion.startLoginActivity
|
||||
import com.xjjk.healthyclients.ui.viewmodel.MainViewModel
|
||||
import com.xjjk.healthyclients.utils.ConstantUtils
|
||||
import com.xjjk.healthyclients.utils.LocationManager
|
||||
import com.xjjk.healthyclients.utils.SystemUtils
|
||||
import com.xjjk.healthyclients.view.FuntionBlurbDialog
|
||||
import com.xjjk.healthyclients.view.PrivacyDialog
|
||||
import com.xjjk.healthyclients.view.TextViewDialog
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
@@ -50,6 +61,7 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
HomeBottomTabLayout.HomeBottomTabLayoutCallback {
|
||||
|
||||
//每个tab对应的tag,和json配置文件中保持一致
|
||||
val TAG_HOME = "key_home_fragment"
|
||||
val TAG_GUIDANCE = "key_guidance_fragment"
|
||||
val TAG_EMERGENCY = "key_emergency_fragment"
|
||||
val TAG_MONITOR = "key_monitor_fragment"
|
||||
@@ -67,14 +79,45 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
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?) {
|
||||
if (!SystemUtils.isSignedWithReleaseCert(mContext)) {
|
||||
UpdateBuilder.create()
|
||||
.check()// 启动更新任务
|
||||
} else {
|
||||
// mViewModel.getAppVersionInfo()
|
||||
}
|
||||
UpdateBuilder.create().check()// 启动更新任务
|
||||
mBinding.apply {
|
||||
//设置回调
|
||||
mainTabLayout.setHomeBottomTabLayoutCallback(this@MainActivity)
|
||||
@@ -85,9 +128,9 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
// main_tab_layout.setUnreadTip(TAG_INDEX, "99+")
|
||||
// main_tab_layout.setUnreadTip(TAG_COLLECT, null, false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun initData() {
|
||||
// if(DataStoreManager.isLogin()){
|
||||
// getAppViewModel().getIMSig(successCall = {
|
||||
@@ -163,9 +206,9 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
if (overdue) {
|
||||
ConstantUtils.mCheckToken = true
|
||||
EventBus.getDefault().post(RefreshEvent())
|
||||
if (DataStoreManager.getToken().isNotEmpty()) {
|
||||
mViewModel.getNoticeData()
|
||||
}
|
||||
// if (DataStoreManager.getToken().isNotEmpty()) {
|
||||
// mViewModel.getNoticeData()
|
||||
// }
|
||||
if (DataStoreManager.isLogin()) {
|
||||
MyApplication.appViewModel?.getIMSig(successCall = {
|
||||
loginIm(it.userId, it.userSig)
|
||||
@@ -179,25 +222,25 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
}
|
||||
}
|
||||
//用户弹窗
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.noticeBean.collectLatest { bean ->
|
||||
if (bean.title.isNotEmpty() && bean.content.isNotEmpty()) {
|
||||
showBlurbDialog(bean)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// lifecycleScope.launch {
|
||||
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
// mViewModel.noticeBean.collectLatest { bean ->
|
||||
// if (bean.title.isNotEmpty() && bean.content.isNotEmpty()) {
|
||||
// showBlurbDialog(bean)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//用户弹窗-结果提交
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.submitNoticeChooseResult.collectLatest { success ->
|
||||
if (success) {
|
||||
mFunctionBlurbDialog?.cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// lifecycleScope.launch {
|
||||
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
// mViewModel.submitNoticeChooseResult.collectLatest { success ->
|
||||
// if (success) {
|
||||
// mFunctionBlurbDialog?.cancel()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//用户弹窗-结果提交
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
@@ -249,6 +292,26 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
}
|
||||
}
|
||||
|
||||
//全科医生校验
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.cardInfoString.collectLatest {
|
||||
if (it.type == 0) {//卡片未过期
|
||||
val bundle = Bundle()
|
||||
bundle.putString("doctorId", mIMChatEvent?.getDoctor())
|
||||
TUICore.startActivity(
|
||||
TUIChatService.getAppContext(),
|
||||
"DoctorHomepageActivity",
|
||||
bundle
|
||||
)
|
||||
} else {
|
||||
CustomToast.makeText(CustomActivityManager.getInstance().currentActivity(),it.msg,Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
@@ -256,15 +319,12 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(Bundle())
|
||||
}
|
||||
|
||||
override fun getFragmentByTag(tabTag: String): Fragment? {
|
||||
when (tabTag) {
|
||||
// TAG_GUIDANCE -> {
|
||||
// return HomeFragment()
|
||||
// }
|
||||
TAG_HOME -> {
|
||||
return HomeFragment()
|
||||
}
|
||||
|
||||
TAG_GUIDANCE -> {
|
||||
return GuidanceFragment()
|
||||
@@ -297,6 +357,11 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
return null
|
||||
}
|
||||
|
||||
fun changeTab(index: Int) {
|
||||
mBinding.mainTabLayout.changeTab(index)
|
||||
}
|
||||
|
||||
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
@@ -321,7 +386,7 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
// }
|
||||
// }
|
||||
}
|
||||
private val mFunctionBlurbDialog : FuntionBlurbDialog by lazy { FuntionBlurbDialog(this@MainActivity) }
|
||||
// private val mFunctionBlurbDialog : FuntionBlurbDialog by lazy { FuntionBlurbDialog(this@MainActivity) }
|
||||
|
||||
private var isExit = false
|
||||
var mHandler: Handler = @SuppressLint("HandlerLeak")
|
||||
@@ -351,17 +416,17 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
}
|
||||
return super.onKeyDown(keyCode, event)
|
||||
}
|
||||
private fun showBlurbDialog(bean: UserNoticeBean) {
|
||||
mFunctionBlurbDialog?.setTitle(bean.title)
|
||||
mFunctionBlurbDialog?.setContent(bean.content)
|
||||
mFunctionBlurbDialog?.setOnAffirmClickListener(object :
|
||||
FuntionBlurbDialog.OnAffirmClickListener {
|
||||
override fun onAffirmClick(type: Int, viewDialog: FuntionBlurbDialog) {
|
||||
mViewModel.submitNoticeChooseItem(bean.id, type)
|
||||
}
|
||||
})
|
||||
mFunctionBlurbDialog?.show()
|
||||
}
|
||||
// private fun showBlurbDialog(bean: UserNoticeBean) {
|
||||
// mFunctionBlurbDialog?.setTitle(bean.title)
|
||||
// mFunctionBlurbDialog?.setContent(bean.content)
|
||||
// mFunctionBlurbDialog?.setOnAffirmClickListener(object :
|
||||
// FuntionBlurbDialog.OnAffirmClickListener {
|
||||
// override fun onAffirmClick(type: Int, viewDialog: FuntionBlurbDialog) {
|
||||
// mViewModel.submitNoticeChooseItem(bean.id, type)
|
||||
// }
|
||||
// })
|
||||
// mFunctionBlurbDialog?.show()
|
||||
// }
|
||||
|
||||
|
||||
override fun onMessageEvent(event: Any?) {
|
||||
@@ -372,7 +437,14 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
if (event.getType()==0) {
|
||||
mIMChatEvent=event
|
||||
mViewModel.initIMDialog()
|
||||
mViewModel.selectDoctorCardExpireTime(event.time)
|
||||
mViewModel.postCardInfo(
|
||||
CardInfoBean(
|
||||
event.fromAccount,
|
||||
event.groupId,
|
||||
event.msgId,
|
||||
DataStoreManager.getUserId()
|
||||
)
|
||||
)
|
||||
}else if (event.getType()==1){
|
||||
if (event.message.isNotEmpty()) {
|
||||
CustomToast.makeText(CustomActivityManager.getInstance().TopActivity(), event.message, Toast.LENGTH_SHORT).show()
|
||||
@@ -383,6 +455,10 @@ class MainActivity : BaseVMBActivity<MainViewModel, ActivityMainBinding>(R.layou
|
||||
mViewModel.selectTfHelper(event.doctor)
|
||||
println("头像id"+doctorId)
|
||||
}
|
||||
}else if (event is HomeTabChangeEvent) {
|
||||
if (event.index >= 0){
|
||||
changeTab(event.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
@@ -12,8 +12,6 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelStore
|
||||
import androidx.lifecycle.ViewModelStoreOwner
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
import com.lzy.ninegrid.NineGridView
|
||||
import com.orhanobut.logger.AndroidLogAdapter
|
||||
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.CustomUpdateNotifier
|
||||
import com.xjjk.healthyclients.view.AppraiseDialog
|
||||
import okhttp3.OkHttpClient
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.lzh.framework.updatepluginlib.UpdateConfig
|
||||
@@ -75,7 +72,8 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
||||
Log.i(TAG, "onCreate")
|
||||
super.onCreate()
|
||||
ConstantUtils.mIsCloseDialog=true
|
||||
LocationMessageHolder.mapKey = "a87b89a2b4a32ed31da04d0996035cc1"
|
||||
// LocationMessageHolder.mapKey = "a87b89a2b4a32ed31da04d0996035cc1"
|
||||
LocationMessageHolder.mapKey = "e9926badd26aaa766d13439c88a83f2d"
|
||||
Logger.addLogAdapter(AndroidLogAdapter())
|
||||
appContext = this
|
||||
DownloadFileUtil.init(this)
|
||||
@@ -98,9 +96,6 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
||||
registerActivityLifecycleCallbacks(AdjustLifecycleCallbacks())
|
||||
val androidId = DevicesInfoUtils.getAndroidId(this)
|
||||
println("设备id:${androidId}")
|
||||
if (UrlConfig.testDeviceList.contains(androidId)) {
|
||||
UrlConfig.isTestDevice = true
|
||||
}
|
||||
}
|
||||
|
||||
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.bean.CvdMainBean
|
||||
import com.xjjk.healthyclients.databinding.ItemCvdMainBinding
|
||||
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||
|
||||
class CvdMainAdapter :
|
||||
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.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 mRootView:RelativeLayout?=null
|
||||
|
||||
/**
|
||||
* 重写getResources()方法,让APP的字体不受系统设置字体大小影响
|
||||
*/
|
||||
override fun getResources(): Resources? {
|
||||
val config = Configuration()
|
||||
config.setToDefaults()
|
||||
createConfigurationContext(config)
|
||||
return super.getResources()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@@ -22,8 +22,8 @@ import com.orhanobut.logger.Logger
|
||||
import com.sw.healthyclients.utils.StatusbarUtil
|
||||
import com.sw.healthyclients.view.CustomToast
|
||||
import com.sw.healthyclients.view.LoadingDialog
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.BR
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel.Companion.LOADING_STATE_HIDE
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel.Companion.LOADING_STATE_SHOW
|
||||
@@ -51,20 +51,26 @@ import java.sql.SQLException
|
||||
abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private val contentViewResId: Int) :
|
||||
Fragment(), View.OnClickListener {
|
||||
var mRootView: RelativeLayout? = null
|
||||
|
||||
/** 是否第一次加载 */
|
||||
private var mIsFirstLoading = true
|
||||
var dialog: LoadingDialog? = null
|
||||
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 mIsVisible: Boolean=false
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
mBinding = DataBindingUtil.inflate(inflater, contentViewResId, container, false)
|
||||
return mBinding.root
|
||||
_mBinding = DataBindingUtil.inflate(inflater, contentViewResId, container, false)
|
||||
return _mBinding!!.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
@@ -137,7 +143,10 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
findViewById<TextView>(R.id.tv_empty).text = "暂无数据"
|
||||
}
|
||||
var layoutParams =
|
||||
RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)
|
||||
RelativeLayout.LayoutParams(
|
||||
RelativeLayout.LayoutParams.MATCH_PARENT,
|
||||
RelativeLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
layoutParams.addRule(RelativeLayout.BELOW, R.id.toolbar_lay)
|
||||
mEmpty?.layoutParams = layoutParams
|
||||
}
|
||||
@@ -167,31 +176,22 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是透明状态栏
|
||||
*/
|
||||
open fun transparentStatusBar(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
mIsVisible=isVisible()
|
||||
if (lifecycle.currentState == Lifecycle.State.STARTED && mIsFirstLoading) {
|
||||
lazyLoadData()
|
||||
mIsFirstLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
super.onHiddenChanged(hidden)
|
||||
mIsVisible=!hidden
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
mIsVisible=false
|
||||
}
|
||||
|
||||
fun addClickViews(vararg views: View) {
|
||||
for (view in views) {
|
||||
view.setOnClickListener(this)
|
||||
@@ -253,14 +253,17 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
requireContext(),
|
||||
getString(R.string.network_error), Toast.LENGTH_SHORT
|
||||
).show()
|
||||
|
||||
is IOException, is SQLException ->
|
||||
CustomToast.makeText(
|
||||
requireContext(),
|
||||
getString(R.string.response_error), Toast.LENGTH_SHORT
|
||||
).show()
|
||||
|
||||
is WindowManager.BadTokenException -> {
|
||||
|
||||
}
|
||||
|
||||
else ->
|
||||
CustomToast.makeText(
|
||||
requireContext(),
|
||||
@@ -283,17 +286,14 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
|
||||
else -> {
|
||||
it?.message?.run {
|
||||
if (mIsVisible) {
|
||||
CustomToast.makeText(
|
||||
requireContext(),
|
||||
this ?: getString(R.string.response_error),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
|
||||
}
|
||||
it?.msg?.run {
|
||||
if (mIsVisible) {
|
||||
CustomToast.makeText(
|
||||
requireContext(),
|
||||
this ?: getString(R.string.response_error),
|
||||
@@ -305,7 +305,6 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 提供一个请求错误的方法,用于像关闭加载框之类的 */
|
||||
open fun requestError(msg: String? = null) {
|
||||
@@ -313,13 +312,15 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
mBinding == null
|
||||
super.onDestroyView()
|
||||
// 置 null 释放 View 引用,防止 Fragment 回退栈期间内存泄漏
|
||||
_mBinding = null
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (!EventBus.getDefault().isRegistered(this)) {
|
||||
// 已注册才执行注销,避免 EventBus 持有 Fragment 引用
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
}
|
||||
@@ -337,14 +338,12 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
protected abstract fun bindEvent()
|
||||
fun showToast(message: String?) {
|
||||
if (message != null && message.isNotEmpty()) {
|
||||
if (this.mIsVisible) {
|
||||
try {
|
||||
CustomToast.makeText(requireContext(), message, Toast.LENGTH_SHORT).show()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun toActivity(clazz: Class<*>?) {
|
||||
val intent = Intent(activity, clazz)
|
||||
@@ -359,12 +358,6 @@ abstract class BaseVMBFragment<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
activity?.startActivity(intent)
|
||||
}
|
||||
|
||||
/**
|
||||
* 历史遗留方法,懒得改以前的了,新页面无视即可
|
||||
*/
|
||||
open fun getStatusbarStyle(): Int{
|
||||
return 0
|
||||
} // 0 主题色+白字 1白底黑字
|
||||
|
||||
private fun createDialog() {
|
||||
dialog = LoadingDialog(
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xjjk.healthyclients.bean
|
||||
|
||||
|
||||
data class CardInfoBean(
|
||||
val fromAccount: String,
|
||||
val groupId: String,
|
||||
val msgId: String,
|
||||
val toAccount: String?
|
||||
)
|
||||
|
||||
data class CardMessageReadLog(
|
||||
val type: Int,
|
||||
val msg: String?
|
||||
)
|
||||
@@ -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
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,5 @@
|
||||
package com.xjjk.healthyclients.bean.emergency
|
||||
|
||||
data class EmergencyBean(
|
||||
val dicts: MutableList<EmergencyDictBean>?,
|
||||
val resources: MutableList<LocationResourceBean>?,
|
||||
val sessionId: String?
|
||||
)
|
||||
@@ -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
|
||||
)
|
||||
@@ -20,7 +20,8 @@ data class LocationResourceBean(
|
||||
val level_dictText: String = "",
|
||||
val longitude: Double = 0.0,
|
||||
val memo: Any = "",
|
||||
val mobile: String = "",
|
||||
val mobile: String? = "",
|
||||
val managePhone: String = "",
|
||||
val name: String = "",
|
||||
val province: String = "",
|
||||
val resourceDesc: 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
|
||||
)
|
||||
@@ -103,6 +103,11 @@ interface CommonApi {
|
||||
*/
|
||||
@POST("/sys/mLogin")
|
||||
fun mLogin(@Body any: LoginBean): Call<JsonObject>
|
||||
/**
|
||||
* 安眼统一认证
|
||||
*/
|
||||
@POST("/sys/mLoginAnYan")
|
||||
fun mLoginAnYan(@Body any: LoginBean): Call<JsonObject>
|
||||
/**
|
||||
* 首页系统功能介绍弹窗-选择多少天不在提示
|
||||
*/
|
||||
@@ -126,5 +131,11 @@ interface CommonApi {
|
||||
@GET("health-consultation/api/consult/conHelper/selectHelperInfoDesc")
|
||||
suspend fun selectHelperInfoDesc(@QueryMap params: MutableMap<String, Any?>): ApiResponse<IMDoctorInfoBean>
|
||||
|
||||
/**
|
||||
* 医生卡片校验
|
||||
*/
|
||||
@POST("health-consultation/con-message/saveReadLog")
|
||||
suspend fun postCardInfo(@Body info: RequestBody): ApiResponse<String>
|
||||
|
||||
|
||||
}
|
||||
@@ -1,14 +1,20 @@
|
||||
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.BigDiseaseDetailsBean
|
||||
import com.xjjk.healthyclients.bean.emergency.EmergencyBean
|
||||
import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo
|
||||
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.LocationResourceBean
|
||||
import com.xjjk.healthyclients.bean.emergency.OrderThroughBean
|
||||
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.PageBean
|
||||
import okhttp3.RequestBody
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
@@ -20,7 +26,7 @@ interface EmergencyApi {
|
||||
* 应急首页数据获取
|
||||
*/
|
||||
@GET("/health-emergency/api/emergency/resource/home")
|
||||
suspend fun getEmergencyData(@QueryMap params: MutableMap<String, Any?>): ApiResponse<EmergencyBean>
|
||||
suspend fun getEmergencyData(@QueryMap params: MutableMap<String, Any?>): ApiResponse<MutableList<LocationResourceBean>>
|
||||
|
||||
/**
|
||||
* 大病就医列表
|
||||
@@ -82,5 +88,51 @@ interface EmergencyApi {
|
||||
*/
|
||||
@GET("/health-emergency/api/emergency/createGroupMag")
|
||||
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
|
||||
|
||||
import com.xjjk.healthyclients.bean.CvdMainBean
|
||||
import com.xjjk.healthyclients.bean.CvdRiskInfoBean
|
||||
import com.xjjk.healthyclients.bean.CvdMainBeanNew
|
||||
import com.xjjk.healthyclients.bean.CvdWarningHistoryBean
|
||||
import com.xjjk.healthyclients.retrofit.intervention.CustomInterventionResponseResult
|
||||
import retrofit2.Call
|
||||
@@ -203,8 +202,10 @@ interface HealthCheckNetApi {
|
||||
/**
|
||||
* 查询心血管首页数据
|
||||
*/
|
||||
@GET("health-watch/watchH5Api/indexDataNew")
|
||||
fun getCvdHomeData(@Query("userId") userId: String): Call<CustomInterventionResponseResult<CvdMainBean>>
|
||||
// @GET("health-watch/watchH5Api/indexDataNew")
|
||||
// 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
|
||||
)
|
||||
@@ -2,6 +2,7 @@ package com.xjjk.healthyclients.data.repository
|
||||
import com.sw.healthyclients.utils.FileUtils
|
||||
import com.xjjk.healthyclients.BuildConfig
|
||||
import com.xjjk.healthyclients.bean.AppUpdateBean
|
||||
import com.xjjk.healthyclients.bean.CardInfoBean
|
||||
import com.xjjk.healthyclients.bean.CommonSettingMenuBean
|
||||
import com.xjjk.healthyclients.bean.SelectUserInfoBean
|
||||
import com.xjjk.healthyclients.bean.SelectUserMessageListBean
|
||||
@@ -13,6 +14,7 @@ import com.xjjk.healthyclients.data.bean.ApiResponse
|
||||
import com.xjjk.healthyclients.data.repository.EmergencyRepository.apiCall
|
||||
import com.xjjk.healthyclients.event.UserNoticeBean
|
||||
import com.xjjk.healthyclients.retrofit.RetrofitManager
|
||||
import com.xjjk.healthyclients.retrofit.RetrofitManager.toRequestBody
|
||||
import com.xjjk.healthyclients.superfuntion.toJson
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.MultipartBody
|
||||
@@ -191,6 +193,14 @@ object CommonRepository {
|
||||
service.selectHelperInfoDesc(map)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 医生卡片校验
|
||||
*/
|
||||
suspend fun postCardInfo(info: CardInfoBean): ApiResponse<String> {
|
||||
return apiCall {
|
||||
service.postCardInfo(info.toJson().toRequestBody())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,29 +1,39 @@
|
||||
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.bean.CommonSettingMenuBean
|
||||
import com.xjjk.healthyclients.bean.emergency.AddBigDiseaseSubmitBean
|
||||
import com.xjjk.healthyclients.bean.emergency.BigDiseaseBean
|
||||
import com.xjjk.healthyclients.bean.emergency.BigDiseaseDetailsBean
|
||||
import com.xjjk.healthyclients.bean.emergency.EmergencyBean
|
||||
import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo
|
||||
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.LocationResourceBean
|
||||
import com.xjjk.healthyclients.bean.emergency.OrderThroughBean
|
||||
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.bean.ApiResponse
|
||||
import com.xjjk.healthyclients.data.bean.PageBean
|
||||
import com.xjjk.healthyclients.retrofit.RetrofitManager
|
||||
import com.xjjk.healthyclients.retrofit.RetrofitManager.toRequestBody
|
||||
import com.xjjk.healthyclients.superfuntion.toJson
|
||||
|
||||
object EmergencyRepository : BaseRepository() {
|
||||
private val service by lazy { RetrofitManager.getService(EmergencyApi::class.java) }
|
||||
|
||||
/**
|
||||
* 1:油田医院 3:健康小屋 4:aed 5:救护车 不传则全部
|
||||
*/
|
||||
suspend fun getEmergencyData(
|
||||
type: String,
|
||||
latitude: Double,
|
||||
longitude: Double
|
||||
): ApiResponse<EmergencyBean> {
|
||||
): ApiResponse<MutableList<LocationResourceBean>> {
|
||||
val map = mutableMapOf<String, Any?>()
|
||||
map["type"] = type
|
||||
map["longitude"] = longitude
|
||||
@@ -103,8 +113,6 @@ object EmergencyRepository : BaseRepository() {
|
||||
return CommonRepository.getCommonSettingMenuList("category")
|
||||
}
|
||||
|
||||
|
||||
|
||||
suspend fun getIMGroupInfo(groupName: String, longitude: Double,
|
||||
latitude: Double): ApiResponse<EmergencyGroupInfo> {
|
||||
var map = mutableMapOf<String, Any?>()
|
||||
@@ -114,4 +122,68 @@ object EmergencyRepository : BaseRepository() {
|
||||
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
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Dialog
|
||||
import android.content.Intent
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Color
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.util.Consumer
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
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.AMapLocationClient
|
||||
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.MyLocationStyle
|
||||
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.classicui.interfaces.OnParamedicOperateListener
|
||||
import com.tencent.qcloud.tuikit.tuichat.presenter.ParamedicOperateHelper
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.base.BaseVMBFragment
|
||||
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.data.repository.EmergencyRepository
|
||||
import com.xjjk.healthyclients.databinding.DialogGroupInfoListBinding
|
||||
import com.xjjk.healthyclients.databinding.FragmentEmergencyBinding
|
||||
import com.xjjk.healthyclients.fragment.adapter.GroupInfoAdapter
|
||||
import com.xjjk.healthyclients.superfuntion.getMarkerInfo
|
||||
import com.xjjk.healthyclients.superfuntion.startGroupChat
|
||||
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.SystemFuntion.goNavigation
|
||||
import com.xjjk.healthyclients.utils.TUIUtils
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
|
||||
|
||||
/**
|
||||
@@ -76,6 +98,100 @@ class EmergencyFragment :
|
||||
)
|
||||
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?) {
|
||||
// fitTransparentStatusBar(mBinding.tvTitle)
|
||||
MapsInitializer.updatePrivacyShow(context, true, true)
|
||||
@@ -88,6 +204,15 @@ class EmergencyFragment :
|
||||
PermissionX.init(this@EmergencyFragment)
|
||||
.permissions(mPermissionList)
|
||||
.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() {
|
||||
@@ -100,7 +225,7 @@ class EmergencyFragment :
|
||||
var mHeadType = mutableListOf<EmergencyDictBean>()
|
||||
// mHeadType.add(EmergencyDictBean("全部","全部","全部","0",true))
|
||||
mHeadType.add(EmergencyDictBean("油田医院", "油田医院", "油田医院", "1", true))
|
||||
mHeadType.add(EmergencyDictBean("合作医院","合作医院","合作医院","2",false))
|
||||
// mHeadType.add(EmergencyDictBean("合作医院","合作医院","合作医院","2",false))
|
||||
mHeadType.add(EmergencyDictBean("健康小屋", "健康小屋", "健康小屋", "3", false))
|
||||
mHeadType.add(EmergencyDictBean("AED", "AED", "AED", "4", false))
|
||||
mHeadType.add(EmergencyDictBean("救护车", "救护车", "救护车", "5", false))
|
||||
@@ -119,6 +244,8 @@ class EmergencyFragment :
|
||||
|
||||
// }
|
||||
}
|
||||
titleId = mHeadType[0].value
|
||||
mViewModel.getEmergencyData(mHeadType[0].value, mCurrentLat, mCurrentLon)
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
@@ -168,6 +295,7 @@ class EmergencyFragment :
|
||||
super.onResume()
|
||||
mMapView?.onResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
mMapView?.onPause()
|
||||
@@ -180,6 +308,10 @@ class EmergencyFragment :
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
// 主动停止并销毁定位客户端,防止 Fragment 销毁后 GPS 定位服务持续运行造成资源浪费
|
||||
mlocationClient?.stopLocation()
|
||||
mlocationClient?.onDestroy()
|
||||
mlocationClient = null
|
||||
mMapView?.onDestroy()
|
||||
}
|
||||
|
||||
@@ -223,6 +355,7 @@ class EmergencyFragment :
|
||||
fragmentEmergencyPhone.setOnClickListener(this@EmergencyFragment)
|
||||
fragmentEmergencyCardNavigation.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 -> {
|
||||
|
||||
}
|
||||
@@ -289,10 +441,6 @@ class EmergencyFragment :
|
||||
}
|
||||
}
|
||||
|
||||
override fun getStatusbarStyle(): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
override fun onLocationChanged(amapLocation: AMapLocation?) {
|
||||
if (mListener != null && 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>) {
|
||||
mAMap?.clear() //清除点位
|
||||
if (markerList.isNullOrEmpty()) {
|
||||
@@ -347,6 +579,15 @@ class EmergencyFragment :
|
||||
)
|
||||
mAMap?.addMarker(markerOption)
|
||||
}
|
||||
}
|
||||
|
||||
if (markerList.size == 1) {
|
||||
MapUtils.setMapZoonloAndZoom(
|
||||
mAMap,
|
||||
LatLng(markerList.get(0).latitude, markerList.get(0).longitude),
|
||||
11
|
||||
)
|
||||
} else {
|
||||
MapUtils.setMapZoonlo(mAMap, 200, ArrayList(newlist))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ 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.StatusbarUtil
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean
|
||||
import com.xjjk.healthyclients.R
|
||||
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)
|
||||
ivRight?.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() {
|
||||
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.viewmodel.TestViewModel
|
||||
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.HeartRateProvider
|
||||
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.intervention.CallbackInterventionManager
|
||||
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.InterventionWebActivity
|
||||
import com.xjjk.healthyclients.utils.ConstantUtils
|
||||
@@ -108,7 +109,6 @@ class MonitorFragment: BaseVMBFragment<TestViewModel, FragmentMonitorBinding>(R.
|
||||
mBinding.let {
|
||||
addClickViews(it.stepLayout, it.sleepLayout)
|
||||
|
||||
|
||||
}
|
||||
|
||||
// titleTextAdapter.setOnItemClickListener { adapter, view, position ->
|
||||
@@ -117,29 +117,29 @@ class MonitorFragment: BaseVMBFragment<TestViewModel, FragmentMonitorBinding>(R.
|
||||
|
||||
cvdMainAdapter.setOnItemClickListener { adapter, view, position ->
|
||||
var data = adapter.data[position] as CvdMainBean.dataBean
|
||||
when (position) {
|
||||
0 -> {
|
||||
when (data.wdType) {
|
||||
"heart_rate" -> {
|
||||
var bundle = Bundle()
|
||||
bundle.putString("path", "heartRate")
|
||||
bundle.putString("date", data.dataDate)
|
||||
toActivity(InterventionWebActivity::class.java, bundle)
|
||||
}
|
||||
|
||||
1 -> {
|
||||
"spo2" -> {
|
||||
var bundle = Bundle()
|
||||
bundle.putString("path", "oxygenSaturation")
|
||||
bundle.putString("date", data.dataDate)
|
||||
toActivity(InterventionWebActivity::class.java, bundle)
|
||||
}
|
||||
|
||||
2 -> {
|
||||
"stress" -> {
|
||||
var bundle = Bundle()
|
||||
bundle.putString("path", "pressure")
|
||||
bundle.putString("date", data.dataDate)
|
||||
toActivity(InterventionWebActivity::class.java, bundle)
|
||||
}
|
||||
|
||||
3 -> {
|
||||
"temperature" -> {
|
||||
var bundle = Bundle()
|
||||
bundle.putString("path", "temperature")
|
||||
bundle.putString("date", data.dataDate)
|
||||
@@ -198,51 +198,59 @@ class MonitorFragment: BaseVMBFragment<TestViewModel, FragmentMonitorBinding>(R.
|
||||
private fun getHomePageUserInfo() {
|
||||
dialog?.show()
|
||||
var getCvdHomeData = mApi.getCvdHomeData(mUserId)
|
||||
getCvdHomeData.enqueue(object : CallbackInterventionManager<CvdMainBean>() {
|
||||
getCvdHomeData.enqueue(object : CallbackInterventionManager<CvdMainBeanNew>() {
|
||||
|
||||
override fun onSuccess(
|
||||
code: Int,
|
||||
result: CvdMainBean?,
|
||||
result: CvdMainBeanNew?,
|
||||
message: String,
|
||||
ok: Boolean
|
||||
) {
|
||||
dialog?.dismiss()
|
||||
result?.let {
|
||||
|
||||
|
||||
mBinding.sleepValue2Tv.text =
|
||||
"平均睡眠${result.aveSleep.toInt() / 60}小时${result.aveSleep.toInt() % 60}分钟"
|
||||
mBinding.stepValue2Tv.text = "累计约步行${result.distance / 1000}公里"
|
||||
if (result.indexItemVos==null) {
|
||||
return@let
|
||||
}
|
||||
|
||||
var indexItemVos = result.indexItemVos
|
||||
|
||||
val iterator = indexItemVos.iterator()
|
||||
val iterator = indexItemVos!!.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val dataBean = iterator.next()
|
||||
if (dataBean.wdType.equals("sleep")) {
|
||||
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 =
|
||||
"${minutes?.div(60)?.toUInt()}"
|
||||
mBinding.sleepValueMinuteTv.text =
|
||||
"${minutes?.rem(60)?.toUInt()}"
|
||||
}
|
||||
iterator.remove()
|
||||
}
|
||||
if (dataBean.wdType.equals("steps")) {
|
||||
mBinding.stepDateTv.text = dataBean.dataDate
|
||||
mBinding.stepValueTv.text = "${dataBean.dataValue}"
|
||||
mBinding.stepValueTv.text = "${dataBean.dataValue.orEmptyDefault()}"
|
||||
|
||||
iterator.remove()
|
||||
}
|
||||
if (dataBean.wdType.equals(TYPE_HEART_RATE)) {
|
||||
if (!TextUtils.isEmpty(dataBean.warnMin) && !TextUtils.isEmpty(dataBean.warnMax)) {
|
||||
heartRateDefaultMin = "${dataBean.warnMin.toFloat().toInt()}次/分钟"
|
||||
heartRateDefaultMax = "${dataBean.warnMax.toFloat().toInt()}次/分钟"
|
||||
heartRateDefaultMin = "${dataBean.warnMin!!.toFloat().toInt()}次/分钟"
|
||||
heartRateDefaultMax = "${dataBean.warnMax!!.toFloat().toInt()}次/分钟"
|
||||
}
|
||||
}
|
||||
if (dataBean.wdType.equals(TYPE_SPO2)) {
|
||||
if (!TextUtils.isEmpty(dataBean.warnMin)) {
|
||||
spo2DefaultMin = dataBean.warnMin.toFloat().toInt()
|
||||
spo2DefaultMin = dataBean.warnMin!!.toFloat().toInt()
|
||||
}
|
||||
}
|
||||
if (dataBean.wdType.equals(TYPE_TEMPERATURE)) {
|
||||
@@ -253,7 +261,7 @@ class MonitorFragment: BaseVMBFragment<TestViewModel, FragmentMonitorBinding>(R.
|
||||
}
|
||||
if (dataBean.wdType.equals(TYPE_STRESS)) {
|
||||
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.startEmergencySeekDoctorActivity
|
||||
import com.xjjk.healthyclients.superfuntion.startLoginActivity
|
||||
import com.xjjk.healthyclients.superfuntion.startSimulateUserActivity
|
||||
import com.xjjk.healthyclients.superfuntion.startUserInfoSettingActivity
|
||||
import com.xjjk.healthyclients.superfuntion.startUserMyGuidanceActivity
|
||||
import com.xjjk.healthyclients.superfuntion.startUserSettingActivity
|
||||
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.utils.ConstantUtils
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
@@ -53,7 +55,8 @@ class UserInfoFragment :
|
||||
mList.clear()
|
||||
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(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 =
|
||||
@@ -72,7 +75,7 @@ class UserInfoFragment :
|
||||
if (mHits[0] >= (SystemClock.uptimeMillis() - time)) {
|
||||
//数组重新初始化
|
||||
mHits = LongArray(mCount)
|
||||
// startSimulateUserActivity(requireContext())
|
||||
startSimulateUserActivity(requireContext())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,6 +171,9 @@ class UserInfoFragment :
|
||||
3 -> {
|
||||
context?.let { startEmergencySeekDoctorActivity(it) }
|
||||
}
|
||||
4 -> {
|
||||
toActivity(HomeNoticeListActivity::class.java)
|
||||
}
|
||||
8 -> {
|
||||
requireContext().startUserSoSContactsActivity()
|
||||
}
|
||||
@@ -188,10 +194,6 @@ class UserInfoFragment :
|
||||
|
||||
}
|
||||
|
||||
override fun getStatusbarStyle(): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
when (v?.id) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,445 +0,0 @@
|
||||
package com.xjjk.healthyclients.imActivity;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.xjjk.healthyclients.R;
|
||||
import com.tencent.imsdk.BaseConstants;
|
||||
import com.tencent.imsdk.v2.V2TIMCallback;
|
||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||
import com.tencent.imsdk.v2.V2TIMConversationListFilter;
|
||||
import com.tencent.imsdk.v2.V2TIMConversationOperationResult;
|
||||
import com.tencent.imsdk.v2.V2TIMConversationResult;
|
||||
import com.tencent.imsdk.v2.V2TIMFriendApplication;
|
||||
import com.tencent.imsdk.v2.V2TIMFriendApplicationResult;
|
||||
import com.tencent.imsdk.v2.V2TIMFriendshipListener;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuicore.component.activities.BaseMinimalistLightActivity;
|
||||
import com.tencent.qcloud.tuicore.util.ErrorMessageConverter;
|
||||
import com.tencent.qcloud.tuicore.util.ToastUtil;
|
||||
import com.tencent.qcloud.tuikit.tuicontact.minimalistui.pages.TUIContactMinimalistFragment;
|
||||
import com.tencent.qcloud.tuikit.tuiconversation.minimalistui.page.ConversationMinimalistFragment;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MainMinimalistActivity extends BaseMinimalistLightActivity {
|
||||
|
||||
private static final String TAG = MainMinimalistActivity.class.getSimpleName();
|
||||
private TextView mConversationBtnText;
|
||||
private TextView mContactBtnText;
|
||||
private TextView mProfileSelfBtnText;
|
||||
private ImageView mConversationBtnIcon;
|
||||
private ImageView mContactBtnIcon;
|
||||
private ImageView mProfileSelfBtnIcon;
|
||||
private TextView mMsgUnread;
|
||||
private TextView mNewFriendUnread;
|
||||
|
||||
private ViewPager2 mainViewPager;
|
||||
private List<Fragment> fragments;
|
||||
|
||||
private HashMap<String, V2TIMConversation> markUnreadMap = new HashMap<>();
|
||||
|
||||
private static WeakReference<MainMinimalistActivity> instance;
|
||||
private BroadcastReceiver unreadCountReceiver;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
Log.i(TAG, "onCreate");
|
||||
super.onCreate(savedInstanceState);
|
||||
instance = new WeakReference<>(this);
|
||||
|
||||
initView();
|
||||
initUnreadCountReceiver();
|
||||
}
|
||||
|
||||
private void initUnreadCountReceiver() {
|
||||
unreadCountReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
long unreadCount = intent.getLongExtra(TUIConstants.UNREAD_COUNT_EXTRA, 0);
|
||||
if (unreadCount > 0) {
|
||||
mMsgUnread.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mMsgUnread.setVisibility(View.GONE);
|
||||
}
|
||||
String unreadStr = "" + unreadCount;
|
||||
if (unreadCount > 100) {
|
||||
unreadStr = "99+";
|
||||
}
|
||||
mMsgUnread.setText(unreadStr);
|
||||
// update Huawei offline push Badge
|
||||
// OfflineMessageDispatcher.updateBadge(MainMinimalistActivity.this, (int) unreadCount);
|
||||
}
|
||||
};
|
||||
|
||||
IntentFilter unreadCountFilter = new IntentFilter();
|
||||
unreadCountFilter.addAction(TUIConstants.CONVERSATION_UNREAD_COUNT_ACTION);
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(unreadCountReceiver, unreadCountFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
Log.i(TAG, "onNewIntent");
|
||||
setIntent(intent);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
setContentView(R.layout.overseas_main_activity);
|
||||
|
||||
mConversationBtnText = findViewById(R.id.conversation);
|
||||
mContactBtnText = findViewById(R.id.contact);
|
||||
mProfileSelfBtnText = findViewById(R.id.mine);
|
||||
mConversationBtnIcon = findViewById(R.id.tab_conversation_icon);
|
||||
mContactBtnIcon = findViewById(R.id.tab_contact_icon);
|
||||
mProfileSelfBtnIcon = findViewById(R.id.tab_profile_icon);
|
||||
mMsgUnread = findViewById(R.id.msg_total_unread);
|
||||
mNewFriendUnread = findViewById(R.id.new_friend_total_unread);
|
||||
|
||||
fragments = new ArrayList<>();
|
||||
fragments.add(new ConversationMinimalistFragment());
|
||||
fragments.add(new TUIContactMinimalistFragment());
|
||||
// fragments.add(new ProfileMinimalistFragment());
|
||||
|
||||
mainViewPager = findViewById(R.id.view_pager);
|
||||
FragmentAdapter fragmentAdapter = new FragmentAdapter(this);
|
||||
fragmentAdapter.setFragmentList(fragments);
|
||||
mainViewPager.setUserInputEnabled(false);
|
||||
mainViewPager.setOffscreenPageLimit(4);
|
||||
mainViewPager.setAdapter(fragmentAdapter);
|
||||
mainViewPager.setCurrentItem(0, false);
|
||||
prepareToClearAllUnreadMessage();
|
||||
}
|
||||
|
||||
private void prepareToClearAllUnreadMessage() {
|
||||
mMsgUnread.setOnTouchListener(new View.OnTouchListener() {
|
||||
private float downX;
|
||||
private float downY;
|
||||
private boolean isTriggered = false;
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
downX = mMsgUnread.getX();
|
||||
downY = mMsgUnread.getY();
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (isTriggered) {
|
||||
return true;
|
||||
}
|
||||
float viewX = view.getX();
|
||||
float viewY = view.getY();
|
||||
float eventX = event.getX();
|
||||
float eventY = event.getY();
|
||||
float translationX = eventX + viewX - downX;
|
||||
float translationY = eventY + viewY - downY;
|
||||
view.setTranslationX(translationX);
|
||||
view.setTranslationY(translationY);
|
||||
// If the moved x and y axis coordinates exceed a certain pixel, it will trigger one-click to clear all unread sessions
|
||||
if (Math.abs(translationX) > 200|| Math.abs(translationY) > 200) {
|
||||
isTriggered = true;
|
||||
mMsgUnread.setVisibility(View.GONE);
|
||||
triggerClearAllUnreadMessage();
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
view.setTranslationX(0);
|
||||
view.setTranslationY(0);
|
||||
isTriggered = false;
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
isTriggered = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void triggerClearAllUnreadMessage() {
|
||||
V2TIMManager.getMessageManager().markAllMessageAsRead(new V2TIMCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.i(TAG, "markAllMessageAsRead success");
|
||||
ToastUtil.toastShortMessage(MainMinimalistActivity.this.getString(R.string.mark_all_message_as_read_succ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i(TAG, "markAllMessageAsRead error:" + code + ", desc:" + ErrorMessageConverter.convertIMError(code, desc));
|
||||
ToastUtil.toastShortMessage(MainMinimalistActivity.this.getString(R.string.mark_all_message_as_read_err_format, code, ErrorMessageConverter.convertIMError(code, desc)));
|
||||
mMsgUnread.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
V2TIMConversationListFilter filter = new V2TIMConversationListFilter();
|
||||
filter.setMarkType(V2TIMConversation.V2TIM_CONVERSATION_MARK_TYPE_UNREAD);
|
||||
getMarkUnreadConversationList(filter, 0, 100, true, new V2TIMValueCallback<HashMap<String, V2TIMConversation>>() {
|
||||
@Override
|
||||
public void onSuccess(HashMap<String, V2TIMConversation> stringV2TIMConversationHashMap) {
|
||||
if (stringV2TIMConversationHashMap.size() == 0) {
|
||||
return;
|
||||
}
|
||||
List<String> unreadConversationIDList = new ArrayList<>();
|
||||
Iterator<Map.Entry<String, V2TIMConversation>> iterator = markUnreadMap.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, V2TIMConversation> entry = iterator.next();
|
||||
unreadConversationIDList.add(entry.getKey());
|
||||
}
|
||||
|
||||
V2TIMManager.getConversationManager().markConversation(unreadConversationIDList,
|
||||
V2TIMConversation.V2TIM_CONVERSATION_MARK_TYPE_UNREAD,
|
||||
false,
|
||||
new V2TIMValueCallback<List<V2TIMConversationOperationResult>>() {
|
||||
@Override
|
||||
public void onSuccess(List<V2TIMConversationOperationResult> v2TIMConversationOperationResults) {
|
||||
for (V2TIMConversationOperationResult result : v2TIMConversationOperationResults) {
|
||||
if (result.getResultCode() == BaseConstants.ERR_SUCC) {
|
||||
V2TIMConversation v2TIMConversation = markUnreadMap.get(result.getConversationID());
|
||||
if (!v2TIMConversation.getMarkList().contains(V2TIMConversation.V2TIM_CONVERSATION_MARK_TYPE_HIDE)) {
|
||||
markUnreadMap.remove(result.getConversationID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.e(TAG, "triggerClearAllUnreadMessage->markConversation error:" + code + ", desc:" + ErrorMessageConverter.convertIMError(code, desc));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.e(TAG, "triggerClearAllUnreadMessage->getMarkUnreadConversationList error:" + code + ", desc:" + ErrorMessageConverter.convertIMError(code, desc));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getMarkUnreadConversationList(V2TIMConversationListFilter filter, long nextSeq, int count, boolean fromStart, V2TIMValueCallback<HashMap<String, V2TIMConversation>> callback) {
|
||||
if (fromStart) {
|
||||
markUnreadMap.clear();
|
||||
}
|
||||
V2TIMManager.getConversationManager().getConversationListByFilter(filter, nextSeq, count, new V2TIMValueCallback<V2TIMConversationResult>() {
|
||||
@Override
|
||||
public void onSuccess(V2TIMConversationResult v2TIMConversationResult) {
|
||||
List<V2TIMConversation> conversationList = v2TIMConversationResult.getConversationList();
|
||||
for (V2TIMConversation conversation : conversationList) {
|
||||
markUnreadMap.put(conversation.getConversationID(), conversation);
|
||||
}
|
||||
|
||||
if (!v2TIMConversationResult.isFinished()) {
|
||||
getMarkUnreadConversationList(filter, v2TIMConversationResult.getNextSeq(), count, false, callback);
|
||||
} else {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(markUnreadMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.e(TAG, "getMarkUnreadConversationList error:" + code + ", desc:" + ErrorMessageConverter.convertIMError(code, desc));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void tabClick(View view) {
|
||||
resetMenuState();
|
||||
switch (view.getId()) {
|
||||
case R.id.conversation_btn_group:
|
||||
mainViewPager.setCurrentItem(0, false);
|
||||
mConversationBtnText.setTextColor(getResources().getColor(R.color.demo_main_tab_text_selected_color_light));
|
||||
mConversationBtnIcon.setBackground(getResources().getDrawable(R.drawable.demo_overseas_main_tab_conversation_selected));
|
||||
break;
|
||||
case R.id.contact_btn_group:
|
||||
mainViewPager.setCurrentItem(1, false);
|
||||
mContactBtnText.setTextColor(getResources().getColor(R.color.demo_main_tab_text_selected_color_light));
|
||||
mContactBtnIcon.setBackground(getResources().getDrawable(R.drawable.demo_overseas_main_tab_contact_selected_bg));
|
||||
break;
|
||||
case R.id.myself_btn_group:
|
||||
mainViewPager.setCurrentItem(2, false);
|
||||
mProfileSelfBtnText.setTextColor(getResources().getColor(R.color.demo_main_tab_text_selected_color_light));
|
||||
mProfileSelfBtnIcon.setBackground(getResources().getDrawable(R.drawable.demo_overseas_main_tab_settings_selected_bg));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void resetMenuState() {
|
||||
mConversationBtnText.setTextColor(getResources().getColor(com.tencent.qcloud.tuicore.R.color.core_light_bg_secondary_text_color_light));
|
||||
mConversationBtnIcon.setBackground(getResources().getDrawable(R.drawable.demo_overseas_main_tab_conversation_normal));
|
||||
mContactBtnText.setTextColor(getResources().getColor(com.tencent.qcloud.tuicore.R.color.core_light_bg_secondary_text_color_light));
|
||||
mContactBtnIcon.setBackground(getResources().getDrawable(R.drawable.demo_overseas_main_tab_contact_normal_bg));
|
||||
mProfileSelfBtnText.setTextColor(getResources().getColor(com.tencent.qcloud.tuicore.R.color.core_light_bg_secondary_text_color_light));
|
||||
mProfileSelfBtnIcon.setBackground(getResources().getDrawable(R.drawable.demo_overseas_main_tab_settings_normal_bg));
|
||||
}
|
||||
|
||||
private final V2TIMFriendshipListener friendshipListener = new V2TIMFriendshipListener() {
|
||||
@Override
|
||||
public void onFriendApplicationListAdded(List<V2TIMFriendApplication> applicationList) {
|
||||
refreshFriendApplicationUnreadCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationListDeleted(List<String> userIDList) {
|
||||
refreshFriendApplicationUnreadCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationListRead() {
|
||||
refreshFriendApplicationUnreadCount();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
finish();
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
super.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
Log.i(TAG, "onStart");
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
Log.i(TAG, "onResume");
|
||||
super.onResume();
|
||||
registerUnreadListener();
|
||||
handleOfflinePush();
|
||||
}
|
||||
|
||||
private void handleOfflinePush() {
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
Log.d(TAG, "handleOfflinePush intent is null");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (OfflinePushConfigs.getOfflinePushConfigs().getClickNotificationCallbackMode() == OfflinePushConfigs.CLICK_NOTIFICATION_CALLBACK_INTENT) {
|
||||
// TUIUtils.handleOfflinePush(intent, new HandleOfflinePushCallBack() {
|
||||
// @Override
|
||||
// public void onHandleOfflinePush(boolean hasLogged) {
|
||||
// if (hasLogged) {
|
||||
// setIntent(null);
|
||||
// } else {
|
||||
// finish();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// String ext = intent.getStringExtra(TUIConstants.TUIOfflinePush.NOTIFICATION_EXT_KEY);
|
||||
// TUIUtils.handleOfflinePush(ext, new HandleOfflinePushCallBack() {
|
||||
// @Override
|
||||
// public void onHandleOfflinePush(boolean hasLogged) {
|
||||
// if (hasLogged) {
|
||||
// setIntent(null);
|
||||
// } else {
|
||||
// finish();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
private void registerUnreadListener() {
|
||||
V2TIMManager.getFriendshipManager().addFriendListener(friendshipListener);
|
||||
refreshFriendApplicationUnreadCount();
|
||||
}
|
||||
|
||||
private void refreshFriendApplicationUnreadCount() {
|
||||
V2TIMManager.getFriendshipManager().getFriendApplicationList(new V2TIMValueCallback<V2TIMFriendApplicationResult>() {
|
||||
@Override
|
||||
public void onSuccess(V2TIMFriendApplicationResult v2TIMFriendApplicationResult) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int unreadCount = v2TIMFriendApplicationResult.getUnreadCount();
|
||||
if (unreadCount > 0) {
|
||||
mNewFriendUnread.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mNewFriendUnread.setVisibility(View.GONE);
|
||||
}
|
||||
String unreadStr = "" + unreadCount;
|
||||
if (unreadCount > 100) {
|
||||
unreadStr = "99+";
|
||||
}
|
||||
mNewFriendUnread.setText(unreadStr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Log.i(TAG, "onPause");
|
||||
super.onPause();
|
||||
V2TIMManager.getFriendshipManager().removeFriendListener(friendshipListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
Log.i(TAG, "onStop");
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Log.i(TAG, "onDestroy");
|
||||
super.onDestroy();
|
||||
|
||||
if (unreadCountReceiver != null) {
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(unreadCountReceiver);
|
||||
unreadCountReceiver = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void finishMainActivity() {
|
||||
if (instance != null && instance.get() != null) {
|
||||
instance.get().finish();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,29 +1,65 @@
|
||||
package com.xjjk.healthyclients.retrofit
|
||||
|
||||
import com.sw.healthyclients.data.local.DataStoreManager
|
||||
import com.xjjk.healthyclients.utils.UrlH5RouteUtils
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
|
||||
object UrlConfig {
|
||||
private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://192.168.1.98/" // 开发环境
|
||||
// private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://cqyt.dev.yg.dt.io/" // 开发环境
|
||||
// private const val TEST_DEFAULT_IP_ADDRESS_REMOTE = "https://starry.test.icdat.cn/" // 测试环境
|
||||
private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "https://xjgateway.mcrm.vip:8888"
|
||||
|
||||
// private const val DEBUG_H5_ADDRESS_REMOTE = "http://cms.dev.yg.dt.io" // 开发环境
|
||||
// private const val TEST_H5_ADDRESS_REMOTE = "https://starry.out.icdat.cn" // 测试环境
|
||||
private const val PRODUCT_H5_ADDRESS_REMOTE = "https://xjconsole.mcrm.vip:8888"
|
||||
/**
|
||||
* 公司内部地址
|
||||
* 接口: http://api-xj.tri.dt.io/
|
||||
* 后台: http://console-xj.tri.dt.io/
|
||||
*/
|
||||
|
||||
|
||||
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 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-jkglpt.iosp.ydpt.tech" // 正式环境
|
||||
|
||||
private const val DEBUG_H5_ADDRESS_REMOTE = "http://console-xj.tri.dt.io" // 开发环境
|
||||
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-jkglpt.iosp.ydpt.tech" // 正式环境
|
||||
//2025年10月23日 14:37 冯普说改为阿里云的地址,给油田部署的正式地址还没有启用
|
||||
// 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
|
||||
|
||||
// const val middle = "xj_health/" //test
|
||||
// const val middleCheck = "healthcheck/" //test
|
||||
const val middle = "hb/" //product
|
||||
const val middleCheck = "hb/" //product
|
||||
|
||||
var testDeviceList = mutableListOf("7e8e7e49a26340b1","bb2d17cc138d109f")//测试设备列表 荣耀 oppo vivo
|
||||
var isTestDevice: Boolean = false
|
||||
var isOpenIm: Boolean = true
|
||||
|
||||
enum class BaseUrlType(val type: Int) {
|
||||
DEBUG(1),
|
||||
// TEST(2),
|
||||
TEST(2),
|
||||
PRODUCT(3)
|
||||
}
|
||||
|
||||
@@ -33,30 +69,134 @@ object UrlConfig {
|
||||
DEBUG_DEFAULT_IP_ADDRESS_REMOTE
|
||||
}
|
||||
//
|
||||
// BaseUrlType.TEST -> {
|
||||
// TEST_DEFAULT_IP_ADDRESS_REMOTE
|
||||
// }
|
||||
BaseUrlType.TEST -> {
|
||||
TEST_DEFAULT_IP_ADDRESS_REMOTE
|
||||
}
|
||||
|
||||
BaseUrlType.PRODUCT -> {
|
||||
PRODUCT_DEFAULT_IP_ADDRESS_REMOTE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
return when (baseUrlType) {
|
||||
BaseUrlType.DEBUG -> {
|
||||
PRODUCT_H5_ADDRESS_REMOTE
|
||||
DEBUG_H5_ADDRESS_REMOTE
|
||||
}
|
||||
//
|
||||
// BaseUrlType.TEST -> {
|
||||
// TEST_H5_ADDRESS_REMOTE
|
||||
// }
|
||||
BaseUrlType.TEST -> {
|
||||
TEST_H5_ADDRESS_REMOTE
|
||||
}
|
||||
|
||||
BaseUrlType.PRODUCT -> {
|
||||
PRODUCT_H5_ADDRESS_REMOTE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
/**
|
||||
* 方便后续加一些其他逻辑
|
||||
*/
|
||||
@@ -64,6 +204,13 @@ object UrlConfig {
|
||||
return getBaseUrl(baseUrlType)
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机银行
|
||||
*/
|
||||
fun getDefaultBankBaseUrl(): String {
|
||||
return getBankBaseUrl(baseUrlType)
|
||||
}
|
||||
|
||||
/**
|
||||
* 方便在APP运行之后切换环境所以用 get获取
|
||||
*/
|
||||
@@ -85,67 +232,38 @@ object UrlConfig {
|
||||
return getH5BaseUrl(baseUrlType) + "/static/monitor/index.html?"
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取评估报告模块地址
|
||||
* @param type 0,健康风险 1,心理评估
|
||||
* 手机银行外链h5 参数
|
||||
*/
|
||||
|
||||
fun getEvaluationReportUrl(type: Int): String {
|
||||
fun getHomeBankH5Url(): String{
|
||||
var httpUrl = getDefaultBaseUrl().toHttpUrl()
|
||||
return getH5Url() +
|
||||
"/?scheme=" + httpUrl.scheme +
|
||||
|
||||
return "scheme=" + httpUrl.scheme +
|
||||
"&host=" + httpUrl.host +
|
||||
"&mobile=0" +
|
||||
"&tokenF=" + DataStoreManager.getToken() +
|
||||
"&type=" + type
|
||||
"&tokenF=" + DataStoreManager.getToken()
|
||||
|
||||
}
|
||||
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
|
||||
|
||||
private fun urlReplace(): String {
|
||||
return getDefaultBaseUrl().replace("http://", "")
|
||||
.replace("https://", "")
|
||||
.replace("/", "")
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取健康干预-膳食 接口地址
|
||||
*/
|
||||
// fun getInterventionFoodUrl():String {
|
||||
// return when (baseUrlType) {
|
||||
// BaseUrlType.DEBUG,BaseUrlType.TEST -> {
|
||||
// "https://vip.shuziweidao.com"
|
||||
// }
|
||||
// BaseUrlType.PRODUCT -> {
|
||||
// "https://yyjk.shuziweidao.com/"
|
||||
// }
|
||||
// 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
|
||||
// }
|
||||
|
||||
/**
|
||||
* 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="
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
//package com.btpj.lib_base.http.interceptor
|
||||
//
|
||||
//import com.btpj.lib_base.BaseApp.Companion.appContext
|
||||
//import com.btpj.lib_base.utils.NetworkUtil
|
||||
//import okhttp3.CacheControl
|
||||
//import okhttp3.Interceptor
|
||||
//import okhttp3.Response
|
||||
//
|
||||
///**
|
||||
// * 缓存拦截器,用于无网情况下传递header直接拉取之前缓存的数据
|
||||
// * @param day 缓存天数
|
||||
// *
|
||||
// * @author nanfeifei 2022/4/14
|
||||
// */
|
||||
//class CacheInterceptor(private var day: Int = 7) : Interceptor {
|
||||
// override fun intercept(chain: Interceptor.Chain): Response {
|
||||
// var request = chain.request()
|
||||
// if (!NetworkUtil.isNetworkAvailable(appContext)) {
|
||||
// request = request.newBuilder()
|
||||
// .cacheControl(CacheControl.FORCE_CACHE)
|
||||
// .build()
|
||||
// }
|
||||
// val response = chain.proceed(request)
|
||||
// if (!NetworkUtil.isNetworkAvailable(appContext)) {
|
||||
// val maxAge = 60 * 60
|
||||
// response.newBuilder()
|
||||
// .removeHeader("Pragma")
|
||||
// .header("Cache-Control", "public, max-age=$maxAge")
|
||||
// .build()
|
||||
// } else {
|
||||
// val maxStale = 60 * 60 * 24 * day
|
||||
// response.newBuilder()
|
||||
// .removeHeader("Pragma")
|
||||
// .header("Cache-Control", "public, only-if-cached, max-stale=$maxStale")
|
||||
// .build()
|
||||
// }
|
||||
// return response
|
||||
// }
|
||||
//}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
//package com.xjjk.healthyclients.superfuntion
|
||||
//
|
||||
//import android.content.Context
|
||||
//import android.content.Intent
|
||||
//import android.net.Uri
|
||||
//import com.xjjk.healthyclients.bean.emergency.LocationResourceBean
|
||||
//import com.xjjk.healthyclients.view.WindowDialogView
|
||||
//
|
||||
//fun EmergencyActivity.getMarkerInfo(
|
||||
// mLat: Double,
|
||||
// mLon: Double,
|
||||
// mMarkerList: MutableList<LocationResourceBean>
|
||||
//): LocationResourceBean? {
|
||||
// var bean: LocationResourceBean? = null
|
||||
// for (index in 0 until mMarkerList.size) {
|
||||
// var lat = mMarkerList[index].latitude
|
||||
// var lon = mMarkerList[index].longitude
|
||||
// if (lat == mLat && lon == mLon) {
|
||||
// //设置卡片信息
|
||||
// bean = mMarkerList[index]
|
||||
// }
|
||||
// }
|
||||
// return bean
|
||||
//}
|
||||
//
|
||||
//fun EmergencyActivity.goNavigation(mLat: Double, mLon: Double, context: Context) {
|
||||
// WindowDialogView.WindowDialogView(context, object :
|
||||
// WindowDialogView.windowDialogListener {
|
||||
// override fun onSelectText(position: Int, str: String?) {
|
||||
// when (str) {
|
||||
// "百度地图" -> {
|
||||
//// showToastTxt = "手机未安装百度地图APP"
|
||||
// val intent = Intent()
|
||||
// //导航界面
|
||||
// intent.setData(Uri.parse("baidumap://map/direction?destination=latlng:${mLat},${mLon}|name:目的地&coord_type=bd09ll&mode=driving"))
|
||||
// //由于没获取到目的地地址,所以跳到目的地界面
|
||||
// //intent.setData(Uri.parse("baidumap://map/geocoder?location=${item?.la},${item?.lg}&src=andr.baidu.openAPIdemo"))
|
||||
// context?.startActivity(intent)
|
||||
//
|
||||
// }
|
||||
//
|
||||
// "高德地图" -> {
|
||||
//// showToastTxt = "手机未安装高德地图APP"
|
||||
// val intent = Intent()
|
||||
// intent.setPackage("com.autonavi.minimap")
|
||||
// intent.setAction(Intent.ACTION_VIEW)
|
||||
// intent.addCategory(Intent.CATEGORY_DEFAULT)
|
||||
// val destination = MapUtils.gaoDeToLatLng(mLat, mLon);//转换坐标系
|
||||
// intent.setData(
|
||||
// Uri.parse(
|
||||
// "androidamap://route?sourceApplication=${context?.getString(R.string.app_name)}&" +
|
||||
// "dlat=" + destination.latitude + "&dlon=" + destination.longitude + "&dname=目的地" + "&dev=0&t=0"
|
||||
// )
|
||||
// )
|
||||
// context?.startActivity(intent)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onClose() {
|
||||
// }
|
||||
// }, MapUtils.isInstalled(context))
|
||||
//}
|
||||
@@ -12,6 +12,7 @@ import com.xjjk.healthyclients.ui.activity.EmergencyContactActivity
|
||||
import com.xjjk.healthyclients.ui.activity.FullScreenImageActivity
|
||||
import com.xjjk.healthyclients.ui.activity.LoginActivity
|
||||
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.UserSettingActivity
|
||||
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.ConsultantManagerActivity
|
||||
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.GeneralPracticeGuidanceActivity
|
||||
import com.xjjk.healthyclients.ui.activity.guidance.GuidanceNoticeActivity
|
||||
@@ -420,11 +420,11 @@ fun startAppointmentWaitAffirmActivity(
|
||||
/**
|
||||
* 专家主页
|
||||
*/
|
||||
fun startDoctorHomepageActivity(context: Context, doctorId: String = "") {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("doctorId", doctorId)
|
||||
startActivity(context, bundle = bundle, targetClass = DoctorHomepageActivity::class.java)
|
||||
}
|
||||
//fun startDoctorHomepageActivity(context: Context, doctorId: String = "") {
|
||||
// val bundle = Bundle()
|
||||
// bundle.putString("doctorId", doctorId)
|
||||
// startActivity(context, bundle = bundle, targetClass = DoctorHomepageActivity::class.java)
|
||||
//}
|
||||
|
||||
/**
|
||||
* 咨询须知 type 1 图文 0音视频
|
||||
@@ -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()
|
||||
bundle.putString("url", url)
|
||||
bundle.putBoolean("Scale", scale)
|
||||
bundle.putInt("source", source)
|
||||
bundle.putString("title", myTitle)
|
||||
bundle.putBoolean("darkStyle", darkStyle)//主题
|
||||
bundle.putBoolean("isFull", isFull)//是否全屏
|
||||
bundle.putBoolean("hideStatus", hideStatus)//是否隐藏状态栏
|
||||
startActivity(this, bundle = bundle, targetClass = WebActivity::class.java)
|
||||
}
|
||||
///**
|
||||
@@ -1373,9 +1373,9 @@ fun Context.startAllDoctorActivity(id:String) {
|
||||
///**
|
||||
// * 模拟用户
|
||||
// */
|
||||
//fun startSimulateUserActivity(context: Context){
|
||||
// startActivity(context, targetClass = SimulateUserActivity::class.java)
|
||||
//}
|
||||
fun startSimulateUserActivity(context: Context){
|
||||
startActivity(context, targetClass = SimulateUserActivity::class.java)
|
||||
}
|
||||
//
|
||||
///**
|
||||
// * 自由训练记录列表
|
||||
|
||||
@@ -126,7 +126,7 @@ fun String?.floatToInt(i: Int = 0): Int {
|
||||
i
|
||||
} else {
|
||||
if (this!!.toFloatOrNull() != null) {
|
||||
this.toFloatOrNull()!!.toInt()
|
||||
this.toFloatOrNull()!!.roundToInt()
|
||||
} else {
|
||||
i
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
import android.widget.ImageView
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@@ -523,7 +524,7 @@ fun ViewPager2.init(
|
||||
*/
|
||||
fun TabLayout.onCreateTab(
|
||||
tabList: Array<String>,
|
||||
tabStyle: Int = 2,
|
||||
tabStyle: Int = 1,
|
||||
listener: (TabLayout.Tab?) -> Unit
|
||||
) {
|
||||
for (tabTitle in tabList) {
|
||||
@@ -548,10 +549,11 @@ fun TabLayout.onCreateTab(
|
||||
|
||||
|
||||
private fun onConfigureTab(context: Context,tab: TabLayout.Tab, tabTitle: String,tabStyle: Int) {
|
||||
val textView = LayoutInflater.from(context)
|
||||
.inflate(getTabStyle(tabStyle), null) as TextView
|
||||
textView.text = tabTitle
|
||||
tab.customView = textView
|
||||
val tabView = LayoutInflater.from(context)
|
||||
.inflate(getTabStyle(tabStyle), null) as RelativeLayout
|
||||
val tabText = tabView.findViewById<TextView>(R.id.tv_text)
|
||||
tabText.text = tabTitle
|
||||
tab.customView = tabView
|
||||
}
|
||||
|
||||
|
||||
@@ -583,13 +585,12 @@ fun TabLayout.attachViewPager(
|
||||
|
||||
/**
|
||||
* tab 样式
|
||||
* 1:通用样式 2:癌症结论tab样式
|
||||
* 1:通用样式 绿色/灰色
|
||||
*/
|
||||
fun getTabStyle(i: Int): Int {
|
||||
return when (i) {
|
||||
1 -> R.layout.item_tablayout_group_title
|
||||
2 -> R.layout.item_tablayout_group_title2
|
||||
102 -> R.layout.item_home_tab_group//首页
|
||||
2 -> R.layout.item_tablayout_group_index_theme//有下标线的绿色
|
||||
else -> R.layout.item_tablayout_group_title
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,10 @@ class EmergencyContactActivity :
|
||||
if (it.isNullOrEmpty()) {
|
||||
return@collectLatest
|
||||
}
|
||||
relationPicker.setData(it)
|
||||
val filter = it.filter {
|
||||
!it.text.equals("本人")
|
||||
}
|
||||
relationPicker.setData(filter)
|
||||
if (mBean == null) {
|
||||
setRelationText(it[0])
|
||||
} else {
|
||||
|
||||
@@ -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.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.webkit.WebChromeClient
|
||||
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", "$localAdress&d=${date}")
|
||||
mBinding.webView.loadUrl("$localAdress&d=${date}&h=${urlType}")
|
||||
Log.i("InterventionWebActivity", "url: "+mBinding.webView.url)
|
||||
}
|
||||
|
||||
private fun getTitleText(path: String?): String {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xjjk.healthyclients.ui.activity
|
||||
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
@@ -30,7 +31,7 @@ import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||
import com.xjjk.healthyclients.bean.LoginBean
|
||||
import com.xjjk.healthyclients.bean.LoginResponseBean
|
||||
import com.xjjk.healthyclients.data.api.CommonApi
|
||||
import com.xjjk.healthyclients.databinding.ActivityLoginBinding
|
||||
import com.xjjk.healthyclients.databinding.ActivityLoginNewBinding
|
||||
import com.xjjk.healthyclients.retrofit.RetrofitManager
|
||||
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||
import com.xjjk.healthyclients.superfuntion.loginIm
|
||||
@@ -40,7 +41,6 @@ import com.xjjk.healthyclients.ui.viewmodel.LoginViewModel
|
||||
import com.xjjk.healthyclients.utils.CommonUtils
|
||||
import com.xjjk.healthyclients.utils.ConstantUtils
|
||||
import com.xjjk.healthyclients.view.TextViewDialog
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import retrofit2.Call
|
||||
@@ -48,7 +48,8 @@ import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
|
||||
class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.layout.activity_login) {
|
||||
class LoginActivity :
|
||||
BaseVMBActivity<LoginViewModel, ActivityLoginNewBinding>(R.layout.activity_login_new) {
|
||||
var mApi = RetrofitManager.getRetrofits().create(CommonApi::class.java)
|
||||
|
||||
var isRead = false
|
||||
@@ -59,6 +60,11 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
var mLastTime = 0L
|
||||
var mHits = LongArray(mCount)
|
||||
var isAdminEnable = false
|
||||
var loginType = 1
|
||||
|
||||
var loginClickTime = 0L
|
||||
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
CommonUtils.logoutClearData()
|
||||
initAgreement()
|
||||
@@ -76,7 +82,6 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun initData() {
|
||||
var state = DataStoreManager.isAgreePrivacyPolicyStatus()
|
||||
if (state) {
|
||||
@@ -106,19 +111,33 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
"1" -> {
|
||||
//用户协议
|
||||
if (it[index].text.isNotEmpty()) {
|
||||
DataStoreManager.saveUserAgreementUrl(UrlConfig.getH5BaseUrl(UrlConfig.baseUrlType)+it[index].text)
|
||||
DataStoreManager.saveUserAgreementUrl(
|
||||
UrlConfig.getH5BaseUrl(
|
||||
UrlConfig.baseUrlType
|
||||
) + it[index].text
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"2" -> {
|
||||
//隐私政策
|
||||
if (it[index].text.isNotEmpty()) {
|
||||
DataStoreManager.savePrivacyAgreementUrl(UrlConfig.getH5BaseUrl(UrlConfig.baseUrlType)+it[index].text)
|
||||
DataStoreManager.savePrivacyAgreementUrl(
|
||||
UrlConfig.getH5BaseUrl(
|
||||
UrlConfig.baseUrlType
|
||||
) + it[index].text
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"3" -> {
|
||||
//相关法律说明
|
||||
if (it[index].text.isNotEmpty()) {
|
||||
DataStoreManager.saveLawUrl(UrlConfig.getH5BaseUrl(UrlConfig.baseUrlType)+it[index].text)
|
||||
DataStoreManager.saveLawUrl(
|
||||
UrlConfig.getH5BaseUrl(
|
||||
UrlConfig.baseUrlType
|
||||
) + it[index].text
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,8 +154,8 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
override fun bindEvent() {
|
||||
mBinding?.apply {
|
||||
addClickViews(
|
||||
loginSubmit,loginIvReadState,loginAgreementRoot,loginRetrievePassword,testBtn,ivIconImg,
|
||||
tvDebug,tvProd,tvTest
|
||||
loginSubmit, loginIvReadState, loginAgreementRoot, loginRetrievePassword,
|
||||
tvLoginHealthy, tvLoginPlatform
|
||||
)
|
||||
}
|
||||
mTextViewDialog?.let {
|
||||
@@ -165,7 +184,7 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
mHits = LongArray(mCount)
|
||||
isAdminEnable = true
|
||||
mBinding.loginEtUserName.setText("admin")
|
||||
mBinding.loginEtUserPassword.setInputContext("&ZzW$3**@VLA")
|
||||
mBinding.loginEtUserPassword.setInputContext("#fCjW%x2dv@a")
|
||||
showToast("已开启专业模式")
|
||||
mCount = 5
|
||||
|
||||
@@ -180,23 +199,31 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
// if (!passWord.formatCheck()) {
|
||||
// showToast("格式校验不通过")
|
||||
// }
|
||||
val passwordLength = mBinding.loginEtUserPassword.getInputContext().length
|
||||
|
||||
if (mBinding.loginEtUserName.text.toString().trim().length == 0) {
|
||||
showToast("请输入员工编号或用户名")
|
||||
}else if (mBinding.loginEtUserPassword.getInputContext().length==0){
|
||||
} else if (passwordLength == 0) {
|
||||
showToast("请输入密码")
|
||||
} else if (!isRead) {
|
||||
showToast("请先阅读相关协议并勾选")
|
||||
// } else if ((passwordLength < 12 || passwordLength > 32)&&loginType==2) {
|
||||
// mTextViewDialog?.show()
|
||||
} else {
|
||||
if (mBinding.loginEtUserPassword.getInputContext().length<12||mBinding.loginEtUserPassword.getInputContext().length>32) {
|
||||
mTextViewDialog?.show()
|
||||
}else {
|
||||
if (System.currentTimeMillis() - loginClickTime > 3000) {
|
||||
loginClickTime = System.currentTimeMillis()
|
||||
login(
|
||||
mBinding.loginEtUserName.text.toString().trim(),
|
||||
mBinding.loginEtUserPassword.getInputContext()
|
||||
)
|
||||
} else {
|
||||
showToast("您的操作过于频繁,请稍后再试!")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
R.id.login_iv_read_state, R.id.login_agreement_root -> {
|
||||
mBinding?.let {
|
||||
if (isRead) {
|
||||
@@ -208,27 +235,20 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
R.id.login_retrieve_password -> {
|
||||
//找回密码
|
||||
if (loginType == 1) {
|
||||
startWebActivity(url = UrlConfig.ANYAN_CHANGE_PASSWORD_H5)
|
||||
} else {
|
||||
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->{
|
||||
if (isAdminEnable) {
|
||||
mBinding.testBtn.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
// R.id.iv_icon_img->{
|
||||
// if (isAdminEnable) {
|
||||
// mBinding.testBtn.visibility = View.VISIBLE
|
||||
// }
|
||||
// }
|
||||
|
||||
R.id.tv_debug -> {
|
||||
DataStoreManager.saveCurrentConfig(1)
|
||||
@@ -244,6 +264,26 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
DataStoreManager.saveCurrentConfig(3)
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
R.id.tv_login_platform -> {
|
||||
loginType = 1
|
||||
mBinding.tvLoginPlatform.setBackgroundResource(R.mipmap.ic_login_platform_bg_green)
|
||||
mBinding.tvLoginPlatform.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
mBinding.tvLoginHealthy.setBackgroundResource(R.mipmap.ic_login_healthy_bg)
|
||||
mBinding.tvLoginHealthy.setTextColor(Color.parseColor("#21BEBD"))
|
||||
mBinding.loginRetrievePassword.text = "统一认证找回密码"
|
||||
|
||||
}
|
||||
|
||||
R.id.tv_login_healthy -> {
|
||||
loginType = 2
|
||||
mBinding.tvLoginPlatform.setBackgroundResource(R.mipmap.ic_login_platform_bg)
|
||||
mBinding.tvLoginPlatform.setTextColor(Color.parseColor("#21BEBD"))
|
||||
mBinding.tvLoginHealthy.setBackgroundResource(R.mipmap.ic_login_healthy_bg_green)
|
||||
mBinding.tvLoginHealthy.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
mBinding.loginRetrievePassword.text = "健康系统找回密码"
|
||||
|
||||
}
|
||||
// R.id.login_iv_eye -> {
|
||||
// mBinding?.let {
|
||||
// var selection=it.loginEtUserPassword.selectionEnd
|
||||
@@ -262,14 +302,13 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
private fun initAgreement() {
|
||||
// var text="已阅读并同意《用户协议》、《隐私政策》和《相关法律说明》"
|
||||
var text="已阅读并同意《用户协议》、《隐私政策》"
|
||||
var text = "已阅读并同意用户协议和隐私政策"
|
||||
var span = SpannableString(text)
|
||||
span.setSpan(object : ClickableSpan() {
|
||||
|
||||
@@ -281,11 +320,15 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
}
|
||||
}
|
||||
// 表示点击整个text的长度都有效触发这个事件
|
||||
}, 6, 12, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||
}, 6, 10, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||
mContext?.let {
|
||||
span.setSpan(NoUnderlineSpan(),6 , 12, Spanned.SPAN_MARK_MARK)
|
||||
span.setSpan(NoUnderlineSpan(), 6, 10, Spanned.SPAN_MARK_MARK)
|
||||
span.setSpan(
|
||||
ForegroundColorSpan(it.resources.getColor(R.color.link_blue_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() {
|
||||
@@ -298,11 +341,15 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
}
|
||||
}
|
||||
// 表示点击整个text的长度都有效触发这个事件
|
||||
}, 13, 19, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||
}, 11, 15, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||
mContext?.let {
|
||||
span.setSpan(NoUnderlineSpan(),13 , 19, Spanned.SPAN_MARK_MARK)
|
||||
span.setSpan(NoUnderlineSpan(), 11, 15, Spanned.SPAN_MARK_MARK)
|
||||
span.setSpan(
|
||||
ForegroundColorSpan(it.resources.getColor(R.color.link_blue_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() {
|
||||
//
|
||||
@@ -331,12 +378,15 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
bean.deviceType = "${DevicesInfoUtils.getDeviceBrand()}"
|
||||
if ("HUAWEI" == DevicesInfoUtils.getDeviceBrand()) {
|
||||
if ("12" == DevicesInfoUtils.getDeviceAndroidVersion()) {
|
||||
bean.deviceSystem="${DevicesInfoUtils.getDeviceModel()}(Android:12||Harmony:${DevicesInfoUtils.getDeviceHarmonyOsVersion()})"
|
||||
bean.deviceSystem =
|
||||
"${DevicesInfoUtils.getDeviceModel()}(Android:12||Harmony:${DevicesInfoUtils.getDeviceHarmonyOsVersion()})"
|
||||
} else {
|
||||
bean.deviceSystem="${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})"
|
||||
bean.deviceSystem =
|
||||
"${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})"
|
||||
}
|
||||
} else {
|
||||
bean.deviceSystem="${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})"
|
||||
bean.deviceSystem =
|
||||
"${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})"
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
@@ -345,12 +395,22 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
bean.username = name
|
||||
bean.password = RSACipherStrategy().encrypt(ConstantUtils.mRSAKey, password)
|
||||
// bean.password=password
|
||||
var login=mApi.mLogin(bean)
|
||||
login.enqueue(object : Callback<JsonObject>{
|
||||
var login: Call<JsonObject>? = null
|
||||
|
||||
if (loginType == 2 || isAdminEnable) {
|
||||
login = mApi.mLogin(bean)
|
||||
} else if (loginType == 1) {
|
||||
login = mApi.mLoginAnYan(bean)
|
||||
}
|
||||
|
||||
login!!.enqueue(object : Callback<JsonObject> {
|
||||
override fun onResponse(call: Call<JsonObject>, response: Response<JsonObject>) {
|
||||
dialog?.dismiss()
|
||||
try {
|
||||
var bean= Gson().fromJson<LoginResponseBean>(response.body().toString(),LoginResponseBean::class.java)
|
||||
var bean = Gson().fromJson<LoginResponseBean>(
|
||||
response.body().toString(),
|
||||
LoginResponseBean::class.java
|
||||
)
|
||||
if (bean.code == 200) {
|
||||
if (bean.result.userInfo.personType != null && bean.result.userInfo.personType == "1" || isAdminEnable) {
|
||||
ConstantUtils.mCheckToken = true
|
||||
@@ -409,6 +469,7 @@ class LoginActivity : BaseVMBActivity<LoginViewModel, ActivityLoginBinding>(R.la
|
||||
isExit = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun exit() {
|
||||
if (!isExit) {
|
||||
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.MarkerOptions
|
||||
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.permissionx.guolindev.PermissionX
|
||||
import com.tencent.qcloud.tuicore.util.ToastUtil
|
||||
@@ -38,6 +43,7 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
||||
var aMap: AMap? = null
|
||||
var mCurrentLat: Double = 0.0
|
||||
var mCurrentLon: Double = 0.0
|
||||
var desc: String = ""
|
||||
var mPermissionList= arrayListOf(
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
@@ -72,6 +78,34 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
||||
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() {
|
||||
// 自定义系统定位小蓝点
|
||||
val myLocationStyle = MyLocationStyle()
|
||||
@@ -91,6 +125,9 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
||||
aMap?.setOnMyLocationChangeListener {
|
||||
mCurrentLat = it.latitude
|
||||
mCurrentLon = it.longitude
|
||||
|
||||
initGeocoderSearch()
|
||||
|
||||
val markerOption = MarkerOptions()
|
||||
markerOption.position(LatLng(mCurrentLat, mCurrentLon))
|
||||
aMap?.moveCamera(CameraUpdateFactory.newLatLng(LatLng(mCurrentLat, mCurrentLon)))
|
||||
@@ -108,6 +145,8 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
||||
marker?.position = cameraPosition.target
|
||||
mCurrentLat = cameraPosition.target.latitude
|
||||
mCurrentLon = cameraPosition.target.longitude
|
||||
|
||||
initGeocoderSearch()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +183,7 @@ class SelectLocationActivity : BaseVMBActivity<TestViewModel, ActivitySelectLoca
|
||||
var locationMessageBean = LocationMessageBean()
|
||||
locationMessageBean.longitude = mCurrentLon
|
||||
locationMessageBean.latitude = mCurrentLat
|
||||
locationMessageBean.desc = desc
|
||||
intent.putExtra(ChatLayoutSetting.KEY_CUSTOM_MESSAGE, locationMessageBean.toJson())
|
||||
setResult(ChatLayoutSetting.RESULT_CODE_LOCATION, intent)
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,20 @@ 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 com.sw.healthyclients.data.local.DataStoreManager
|
||||
import com.xjjk.healthyclients.AppViewModel
|
||||
import com.xjjk.healthyclients.BuildConfig
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||
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 kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import org.lzh.framework.updatepluginlib.UpdateBuilder
|
||||
|
||||
/**
|
||||
* 个人信息设置页面
|
||||
@@ -16,12 +23,16 @@ import com.xjjk.healthyclients.superfuntion.startWebActivity
|
||||
class UserSettingActivity :
|
||||
BaseVMBActivity<AppViewModel, ActivitySettingBinding>(R.layout.activity_setting) {
|
||||
|
||||
var newVersion: Boolean = false//是否有新版本
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding?.apply {
|
||||
settingEditPassword.setOrderStateInfo("账号与安全(修改密码)",0,View.GONE)
|
||||
settingUserAgreement.setOrderStateInfo("用户协议",0,View.VISIBLE)
|
||||
settingUserPrivacyPolicy.setOrderStateInfo("隐私政策",0,View.VISIBLE)
|
||||
settingVersion.setOrderStateInfo("当前版本",0,View.VISIBLE,false, "v"+BuildConfig.VERSION_NAME)
|
||||
settingCheckVersion.setOrderStateInfo("检查更新", 0, View.VISIBLE, false, "")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,13 +42,12 @@ class UserSettingActivity :
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
|
||||
mViewModel.getAppVersionInfo()
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding?.apply {
|
||||
addClickViews(settingEditPassword,settingUserAgreement,settingUserPrivacyPolicy)
|
||||
addClickViews(settingEditPassword,settingUserAgreement,settingUserPrivacyPolicy,settingCheckVersion)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,7 +55,8 @@ class UserSettingActivity :
|
||||
override fun processClick(paramView: View?) {
|
||||
when (paramView?.id) {
|
||||
R.id.setting_edit_password -> {
|
||||
mContext?.startRetrievePassWordActivity()
|
||||
// mContext?.startRetrievePassWordActivity()
|
||||
startWebActivity(url = UrlConfig.ANYAN_CHANGE_PASSWORD_H5)
|
||||
}
|
||||
R.id.setting_user_agreement -> {
|
||||
DataStoreManager.getUserAgreementUrl()?.let {
|
||||
@@ -61,8 +72,40 @@ class UserSettingActivity :
|
||||
}
|
||||
}
|
||||
}
|
||||
R.id.setting_check_version -> {
|
||||
if (newVersion) {
|
||||
UpdateBuilder.create().check()
|
||||
} else {
|
||||
showToast("已是最新版本了")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.mAppUpdateBean.collectLatest { bean ->
|
||||
if (bean==null) {
|
||||
mBinding?.settingCheckVersion?.setOrderStateInfo("检查更新", 0, View.VISIBLE, false, "已是最新版本")
|
||||
}
|
||||
bean?.let {
|
||||
if (it.versionNo > BuildConfig.VERSION_CODE) {
|
||||
newVersion = true
|
||||
mBinding?.settingCheckVersion?.setOrderStateInfo("检查更新", 0, View.VISIBLE, false, "有新版本待更新")
|
||||
} else {
|
||||
mBinding?.settingCheckVersion?.setOrderStateInfo("检查更新", 0, View.VISIBLE, false, "已是最新版本")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.xjjk.healthyclients.ui.activity
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
@@ -66,26 +65,27 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
||||
.ready()
|
||||
.go(getUrl())
|
||||
mAgentWeb.agentWebSettings.webSettings.javaScriptEnabled = true
|
||||
mAgentWeb.agentWebSettings.webSettings.cacheMode = WebSettings.LOAD_NO_CACHE
|
||||
mAgentWeb.jsInterfaceHolder.addJavaObject("android", androidInterface)
|
||||
}
|
||||
|
||||
override fun dataBindingFinish() {
|
||||
val source = intent.getIntExtra("source", 0)
|
||||
customTitle = intent.getStringExtra("title")
|
||||
if (source == 1) {//深绿色
|
||||
mBinding.toolbarLay.rlTitleLay.setBackgroundColor(Color.parseColor("#117474"))
|
||||
}
|
||||
mBinding.toolbarLay.darkStyle = intent.getBooleanExtra("darkStyle", true)
|
||||
if (intent.getBooleanExtra("isFull", false)) {
|
||||
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
|
||||
|
||||
val statusBarHeight = StatusbarUtil.getStatusBarHeight(this)
|
||||
val layoutParams = mBinding.statusView.layoutParams
|
||||
layoutParams.height = statusBarHeight
|
||||
mBinding.statusView.layoutParams = layoutParams
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
mIsScale = intent.getBooleanExtra("Scale", false)
|
||||
@@ -110,11 +110,13 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
||||
override fun onBackEvent() {
|
||||
if (!mAgentWeb.back()) {
|
||||
if (jsAffirmBack.isNullOrEmpty()) {
|
||||
mAgentWeb.webCreator.webView?.stopLoading()
|
||||
super.onBackEvent()
|
||||
} else {
|
||||
mAgentWeb.jsAccessEntrace.quickCallJs("interceptBack",
|
||||
{ value ->
|
||||
if ("1" != value) {
|
||||
mAgentWeb.webCreator.webView?.stopLoading()
|
||||
finish()
|
||||
}
|
||||
})
|
||||
@@ -273,14 +275,10 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
||||
}
|
||||
}
|
||||
}
|
||||
var isRefresh = false
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
mAgentWeb.webLifeCycle.onResume()
|
||||
if (getUrl().contains("motionClock")&&isRefresh) {//动打卡链接,同步微信步数再次刷新界面
|
||||
mAgentWeb.urlLoader.reload()
|
||||
}
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
@@ -293,7 +291,6 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
||||
|
||||
override fun onPause() {
|
||||
mAgentWeb.webLifeCycle.onPause()
|
||||
isRefresh = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -18,15 +18,15 @@ class EmergencySeekDoctorAdapter(var mContext: Context) : BaseQuickAdapter<initU
|
||||
holder?.getView<TextView>(R.id.item_emergency_seek_doctor_time)?.let{
|
||||
it.text="求救时间:${bean?.createTime}"
|
||||
}
|
||||
holder?.getView<TextView>(R.id.item_emergency_seek_doctor_hospital)?.let{
|
||||
var content="${bean?.sendOrderHospital}"
|
||||
if (content.isNotEmpty()&&bean?.stationBusiness_dictText!!.isNotEmpty()) {
|
||||
content="$content - ${bean?.stationBusiness_dictText}"
|
||||
}else if(bean?.stationBusiness_dictText!!.isNotEmpty()){
|
||||
content="${bean?.stationBusiness_dictText}"
|
||||
}
|
||||
it.text="应急医院:${content}"
|
||||
}
|
||||
// holder?.getView<TextView>(R.id.item_emergency_seek_doctor_hospital)?.let{
|
||||
// var content="${bean?.sendOrderHospital}"
|
||||
// if (content.isNotEmpty()&&bean?.stationBusiness_dictText!!.isNotEmpty()) {
|
||||
// content="$content - ${bean?.stationBusiness_dictText}"
|
||||
// }else if(bean?.stationBusiness_dictText!!.isNotEmpty()){
|
||||
// content="${bean?.stationBusiness_dictText}"
|
||||
// }
|
||||
// it.text="应急医院:${content}"
|
||||
// }
|
||||
holder?.getView<TextView>(R.id.item_emergency_seek_doctor_state)?.let{
|
||||
it.text="${bean?.orderStatus_dictText}"
|
||||
}
|
||||
|
||||
+5
-5
@@ -80,7 +80,7 @@ class ArchivesDetailActivity :
|
||||
ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
||||
mBinding.viewQuestionDiseaseDuration.setTitle(getString(R.string.archives_detail_question_disease_duration))
|
||||
mBinding.viewQuestionHaveDoctor.setTitle(getString(R.string.archives_detail_question_have_doctor))
|
||||
mBinding.viewQuestionPhysicalExaminationReport.setTitle(getString(R.string.archives_detail_question_physical_examination_report))
|
||||
// mBinding.viewQuestionPhysicalExaminationReport.setTitle(getString(R.string.archives_detail_question_physical_examination_report))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class ArchivesDetailActivity :
|
||||
mBinding.etLookMedicalName.setText(it.lookMedicalName)
|
||||
mBinding.viewQuestionDiseaseDuration.setDefaultValue(it.haveTime)
|
||||
mBinding.viewQuestionHaveDoctor.setDefaultValue(it.tfLook)
|
||||
mBinding.viewQuestionPhysicalExaminationReport.setDefaultValue(it.tfPermission)
|
||||
// mBinding.viewQuestionPhysicalExaminationReport.setDefaultValue(it.tfPermission)
|
||||
it.tfLook?.let { tfLook -> isShowSeeDoctorExplainLay(tfLook) }
|
||||
}
|
||||
}
|
||||
@@ -131,8 +131,8 @@ class ArchivesDetailActivity :
|
||||
if (it.isNullOrEmpty()) {
|
||||
return@collectLatest
|
||||
}
|
||||
mBinding.viewQuestionPhysicalExaminationReport.setData(it)
|
||||
mBinding.viewQuestionPhysicalExaminationReport.disableRadioGroup(mViewModel.noEdit.value)
|
||||
// mBinding.viewQuestionPhysicalExaminationReport.setData(it)
|
||||
// mBinding.viewQuestionPhysicalExaminationReport.disableRadioGroup(mViewModel.noEdit.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ class ArchivesDetailActivity :
|
||||
etLookOffice.isFocusable = !noEdit
|
||||
etLookOffice.isFocusableInTouchMode = !noEdit
|
||||
viewQuestionHaveDoctor.disableRadioGroup(noEdit)
|
||||
viewQuestionPhysicalExaminationReport.disableRadioGroup(noEdit)
|
||||
// viewQuestionPhysicalExaminationReport.disableRadioGroup(noEdit)
|
||||
viewQuestionDiseaseDuration.disableRadioGroup(noEdit)
|
||||
imageAdapter.isEditModel(!noEdit)
|
||||
}
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ class DoctorHomepageActivity :
|
||||
if (doctorStatus!="3") {
|
||||
if (audioStatus=="1"){
|
||||
mType="0"
|
||||
mViewModel.selectUserNotice("2")
|
||||
mViewModel.selectUserNotice("0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-7
@@ -22,7 +22,7 @@ import kotlinx.coroutines.launch
|
||||
class GuidanceNoticeActivity : BaseVMBActivity<GuidanceNoticeViewModel, ActivityGuidanceNoticeBinding>(R.layout.activity_guidance_notice){
|
||||
|
||||
|
||||
var type=3;//7天0 1个月1 以后不再 3
|
||||
var type=2;//7天0 1个月1 以后不再 2
|
||||
var id=""
|
||||
var doctorId: String? = null
|
||||
var mPageType: String? = null// 1 图文 0音视频
|
||||
@@ -88,7 +88,7 @@ class GuidanceNoticeActivity : BaseVMBActivity<GuidanceNoticeViewModel, Activity
|
||||
dialogConfirmNoRemindIv.setImageResource(R.drawable.ic_marital_state_no_select)
|
||||
}
|
||||
dialogConfirmNoRemindLl.setOnClickListener {
|
||||
type=3
|
||||
type=2
|
||||
dialogConfirmNoRemindIv.setImageResource(R.drawable.ic_marital_state_select)
|
||||
dialogConfirm7DayNoRemindIv.setImageResource(R.drawable.ic_marital_state_no_select)
|
||||
dialogConfirm1MonthNoRemindIv.setImageResource(R.drawable.ic_marital_state_no_select)
|
||||
@@ -101,11 +101,6 @@ class GuidanceNoticeActivity : BaseVMBActivity<GuidanceNoticeViewModel, Activity
|
||||
|
||||
override fun processClick(paramView: View?) {
|
||||
when(paramView?.id){
|
||||
R.id.hospital_detail_navigation -> {
|
||||
mContext?.let{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ class UserMyGuidanceActivity : BaseVMBActivity<MyGuidanceActivityViewModel, Acti
|
||||
}
|
||||
|
||||
/**
|
||||
* 1 待开始 3 进行中 5已完成
|
||||
* 1 待开始 3 进行中 5已完成 6 历史
|
||||
*/
|
||||
fun orderState(state:Int){
|
||||
mTitleState="$state"
|
||||
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package com.xjjk.healthyclients.ui.activity.guidance.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import com.sw.healthyclients.bean.guidance.DiseaseBean
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.adapter.common.CommonAdapter
|
||||
import com.xjjk.healthyclients.adapter.common.ViewHolder
|
||||
|
||||
class DiseaseAdapter(
|
||||
var mContext: Context?,
|
||||
var layoutId: Int,
|
||||
var datas: ArrayList<DiseaseBean>?,
|
||||
var method: () -> Unit
|
||||
) : CommonAdapter<DiseaseBean>(mContext, layoutId, datas) {
|
||||
override fun convert(holder: ViewHolder?, bean: DiseaseBean?, position: Int) {
|
||||
bean?.let{
|
||||
var doctorHint=""
|
||||
// if (it.doctorNum?.isNotEmpty() == true) {
|
||||
// doctorHint="(有${it.doctorNum}名专家)"
|
||||
// }
|
||||
holder?.getView<TextView>(R.id.item_recycler_seek_doctor_disease_child_name)?.setText(it.name)
|
||||
holder?.getView<TextView>(R.id.item_recycler_seek_doctor_disease_child_hint)?.setText(doctorHint)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.xjjk.healthyclients.ui.activity.guidance.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.adapter.common.CommonAdapter
|
||||
import com.xjjk.healthyclients.adapter.common.ViewHolder
|
||||
import com.xjjk.healthyclients.bean.guidance.DepartListBean
|
||||
|
||||
|
||||
class FilterSearchDepartment2Adapter(var mContext: Context, var layoutId: Int, var datas: ArrayList<DepartListBean>?) : CommonAdapter<DepartListBean>(mContext,layoutId,datas){
|
||||
override fun convert(holder: ViewHolder?, bean: DepartListBean?, position: Int) {
|
||||
holder?.getView<TextView>(R.id.item_key)?.let{
|
||||
it.text=bean?.departmentName
|
||||
}
|
||||
holder?.getView<LinearLayout>(R.id.item_department_root)?.let{
|
||||
if(bean?.isSelect == true){
|
||||
it.background=mContext.resources.getDrawable(R.color.white)
|
||||
}else{
|
||||
it.background=mContext.resources.getDrawable(R.color.service_menu_bg)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-113
@@ -1,113 +0,0 @@
|
||||
package com.xjjk.healthyclients.ui.activity.guidance.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.amap.api.maps.AMapUtils
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.adapter.common.CommonAdapter
|
||||
import com.xjjk.healthyclients.adapter.common.ViewHolder
|
||||
import com.xjjk.healthyclients.bean.guidance.HospitalchildBean
|
||||
import com.xjjk.healthyclients.superfuntion.loadRoundedImage
|
||||
import com.xjjk.healthyclients.utils.ConstantUtils
|
||||
import com.xjjk.healthyclients.utils.MapUtils
|
||||
import com.xjjk.healthyclients.view.WindowDialogView
|
||||
|
||||
|
||||
class SeekDoctorHospitalAdapter(var mContext: Context, var layoutId: Int, var datas: ArrayList<HospitalchildBean>?) : CommonAdapter<HospitalchildBean>(mContext,layoutId,datas){
|
||||
override fun convert(holder: ViewHolder?, bean: HospitalchildBean?, position: Int) {
|
||||
holder?.getView<ImageView>(R.id.item_recycler_seek_doctor_hospital_img)?.let{
|
||||
it.loadRoundedImage(bean?.img,5f, R.drawable.ic_hospital_default)
|
||||
}
|
||||
holder?.getView<TextView>(R.id.item_recycler_seek_doctor_hospital_tag)?.let{
|
||||
//医院等级
|
||||
it.text=bean?.tag
|
||||
}
|
||||
holder?.getView<TextView>(R.id.item_recycler_seek_doctor_hospital_name)?.let{
|
||||
//医院名称
|
||||
it.text=bean?.name
|
||||
}
|
||||
holder?.getView<TextView>(R.id.item_recycler_seek_doctor_hospital_department)?.let{
|
||||
//医院重点科室
|
||||
if (bean?.department?.isNotEmpty() == true) {
|
||||
it.text="重点科室: ${bean?.department}"
|
||||
}else{
|
||||
it.visibility=View.GONE
|
||||
}
|
||||
}
|
||||
holder?.getView<TextView>(R.id.item_recycler_seek_doctor_hospital_navigation)?.let{
|
||||
it.setOnClickListener {
|
||||
if (bean!=null) {
|
||||
goNavigation(bean.lat, bean.lon,mContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
holder?.getView<TextView>(R.id.item_recycler_seek_doctor_hospital_distance)?.let{
|
||||
//距离
|
||||
if (bean != null) {
|
||||
if(ConstantUtils.mCurrentLat==0.0|| ConstantUtils.mCurrentLon==0.0){
|
||||
it.text = "-- km"
|
||||
}else{
|
||||
var startLatLng = LatLng(ConstantUtils.mCurrentLat, ConstantUtils.mCurrentLon)
|
||||
var endLatLng = LatLng(bean.lat, bean.lon)
|
||||
var value = AMapUtils.calculateLineDistance(startLatLng, endLatLng) / 1000
|
||||
it.text = "${String.format("%.2f",value)} km"
|
||||
}
|
||||
it.visibility=View.VISIBLE
|
||||
}else{
|
||||
it.visibility=View.INVISIBLE
|
||||
}
|
||||
}
|
||||
holder?.getView<TextView>(R.id.item_recycler_seek_doctor_hospital_address)?.let{
|
||||
//地址
|
||||
if (bean != null) {
|
||||
var address=bean?.address
|
||||
it.text="${address}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun goNavigation(mLat: Double, mLon: Double, context: Context) {
|
||||
WindowDialogView.WindowDialogView(context, object :
|
||||
WindowDialogView.windowDialogListener {
|
||||
override fun onSelectText(position: Int, str: String?) {
|
||||
when (str) {
|
||||
"百度地图" -> {
|
||||
// showToastTxt = "手机未安装百度地图APP"
|
||||
val intent = Intent()
|
||||
val destination = MapUtils.gaoDeToLatLng(mLat, mLon);//转换坐标系
|
||||
//导航界面
|
||||
intent.setData(Uri.parse("baidumap://map/direction?destination=latlng:${destination.latitude},${destination.longitude}|name:目的地&coord_type=bd09ll&mode=driving"))
|
||||
//由于没获取到目的地地址,所以跳到目的地界面
|
||||
//intent.setData(Uri.parse("baidumap://map/geocoder?location=${item?.la},${item?.lg}&src=andr.baidu.openAPIdemo"))
|
||||
context?.startActivity(intent)
|
||||
|
||||
}
|
||||
|
||||
"高德地图" -> {
|
||||
// showToastTxt = "手机未安装高德地图APP"
|
||||
val intent = Intent()
|
||||
intent.setPackage("com.autonavi.minimap")
|
||||
intent.setAction(Intent.ACTION_VIEW)
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT)
|
||||
val destination = MapUtils.gaoDeToLatLng(mLat, mLon);//转换坐标系
|
||||
intent.setData(
|
||||
Uri.parse(
|
||||
"androidamap://route?sourceApplication=${context?.getString(R.string.app_name)}&" +
|
||||
"dlat=" + destination.latitude + "&dlon=" + destination.longitude + "&dname=目的地" + "&dev=0&t=0"
|
||||
)
|
||||
)
|
||||
context?.startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClose() {
|
||||
}
|
||||
}, MapUtils.isInstalled(context))
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package com.xjjk.healthyclients.ui.activity.guidance.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.adapter.common.CommonAdapter
|
||||
import com.xjjk.healthyclients.adapter.common.ViewHolder
|
||||
import com.xjjk.healthyclients.bean.guidance.SickListBean
|
||||
|
||||
|
||||
class SeekDoctorSick3Adapter(var mContext: Context, var layoutId: Int, var datas: ArrayList<SickListBean>?) : CommonAdapter<SickListBean>(mContext,layoutId,datas){
|
||||
override fun convert(holder: ViewHolder?, bean: SickListBean?, position: Int) {
|
||||
holder?.getView<TextView>(R.id.item_key)?.let{
|
||||
//医院名称
|
||||
it.text=bean?.sicksName
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -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?) {
|
||||
}
|
||||
}
|
||||
+77
@@ -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,70 +0,0 @@
|
||||
package com.xjjk.healthyclients.ui.viewmodel
|
||||
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||
import com.xjjk.healthyclients.bean.CommonSettingMenuBean
|
||||
import com.xjjk.healthyclients.bean.emergency.AddBigDiseaseSubmitBean
|
||||
import com.xjjk.healthyclients.bean.emergency.HospitalBean
|
||||
import com.xjjk.healthyclients.data.repository.EmergencyRepository
|
||||
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||
import com.xjjk.healthyclients.superfuntion.launch
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
class AddBigDiseaseViewModel : BaseViewModel() {
|
||||
var messageList = MutableStateFlow(ArrayList<HospitalBean>())
|
||||
var registerType = MutableStateFlow(mutableListOf<CommonSettingMenuBean>())
|
||||
var isSubmit = MutableStateFlow(false)
|
||||
|
||||
override fun init() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun selectStationHospitalList() {
|
||||
launch(tryBlock =
|
||||
{
|
||||
handleRequest(
|
||||
EmergencyRepository.selectStationHospitalList(),
|
||||
successBlock = {
|
||||
it.result?.let {
|
||||
messageList.emit(it)
|
||||
}
|
||||
})
|
||||
}, finallyBlock = {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增大病就医
|
||||
*/
|
||||
fun appointmentSeeDoctor(bean: AddBigDiseaseSubmitBean) {
|
||||
launch(tryBlock =
|
||||
{
|
||||
handleRequest(
|
||||
EmergencyRepository.appointmentSeeDoctor(bean),
|
||||
successBlock = {
|
||||
if (it.code==200) {
|
||||
isSubmit.emit(true)
|
||||
}
|
||||
})
|
||||
}, finallyBlock = {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getCommonSettingMenuList() {
|
||||
launch(tryBlock =
|
||||
{
|
||||
handleRequest(
|
||||
EmergencyRepository.getCommonSettingMenuList(),
|
||||
successBlock = {
|
||||
it.result?.let {
|
||||
registerType.emit(it)
|
||||
}
|
||||
})
|
||||
}, finallyBlock = {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.xjjk.healthyclients.ui.viewmodel
|
||||
|
||||
import com.sw.healthyclients.bean.guidance.DiseaseBean
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||
import com.xjjk.healthyclients.bean.guidance.DepartmentchildBean
|
||||
import com.xjjk.healthyclients.bean.guidance.HospitalchildBean
|
||||
import com.xjjk.healthyclients.bean.guidance.SearchDepartListBean
|
||||
import com.xjjk.healthyclients.data.repository.GuidanceRepository
|
||||
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||
import com.xjjk.healthyclients.superfuntion.launch
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
class DepartmentSearchViewModel: BaseViewModel() {
|
||||
var pag=1
|
||||
var pagNumber=100
|
||||
var mDepartmentSoure=MutableStateFlow(arrayListOf<DepartmentchildBean>()) //科室列表
|
||||
var mDepartmentSoureState = MutableSharedFlow<Boolean>()
|
||||
var mDataSoure=MutableStateFlow(ArrayList<SearchDepartListBean>()) //医院
|
||||
var mDiseaseSoure=MutableStateFlow(arrayListOf<DiseaseBean>()) //疾病
|
||||
var mDiseaseSoureState = MutableSharedFlow<Boolean>()
|
||||
var titleText = MutableStateFlow("")
|
||||
var mHospitalSoure=MutableStateFlow(ArrayList<HospitalchildBean>()) //医院列表
|
||||
override fun init() {
|
||||
// selectDoctorRecommend()
|
||||
}
|
||||
|
||||
/**
|
||||
* 疾病搜索
|
||||
*/
|
||||
fun searchconSicksList(value:String){
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.searchconSicksList(value,pag,pagNumber),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
var disease= arrayListOf<DiseaseBean>()
|
||||
for (index in 0 until result.size){
|
||||
var bean= DiseaseBean(result[index].sicksName)
|
||||
bean.id=result[index].id
|
||||
disease.add(bean)
|
||||
}
|
||||
mDiseaseSoure.emit(disease)
|
||||
if(disease.size==0){
|
||||
mDiseaseSoureState.emit(false)
|
||||
}else{
|
||||
mDiseaseSoureState.emit(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 医院搜索
|
||||
*/
|
||||
fun searchConResource(value:String){
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.searchConResource(value,pag,pagNumber),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
//专家
|
||||
var hospital= arrayListOf<HospitalchildBean>()
|
||||
for (index in 0 until result.size){
|
||||
var bean= HospitalchildBean()
|
||||
bean.id=result[index].id
|
||||
bean.img=result[index].img
|
||||
bean.tag=result[index].level
|
||||
bean.name=result[index].resourceName
|
||||
bean.department=result[index].keyDepartments
|
||||
bean.address=result[index].address
|
||||
bean.lon=result[index].longitude
|
||||
bean.lat=result[index].latitude
|
||||
hospital.add(bean)
|
||||
}
|
||||
mHospitalSoure.emit(hospital)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室搜索
|
||||
*/
|
||||
fun searchConDepartment(value:String){
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.searchConDepartment(value,pag,pagNumber),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
//科室
|
||||
var department= arrayListOf<DepartmentchildBean>()
|
||||
for (index in 0 until result.size){
|
||||
var bean= DepartmentchildBean()
|
||||
bean.departmentId=result[index].id
|
||||
bean.departmentImg=result[index].image
|
||||
bean.doctorNum=result[index].doctorNum
|
||||
bean.departmentName=result[index].departmentName
|
||||
bean.hint=result[index].mark
|
||||
department.add(bean)
|
||||
}
|
||||
mDepartmentSoure.emit(department)
|
||||
if(department.size==0){
|
||||
mDepartmentSoureState.emit(false)
|
||||
}else{
|
||||
mDepartmentSoureState.emit(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.xjjk.healthyclients.ui.viewmodel
|
||||
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||
import com.xjjk.healthyclients.bean.guidance.DoctorChildBean
|
||||
import com.xjjk.healthyclients.data.repository.GuidanceRepository
|
||||
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||
import com.xjjk.healthyclients.superfuntion.launch
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
class DoctorsGuidanceViewModel: BaseViewModel() {
|
||||
var mDoctorSoure=MutableStateFlow(arrayListOf<DoctorChildBean>()) //疾病
|
||||
|
||||
|
||||
override fun init() {
|
||||
}
|
||||
|
||||
fun selectDictListBySickAndDepartment(officeIds:ArrayList<String>,sicksIds:ArrayList<String>) {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.selectDictListBySickAndDepartment(officeIds,sicksIds),
|
||||
successBlock = {
|
||||
it.result?.let{result ->
|
||||
//疾病
|
||||
var doctorList= arrayListOf<DoctorChildBean>()
|
||||
for (index in 0 until result.size){
|
||||
var doctorBean= DoctorChildBean()
|
||||
doctorBean.id=result[index].id
|
||||
doctorBean.icon=result[index].photo
|
||||
doctorBean.name=result[index].doctorName
|
||||
doctorBean.title="${result[index].doctorTitle} ${result[index].departmentName.orEmpty()}"
|
||||
doctorBean.history="${result[index].type}"
|
||||
doctorBean.tag="${result[index].hospitalLevel}"
|
||||
doctorBean.hospitalName=result[index].resourceName
|
||||
doctorBean.tfShowFire=result[index].tfShowFire
|
||||
doctorBean.doctorStatus=result[index].doctorStatus
|
||||
doctorBean.audioStatus=result[index].audioStatus
|
||||
doctorBean.hint="擅长: ${result[index].goodAt}"
|
||||
doctorBean.evaluate="${result[index].overallMerit}"
|
||||
var Rate=result[index].responseRate
|
||||
if (Rate==null) {
|
||||
Rate="0.0"
|
||||
}
|
||||
doctorBean.reply="${Rate.toDouble()}%"
|
||||
doctorBean.guidanceNumber="${result[index].messageNum}"
|
||||
doctorList.add(doctorBean)
|
||||
}
|
||||
mDoctorSoure.emit(doctorList)
|
||||
}
|
||||
})
|
||||
}
|
||||
, finallyBlock = {
|
||||
println("请求结束了")
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
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.bean.emergency.EmergencyGroupInfo
|
||||
import com.xjjk.healthyclients.bean.emergency.GroupInfo
|
||||
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.superfuntion.handleRequest
|
||||
import com.xjjk.healthyclients.superfuntion.launch
|
||||
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
/**
|
||||
@@ -22,7 +26,7 @@ class EmergencyViewModel : BaseViewModel() {
|
||||
|
||||
// var titleList = MutableStateFlow(mutableListOf<EmergencyDictBean>())
|
||||
var markList = MutableStateFlow(mutableListOf<LocationResourceBean>())
|
||||
var sessionId = MutableStateFlow("")
|
||||
// var sessionId = MutableStateFlow("")
|
||||
|
||||
override fun init() {
|
||||
|
||||
@@ -33,10 +37,40 @@ class EmergencyViewModel : BaseViewModel() {
|
||||
{
|
||||
handleRequest(
|
||||
EmergencyRepository.getEmergencyData(type, latitude, longitude),
|
||||
successBlock = {
|
||||
successBlock = { response ->
|
||||
// it.result?.dicts?.let { list -> titleList.emit(list) }
|
||||
it.result?.resources?.let { list -> markList.emit(list) }
|
||||
it.result?.sessionId?.let { it1 -> sessionId.emit(it1) }
|
||||
// it.result?.resources?.let { list -> markList.emit(list) }
|
||||
// it.result?.sessionId?.let { it1 -> sessionId.emit(it1) }
|
||||
response.result?.let { markList.emit(it) }
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
@@ -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)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 附近医疗点
|
||||
|
||||
-263
@@ -1,263 +0,0 @@
|
||||
package com.xjjk.healthyclients.ui.viewmodel
|
||||
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||
import com.xjjk.healthyclients.bean.guidance.DepartListBean
|
||||
import com.xjjk.healthyclients.bean.guidance.DoctorChildBean
|
||||
import com.xjjk.healthyclients.bean.guidance.FilterSearchBean
|
||||
import com.xjjk.healthyclients.bean.guidance.SickListBean
|
||||
import com.xjjk.healthyclients.bean.guidance.selectDictListByNHDSRequestBean
|
||||
import com.xjjk.healthyclients.data.repository.GuidanceRepository
|
||||
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||
import com.xjjk.healthyclients.superfuntion.launch
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
class FilterSearchDoctorViewModel: BaseViewModel() {
|
||||
var mHospitalSoure=MutableStateFlow(ArrayList<FilterSearchBean>()) //医院列表
|
||||
var mDepartmentSoure=MutableStateFlow(arrayListOf<FilterSearchBean>()) //科室列表
|
||||
var mDiseaseSoure=MutableStateFlow(arrayListOf<FilterSearchBean>()) //疾病
|
||||
var mDoctorSoure=MutableStateFlow(arrayListOf<DoctorChildBean>()) //疾病
|
||||
|
||||
//科室
|
||||
var mLeftSoure = MutableStateFlow(ArrayList<DepartListBean>()) //科室和疾病左侧列表
|
||||
var mRightSoure = MutableStateFlow(arrayListOf<DepartListBean>()) //科室右侧列表
|
||||
//疾病
|
||||
var mLeftSickSoure = MutableStateFlow(ArrayList<DepartListBean>()) //疾病左侧列表
|
||||
var mRightSickSoure = MutableStateFlow(arrayListOf<SickListBean>())//疾病右侧列表
|
||||
var mCloseDialog = MutableStateFlow(false)//主动关闭dialog
|
||||
|
||||
var titleText = MutableStateFlow("")
|
||||
|
||||
override fun init() {
|
||||
selectHospitalList()
|
||||
}
|
||||
fun selectHospitalList() {
|
||||
launch(showDialog=false,
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.selectHospitalList(),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
// //疾病
|
||||
// var sickList= arrayListOf<FilterSearchBean>()
|
||||
// for (index in 0 until result.sickList.size){
|
||||
// var bean=FilterSearchBean()
|
||||
// bean.type=2
|
||||
// bean.sickId=result.sickList[index].id
|
||||
// bean.sicksName=result.sickList[index].sicksName
|
||||
// bean.sickDepartmentId=result.sickList[index].departmentId
|
||||
// sickList.add(bean)
|
||||
// }
|
||||
// mDiseaseSoure.emit(sickList)
|
||||
|
||||
//医院
|
||||
var hospitalList= arrayListOf<FilterSearchBean>()
|
||||
var bean=FilterSearchBean()
|
||||
bean.type=0
|
||||
bean.hospitalId=""
|
||||
bean.hospitalName="全部医院"
|
||||
hospitalList.add(bean)
|
||||
for (index in 0 until result.hostitalList.size){
|
||||
var bean=FilterSearchBean()
|
||||
bean.type=0
|
||||
bean.hospitalId=result.hostitalList[index].id
|
||||
bean.hospitalName=result.hostitalList[index].resourceName
|
||||
hospitalList.add(bean)
|
||||
}
|
||||
mHospitalSoure.emit(hospitalList)
|
||||
|
||||
// //科室
|
||||
// var departList= arrayListOf<FilterSearchBean>()
|
||||
// for (index in 0 until result.departList.size){
|
||||
// var bean=FilterSearchBean()
|
||||
// bean.type=1
|
||||
// bean.departmentid=result.departList[index].id
|
||||
// bean.departmentName=result.departList[index].departmentName
|
||||
// departList.add(bean)
|
||||
// }
|
||||
// mDepartmentSoure.emit(departList)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun selectDictListByNHDS(bean: selectDictListByNHDSRequestBean) {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.selectDictListByNHDS(bean),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
//疾病
|
||||
var doctorList= arrayListOf<DoctorChildBean>()
|
||||
for (index in 0 until result.size){
|
||||
var doctorBean= DoctorChildBean()
|
||||
doctorBean.id=result[index].id
|
||||
doctorBean.icon=result[index].photo
|
||||
doctorBean.name=result[index].doctorName
|
||||
doctorBean.title="${result[index].doctorTitle} ${result[index].departmentName.orEmpty()}"
|
||||
doctorBean.history="${result[index].type}"
|
||||
doctorBean.tag="${result[index].hospitalLevel}"
|
||||
doctorBean.hospitalName=result[index].resourceName
|
||||
doctorBean.tfShowFire=result[index].tfShowFire
|
||||
doctorBean.doctorStatus=result[index].doctorStatus
|
||||
doctorBean.audioStatus=result[index].audioStatus
|
||||
doctorBean.hint="擅长: ${result[index].goodAt}"
|
||||
doctorBean.evaluate="${result[index].overallMerit}"
|
||||
var Rate=result[index].responseRate
|
||||
if (Rate==null) {
|
||||
Rate="0.0"
|
||||
}
|
||||
doctorBean.reply="${Rate.toDouble()}%"
|
||||
doctorBean.guidanceNumber="${result[index].messageNum}"
|
||||
doctorList.add(doctorBean)
|
||||
}
|
||||
mDoctorSoure.emit(doctorList)
|
||||
}
|
||||
})
|
||||
}
|
||||
, finallyBlock = {
|
||||
println("请求结束了")
|
||||
mCloseDialog.emit(true)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室一级科室
|
||||
*/
|
||||
fun selectDepartListByHospitalId(hospitalId: String,departmentId: String) {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.selectDepartListByHospitalIdVersionTwo(hospitalId,departmentId),
|
||||
successBlock = {
|
||||
it.result?.let { result ->
|
||||
if (departmentId=="0") {
|
||||
var list = arrayListOf<DepartListBean>()
|
||||
var bean = DepartListBean()
|
||||
bean.id = "1"
|
||||
bean.departmentName = "全部科室"
|
||||
bean.secondDepartmentNum = result.list.size
|
||||
list.add(bean)
|
||||
list.addAll(result.list)
|
||||
mLeftSoure.emit(list)
|
||||
}else {
|
||||
var list = arrayListOf<DepartListBean>()
|
||||
var bean = DepartListBean()
|
||||
bean.id = departmentId
|
||||
// bean.departmentName = "全部医生(${result.doctorNum})"
|
||||
bean.departmentName = "全部医生"
|
||||
list.add(bean)
|
||||
list.addAll(result.list)
|
||||
mRightSoure.emit(list)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 二级科室
|
||||
*/
|
||||
fun selectDepartList(value: String) {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.selectDepartListNew(value),
|
||||
successBlock = {
|
||||
it.result?.let { result ->
|
||||
if (value == "") {
|
||||
var list = arrayListOf<DepartListBean>()
|
||||
var bean = DepartListBean()
|
||||
bean.id = " "
|
||||
bean.departmentName = "全部科室"
|
||||
bean.secondDepartmentNum = 0
|
||||
list.add(bean)
|
||||
list.addAll(result.list)
|
||||
mLeftSoure.emit(list)
|
||||
|
||||
} else {
|
||||
var list = arrayListOf<DepartListBean>()
|
||||
var bean = DepartListBean()
|
||||
bean.id = value
|
||||
// bean.departmentName = "全部医生(${result.doctorNum})"
|
||||
bean.departmentName = "全部医生"
|
||||
list.add(bean)
|
||||
list.addAll(result.list)
|
||||
mRightSoure.emit(list)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun selectDepartListSick(value: String){
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.selectDepartListSick(value),
|
||||
successBlock = {
|
||||
it.result?.let { result ->
|
||||
if (value == "0") {
|
||||
var list2 = arrayListOf<DepartListBean>()
|
||||
var bean2 = DepartListBean()
|
||||
bean2.id = "0"
|
||||
bean2.departmentName = "全部疾病"
|
||||
bean2.secondDepartmentNum = 0
|
||||
list2.add(bean2)
|
||||
list2.addAll(result)
|
||||
mLeftSickSoure.emit(list2)
|
||||
} else {
|
||||
var list = arrayListOf<DepartListBean>()
|
||||
var bean = DepartListBean()
|
||||
bean.id = value
|
||||
bean.departmentName = "全部医生"
|
||||
list.add(bean)
|
||||
var doctor=0
|
||||
for (index in 0 until result.size){
|
||||
doctor += result[index].sickNum
|
||||
var bean = DepartListBean()
|
||||
bean.id=result[index].id
|
||||
bean.departmentName=result[index].departmentName+"(${result[index].sickNum})"
|
||||
list.add(bean)
|
||||
}
|
||||
if(list.size>0){
|
||||
list[0].departmentName="全部(${doctor})"
|
||||
}
|
||||
// list.addAll(result)
|
||||
mRightSoure.emit(list)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 二级疾病
|
||||
*/
|
||||
fun selectSickListByDepartmentId(value: String) {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.selectSickListByDepartmentId(value),
|
||||
successBlock = {
|
||||
it.result?.let { result ->
|
||||
var list = arrayListOf<SickListBean>()
|
||||
if (value=="0"){
|
||||
var sick = SickListBean()
|
||||
sick.id = value
|
||||
sick.sicksName = "全部(${result.size})"
|
||||
list.add(sick)
|
||||
}
|
||||
list.addAll(result)
|
||||
mRightSickSoure.emit(list)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import com.sw.healthyclients.data.local.DataStoreManager
|
||||
import com.sw.healthyclients.utils.CustomActivityManager
|
||||
import com.sw.healthyclients.view.LoadingDialog
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||
import com.xjjk.healthyclients.bean.CardInfoBean
|
||||
import com.xjjk.healthyclients.bean.CardMessageReadLog
|
||||
import com.xjjk.healthyclients.bean.user.IMDoctorInfoBean
|
||||
import com.xjjk.healthyclients.data.repository.CommonRepository
|
||||
import com.xjjk.healthyclients.event.UserNoticeBean
|
||||
@@ -26,8 +28,11 @@ class MainViewModel : BaseViewModel() {
|
||||
var tokenOverdue = MutableSharedFlow<Boolean>()
|
||||
var timePrescription = MutableSharedFlow<String>()
|
||||
var selectTfHelper = MutableSharedFlow<Boolean>()
|
||||
var cardInfoString = MutableSharedFlow<CardMessageReadLog>()
|
||||
var submitNoticeChooseResult = MutableSharedFlow<Boolean>()
|
||||
var imDialog: LoadingDialog? = null
|
||||
|
||||
|
||||
override fun init() {
|
||||
// getNoticeData()
|
||||
checkTokenIsEffective()
|
||||
@@ -51,7 +56,7 @@ class MainViewModel : BaseViewModel() {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
CommonRepository.selectUserNotice("2"),
|
||||
CommonRepository.selectUserNotice("0"),
|
||||
successBlock = {
|
||||
it.result?.let { result ->
|
||||
noticeBean.emit(result)
|
||||
@@ -126,23 +131,31 @@ class MainViewModel : BaseViewModel() {
|
||||
if (it[index].text.isNotEmpty()) {
|
||||
DataStoreManager.saveUserAgreementUrl(
|
||||
UrlConfig.getH5BaseUrl(
|
||||
UrlConfig.baseUrlType)+ it[index].text)
|
||||
UrlConfig.baseUrlType
|
||||
) + it[index].text
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"2" -> {
|
||||
//隐私政策
|
||||
if (it[index].text.isNotEmpty()) {
|
||||
DataStoreManager.savePrivacyAgreementUrl(
|
||||
UrlConfig.getH5BaseUrl(
|
||||
UrlConfig.baseUrlType)+ it[index].text)
|
||||
UrlConfig.baseUrlType
|
||||
) + it[index].text
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"3" -> {
|
||||
//相关法律说明
|
||||
if (it[index].text.isNotEmpty()) {
|
||||
DataStoreManager.saveLawUrl(
|
||||
UrlConfig.getH5BaseUrl(
|
||||
UrlConfig.baseUrlType)+ it[index].text)
|
||||
UrlConfig.baseUrlType
|
||||
) + it[index].text
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,4 +205,23 @@ class MainViewModel : BaseViewModel() {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 医生卡片校验
|
||||
*/
|
||||
fun postCardInfo(info: CardInfoBean) {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
CommonRepository.postCardInfo(info),
|
||||
successBlock = {
|
||||
cardInfoString.emit(CardMessageReadLog(0,""))
|
||||
}, errorBlock = {
|
||||
cardInfoString.emit(CardMessageReadLog(1,it.message))
|
||||
true
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
-269
@@ -1,269 +0,0 @@
|
||||
package com.xjjk.healthyclients.ui.viewmodel
|
||||
|
||||
|
||||
import com.sw.healthyclients.bean.guidance.DiseaseBean
|
||||
import com.sw.healthyclients.utils.BigDecimalUtils
|
||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||
import com.xjjk.healthyclients.bean.guidance.DepartmentchildBean
|
||||
import com.xjjk.healthyclients.bean.guidance.DoctorChildBean
|
||||
import com.xjjk.healthyclients.bean.guidance.HospitalchildBean
|
||||
import com.xjjk.healthyclients.data.repository.GuidanceRepository
|
||||
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||
import com.xjjk.healthyclients.superfuntion.launch
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import java.math.BigDecimal
|
||||
|
||||
class SeekDoctorSearchActivityViewModel: BaseViewModel() {
|
||||
var pag=1
|
||||
var pagNumber=100
|
||||
var mHospitalSoure=MutableStateFlow(ArrayList<HospitalchildBean>()) //医院列表
|
||||
var mHospitalSoureState = MutableSharedFlow<Boolean>()
|
||||
var mAllState = MutableSharedFlow<Boolean>()
|
||||
var mDepartmentSoure=MutableStateFlow(arrayListOf<DepartmentchildBean>()) //科室列表
|
||||
var mDepartmentSoureState = MutableSharedFlow<Boolean>()
|
||||
var mDiseaseSoure=MutableStateFlow(arrayListOf<DiseaseBean>()) //疾病
|
||||
var mDiseaseSoureState = MutableSharedFlow<Boolean>()
|
||||
var mDoctorSoure=MutableStateFlow(arrayListOf<DoctorChildBean>()) //专家
|
||||
var mDoctorSoureState = MutableSharedFlow<Boolean>()
|
||||
override fun init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 综合搜索
|
||||
*/
|
||||
fun searchComprehensive(value:String) {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.searchComprehensive(value),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
//医院
|
||||
var hospital= arrayListOf<HospitalchildBean>()
|
||||
for (index in 0 until result.hospitalList.size){
|
||||
var bean=HospitalchildBean()
|
||||
bean.id=result.hospitalList[index].id
|
||||
bean.img=result.hospitalList[index].img
|
||||
bean.tag=result.hospitalList[index].level
|
||||
bean.name=result.hospitalList[index].resourceName
|
||||
bean.department=result.hospitalList[index].keyDepartments
|
||||
bean.address=result.hospitalList[index].address
|
||||
bean.lon=result.hospitalList[index].longitude
|
||||
bean.lat=result.hospitalList[index].latitude
|
||||
hospital.add(bean)
|
||||
}
|
||||
if(hospital.size==0){
|
||||
mHospitalSoureState.emit(false)
|
||||
}else{
|
||||
mHospitalSoureState.emit(true)
|
||||
}
|
||||
mHospitalSoure.emit(hospital)
|
||||
//科室
|
||||
var department= arrayListOf<DepartmentchildBean>()
|
||||
for (index in 0 until result.departmentList.size){
|
||||
var bean=DepartmentchildBean()
|
||||
bean.departmentId=result.departmentList[index].id
|
||||
bean.departmentImg=result.departmentList[index].image
|
||||
bean.departmentName=result.departmentList[index].departmentName
|
||||
bean.doctorNum=result.departmentList[index].doctorNum
|
||||
bean.hint=result.departmentList[index].mark
|
||||
department.add(bean)
|
||||
}
|
||||
mDepartmentSoure.emit(department)
|
||||
if(department.size==0){
|
||||
mDepartmentSoureState.emit(false)
|
||||
}else{
|
||||
mDepartmentSoureState.emit(true)
|
||||
}
|
||||
|
||||
//疾病
|
||||
var disease= arrayListOf<DiseaseBean>()
|
||||
for (index in 0 until result.sicksList.size){
|
||||
var bean= DiseaseBean(result.sicksList[index].sicksName)
|
||||
bean.id=result.sicksList[index].id
|
||||
disease.add(bean)
|
||||
}
|
||||
mDiseaseSoure.emit(disease)
|
||||
if(disease.size==0){
|
||||
mDiseaseSoureState.emit(false)
|
||||
}else{
|
||||
mDiseaseSoureState.emit(true)
|
||||
}
|
||||
//专家
|
||||
var doctor= arrayListOf<DoctorChildBean>()
|
||||
for (index in 0 until result.doctorList.size){
|
||||
var doctorBean=DoctorChildBean()
|
||||
doctorBean.id=result.doctorList[index].id
|
||||
doctorBean.icon=result.doctorList[index].photo
|
||||
doctorBean.name=result.doctorList[index].doctorName
|
||||
doctorBean.title="${result.doctorList[index].doctorTitle} ${result.doctorList[index].departmentName}"
|
||||
doctorBean.history="${result.doctorList[index].type}"
|
||||
doctorBean.tag="${result.doctorList[index].hospitalLevel}"
|
||||
doctorBean.tfShowFire=result.doctorList[index].tfShowFire
|
||||
doctorBean.hospitalName=result.doctorList[index].resourceName
|
||||
doctorBean.hint="擅长: ${result.doctorList[index].goodAt}"
|
||||
doctorBean.evaluate="${result.doctorList[index].overallMerit}"
|
||||
doctorBean.doctorStatus="${result.doctorList[index].doctorStatus}"
|
||||
doctorBean.audioStatus="${result.doctorList[index].audioStatus}"
|
||||
var Rate=result.doctorList[index].responseRate.toDouble()
|
||||
var tate2= BigDecimalUtils.multiply(Rate,100)
|
||||
doctorBean.reply="${String.format("%.2f",tate2)}%"
|
||||
doctorBean.guidanceNumber="${result.doctorList[index].messageNum}"
|
||||
doctor.add(doctorBean)
|
||||
}
|
||||
mDoctorSoure.emit(doctor)
|
||||
if(doctor.size==0){
|
||||
mDoctorSoureState.emit(false)
|
||||
}else{
|
||||
mDoctorSoureState.emit(true)
|
||||
}
|
||||
if(hospital.size==0&&department.size==0&&disease.size==0&&doctor.size==0){
|
||||
mAllState.emit(false)
|
||||
}else{
|
||||
mAllState.emit(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 专家搜索
|
||||
*/
|
||||
fun searchConDoctor(value:String){
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.searchConDoctor(value,pag,pagNumber),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
//专家
|
||||
var doctor= arrayListOf<DoctorChildBean>()
|
||||
for (index in 0 until result.size){
|
||||
var doctorBean= DoctorChildBean()
|
||||
doctorBean.icon=result[index].photo
|
||||
doctorBean.name=result[index].doctorName
|
||||
doctorBean.title="${result[index].doctorTitle} ${result[index].departmentName}"
|
||||
doctorBean.history="${result[index].type}"
|
||||
doctorBean.tag="${result[index].hospitalLevel}"
|
||||
doctorBean.hospitalName=result[index].resourceName
|
||||
doctorBean.id=result[index].id
|
||||
doctorBean.doctorStatus=result[index].doctorStatus
|
||||
doctorBean.audioStatus=result[index].audioStatus
|
||||
doctorBean.tfShowFire=result[index].tfShowFire
|
||||
doctorBean.hint="擅长: ${result[index].goodAt}"
|
||||
doctorBean.evaluate="${result[index].overallMerit}"
|
||||
var Rate=result[index].responseRate.toDouble()
|
||||
doctorBean.reply="${Rate*100}%"
|
||||
doctorBean.guidanceNumber="${result[index].messageNum}"
|
||||
doctor.add(doctorBean)
|
||||
}
|
||||
mDoctorSoure.emit(doctor)
|
||||
if(doctor.size==0){
|
||||
mDoctorSoureState.emit(false)
|
||||
}else{
|
||||
mDoctorSoureState.emit(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 专家搜索
|
||||
*/
|
||||
fun searchConResource(value:String){
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.searchConResource(value,pag,pagNumber),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
//专家
|
||||
var hospital= arrayListOf<HospitalchildBean>()
|
||||
for (index in 0 until result.size){
|
||||
var bean= HospitalchildBean()
|
||||
bean.id=result[index].id
|
||||
bean.img=result[index].img
|
||||
bean.tag=result[index].level
|
||||
bean.name=result[index].resourceName
|
||||
bean.department=result[index].keyDepartments
|
||||
bean.address=result[index].address
|
||||
bean.lon=result[index].longitude
|
||||
bean.lat=result[index].latitude
|
||||
hospital.add(bean)
|
||||
}
|
||||
mHospitalSoure.emit(hospital)
|
||||
if(hospital.size==0){
|
||||
mHospitalSoureState.emit(false)
|
||||
}else{
|
||||
mHospitalSoureState.emit(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
/**
|
||||
* 专家搜索
|
||||
*/
|
||||
fun searchconSicksList(value:String){
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.searchconSicksList(value,pag,pagNumber),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
var disease= arrayListOf<DiseaseBean>()
|
||||
for (index in 0 until result.size){
|
||||
var bean= DiseaseBean(result[index].sicksName)
|
||||
bean.id=result[index].id
|
||||
disease.add(bean)
|
||||
}
|
||||
mDiseaseSoure.emit(disease)
|
||||
if(disease.size==0){
|
||||
mDiseaseSoureState.emit(false)
|
||||
}else{
|
||||
mDiseaseSoureState.emit(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
/**
|
||||
* 科室搜索
|
||||
*/
|
||||
fun searchConDepartment(value:String){
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
GuidanceRepository.searchConDepartment(value,pag,pagNumber),
|
||||
successBlock = {
|
||||
it.result?.let{ result ->
|
||||
//科室
|
||||
var department= arrayListOf<DepartmentchildBean>()
|
||||
for (index in 0 until result.size){
|
||||
var bean= DepartmentchildBean()
|
||||
bean.departmentId=result[index].id
|
||||
bean.departmentImg=result[index].image
|
||||
bean.departmentName=result[index].departmentName
|
||||
bean.doctorNum=result[index].doctorNum
|
||||
bean.hint=result[index].mark
|
||||
department.add(bean)
|
||||
}
|
||||
mDepartmentSoure.emit(department)
|
||||
if(department.size==0){
|
||||
mDepartmentSoureState.emit(false)
|
||||
}else{
|
||||
mDepartmentSoureState.emit(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
fun finishActivity() {
|
||||
context.runOnUiThread {
|
||||
EventBus.getDefault().post(WebReloadEvent())
|
||||
context.finish()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ object ConstantUtils {
|
||||
var mCurrentLon = 87.627704
|
||||
var mNutritionMonitor = false
|
||||
var mIsCloseDialog = false
|
||||
var mPrivacy = "本平台由西安仁康信息科技有限公司开发和运维,平台深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则,保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。同时,我们承诺将采取相应的安全保护措施来保护您的个人信息。请在使用平台服务前,仔细阅读并了解本隐私权政策,我们将按照本政策收集、处理及披露您的信息。\n" +
|
||||
|
||||
val APP_ID: String = "wxb33cd60beda0a212"
|
||||
var mPrivacy = "本平台由西安联链科技有限公司开发和运维,平台深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则,保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。同时,我们承诺将采取相应的安全保护措施来保护您的个人信息。请在使用平台服务前,仔细阅读并了解本隐私权政策,我们将按照本政策收集、处理及披露您的信息。\n" +
|
||||
"本政策将帮助您了解以下内容:\n" +
|
||||
"1、定义\n" +
|
||||
"2、我们可能收集的信息\n" +
|
||||
@@ -263,9 +265,7 @@ object ConstantUtils {
|
||||
"7、 我们还会将本声明和隐私的旧版本存档,供您查阅。\n" +
|
||||
"十一、如何联系我们\n" +
|
||||
"1.如果您对本政策有任何疑问、意见或建议,可通过以下方式与我们联系:\n" +
|
||||
"(1)拨打客服热线电话029-86581752\n" +
|
||||
"(2)发送电子邮件至123456789@qq.com\n" +
|
||||
"(3)邮寄地址:陕西省西安市未央区未央路151号,收件人:陈天宇\n" +
|
||||
"(1)发送电子邮件至lilong@xalianlian.cn\n" +
|
||||
"我们的客服部门将会同个人信息保护部门30天内进行回复,并协助解决您的问题。\n" +
|
||||
"2.如果您对我们的回复不满意,特别是我们的个人信息处理行为损害了您的合法权益,您还可以通过以下外部途径寻求解决方式:向网信、工商、公安等监管部门进行投诉或举报。"
|
||||
@Parcelize
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.xjjk.healthyclients.utils
|
||||
|
||||
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.setting.InputActionSetting
|
||||
import com.xjjk.healthyclients.BuildConfig
|
||||
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||
|
||||
object IMInputActionSettingUtils {
|
||||
/**
|
||||
* 应急就医IM功能配置
|
||||
*/
|
||||
fun createEmergencySetting(){
|
||||
fun createEmergencySetting(firstAid: Boolean = false){//是否为急救员
|
||||
var inputActionSetting = InputActionSetting.createInstance()
|
||||
inputActionSetting.packageName = BuildConfig.APPLICATION_ID
|
||||
inputActionSetting.CurrentResourceHost = UrlConfig.IMAGE_BASE_URL
|
||||
@@ -20,6 +20,7 @@ object IMInputActionSettingUtils {
|
||||
inputActionSetting.isDisableMedicalExaminationReport = true
|
||||
inputActionSetting.isDisableSendMessage = false
|
||||
inputActionSetting.isDisableFinishSession = false
|
||||
inputActionSetting.isFirstAid = firstAid
|
||||
}
|
||||
/**
|
||||
* 图文咨询IM功能配置
|
||||
@@ -33,7 +34,7 @@ object IMInputActionSettingUtils {
|
||||
inputActionSetting.isDisableArchives = false
|
||||
inputActionSetting.disableFinishName = false
|
||||
inputActionSetting.disableEvaluate = disableEvaluate
|
||||
inputActionSetting.isDisableMedicalExaminationReport = !isSelf
|
||||
inputActionSetting.isDisableMedicalExaminationReport = true
|
||||
inputActionSetting.isDisableSendMessage = disableSendMessage
|
||||
inputActionSetting.isDisableFinishSession = false
|
||||
}
|
||||
@@ -53,20 +54,20 @@ object IMInputActionSettingUtils {
|
||||
inputActionSetting.isDisableSendMessage = false
|
||||
inputActionSetting.isDisableFinishSession = false
|
||||
}
|
||||
/**
|
||||
* 急救联动IM功能配置
|
||||
*/
|
||||
fun createEmergencyLinkageSetting(){
|
||||
var inputActionSetting = InputActionSetting.createInstance()
|
||||
inputActionSetting.packageName = BuildConfig.APPLICATION_ID
|
||||
inputActionSetting.CurrentResourceHost = UrlConfig.IMAGE_BASE_URL
|
||||
inputActionSetting.isDisableAudioCall = false
|
||||
inputActionSetting.isDisableVideoCall = false
|
||||
inputActionSetting.isDisableArchives = true
|
||||
inputActionSetting.disableFinishName = false
|
||||
inputActionSetting.disableEvaluate = false
|
||||
inputActionSetting.isDisableMedicalExaminationReport = true
|
||||
inputActionSetting.isDisableSendMessage = false
|
||||
inputActionSetting.isDisableFinishSession = false
|
||||
}
|
||||
// /**
|
||||
// * 急救联动IM功能配置
|
||||
// */
|
||||
// fun createEmergencyLinkageSetting(){
|
||||
// var inputActionSetting = InputActionSetting.createInstance()
|
||||
// inputActionSetting.packageName = BuildConfig.APPLICATION_ID
|
||||
// inputActionSetting.CurrentResourceHost = UrlConfig.IMAGE_BASE_URL
|
||||
// inputActionSetting.isDisableAudioCall = false
|
||||
// inputActionSetting.isDisableVideoCall = false
|
||||
// inputActionSetting.isDisableArchives = true
|
||||
// inputActionSetting.disableFinishName = false
|
||||
// inputActionSetting.disableEvaluate = false
|
||||
// inputActionSetting.isDisableMedicalExaminationReport = true
|
||||
// inputActionSetting.isDisableSendMessage = false
|
||||
// inputActionSetting.isDisableFinishSession = false
|
||||
// }
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class LocationManager(
|
||||
// bean.address = aMapLocation.address
|
||||
// bean.locationDetail = locationDetail
|
||||
// locationCallBack!!.onLocationInfo(bean)
|
||||
println("定位${aMapLocation.latitude}--${aMapLocation.longitude}")
|
||||
Logger.i("定位${aMapLocation.latitude}--${aMapLocation.longitude}")
|
||||
ConstantUtils.mCurrentLat=aMapLocation.latitude
|
||||
ConstantUtils.mCurrentLon=aMapLocation.longitude
|
||||
//保存经纬度到本地文件(长链接没有连接时)
|
||||
|
||||
@@ -36,8 +36,12 @@ public class MapUtils {
|
||||
public static void setMapZoonlo(AMap map, int padding, LatLngBounds.Builder builder){
|
||||
LatLngBounds bounds = builder.build();
|
||||
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding));
|
||||
|
||||
}
|
||||
|
||||
public static void setMapZoonloAndZoom(AMap map, LatLng latLng, int zoom){
|
||||
map.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng,zoom));
|
||||
}
|
||||
|
||||
public static void setMapZoonlo(AMap map, int padding, ArrayList<LocationResourceBean> list){
|
||||
LatLngBounds.Builder builder = LatLngBounds.builder();
|
||||
if (list==null||list.size()==0) {
|
||||
|
||||
@@ -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,66 +0,0 @@
|
||||
package com.xjjk.healthyclients.utils;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class SystemUtils {
|
||||
public static boolean isSignedWithReleaseCert(Context context) {
|
||||
// TODO: 2024/7/9 应要求,正式签名包不做应用内检查更新,故做此签名判断
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES);
|
||||
Signature[] signatures = packageInfo.signatures;
|
||||
|
||||
// 通常正式签名的SHA1值是已知的,可以将其与应用的签名进行比对。
|
||||
// 这里假设已知的正式签名SHA1值是 "YOUR_RELEASE_CERT_SHA1_HASH"
|
||||
String knownReleaseSignatureSha1 = "CD:5D:30:3C:B7:D0:1A:D2:E6:0D:DE:96:71:5B:59:AB:C5:3C:C5:92";
|
||||
|
||||
for (Signature signature : signatures) {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||
md.update(signature.toByteArray());
|
||||
String currentSignatureSha1 = SystemUtils.byte2HexFormatted(md.digest());
|
||||
System.out.println("计算出的签名--" + currentSignatureSha1);
|
||||
// String currentSignatureSha1 = android.util.Base64.encodeToString(md.digest(), android.util.Base64.DEFAULT).trim();
|
||||
if (knownReleaseSignatureSha1.equals(currentSignatureSha1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String byte2HexFormatted(byte[] arr) {
|
||||
StringBuilder str = new StringBuilder(arr.length * 2);
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
String h = Integer.toHexString(arr[i]);
|
||||
int l = h.length();
|
||||
if (l == 1)
|
||||
h = "0" + h;
|
||||
if (l > 2)
|
||||
h = h.substring(l - 2, l);
|
||||
str.append(h.toUpperCase());
|
||||
if (i < (arr.length - 1))
|
||||
str.append(':');
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
public static void copyTextToClipboard(Context context, String string) {
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("label", string);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(context, "已复制", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
@@ -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.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
@@ -21,17 +20,11 @@ import com.xjjk.healthyclients.databinding.DialogAppraiseBinding
|
||||
class AppraiseDialog constructor(
|
||||
context: Context
|
||||
) : AlertDialog(context) {
|
||||
lateinit var mOnSubmitClickListener: OnSubmitClickListener
|
||||
// 提交点击监听器
|
||||
var mOnSubmitClickListener: OnSubmitClickListener?=null
|
||||
// 数据绑定对象
|
||||
lateinit var binding: DialogAppraiseBinding
|
||||
|
||||
init {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
create()
|
||||
} else {
|
||||
onCreate(null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = DataBindingUtil.inflate(
|
||||
@@ -51,15 +44,11 @@ class AppraiseDialog constructor(
|
||||
CustomToast.makeText(context, "您还没有选择星级评分", Toast.LENGTH_SHORT).show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (this::mOnSubmitClickListener.isInitialized) {
|
||||
mOnSubmitClickListener?.onSubmitClick(this@AppraiseDialog)
|
||||
}
|
||||
this.cancel()
|
||||
}
|
||||
binding.btnClose.setOnClickListener {
|
||||
if (this::mOnSubmitClickListener.isInitialized) {
|
||||
mOnSubmitClickListener?.onCancelClick(this@AppraiseDialog)
|
||||
}
|
||||
this.cancel()
|
||||
}
|
||||
|
||||
@@ -70,11 +59,26 @@ class AppraiseDialog constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* 评分提交回调接口
|
||||
*/
|
||||
interface OnSubmitClickListener {
|
||||
/**
|
||||
* 提交按钮点击回调
|
||||
*/
|
||||
fun onSubmitClick(viewDialog: AppraiseDialog)
|
||||
/**
|
||||
* 关闭按钮点击回调
|
||||
*/
|
||||
fun onCancelClick(viewDialog: AppraiseDialog){}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置对话框标题
|
||||
* @param title 标题文本
|
||||
* @param titleSize 标题字体大小,默认 18f
|
||||
* @return 返回当前对象,支持链式调用
|
||||
*/
|
||||
fun setDialogTitle(title: String, titleSize: Float = 18f): AppraiseDialog {
|
||||
binding.tvTitle.visibility = View.VISIBLE
|
||||
binding.tvTitle.text = title
|
||||
@@ -82,35 +86,67 @@ class AppraiseDialog constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置评价内容输入框提示文本
|
||||
* @param text 提示文本
|
||||
* @param textSize 字体大小,默认 13f
|
||||
* @return 返回当前对象,支持链式调用
|
||||
*/
|
||||
fun setContentHint(text: String, textSize: Float = 13f): AppraiseDialog {
|
||||
binding.etAppraise.hint = text
|
||||
binding.etAppraise.textSize = textSize
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置提交按钮文本
|
||||
* @param text 按钮文本
|
||||
* @param btnTextSize 字体大小,默认 18f
|
||||
* @return 返回当前对象,支持链式调用
|
||||
*/
|
||||
fun setBtnText(text: String, btnTextSize: Float = 18f): AppraiseDialog {
|
||||
binding.btnSubmit.text = text
|
||||
binding.btnSubmit.textSize = btnTextSize
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置对话框是否可取消
|
||||
* @param flag true 可取消,false 不可取消
|
||||
* @return 返回当前对象,支持链式调用
|
||||
*/
|
||||
fun setDialogCancelable(flag: Boolean): AppraiseDialog {
|
||||
setCancelable(flag)
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户输入的评价内容
|
||||
* @return 评价文本
|
||||
*/
|
||||
fun getAppraiseContext(): String {
|
||||
return binding.etAppraise.text.trim().toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评分条控件
|
||||
* @return RatingBar 对象
|
||||
*/
|
||||
fun getRatingBar(): 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 {
|
||||
return binding.cbAnonymity.isChecked
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
package com.xjjk.healthyclients.view
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.bean.CvdRiskInfoBean
|
||||
import com.xjjk.healthyclients.bean.MapDataBean
|
||||
import com.xjjk.healthyclients.databinding.CustomCvdDiseaseWarningViewBinding
|
||||
import com.xjjk.healthyclients.retrofit.UrlConfig
|
||||
import com.xjjk.healthyclients.superfuntion.orEmptyDefault
|
||||
import com.xjjk.healthyclients.superfuntion.startWebActivity
|
||||
import com.xjjk.healthyclients.utils.UrlH5RouteUtils
|
||||
|
||||
class CustomCvdMainDiseaseWarningView : RelativeLayout {
|
||||
|
||||
var mContext:Context?=null
|
||||
lateinit var mBinding: CustomCvdDiseaseWarningViewBinding
|
||||
var mList = arrayListOf<MapDataBean>()
|
||||
var mType=1
|
||||
var mBean: CvdRiskInfoBean?=CvdRiskInfoBean()
|
||||
constructor(context: Context?,attrs : AttributeSet?): super(context, attrs,0){
|
||||
mContext=context
|
||||
if(isInEditMode){
|
||||
LayoutInflater.from(context).inflate(R.layout.custom_cvd_disease_warning_view, this, true)
|
||||
}else{
|
||||
mBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(context),
|
||||
R.layout.custom_cvd_disease_warning_view, this,true)
|
||||
}
|
||||
event()
|
||||
noAnswer()
|
||||
}
|
||||
fun initView(type:Int){
|
||||
mType=type
|
||||
if(mType==1){
|
||||
mBinding.viewChildTitle1.text="突发心梗风险"
|
||||
mBinding.viewChildTitle2.text="突发猝死风险"
|
||||
}else{
|
||||
mBinding.viewChildTitle1.text="突发脑梗风险"
|
||||
mBinding.viewChildTitle2.text="突发脑出血风险"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun answerState(boolean: Boolean){
|
||||
//初始化调用
|
||||
if (boolean) {
|
||||
noAnswer(true)
|
||||
}else{
|
||||
noAnswer()
|
||||
}
|
||||
// mBinding.viewNoAnswer.visibility=View.VISIBLE
|
||||
// mBinding.viewAnswer.visibility=View.GONE
|
||||
//调用接口检查是否填写问卷
|
||||
}
|
||||
|
||||
fun noAnswer(answer : Boolean=false){
|
||||
if (answer) {
|
||||
mBinding.viewNoAnswer.visibility=View.GONE
|
||||
mBinding.viewEditAnswer.visibility=View.VISIBLE
|
||||
mBinding.viewAnswer.visibility=View.VISIBLE
|
||||
}else{
|
||||
mBinding.viewNoAnswer.visibility=View.VISIBLE
|
||||
mBinding.viewEditAnswer.visibility=View.INVISIBLE
|
||||
mBinding.viewAnswer.visibility=View.GONE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun setRiskInfo(bean: CvdRiskInfoBean?){
|
||||
//调用接口查询疾病信息
|
||||
if(bean!=null){
|
||||
copyData(bean)
|
||||
//有数据进行填充
|
||||
try {
|
||||
if(mType==1){
|
||||
//心梗
|
||||
mBinding.viewTvLevel.setText(bean.riskMiValueName.orEmptyDefault())
|
||||
mBinding.viewTvLevel.setTextColor(Color.parseColor(bean.riskMiValueColor))
|
||||
mBinding.viewTvTime.setText(bean.warningData)
|
||||
//猝死
|
||||
mBinding.viewTvLevel2.setText(bean.riskSuddenDeathValueName.orEmptyDefault())
|
||||
mBinding.viewTvLevel2.setTextColor(Color.parseColor(bean.riskSuddenDeathValueColor))
|
||||
mBinding.viewTvTime2.setText(bean.warningData)
|
||||
}else{
|
||||
//脑梗
|
||||
mBinding.viewTvLevel.setText(bean.riskCiValueName.orEmptyDefault())
|
||||
mBinding.viewTvLevel.setTextColor(Color.parseColor(bean.riskCiValueColor))
|
||||
mBinding.viewTvTime.setText(bean.warningData)
|
||||
//脑出血
|
||||
mBinding.viewTvLevel2.setText(bean.riskChValueName.orEmptyDefault())
|
||||
mBinding.viewTvLevel2.setTextColor(Color.parseColor(bean.riskChValueColor))
|
||||
mBinding.viewTvTime2.setText(bean.warningData)
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}else{
|
||||
mBinding.viewEmptyData1.visibility=View.VISIBLE
|
||||
mBinding.viewEmptyData2.visibility=View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyData(bean: CvdRiskInfoBean?) {
|
||||
mBean?.id=bean?.id
|
||||
mBean?.riskMiValueName=bean?.riskMiValueName
|
||||
mBean?.riskMiValueColor=bean?.riskMiValueColor
|
||||
mBean?.riskCiValueName=bean?.riskCiValueName
|
||||
mBean?.riskCiValueColor=bean?.riskCiValueColor
|
||||
mBean?.riskSuddenDeathValueName=bean?.riskSuddenDeathValueName
|
||||
mBean?.riskSuddenDeathValueColor=bean?.riskSuddenDeathValueColor
|
||||
mBean?.riskChValueName=bean?.riskChValueName
|
||||
mBean?.riskChValueColor=bean?.riskChValueColor
|
||||
}
|
||||
|
||||
fun event(){
|
||||
mBinding.startAnswer.setOnClickListener {
|
||||
//填写问卷
|
||||
var map = mutableMapOf<String, Any?>()
|
||||
map["heartType"] = mType
|
||||
mContext?.startWebActivity(UrlConfig.getKnowledgeDetailUrl(UrlH5RouteUtils.HEART_ATTACK,map))
|
||||
}
|
||||
mBinding.viewEditAnswer.setOnClickListener {
|
||||
//修改问卷
|
||||
var map = mutableMapOf<String, Any?>()
|
||||
map["heartType"] = mType
|
||||
mContext?.startWebActivity(UrlConfig.getKnowledgeDetailUrl(UrlH5RouteUtils.HEART_ATTACK,map))
|
||||
}
|
||||
|
||||
mBinding.viewRlOne.setOnClickListener {
|
||||
var map = mutableMapOf<String, Any?>()
|
||||
map["hriskId"] = mBean?.id
|
||||
|
||||
if (mType==1) {
|
||||
map["hriskName"] = "突发心梗风险"
|
||||
map["hriskType"] = "1"
|
||||
map["hriskLevel"] = mBean?.riskMiValueName
|
||||
map["hriskColor"] = mBean?.riskMiValueColor
|
||||
}else{
|
||||
map["hriskName"] = "突发脑梗风险"
|
||||
map["hriskType"] = "3"
|
||||
map["hriskLevel"] = mBean?.riskCiValueName
|
||||
map["hriskColor"] = mBean?.riskCiValueColor
|
||||
}
|
||||
mContext?.startWebActivity(UrlConfig.getKnowledgeDetailUrl(UrlH5RouteUtils.HEART_FACTORS,map))
|
||||
}
|
||||
mBinding.viewRlTwo.setOnClickListener {
|
||||
var map = mutableMapOf<String, Any?>()
|
||||
map["hriskId"] = mBean?.id
|
||||
if (mType==1) {
|
||||
map["hriskName"] = "突发猝死风险"
|
||||
map["hriskType"] = "2"
|
||||
map["hriskLevel"] = mBean?.riskSuddenDeathValueName
|
||||
map["hriskColor"] = mBean?.riskSuddenDeathValueColor
|
||||
}else{
|
||||
map["hriskName"] = "突发脑出血风险"
|
||||
map["hriskType"] = "4"
|
||||
map["hriskLevel"] = mBean?.riskChValueName
|
||||
map["hriskColor"] = mBean?.riskChValueColor
|
||||
}
|
||||
mContext?.startWebActivity(UrlConfig.getKnowledgeDetailUrl(UrlH5RouteUtils.HEART_FACTORS,map))
|
||||
}
|
||||
}
|
||||
|
||||
fun setlevel(view :View){
|
||||
if (view is TextView) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -8,12 +8,12 @@ import android.view.LayoutInflater
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.databinding.CustomPasswordViewBinding
|
||||
import com.xjjk.healthyclients.databinding.CustomPasswordViewNewBinding
|
||||
|
||||
class CustomPasswordView : RelativeLayout {
|
||||
|
||||
var mContext:Context?=null
|
||||
lateinit var mBinding: CustomPasswordViewBinding
|
||||
lateinit var mBinding: CustomPasswordViewNewBinding
|
||||
constructor(context: Context?,attrs : AttributeSet?): super(context, attrs,0){
|
||||
mContext=context
|
||||
// if(isInEditMode){
|
||||
@@ -21,7 +21,7 @@ class CustomPasswordView : RelativeLayout {
|
||||
// }else{
|
||||
mBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(context),
|
||||
R.layout.custom_password_view, this,true)
|
||||
R.layout.custom_password_view_new, this,true)
|
||||
// }
|
||||
mBinding.loginEtUserPassword.setTransformationMethod(PasswordTransformationMethod.getInstance())
|
||||
mBinding.loginIvEye.setOnClickListener {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user