commit 7847e677793eabc1b16ac2ce61fa88b2579f9822 Author: zhanglei <350328959@qq.com> Date: Wed Jun 25 16:55:14 2025 +0800 首次提交 diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..bbf8763 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,18 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties +.idea/ +.idea/gradle.xml +.idea/misc.xml diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..1b9f024 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,142 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' +// id 'kotlin-android-extensions' + id 'kotlin-kapt' + id 'org.jetbrains.kotlin.android' + id 'kotlin-parcelize' +} + +android { + compileSdk rootProject.ext.compileSdkVersion + + defaultConfig { + applicationId "com.xjjk.healthyclients" + minSdk rootProject.ext.minSdkVersion + targetSdk rootProject.ext.targetSdkVersion + versionCode rootProject.ext.versionCode + versionName rootProject.ext.versionName + + ndk { + // 选择实际需要的cpu架构 + abiFilters 'armeabi-v7a', 'arm64-v8a'//, 'x86', 'x86_64' + } +// manifestPlaceholders = [ +// JPUSH_PKGNAME : applicationId, +// JPUSH_APPKEY : "45f403286fced2b6dda971f9", //JPush 上注册的包名对应的 Appkey. +// JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可. +// XIAOMI_APPID : "MI-小米的APPID", +// XIAOMI_APPKEY : "MI-小米的APPKEY", +// OPPO_APPKEY : "OP-oppo的APPKEY", +// OPPO_APPID : "OP-oppo的APPID", +// OPPO_APPSECRET : "OP-oppo的APPSECRET", +// VIVO_APPKEY : "vivo的APPKEY", +// VIVO_APPID : "vivo的APPID", +// HONOR_APPID : "Honor的APP ID" +// ] + } + + signingConfigs{ + release { + storeFile file('/key/yxjk-release.jks') + storePassword "yxjk1234" + keyAlias "yxjk" + keyPassword "yxjk1234" + } + } + + buildTypes { + debug { +// debuggable false + signingConfig signingConfigs.release + } + release { + 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) + } + } + + + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + kotlinOptions { + jvmTarget = '1.8' + } + packagingOptions { + exclude 'META-INF/gradle/incremental.annotation.processors' + exclude 'DebugProbesKt.bin' + } + testOptions { + unitTests.returnDefaultValues = true + } + dataBinding { + enabled = true + } + kapt { + generateStubs = true + } + sourceSets { + main { + jniLibs.srcDirs = ['libs'] + res.srcDirs = [ + 'src/main/res-login', + 'src/main/res-health-check', + 'src/main/res-health-record', +// 'src/main/res-intervention', + 'src/main/res-intervention2', + 'src/main/res-gastrointestinal', + 'src/main/res-guidance', + 'src/main/res-dossier', + 'src/main/res-emergency', + 'src/main/res-service-centre', + 'src/main/res-user', + 'src/main/res-knowledge', + 'src/main/res-other', + 'src/main/res' + ] + } + } +} + +dependencies { + implementation files('libs\\BASE64Encoder.jar') + implementation files('libs\\com.heytap.msp_3.1.0.aar') + //CGM +// implementation files('libs/cgmlib-release.aar') +// implementation files('libs/blecomm-release.aar') +// implementation files('libs/cgat-release.aar') +// implementation files('libs/bgmlib-release.aar') + + + /*高德地图*/ + implementation rootProject.ext.mapLibs + + implementation project(path: ':video') + implementation project(path: ':core') +// implementation project(path: ':ALibs') + implementation project(path: ':rsalibrary') + implementation project(path: ':AgentWebCore') + implementation project(path: ':AAChartCore') + implementation project(path: ':xpopup') + + implementation project(':tuichat') + implementation project(':tuicontact') + implementation project(':tuiconversation') + implementation project(':tuigroup') + implementation project(':tuicallkit') + + //JSoup + api 'org.jsoup:jsoup:1.12.1' + + +} \ No newline at end of file diff --git a/app/key/yxjk-release.jks b/app/key/yxjk-release.jks new file mode 100644 index 0000000..3ded6fb Binary files /dev/null and b/app/key/yxjk-release.jks differ diff --git a/app/libs/BASE64Encoder.jar b/app/libs/BASE64Encoder.jar new file mode 100644 index 0000000..3500f7b Binary files /dev/null and b/app/libs/BASE64Encoder.jar differ diff --git a/app/libs/bgmlib-release.aar b/app/libs/bgmlib-release.aar new file mode 100644 index 0000000..e051117 Binary files /dev/null and b/app/libs/bgmlib-release.aar differ diff --git a/app/libs/blecomm-release.aar b/app/libs/blecomm-release.aar new file mode 100644 index 0000000..04a83cb Binary files /dev/null and b/app/libs/blecomm-release.aar differ diff --git a/app/libs/cgat-release.aar b/app/libs/cgat-release.aar new file mode 100644 index 0000000..2be1fbc Binary files /dev/null and b/app/libs/cgat-release.aar differ diff --git a/app/libs/cgmlib-release.aar b/app/libs/cgmlib-release.aar new file mode 100644 index 0000000..688eefc Binary files /dev/null and b/app/libs/cgmlib-release.aar differ diff --git a/app/libs/com.heytap.msp_3.1.0.aar b/app/libs/com.heytap.msp_3.1.0.aar new file mode 100644 index 0000000..48940ff Binary files /dev/null and b/app/libs/com.heytap.msp_3.1.0.aar differ diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..c6c1bc6 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,147 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile + +#基本指令区 +-optimizationpasses 5 #指定压缩级别 +-optimizations !code/simplification/arithmetic,!field/,!class/merging/ #混淆时采用的算法 +-verbose #打印混淆的详细信息 +-dontoptimize #关闭优化 +-keepattributes Annotation #保留注解中的参数 +-keepattributes Annotation,InnerClasses # 保持注解 +-keepattributes Signature # 避免混淆泛型, 这在JSON实体映射时非常重要 +-ignorewarnings # 屏蔽警告 +-keepattributes SourceFile,LineNumberTable # 抛出异常时保留代码行号 +-dontusemixedcaseclassnames + +#默认保留区 +-keep public class * extends android.app.Activity +-keep public class * extends androidx.fragment.app.Fragment +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference +-keep public class * extends android.view.View +-keep class android.support.** {*;} + +-keep class com.google.android.material.** {*;} +-keep class androidx.* {*;} +-keep public class * extends androidx.* +-keep interface androidx.**{*;} +-keep class * implements androidx.* {*;} +#androidx 混淆 +-dontwarn com.google.android.material.* +-dontnote com.google.android.material.** +-dontwarn androidx.** +-printconfiguration +-keep,allowobfuscation interface androidx.annotation.Keep +-keep @androidx.annotation.Keep class * +-keepclassmembers class * {@androidx.annotation.Keep *;} +#set get方法 和 构造方法不混淆 +-keep public class * extends android.view.View{ +*** get(); +void set(***); +public (android.content.Context); +public (android.content.Context, android.util.AttributeSet); +public (android.content.Context, android.util.AttributeSet, int);} +-keepclasseswithmembers class * { +public (android.content.Context, android.util.AttributeSet); +public (android.content.Context, android.util.AttributeSet, int);} +#onClick不进行混淆 +-keepclassmembers class * extends android.app.Activity { +public void *(android.view.View); +} +# Serializable 不被混淆 +-keepnames class * implements java.io.Serializable +#Serializable接口的类重写父类方法保留 +-keepclassmembers class * implements java.io.Serializable { +static final long serialVersionUID; +private static final java.io.ObjectStreamField[] serialPersistentFields; +private void writeObject(java.io.ObjectOutputStream); +private void readObject(java.io.ObjectInputStream); +java.lang.Object writeReplace(); +java.lang.Object readResolve();} +#保留R文件中所有静态字段 +-keepclassmembers class *.R$ { +public static ; +} +-keepclassmembers class * { +void (); +} +#保留枚举类中的values和valueOf方法 +-keepclassmembers enum * { +public static **[] values(); +public static ** valueOf(java.lang.String); +} +#保留Parcelable实现类中的Creator字段 +-keep class * implements android.os.Parcelable { +public static final android.os.Parcelable$Creator *; +} + +#保持 Parcelable 不被混淆 +-keep class * implements android.os.Parcelable { +public static final android.os.Parcelable$Creator *; +} +#不混淆包含native方法的类的类名以及native方法名 +-keepclasseswithmembernames class * { +native; +} +#避免log打印输出 +-assumenosideeffects class android.util.Log { +public static *** v(...); +public static *** d(...); +public static *** i(...); +public static *** w(...); +} +#webView需要进行特殊处理 +-dontwarn android.webkit.WebView +-dontwarn android.net.http.SslError +-dontwarn android.webkit.WebViewClient +-keep public class android.webkit.WebView +-keep public class android.net.http.SslError +-keep public class android.webkit.WebViewClient +#AgentWeb +-keep class com.just.agentweb.** { + *; +} +#-dontwarn com.just.agentweb.** +#九宫格组件 +-dontwarn com.lwkandroid.widget.ninegridview.** +-keep class com.lwkandroid.widget.ninegridview.**{*;} +#饺子播放器 +-keep public class cn.jzvd.JZMediaSystem {*; } +-keep class tv.danmaku.ijk.media.player.** {*; } +-dontwarn tv.danmaku.ijk.media.player.* +-keep interface tv.danmaku.ijk.media.player.** { *; } +#实体类不可混淆 +-keep class com.xjjk.healthyclients.bean.**{ *; } +#OkHttp3 去掉缺失类警告 +-dontwarn org.bouncycastle.** +-dontwarn org.conscrypt.** +-dontwarn org.openjsse.javax.net.ssl.** +-dontwarn org.openjsse.net.ssl.** + +-keep class com.github.aachartmodel.aainfographics.aachartcreator.AAChartView { + public void aa_drawChartWithChartModel( com.github.aachartmodel.aainfographics.aachartcreator.AAChartModel); +} + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d312772 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/assets/tab.json b/app/src/main/assets/tab.json new file mode 100644 index 0000000..fe3fc35 --- /dev/null +++ b/app/src/main/assets/tab.json @@ -0,0 +1,37 @@ +{ + "textColorNormal": "#A4A3A3", + "textColorSelected": "#21BEBD", + "textSizeNormal": 9, + "textSizeSelected": 9, + "backgroundColor": "#e9e9e9", + "isNameResId": false, + "isTitleVisible": true, + "tabs": [ + { + "tabName": "首页", + "tabTag": "key_guidance_fragment", + "iconNormal": "main_home_tab_index_normal", + "iconSelected": "main_home_tab_index_selected" + }, + { + "tabName": "就医", + "tabTag": "key_emergency_fragment", + "iconNormal": "main_home_tab_emergency_normal", + "iconSelected": "main_home_tab_emergency_selected", + "itemBg": "home_tab_center_bg" + }, + { + "tabName": "监测", + "tabTag": "key_monitor_fragment", + "iconNormal": "main_home_tab_monitor_normal", + "iconSelected": "main_home_tab_monitor_selected", + "itemBg": "home_tab_center_bg" + }, + { + "tabName": "我的", + "tabTag": "key_my_fragment", + "iconNormal": "main_home_tab_my_normal", + "iconSelected": "main_home_tab_my_selected" + } + ] +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/AppViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/AppViewModel.kt new file mode 100644 index 0000000..7aee46c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/AppViewModel.kt @@ -0,0 +1,118 @@ +package com.xjjk.healthyclients + +import com.sw.healthyclients.data.local.DataStoreManager +import com.sw.healthyclients.utils.CustomActivityManager +import com.tencent.imsdk.v2.V2TIMCallback +import com.tencent.imsdk.v2.V2TIMManager +import com.tencent.imsdk.v2.V2TIMUserFullInfo +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.im.IMInfoBean +import com.xjjk.healthyclients.data.repository.GuidanceRepository +import com.xjjk.healthyclients.data.repository.IMRepository +import com.xjjk.healthyclients.event.AppraiseFinishEvent +import com.xjjk.healthyclients.retrofit.UrlConfig +import com.xjjk.healthyclients.superfuntion.addImageBaseUrl +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.hideLoading +import com.xjjk.healthyclients.superfuntion.launch +import com.xjjk.healthyclients.utils.TUIUtils +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import org.greenrobot.eventbus.EventBus + +/** + * @author nanfeifei + * @time 2023/5/11 14:11 + * @description + */ +class AppViewModel: BaseViewModel() { + var imSig = MutableStateFlow("") + var imUserId = MutableStateFlow("") + var imAppId = MutableStateFlow("") + var userHaveWatch = MutableSharedFlow() + override fun init() { + } + fun getIMSig(successCall: (IMInfoBean) -> Unit = {}){ + if (!UrlConfig.isOpenIm) { + return + } + launch({ + handleRequest(IMRepository.getIMSig(), successBlock = { + it.result?.let { imBean -> + appContext.initIMSDK(imBean.sdkAppId.toInt()) + imSig.emit(imBean.userSig) + imUserId.emit(imBean.userId) + imAppId.emit(imBean.sdkAppId) + successCall.invoke(imBean) + } + }, errorBlock = { + false + }) + }) + } + fun setUserIMInfo(){ + var info = V2TIMUserFullInfo() + var userInfo = DataStoreManager.getUserInfo() + info.setNickname(userInfo.realname) + info.faceUrl = addImageBaseUrl(userInfo.avatar) + V2TIMManager.getInstance().setSelfInfo(info, object : V2TIMCallback { + override fun onSuccess() { + // 设置个人资料成功 + } + + override fun onError(code: Int, desc: String) { + // 设置个人资料失败 + } + }) + } + fun finishIMChat(workType: Int, workId: String){ + launch({ + when(workType){ + TUIUtils.WORK_TYPE_EMERGENCY -> { + handleRequest(IMRepository.finishIMEmergency(workId)) + } + TUIUtils.WORK_TYPE_IMAGE_TEXT_CONSULT -> { + handleRequest(IMRepository.finishIMImageText(workId)) + } + TUIUtils.WORK_TYPE_ASSISTANT -> { + handleRequest(IMRepository.finishIMImageText(workId)) + } + } + + }, finallyBlock = { + hideLoading() + }) + } + fun submitAppraise(chatId: String, workType: Int, workId: String, score: Float, content: String, anonymity: Boolean){ + launch({ + when(workType){ + TUIUtils.WORK_TYPE_EMERGENCY -> { + + } + TUIUtils.WORK_TYPE_IMAGE_TEXT_CONSULT -> { + handleRequest(GuidanceRepository.submitConsultAppraise("", workId, score, content, anonymity), successBlock = { +// val customEvaluationMessage = CustomEvaluationMessage() +// customEvaluationMessage.score = score +// customEvaluationMessage.comment = content +// EventBus.getDefault().post(CustomMessageEvent(chatId, customEvaluationMessage.toJson())) + ToastUtil.toastShortMessage(it.message) + EventBus.getDefault().post(AppraiseFinishEvent()) + CustomActivityManager.getInstance() + .finishActivity(TUIGroupChatActivity::class.java) + }) + } + TUIUtils.WORK_TYPE_ASSISTANT -> { + + } + } + + }, finallyBlock = { + hideLoading() + }) + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/CustomMedia/JZMediaExo.java b/app/src/main/java/com/xjjk/healthyclients/CustomMedia/JZMediaExo.java new file mode 100644 index 0000000..579f18e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/CustomMedia/JZMediaExo.java @@ -0,0 +1,313 @@ +package com.xjjk.healthyclients.CustomMedia; + +import android.content.Context; +import android.graphics.SurfaceTexture; +import android.net.Uri; +import android.os.Handler; +import android.os.HandlerThread; +import android.util.Log; +import android.view.Surface; + +import com.google.android.exoplayer2.C; +import com.google.android.exoplayer2.DefaultLoadControl; +import com.google.android.exoplayer2.DefaultRenderersFactory; +import com.google.android.exoplayer2.ExoPlaybackException; +import com.google.android.exoplayer2.ExoPlayerFactory; +import com.google.android.exoplayer2.LoadControl; +import com.google.android.exoplayer2.PlaybackParameters; +import com.google.android.exoplayer2.Player; +import com.google.android.exoplayer2.RenderersFactory; +import com.google.android.exoplayer2.SimpleExoPlayer; +import com.google.android.exoplayer2.Timeline; +import com.google.android.exoplayer2.source.ExtractorMediaSource; +import com.google.android.exoplayer2.source.MediaSource; +import com.google.android.exoplayer2.source.TrackGroupArray; +import com.google.android.exoplayer2.source.hls.HlsMediaSource; +import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection; +import com.google.android.exoplayer2.trackselection.DefaultTrackSelector; +import com.google.android.exoplayer2.trackselection.TrackSelection; +import com.google.android.exoplayer2.trackselection.TrackSelectionArray; +import com.google.android.exoplayer2.trackselection.TrackSelector; +import com.google.android.exoplayer2.upstream.BandwidthMeter; +import com.google.android.exoplayer2.upstream.DataSource; +import com.google.android.exoplayer2.upstream.DefaultAllocator; +import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; +import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; +import com.google.android.exoplayer2.util.Util; +import com.google.android.exoplayer2.video.VideoListener; +import com.xjjk.healthyclients.R; + +import cn.jzvd.JZMediaInterface; +import cn.jzvd.Jzvd; + +/** + * Created by MinhDV on 5/3/18. + */ +public class JZMediaExo extends JZMediaInterface implements Player.EventListener, VideoListener { + private SimpleExoPlayer simpleExoPlayer; + private Runnable callback; + private String TAG = "JZMediaExo"; + private long previousSeek = 0; + + public JZMediaExo(Jzvd jzvd) { + super(jzvd); + } + + @Override + public void start() { + simpleExoPlayer.setPlayWhenReady(true); + } + + @Override + public void prepare() { + Log.e(TAG, "prepare"); + Context context = jzvd.getContext(); + + release(); + mMediaHandlerThread = new HandlerThread("JZVD"); + mMediaHandlerThread.start(); + mMediaHandler = new Handler(mMediaHandlerThread.getLooper());//主线程还是非主线程,就在这里 + handler = new Handler(); + mMediaHandler.post(() -> { + BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); + TrackSelection.Factory videoTrackSelectionFactory = + new AdaptiveTrackSelection.Factory(bandwidthMeter); + TrackSelector trackSelector = + new DefaultTrackSelector(videoTrackSelectionFactory); + + LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE), + 360000, 600000, 1000, 5000, + C.LENGTH_UNSET, + false); + + // 2. Create the player + + RenderersFactory renderersFactory = new DefaultRenderersFactory(context); + simpleExoPlayer = ExoPlayerFactory.newSimpleInstance(context, renderersFactory, trackSelector, loadControl); + // Produces DataSource instances through which media data is loaded. + DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, + Util.getUserAgent(context, context.getResources().getString(R.string.app_name))); + + String currUrl = jzvd.jzDataSource.getCurrentUrl().toString(); + MediaSource videoSource; + if (currUrl.contains(".m3u8")) { + videoSource = new HlsMediaSource.Factory(dataSourceFactory) + .createMediaSource(Uri.parse(currUrl), handler, null); + } else { + videoSource = new ExtractorMediaSource.Factory(dataSourceFactory) + .createMediaSource(Uri.parse(currUrl)); + } + simpleExoPlayer.addVideoListener(this); + + Log.e(TAG, "URL Link = " + currUrl); + + simpleExoPlayer.addListener(this); + Boolean isLoop = jzvd.jzDataSource.looping; + if (isLoop) { + simpleExoPlayer.setRepeatMode(Player.REPEAT_MODE_ONE); + } else { + simpleExoPlayer.setRepeatMode(Player.REPEAT_MODE_OFF); + } + simpleExoPlayer.prepare(videoSource); + simpleExoPlayer.setPlayWhenReady(true); + callback = new onBufferingUpdate(); + + simpleExoPlayer.setVideoSurface(new Surface(jzvd.textureView.getSurfaceTexture())); + }); + + } + + @Override + public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) { + handler.post(() -> jzvd.onVideoSizeChanged(width, height)); + } + + @Override + public void onRenderedFirstFrame() { + Log.e(TAG, "onRenderedFirstFrame"); + } + + @Override + public void pause() { + simpleExoPlayer.setPlayWhenReady(false); + } + + @Override + public boolean isPlaying() { + return simpleExoPlayer.getPlayWhenReady(); + } + + @Override + public void seekTo(long time) { + if (time != previousSeek) { + simpleExoPlayer.seekTo(time); + previousSeek = time; + jzvd.seekToInAdvance = time; + } + } + + @Override + public void release() { + if (mMediaHandler != null && mMediaHandlerThread != null && simpleExoPlayer != null) {//不知道有没有妖孽 + HandlerThread tmpHandlerThread = mMediaHandlerThread; + SimpleExoPlayer tmpMediaPlayer = simpleExoPlayer; + JZMediaInterface.SAVED_SURFACE = null; + + mMediaHandler.post(() -> { + tmpMediaPlayer.release();//release就不能放到主线程里,界面会卡顿 + tmpHandlerThread.quit(); + }); + simpleExoPlayer = null; + } + } + + @Override + public long getCurrentPosition() { + if (simpleExoPlayer != null) + return simpleExoPlayer.getCurrentPosition(); + else return 0; + } + + @Override + public long getDuration() { + if (simpleExoPlayer != null) + return simpleExoPlayer.getDuration(); + else return 0; + } + + @Override + public void setVolume(float leftVolume, float rightVolume) { + simpleExoPlayer.setVolume(leftVolume); + simpleExoPlayer.setVolume(rightVolume); + } + + @Override + public void setSpeed(float speed) { + PlaybackParameters playbackParameters = new PlaybackParameters(speed, 1.0F); + simpleExoPlayer.setPlaybackParameters(playbackParameters); + } + + @Override + public void onTimelineChanged(final Timeline timeline, Object manifest, final int reason) { + Log.e(TAG, "onTimelineChanged"); +// JZMediaPlayer.instance().mainThreadHandler.post(() -> { +// if (reason == 0) { +// +// JzvdMgr.getCurrentJzvd().onInfo(reason, timeline.getPeriodCount()); +// } +// }); + } + + @Override + public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { + + } + + @Override + public void onLoadingChanged(boolean isLoading) { + Log.e(TAG, "onLoadingChanged"); + } + + @Override + public void onPlayerStateChanged(final boolean playWhenReady, final int playbackState) { + Log.e(TAG, "onPlayerStateChanged" + playbackState + "/ready=" + String.valueOf(playWhenReady)); + handler.post(() -> { + switch (playbackState) { + case Player.STATE_IDLE: { + } + break; + case Player.STATE_BUFFERING: { + handler.post(callback); + } + break; + case Player.STATE_READY: { + if (playWhenReady) { + jzvd.onStatePlaying(); + } else { + } + } + break; + case Player.STATE_ENDED: { + jzvd.onAutoCompletion(); + } + break; + } + }); + } + + @Override + public void onRepeatModeChanged(int repeatMode) { + + } + + @Override + public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) { + + } + + @Override + public void onPlayerError(ExoPlaybackException error) { + Log.e(TAG, "onPlayerError" + error.toString()); + handler.post(() -> jzvd.onError(1000, 1000)); + } + + @Override + public void onPositionDiscontinuity(int reason) { + + } + + @Override + public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) { + + } + + @Override + public void onSeekProcessed() { + handler.post(() -> jzvd.onSeekComplete()); + } + + @Override + public void setSurface(Surface surface) { + simpleExoPlayer.setVideoSurface(surface); + } + + @Override + public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { + if (SAVED_SURFACE == null) { + SAVED_SURFACE = surface; + prepare(); + } else { + jzvd.textureView.setSurfaceTexture(SAVED_SURFACE); + } + } + + @Override + public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { + + } + + @Override + public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { + return false; + } + + @Override + public void onSurfaceTextureUpdated(SurfaceTexture surface) { + + } + + private class onBufferingUpdate implements Runnable { + @Override + public void run() { + if (simpleExoPlayer != null) { + final int percent = simpleExoPlayer.getBufferedPercentage(); + handler.post(() -> jzvd.setBufferProgress(percent)); + if (percent < 100) { + handler.postDelayed(callback, 300); + } else { + handler.removeCallbacks(callback); + } + } + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/MainActivity.kt b/app/src/main/java/com/xjjk/healthyclients/MainActivity.kt new file mode 100644 index 0000000..8102682 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/MainActivity.kt @@ -0,0 +1,238 @@ +package com.xjjk.healthyclients + +import UserInfoFragment +import android.Manifest +import android.annotation.SuppressLint +import android.os.Bundle +import android.os.Handler +import android.os.Message +import android.view.Gravity +import android.view.KeyEvent +import android.view.View +import androidx.fragment.app.Fragment +import com.amap.api.maps.MapsInitializer +import com.permissionx.guolindev.PermissionX +import com.sw.healthyclients.data.local.DataStoreManager +import com.sw.healthyclients.utils.CustomActivityManager +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bottomtab.HomeBottomTabLayout +import com.xjjk.healthyclients.databinding.ActivityMainBinding +import com.xjjk.healthyclients.fragment.EmergencyFragment +import com.xjjk.healthyclients.fragment.GuidanceFragment +import com.xjjk.healthyclients.fragment.MonitorFragment +import com.xjjk.healthyclients.superfuntion.startLoginActivity +import com.xjjk.healthyclients.utils.ConstantUtils +import com.xjjk.healthyclients.utils.LocationManager +import com.xjjk.healthyclients.utils.SystemUtils +import com.xjjk.healthyclients.view.PrivacyDialog +import com.xjjk.healthyclients.view.TextViewDialog +import org.lzh.framework.updatepluginlib.UpdateBuilder + + +class MainActivity : BaseVMBActivity(R.layout.activity_main), + HomeBottomTabLayout.HomeBottomTabLayoutCallback { + + //每个tab对应的tag,和json配置文件中保持一致 + val TAG_GUIDANCE = "key_guidance_fragment" + val TAG_EMERGENCY = "key_emergency_fragment" + val TAG_MONITOR = "key_monitor_fragment" + val TAG_MY = "key_my_fragment" + var textViewDialog: TextViewDialog? = null + var mPermissionList = arrayListOf( + Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.ACCESS_COARSE_LOCATION, + Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.QUERY_ALL_PACKAGES, + Manifest.permission.POST_NOTIFICATIONS + ) + + + override fun initView(savedInstanceState: Bundle?) { + if (!SystemUtils.isSignedWithReleaseCert(mContext)) { + UpdateBuilder.create() + .check()// 启动更新任务 + } else { +// mViewModel.getAppVersionInfo() + } + mBinding.apply { + //设置回调 + mainTabLayout.setHomeBottomTabLayoutCallback(this@MainActivity) + //初始化,参数为默认展示第几个tab + mainTabLayout.initFirstTab(0) + //如果需要展示未读消息,通过该方法展示 +// main_tab_layout.setUnreadTip(TAG_USER, "12") +// main_tab_layout.setUnreadTip(TAG_INDEX, "99+") +// main_tab_layout.setUnreadTip(TAG_COLLECT, null, false) + } + + } + + override fun initData() { +// if(DataStoreManager.isLogin()){ +// getAppViewModel().getIMSig(successCall = { +// loginIm(it.userId, it.userSig) +// }) +// } + if (DataStoreManager.isPrivacyState()) { +// if (ProxyChecker.hasProxy(mContext)) { +// if (UrlConfig.baseUrlType == UrlConfig.BaseUrlType.PRODUCT) { +// checkNetWork() +// } +// } + } else { + privacyShow() + } + + PermissionX.init(this) + .permissions(mPermissionList) + .request { allGranted, grantedList, deniedList -> + MapsInitializer.updatePrivacyShow(mContext, true, true) + MapsInitializer.updatePrivacyAgree(mContext, true) + var c = LocationManager(mContext, null, null) + c.startLocation() +// MapRouteSearch.setRoute(this@MainActivity) + } + + + } + + fun privacyShow() { + val textViewDialog = mContext?.let { PrivacyDialog(it) } + textViewDialog?.setDialogTitle("隐私协议授权", 18f) + textViewDialog?.setContent(ConstantUtils.mPrivacy, 14f) + textViewDialog?.setContentStyle(Gravity.LEFT) + textViewDialog?.setBtnText("同意", 18f) + textViewDialog?.setDialogCancelable(false) + textViewDialog?.setCancelBtnText("下次再说", 18f) + textViewDialog?.setOnAffirmClickListener(object : PrivacyDialog.OnAffirmClickListener { + override fun onAffirmClick(viewDialog: PrivacyDialog) { + DataStoreManager.savePrivacyState(true) +// if (ProxyChecker.hasProxy(mContext)) { +// if (UrlConfig.baseUrlType == UrlConfig.BaseUrlType.PRODUCT) { +// checkNetWork() +// } +// } + } + + override fun onCancelClick(viewDialog: PrivacyDialog) { + + } + }) + textViewDialog?.show() + } + + + override fun bindEvent() { + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + } + } + + override fun onBackEvent() { + super.onBackEvent() + } + + override fun onPause() { + textViewDialog?.dismiss() + super.onPause() + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(Bundle()) + } + + override fun getFragmentByTag(tabTag: String): Fragment? { + when (tabTag) { +// TAG_GUIDANCE -> { +// return HomeFragment() +// } + + TAG_GUIDANCE -> { + return GuidanceFragment() + } + + TAG_EMERGENCY -> { + if (DataStoreManager.isLogin()) { + return EmergencyFragment() + } else { + startLoginActivity(this@MainActivity) + return Fragment() + } + } + + TAG_MONITOR -> { + if (DataStoreManager.isLogin()) { + return MonitorFragment() + } else { + startLoginActivity(this@MainActivity) + return Fragment() + } + + } + + TAG_MY -> { + return UserInfoFragment() + } + + } + return null + } + + override fun transparentStatusBar(): Boolean { + return true + } + + + override fun onClickChangeTab(selectedIndex: Int, selectedTag: String?) { +// when(selectedIndex){ +// 0 -> { +// mActivity?.let { StatusbarUtil.customColorMode(it, "#54eccb",false) } +// } +// 1 -> { +// mActivity?.let { StatusbarUtil.customColorMode(it, "#2dcac1",false) } +// } +// 2 -> { +// mActivity?.let { StatusbarUtil.customColorMode(it, "#21BEBD",true) } +// } +// 3 -> { +// mActivity?.let { StatusbarUtil.customColorMode(it, "#21BEBD",true) } +// } +// 4 -> { +// mActivity?.let { StatusbarUtil.customColorMode(it, "#FFFFFFFF",true) } +// } +// } + } + + private var isExit = false + var mHandler: Handler = @SuppressLint("HandlerLeak") + object : Handler() { + override fun handleMessage(msg: Message) { + super.handleMessage(msg) + isExit = false + } + } + + private fun exit() { + if (!isExit) { + isExit = true + showToast("再按一次退出程序") + // 利用handler延迟发送更改状态信息 + mHandler.sendEmptyMessageDelayed(0, 2000) + } else { + CustomActivityManager.getInstance().finishAllActivity() +// System.exit(0) + } + } + + override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + if (keyCode == KeyEvent.KEYCODE_BACK) { + exit() + return false + } + return super.onKeyDown(keyCode, event) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/MyApplication.kt b/app/src/main/java/com/xjjk/healthyclients/MyApplication.kt new file mode 100644 index 0000000..3ab19d9 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/MyApplication.kt @@ -0,0 +1,358 @@ +package com.xjjk.healthyclients + +import android.app.Activity +import android.app.ActivityManager +import android.app.Application +import android.content.Context +import android.os.Build +import android.os.Bundle +import android.os.StrictMode +import android.util.Log +import androidx.appcompat.app.AppCompatActivity +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.ViewModelStore +import androidx.lifecycle.ViewModelStoreOwner +import com.lzy.ninegrid.NineGridView +import com.orhanobut.logger.AndroidLogAdapter +import com.orhanobut.logger.Logger +import com.sw.healthyclients.data.local.DataStoreManager.initialize +import com.sw.healthyclients.utils.CustomActivityManager +import com.sw.healthyclients.utils.DevicesInfoUtils +import com.sw.healthyclients.utils.DownloadFileUtil +import com.sw.healthyclients.utils.GenerateTestUserSig +import com.tencent.imsdk.v2.V2TIMManager +import com.tencent.imsdk.v2.V2TIMSDKConfig +import com.tencent.imsdk.v2.V2TIMValueCallback +import com.tencent.qcloud.tuicore.TUILogin +import com.tencent.qcloud.tuicore.TUIThemeManager +import com.tencent.qcloud.tuicore.interfaces.TUILoginListener +import com.tencent.qcloud.tuicore.util.ErrorMessageConverter +import com.tencent.qcloud.tuicore.util.TUIUtil +import com.tencent.qcloud.tuikit.tuichat.config.TUIChatConfigs +import com.tencent.qcloud.tuikit.tuichat.interfaces.IMInputViewActionListener +import com.xjjk.healthyclients.bean.AppUpdateBean +import com.xjjk.healthyclients.retrofit.UrlConfig +import com.xjjk.healthyclients.superfuntion.jsonToBean +import com.xjjk.healthyclients.superfuntion.showLoading +import com.xjjk.healthyclients.superfuntion.startLoginActivity +import com.xjjk.healthyclients.superfuntion.userSigExpired +import com.xjjk.healthyclients.utils.BrandUtil +import com.xjjk.healthyclients.utils.ConstantUtils +import com.xjjk.healthyclients.utils.NineGridViewImageLoader +import com.xjjk.healthyclients.utils.updateplugin.CheckUpdateAppVersion +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 org.json.JSONException +import org.json.JSONObject +import org.lzh.framework.updatepluginlib.UpdateConfig +import org.lzh.framework.updatepluginlib.base.UpdateParser +import org.lzh.framework.updatepluginlib.base.UpdateStrategy +import org.lzh.framework.updatepluginlib.model.CheckEntity +import org.lzh.framework.updatepluginlib.model.Update +import retrofit2.HttpException +import kotlin.properties.Delegates + + +class MyApplication : Application(), ViewModelStoreOwner { + private var mAppViewModelStore: ViewModelStore? = null + private var mFactory: ViewModelProvider.Factory? = null + var sdkAppId = 0 + var tuikit_demo_style: Int = 0 + companion object { + @JvmStatic + var appContext: MyApplication by Delegates.notNull() + @JvmStatic + lateinit var appViewModel: AppViewModel + val TAG = MyApplication::class.java.simpleName + } + override fun onCreate() { + Log.i(TAG, "onCreate") + super.onCreate() + ConstantUtils.mIsCloseDialog=true + Logger.addLogAdapter(AndroidLogAdapter()) + appContext = this + DownloadFileUtil.init(this) + mAppViewModelStore = ViewModelStore() + appViewModel = getAppViewModelProvider()[AppViewModel::class.java] + appViewModel.init() + createObserve() + createNewConfig() + init() + initUpdateApp() + + //JPushSdk().initSDK(this) + //禁止网络相关安全检查 + if (Build.VERSION.SDK_INT > 9) { + val policy = StrictMode.ThreadPolicy.Builder().permitAll().build() + StrictMode.setThreadPolicy(policy) //这两句设置禁止所有检查 + } + NineGridView.setImageLoader(NineGridViewImageLoader()) + initialize(this) + registerActivityLifecycleCallbacks(AdjustLifecycleCallbacks()) + val androidId = DevicesInfoUtils.getAndroidId(this) + println("设备id:${androidId}") + if (UrlConfig.testDeviceList.contains(androidId)) { + UrlConfig.isTestDevice = true + } + } + + override fun attachBaseContext(base: Context) { + super.attachBaseContext(base) + TUIThemeManager.setWebViewLanguage(this) + } + /** 获取一个全局的ViewModel */ + private fun getAppViewModelProvider(): ViewModelProvider { + return ViewModelProvider(this, getAppFactory()) + } + private fun getAppFactory(): ViewModelProvider.Factory { + if (mFactory == null) { + mFactory = ViewModelProvider.AndroidViewModelFactory.getInstance(this) + } + return mFactory as ViewModelProvider.Factory + } + + private fun createNewConfig(): UpdateConfig { + return UpdateConfig.createConfig() + .setUrl("http://o1wh05aeh.qnssl.com/image/view/app_icons") + .setUpdateParser(object : UpdateParser() { + @Throws(Exception::class) + override fun parse(httpResponse: String): Update { + val `object` = JSONObject(httpResponse) + val update = Update() + // 此apk包的下载地址 + update.updateUrl = `object`.optString("update_url") + // 此apk包的版本号 + update.versionCode = `object`.optInt("update_ver_code") + // 此apk包的版本名称 + update.versionName = `object`.optString("update_ver_name") + // 此apk包的更新内容 + update.updateContent = `object`.optString("update_content") + // 此apk包是否为强制更新 + update.isForced = true + // 是否显示忽略此次版本更新按钮 + update.isIgnore = `object`.optBoolean("ignore_able", false) + update.md5 = `object`.optString("md5") + return update + } + }) + } + + private fun initBuildInformation() { + try { + val buildInfoJson = JSONObject() + buildInfoJson.put("buildBrand", BrandUtil.getBuildBrand()) + buildInfoJson.put("buildManufacturer", BrandUtil.getBuildManufacturer()) + buildInfoJson.put("buildModel", BrandUtil.getBuildModel()) + buildInfoJson.put("buildVersionRelease", BrandUtil.getBuildVersionRelease()) + buildInfoJson.put("buildVersionSDKInt", BrandUtil.getBuildVersionSDKInt()) + // 工信部要求 app 在运行期间只能获取一次设备信息。因此 app 获取设备信息设置给 SDK 后,SDK 使用该值并且不再调用系统接口。 + // The Ministry of Industry and Information Technology requires the app to obtain device information only once + // during its operation. Therefore, after the app obtains the device information and sets it to the SDK, the SDK + // uses this value and no longer calls the system interface. + V2TIMManager.getInstance().callExperimentalAPI( + "setBuildInfo", + buildInfoJson.toString(), + object : V2TIMValueCallback { + + override fun onSuccess(p0: Any?) { + Log.i(TAG, "setBuildInfo success") + } + + override fun onError(code: Int, desc: String) { + Log.i( + TAG, + "setBuildInfo code:" + code + " desc:" + ErrorMessageConverter.convertIMError( + code, + desc + ) + ) + } + }) + } catch (e: JSONException) { + e.printStackTrace() + } + } + + fun init() { + initBuildInformation() + TUIChatConfigs.getConfigs().imInputViewActionListener = object : IMInputViewActionListener { + override fun finishAction(workType: Int, workId: String) { + val activity = CustomActivityManager.getInstance().currentActivity() + if (activity is AppCompatActivity) { + activity.showLoading() + } + appViewModel.finishIMChat(workType, workId) + } + + override fun appraiseAction(chatId: String, workType: Int, workId: String) { + val appraiseDialog = + AppraiseDialog(CustomActivityManager.getInstance().TopActivity()) + appraiseDialog.setOnSubmitClickListener(object : + AppraiseDialog.OnSubmitClickListener { + override fun onCancelClick(viewDialog: AppraiseDialog) {} + override fun onSubmitClick(viewDialog: AppraiseDialog) { + val activity = CustomActivityManager.getInstance().currentActivity() + if (activity is AppCompatActivity) { + activity.showLoading() + } + appViewModel.submitAppraise( + chatId, + workType, + workId, + viewDialog.getRating(), + viewDialog.getAppraiseContext(), + viewDialog.getAnonymityStatus() + ) + } + }) + appraiseDialog.show() + } + + override fun finishActivityToGuidanceHome(workType: Int) { +// if (workType > 0) { +// if (CustomActivityManager.getInstance().isActivityExist(GuidanceActivity::class.java)) { +// CustomActivityManager.getInstance() +// .finishActivityTohome(GuidanceActivity::class.java) +// }else if (CustomActivityManager.getInstance().isActivityExist(SeekDoctorActivity::class.java)) { +// CustomActivityManager.getInstance() +// .finishActivityTohome(SeekDoctorActivity::class.java) +// }else if (CustomActivityManager.getInstance().isActivityExist(DoctorsGuidanceActivity::class.java)) { +// CustomActivityManager.getInstance() +// .finishActivityTohome(DoctorsGuidanceActivity::class.java) +// }else{ +// CustomActivityManager.getInstance() +// .finishActivityTohome(MainActivity::class.java) +// } +// +// } + } + } + // initIMSDK(imSdkAppId); + } + + fun initIMSDK(imSdkAppId: Int) { + if (imSdkAppId != 0) { + sdkAppId = imSdkAppId + } else { + sdkAppId = GenerateTestUserSig.SDKAPPID + } + // 2. 初始化 config 对象。 + val config = V2TIMSDKConfig() + // 3. 指定 log 输出级别。 + config.logLevel = V2TIMSDKConfig.V2TIM_LOG_INFO + V2TIMManager.getInstance().initSDK(this, imSdkAppId, config) + TUIThemeManager.getInstance().changeTheme(this, TUIThemeManager.THEME_SERIOUS) + initLoginStatusListener() + } + + fun createObserve() { + appViewModel.exception.observeForever { e: Exception? -> + if (e is HttpException) { + if (e.code() == 401) { + val activity = CustomActivityManager.getInstance().currentActivity() + startLoginActivity(activity) + activity.finish() + } + } + } + } + + fun initLoginStatusListener() { + TUILogin.addLoginListener(loginStatusListener) + } + + private val loginStatusListener: TUILoginListener = object : TUILoginListener() { + override fun onKickedOffline() { + if (UrlConfig.isOpenIm){ + startLoginActivity(CustomActivityManager.getInstance().currentActivity()) + } + } + + override fun onUserSigExpired() { + if (UrlConfig.isOpenIm) { + CustomActivityManager.getInstance().currentActivity().userSigExpired { null } + } + } + } + + private inner class AdjustLifecycleCallbacks : ActivityLifecycleCallbacks { + override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) { + println("路径" + activity.javaClass.name) + CustomActivityManager.getInstance().addActivity(activity) + } + + override fun onActivityStarted(activity: Activity) {} + override fun onActivityResumed(activity: Activity) {} + override fun onActivityPaused(activity: Activity) {} + override fun onActivityStopped(activity: Activity) {} + override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {} + override fun onActivityDestroyed(activity: Activity) { + CustomActivityManager.getInstance().removeActivity(activity) + } + } + private fun initUpdateApp(){ + UpdateConfig.getConfig() + .setCheckWorker(CheckUpdateAppVersion::class.java) + //为了通过原检查更新库的检查随便传入的地址,实际请求参考CheckUpdateAppVersion.class + .setCheckEntity(CheckEntity().setUrl("https://www.baidu.com")) + .setCheckNotifier(CustomUpdateNotifier()) + .setInstallNotifier(CustomInstallNotifier()) + .setDownloadNotifier(CustomDownloadNotifier()) + .setUpdateParser(object : UpdateParser() { + override fun parse(response: String?): Update { + val resultBean: AppUpdateBean? = response.jsonToBean(AppUpdateBean::class.java) + val update = Update() + if(resultBean == null){ + return update + } + // 此apk包的下载地址 + update.updateUrl = UrlConfig.IMAGE_BASE_URL+resultBean.appUrl + // 此apk包的版本号(因接口只有在有更新时才会返回数据,而且没有返回云端APP版本号,故将当前APP版本号+1,传给更新框架用作判断有新版本) + update.versionCode = resultBean.versionNo ?: 0 + // 此apk包的版本名称 + update.versionName = resultBean.versionName + // 此apk包的更新内容 + update.updateContent = resultBean.updateContent + // 此apk包是否为强制更新 + if (resultBean != null) { + update.isForced = 1 == resultBean.forced + }else{ + update.isForced = false + } + // 是否显示忽略此次版本更新按钮 + update.isIgnore = 1 == resultBean.ignoreFlag + return update + } + }).updateStrategy = object : UpdateStrategy() { + override fun isShowUpdateDialog(update: Update): Boolean { + // 是否在检查到有新版本更新时展示Dialog。 + return true + } + + override fun isAutoInstall(): Boolean { + // 是否自动更新.当为自动更新时。代表下载成功后不通知用户。直接调起安装。 + return true + } + + override fun isShowDownloadDialog(): Boolean { + // 在APK下载时。是否显示下载进度的Dialog + return true + } + } + } + + private val isMainProcess: Boolean + private get() { + val am = this.getSystemService(ACTIVITY_SERVICE) as ActivityManager + val mainProcessName = this.packageName + val currentProcessName = TUIUtil.getProcessName() + return mainProcessName == currentProcessName + } + + override fun getViewModelStore(): ViewModelStore { + return mAppViewModelStore!! + } // call after login success + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/CvdMainAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/adapter/CvdMainAdapter.kt new file mode 100644 index 0000000..27bf88c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/CvdMainAdapter.kt @@ -0,0 +1,54 @@ +package com.xjjk.healthyclients.adapter + +import android.graphics.Color +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.CvdMainBean +import com.xjjk.healthyclients.databinding.ItemCvdMainBinding + +class CvdMainAdapter : + BaseDataBindingAdapter( + R.layout.item_cvd_main + ) { + + private val COLOR_HEART_RATE = "#F14D6B" + private val COLOR_SPO2 = "#2AC79F" + private val COLOR_STRESS = "#1385FA" + private val COLOR_TEMP = "#02C7D2" + + override fun convert( + holder: BaseDataBindingHolder, + item: CvdMainBean.dataBean + ) { + val mBinding = holder.dataBinding + mBinding?.let { + when (item.wdType) { + "heart_rate" -> { + mBinding.icon.setImageResource(R.drawable.icon_cvd_heart_rate) + mBinding.valueTv.setTextColor(Color.parseColor(COLOR_HEART_RATE)) + mBinding.valueUnitTv.text = "次/分钟" + } + "spo2" -> { + mBinding.icon.setImageResource(R.drawable.icon_cvd_spo) + mBinding.valueTv.setTextColor(Color.parseColor(COLOR_SPO2)) + mBinding.valueUnitTv.text = "%" + } + "stress" -> { + mBinding.icon.setImageResource(R.drawable.icon_cvd_pressure) + mBinding.valueTv.setTextColor(Color.parseColor(COLOR_STRESS)) + mBinding.valueUnitTv.text = "" + } + "temperature" -> { + mBinding.icon.setImageResource(R.drawable.icon_cvd_temperature) + mBinding.valueTv.setTextColor(Color.parseColor(COLOR_TEMP)) + mBinding.valueUnitTv.text = "℃" + } + } + + mBinding.valueTv.text = item.dataValue + mBinding.nameTv.text = item.wdTypeName + mBinding.dateTv.text = item.dataDate + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/CvdWarningHistoryAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/adapter/CvdWarningHistoryAdapter.kt new file mode 100644 index 0000000..adbec09 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/CvdWarningHistoryAdapter.kt @@ -0,0 +1,72 @@ +package com.xjjk.healthyclients.adapter + +import android.graphics.Color +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.CvdWarningHistoryBean +import com.xjjk.healthyclients.databinding.ItemCvdWarningHistoryBinding + +class CvdWarningHistoryAdapter : + BaseDataBindingAdapter( + R.layout.item_cvd_warning_history + ) { + + private val COLOR_HEART_RATE = "#F14D6B" + private val COLOR_SPO2 = "#2AC79F" + private val COLOR_STRESS = "#1385FA" + private val COLOR_TEMP = "#02C7D2" + + private var mType: Int = -1; + + fun CvdWarningHistoryAdapter(type: Int) { + mType = type + } + + + fun setType(type: Int) { + mType = type + } + + override fun convert( + holder: BaseDataBindingHolder, + item: CvdWarningHistoryBean + ) { + val mBinding = holder.dataBinding + mBinding?.let { + when (mType) { + 0 -> { + mBinding.nameTv.text = "心率" + mBinding.icon.setImageResource(R.drawable.icon_cvd_heart_rate) + mBinding.valueTv.setTextColor(Color.parseColor(COLOR_HEART_RATE)) + mBinding.valueUnitTv.text = "次/分钟" + } + + 1 -> { + mBinding.nameTv.text = "血氧饱和度" + mBinding.icon.setImageResource(R.drawable.icon_cvd_spo) + mBinding.valueTv.setTextColor(Color.parseColor(COLOR_SPO2)) + mBinding.valueUnitTv.text = "%" + } + + 2 -> { + mBinding.nameTv.text = "压力" + mBinding.icon.setImageResource(R.drawable.icon_cvd_pressure) + mBinding.valueTv.setTextColor(Color.parseColor(COLOR_STRESS)) + mBinding.valueUnitTv.text = "" + } + + 3 -> { + mBinding.nameTv.text = "体温" + mBinding.icon.setImageResource(R.drawable.icon_cvd_temperature) + mBinding.valueTv.setTextColor(Color.parseColor(COLOR_TEMP)) + mBinding.valueUnitTv.text = "℃" + } + } + + mBinding.valueTv.text = item.dataValue + mBinding.dateTv.text = item.warnTime + mBinding.addressTv.text = item.address + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/common/BaseCheckRecycleViewAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/adapter/common/BaseCheckRecycleViewAdapter.kt new file mode 100644 index 0000000..0855399 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/common/BaseCheckRecycleViewAdapter.kt @@ -0,0 +1,219 @@ +package com.xjjk.healthyclients.adapter.common + +import android.view.View +import android.widget.CompoundButton +import androidx.annotation.LayoutRes +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.entity.MultiItemEntity +import com.chad.library.adapter.base.viewholder.BaseViewHolder + +/** + * 封装adapter + * + * @param + */ +abstract class BaseCheckRecycleViewAdapter + @JvmOverloads constructor(@LayoutRes private val layoutResId: Int, data: MutableList? = null + ) : BaseQuickAdapter(layoutResId, data) { + /** + * 判定是否已激活选择模式 + */ + var enabledCheckMode //激活选择模式 + = false + /** + * 是否是单选模式 + */ + /** + * 设置单选模式,默认是复选模式 + */ + var singleMode //单选模式 + = false + /** + * 单选模式选中后是否可取消选中项 + * @param isCancel true为可取消,false为不可取消(必须有一项被选中) + */ + var singleModeIsCanCancel //单选模式选中后是否可取消选中项 + = false + private var currentCheckedPosition = -1 + private var secondCheckedPosition = -1 + + + + + /** + * 处理复选框 + */ + fun handleCompoundButton(compoundButton: CompoundButton, t: T) { + compoundButton.isChecked = t!!.checked + compoundButton.visibility = + if (enabledCheckMode) View.VISIBLE else View.GONE + } + + /** + * 激活选择模式 + */ + fun enableCheckMode() { + if (enabledCheckMode) { + return + } + enabledCheckMode = true + notifyDataSetChanged() + } + + /** + * 取消选择模式 + */ + fun cancelCheckMode() { + if (!enabledCheckMode) { + return + } + enabledCheckMode = false + for (item in data) { + item!!.checked = false + } + notifyDataSetChanged() + } + + /** + * 点击了某一项 + * + * @return true:已经激活了选择模式并且设置成功;false:尚未激活选择模式并且设置失败 + */ + fun clickItem(position: Int, isSecond: Boolean): Boolean { + var position = position + return if (enabledCheckMode) { + if (position < data.size) { + if (singleMode) { + if (isSecond) { + if (secondCheckedPosition == -1) { + val item: T = data[position] + item!!.checked = true + } else if (secondCheckedPosition == position) { + if (singleModeIsCanCancel) { + val item: T = data[position] + item!!.checked = !item.checked + } + } else { + if (currentCheckedPosition < data.size) { + data[currentCheckedPosition].checked = false + } + data[position].checked = true + } + secondCheckedPosition = position + } else { + secondCheckedPosition = -1 + if (currentCheckedPosition == -1) { + val item: T = data[position] + if (singleModeIsCanCancel){ + item!!.checked = !item.checked + }else{ + item!!.checked = true + } + } else if (currentCheckedPosition == position) { + if (singleModeIsCanCancel) { + val item: T = data[position] + item!!.checked = !item.checked + } + } else { + if (currentCheckedPosition < data.size) { + data[currentCheckedPosition].checked = false + } + data[position].checked = true + } + currentCheckedPosition = position + } + } else { + val item: T = data.get(position) + item!!.checked = !item.checked + } + notifyDataSetChanged() + } + true + } else { + false + } + } + + /** + * 全选 + * + * @return true:已经激活了选择模式并且设置成功;false:尚未激活选择模式并且设置失败 + */ + fun checkAll(checked: Boolean): Boolean { + return if (enabledCheckMode) { + for (i in 0 until data.size) { + val item: T = data[i] + item!!.checked = checked + } + notifyDataSetChanged() + if (!checked) { + currentCheckedPosition = -1 + secondCheckedPosition = -1 + } + true + } else { + false + } + } + + /** + * 获取选中的项 + */ + val checkedItems: MutableList + get() { + val checkedItems: MutableList = ArrayList() + for (item in data) { + if (item!!.checked) { + checkedItems.add(item) + } + } + return checkedItems + } + fun getCheckedItemPosition(): Int{ + if (!singleMode){ + return -1 + } + for (index in data.indices) { + if (data[index]!!.checked) { + return index + } + } + return -1 + } + /** + * 获取集合中选中的项 + */ + fun getCheckedItems(list: List): List { + val checkedItems: MutableList = ArrayList() + for (item in list) { + if (item!!.checked) { + checkedItems.add(item) + } + } + return checkedItems + } + + /** + * 删除选中的项 + */ + fun deleteCheckedItems(): List { + val checkedItems: MutableList = ArrayList() + val iterator: MutableIterator = data.iterator() + var item: T + while (iterator.hasNext()) { + item = iterator.next() + if (item!!.checked) { + checkedItems.add(item) + iterator.remove() + } + } + notifyDataSetChanged() + currentCheckedPosition = -1 + secondCheckedPosition = -1 + return checkedItems + } + + interface CheckItem : MultiItemEntity { + var checked: Boolean + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/common/BaseDataBindingAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/adapter/common/BaseDataBindingAdapter.kt new file mode 100644 index 0000000..f6cdb14 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/common/BaseDataBindingAdapter.kt @@ -0,0 +1,24 @@ +package com.xjjk.healthyclients.adapter.common + +import android.view.ViewGroup +import androidx.annotation.LayoutRes +import androidx.databinding.ViewDataBinding +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.util.getItemView +import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder + +/** + * @author nanfeifei + * @time 2023/5/5 14:07 + * @description 基于第三方库BaseRecyclerViewAdapterHelper拓展使用DataBinding的Adapter + */ +abstract class BaseDataBindingAdapter +@JvmOverloads constructor(@LayoutRes private val layoutResId: Int, data: MutableList? = null +) : BaseQuickAdapter>(layoutResId, data) { + override fun onCreateDefViewHolder( + parent: ViewGroup, + viewType: Int + ): BaseDataBindingHolder { + return BaseDataBindingHolder(parent.getItemView(layoutResId)) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/common/CommonAdapter.java b/app/src/main/java/com/xjjk/healthyclients/adapter/common/CommonAdapter.java new file mode 100644 index 0000000..b0b40ca --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/common/CommonAdapter.java @@ -0,0 +1,45 @@ +package com.xjjk.healthyclients.adapter.common; + +import android.content.Context; +import android.view.LayoutInflater; + +import java.util.List; + +/** + * 原创 hongyang + */ +public abstract class CommonAdapter extends MultiItemTypeAdapter { + protected Context mContext; + protected int mLayoutId; + protected List mDatas; + protected LayoutInflater mInflater; + + public CommonAdapter(final Context context, final int layoutId, List datas) { + super(context, datas); + mContext = context; + mInflater = LayoutInflater.from(context); + mLayoutId = layoutId; + mDatas = datas; + + addItemViewDelegate(new ItemViewDelegate() { + @Override + public int getItemViewLayoutId() { + return layoutId; + } + + @Override + public boolean isForViewType(T item, int position) { + return true; + } + + @Override + public void convert(ViewHolder holder, T t, int position) { + CommonAdapter.this.convert(holder, t, position); + } + }); + } + + protected abstract void convert(ViewHolder holder, T t, int position); + + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/common/CustomEmergencyHeadViewAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/adapter/common/CustomEmergencyHeadViewAdapter.kt new file mode 100644 index 0000000..966920d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/common/CustomEmergencyHeadViewAdapter.kt @@ -0,0 +1,32 @@ +package com.xjjk.healthyclients.adapter.common + +import android.content.Context +import android.content.res.ColorStateList +import android.graphics.Color +import android.widget.TextView +import androidx.core.content.ContextCompat +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.bean.emergency.EmergencyDictBean + +class CustomEmergencyHeadViewAdapter( + var mContext: Context?, + var layoutId: Int, + var datas: ArrayList?, + var method: () -> Unit +) : CommonAdapter(mContext, layoutId, datas) { + override fun convert(holder: ViewHolder?, t: EmergencyDictBean?, position: Int) { + t?.let{ + var textview=holder?.getView(R.id.item_custom_emergency_head_view_label) + textview?.setText(it.title) + if (it.isCheck) { + textview?.setTextColor(ContextCompat.getColor(textview.context, R.color.white)) + textview?.backgroundTintList = ColorStateList.valueOf(Color.parseColor("#21BEBD")) + }else{ + textview?.setTextColor(ContextCompat.getColor(textview.context, R.color.text_black_66)) + textview?.backgroundTintList = ColorStateList.valueOf(Color.parseColor("#FFFFFF")) + } + + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/common/ItemViewDelegate.java b/app/src/main/java/com/xjjk/healthyclients/adapter/common/ItemViewDelegate.java new file mode 100644 index 0000000..bdf188c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/common/ItemViewDelegate.java @@ -0,0 +1,16 @@ +package com.xjjk.healthyclients.adapter.common; + + +/** + * Created by wyy on 16/6/22. + */ +public interface ItemViewDelegate +{ + + int getItemViewLayoutId(); + + boolean isForViewType(T item, int position); + + void convert(ViewHolder holder, T t, int position); + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/common/ItemViewDelegateManager.java b/app/src/main/java/com/xjjk/healthyclients/adapter/common/ItemViewDelegateManager.java new file mode 100644 index 0000000..8e8d615 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/common/ItemViewDelegateManager.java @@ -0,0 +1,116 @@ +package com.xjjk.healthyclients.adapter.common; + + +import androidx.collection.SparseArrayCompat; + +/** + * Created by wyy on 16/6/22. + */ +public class ItemViewDelegateManager +{ + SparseArrayCompat> delegates = new SparseArrayCompat(); + + public int getItemViewDelegateCount() + { + return delegates.size(); + } + + public ItemViewDelegateManager addDelegate(ItemViewDelegate delegate) + { + int viewType = delegates.size(); + if (delegate != null) + { + delegates.put(viewType, delegate); + viewType++; + } + return this; + } + + public ItemViewDelegateManager addDelegate(int viewType, ItemViewDelegate delegate) + { + if (delegates.get(viewType) != null) + { + throw new IllegalArgumentException( + "An ItemViewDelegate is already registered for the viewType = " + + viewType + + ". Already registered ItemViewDelegate is " + + delegates.get(viewType)); + } + delegates.put(viewType, delegate); + return this; + } + + public ItemViewDelegateManager removeDelegate(ItemViewDelegate delegate) + { + if (delegate == null) + { + throw new NullPointerException("ItemViewDelegate is null"); + } + int indexToRemove = delegates.indexOfValue(delegate); + + if (indexToRemove >= 0) + { + delegates.removeAt(indexToRemove); + } + return this; + } + + public ItemViewDelegateManager removeDelegate(int itemType) + { + int indexToRemove = delegates.indexOfKey(itemType); + + if (indexToRemove >= 0) + { + delegates.removeAt(indexToRemove); + } + return this; + } + + public int getItemViewType(T item, int position) + { + int delegatesCount = delegates.size(); + for (int i = delegatesCount - 1; i >= 0; i--) + { + ItemViewDelegate delegate = delegates.valueAt(i); + if (delegate.isForViewType( item, position)) + { + return delegates.keyAt(i); + } + } + throw new IllegalArgumentException( + "No ItemViewDelegate added that matches position=" + position + " in data source"); + } + + public void convert(ViewHolder holder, T item, int position) + { + int delegatesCount = delegates.size(); + for (int i = 0; i < delegatesCount; i++) + { + ItemViewDelegate delegate = delegates.valueAt(i); + + if (delegate.isForViewType( item, position)) + { + delegate.convert(holder, item, position); + return; + } + } + throw new IllegalArgumentException( + "No ItemViewDelegateManager added that matches position=" + position + " in data source"); + } + + + public ItemViewDelegate getItemViewDelegate(int viewType) + { + return delegates.get(viewType); + } + + public int getItemViewLayoutId(int viewType) + { + return getItemViewDelegate(viewType).getItemViewLayoutId(); + } + + public int getItemViewType(ItemViewDelegate itemViewDelegate) + { + return delegates.indexOfValue(itemViewDelegate); + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/common/MultiItemTypeAdapter.java b/app/src/main/java/com/xjjk/healthyclients/adapter/common/MultiItemTypeAdapter.java new file mode 100644 index 0000000..e3686b9 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/common/MultiItemTypeAdapter.java @@ -0,0 +1,152 @@ +package com.xjjk.healthyclients.adapter.common; + +import android.content.Context; +import android.view.View; +import android.view.ViewGroup; + +import androidx.recyclerview.widget.RecyclerView; + +import java.util.List; + +/** + * Created by zhy on 16/4/9. + */ +public class MultiItemTypeAdapter extends RecyclerView.Adapter { + protected Context mContext; + protected List mDatas; + private int mCount = 4; + private boolean mIsShowOnlyCount=false; + + protected ItemViewDelegateManager mItemViewDelegateManager; + protected OnItemClickListener mOnItemClickListener; + + + public MultiItemTypeAdapter(Context context, List datas) { + mContext = context; + mDatas = datas; + mItemViewDelegateManager = new ItemViewDelegateManager(); + } + + @Override + public int getItemViewType(int position) { + if (!useItemViewDelegateManager()) return super.getItemViewType(position); + return mItemViewDelegateManager.getItemViewType(mDatas.get(position), position); + } + + + @Override + public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + ItemViewDelegate itemViewDelegate = mItemViewDelegateManager.getItemViewDelegate(viewType); + int layoutId = itemViewDelegate.getItemViewLayoutId(); + ViewHolder holder = ViewHolder.createViewHolder(mContext, parent, layoutId); + onViewHolderCreated(holder, holder.getConvertView()); + setListener(parent, holder, viewType); + return holder; + } + + public void onViewHolderCreated(ViewHolder holder, View itemView) { + + } + + public void convert(ViewHolder holder, T t) { + mItemViewDelegateManager.convert(holder, t, holder.getAdapterPosition()); + } + + protected boolean isEnabled(int viewType) { + return true; + } + + + protected void setListener(final ViewGroup parent, final ViewHolder viewHolder, int viewType) { + if (!isEnabled(viewType)) return; + viewHolder.getConvertView().setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mOnItemClickListener != null) { + int position = viewHolder.getAdapterPosition(); + mOnItemClickListener.onItemClick(v, viewHolder, position); + } + } + }); + + viewHolder.getConvertView().setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + if (mOnItemClickListener != null) { + int position = viewHolder.getAdapterPosition(); + return mOnItemClickListener.onItemLongClick(v, viewHolder, position); + } + return false; + } + }); + } + + @Override + public void onBindViewHolder(ViewHolder holder, int position) { + convert(holder, mDatas.get(position)); + } + + public void setShowOnlyThree(boolean isShowOnlyThree) { + setShowOnlyCount(isShowOnlyThree, 3); + } + + /** + * 设置显示的条数 + */ + public void setShowOnlyCount(boolean isShowOnlyThree, int count) { + mIsShowOnlyCount = isShowOnlyThree; + mCount = count; + notifyDataSetChanged(); + } + + @Override + public int getItemCount() { + int itemCount = 0; + if (mDatas != null) { + if (mIsShowOnlyCount) { + if (mDatas.size() > mCount) { + itemCount = mCount; + } else { + itemCount = mDatas.size(); + } + } else { + itemCount = mDatas.size(); + } + } + return itemCount; + } + + + public List getDatas() { + return mDatas; + } + + + public void setmDatas(List mDatas) { + this.mDatas = mDatas; + } + + public MultiItemTypeAdapter addItemViewDelegate(ItemViewDelegate itemViewDelegate) { + mItemViewDelegateManager.addDelegate(itemViewDelegate); + return this; + } + + public MultiItemTypeAdapter addItemViewDelegate(int viewType, ItemViewDelegate itemViewDelegate) { + mItemViewDelegateManager.addDelegate(viewType, itemViewDelegate); + return this; + } + + protected boolean useItemViewDelegateManager() { + return mItemViewDelegateManager.getItemViewDelegateCount() > 0; + } + + public interface OnItemClickListener { + void onItemClick(View view, RecyclerView.ViewHolder holder, int position); + + boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position); + } + + public void setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.mOnItemClickListener = onItemClickListener; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/common/ViewHolder.java b/app/src/main/java/com/xjjk/healthyclients/adapter/common/ViewHolder.java new file mode 100644 index 0000000..6fe5fa5 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/common/ViewHolder.java @@ -0,0 +1,419 @@ +package com.xjjk.healthyclients.adapter.common; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Paint; +import android.graphics.Typeface; +import android.graphics.drawable.Drawable; +import android.os.Build; +import android.text.Spannable; +import android.text.util.Linkify; +import android.util.SparseArray; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.AlphaAnimation; +import android.widget.Checkable; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.RatingBar; +import android.widget.TextView; + +import androidx.recyclerview.widget.RecyclerView; + +public class ViewHolder extends RecyclerView.ViewHolder +{ + private SparseArray mViews; + private View mConvertView; + private Context mContext; + + public ViewHolder(Context context, View itemView) + { + super(itemView); + mContext = context; + mConvertView = itemView; + mViews = new SparseArray(); + } + + + public static ViewHolder createViewHolder(Context context, View itemView) + { + ViewHolder holder = new ViewHolder(context, itemView); + return holder; + } + + public static ViewHolder createViewHolder(Context context, + ViewGroup parent, int layoutId) + { + View itemView = LayoutInflater.from(context).inflate(layoutId, parent, + false); + ViewHolder holder = new ViewHolder(context, itemView); + return holder; + } + + /** + * 通过viewId获取控件 + * + * @param viewId + * @return + */ + public T getView(int viewId) + { + View view = mViews.get(viewId); + if (view == null) + { + view = mConvertView.findViewById(viewId); + mViews.put(viewId, view); + } + return (T) view; + } + + public View getConvertView() + { + return mConvertView; + } + + + + + /****以下为辅助方法*****/ + + /** + * 设置TextView的值 + * + * @param viewId + * @param text + * @return + */ + public ViewHolder setText(int viewId, String text) + { + TextView tv = getView(viewId); + tv.setText(text); + return this; + } + /** + * 设置TextView的值 + * + * @param viewId + * @param text + * @return + */ + public ViewHolder setText(int viewId, Spannable text) + { + TextView tv = getView(viewId); + tv.setText(text); + return this; + } + + /** + * @param viewId + * @param resId + * @return + */ + public ViewHolder setImageResource(int viewId, int resId) + { + ImageView view = getView(viewId); + view.setImageResource(resId); + return this; + } + /** + * @param viewId + * @param url + * @return + */ + public ViewHolder setImageResource(int viewId, String url) + { + ImageView view = getView(viewId); +// LoaderManager.getLoader().loadNet(view,url); + return this; + } + + /** + * @param viewId + * @param bitmap + * @return + */ + public ViewHolder setImageBitmap(int viewId, Bitmap bitmap) + { + ImageView view = getView(viewId); + view.setImageBitmap(bitmap); + return this; + } + + /** + * @param viewId + * @param drawable + * @return + */ + public ViewHolder setImageDrawable(int viewId, Drawable drawable) + { + ImageView view = getView(viewId); + view.setImageDrawable(drawable); + return this; + } + + /** + * @param viewId + * @param color + * @return + */ + public ViewHolder setBackgroundColor(int viewId, int color) + { + View view = getView(viewId); + view.setBackgroundColor(color); + return this; + } + + /** + * @param viewId + * @param backgroundRes + * @return + */ + public ViewHolder setBackgroundRes(int viewId, int backgroundRes) + { + View view = getView(viewId); + view.setBackgroundResource(backgroundRes); + return this; + } + + /** + * @param viewId + * @param textColor + * @return + */ + public ViewHolder setTextColor(int viewId, int textColor) + { + TextView view = getView(viewId); + view.setTextColor(textColor); + return this; + } + + /** + * @param viewId + * @param textColorRes + * @return + */ + public ViewHolder setTextColorRes(int viewId, int textColorRes) + { + TextView view = getView(viewId); + view.setTextColor(mContext.getResources().getColor(textColorRes)); + return this; + } + + /** + * @param viewId + * @param value + * @return + */ + @SuppressLint("NewApi") + public ViewHolder setAlpha(int viewId, float value) + { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) + { + getView(viewId).setAlpha(value); + } else + { + // Pre-honeycomb hack to set Alpha value + AlphaAnimation alpha = new AlphaAnimation(value, value); + alpha.setDuration(0); + alpha.setFillAfter(true); + getView(viewId).startAnimation(alpha); + } + return this; + } + + /** + * @param viewId + * @param visible + * @return + */ + public ViewHolder setVisible(int viewId, boolean visible) + { + View view = getView(viewId); + view.setVisibility(visible ? View.VISIBLE : View.GONE); + return this; + } + + /** + * @param viewId + * @param visible + * @return + */ + public ViewHolder setVisibility(int viewId,int visible) + { + View view = getView(viewId); + view.setVisibility(visible); + return this; + } + + /** + * @param viewId + * @return + */ + public ViewHolder linkify(int viewId) + { + TextView view = getView(viewId); + Linkify.addLinks(view, Linkify.ALL); + return this; + } + + /** + * @param typeface + * @param viewIds + * @return + */ + public ViewHolder setTypeface(Typeface typeface, int... viewIds) + { + for (int viewId : viewIds) + { + TextView view = getView(viewId); + view.setTypeface(typeface); + view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); + } + return this; + } + + /** + * @param viewId + * @param progress + * @return + */ + public ViewHolder setProgress(int viewId, int progress) + { + ProgressBar view = getView(viewId); + view.setProgress(progress); + return this; + } + + /** + * @param viewId + * @param progress + * @param max + * @return + */ + public ViewHolder setProgress(int viewId, int progress, int max) + { + ProgressBar view = getView(viewId); + view.setMax(max); + view.setProgress(progress); + return this; + } + + /** + * @param viewId + * @param max + * @return + */ + public ViewHolder setMax(int viewId, int max) + { + ProgressBar view = getView(viewId); + view.setMax(max); + return this; + } + + /** + * @param viewId + * @param rating + * @return + */ + public ViewHolder setRating(int viewId, float rating) + { + RatingBar view = getView(viewId); + view.setRating(rating); + return this; + } + + /** + * @param viewId + * @param rating + * @param max + * @return + */ + public ViewHolder setRating(int viewId, float rating, int max) + { + RatingBar view = getView(viewId); + view.setMax(max); + view.setRating(rating); + return this; + } + + /** + * @param viewId + * @param tag + * @return + */ + public ViewHolder setTag(int viewId, Object tag) + { + View view = getView(viewId); + view.setTag(tag); + return this; + } + + /** + * @param viewId + * @param key + * @param tag + * @return + */ + public ViewHolder setTag(int viewId, int key, Object tag) + { + View view = getView(viewId); + view.setTag(key, tag); + return this; + } + + /** + * @param viewId + * @param checked + * @return + */ + public ViewHolder setChecked(int viewId, boolean checked) + { + Checkable view = (Checkable) getView(viewId); + view.setChecked(checked); + return this; + } + + /** + * 关于事件的 + * @param viewId + * @param listener + * @return + */ + public ViewHolder setOnClickListener(int viewId, + View.OnClickListener listener) + { + View view = getView(viewId); + view.setOnClickListener(listener); + return this; + } + + /** + * @param viewId + * @param listener + * @return + */ + public ViewHolder setOnTouchListener(int viewId, + View.OnTouchListener listener) + { + View view = getView(viewId); + view.setOnTouchListener(listener); + return this; + } + + /** + * @param viewId + * @param listener + * @return + */ + public ViewHolder setOnLongClickListener(int viewId, + View.OnLongClickListener listener) + { + View view = getView(viewId); + view.setOnLongClickListener(listener); + return this; + } + + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/common/WindowDialogAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/adapter/common/WindowDialogAdapter.kt new file mode 100644 index 0000000..32c8388 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/common/WindowDialogAdapter.kt @@ -0,0 +1,25 @@ +package com.xjjk.healthyclients.adapter.common + +import android.content.Context +import android.view.View +import android.widget.TextView +import com.xjjk.healthyclients.R + + +class WindowDialogAdapter( + var mContext: Context?, + var layoutId: Int, + var datas: ArrayList?, +) : CommonAdapter(mContext, layoutId, datas) { + override fun convert(holder: ViewHolder?, t: String?, position: Int) { + t?.let{ + holder?.getView(R.id.item_windwo_dialog_tv_name)?.setText(it) + if (position==(datas!!.size-1)) { + holder?.getView(R.id.item_windwo_dialog_tv_line)?.visibility=View.GONE + }else{ + holder?.getView(R.id.item_windwo_dialog_tv_line)?.visibility=View.VISIBLE + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/adapter/user/UserMenuAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/adapter/user/UserMenuAdapter.kt new file mode 100644 index 0000000..37bcf49 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/adapter/user/UserMenuAdapter.kt @@ -0,0 +1,19 @@ +package com.xjjk.healthyclients.adapter.user + +import android.content.Context +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.CommonAdapter +import com.xjjk.healthyclients.adapter.common.ViewHolder +import com.xjjk.healthyclients.bean.user.UserMenuBean +import com.xjjk.healthyclients.view.CustomUserInfoMenu + +class UserMenuAdapter(var mContext: Context, var layoutId: Int, var datas: ArrayList?) : CommonAdapter(mContext,layoutId,datas){ + override fun convert(holder: ViewHolder?, bean: UserMenuBean?, position: Int) { + holder?.getView(R.id.item_user_menu)?.let{ + if (bean!=null) { + it.setOrderStateInfo(bean.name,bean.resource, bean.isShow) + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/base/BaseActivity.kt b/app/src/main/java/com/xjjk/healthyclients/base/BaseActivity.kt new file mode 100644 index 0000000..fbecc1c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/base/BaseActivity.kt @@ -0,0 +1,268 @@ +package com.xjjk.healthyclients.base + +import android.app.Activity +import android.app.ActivityManager +import android.app.ActivityManager.RunningAppProcessInfo +import android.app.ProgressDialog +import android.content.Context +import android.content.Intent +import android.graphics.drawable.Drawable +import android.os.Build +import android.os.Bundle +import android.text.InputType +import android.util.AttributeSet +import android.view.View +import android.view.Window +import android.widget.EditText +import android.widget.Toast +import androidx.annotation.IdRes +import androidx.annotation.LayoutRes +import androidx.appcompat.app.AppCompatActivity +import com.sw.healthyclients.view.CustomToast +import com.sw.healthyclients.view.LoadingDialog +import com.xjjk.healthyclients.MyApplication +import com.xjjk.healthyclients.event.GlobalEvent +import com.xjjk.healthyclients.retrofit.NetApi +import com.xjjk.healthyclients.retrofit.RetrofitManager +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.MainScope +import kotlinx.coroutines.cancel +import org.greenrobot.eventbus.EventBus +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode +import java.lang.reflect.Method + + +/** + * 可以再基类中 + */ +abstract class BaseActivity : AppCompatActivity(), View.OnClickListener, CoroutineScope by MainScope() { + protected var app: MyApplication? = null + public var mContext: Context? = null + protected set + var newsApi = RetrofitManager.getRetrofits().create(NetApi::class.java) + protected set + public var mActivity: Activity? = null + var dialog: LoadingDialog? = null + protected set + protected var screenWidth = 0 + protected var screenHeight = 0 + var moveTime: Long = 0 + var currentMS: Long = 0 + + override fun onClick(view: View) { + processClick(view) + } + + override fun onCreate(paramBundle: Bundle?) { + super.onCreate(paramBundle) + EventBus.getDefault().register(this) + screenWidth = this.resources.displayMetrics.widthPixels + screenHeight = this.resources.displayMetrics.heightPixels + mContext = this + mActivity = this + createDialog() + } + + override fun onCreateView(name: String, context: Context, attrs: AttributeSet): View? { + return super.onCreateView(name, context, attrs) + } + + /** + * 创建加载弹窗 + */ + private fun createDialog() { + dialog = LoadingDialog( + mActivity, + ProgressDialog.STYLE_SPINNER, "数据加载中" + ) + dialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE) + dialog!!.setCanceledOnTouchOutside(false) + dialog!!.setCancelable(false) + dialog!!.setMessage("请稍后") + } + + override fun setContentView(@LayoutRes layoutResID: Int) { + super.setContentView(layoutResID) + initView() + initData() + bindEvent() + tryToAddBackClick() + } + + override fun setContentView(view: View) { + super.setContentView(view) + initView() + bindEvent() + initData() + tryToAddBackClick() + } + + override fun onStart() { + super.onStart() + } + + override fun onStop() { + super.onStop() + } + + override fun onDestroy() { + super.onDestroy() + cancel() + EventBus.getDefault().unregister(this) + } + + override fun onBackPressed() { + super.onBackPressed() + finish() + } + + /** + * 初始化View + */ + abstract fun initView() + + /** + * 初始化数据 + */ + abstract fun initData() + + /** + * 事件监听 + */ + protected abstract fun bindEvent() + /** + * 点击事件处理 + * + * @param paramView + */ + abstract fun processClick(paramView: View?) + /** + * 返回键的默认点击销毁当前activity + */ + fun tryToAddBackClick() {} + + + fun showLongToast(message: String?) { + CustomToast.makeText(mContext, message, Toast.LENGTH_LONG).show() + } + + fun showToast(message: String?, drawable: Drawable?) { + CustomToast.makeText(mContext, message, Toast.LENGTH_SHORT, drawable).show() + } + + fun showToast(message: String?) { + if (message != null&&message.isNotEmpty()) { + CustomToast.makeText(mContext, message, Toast.LENGTH_SHORT).show() + } + } + + + fun toActivity(clazz: Class<*>?) { + val intent = Intent(mActivity, clazz) + mActivity?.startActivity(intent) + } + + fun toActivityForResult(clazz: Class<*>?,code:Int) { + val intent = Intent(mActivity, clazz) + mActivity?.startActivityForResult(intent, code) + } + fun toActivityForResult(clazz: Class<*>?,bundle: Bundle?,code:Int) { + val intent = Intent(mActivity, clazz) + if (bundle != null) { + intent.putExtras(bundle) + } + mActivity?.startActivityForResult(intent, code) + } + + fun toActivity(clazz: Class<*>?, bundle: Bundle?) { + val intent = Intent(mActivity, clazz) + if (bundle != null) { + intent.putExtras(bundle) + } + mActivity?.startActivity(intent) + } + + protected fun toLoginActivity(clazz: Class<*>?) { + val intent = Intent(mActivity, clazz) + mActivity?.startActivity(intent) + } + + override fun onRestart() { + super.onRestart() + } + + override fun finish() { + super.finish() + } + + protected fun F(@IdRes viewId: Int): E { + return super.findViewById(viewId) as E + } + + protected fun F(view: View, @IdRes viewId: Int): E { + return view.findViewById(viewId) as E + } + + protected fun C(view: E) { + view!!.setOnClickListener(this) + }// The name of the process that this object is associated with.// Returns a list of application processes that are running on the + // device + /** + * 程序是否在前台运行 + * + * @return + */ + val isAppOnForeground: Boolean + get() { + // Returns a list of application processes that are running on the + // device + val activityManager = applicationContext + .getSystemService(ACTIVITY_SERVICE) as ActivityManager + val packageName = applicationContext.packageName + val appProcesses = activityManager + .runningAppProcesses ?: return false + for (appProcess in appProcesses) { + // The name of the process that this object is associated with. + if (appProcess.processName == packageName && appProcess.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { + return true + } + } + return false + } + + + fun disableShowInput(view: EditText) { + if (Build.VERSION.SDK_INT <= 10) { + view.inputType = InputType.TYPE_NULL + } else { + val cls = EditText::class.java + var method: Method + try { + method = cls.getMethod("setShowSoftInputOnFocus", Boolean::class.javaPrimitiveType) + method.isAccessible = true + method.invoke(view, false) + } catch (e: Exception) { //TODO: handle exception + } + try { + method = cls.getMethod("setSoftInputShownOnFocus", Boolean::class.javaPrimitiveType) + method.isAccessible = true + method.invoke(view, false) + } catch (e: Exception) { //TODO: handle exception + } + } + } + + + @Subscribe(threadMode = ThreadMode.MAIN) + open fun onMessageEvent(event: GlobalEvent?) { + try { + event?.let{ event-> + if (event is GlobalEvent) { + + } + } + } catch (e: Exception) { + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/base/BaseFragment.kt b/app/src/main/java/com/xjjk/healthyclients/base/BaseFragment.kt new file mode 100644 index 0000000..dc3f7f8 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/base/BaseFragment.kt @@ -0,0 +1,81 @@ +package com.xjjk.healthyclients.base + +import android.annotation.SuppressLint +import android.content.Context +import android.content.Intent +import android.os.Build +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Toast +import androidx.annotation.RequiresApi +import androidx.fragment.app.Fragment +import com.sw.healthyclients.utils.StatusbarUtil +import com.sw.healthyclients.view.CustomToast +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.MainScope + + +/** + * 可以再基类中 + */ +abstract class BaseFragment : Fragment(), View.OnClickListener, CoroutineScope by MainScope() { + var mContext:Context?=null + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + mContext=context + return inflater.inflate(getContentLayoutId(), container, false); + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + initViews(view); + initData(); + bindEvent() + } + fun fitTransparentStatusBar(view: View?){ + view?.let { + var statusHeight = StatusbarUtil.getStatusBarHeight(requireContext()) + it.setPadding(0, statusHeight, + 0, 0) + var height: Int = it.layoutParams?.height ?: 0 + it.layoutParams.height = height + statusHeight + + } + } + protected abstract fun getContentLayoutId(): Int + protected abstract fun getStatusbarStyle(): Int // 0 主题色+白字 1白底黑字 + protected abstract fun initViews(root: View?) + + protected open fun initData() {} + protected abstract fun bindEvent() + + @RequiresApi(Build.VERSION_CODES.M) + @SuppressLint("ResourceAsColor") + override fun onResume() { + super.onResume() +// try { +// if (getStatusbarStyle()==0) { +// activity?.let { StatusbarUtil.customColorMode(it, "#54eccb",false) } +// }else if (getStatusbarStyle()==1){ +// activity?.let { StatusbarUtil.customColorMode(it, "#FFFFFFFF",true) } +// } +// } catch (e: Exception) { +// } + } + + fun showToast(message: String?) { + if (message != null&&message.isNotEmpty()) { + CustomToast.makeText(mContext, message, Toast.LENGTH_SHORT).show() + } + } + + fun toActivity(clazz: Class<*>?) { + val intent = Intent(activity, clazz) + activity?.startActivity(intent) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/base/BaseVMBActivity.kt b/app/src/main/java/com/xjjk/healthyclients/base/BaseVMBActivity.kt new file mode 100644 index 0000000..bf9ceec --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/base/BaseVMBActivity.kt @@ -0,0 +1,492 @@ +package com.xjjk.healthyclients.base + +import android.app.Activity +import android.app.ProgressDialog +import android.content.Context +import android.content.Intent +import android.content.res.Configuration +import android.content.res.Resources +import android.graphics.drawable.ColorDrawable +import android.graphics.drawable.Drawable +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.Window +import android.widget.ImageView +import android.widget.RelativeLayout +import android.widget.TextView +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat +import androidx.core.graphics.ColorUtils +import androidx.databinding.DataBindingUtil +import androidx.databinding.OnRebindCallback +import androidx.databinding.ViewDataBinding +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import com.gyf.immersionbar.ktx.immersionBar +import com.orhanobut.logger.Logger +import com.sw.healthyclients.utils.CustomActivityManager +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.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 +import com.xjjk.healthyclients.event.GlobalEvent +import com.xjjk.healthyclients.superfuntion.hideLoading +import com.xjjk.healthyclients.superfuntion.showLoading +import com.xjjk.healthyclients.superfuntion.startLoginActivity +import com.xjjk.healthyclients.ui.activity.LoginActivity +import kotlinx.coroutines.launch +import org.greenrobot.eventbus.EventBus +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode +import retrofit2.HttpException +import java.io.IOException +import java.lang.reflect.ParameterizedType +import java.net.ConnectException +import java.net.SocketTimeoutException +import java.net.UnknownHostException +import java.sql.SQLException + + +/** + * 封装了ViewModel和DataBinding的Activity基类 + * + * @author nanfeifei 2021/11/23 + */ +abstract class BaseVMBActivity(private val contentViewResId: Int) : + AppCompatActivity(), View.OnClickListener { + var mContext: Context? = null + var mActivity: Activity? = null + lateinit var mViewModel: VM + lateinit var mBinding: B + var dialog: LoadingDialog? = null + 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) + EventBus.getDefault().register(this) + mContext = this + mActivity = this + initViewModel() + initDataBinding() + initImmersionBar() + onDrawFinish() + createObserve() + createDialog() + initView(savedInstanceState) + initData() + bindEvent() + mBinding.addOnRebindCallback(object : OnRebindCallback(){ + override fun onPreBind(binding: B): Boolean {//数据绑定之前 + return super.onPreBind(binding) + } + override fun onBound(binding: B) {//数据绑定之后 + super.onBound(binding) + setTransparentStatusBar(transparentStatusBar(), statusBarDarkFont()) + dataBindingFinish() + } + }) + + } + + open fun initImmersionBar() { + initToolBar() + } + + open fun onDrawFinish(){ + mRootView=findViewById(R.id.rl_empty_root_view) + mRootView?.let{ + mEmpty=LayoutInflater.from(mContext) + .inflate(R.layout.layout_empty, it, false).apply { + findViewById(R.id.tv_empty).text = "暂无数据" + } + var layoutParams = + RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT) + layoutParams.addRule(RelativeLayout.BELOW, R.id.toolbar_lay) + mEmpty?.layoutParams = layoutParams + } + + } + open fun dataBindingFinish(){ + + } + fun showEmpty(emptyMessage:String="暂无数据"){ + if (mEmpty?.parent==null) { + mRootView?.addView(mEmpty) + }else{ + mRootView?.removeView(mEmpty) + mRootView?.addView(mEmpty) + } + } + + fun hindEmpty(emptyMessage:String="暂无数据"){ + mRootView?.removeView(mEmpty) + } + + /** + * + * @param isTransparent + * @param isStatusBarDarkFont + */ + open fun setTransparentStatusBar(isTransparent: Boolean, isStatusBarDarkFont: Boolean) { + immersionBar { +// reset() + titleBar(getToolBar()) + var bgColor: Int = ContextCompat.getColor(this@BaseVMBActivity, R.color.colorAccent) + if (isTransparent) { + statusBarColorInt(ContextCompat.getColor(this@BaseVMBActivity, R.color.transparent)) + .fitsSystemWindows(false) //解决状态栏和布局重叠问题 + //如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持状态栏字体变色,会使当前状态栏加上透明度,否则不执行透明度 + statusBarDarkFont(isStatusBarDarkFont,0.2f) + } else { + var relativeLayout: RelativeLayout? = findViewById(R.id.toolbar_lay) + var background = relativeLayout?.background + if (relativeLayout != null && background is ColorDrawable) { + bgColor = background.color + } + statusBarColorInt(bgColor) + .fitsSystemWindows(false) //解决状态栏和布局重叠问题 + //如果为亮色则状态栏字体为黑色,否则为白色 + statusBarDarkFont(isLightColor(bgColor), 0.2f) + } + } + } + + /** + * 判断一个颜色是否是亮色 + */ + fun isLightColor(color: Int): Boolean { + val darkness = ColorUtils.calculateLuminance(color) + return darkness >= 0.5 + } + private fun initToolBar() { +// if (transparentStatusBar()) { + var titleLay: View? = findViewById(R.id.rl_title_lay) + if (titleLay == null){ + titleLay = findViewById(R.id.toolbar_lay) + } + if (titleLay == null){ + titleLay = getToolBar() + } + fitTransparentStatusBar(titleLay) + +// } + findViewById(R.id.title_iv_back)?.setOnClickListener { + onBackEvent() + } + } + + fun fitTransparentStatusBar(view: View?) { + view?.let { + var statusHeight = StatusbarUtil.getStatusBarHeight(this@BaseVMBActivity) + it.setPadding( + 0, statusHeight, + 0, 0 + ) + var height: Int = it.layoutParams?.height ?: 0 + it.layoutParams.height = height + statusHeight + } + } + + fun addClickViews(vararg views: View) { + for (view in views) { + view.setOnClickListener(this) + } + } + + override fun onBackPressed() { + onBackEvent() + } + + open fun onBackEvent() { + super.onBackPressed() +// finish() + } + + override fun onClick(view: View) { + processClick(view) + } + + open fun getToolBar(): View? { + return null + } + + /** + * 是否是透明状态栏 + */ + open fun transparentStatusBar(): Boolean { + return false + } + + /** 状态栏是否是深色*/ + open fun statusBarDarkFont(): Boolean { + return false + } + + /** ViewModel初始化 */ + @Suppress("UNCHECKED_CAST") + open fun initViewModel() { + // 这里利用反射获取泛型中第一个参数ViewModel + val type: Class = + (this.javaClass.genericSuperclass as ParameterizedType).actualTypeArguments[0] as Class + mViewModel = ViewModelProvider(this)[type] + mViewModel.init() + } + + /** DataBinding初始化 */ + private fun initDataBinding() { + mBinding = DataBindingUtil.setContentView(this, contentViewResId) + mBinding.apply { + // 需绑定lifecycleOwner到activity,xml绑定的数据才会随着liveData数据源的改变而改变 + lifecycleOwner = this@BaseVMBActivity + setVariable(BR.viewModel, mViewModel) + } + } + + /** View相关初始化 */ + abstract fun initView(savedInstanceState: Bundle?) + + /** + * 初始化数据 + */ + abstract fun initData() + + /** + * 事件监听 + */ + protected abstract fun bindEvent() + + /** + * 点击事件处理 + * + * @param paramView + */ + abstract fun processClick(v: View?) + fun showLongToast(message: String?) { + CustomToast.makeText(mContext, message, Toast.LENGTH_LONG).show() + } + + fun showToast(message: String?, drawable: Drawable?) { + CustomToast.makeText(mContext, message, Toast.LENGTH_SHORT, drawable).show() + } + + fun showToast(message: String?) { + if (message != null && message.isNotEmpty()) { + CustomToast.makeText(mContext, message, Toast.LENGTH_SHORT).show() + } + } + + /** 提供编写LiveData监听逻辑的方法 */ + open fun createObserve() { + // 全局服务器请求错误监听 + mViewModel.apply { + loadingDialog.observe(this@BaseVMBActivity) { + when (it) { + LOADING_STATE_SHOW -> { + showLoading() + } + + LOADING_STATE_HIDE -> { + hideLoading() + } + } + } + showEmpty.observe(this@BaseVMBActivity){ + if (isAutoEmpty.value == true&&it){ + showEmpty() + }else{ + hindEmpty() + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + toastMessage.collect { message -> + message?.let { + CustomToast.makeText( + this@BaseVMBActivity, message, Toast.LENGTH_SHORT + ).show() + } + } + } + } + exception.observe(this@BaseVMBActivity) { + requestError(it.message) + Logger.e("Network error:${it.message}") + when (it) { + is HttpException -> { + if (it.code() == 401) { + val activity = CustomActivityManager.getInstance().currentActivity() + if (activity !is LoginActivity) { + startLoginActivity(this@BaseVMBActivity) + finish() + } + }else if (it.code() == 404) { + CustomToast.makeText( + this@BaseVMBActivity, + "服务器走丢了,请稍后重试", + Toast.LENGTH_SHORT + ).show() + } + } + is SocketTimeoutException -> CustomToast.makeText( + this@BaseVMBActivity, + getString(R.string.request_time_out), Toast.LENGTH_SHORT + ).show() + + is ConnectException, is UnknownHostException -> + CustomToast.makeText( + this@BaseVMBActivity, + getString(R.string.network_error), Toast.LENGTH_SHORT + ).show() + is IOException, is SQLException -> + CustomToast.makeText( + this@BaseVMBActivity, + getString(R.string.response_error), Toast.LENGTH_SHORT + ).show() + else -> + CustomToast.makeText( + this@BaseVMBActivity, + it.message ?: getString(R.string.response_error), + Toast.LENGTH_SHORT + ).show() + + } + } + + // 全局服务器返回的错误信息监听 + errorResponse.observe(this@BaseVMBActivity) { + requestError(it?.message) + when (it) { + is HttpException -> { + if (it.code() == 401) { + startLoginActivity(this@BaseVMBActivity) + finish() + } + } + + else -> { + it?.message?.run { + CustomToast.makeText( + this@BaseVMBActivity, + this ?: getString(R.string.response_error), + Toast.LENGTH_SHORT + ).show() + } + it?.msg?.run { + CustomToast.makeText( + this@BaseVMBActivity, + this ?: getString(R.string.response_error), + Toast.LENGTH_SHORT + ).show() + } + } + } + } + } + } + + /** 提供一个请求错误的方法,用于像关闭加载框,显示错误布局之类的 */ + open fun requestError(msg: String?) { + mViewModel.loadingDialog.value = LOADING_STATE_HIDE + } + + override fun onDestroy() { + super.onDestroy() + mViewModel.loadingDialog.value = LOADING_STATE_HIDE + EventBus.getDefault().unregister(this) + } + + @Subscribe(threadMode = ThreadMode.MAIN) + open fun onMessageEvent(event: Any?) { + try { + event?.let { event -> + if (event is GlobalEvent) { + if (event.message == 0) { + mContext?.let { + startLoginActivity(it) + } + var currentActivity= CustomActivityManager.getInstance().currentActivity() + if (!currentActivity.toString().contains("MainActivity")) { + CustomActivityManager.getInstance().finishActivity(CustomActivityManager.getInstance().currentActivity()) + } + + } + } + } + } catch (e: Exception) { + } + } + + /** + * 登录状态发生变化 + */ + open fun loginStateChange(isLogin: Boolean) { + + } + + fun toActivity(clazz: Class<*>?) { + val intent = Intent(mActivity, clazz) + mActivity?.startActivity(intent) + } + + fun toActivityForResult(clazz: Class<*>?, code: Int) { + val intent = Intent(mActivity, clazz) + mActivity?.startActivityForResult(intent, code) + } + + fun toActivityForResult(clazz: Class<*>?, bundle: Bundle?, code: Int) { + val intent = Intent(mActivity, clazz) + if (bundle != null) { + intent.putExtras(bundle) + } + mActivity?.startActivityForResult(intent, code) + } + + fun toActivity(clazz: Class<*>?, bundle: Bundle?) { + val intent = Intent(mActivity, clazz) + if (bundle != null) { + intent.putExtras(bundle) + } + mActivity?.startActivity(intent) + } + + private fun createDialog() { + dialog = LoadingDialog( + mContext, + ProgressDialog.STYLE_SPINNER, "数据加载中" + ) + dialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE) + dialog!!.setCanceledOnTouchOutside(false) + dialog!!.setCancelable(false) + dialog!!.setMessage("请稍后...") + } + + // 字体大小不跟随系统 + override fun attachBaseContext(newBase: Context) { + super.attachBaseContext(getConfigurationContext(newBase)) + } + + private fun getConfigurationContext(context: Context): Context { + val configuration = context.resources.configuration + configuration.fontScale = 1f + return context.createConfigurationContext(configuration) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/base/BaseVMBFragment.kt b/app/src/main/java/com/xjjk/healthyclients/base/BaseVMBFragment.kt new file mode 100644 index 0000000..158c8f0 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/base/BaseVMBFragment.kt @@ -0,0 +1,379 @@ +package com.xjjk.healthyclients.base + +import android.app.ProgressDialog +import android.content.Intent +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.view.Window +import android.view.WindowManager +import android.widget.RelativeLayout +import android.widget.TextView +import android.widget.Toast +import androidx.databinding.DataBindingUtil +import androidx.databinding.ViewDataBinding +import androidx.fragment.app.Fragment +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +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.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 +import com.xjjk.healthyclients.superfuntion.hideLoading +import com.xjjk.healthyclients.superfuntion.showLoading +import com.xjjk.healthyclients.superfuntion.startLoginActivity +import kotlinx.coroutines.launch +import org.greenrobot.eventbus.EventBus +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode +import retrofit2.HttpException +import java.io.IOException +import java.lang.reflect.ParameterizedType +import java.net.ConnectException +import java.net.SocketTimeoutException +import java.net.UnknownHostException +import java.sql.SQLException + +/** + * 封装了ViewModel和DataBinding的Fragment基类 + * 未默认实现onClick方法主要为了让使用者看到而不是另外实现接口 + * + * @author LTP 2021/11/23 + */ +abstract class BaseVMBFragment(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 + 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 + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + if (!EventBus.getDefault().isRegistered(this)) { + EventBus.getDefault().register(this) + } + createDialog() + mIsFirstLoading = true + initViewModel() + onDrawFinish() + initView(view, savedInstanceState) + initData() + setupDataBinding() + createObserve() + initToolBar() + bindEvent() + } + + /** ViewModel初始化 */ + @Suppress("UNCHECKED_CAST") + open fun initViewModel() { + // 这里利用反射获取泛型中第一个参数ViewModel + val type: Class = + (this.javaClass.genericSuperclass as ParameterizedType).actualTypeArguments[0] as Class + mViewModel = ViewModelProvider(this)[type] + mViewModel.init() + } + + /** DataBinding相关设置 */ + private fun setupDataBinding() { + mBinding.apply { + // 需绑定lifecycleOwner到Fragment,xml绑定的数据才会随着liveData数据源的改变而改变 + lifecycleOwner = viewLifecycleOwner + setVariable(BR.viewModel, mViewModel) + } + } + + /** View相关初始化 */ + abstract fun initView(root: View?, savedInstanceState: Bundle?) + private fun initToolBar() { + if (transparentStatusBar()) { + var titleLay: View? = mBinding.root.findViewById(R.id.rl_title_lay) + if (titleLay == null) { + titleLay = mBinding.root.findViewById(R.id.toolbar_lay) + } + fitTransparentStatusBar(titleLay) + + } + } + + fun fitTransparentStatusBar(view: View?) { + view?.let { + var statusHeight = StatusbarUtil.getStatusBarHeight(requireContext()) + it.setPadding( + 0, statusHeight, + 0, 0 + ) + var height: Int = it.layoutParams?.height ?: 0 + it.layoutParams.height = height + statusHeight + + } + } + + open fun onDrawFinish(){ + mRootView=mBinding.root.findViewById(R.id.rl_empty_root_view) + mRootView?.let{ + mEmpty=LayoutInflater.from(context) + .inflate(R.layout.layout_empty, it, false).apply { + findViewById(R.id.tv_empty).text = "暂无数据" + } + var layoutParams = + RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT) + layoutParams.addRule(RelativeLayout.BELOW, R.id.toolbar_lay) + mEmpty?.layoutParams = layoutParams + } + } + + fun showEmpty(emptyMessage:String="暂无数据",color: Int=0){ + try { + if(color!=0){ + mEmpty?.setBackgroundColor(color) + } + mEmpty?.findViewById(R.id.tv_empty)?.setText(emptyMessage) + + if (mEmpty?.parent==null) { + mRootView?.addView(mEmpty) + }else{ + mRootView?.removeView(mEmpty) + mRootView?.addView(mEmpty) + } + } catch (e: Exception) { + e.printStackTrace() + } + } + + fun hindEmpty(emptyMessage:String="暂无数据"){ + try { + mRootView?.removeView(mEmpty) + } 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) + } + } + + /** 数据懒加载 */ + open fun lazyLoadData() {} + + /** 提供编写LiveData监听逻辑的方法 */ + open fun createObserve() { // 全局服务器请求错误监听 + mViewModel.apply { + loadingDialog.observe(viewLifecycleOwner) { + when (it) { + LOADING_STATE_SHOW -> { + showLoading() + } + + LOADING_STATE_HIDE -> { + hideLoading() + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + toastMessage.collect { message -> + message?.let { + CustomToast.makeText( + requireContext(), message, Toast.LENGTH_SHORT + ).show() + } + } + } + } + exception.observe(viewLifecycleOwner) { + requestError(it.message) + Logger.e("Network error:${it.message}") + when (it) { + is HttpException -> { + if (it.code() == 401) { + startLoginActivity(requireContext()) + requireActivity().finish() + }else if (it.code() == 404) { + CustomToast.makeText( + requireContext(), + "服务器走丢了,请稍后重试", + Toast.LENGTH_SHORT + ).show() + } + } + + is SocketTimeoutException -> CustomToast.makeText( + requireContext(), + getString(R.string.request_time_out), Toast.LENGTH_SHORT + ).show() + + is ConnectException, is UnknownHostException -> + CustomToast.makeText( + 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(), + it.message ?: getString(R.string.response_error), + Toast.LENGTH_SHORT + ).show() + } + } + + // 全局服务器返回的错误信息监听 + errorResponse.observe(viewLifecycleOwner) { + requestError(it?.message) + when (it) { + is HttpException -> { + if (it.code() == 401) { + startLoginActivity(requireContext()) + requireActivity().finish() + } + } + + 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), + Toast.LENGTH_SHORT + ).show() + } + } + } + } + } + } + } + + /** 提供一个请求错误的方法,用于像关闭加载框之类的 */ + open fun requestError(msg: String? = null) { + mViewModel.loadingDialog.value = LOADING_STATE_HIDE + } + + override fun onDestroyView() { + mBinding == null + super.onDestroyView() + } + + override fun onDestroy() { + super.onDestroy() + if (!EventBus.getDefault().isRegistered(this)) { + EventBus.getDefault().unregister(this) + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + open fun onMessageEvent(event: Any?) { + + } + + open fun loginStateChange(isLogin: Boolean) { + + } + + protected open fun initData() {} + 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) + activity?.startActivity(intent) + } + + fun toActivity(clazz: Class<*>?, bundle: Bundle?) { + val intent = Intent(activity, clazz) + if (bundle != null) { + intent.putExtras(bundle) + } + activity?.startActivity(intent) + } + + /** + * 历史遗留方法,懒得改以前的了,新页面无视即可 + */ + open fun getStatusbarStyle(): Int{ + return 0 + } // 0 主题色+白字 1白底黑字 + + private fun createDialog() { + dialog = LoadingDialog( + activity, + ProgressDialog.STYLE_SPINNER, "数据加载中" + ) + dialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE) + dialog!!.setCanceledOnTouchOutside(false) + dialog!!.setCancelable(false) + dialog!!.setMessage("请稍后") + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/base/repository/BaseRepository.kt b/app/src/main/java/com/xjjk/healthyclients/base/repository/BaseRepository.kt new file mode 100644 index 0000000..4bce67a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/base/repository/BaseRepository.kt @@ -0,0 +1,19 @@ +package com.xjjk.healthyclients.base.repository + +import com.xjjk.healthyclients.data.bean.ApiResponse +import com.xjjk.healthyclients.retrofit.ResultData +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext + +/** + * Repository数据仓库基类,主要用于协程的调用 + * + * @author LTP 2022/3/23 + */ +open class BaseRepository { + + suspend fun apiCall(api: suspend () -> ApiResponse): ApiResponse { + return withContext(Dispatchers.IO) { + api.invoke() } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/base/viewmodel/BaseViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/base/viewmodel/BaseViewModel.kt new file mode 100644 index 0000000..f13cabd --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/base/viewmodel/BaseViewModel.kt @@ -0,0 +1,33 @@ +package com.xjjk.healthyclients.base.viewmodel + +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel +import com.xjjk.healthyclients.data.bean.ApiResponse +import com.xjjk.healthyclients.retrofit.ResultData +import kotlinx.coroutines.flow.MutableStateFlow + +/** + * ViewModel基类 + * @author LTP 2021/11/23 + */ +abstract class BaseViewModel : ViewModel() { + companion object{ + const val LOADING_STATE_SHOW = 1 + const val LOADING_STATE_HIDE = 2 + } + /** 加载框控制 */ + var loadingDialog = MutableLiveData() + /** 请求异常(服务器请求失败,譬如:服务器连接超时等) */ + val exception = MutableLiveData() + + /** 请求服务器返回错误(服务器请求成功但status错误,譬如:登录过期等) */ + val errorResponse = MutableLiveData?>() + /** Toast文本 */ + var toastMessage = MutableStateFlow(null) + /** 界面启动时要进行的初始化逻辑,如网络请求,数据初始化等 */ + abstract fun init() + /** 监听请求,返回空数据的时候是否自动展示空页面*/ + var isAutoEmpty = MutableLiveData() + /** 监听请求,是否展示空页面*/ + var showEmpty = MutableLiveData(false) +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/base/viewmodel/TestViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/base/viewmodel/TestViewModel.kt new file mode 100644 index 0000000..1889ced --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/base/viewmodel/TestViewModel.kt @@ -0,0 +1,6 @@ +package com.xjjk.healthyclients.base.viewmodel + +class TestViewModel: BaseViewModel() { + override fun init() { + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/AEDResultBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/AEDResultBean.java new file mode 100644 index 0000000..96ec4dc --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/AEDResultBean.java @@ -0,0 +1,383 @@ +package com.xjjk.healthyclients.bean; + +public class AEDResultBean { + + private Integer id; + private String name; + private Double longitude; + private Double latitude; + private String departCode; + private String hostModel; + private String hostSerialNum; + private String electrodeSheetValidTime; + private String routerModel; + private String routerSerialNum; + private String batteryModel; + private Double batteryVoltage; + private String warrantyStartDate; + private String warrantyEndDate; + private Object aedImg; + private String mfrsName; + private String mfrsMobile; + private String installAddress; + private Object installAddressImg; + private Object manageUserId; + private String manageUserName; + private String manageUserMobile; + private String checkStatus; + private String checkStatus_dictText; + private String electrodeSheetStatus; + private String electrodeSheetStatus_dictText; + private String batteryStatus; + private String batteryStatus_dictText; + private String routerStatus; + private String routerStatus_dictText; + private String departName; + private Integer delFlag; + private Object createBy; + private Object createTime; + private Object updateBy; + private Object updateTime; + private Object memo; + private Double distance; + private String chargeFirst; + private String chargeFirstMobile; + private String chargeSecond; + private String chargeSecondMobile; + + public String getChargeFirst() { + return chargeFirst == null ? "" : chargeFirst; + } + + public void setChargeFirst(String chargeFirst) { + this.chargeFirst = chargeFirst; + } + + public String getChargeFirstMobile() { + return chargeFirstMobile == null ? "" : chargeFirstMobile; + } + + public void setChargeFirstMobile(String chargeFirstMobile) { + this.chargeFirstMobile = chargeFirstMobile; + } + + public String getChargeSecond() { + return chargeSecond == null ? "" : chargeSecond; + } + + public void setChargeSecond(String chargeSecond) { + this.chargeSecond = chargeSecond; + } + + public String getChargeSecondMobile() { + return chargeSecondMobile == null ? "" : chargeSecondMobile; + } + + public void setChargeSecondMobile(String chargeSecondMobile) { + this.chargeSecondMobile = chargeSecondMobile; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public String getDepartCode() { + return departCode; + } + + public void setDepartCode(String departCode) { + this.departCode = departCode; + } + + public String getHostModel() { + return hostModel; + } + + public void setHostModel(String hostModel) { + this.hostModel = hostModel; + } + + public String getHostSerialNum() { + return hostSerialNum; + } + + public void setHostSerialNum(String hostSerialNum) { + this.hostSerialNum = hostSerialNum; + } + + public String getElectrodeSheetValidTime() { + return electrodeSheetValidTime; + } + + public void setElectrodeSheetValidTime(String electrodeSheetValidTime) { + this.electrodeSheetValidTime = electrodeSheetValidTime; + } + + public String getRouterModel() { + return routerModel; + } + + public void setRouterModel(String routerModel) { + this.routerModel = routerModel; + } + + public String getRouterSerialNum() { + return routerSerialNum; + } + + public void setRouterSerialNum(String routerSerialNum) { + this.routerSerialNum = routerSerialNum; + } + + public String getBatteryModel() { + return batteryModel; + } + + public void setBatteryModel(String batteryModel) { + this.batteryModel = batteryModel; + } + + public Double getBatteryVoltage() { + return batteryVoltage; + } + + public void setBatteryVoltage(Double batteryVoltage) { + this.batteryVoltage = batteryVoltage; + } + + public String getWarrantyStartDate() { + return warrantyStartDate; + } + + public void setWarrantyStartDate(String warrantyStartDate) { + this.warrantyStartDate = warrantyStartDate; + } + + public String getWarrantyEndDate() { + return warrantyEndDate; + } + + public void setWarrantyEndDate(String warrantyEndDate) { + this.warrantyEndDate = warrantyEndDate; + } + + public Object getAedImg() { + return aedImg; + } + + public void setAedImg(Object aedImg) { + this.aedImg = aedImg; + } + + public String getMfrsName() { + return mfrsName; + } + + public void setMfrsName(String mfrsName) { + this.mfrsName = mfrsName; + } + + public String getMfrsMobile() { + return mfrsMobile; + } + + public void setMfrsMobile(String mfrsMobile) { + this.mfrsMobile = mfrsMobile; + } + + public String getInstallAddress() { + return installAddress; + } + + public void setInstallAddress(String installAddress) { + this.installAddress = installAddress; + } + + public Object getInstallAddressImg() { + return installAddressImg; + } + + public void setInstallAddressImg(Object installAddressImg) { + this.installAddressImg = installAddressImg; + } + + public Object getManageUserId() { + return manageUserId; + } + + public void setManageUserId(Object manageUserId) { + this.manageUserId = manageUserId; + } + + public String getManageUserName() { + return manageUserName; + } + + public void setManageUserName(String manageUserName) { + this.manageUserName = manageUserName; + } + + public String getManageUserMobile() { + return manageUserMobile; + } + + public void setManageUserMobile(String manageUserMobile) { + this.manageUserMobile = manageUserMobile; + } + + public String getCheckStatus() { + return checkStatus; + } + + public void setCheckStatus(String checkStatus) { + this.checkStatus = checkStatus; + } + + public String getCheckStatus_dictText() { + return checkStatus_dictText; + } + + public void setCheckStatus_dictText(String checkStatus_dictText) { + this.checkStatus_dictText = checkStatus_dictText; + } + + public String getElectrodeSheetStatus() { + return electrodeSheetStatus; + } + + public void setElectrodeSheetStatus(String electrodeSheetStatus) { + this.electrodeSheetStatus = electrodeSheetStatus; + } + + public String getElectrodeSheetStatus_dictText() { + return electrodeSheetStatus_dictText; + } + + public void setElectrodeSheetStatus_dictText(String electrodeSheetStatus_dictText) { + this.electrodeSheetStatus_dictText = electrodeSheetStatus_dictText; + } + + public String getBatteryStatus() { + return batteryStatus; + } + + public void setBatteryStatus(String batteryStatus) { + this.batteryStatus = batteryStatus; + } + + public String getBatteryStatus_dictText() { + return batteryStatus_dictText; + } + + public void setBatteryStatus_dictText(String batteryStatus_dictText) { + this.batteryStatus_dictText = batteryStatus_dictText; + } + + public String getRouterStatus() { + return routerStatus; + } + + public void setRouterStatus(String routerStatus) { + this.routerStatus = routerStatus; + } + + public String getRouterStatus_dictText() { + return routerStatus_dictText; + } + + public void setRouterStatus_dictText(String routerStatus_dictText) { + this.routerStatus_dictText = routerStatus_dictText; + } + + public String getDepartName() { + return departName; + } + + public void setDepartName(String departName) { + this.departName = departName; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public Object getCreateTime() { + return createTime; + } + + public void setCreateTime(Object createTime) { + this.createTime = createTime; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getMemo() { + return memo; + } + + public void setMemo(Object memo) { + this.memo = memo; + } + + public Double getDistance() { + return distance; + } + + public void setDistance(Double distance) { + this.distance = distance; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/AedNetworkingBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/AedNetworkingBean.kt new file mode 100644 index 0000000..6f29afa --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/AedNetworkingBean.kt @@ -0,0 +1,31 @@ +package com.xjjk.healthyclients.bean +import java.io.Serializable + + +class AedNetworkingBean : Serializable { + var aedStatus: String? = null + var chargeFirst: String? = null + var chargeFirstMobile: String? = null + var chargeSecond: String? = null + var chargeSecondMobile: String? = null + var code: String? = null + var controlOrgName: String? = null + var coverUserNum: Int? = null + var departName: String? = null + var disclaimer: String? = null + var distance: Double? = null + var hostModel: String? = null + var hostSerialNum: String? = null + var installAddress: String? = null + var installAddressImg: String? = null + var latitude: Double = 0.0 + var longitude: Double = 0.0 + var manageUserMobile: String? = null + var manageUserName: String? = null + var mfrsMobile: String? = null + var name: String? = null + var operateInstruction: String? = null + var operateVideo: String? = null + var operateType: Int = 0 + var brand: String? = null +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/AppUpdateBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/AppUpdateBean.kt new file mode 100644 index 0000000..4275af0 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/AppUpdateBean.kt @@ -0,0 +1,16 @@ +package com.xjjk.healthyclients.bean + +data class AppUpdateBean( + var appId: String = "", + var appName: String = "", + var appStatus: Int = 0, + var appUrl: String = "", + var deviceType: Int = 0, + var forced: Int = 0, + var id: String = "", + var ignoreFlag: Int = 0, + var updateContent: String = "", + var updateTime: Any? = null, + var versionName: String = "", + var versionNo: Int = 0 +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/CommonSettingMenuBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/CommonSettingMenuBean.kt new file mode 100644 index 0000000..97353b4 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/CommonSettingMenuBean.kt @@ -0,0 +1,14 @@ +package com.xjjk.healthyclients.bean + + +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter + +/** + * 配置菜单 + */ +data class CommonSettingMenuBean( + val value: String = "", + val text: String = "", + override val itemType: Int = -1, + override var checked: Boolean = false +): BaseCheckRecycleViewAdapter.CheckItem diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/CvdMainBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/CvdMainBean.java new file mode 100644 index 0000000..e413a6f --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/CvdMainBean.java @@ -0,0 +1,113 @@ +package com.xjjk.healthyclients.bean; + +import java.util.ArrayList; + +public class CvdMainBean { + + private ArrayList indexItemVos; + private String days; + private long distance; + private double aveSleep; + + public ArrayList getIndexItemVos() { + return indexItemVos; + } + + public void setIndexItemVos(ArrayList 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; + } + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/CvdRiskInfoBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/CvdRiskInfoBean.java new file mode 100644 index 0000000..d454d64 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/CvdRiskInfoBean.java @@ -0,0 +1,140 @@ +package com.xjjk.healthyclients.bean; + +public class CvdRiskInfoBean { + + private String id; + private String warningData; + private String riskData; + private String riskMiValue; + private String riskSuddenDeathValue; + private String riskCiValue; + private String riskChValue; + private String riskMiValueName; + private String riskMiValueColor; + private String riskSuddenDeathValueName; + private String riskSuddenDeathValueColor; + private String riskCiValueName; + private String riskCiValueColor; + private String riskChValueName; + private String riskChValueColor; + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getWarningData() { + return warningData == null ? "" : warningData; + } + + public void setWarningData(String warningData) { + this.warningData = warningData; + } + + public String getRiskData() { + return riskData == null ? "" : riskData; + } + + public void setRiskData(String riskData) { + this.riskData = riskData; + } + + public String getRiskMiValue() { + return riskMiValue == null ? "" : riskMiValue; + } + + public void setRiskMiValue(String riskMiValue) { + this.riskMiValue = riskMiValue; + } + + public String getRiskSuddenDeathValue() { + return riskSuddenDeathValue == null ? "" : riskSuddenDeathValue; + } + + public void setRiskSuddenDeathValue(String riskSuddenDeathValue) { + this.riskSuddenDeathValue = riskSuddenDeathValue; + } + + public String getRiskCiValue() { + return riskCiValue == null ? "" : riskCiValue; + } + + public void setRiskCiValue(String riskCiValue) { + this.riskCiValue = riskCiValue; + } + + public String getRiskChValue() { + return riskChValue == null ? "" : riskChValue; + } + + public void setRiskChValue(String riskChValue) { + this.riskChValue = riskChValue; + } + + public String getRiskMiValueName() { + return riskMiValueName == null ? "" : riskMiValueName; + } + + public void setRiskMiValueName(String riskMiValueName) { + this.riskMiValueName = riskMiValueName; + } + + public String getRiskMiValueColor() { + return riskMiValueColor == null ? "" : riskMiValueColor; + } + + public void setRiskMiValueColor(String riskMiValueColor) { + this.riskMiValueColor = riskMiValueColor; + } + + public String getRiskSuddenDeathValueName() { + return riskSuddenDeathValueName == null ? "" : riskSuddenDeathValueName; + } + + public void setRiskSuddenDeathValueName(String riskSuddenDeathValueName) { + this.riskSuddenDeathValueName = riskSuddenDeathValueName; + } + + public String getRiskSuddenDeathValueColor() { + return riskSuddenDeathValueColor == null ? "" : riskSuddenDeathValueColor; + } + + public void setRiskSuddenDeathValueColor(String riskSuddenDeathValueColor) { + this.riskSuddenDeathValueColor = riskSuddenDeathValueColor; + } + + public String getRiskCiValueName() { + return riskCiValueName == null ? "" : riskCiValueName; + } + + public void setRiskCiValueName(String riskCiValueName) { + this.riskCiValueName = riskCiValueName; + } + + public String getRiskCiValueColor() { + return riskCiValueColor == null ? "" : riskCiValueColor; + } + + public void setRiskCiValueColor(String riskCiValueColor) { + this.riskCiValueColor = riskCiValueColor; + } + + public String getRiskChValueName() { + return riskChValueName == null ? "" : riskChValueName; + } + + public void setRiskChValueName(String riskChValueName) { + this.riskChValueName = riskChValueName; + } + + public String getRiskChValueColor() { + return riskChValueColor == null ? "" : riskChValueColor; + } + + public void setRiskChValueColor(String riskChValueColor) { + this.riskChValueColor = riskChValueColor; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/CvdWarningHistoryBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/CvdWarningHistoryBean.java new file mode 100644 index 0000000..424b58b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/CvdWarningHistoryBean.java @@ -0,0 +1,62 @@ +package com.xjjk.healthyclients.bean; + +import android.text.TextUtils; + +public class CvdWarningHistoryBean { +// "watchNo": "CRFTQ22C03000080", +// "warnTime": "2023-03-22 11:11:15", +// "dataValue": "200", +// "address": "1", +// "addressGd": "", +// "gpsErrorMsg": "未获取到地址信息21" + + private String warnTime; + private String dataValue; + private String address; + private String addressGd; + private String gpsErrorMsg; + + public String getWarnTime() { + return warnTime; + } + + public void setWarnTime(String warnTime) { + this.warnTime = warnTime; + } + + public String getDataValue() { + return dataValue; + } + + public void setDataValue(String dataValue) { + this.dataValue = dataValue; + } + + public String getAddress() { + if (TextUtils.isEmpty(gpsErrorMsg)) { + return TextUtils.isEmpty(addressGd) ? address : addressGd; + } else { + return gpsErrorMsg; + } + } + + public void setAddress(String address) { + this.address = address; + } + + public String getAddressGd() { + return addressGd; + } + + public void setAddressGd(String addressGd) { + this.addressGd = addressGd; + } + + public String getGpsErrorMsg() { + return gpsErrorMsg; + } + + public void setGpsErrorMsg(String gpsErrorMsg) { + this.gpsErrorMsg = gpsErrorMsg; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/ImageBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/ImageBean.kt new file mode 100644 index 0000000..f906125 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/ImageBean.kt @@ -0,0 +1,6 @@ +package com.xjjk.healthyclients.bean + +/** + * 类似九宫格图集使用 + */ +data class ImageBean(var imageUrl: String = "", var isFilePath: Boolean = false, var isAddButton: Boolean = false) diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/LoginBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/LoginBean.java new file mode 100644 index 0000000..26833f5 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/LoginBean.java @@ -0,0 +1,41 @@ +package com.xjjk.healthyclients.bean; + +public class LoginBean { + + private String username; + private String password; + private String deviceType; + private String deviceSystem; + + public String getDeviceType() { + return deviceType == null ? "" : deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getDeviceSystem() { + return deviceSystem == null ? "" : deviceSystem; + } + + public void setDeviceSystem(String deviceSystem) { + this.deviceSystem = deviceSystem; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/LoginResponseBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/LoginResponseBean.java new file mode 100644 index 0000000..5f1e0a2 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/LoginResponseBean.java @@ -0,0 +1,74 @@ +package com.xjjk.healthyclients.bean; + +import com.sw.healthyclients.bean.common.UserInfoBean; + +public class LoginResponseBean { + + private Boolean success; + private String message; + private Integer code; + private ResultDTO result; + private Long timestamp; + + public Boolean getSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public ResultDTO getResult() { + return result; + } + + public void setResult(ResultDTO result) { + this.result = result; + } + + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(Long timestamp) { + this.timestamp = timestamp; + } + + public static class ResultDTO { + private UserInfoBean userInfo; + private String token; + + public UserInfoBean getUserInfo() { + return userInfo; + } + + public void setUserInfo(UserInfoBean userInfo) { + this.userInfo = userInfo; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/MapDataBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/MapDataBean.java new file mode 100644 index 0000000..2b4ac5b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/MapDataBean.java @@ -0,0 +1,87 @@ +package com.xjjk.healthyclients.bean; + +public class MapDataBean { + + private String a; + private String c; + private String d; + private String e; + private String f; + private String g; + private String h; + private Double lon; + private Double lat; + + public Double getLon() { + return lon; + } + + public void setLon(Double lon) { + this.lon = lon; + } + + public Double getLat() { + return lat; + } + + public void setLat(Double lat) { + this.lat = lat; + } + + public String getA() { + return a; + } + + public void setA(String a) { + this.a = a; + } + + + public String getC() { + return c; + } + + public void setC(String c) { + this.c = c; + } + + public String getD() { + return d; + } + + public void setD(String d) { + this.d = d; + } + + public String getE() { + return e; + } + + public void setE(String e) { + this.e = e; + } + + public String getF() { + return f; + } + + public void setF(String f) { + this.f = f; + } + + public String getG() { + return g; + } + + public void setG(String g) { + this.g = g; + } + + public String getH() { + return h; + } + + public void setH(String h) { + this.h = h; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/NearbyAmbulanceBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/NearbyAmbulanceBean.kt new file mode 100644 index 0000000..8884ca3 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/NearbyAmbulanceBean.kt @@ -0,0 +1,38 @@ +package com.sw.healthyclients.bean.intervention + + +data class NearbyAmbulanceBean( + var ambulancePhoto: Any?, + var belongName: String?, + var createBy: String?, + var createTime: String?, + var delFlag: String?, + var departCode: String?, + var departName: Any?, + var distance: String?, + var driverName: String?, + var driversLicensePhoto: Any?, + var equipmentList: Any?, + var id: String?, + var isGps: Any?, + var isManagementSystem: String?, + var latitude: Double=0.0, + var licensePlateNumber: String?, + var longitude: Double=0.0, + var medicalResource: Any?, + var model: String?, + var payFeeYear: Double?, + var phone: String="", + var propagateArea: String?, + var propagateNum: String?, + var qualificationLicensePhoto: Any?, + var remark: Any?, + var rescueCapability: String?, + var rescueCapabilityType: String?, + var rescueDevice: String?, + var resourceId: String?, + var status: String?, + var updateBy: String?, + var updateTime: String?, + var yearOfService: String? +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/NearbyResourceBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/NearbyResourceBean.java new file mode 100644 index 0000000..c2d31af --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/NearbyResourceBean.java @@ -0,0 +1,162 @@ +package com.xjjk.healthyclients.bean; + +import java.util.ArrayList; + +public class NearbyResourceBean { + private String id; + private String hospitalId; + private String img; + private String name; + private String address; + private double longitude; + private double latitude; + private String mobile; + private String adminUser;//负责人 + private String setUpTime;//设立时间 + private String radiationNum;//辐射人数 + private String ambulanceNum;//救护车数量 + private String radiationDepart;//辐射单位id + private ArrayList radiationDepartList;//辐射单位集合 + private String resourceDesc; //简介 + private String medicalStaffNum; //医护人员数量 + private String departName; //所属单位 + + public String getDepartName() { + return departName == null ? "" : departName; + } + + public void setDepartName(String departName) { + this.departName = departName; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getHospitalId() { + return hospitalId == null ? "" : hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getImg() { + return img == null ? "" : img; + } + + public void setImg(String img) { + this.img = img; + } + + public String getName() { + return name == null ? "" : name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address == null ? "" : address; + } + + public void setAddress(String address) { + this.address = address; + } + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public String getMobile() { + return mobile == null ? "" : mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getAdminUser() { + return adminUser == null ? "--" : adminUser; + } + + public void setAdminUser(String adminUser) { + this.adminUser = adminUser; + } + + public String getSetUpTime() { + return setUpTime == null ? "--" : setUpTime; + } + + public void setSetUpTime(String setUpTime) { + this.setUpTime = setUpTime; + } + + public String getRadiationNum() { + return radiationNum == null ? "--" : radiationNum; + } + + public void setRadiationNum(String radiationNum) { + this.radiationNum = radiationNum; + } + + public String getAmbulanceNum() { + return ambulanceNum == null ? "--" : ambulanceNum; + } + + public void setAmbulanceNum(String ambulanceNum) { + this.ambulanceNum = ambulanceNum; + } + + public String getRadiationDepart() { + return radiationDepart == null ? "" : radiationDepart; + } + + public void setRadiationDepart(String radiationDepart) { + this.radiationDepart = radiationDepart; + } + + public ArrayList getRadiationDepartList() { + if (radiationDepartList == null) { + return new ArrayList<>(); + } + return radiationDepartList; + } + + public void setRadiationDepartList(ArrayList radiationDepartList) { + this.radiationDepartList = radiationDepartList; + } + + public String getResourceDesc() { + return resourceDesc == null ? "\n暂无\n" : resourceDesc; + } + + public void setResourceDesc(String resourceDesc) { + this.resourceDesc = resourceDesc; + } + + public String getMedicalStaffNum() { + return medicalStaffNum == null ? "" : medicalStaffNum; + } + + public void setMedicalStaffNum(String medicalStaffNum) { + this.medicalStaffNum = medicalStaffNum; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/SelectUserInfoBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/SelectUserInfoBean.java new file mode 100644 index 0000000..f94bd63 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/SelectUserInfoBean.java @@ -0,0 +1,131 @@ +package com.xjjk.healthyclients.bean; + +public class SelectUserInfoBean { + + private String realname; + private String workNo; + private String phone; + private String idCard; + private String sex; + private String sex_dictText; + private String personType; + private String personType_dictText; + private String orgCode; + private String healthType; + private String bloodType; + private String bloodType_dictText; + private String healthType_dictText; + private String avatar; + + public String getBloodType_dictText() { + return bloodType_dictText == null ? "" : bloodType_dictText; + } + + public void setBloodType_dictText(String bloodType_dictText) { + this.bloodType_dictText = bloodType_dictText; + } + + public String getHealthType_dictText() { + return healthType_dictText == null ? "" : healthType_dictText; + } + + public void setHealthType_dictText(String healthType_dictText) { + this.healthType_dictText = healthType_dictText; + } + + public String getHealthType() { + return healthType == null ? "" : healthType; + } + + public void setHealthType(String healthType) { + this.healthType = healthType; + } + + public String getBloodType() { + return bloodType == null ? "" : bloodType; + } + + public void setBloodType(String bloodType) { + this.bloodType = bloodType; + } + + public String getRealname() { + return realname == null ? "--" : realname; + } + + public void setRealname(String realname) { + this.realname = realname; + } + + public String getWorkNo() { + return workNo == null ? "--" : workNo; + } + + public void setWorkNo(String workNo) { + this.workNo = workNo; + } + + public String getPhone() { + return phone == null ? "" : phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getIdCard() { + return idCard == null ? "" : idCard; + } + + public void setIdCard(String idCard) { + this.idCard = idCard; + } + + public String getSex() { + return sex == null ? "" : sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getSex_dictText() { + return sex_dictText == null ? "" : sex_dictText; + } + + public void setSex_dictText(String sex_dictText) { + this.sex_dictText = sex_dictText; + } + + public String getPersonType() { + return personType == null ? "" : personType; + } + + public void setPersonType(String personType) { + this.personType = personType; + } + + public String getPersonType_dictText() { + return personType_dictText == null ? "--" : personType_dictText; + } + + public void setPersonType_dictText(String personType_dictText) { + this.personType_dictText = personType_dictText; + } + + public String getOrgCode() { + return orgCode == null ? "" : orgCode; + } + + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + public String getAvatar() { + return avatar== null ? "" : avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/SelectUserMessageListBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/SelectUserMessageListBean.java new file mode 100644 index 0000000..3f35005 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/SelectUserMessageListBean.java @@ -0,0 +1,52 @@ +package com.xjjk.healthyclients.bean; + +import java.io.Serializable; + +public class SelectUserMessageListBean implements Serializable { + + private String id; + private String title; + private String content; + private String type; + private String state; + + public String getState() { + return state == null ? "" : state; + } + + public void setState(String state) { + this.state = state; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/TitleTagBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/TitleTagBean.java new file mode 100644 index 0000000..4d73feb --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/TitleTagBean.java @@ -0,0 +1,22 @@ +package com.xjjk.healthyclients.bean; + +public class TitleTagBean { + private String text; + private boolean isSelect; + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public boolean isSelect() { + return isSelect; + } + + public void setSelect(boolean select) { + isSelect = select; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/UploadFileResultBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/UploadFileResultBean.kt new file mode 100644 index 0000000..83f8bb6 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/UploadFileResultBean.kt @@ -0,0 +1,5 @@ +package com.xjjk.healthyclients.bean + +data class UploadFileResultBean( + var url: String = "" +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/UserInfo.java b/app/src/main/java/com/xjjk/healthyclients/bean/UserInfo.java new file mode 100644 index 0000000..705beb1 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/UserInfo.java @@ -0,0 +1,152 @@ +package com.xjjk.healthyclients.bean; + +import android.content.SharedPreferences; + +import com.google.gson.Gson; +import com.sw.healthyclients.utils.TUIKitConstants; +import com.xjjk.healthyclients.MyApplication; + +import java.io.Serializable; + +public class UserInfo implements Serializable { + + private final static String PER_USER_MODEL = "per_user_model"; + + private static UserInfo sUserInfo; + + private int sdkAppId; + private String zone; + private String phone; + private String token; + private String userId; + private String userSig; + private String name; + private String avatar; + private boolean autoLogin; + private boolean debugLogin = false; + + public synchronized static UserInfo getInstance() { + if (sUserInfo == null) { + SharedPreferences shareInfo = MyApplication.getAppContext().getSharedPreferences(TUIKitConstants.USERINFO, 0); + String json = shareInfo.getString(PER_USER_MODEL, ""); + sUserInfo = new Gson().fromJson(json, UserInfo.class); + if (sUserInfo == null) { + sUserInfo = new UserInfo(); + } + } + return sUserInfo; + } + + private UserInfo() { + + } + + public void setUserInfo(UserInfo info) { + SharedPreferences shareInfo = MyApplication.getAppContext().getSharedPreferences(TUIKitConstants.USERINFO, 0); + SharedPreferences.Editor editor = shareInfo.edit(); + editor.putString(PER_USER_MODEL, new Gson().toJson(info)); + editor.commit(); + } + + public int getSdkAppId() { + return sdkAppId; + } + + public void setSdkAppId(int sdkAppId) { + this.sdkAppId = sdkAppId; + } + + public String getUserSig() { + return this.userSig; + } + + public void setUserSig(String userSig) { + this.userSig = userSig; + setUserInfo(this); + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + setUserInfo(this); + } + + public String getUserId() { + return this.userId; + } + + public void setUserId(String userId) { + this.userId = userId; + setUserInfo(this); + } + + public String getToken() { + return this.token; + } + + public void setToken(String token) { + this.token = token; + setUserInfo(this); + } + + public String getZone() { + return this.zone; + } + + public void setZone(String zone) { + this.zone = zone; + setUserInfo(this); + } + + public String getPhone() { + return this.phone; + } + + public void setPhone(String userPhone) { + this.phone = userPhone; + setUserInfo(this); + } + + public Boolean isAutoLogin() { + return this.autoLogin; + } + + public void setAutoLogin(boolean autoLogin) { + this.autoLogin = autoLogin; + setUserInfo(this); + } + + public String getAvatar() { + return this.avatar; + } + + public void setAvatar(String url) { + this.avatar = url; + setUserInfo(this); + } + + public void setDebugLogin(boolean debugLogin) { + this.debugLogin = debugLogin; + setUserInfo(this); + } + + public boolean isDebugLogin() { + return debugLogin; + } + + public void cleanUserInfo() { + sdkAppId = 0; + zone = ""; + token = ""; + userId = ""; + userSig = ""; + name = ""; + avatar = ""; + autoLogin = false; + setUserInfo(this); + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/AddBigDiseaseSubmitBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/AddBigDiseaseSubmitBean.java new file mode 100644 index 0000000..5ac60c5 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/AddBigDiseaseSubmitBean.java @@ -0,0 +1,76 @@ +package com.xjjk.healthyclients.bean.emergency; + +public class AddBigDiseaseSubmitBean { + private String hospitalId; + private String hospitalName; + private String medicalCardNo; + private String registerCategory; + private long desireTime; + private String reservationOffice; + private String reservationDoctor; + private String diseaseDescribe; + + public String getHospitalName() { + return hospitalName == null ? "" : hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public String getHospitalId() { + return hospitalId == null ? "" : hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getMedicalCardNo() { + return medicalCardNo == null ? "" : medicalCardNo; + } + + public void setMedicalCardNo(String medicalCardNo) { + this.medicalCardNo = medicalCardNo; + } + + public String getRegisterCategory() { + return registerCategory == null ? "" : registerCategory; + } + + public void setRegisterCategory(String registerCategory) { + this.registerCategory = registerCategory; + } + + public long getDesireTime() { + return desireTime; + } + + public void setDesireTime(long desireTime) { + this.desireTime = desireTime; + } + + public String getReservationOffice() { + return reservationOffice == null ? "" : reservationOffice; + } + + public void setReservationOffice(String reservationOffice) { + this.reservationOffice = reservationOffice; + } + + public String getReservationDoctor() { + return reservationDoctor == null ? "" : reservationDoctor; + } + + public void setReservationDoctor(String reservationDoctor) { + this.reservationDoctor = reservationDoctor; + } + + public String getDiseaseDescribe() { + return diseaseDescribe == null ? "" : diseaseDescribe; + } + + public void setDiseaseDescribe(String diseaseDescribe) { + this.diseaseDescribe = diseaseDescribe; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/BigDiseaseBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/BigDiseaseBean.java new file mode 100644 index 0000000..e990b8c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/BigDiseaseBean.java @@ -0,0 +1,158 @@ +package com.xjjk.healthyclients.bean.emergency; + +public class BigDiseaseBean { + + private String id; + private String hospitalId; + private String hospitalName; + private String medicalCardNo; + private String registerCategory; + private String registerCategory_dictText; + private String state; + private String desireTime; + private String createTime; + private String reservationOffice; + private String reservationDoctor; + private String diseaseDescribe; + private String rejectionReason; + private String realname; + private String idNo; + private String telPhone; + private String reservationNo; + + public String getHospitalName() { + return hospitalName == null ? "" : hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getHospitalId() { + return hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getMedicalCardNo() { + return medicalCardNo; + } + + public void setMedicalCardNo(String medicalCardNo) { + this.medicalCardNo = medicalCardNo; + } + + public String getRegisterCategory() { + return registerCategory; + } + + public void setRegisterCategory(String registerCategory) { + this.registerCategory = registerCategory; + } + + public String getRegisterCategory_dictText() { + return registerCategory_dictText; + } + + public void setRegisterCategory_dictText(String registerCategory_dictText) { + this.registerCategory_dictText = registerCategory_dictText; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getDesireTime() { + return desireTime; + } + + public void setDesireTime(String desireTime) { + this.desireTime = desireTime; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getReservationOffice() { + return reservationOffice==null?"":reservationOffice; + } + + public void setReservationOffice(String reservationOffice) { + this.reservationOffice = reservationOffice; + } + + public String getReservationDoctor() { + return reservationDoctor==null?"":reservationDoctor ; + } + + public void setReservationDoctor(String reservationDoctor) { + this.reservationDoctor = reservationDoctor; + } + + public String getDiseaseDescribe() { + return diseaseDescribe; + } + + public void setDiseaseDescribe(String diseaseDescribe) { + this.diseaseDescribe = diseaseDescribe; + } + + public String getRejectionReason() { + return rejectionReason; + } + + public void setRejectionReason(String rejectionReason) { + this.rejectionReason = rejectionReason; + } + + public String getRealname() { + return realname; + } + + public void setRealname(String realname) { + this.realname = realname; + } + + public String getIdNo() { + return idNo; + } + + public void setIdNo(String idNo) { + this.idNo = idNo; + } + + public String getTelPhone() { + return telPhone; + } + + public void setTelPhone(String telPhone) { + this.telPhone = telPhone; + } + + public String getReservationNo() { + return reservationNo; + } + + public void setReservationNo(String reservationNo) { + this.reservationNo = reservationNo; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/BigDiseaseDetailsBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/BigDiseaseDetailsBean.java new file mode 100644 index 0000000..8b43692 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/BigDiseaseDetailsBean.java @@ -0,0 +1,176 @@ +package com.xjjk.healthyclients.bean.emergency; + +public class BigDiseaseDetailsBean { + + private String id; + private String hospitalId; + private String hospitalName; + private String medicalCardNo; + private String registerCategory; + private String registerCategory_dictText; + private String state; + private String desireTime; + private String createTime; + private String reservationOffice; + private String reservationDoctor; + private String diseaseDescribe; + private String rejectionReason; + private String realname; + private String idNo; + private String telPhone; + private String reservationNo; + private String rejectionTime; + private String newState; + + public String getNewState() { + return newState == null ? "" : newState; + } + + public void setNewState(String newState) { + this.newState = newState; + } + + public String getRejectionTime() { + return rejectionTime == null ? "" : rejectionTime; + } + + public void setRejectionTime(String rejectionTime) { + this.rejectionTime = rejectionTime; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getHospitalId() { + return hospitalId == null ? "" : hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getHospitalName() { + return hospitalName == null ? "" : hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public String getMedicalCardNo() { + return medicalCardNo == null ? "" : medicalCardNo; + } + + public void setMedicalCardNo(String medicalCardNo) { + this.medicalCardNo = medicalCardNo; + } + + public String getRegisterCategory() { + return registerCategory == null ? "" : registerCategory; + } + + public void setRegisterCategory(String registerCategory) { + this.registerCategory = registerCategory; + } + + public String getRegisterCategory_dictText() { + return registerCategory_dictText == null ? "" : registerCategory_dictText; + } + + public void setRegisterCategory_dictText(String registerCategory_dictText) { + this.registerCategory_dictText = registerCategory_dictText; + } + + public String getState() { + return state == null ? "" : state; + } + + public void setState(String state) { + this.state = state; + } + + public String getDesireTime() { + return desireTime == null ? "" : desireTime; + } + + public void setDesireTime(String desireTime) { + this.desireTime = desireTime; + } + + public String getCreateTime() { + return createTime == null ? "" : createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getReservationOffice() { + return reservationOffice == null ? "" : reservationOffice; + } + + public void setReservationOffice(String reservationOffice) { + this.reservationOffice = reservationOffice; + } + + public String getReservationDoctor() { + return reservationDoctor == null ? "" : reservationDoctor; + } + + public void setReservationDoctor(String reservationDoctor) { + this.reservationDoctor = reservationDoctor; + } + + public String getDiseaseDescribe() { + return diseaseDescribe == null ? "" : diseaseDescribe; + } + + public void setDiseaseDescribe(String diseaseDescribe) { + this.diseaseDescribe = diseaseDescribe; + } + + public String getRejectionReason() { + return rejectionReason == null ? "" : rejectionReason; + } + + public void setRejectionReason(String rejectionReason) { + this.rejectionReason = rejectionReason; + } + + public String getRealname() { + return realname == null ? "" : realname; + } + + public void setRealname(String realname) { + this.realname = realname; + } + + public String getIdNo() { + return idNo == null ? "" : idNo; + } + + public void setIdNo(String idNo) { + this.idNo = idNo; + } + + public String getTelPhone() { + return telPhone == null ? "" : telPhone; + } + + public void setTelPhone(String telPhone) { + this.telPhone = telPhone; + } + + public String getReservationNo() { + return reservationNo == null ? "" : reservationNo; + } + + public void setReservationNo(String reservationNo) { + this.reservationNo = reservationNo; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyBean.kt new file mode 100644 index 0000000..1fbb408 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyBean.kt @@ -0,0 +1,7 @@ +package com.xjjk.healthyclients.bean.emergency + +data class EmergencyBean( + val dicts: MutableList?, + val resources: MutableList?, + val sessionId: String? +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyCallResultBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyCallResultBean.kt new file mode 100644 index 0000000..c12a097 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyCallResultBean.kt @@ -0,0 +1,7 @@ +package com.xjjk.healthyclients.bean.emergency + +data class EmergencyCallResultBean( + val majors: List, + val operators: List, + val orderId: String +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyDictBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyDictBean.kt new file mode 100644 index 0000000..93e4fbd --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyDictBean.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.bean.emergency + +data class EmergencyDictBean( + val label: String, + val text: String, + val title: String, + val value: String, + var isCheck: Boolean +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyGroupInfo.kt b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyGroupInfo.kt new file mode 100644 index 0000000..42ce606 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/EmergencyGroupInfo.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.bean.emergency + +data class EmergencyGroupInfo( + val groupId: String, + val userId: String, + val member: ArrayList, + val tfNew: String, + val id: String +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/GetOrderBySessionIdBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/GetOrderBySessionIdBean.java new file mode 100644 index 0000000..e07332b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/GetOrderBySessionIdBean.java @@ -0,0 +1,1178 @@ +package com.xjjk.healthyclients.bean.emergency; + +import java.util.ArrayList; +import java.util.List; + +public class GetOrderBySessionIdBean { + + private String id; + private String initiatorType; + private boolean isFill; + private Object resourceId; + private Object infoDesc; + private String sessionId; + private Object sessionOverTime; + private String orderOverTime; + private boolean sessionNow; + private String initiatorUserId; + private String initiatorUserName; + private String initiatorUserSex; + private String initiatorUserMobile; + private String initiatorUserIdCard; + private String initiatorUserDepart; + private String initiatorUserAvatar; + private double initiatorLongitude; + private double initiatorLatitude; + private String salvageUserId; + private String salvageUserName; + private String salvageUserSex; + private String salvageUserMobile; + private String salvageUserIdCard; + private String salvageUserDepart; + private String salvageUserAvatar; + private String operationUserId; + private String operationUserName; + private String operationUserSex; + private String operationUserMobile; + private Object operationUserAvatar; + private String majorUserId; + private String majorUserName; + private String majorUserSex; + private Object majorUserMobile; + private Object majorUserAvatar; + private Object stationUserId; + private String stationUserName; + private Object stationUserSex; + private Object stationUserMobile; + private Object stationUserDepart; + private Object stationUserAvatar; + private String stationBusiness; + private String stationBusiness_dictText; + private String operationResponseTime; + private String operationSendOrderTime; + private String majorResponseTime; + private String stationResponseTime; + private Object stationRejectionTime; + private Object majorSalvageOpinion; + private String sendOrderHospital; + private String orderStatus; + private String orderStatus_dictText; + private Object isDispatch; + private Object detailTitle; + private int status; + private int delFlag; + private String createBy; + private String createTime; + private String updateBy; + private String updateTime; + private String isDispatch_dictText; + private Object memo; + private OrderDetailDTO orderDetail; + private List orderSendRecordList; + private Object resourceName; + private String initiatorUserSecondDepart; + private String salvageUserSecondDepart; + private Object createTimeStart; + private Object createTimeEnd; + private int initiatorUserAge; + private int salvageUserAge; + + public String getIsDispatch_dictText() { + return isDispatch_dictText == null ? "" : isDispatch_dictText; + } + + public void setIsDispatch_dictText(String isDispatch_dictText) { + this.isDispatch_dictText = isDispatch_dictText; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInitiatorType() { + return initiatorType == null ? "" : initiatorType; + } + + public void setInitiatorType(String initiatorType) { + this.initiatorType = initiatorType; + } + + public boolean isFill() { + return isFill; + } + + public void setFill(boolean fill) { + isFill = fill; + } + + public Object getResourceId() { + return resourceId; + } + + public void setResourceId(Object resourceId) { + this.resourceId = resourceId; + } + + public Object getInfoDesc() { + return infoDesc; + } + + public void setInfoDesc(Object infoDesc) { + this.infoDesc = infoDesc; + } + + public String getSessionId() { + return sessionId == null ? "" : sessionId; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + public Object getSessionOverTime() { + return sessionOverTime; + } + + public void setSessionOverTime(Object sessionOverTime) { + this.sessionOverTime = sessionOverTime; + } + + public String getOrderOverTime() { + return orderOverTime == null ? "" : orderOverTime; + } + + public void setOrderOverTime(String orderOverTime) { + this.orderOverTime = orderOverTime; + } + + public boolean isSessionNow() { + return sessionNow; + } + + public void setSessionNow(boolean sessionNow) { + this.sessionNow = sessionNow; + } + + public String getInitiatorUserId() { + return initiatorUserId == null ? "" : initiatorUserId; + } + + public void setInitiatorUserId(String initiatorUserId) { + this.initiatorUserId = initiatorUserId; + } + + public String getInitiatorUserName() { + return initiatorUserName == null ? "" : initiatorUserName; + } + + public void setInitiatorUserName(String initiatorUserName) { + this.initiatorUserName = initiatorUserName; + } + + public String getInitiatorUserSex() { + return initiatorUserSex == null ? "" : initiatorUserSex; + } + + public void setInitiatorUserSex(String initiatorUserSex) { + this.initiatorUserSex = initiatorUserSex; + } + + public String getInitiatorUserMobile() { + return initiatorUserMobile == null ? "" : initiatorUserMobile; + } + + public void setInitiatorUserMobile(String initiatorUserMobile) { + this.initiatorUserMobile = initiatorUserMobile; + } + + public String getInitiatorUserIdCard() { + return initiatorUserIdCard == null ? "" : initiatorUserIdCard; + } + + public void setInitiatorUserIdCard(String initiatorUserIdCard) { + this.initiatorUserIdCard = initiatorUserIdCard; + } + + public String getInitiatorUserDepart() { + return initiatorUserDepart == null ? "" : initiatorUserDepart; + } + + public void setInitiatorUserDepart(String initiatorUserDepart) { + this.initiatorUserDepart = initiatorUserDepart; + } + + public String getInitiatorUserAvatar() { + return initiatorUserAvatar == null ? "" : initiatorUserAvatar; + } + + public void setInitiatorUserAvatar(String initiatorUserAvatar) { + this.initiatorUserAvatar = initiatorUserAvatar; + } + + public double getInitiatorLongitude() { + return initiatorLongitude; + } + + public void setInitiatorLongitude(double initiatorLongitude) { + this.initiatorLongitude = initiatorLongitude; + } + + public double getInitiatorLatitude() { + return initiatorLatitude; + } + + public void setInitiatorLatitude(double initiatorLatitude) { + this.initiatorLatitude = initiatorLatitude; + } + + public String getSalvageUserId() { + return salvageUserId == null ? "" : salvageUserId; + } + + public void setSalvageUserId(String salvageUserId) { + this.salvageUserId = salvageUserId; + } + + public String getSalvageUserName() { + return salvageUserName == null ? "" : salvageUserName; + } + + public void setSalvageUserName(String salvageUserName) { + this.salvageUserName = salvageUserName; + } + + public String getSalvageUserSex() { + return salvageUserSex == null ? "" : salvageUserSex; + } + + public void setSalvageUserSex(String salvageUserSex) { + this.salvageUserSex = salvageUserSex; + } + + public String getSalvageUserMobile() { + return salvageUserMobile == null ? "" : salvageUserMobile; + } + + public void setSalvageUserMobile(String salvageUserMobile) { + this.salvageUserMobile = salvageUserMobile; + } + + public String getSalvageUserIdCard() { + return salvageUserIdCard == null ? "" : salvageUserIdCard; + } + + public void setSalvageUserIdCard(String salvageUserIdCard) { + this.salvageUserIdCard = salvageUserIdCard; + } + + public String getSalvageUserDepart() { + return salvageUserDepart == null ? "" : salvageUserDepart; + } + + public void setSalvageUserDepart(String salvageUserDepart) { + this.salvageUserDepart = salvageUserDepart; + } + + public String getSalvageUserAvatar() { + return salvageUserAvatar == null ? "" : salvageUserAvatar; + } + + public void setSalvageUserAvatar(String salvageUserAvatar) { + this.salvageUserAvatar = salvageUserAvatar; + } + + public String getOperationUserId() { + return operationUserId == null ? "" : operationUserId; + } + + public void setOperationUserId(String operationUserId) { + this.operationUserId = operationUserId; + } + + public String getOperationUserName() { + return operationUserName == null ? "" : operationUserName; + } + + public void setOperationUserName(String operationUserName) { + this.operationUserName = operationUserName; + } + + public String getOperationUserSex() { + return operationUserSex == null ? "" : operationUserSex; + } + + public void setOperationUserSex(String operationUserSex) { + this.operationUserSex = operationUserSex; + } + + public String getOperationUserMobile() { + return operationUserMobile == null ? "" : operationUserMobile; + } + + public void setOperationUserMobile(String operationUserMobile) { + this.operationUserMobile = operationUserMobile; + } + + public Object getOperationUserAvatar() { + return operationUserAvatar; + } + + public void setOperationUserAvatar(Object operationUserAvatar) { + this.operationUserAvatar = operationUserAvatar; + } + + public String getMajorUserId() { + return majorUserId == null ? "" : majorUserId; + } + + public void setMajorUserId(String majorUserId) { + this.majorUserId = majorUserId; + } + + public String getMajorUserName() { + return majorUserName == null ? "" : majorUserName; + } + + public void setMajorUserName(String majorUserName) { + this.majorUserName = majorUserName; + } + + public String getMajorUserSex() { + return majorUserSex == null ? "" : majorUserSex; + } + + public void setMajorUserSex(String majorUserSex) { + this.majorUserSex = majorUserSex; + } + + public Object getMajorUserMobile() { + return majorUserMobile; + } + + public void setMajorUserMobile(Object majorUserMobile) { + this.majorUserMobile = majorUserMobile; + } + + public Object getMajorUserAvatar() { + return majorUserAvatar; + } + + public void setMajorUserAvatar(Object majorUserAvatar) { + this.majorUserAvatar = majorUserAvatar; + } + + public Object getStationUserId() { + return stationUserId; + } + + public void setStationUserId(Object stationUserId) { + this.stationUserId = stationUserId; + } + + public String getStationUserName() { + return stationUserName == null ? "" : stationUserName; + } + + public void setStationUserName(String stationUserName) { + this.stationUserName = stationUserName; + } + + public Object getStationUserSex() { + return stationUserSex; + } + + public void setStationUserSex(Object stationUserSex) { + this.stationUserSex = stationUserSex; + } + + public Object getStationUserMobile() { + return stationUserMobile; + } + + public void setStationUserMobile(Object stationUserMobile) { + this.stationUserMobile = stationUserMobile; + } + + public Object getStationUserDepart() { + return stationUserDepart; + } + + public void setStationUserDepart(Object stationUserDepart) { + this.stationUserDepart = stationUserDepart; + } + + public Object getStationUserAvatar() { + return stationUserAvatar; + } + + public void setStationUserAvatar(Object stationUserAvatar) { + this.stationUserAvatar = stationUserAvatar; + } + + public String getStationBusiness() { + return stationBusiness == null ? "" : stationBusiness; + } + + public void setStationBusiness(String stationBusiness) { + this.stationBusiness = stationBusiness; + } + + public String getStationBusiness_dictText() { + return stationBusiness_dictText == null ? "" : stationBusiness_dictText; + } + + public void setStationBusiness_dictText(String stationBusiness_dictText) { + this.stationBusiness_dictText = stationBusiness_dictText; + } + + public String getOperationResponseTime() { + return operationResponseTime == null ? "" : operationResponseTime; + } + + public void setOperationResponseTime(String operationResponseTime) { + this.operationResponseTime = operationResponseTime; + } + + public String getOperationSendOrderTime() { + return operationSendOrderTime == null ? "" : operationSendOrderTime; + } + + public void setOperationSendOrderTime(String operationSendOrderTime) { + this.operationSendOrderTime = operationSendOrderTime; + } + + public String getMajorResponseTime() { + return majorResponseTime == null ? "" : majorResponseTime; + } + + public void setMajorResponseTime(String majorResponseTime) { + this.majorResponseTime = majorResponseTime; + } + + public String getStationResponseTime() { + return stationResponseTime==null?"":stationResponseTime; + } + + public void setStationResponseTime(String stationResponseTime) { + this.stationResponseTime = stationResponseTime; + } + + public Object getStationRejectionTime() { + return stationRejectionTime; + } + + public void setStationRejectionTime(Object stationRejectionTime) { + this.stationRejectionTime = stationRejectionTime; + } + + public Object getMajorSalvageOpinion() { + return majorSalvageOpinion; + } + + public void setMajorSalvageOpinion(Object majorSalvageOpinion) { + this.majorSalvageOpinion = majorSalvageOpinion; + } + + public String getSendOrderHospital() { + return sendOrderHospital == null ? "" : sendOrderHospital; + } + + public void setSendOrderHospital(String sendOrderHospital) { + this.sendOrderHospital = sendOrderHospital; + } + + public String getOrderStatus() { + return orderStatus == null ? "" : orderStatus; + } + + public void setOrderStatus(String orderStatus) { + this.orderStatus = orderStatus; + } + + public String getOrderStatus_dictText() { + return orderStatus_dictText == null ? "" : orderStatus_dictText; + } + + public void setOrderStatus_dictText(String orderStatus_dictText) { + this.orderStatus_dictText = orderStatus_dictText; + } + + public Object getIsDispatch() { + return isDispatch; + } + + public void setIsDispatch(Object isDispatch) { + this.isDispatch = isDispatch; + } + + public Object getDetailTitle() { + return detailTitle; + } + + public void setDetailTitle(Object detailTitle) { + this.detailTitle = detailTitle; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public String getCreateBy() { + return createBy == null ? "" : createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public String getCreateTime() { + return createTime == null ? "" : createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy == null ? "" : updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public String getUpdateTime() { + return updateTime == null ? "" : updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public Object getMemo() { + return memo; + } + + public void setMemo(Object memo) { + this.memo = memo; + } + + public OrderDetailDTO getOrderDetail() { + return orderDetail; + } + + public void setOrderDetail(OrderDetailDTO orderDetail) { + this.orderDetail = orderDetail; + } + + public List getOrderSendRecordList() { + if (orderSendRecordList == null) { + return new ArrayList<>(); + } + return orderSendRecordList; + } + + public void setOrderSendRecordList(List orderSendRecordList) { + this.orderSendRecordList = orderSendRecordList; + } + + public Object getResourceName() { + return resourceName; + } + + public void setResourceName(Object resourceName) { + this.resourceName = resourceName; + } + + public String getInitiatorUserSecondDepart() { + return initiatorUserSecondDepart == null ? "" : initiatorUserSecondDepart; + } + + public void setInitiatorUserSecondDepart(String initiatorUserSecondDepart) { + this.initiatorUserSecondDepart = initiatorUserSecondDepart; + } + + public String getSalvageUserSecondDepart() { + return salvageUserSecondDepart == null ? "" : salvageUserSecondDepart; + } + + public void setSalvageUserSecondDepart(String salvageUserSecondDepart) { + this.salvageUserSecondDepart = salvageUserSecondDepart; + } + + public Object getCreateTimeStart() { + return createTimeStart; + } + + public void setCreateTimeStart(Object createTimeStart) { + this.createTimeStart = createTimeStart; + } + + public Object getCreateTimeEnd() { + return createTimeEnd; + } + + public void setCreateTimeEnd(Object createTimeEnd) { + this.createTimeEnd = createTimeEnd; + } + + public int getInitiatorUserAge() { + return initiatorUserAge; + } + + public void setInitiatorUserAge(int initiatorUserAge) { + this.initiatorUserAge = initiatorUserAge; + } + + public int getSalvageUserAge() { + return salvageUserAge; + } + + public void setSalvageUserAge(int salvageUserAge) { + this.salvageUserAge = salvageUserAge; + } + + public static class OrderDetailDTO { + private String id; + private Object orderScore; + private Object orderEvaluation; + private Object orderEvaluationTime; + private String orderThrough; + private String orderResult; + private Object orderRecord; + private Object imgs; + private Object ambCarNum; + private Object ambCarArriveTime; + private Object ambCarServeTime; + private Object ambContactUserId; + private Object ambContactUserName; + private Object ambContactUserPhone; + private Object ambFollowUserId; + private Object ambFollowUserName; + private Object ambFollowUserPhone; + private Object comCarNum; + private Object comCarArriveTime; + private Object comCarServeTime; + private Object comContactUserId; + private Object comContactUserName; + private Object comContactUserPhone; + private Object salvageTime; + private Object salvageHospital; + private Object salvageDepart; + private Object salvageDoctor; + private Object salvageRegisterTime; + private Object salvageCoordinate; + private Object salvageOperation; + private int status; + private int delFlag; + private Object createBy; + private Object createTime; + private Object updateBy; + private Object updateTime; + private Object memo; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Object getOrderScore() { + return orderScore; + } + + public void setOrderScore(Object orderScore) { + this.orderScore = orderScore; + } + + public Object getOrderEvaluation() { + return orderEvaluation; + } + + public void setOrderEvaluation(Object orderEvaluation) { + this.orderEvaluation = orderEvaluation; + } + + public Object getOrderEvaluationTime() { + return orderEvaluationTime; + } + + public void setOrderEvaluationTime(Object orderEvaluationTime) { + this.orderEvaluationTime = orderEvaluationTime; + } + + public String getOrderThrough() { + return orderThrough; + } + + public void setOrderThrough(String orderThrough) { + this.orderThrough = orderThrough; + } + + public String getOrderResult() { + return orderResult; + } + + public void setOrderResult(String orderResult) { + this.orderResult = orderResult; + } + + public Object getOrderRecord() { + return orderRecord; + } + + public void setOrderRecord(Object orderRecord) { + this.orderRecord = orderRecord; + } + + public Object getImgs() { + return imgs; + } + + public void setImgs(Object imgs) { + this.imgs = imgs; + } + + public Object getAmbCarNum() { + return ambCarNum; + } + + public void setAmbCarNum(Object ambCarNum) { + this.ambCarNum = ambCarNum; + } + + public Object getAmbCarArriveTime() { + return ambCarArriveTime; + } + + public void setAmbCarArriveTime(Object ambCarArriveTime) { + this.ambCarArriveTime = ambCarArriveTime; + } + + public Object getAmbCarServeTime() { + return ambCarServeTime; + } + + public void setAmbCarServeTime(Object ambCarServeTime) { + this.ambCarServeTime = ambCarServeTime; + } + + public Object getAmbContactUserId() { + return ambContactUserId; + } + + public void setAmbContactUserId(Object ambContactUserId) { + this.ambContactUserId = ambContactUserId; + } + + public Object getAmbContactUserName() { + return ambContactUserName; + } + + public void setAmbContactUserName(Object ambContactUserName) { + this.ambContactUserName = ambContactUserName; + } + + public Object getAmbContactUserPhone() { + return ambContactUserPhone; + } + + public void setAmbContactUserPhone(Object ambContactUserPhone) { + this.ambContactUserPhone = ambContactUserPhone; + } + + public Object getAmbFollowUserId() { + return ambFollowUserId; + } + + public void setAmbFollowUserId(Object ambFollowUserId) { + this.ambFollowUserId = ambFollowUserId; + } + + public Object getAmbFollowUserName() { + return ambFollowUserName; + } + + public void setAmbFollowUserName(Object ambFollowUserName) { + this.ambFollowUserName = ambFollowUserName; + } + + public Object getAmbFollowUserPhone() { + return ambFollowUserPhone; + } + + public void setAmbFollowUserPhone(Object ambFollowUserPhone) { + this.ambFollowUserPhone = ambFollowUserPhone; + } + + public Object getComCarNum() { + return comCarNum; + } + + public void setComCarNum(Object comCarNum) { + this.comCarNum = comCarNum; + } + + public Object getComCarArriveTime() { + return comCarArriveTime; + } + + public void setComCarArriveTime(Object comCarArriveTime) { + this.comCarArriveTime = comCarArriveTime; + } + + public Object getComCarServeTime() { + return comCarServeTime; + } + + public void setComCarServeTime(Object comCarServeTime) { + this.comCarServeTime = comCarServeTime; + } + + public Object getComContactUserId() { + return comContactUserId; + } + + public void setComContactUserId(Object comContactUserId) { + this.comContactUserId = comContactUserId; + } + + public Object getComContactUserName() { + return comContactUserName; + } + + public void setComContactUserName(Object comContactUserName) { + this.comContactUserName = comContactUserName; + } + + public Object getComContactUserPhone() { + return comContactUserPhone; + } + + public void setComContactUserPhone(Object comContactUserPhone) { + this.comContactUserPhone = comContactUserPhone; + } + + public Object getSalvageTime() { + return salvageTime; + } + + public void setSalvageTime(Object salvageTime) { + this.salvageTime = salvageTime; + } + + public Object getSalvageHospital() { + return salvageHospital; + } + + public void setSalvageHospital(Object salvageHospital) { + this.salvageHospital = salvageHospital; + } + + public Object getSalvageDepart() { + return salvageDepart; + } + + public void setSalvageDepart(Object salvageDepart) { + this.salvageDepart = salvageDepart; + } + + public Object getSalvageDoctor() { + return salvageDoctor; + } + + public void setSalvageDoctor(Object salvageDoctor) { + this.salvageDoctor = salvageDoctor; + } + + public Object getSalvageRegisterTime() { + return salvageRegisterTime; + } + + public void setSalvageRegisterTime(Object salvageRegisterTime) { + this.salvageRegisterTime = salvageRegisterTime; + } + + public Object getSalvageCoordinate() { + return salvageCoordinate; + } + + public void setSalvageCoordinate(Object salvageCoordinate) { + this.salvageCoordinate = salvageCoordinate; + } + + public Object getSalvageOperation() { + return salvageOperation; + } + + public void setSalvageOperation(Object salvageOperation) { + this.salvageOperation = salvageOperation; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public Object getCreateTime() { + return createTime; + } + + public void setCreateTime(Object createTime) { + this.createTime = createTime; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getMemo() { + return memo; + } + + public void setMemo(Object memo) { + this.memo = memo; + } + } + + public static class OrderSendRecordListDTO { + private String id; + private String orderId; + private String stationUserId; + private String stationUserName; + private String stationUserSex; + private Object stationUserDepart; + private String accept; + private String accept_dictText; + private String sendOrderHospital; + private String stationBusiness; + private String stationBusiness_dictText; + private String transferOrderTime; + private Object refuseCause; + private int status; + private int delFlag; + private Object createBy; + private String createTime; + private Object updateBy; + private Object updateTime; + private Object memo; + private Object order; + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getOrderId() { + return orderId == null ? "" : orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getStationUserId() { + return stationUserId == null ? "" : stationUserId; + } + + public void setStationUserId(String stationUserId) { + this.stationUserId = stationUserId; + } + + public String getStationUserName() { + return stationUserName == null ? "" : stationUserName; + } + + public void setStationUserName(String stationUserName) { + this.stationUserName = stationUserName; + } + + public String getStationUserSex() { + return stationUserSex == null ? "" : stationUserSex; + } + + public void setStationUserSex(String stationUserSex) { + this.stationUserSex = stationUserSex; + } + + public Object getStationUserDepart() { + return stationUserDepart; + } + + public void setStationUserDepart(Object stationUserDepart) { + this.stationUserDepart = stationUserDepart; + } + + public String getAccept() { + return accept == null ? "" : accept; + } + + public void setAccept(String accept) { + this.accept = accept; + } + + public String getAccept_dictText() { + return accept_dictText == null ? "" : accept_dictText; + } + + public void setAccept_dictText(String accept_dictText) { + this.accept_dictText = accept_dictText; + } + + public String getSendOrderHospital() { + return sendOrderHospital == null ? "" : sendOrderHospital; + } + + public void setSendOrderHospital(String sendOrderHospital) { + this.sendOrderHospital = sendOrderHospital; + } + + public String getStationBusiness() { + return stationBusiness == null ? "" : stationBusiness; + } + + public void setStationBusiness(String stationBusiness) { + this.stationBusiness = stationBusiness; + } + + public String getStationBusiness_dictText() { + return stationBusiness_dictText == null ? "" : stationBusiness_dictText; + } + + public void setStationBusiness_dictText(String stationBusiness_dictText) { + this.stationBusiness_dictText = stationBusiness_dictText; + } + + public String getTransferOrderTime() { + return transferOrderTime == null ? "" : transferOrderTime; + } + + public void setTransferOrderTime(String transferOrderTime) { + this.transferOrderTime = transferOrderTime; + } + + public Object getRefuseCause() { + return refuseCause; + } + + public void setRefuseCause(Object refuseCause) { + this.refuseCause = refuseCause; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public String getCreateTime() { + return createTime == null ? "" : createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getMemo() { + return memo; + } + + public void setMemo(Object memo) { + this.memo = memo; + } + + public Object getOrder() { + return order; + } + + public void setOrder(Object order) { + this.order = order; + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/HospitalBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/HospitalBean.java new file mode 100644 index 0000000..49be81e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/HospitalBean.java @@ -0,0 +1,23 @@ +package com.xjjk.healthyclients.bean.emergency; + +public class HospitalBean { + + private String id; + private String name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/LocationResourceBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/LocationResourceBean.kt new file mode 100644 index 0000000..6df3382 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/LocationResourceBean.kt @@ -0,0 +1,32 @@ +package com.xjjk.healthyclients.bean.emergency + +/** + * 应急页面标记的位置点 + */ +data class LocationResourceBean( + val address: String = "", + val aidrange: Any = "", + val area: Any = "", + val city: String = "", + val createBy: Any = "", + val createTime: Any = "", + val delFlag: Int = 0, + val distance: Double = 0.0, + val gdId: String = "", + val id: String = "", + val img: Any = "", + val latitude: Double = 0.0, + val level: String = "", + val level_dictText: String = "", + val longitude: Double = 0.0, + val memo: Any = "", + val mobile: String = "", + val name: String = "", + val province: String = "", + val resourceDesc: String = "", + val status: Int = 0, + val type: String = "", + val updateBy: Any = "", + val updateTime: Any = "", + val url: String = "" +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/MajorBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/MajorBean.kt new file mode 100644 index 0000000..77b6eac --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/MajorBean.kt @@ -0,0 +1,7 @@ +package com.xjjk.healthyclients.bean.emergency + +data class MajorBean( + val userId: String, + val userName: String, + val userSex: String +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/OperatorBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/OperatorBean.kt new file mode 100644 index 0000000..39b989e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/OperatorBean.kt @@ -0,0 +1,7 @@ +package com.xjjk.healthyclients.bean.emergency + +data class OperatorBean( + val userId: String, + val userName: String, + val userSex: String +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/OrderThroughBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/OrderThroughBean.java new file mode 100644 index 0000000..61c91a7 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/OrderThroughBean.java @@ -0,0 +1,23 @@ +package com.xjjk.healthyclients.bean.emergency; + +public class OrderThroughBean { + + private String orderThrough; + private String orderResult; + + public String getOrderThrough() { + return orderThrough; + } + + public void setOrderThrough(String orderThrough) { + this.orderThrough = orderThrough; + } + + public String getOrderResult() { + return orderResult; + } + + public void setOrderResult(String orderResult) { + this.orderResult = orderResult; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/emergency/initUserOrderPageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/initUserOrderPageBean.java new file mode 100644 index 0000000..baca2ef --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/emergency/initUserOrderPageBean.java @@ -0,0 +1,164 @@ +package com.xjjk.healthyclients.bean.emergency; + +import java.util.List; + +public class initUserOrderPageBean { + + private List records; + private int total; + private int size; + private int current; + private List orders; + private boolean optimizeCountSql; + private boolean searchCount; + private int pages; + + public List getRecords() { + return records; + } + + public void setRecords(List records) { + this.records = records; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public int getCurrent() { + return current; + } + + public void setCurrent(int current) { + this.current = current; + } + + public List getOrders() { + return orders; + } + + public void setOrders(List orders) { + this.orders = orders; + } + + public boolean isOptimizeCountSql() { + return optimizeCountSql; + } + + public void setOptimizeCountSql(boolean optimizeCountSql) { + this.optimizeCountSql = optimizeCountSql; + } + + public boolean isSearchCount() { + return searchCount; + } + + public void setSearchCount(boolean searchCount) { + this.searchCount = searchCount; + } + + + public int getPages() { + return pages; + } + + public void setPages(int pages) { + this.pages = pages; + } + + public static class RecordsDTO { + private String id; + private String sessionId; + private String initiatorUserId; + private String initiatorUserName; + private String orderStatus; + private String orderStatus_dictText; + private String createTime; + private String sendOrderHospital; + private String stationBusiness_dictText; + + public String getStationBusiness_dictText() { + return stationBusiness_dictText == null ? "" : stationBusiness_dictText; + } + + public void setStationBusiness_dictText(String stationBusiness_dictText) { + this.stationBusiness_dictText = stationBusiness_dictText; + } + + public String getSendOrderHospital() { + return sendOrderHospital == null ? "" : sendOrderHospital; + } + + public void setSendOrderHospital(String sendOrderHospital) { + this.sendOrderHospital = sendOrderHospital; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSessionId() { + return sessionId == null ? "" : sessionId; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + public String getInitiatorUserId() { + return initiatorUserId == null ? "" : initiatorUserId; + } + + public void setInitiatorUserId(String initiatorUserId) { + this.initiatorUserId = initiatorUserId; + } + + public String getInitiatorUserName() { + return initiatorUserName == null ? "" : initiatorUserName; + } + + public void setInitiatorUserName(String initiatorUserName) { + this.initiatorUserName = initiatorUserName; + } + + public String getOrderStatus() { + return orderStatus == null ? "" : orderStatus; + } + + public void setOrderStatus(String orderStatus) { + this.orderStatus = orderStatus; + } + + public String getOrderStatus_dictText() { + return orderStatus_dictText == null ? "" : orderStatus_dictText; + } + + public void setOrderStatus_dictText(String orderStatus_dictText) { + this.orderStatus_dictText = orderStatus_dictText; + } + + public String getCreateTime() { + return createTime == null ? "" : createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/AppointmentInformationBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/AppointmentInformationBean.kt new file mode 100644 index 0000000..2342bf5 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/AppointmentInformationBean.kt @@ -0,0 +1,21 @@ +package com.xjjk.healthyclients.bean.guidance + +import android.os.Parcelable +import com.sw.healthyclients.bean.guidance.CallTimeBean +import com.sw.healthyclients.bean.guidance.ConsultRecordBean +import com.sw.healthyclients.bean.guidance.DoctorBean +import com.sw.healthyclients.bean.guidance.HealthInfoBean +import kotlinx.parcelize.Parcelize + +@Parcelize +data class AppointmentInformationBean( + var answer: MutableList? = null, + var conFamilyMembersDO: ConsultantBean? = null, + var conMedicalRecordsListDO: ArchivesBean? = null, + var conSession: ConsultRecordBean? = null, + var createTime: Long = 0, + var conDoctorDO: DoctorBean? = null, + var conEvaluateDO: AppraiseBean? = null, + var idNo: String? = null, + var imList: MutableList? = mutableListOf() +): Parcelable diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/AppointmentTimeBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/AppointmentTimeBean.kt new file mode 100644 index 0000000..9f82270 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/AppointmentTimeBean.kt @@ -0,0 +1,15 @@ +package com.xjjk.healthyclients.bean.guidance + +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter + +data class AppointmentTimeBean( + var id: String = "", + var type: String = "", + var schedulingNum: String = "", + var schedulingDate: String = "", + var week : String = "", + var readySchedulingNum: String ="", + override val itemType: Int = -1, + override var checked: Boolean = false +) : BaseCheckRecycleViewAdapter.CheckItem { +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/AppraiseBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/AppraiseBean.kt new file mode 100644 index 0000000..f8216ad --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/AppraiseBean.kt @@ -0,0 +1,16 @@ +package com.xjjk.healthyclients.bean.guidance + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize +data class AppraiseBean( + var context: String = "", + var id: String = "", + var officeName: String = "", + var score: String = "", + var sessionType: String = "", + var time: String = "", + var userId: String = "", + var userName: String = "" + ): Parcelable diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ArchivesBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ArchivesBean.kt new file mode 100644 index 0000000..90c731c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ArchivesBean.kt @@ -0,0 +1,58 @@ +package com.xjjk.healthyclients.bean.guidance + +import android.os.Parcelable +import com.lzy.ninegrid.ImageInfo +import com.tencent.qcloud.tuikit.tuichat.bean.message.ArchivesMessageBean +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import com.xjjk.healthyclients.superfuntion.addImageBaseUrl +import com.xjjk.healthyclients.utils.CommonUtils +import kotlinx.parcelize.Parcelize + +@Parcelize +data class ArchivesBean( + val id: String? = null, + var name: String = "", + var gender: String = "", + var age: String? = null, + var medicalDescribe: String = "", + var recordsName: String = "", + val createTime: String = "", + val createTimeLong: Long = 0, + var tfPermission: String? = null, + var haveTime: String? = null, + var haveTimeValue: String? = null, + var desire: String = "", + var tfLook: String? = null, + var tfLookValue: String? = null, + var lookOffice: String? = null, + var lookMedicalName: String? = null, + var image: String = "", + var memberId: String? = null, + var updateTime : String? = null, + var isSelf: Boolean = false, + override val itemType: Int = -1, + override var checked: Boolean = false +): BaseCheckRecycleViewAdapter.CheckItem, Parcelable{ + fun toIMArchivesMessageBean(consultantBean: ConsultantBean? = null): ArchivesMessageBean { + var archivesMessageBean = ArchivesMessageBean() + archivesMessageBean.archivesId = id + archivesMessageBean.name = consultantBean?.name ?: name + archivesMessageBean.gender = CommonUtils.getGenderText(consultantBean?.gender ?: gender) + archivesMessageBean.age = (consultantBean?.age ?: age)?.toInt() ?: 0 + archivesMessageBean.symptomDescription = medicalDescribe + archivesMessageBean.memberId = memberId + var imageList = image.split(",") + val list: MutableList = ArrayList() + var imageInfo: ImageInfo + imageList.forEach { + if (it.isNotEmpty()){ + imageInfo = ImageInfo() + imageInfo.setThumbnailUrl(addImageBaseUrl(it)) + imageInfo.setBigImageUrl(addImageBaseUrl(it)) + list.add(imageInfo) + } + } + archivesMessageBean.imageList = list + return archivesMessageBean + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/BaseHealthyInfoChildBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/BaseHealthyInfoChildBean.kt new file mode 100644 index 0000000..a0cef93 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/BaseHealthyInfoChildBean.kt @@ -0,0 +1,28 @@ +package com.xjjk.healthyclients.bean.guidance + +import com.chad.library.adapter.base.entity.SectionEntity +import com.google.gson.annotations.SerializedName + +class BaseHealthyInfoChildBean: SectionEntity{ + var headerName: String = "" + var answerContent: String? = null + var id: String = "" + var itemOptions: String = "" + var itemProblem: String = "" + var hideLine: Boolean = false + var baseHealthId: String + set(value) {baseHealthId = id} + get() = id + var memberId: String? = null + var answerList: MutableList = mutableListOf() + @SerializedName("itemType") + var type: String = "" + override var itemType: Int + @SerializedName("multiItemType") + set(value) { itemType = value } + @SerializedName("multiItemType") + get() = if (isHeader) SectionEntity.HEADER_TYPE else SectionEntity.NORMAL_TYPE + override var isHeader: Boolean = false + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/BaseHealthyInfoResultBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/BaseHealthyInfoResultBean.kt new file mode 100644 index 0000000..d6c1c25 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/BaseHealthyInfoResultBean.kt @@ -0,0 +1,7 @@ +package com.xjjk.healthyclients.bean.guidance + +data class BaseHealthyInfoResultBean( + var childList: MutableList = mutableListOf(), + var text: String = "", + var value: String = "" +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/CallTimeBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/CallTimeBean.kt new file mode 100644 index 0000000..d465e0b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/CallTimeBean.kt @@ -0,0 +1,15 @@ +package com.sw.healthyclients.bean.guidance + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize +data class CallTimeBean( + val createTime: String = "", + val endTime: String = "", + val createTimeLong: Long? = null, + val endTimeLong: Long?= null, + var startTime: String = "", + var startTimLong: Long? = null, + val type: String = "" +): Parcelable \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultArchivesDetailBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultArchivesDetailBean.kt new file mode 100644 index 0000000..b9257f7 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultArchivesDetailBean.kt @@ -0,0 +1,14 @@ +package com.xjjk.healthyclients.bean.guidance + +import com.sw.healthyclients.bean.guidance.HealthInfoBean + +/** + * @author nanfeifei + * @time 2023/6/20 13:35 + * @description + */ +class ConsultArchivesDetailBean ( + var answer: MutableList? = mutableListOf(), + var conMedicalRecordsDO: ArchivesBean? = null, + var conFamilyMembersDO: ConsultantBean? = null +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultDoctorIMChatInfo.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultDoctorIMChatInfo.kt new file mode 100644 index 0000000..9d73c63 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultDoctorIMChatInfo.kt @@ -0,0 +1,9 @@ +package com.sw.healthyclients.bean.guidance + +data class ConsultDoctorIMChatInfo( + val groupId: String, + val userId: String, + val member: ArrayList, + val tfNew: String, + val id: String +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultRecordBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultRecordBean.kt new file mode 100644 index 0000000..8fd89fa --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultRecordBean.kt @@ -0,0 +1,30 @@ +package com.sw.healthyclients.bean.guidance + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +/** + * 咨询记录相关信息 + */ +@Parcelize +data class ConsultRecordBean( + val doctorEndTime: String? = "", + val doctorStartTime: String? = "", + val doctorEndTimeLong: Long? = null, + val doctorStartTimeLong: Long? = null, + val sessionDateLong: Long? = null, + val week: String? = "", + val amPm: String? = "", + val id: String? = "", + val imId: String? = "", + val memberAge: String? = "", + val memberId: String? = "", + val memberName: String? = "", + val memberSex: String? = "", + val createTime: String? = "", + var unreadCount: Int = 0, + val contentStatus: String? = "", //预约状态 1待确认 2待开始 3已开始 4待评价 5完成 6拒绝 7取消 + val contentType: String? = "", //咨询类型:1图文咨询 2视频咨询 + val reasonType: String? = "", //拒绝原因 + val rejectReason: String? = "" //拒绝的备注 +) : Parcelable diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultantBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultantBean.kt new file mode 100644 index 0000000..bd0ca00 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ConsultantBean.kt @@ -0,0 +1,27 @@ +package com.xjjk.healthyclients.bean.guidance + +import android.os.Parcelable +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import kotlinx.parcelize.Parcelize + +/** + * 咨询人 + */ +@Parcelize +data class ConsultantBean(var name: String? = "", + var gender: String = "", + var age: String? = null, + var birthday: String? = null, + var birthdayLong: Long = 0, + var height: String? = "", + var weight: String? = "", + var familyRelation: String = "", //需注意选择咨询人时返回的是关系值1,2,3咨询人管理时是描述本人,母亲 + var id: String? = null, + var list : MutableList? = null, + override val itemType: Int = -1, + override var checked: Boolean = false +): BaseCheckRecycleViewAdapter.CheckItem, Parcelable{ + fun isSelf(): Boolean{ + return "1" == familyRelation + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartListBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartListBean.java new file mode 100644 index 0000000..2266737 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartListBean.java @@ -0,0 +1,59 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class DepartListBean { + + private String id; + private String departmentName; + private int doctorNum; + private int secondDepartmentNum; + private int sickNum; + private boolean isSelect; + + public int getSecondDepartmentNum() { + return secondDepartmentNum; + } + + public void setSecondDepartmentNum(int secondDepartmentNum) { + this.secondDepartmentNum = secondDepartmentNum; + } + + public int getSickNum() { + return sickNum; + } + + public void setSickNum(int sickNum) { + this.sickNum = sickNum; + } + + public boolean isSelect() { + return isSelect; + } + + public void setSelect(boolean select) { + isSelect = select; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentName() { + return departmentName == null ? "" : departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartListBeanNew.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartListBeanNew.java new file mode 100644 index 0000000..aeee147 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartListBeanNew.java @@ -0,0 +1,28 @@ +package com.xjjk.healthyclients.bean.guidance; + + +import java.util.ArrayList; + +public class DepartListBeanNew { + private int doctorNum; + private ArrayList list; + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } + + public ArrayList getList() { + if (list == null) { + return new ArrayList<>(); + } + return list; + } + + public void setList(ArrayList list) { + this.list = list; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartmentListBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartmentListBean.java new file mode 100644 index 0000000..349e57b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartmentListBean.java @@ -0,0 +1,72 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class DepartmentListBean { + + + private String header; + private Boolean isHeader; + private InfoDTO info; + + public String getHeader() { + return header; + } + + public void setHeader(String header) { + this.header = header; + } + + public Boolean getIsHeader() { + return isHeader; + } + + public void setIsHeader(Boolean isHeader) { + this.isHeader = isHeader; + } + + public InfoDTO getInfo() { + return info; + } + + public void setInfo(InfoDTO info) { + this.info = info; + } + + public static class InfoDTO { + private String content; + private String group; + private String imgUrl; + private String title; + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getGroup() { + return group; + } + + public void setGroup(String group) { + this.group = group; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartmentchildBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartmentchildBean.java new file mode 100644 index 0000000..b98b527 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DepartmentchildBean.java @@ -0,0 +1,59 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class DepartmentchildBean { + //科室 + private String departmentId; + private String departmentImg; + private String departmentName; + private String hint; + private int doctorNum=0; + private boolean isSelect; + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } + + public String getDepartmentId() { + return departmentId == null ? "" : departmentId; + } + + public void setDepartmentId(String departmentId) { + this.departmentId = departmentId; + } + + public boolean isSelect() { + return isSelect; + } + + public void setSelect(boolean select) { + isSelect = select; + } + + public String getDepartmentImg() { + return departmentImg; + } + + public void setDepartmentImg(String departmentImg) { + this.departmentImg = departmentImg; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public String getHint() { + return hint; + } + + public void setHint(String hint) { + this.hint = hint; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DiseaseBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DiseaseBean.kt new file mode 100644 index 0000000..c6dbb8c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DiseaseBean.kt @@ -0,0 +1,22 @@ +package com.sw.healthyclients.bean.guidance + +import android.os.Parcelable +import com.chad.library.adapter.base.entity.SectionEntity +import com.google.gson.annotations.SerializedName +import kotlinx.parcelize.Parcelize + +@Parcelize +data class DiseaseBean( + @field:SerializedName(value = "sicksName", alternate = ["name"]) var name: String = "", + override val isHeader: Boolean = false +) : Parcelable, SectionEntity { + //疾病 + var id: String? = null + get() = field.orEmpty() + + var title: String? = null + + var doctorNum: String? = null + get() = field.orEmpty() + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DoctorBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DoctorBean.kt new file mode 100644 index 0000000..4383196 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DoctorBean.kt @@ -0,0 +1,34 @@ +package com.sw.healthyclients.bean.guidance + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize +data class DoctorBean( + var degreeHeat: String = "", + var departmentId: String = "", + var departmentName: String = "", + var doctorLabel: String = "", + var doctorName: String = "", + var doctorScore: String = "", + var doctorTitle: String = "", + var goodAt: String = "", + var hospitalLevel: String = "", + var id: String = "", + var introduction: String = "", + var messageNum: String = "", + var overallMerit: String = "", + var doctorStatus: String = "", + var photo: String = "", + var resourceId: String = "", + var resourceName: String = "", + var responseRate: String = "", + var tfFollow: String = "", + var type: String = "", + var audioStatus: String = "", + var goodAtSickness: String? = "", + var score: String = "", + var userScoreNum: String = "", + var experience: String = "", + var goodAtSicknessName: MutableList? = null + ): Parcelable diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DoctorChildBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DoctorChildBean.java new file mode 100644 index 0000000..1da7726 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DoctorChildBean.java @@ -0,0 +1,130 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class DoctorChildBean { + private String id; + private String icon; + private String name; + private String title; + private String tag; + private String history; + private String hospitalName; + private String hint; + private String evaluate;//综合评价 + private String reply;//回复率 + private String guidanceNumber;//咨询量 + private String tfShowFire;//小火苗 + private String doctorStatus; + private String audioStatus; + + public String getAudioStatus() { + return audioStatus == null ? "" : audioStatus; + } + + public void setAudioStatus(String audioStatus) { + this.audioStatus = audioStatus; + } + + public String getDoctorStatus() { + return doctorStatus == null ? "" : doctorStatus; + } + + public void setDoctorStatus(String doctorStatus) { + this.doctorStatus = doctorStatus; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTfShowFire() { + return tfShowFire == null ? "" : tfShowFire; + } + + public void setTfShowFire(String tfShowFire) { + this.tfShowFire = tfShowFire; + } + + public String getHistory() { + return history; + } + + public void setHistory(String history) { + this.history = history; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getTag() { + return tag==null?"":tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getHospitalName() { + return hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public String getHint() { + return hint==null ? "" :hint; + } + + public void setHint(String hint) { + this.hint = hint; + } + + public String getEvaluate() { + return evaluate; + } + + public void setEvaluate(String evaluate) { + this.evaluate = evaluate; + } + + public String getReply() { + return reply; + } + + public void setReply(String reply) { + this.reply = reply; + } + + public String getGuidanceNumber() { + return guidanceNumber; + } + + public void setGuidanceNumber(String guidanceNumber) { + this.guidanceNumber = guidanceNumber; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DoctorRecommendBeanNetWork.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DoctorRecommendBeanNetWork.java new file mode 100644 index 0000000..9ca4c68 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/DoctorRecommendBeanNetWork.java @@ -0,0 +1,28 @@ +package com.xjjk.healthyclients.bean.guidance; + +import com.sw.healthyclients.bean.guidance.DoctorBean; + +import java.util.List; + +public class DoctorRecommendBeanNetWork { + + private String haveSessioning; + private List list; + + public String getHaveSessioning() { + return haveSessioning; + } + + public void setHaveSessioning(String haveSessioning) { + this.haveSessioning = haveSessioning; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ElemeGroupedItem.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ElemeGroupedItem.java new file mode 100644 index 0000000..2fa6105 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/ElemeGroupedItem.java @@ -0,0 +1,71 @@ +package com.xjjk.healthyclients.bean.guidance;//package com.sw.healthyclients.bean.guidance; +// +///* +// * Copyright (c) 2018-present. KunMinX +// * +// * Licensed under the Apache License, Version 2.0 (the "License"); +// * you may not use this file except in compliance with the License. +// * You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the License is distributed on an "AS IS" BASIS, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the License for the specific language governing permissions and +// * limitations under the License. +// */ +// +// +//import com.kunminx.linkage.bean.BaseGroupedItem; +// +///** +// * Create by KunMinX at 19/4/27 +// */ +//public class ElemeGroupedItem extends BaseGroupedItem { +// +// public ElemeGroupedItem(boolean isHeader, String header) { +// super(isHeader, header); +// } +// +// public ElemeGroupedItem(ItemInfo item) { +// super(item); +// } +// +// public static class ItemInfo extends BaseGroupedItem.ItemInfo { +// private String content; +// private String imgUrl; +// private String cost; +// +// public ItemInfo(String title, String group, String content, String imgUrl, String cost) { +// super(title, group); +// this.content = content; +// this.imgUrl = imgUrl; +// this.cost = cost; +// } +// +// public String getContent() { +// return content; +// } +// +// public void setContent(String content) { +// this.content = content; +// } +// +// public String getImgUrl() { +// return imgUrl; +// } +// +// public void setImgUrl(String imgUrl) { +// this.imgUrl = imgUrl; +// } +// +// public String getCost() { +// return cost; +// } +// +// public void setCost(String cost) { +// this.cost = cost; +// } +// } +//} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/FilterSearchBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/FilterSearchBean.java new file mode 100644 index 0000000..3488b1f --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/FilterSearchBean.java @@ -0,0 +1,76 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class FilterSearchBean { + private int type; //0医院 1科室 2疾病 + private String sickId; + private String sickDepartmentId; + private String sicksName; + private String hospitalId; + private String hospitalName; + private String departmentName; + private String departmentid; + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getSickId() { + return sickId == null ? "" : sickId; + } + + public void setSickId(String sickId) { + this.sickId = sickId; + } + + public String getSickDepartmentId() { + return sickDepartmentId == null ? "" : sickDepartmentId; + } + + public void setSickDepartmentId(String sickDepartmentId) { + this.sickDepartmentId = sickDepartmentId; + } + + public String getSicksName() { + return sicksName == null ? "" : sicksName; + } + + public void setSicksName(String sicksName) { + this.sicksName = sicksName; + } + + public String getHospitalId() { + return hospitalId == null ? "" : hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getHospitalName() { + return hospitalName == null ? "" : hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public String getDepartmentName() { + return departmentName == null ? "" : departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public String getDepartmentid() { + return departmentid == null ? "" : departmentid; + } + + public void setDepartmentid(String departmentid) { + this.departmentid = departmentid; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/GuidanceListBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/GuidanceListBean.java new file mode 100644 index 0000000..968124e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/GuidanceListBean.java @@ -0,0 +1,103 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class GuidanceListBean { + private String id; + private String imId; + private String memberId; + private String toAccountHead; + private String toAccountName; + private String contentType; + private String contentStatus; + private String hospitalLevel; + private String resourceName; + private String createTime; + private String memberName; + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getImId() { + return imId == null ? "" : imId; + } + + public void setImId(String imId) { + this.imId = imId; + } + + public String getMemberId() { + return memberId == null ? "" : memberId; + } + + public void setMemberId(String memberId) { + this.memberId = memberId; + } + + public String getToAccountHead() { + return toAccountHead == null ? "" : toAccountHead; + } + + public void setToAccountHead(String toAccountHead) { + this.toAccountHead = toAccountHead; + } + + public String getToAccountName() { + return toAccountName ; + } + + public void setToAccountName(String toAccountName) { + this.toAccountName = toAccountName; + } + + public String getContentType() { + return contentType == null ? "" : contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getContentStatus() { + return contentStatus == null ? "" : contentStatus; + } + + public void setContentStatus(String contentStatus) { + this.contentStatus = contentStatus; + } + + public String getHospitalLevel() { + return hospitalLevel == null ? "" : hospitalLevel; + } + + public void setHospitalLevel(String hospitalLevel) { + this.hospitalLevel = hospitalLevel; + } + + public String getResourceName() { + return resourceName == null ? "" : resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getCreateTime() { + return createTime == null ? "" : createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getMemberName() { + return memberName == null ? "" : memberName; + } + + public void setMemberName(String memberName) { + this.memberName = memberName; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/GuidanceSearchBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/GuidanceSearchBean.java new file mode 100644 index 0000000..8f6ac4b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/GuidanceSearchBean.java @@ -0,0 +1,13 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class GuidanceSearchBean { + private int type=0; + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HealthInfoBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HealthInfoBean.kt new file mode 100644 index 0000000..f9d3e0a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HealthInfoBean.kt @@ -0,0 +1,10 @@ +package com.sw.healthyclients.bean.guidance + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize +data class HealthInfoBean( + val answerKey: String, + val answerValue: String +): Parcelable \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HealthyInfoRadioBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HealthyInfoRadioBean.kt new file mode 100644 index 0000000..3d90a22 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HealthyInfoRadioBean.kt @@ -0,0 +1,13 @@ +package com.xjjk.healthyclients.bean.guidance + +import android.os.Parcelable +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import kotlinx.parcelize.Parcelize + +@Parcelize +data class HealthyInfoRadioBean(var radioText: String, + var explain: String?, + var value: String, + override val itemType: Int, + override var checked: Boolean +): BaseCheckRecycleViewAdapter.CheckItem, Parcelable diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HospitalCommentBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HospitalCommentBean.java new file mode 100644 index 0000000..56884db --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HospitalCommentBean.java @@ -0,0 +1,77 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class HospitalCommentBean { + + private String id; + private String userId; + private String userName; + private String time; + private String score; + private String context; + private String officeName; + private String sessionType; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getScore() { + return score; + } + + public void setScore(String score) { + this.score = score; + } + + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } + + public String getOfficeName() { + return officeName; + } + + public void setOfficeName(String officeName) { + this.officeName = officeName; + } + + public String getSessionType() { + return sessionType; + } + + public void setSessionType(String sessionType) { + this.sessionType = sessionType; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HospitalchildBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HospitalchildBean.java new file mode 100644 index 0000000..0e90504 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/HospitalchildBean.java @@ -0,0 +1,86 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class HospitalchildBean { + //医院 + private String id; + private String img; + private String tag; + private String name; + private String department;//科室 + private String distance; + private String address; + private double lon; + private double lat; + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getImg() { + return img; + } + + public void setImg(String img) { + this.img = img; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDepartment() { + return department == null ? "" : department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public String getDistance() { + return distance; + } + + public void setDistance(String distance) { + this.distance = distance; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/InsertUserAndHelperSessionBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/InsertUserAndHelperSessionBean.java new file mode 100644 index 0000000..c58231d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/InsertUserAndHelperSessionBean.java @@ -0,0 +1,23 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class InsertUserAndHelperSessionBean { + + private String helpId;//小助手id + private String id;//咨询单id + + public String getHelpId() { + return helpId == null ? "" : helpId; + } + + public void setHelpId(String helpId) { + this.helpId = helpId; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/SearchDepartListBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/SearchDepartListBean.java new file mode 100644 index 0000000..3a6d728 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/SearchDepartListBean.java @@ -0,0 +1,68 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class SearchDepartListBean { + + private String id; + private String departmentName; + private int doctorNum; + private int secondDepartmentNum; + private int sickNum; + private int mark; + private Object image; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } + + public int getSecondDepartmentNum() { + return secondDepartmentNum; + } + + public void setSecondDepartmentNum(int secondDepartmentNum) { + this.secondDepartmentNum = secondDepartmentNum; + } + + public int getSickNum() { + return sickNum; + } + + public void setSickNum(int sickNum) { + this.sickNum = sickNum; + } + + public int getMark() { + return mark; + } + + public void setMark(int mark) { + this.mark = mark; + } + + public Object getImage() { + return image; + } + + public void setImage(Object image) { + this.image = image; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/SearchHomeBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/SearchHomeBean.java new file mode 100644 index 0000000..0a9855e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/SearchHomeBean.java @@ -0,0 +1,616 @@ +package com.xjjk.healthyclients.bean.guidance; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class SearchHomeBean { + + @SerializedName("SicksList") + private List sicksList; + private int hospitalCount; + @SerializedName("DepartmentList") + private List departmentList; + private List hospitalList; + @SerializedName("DepartmentCount") + private int departmentCount; + @SerializedName("SicksCount") + private int sicksCount; + + public List getSicksList() { + return sicksList; + } + + public void setSicksList(List sicksList) { + this.sicksList = sicksList; + } + + public int getHospitalCount() { + return hospitalCount; + } + + public void setHospitalCount(int hospitalCount) { + this.hospitalCount = hospitalCount; + } + + public List getDepartmentList() { + return departmentList; + } + + public void setDepartmentList(List departmentList) { + this.departmentList = departmentList; + } + + public List getHospitalList() { + return hospitalList; + } + + public void setHospitalList(List hospitalList) { + this.hospitalList = hospitalList; + } + + public int getDepartmentCount() { + return departmentCount; + } + + public void setDepartmentCount(int departmentCount) { + this.departmentCount = departmentCount; + } + + public int getSicksCount() { + return sicksCount; + } + + public void setSicksCount(int sicksCount) { + this.sicksCount = sicksCount; + } + + public static class SicksListDTO { + private String id; + private String departmentId; + private String sicksName; + private String descript; + private String doctorNum; + private int status; + private int delFlag; + private Object createBy; + private Object createTime; + private Object updateBy; + private Object updateTime; + private Object memo; + private Object sicksCode; + + public String getDoctorNum() { + return doctorNum == null ? "" : doctorNum; + } + + public void setDoctorNum(String doctorNum) { + this.doctorNum = doctorNum; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentId() { + return departmentId; + } + + public void setDepartmentId(String departmentId) { + this.departmentId = departmentId; + } + + public String getSicksName() { + return sicksName; + } + + public void setSicksName(String sicksName) { + this.sicksName = sicksName; + } + + public String getDescript() { + return descript; + } + + public void setDescript(String descript) { + this.descript = descript; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public Object getCreateTime() { + return createTime; + } + + public void setCreateTime(Object createTime) { + this.createTime = createTime; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getMemo() { + return memo; + } + + public void setMemo(Object memo) { + this.memo = memo; + } + + public Object getSicksCode() { + return sicksCode; + } + + public void setSicksCode(Object sicksCode) { + this.sicksCode = sicksCode; + } + } + + public static class DepartmentListDTO { + private String id; + private String departmentName; + private String othername; + private String mark; + private String sicks; + private String createName; + private Object createBy; + private Object createTime; + private String updateName; + private Object updateBy; + private Object updateTime; + private Object delDate; + private int delFlag; + private int doctorNum; + private String officeLevel; + private String officeCode; + private Object officeparid; + private String resourceId; + private String resourceName; + private String image; + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public String getOthername() { + return othername; + } + + public void setOthername(String othername) { + this.othername = othername; + } + + public String getMark() { + return mark; + } + + public void setMark(String mark) { + this.mark = mark; + } + + public String getSicks() { + return sicks; + } + + public void setSicks(String sicks) { + this.sicks = sicks; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public Object getCreateTime() { + return createTime; + } + + public void setCreateTime(Object createTime) { + this.createTime = createTime; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getDelDate() { + return delDate; + } + + public void setDelDate(Object delDate) { + this.delDate = delDate; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public String getOfficeLevel() { + return officeLevel; + } + + public void setOfficeLevel(String officeLevel) { + this.officeLevel = officeLevel; + } + + public String getOfficeCode() { + return officeCode; + } + + public void setOfficeCode(String officeCode) { + this.officeCode = officeCode; + } + + public Object getOfficeparid() { + return officeparid; + } + + public void setOfficeparid(Object officeparid) { + this.officeparid = officeparid; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + } + + public static class HospitalListDTO { + private String id; + private String resourceName; + private double longitude; + private double latitude; + private String type; + private Object secondType; + private Object aidrange; + private String gdId; + private String url; + private String province; + private String city; + private Object area; + private String address; + private String level; + private String img; + private String synopsis; + private int sort; + private int status; + private int delFlag; + private Object createBy; + private Object createTime; + private Object updateBy; + private Object updateTime; + private Object memo; + private String keyDepartments; + private String userScore; + private String userScoreNum; + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getResourceName() { + return resourceName == null ? "" : resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public String getType() { + return type == null ? "" : type; + } + + public void setType(String type) { + this.type = type; + } + + public Object getSecondType() { + return secondType; + } + + public void setSecondType(Object secondType) { + this.secondType = secondType; + } + + public Object getAidrange() { + return aidrange; + } + + public void setAidrange(Object aidrange) { + this.aidrange = aidrange; + } + + public String getGdId() { + return gdId == null ? "" : gdId; + } + + public void setGdId(String gdId) { + this.gdId = gdId; + } + + public String getUrl() { + return url == null ? "" : url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getProvince() { + return province == null ? "" : province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city == null ? "" : city; + } + + public void setCity(String city) { + this.city = city; + } + + public Object getArea() { + return area; + } + + public void setArea(Object area) { + this.area = area; + } + + public String getAddress() { + return address == null ? "" : address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getLevel() { + return level == null ? "" : level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getImg() { + return img == null ? "" : img; + } + + public void setImg(String img) { + this.img = img; + } + + public String getSynopsis() { + return synopsis == null ? "" : synopsis; + } + + public void setSynopsis(String synopsis) { + this.synopsis = synopsis; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public Object getCreateTime() { + return createTime; + } + + public void setCreateTime(Object createTime) { + this.createTime = createTime; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getMemo() { + return memo; + } + + public void setMemo(Object memo) { + this.memo = memo; + } + + public String getKeyDepartments() { + return keyDepartments == null ? "" : keyDepartments; + } + + public void setKeyDepartments(String keyDepartments) { + this.keyDepartments = keyDepartments; + } + + public String getUserScore() { + return userScore == null ? "" : userScore; + } + + public void setUserScore(String userScore) { + this.userScore = userScore; + } + + public String getUserScoreNum() { + return userScoreNum == null ? "" : userScoreNum; + } + + public void setUserScoreNum(String userScoreNum) { + this.userScoreNum = userScoreNum; + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/SickListBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/SickListBean.java new file mode 100644 index 0000000..4e57c47 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/SickListBean.java @@ -0,0 +1,50 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class SickListBean { + + private String id; + private String departmentId; + private String sicksName; + private int doctorNum; + private Object descript; + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentId() { + return departmentId == null ? "" : departmentId; + } + + public void setDepartmentId(String departmentId) { + this.departmentId = departmentId; + } + + public String getSicksName() { + return sicksName == null ? "" : sicksName; + } + + public void setSicksName(String sicksName) { + this.sicksName = sicksName; + } + + public Object getDescript() { + return descript; + } + + public void setDescript(Object descript) { + this.descript = descript; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/hospitalDetailBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/hospitalDetailBean.java new file mode 100644 index 0000000..e92e0ac --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/hospitalDetailBean.java @@ -0,0 +1,113 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class hospitalDetailBean { + + private String id; + private String resourceName=""; + private double longitude; + private double latitude; + private String address=""; + private String level; + private String img; + private String synopsis=""; + private String departmentNum; + private String doctorNum; + private String tfFollow; + private String resourceDetail; + + public String getResourceDetail() { + return resourceDetail == null ? "" : resourceDetail; + } + + public void setResourceDetail(String resourceDetail) { + this.resourceDetail = resourceDetail; + } + + public String getTfFollow() { + return tfFollow == null ? "" : tfFollow; + } + + public void setTfFollow(String tfFollow) { + this.tfFollow = tfFollow; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getImg() { + return img; + } + + public void setImg(String img) { + this.img = img; + } + + public String getSynopsis() { + return synopsis; + } + + public void setSynopsis(String synopsis) { + this.synopsis = synopsis; + } + + public String getDepartmentNum() { + return departmentNum; + } + + public void setDepartmentNum(String departmentNum) { + this.departmentNum = departmentNum; + } + + public String getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(String doctorNum) { + this.doctorNum = doctorNum; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/ArchivesMessageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/ArchivesMessageBean.java new file mode 100644 index 0000000..62534e1 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/ArchivesMessageBean.java @@ -0,0 +1,77 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +import com.lzy.ninegrid.ImageInfo; + +import java.util.ArrayList; + +/** + * 档案 + */ +public class ArchivesMessageBean { + private String archivesId; + private String age; + private String gender; + private ArrayList imageList; + private String memberId; + private String name; + private String symptomDescription; + + public String getArchivesId() { + return archivesId == null ? "" : archivesId; + } + + public void setArchivesId(String archivesId) { + this.archivesId = archivesId; + } + + public String getAge() { + return age == null ? "0" : age; + } + + public void setAge(String age) { + this.age = age; + } + + public String getGender() { + return gender == null ? "" : gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public ArrayList getImageList() { + if (imageList == null) { + return new ArrayList<>(); + } + return imageList; + } + + public void setImageList(ArrayList imageList) { + this.imageList = imageList; + } + + public String getMemberId() { + return memberId == null ? "" : memberId; + } + + public void setMemberId(String memberId) { + this.memberId = memberId; + } + + public String getName() { + return name == null ? "" : name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSymptomDescription() { + return symptomDescription == null ? "" : symptomDescription; + } + + public void setSymptomDescription(String symptomDescription) { + this.symptomDescription = symptomDescription; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/CaseInsensitiveHashMap.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/CaseInsensitiveHashMap.kt new file mode 100644 index 0000000..a11b223 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/CaseInsensitiveHashMap.kt @@ -0,0 +1,19 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory + +class CaseInsensitiveHashMap : HashMap() { + override fun put(key: String, value: V): V? { + return super.put(key.lowercase(), value) + } + + override fun get(key: String): V? { + return super.get(key.lowercase()) + } + + override fun containsKey(key: String): Boolean { + return super.containsKey(key.lowercase()) + } + + override fun remove(key: String): V? { + return super.remove(key.lowercase()) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/DoctorCardMessageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/DoctorCardMessageBean.java new file mode 100644 index 0000000..b4ca83a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/DoctorCardMessageBean.java @@ -0,0 +1,49 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +public class DoctorCardMessageBean { + private String doctortitle; + private String cardid; + private String organization; + private String doctorname; + private String doctorheadimg; + + public String getDoctorheadimg() { + return doctorheadimg == null ? "" : doctorheadimg; + } + + public void setDoctorheadimg(String doctorheadimg) { + this.doctorheadimg = doctorheadimg; + } + + public String getDoctortitle() { + return doctortitle == null ? "" : doctortitle; + } + + public void setDoctortitle(String doctortitle) { + this.doctortitle = doctortitle; + } + + public String getCardid() { + return cardid == null ? "" : cardid; + } + + public void setCardid(String cardid) { + this.cardid = cardid; + } + + public String getOrganization() { + return organization == null ? "" : organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + public String getDoctorname() { + return doctorname == null ? "" : doctorname; + } + + public void setDoctorname(String doctorname) { + this.doctorname = doctorname; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/FileMessageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/FileMessageBean.java new file mode 100644 index 0000000..c67e71a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/FileMessageBean.java @@ -0,0 +1,31 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +public class FileMessageBean { + private String FileName; + private double FileSize; + private String Url; + + public String getFileName() { + return FileName == null ? "" : FileName; + } + + public void setFileName(String fileName) { + FileName = fileName; + } + + public double getFileSize() { + return FileSize; + } + + public void setFileSize(double fileSize) { + FileSize = fileSize; + } + + public String getUrl() { + return Url == null ? "" : Url; + } + + public void setUrl(String url) { + Url = url; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/ImageMessageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/ImageMessageBean.java new file mode 100644 index 0000000..1e953bf --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/ImageMessageBean.java @@ -0,0 +1,31 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +public class ImageMessageBean { + private String URL; + private int Width; + private int Height; + + public String getURL() { + return URL == null ? "" : URL; + } + + public void setURL(String URL) { + this.URL = URL; + } + + public int getWidth() { + return Width; + } + + public void setWidth(int width) { + Width = width; + } + + public int getHeight() { + return Height; + } + + public void setHeight(int height) { + Height = height; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/LocationMessageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/LocationMessageBean.java new file mode 100644 index 0000000..bd7850a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/LocationMessageBean.java @@ -0,0 +1,31 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +public class LocationMessageBean { + private String Desc; + private double Latitude; + private double Longitude; + + public String getDesc() { + return Desc == null ? "" : Desc; + } + + public void setDesc(String desc) { + Desc = desc; + } + + public double getLatitude() { + return Latitude; + } + + public void setLatitude(double latitude) { + Latitude = latitude; + } + + public double getLongitude() { + return Longitude; + } + + public void setLongitude(double longitude) { + Longitude = longitude; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/MedicalMessageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/MedicalMessageBean.java new file mode 100644 index 0000000..78e3c01 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/MedicalMessageBean.java @@ -0,0 +1,40 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +public class MedicalMessageBean { + private String year; + private String hospital; + private String cardNum; + private String recordId; + + public String getYear() { + return year == null ? "" : year; + } + + public void setYear(String year) { + this.year = year; + } + + public String getHospital() { + return hospital == null ? "" : hospital; + } + + public void setHospital(String hospital) { + this.hospital = hospital; + } + + public String getCardNum() { + return cardNum == null ? "" : cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } + + public String getRecordId() { + return recordId == null ? "" : recordId; + } + + public void setRecordId(String recordId) { + this.recordId = recordId; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/MessageHistoryBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/MessageHistoryBean.java new file mode 100644 index 0000000..544bfc4 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/MessageHistoryBean.java @@ -0,0 +1,82 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +public class MessageHistoryBean { + public String id=""; + public String groupid=""; + public String fromAccount="";//发送者账号 + public String toAccount="";//接受者账号 + public String sendtime="";//发送时间 + public String msgtype="";//消息类型 1单聊 2群聊 + public String msgcontent=""; + public String contenttype="";//消息元素类别 + public int msgseq=0;//消息序列 + public String createTime=""; + public String fromAccountName="";//发送者姓名 + public String toAccountName="";//接受者姓名 + public String contentStatus=""; + public String fromAccountHead="";//发送者头像 + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getGroupid() { + return groupid == null ? "" : groupid; + } + + public void setGroupid(String groupid) { + this.groupid = groupid; + } + + public String getFromAccount() { + return fromAccount == null ? "" : fromAccount; + } + + public void setFromAccount(String fromAccount) { + this.fromAccount = fromAccount; + } + + public String getToAccount() { + return toAccount == null ? "" : toAccount; + } + + public void setToAccount(String toAccount) { + this.toAccount = toAccount; + } + + public String getMsgcontent() { + return msgcontent == null ? "" : msgcontent; + } + + public void setMsgcontent(String msgcontent) { + this.msgcontent = msgcontent; + } + + public String getContenttype() { + return contenttype == null ? "" : contenttype; + } + + public void setContenttype(String contenttype) { + this.contenttype = contenttype; + } + + public String getCreateTime() { + return createTime == null ? "" : createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getFromAccountName() { + return fromAccountName == null ? "" : fromAccountName; + } + + public void setFromAccountName(String fromAccountName) { + this.fromAccountName = fromAccountName; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/MessageUtils.kt b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/MessageUtils.kt new file mode 100644 index 0000000..b3d675a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/MessageUtils.kt @@ -0,0 +1,349 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory + +import com.google.gson.Gson +import com.lzy.ninegrid.ImageInfo +import com.xjjk.healthyclients.superfuntion.toJson + +object MessageUtils { + public fun convertIMHistory(list: MutableList): ArrayList { + var newList= arrayListOf() + if (list.isNullOrEmpty()) { + return newList + } + var mGson=Gson() + for (index in 0 until list.size){ + var bean=list[index].toJson() + var beanJson= mGson.fromJson(bean, CaseInsensitiveHashMap::class.java) + var messageBean=Messagebean() + messageBean.contentType=beanJson["contenttype"].toString() + messageBean.createTime=beanJson["createTime"].toString() + messageBean.fromAccount=beanJson["fromAccount"].toString() + messageBean.fromAccountHead=beanJson["fromAccountHead"].toString() + messageBean.fromAccountName=beanJson["fromAccountName"].toString() + messageBean.toAccount=beanJson["toAccount"].toString() + when(beanJson["contenttype"].toString()){ + "TIMTextElem" -> { + //文本消息 + if (beanJson["msgcontent"].toString().contains("MsgBody")) { + var msgContentJsonMap = mGson.fromJson( + beanJson["msgcontent"].toString(), + CaseInsensitiveHashMap::class.java + ) + if (msgContentJsonMap != null) { + var Msg = msgContentJsonMap["MsgBody"] as List<*> + if (Msg.size > 0) { + TIMTextElemFactory(mGson, Msg, messageBean, newList) + } + } + }else{ + var msgContentJsonMap=mGson.fromJson(beanJson["msgcontent"].toString(),ArrayList::class.java) + if(msgContentJsonMap.size>0){ + TIMTextElemFactory(mGson, msgContentJsonMap, messageBean, newList) + } + } + } + "TIMCustomElem" -> { + //自定义消息 + if (beanJson["msgcontent"].toString().contains("MsgBody")) { + var msgContentJsonMap= mGson.fromJson(beanJson["msgcontent"].toString(), + CaseInsensitiveHashMap::class.java) + if (msgContentJsonMap != null) { + var Msg = msgContentJsonMap["MsgBody"] as List<*> + if(Msg.size>0){ + TIMCustomElemFactory(mGson, Msg, messageBean, newList) + } + } + }else{ + var msgContentJsonMap=mGson.fromJson(beanJson["msgcontent"].toString(),ArrayList::class.java) + if(msgContentJsonMap.size>0){ + TIMCustomElemFactory(mGson, msgContentJsonMap, messageBean, newList) + } + } + + } + "TIMImageElem" -> { + //图片消息 + if (beanJson["msgcontent"].toString().contains("MsgBody")) { + var msgContentJsonMap= mGson.fromJson(beanJson["msgcontent"].toString(), + CaseInsensitiveHashMap::class.java) + if (msgContentJsonMap != null) { + var Msg = msgContentJsonMap["MsgBody"] as List<*> + if(Msg.size>0){ + TIMImageElemFactory(mGson, Msg, messageBean, newList) + } + } + }else{ + var msgContentJsonMap=mGson.fromJson(beanJson["msgcontent"].toString(),ArrayList::class.java) + if(msgContentJsonMap.size>0){ + TIMImageElemFactory(mGson, msgContentJsonMap, messageBean, newList) + } + } + + } + "TIMVideoFileElem" -> { + //视频消息 + if (beanJson["msgcontent"].toString().contains("MsgBody")) { + var msgContentJsonMap= mGson.fromJson(beanJson["msgcontent"].toString(), + CaseInsensitiveHashMap::class.java) + if (msgContentJsonMap != null) { + var Msg = msgContentJsonMap["MsgBody"] as List<*> + if(Msg.size>0){ + TIMVideoFileElemFactory(mGson, Msg, messageBean, newList) + } + } + }else{ + var msgContentJsonMap=mGson.fromJson(beanJson["msgcontent"].toString(),ArrayList::class.java) + if(msgContentJsonMap.size>0){ + TIMVideoFileElemFactory(mGson, msgContentJsonMap, messageBean, newList) + } + } + + } + "TIMLocationElem" -> { + //定位消息 + if (beanJson["msgcontent"].toString().contains("MsgBody")) { + var msgContentJsonMap= mGson.fromJson(beanJson["msgcontent"].toString(), + CaseInsensitiveHashMap::class.java) + if (msgContentJsonMap != null) { + var Msg = msgContentJsonMap["MsgBody"] as List<*> + if(Msg.size>0){ + TIMLocationElemFactory(mGson, Msg, messageBean, newList) + } + } + }else{ + var msgContentJsonMap=mGson.fromJson(beanJson["msgcontent"].toString(),ArrayList::class.java) + if(msgContentJsonMap.size>0){ + TIMLocationElemFactory(mGson, msgContentJsonMap, messageBean, newList) + } + } + + } + "TIMFileElem" -> { + //文件消息 + if (beanJson["msgcontent"].toString().contains("MsgBody")) { + var msgContentJsonMap= mGson.fromJson(beanJson["msgcontent"].toString(), + CaseInsensitiveHashMap::class.java) + if (msgContentJsonMap != null) { + var Msg = msgContentJsonMap["MsgBody"] as List<*> + if(Msg.size>0){ + TIMFileElemFactory(mGson, Msg, messageBean, newList) + } + } + }else{ + var msgContentJsonMap=mGson.fromJson(beanJson["msgcontent"].toString(),ArrayList::class.java) + if(msgContentJsonMap.size>0){ + TIMFileElemFactory(mGson, msgContentJsonMap, messageBean, newList) + } + } + + } + "TIMSoundElem" -> { + //语音消息 + if (beanJson["msgcontent"].toString().contains("MsgBody")) { + var msgContentJsonMap= mGson.fromJson(beanJson["msgcontent"].toString(), + CaseInsensitiveHashMap::class.java) + if (msgContentJsonMap != null) { + var Msg = msgContentJsonMap["MsgBody"] as List<*> + if(Msg.size>0){ + TIMSoundElemFactory(mGson, Msg, messageBean, newList) + } + } + }else{ + var msgContentJsonMap=mGson.fromJson(beanJson["msgcontent"].toString(),ArrayList::class.java) + if(msgContentJsonMap.size>0){ + TIMSoundElemFactory(mGson, msgContentJsonMap, messageBean, newList) + } + } + + } + else -> {} + } + } + return newList + } + + private fun TIMSoundElemFactory( + mGson: Gson, + Msg: List<*>, + messageBean: Messagebean, + newList: ArrayList, + ) { + var soundMessageBean = SoundMessageBean() + var msgContentJsonMap = mGson.fromJson(Msg[0].toJson(), CaseInsensitiveHashMap::class.java) + var MsgContent = mGson.fromJson( + msgContentJsonMap["MsgContent"].toJson(), + CaseInsensitiveHashMap::class.java + ) + soundMessageBean.second = MsgContent["second"].toString() + soundMessageBean.size = MsgContent["Size"].toString() + soundMessageBean.url = MsgContent["Url"].toString() + messageBean.soundMessage = soundMessageBean + newList.add(messageBean) + } + + private fun TIMFileElemFactory( + mGson: Gson, + Msg: List<*>, + messageBean: Messagebean, + newList: ArrayList, + ) { + var fileMessageBean = FileMessageBean() + var msgContentJsonMap = mGson.fromJson(Msg[0].toJson(), CaseInsensitiveHashMap::class.java) + var MsgContent = mGson.fromJson( + msgContentJsonMap["MsgContent"].toJson(), + CaseInsensitiveHashMap::class.java + ) + fileMessageBean.fileName = MsgContent["fileName"].toString() + fileMessageBean.fileSize = MsgContent["fileSize"].toString().toDouble() + fileMessageBean.url = MsgContent["url"].toString() + messageBean.fileMessage = fileMessageBean + newList.add(messageBean) + } + + private fun TIMLocationElemFactory( + mGson: Gson, + Msg: List<*>, + messageBean: Messagebean, + newList: ArrayList, + ) { + var locationMessageBean = LocationMessageBean() + var msgContentJsonMap = mGson.fromJson(Msg[0].toJson(), CaseInsensitiveHashMap::class.java) + var MsgContent = mGson.fromJson( + msgContentJsonMap["MsgContent"].toJson(), + CaseInsensitiveHashMap::class.java + ) + locationMessageBean.desc = MsgContent["desc"].toString() + locationMessageBean.longitude = MsgContent["longitude"].toString().toDouble() + locationMessageBean.latitude = MsgContent["latitude"].toString().toDouble() + messageBean.locationMessage = locationMessageBean + newList.add(messageBean) + } + + private fun TIMVideoFileElemFactory( + mGson: Gson, + Msg: List<*>, + messageBean: Messagebean, + newList: ArrayList, + ) { + var videoMessageBean = VideoMessageBean() + var msgContentJsonMap = mGson.fromJson(Msg[0].toJson(), CaseInsensitiveHashMap::class.java) + var MsgContent = mGson.fromJson( + msgContentJsonMap["MsgContent"].toJson(), + CaseInsensitiveHashMap::class.java + ) + videoMessageBean.thumbUrl = MsgContent["ThumbUrl"].toString() + videoMessageBean.thumbWidth = MsgContent["thumbWidth"].toString().toDouble().toInt() + videoMessageBean.thumbHeight = MsgContent["thumbHeight"].toString().toDouble().toInt() + videoMessageBean.videoUrl = MsgContent["videoUrl"].toString() + messageBean.videoMessage = videoMessageBean + newList.add(messageBean) + } + + private fun TIMImageElemFactory( + mGson: Gson, + Msg: List<*>, + messageBean: Messagebean, + newList: ArrayList, + ) { + var imageMessageBean = ImageMessageBean() + var msgContentJsonMap = mGson.fromJson(Msg[0].toJson(), CaseInsensitiveHashMap::class.java) + var MsgContent = mGson.fromJson( + msgContentJsonMap["MsgContent"].toJson(), + CaseInsensitiveHashMap::class.java + ) + var ImageInfoArray = MsgContent["ImageInfoArray"] as List<*> + var imageinfo = + mGson.fromJson(ImageInfoArray[0].toJson(), CaseInsensitiveHashMap::class.java) + imageMessageBean.url = imageinfo["URL"].toString() + imageMessageBean.width = imageinfo["Width"].toString().toDouble().toInt() + imageMessageBean.height = imageinfo["Height"].toString().toDouble().toInt() + messageBean.imageMessage = imageMessageBean + newList.add(messageBean) + } + + private fun TIMCustomElemFactory( + mGson: Gson, + Msg: List<*>, + messageBean: Messagebean, + newList: ArrayList, + ) { + var msgContentJsonMap = mGson.fromJson(Msg[0].toJson(), CaseInsensitiveHashMap::class.java) + var MsgContent = mGson.fromJson( + msgContentJsonMap["MsgContent"].toJson(), + CaseInsensitiveHashMap::class.java + ) + var Data = mGson.fromJson(MsgContent["Data"].toString(), CaseInsensitiveHashMap::class.java) + if ("archives".equals(Data["businessID"])) { + var archivesMessageBean = ArchivesMessageBean() + archivesMessageBean.archivesId = Data["archivesId"].toString() + archivesMessageBean.age = Data["age"].toString() + archivesMessageBean.gender = Data["gender"].toString() + archivesMessageBean.memberId = Data["memberId"].toString() + archivesMessageBean.name = Data["name"].toString() + archivesMessageBean.symptomDescription = Data["symptomDescription"].toString() + + var newImageList = arrayListOf() + var imageList = Data["imageList"] as List<*> + imageList.forEach { + var image = ImageInfo() + var imageHash = mGson.fromJson(it.toJson(), CaseInsensitiveHashMap::class.java) + image.thumbnailUrl = imageHash["thumbnailUrl"].toString() + image.bigImageUrl = imageHash["bigImageUrl"].toString() + newImageList.add(image) + } + archivesMessageBean.imageList = newImageList + messageBean.contentType = "TIMArchivesElem" + messageBean.archivesMessage = archivesMessageBean + newList.add(messageBean) + } else if ("medical_examination_report".equals(Data["businessID"])) { + var medicalMessageBean = MedicalMessageBean() + medicalMessageBean.year = Data["year"].toString() + medicalMessageBean.hospital = Data["hospital"].toString() + medicalMessageBean.cardNum = Data["cardNum"].toString() + medicalMessageBean.recordId = Data["recordId"].toString() + messageBean.contentType = "TIMMedicalElem" + messageBean.medicalMessage = medicalMessageBean + newList.add(messageBean) + } else if ("business_card".equals(Data["businessID"])) { + //医生名片 + var doctorCardMessage = DoctorCardMessageBean() + doctorCardMessage.doctorheadimg = Data["doctorheadimg"].toString() + doctorCardMessage.doctortitle = Data["doctortitle"].toString() + doctorCardMessage.cardid = Data["cardid"].toString() + doctorCardMessage.organization = Data["organization"].toString() + doctorCardMessage.doctorname = Data["doctorname"].toString() + messageBean.contentType = "TIMDoctorCardElem" + messageBean.doctorCardMessage = doctorCardMessage + newList.add(messageBean) + + } else if ("system".equals(Data["businessID"])) { + //系统消息 + var systemMessage = SystemMessageBean() + systemMessage.title = Data["title"].toString() + systemMessage.content = Data["content"].toString() + systemMessage.type = Data["content"].toString() + messageBean.systemMessage = systemMessage + messageBean.contentType = "TIMSystemElem" + newList.add(messageBean) + } + } + + private fun TIMTextElemFactory( + mGson: Gson, + Msg: List<*>, + messageBean: Messagebean, + newList: ArrayList, + ) { + var msgContentJsonMap = mGson.fromJson( + Msg[0].toString(), + CaseInsensitiveHashMap::class.java + ) + var MsgContent = mGson.fromJson( + msgContentJsonMap["MsgContent"].toString(), + CaseInsensitiveHashMap::class.java + ) + messageBean.textMessage = MsgContent["Text"].toString() + newList.add(messageBean) + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/Messagebean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/Messagebean.java new file mode 100644 index 0000000..7799824 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/Messagebean.java @@ -0,0 +1,180 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +import com.chad.library.adapter.base.entity.MultiItemEntity; + +public class Messagebean implements MultiItemEntity { + private String contentType;//消息类型 + private String createTime;//消息创建时间 + private String fromAccount;//消息发送者id + private String fromAccountHead;//消息发送者头像 + private String fromAccountName;//消息发送者名称 + private String toAccount; + private String textMessage;//文本消息 + private ArchivesMessageBean archivesMessage;//档案消息 + private MedicalMessageBean medicalMessage;//体检报告消息 + private ImageMessageBean imageMessage;//图片消息 + private VideoMessageBean videoMessage;//视频消息 + private LocationMessageBean locationMessage;//定位消息 + private FileMessageBean fileMessage;//文件消息 + private DoctorCardMessageBean doctorCardMessage;//医生名片消息 + private SystemMessageBean systemMessage;//系统消息 + private SoundMessageBean soundMessage;//语音消息 + + public SoundMessageBean getSoundMessage() { + return soundMessage; + } + + public void setSoundMessage(SoundMessageBean soundMessage) { + this.soundMessage = soundMessage; + } + + public SystemMessageBean getSystemMessage() { + return systemMessage; + } + + public void setSystemMessage(SystemMessageBean systemMessage) { + this.systemMessage = systemMessage; + } + + public DoctorCardMessageBean getDoctorCardMessage() { + return doctorCardMessage; + } + + public void setDoctorCardMessage(DoctorCardMessageBean doctorCardMessage) { + this.doctorCardMessage = doctorCardMessage; + } + + public FileMessageBean getFileMessage() { + return fileMessage; + } + + public void setFileMessage(FileMessageBean fileMessage) { + this.fileMessage = fileMessage; + } + + public LocationMessageBean getLocationMessage() { + return locationMessage; + } + + public void setLocationMessage(LocationMessageBean locationMessage) { + this.locationMessage = locationMessage; + } + + public VideoMessageBean getVideoMessage() { + return videoMessage; + } + + public void setVideoMessage(VideoMessageBean videoMessage) { + this.videoMessage = videoMessage; + } + + public ImageMessageBean getImageMessage() { + return imageMessage; + } + + public void setImageMessage(ImageMessageBean imageMessage) { + this.imageMessage = imageMessage; + } + + public MedicalMessageBean getMedicalMessage() { + return medicalMessage; + } + + public void setMedicalMessage(MedicalMessageBean medicalMessage) { + this.medicalMessage = medicalMessage; + } + + public ArchivesMessageBean getArchivesMessage() { + return archivesMessage; + } + + public void setArchivesMessage(ArchivesMessageBean archivesMessage) { + this.archivesMessage = archivesMessage; + } + + public String getContentType() { + return contentType == null ? "" : contentType; + } + + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getCreateTime() { + return createTime == null ? "" : createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getFromAccount() { + return fromAccount == null ? "" : fromAccount; + } + + public void setFromAccount(String fromAccount) { + this.fromAccount = fromAccount; + } + + public String getFromAccountHead() { + return fromAccountHead == null ? "" : fromAccountHead; + } + + public void setFromAccountHead(String fromAccountHead) { + this.fromAccountHead = fromAccountHead; + } + + public String getFromAccountName() { + return fromAccountName == null ? "管理员" : fromAccountName; + } + + public void setFromAccountName(String fromAccountName) { + this.fromAccountName = fromAccountName; + } + + public String getToAccount() { + return toAccount == null ? "" : toAccount; + } + + public void setToAccount(String toAccount) { + this.toAccount = toAccount; + } + + public String getTextMessage() { + return textMessage == null ? "" : textMessage; + } + + public void setTextMessage(String textMessage) { + this.textMessage = textMessage; + } + + @Override + public int getItemType() { + return getContentTypeView(); + } + public int getContentTypeView() { + if (contentType.equals("TIMTextElem")){ + return 1; + }else if (contentType.equals("TIMArchivesElem")){ + return 2; + }else if (contentType.equals("TIMMedicalElem")){ + return 3; + }else if (contentType.equals("TIMImageElem")){ + return 4; + }else if (contentType.equals("TIMVideoFileElem")){ + return 5; + }else if (contentType.equals("TIMLocationElem")){ + return 6; + }else if (contentType.equals("TIMFileElem")){ + return 7; + }else if (contentType.equals("TIMDoctorCardElem")){ + return 8; + }else if (contentType.equals("TIMSystemElem")){ + return 9; + }else if (contentType.equals("TIMSoundElem")){ + return 10; + } + return 1; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/SoundMessageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/SoundMessageBean.java new file mode 100644 index 0000000..dcf0820 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/SoundMessageBean.java @@ -0,0 +1,34 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +/** + * 声音 + */ +public class SoundMessageBean { + private String Second; + private String Size; + private String Url; + + public String getSecond() { + return Second == null ? "" : Second; + } + + public void setSecond(String second) { + Second = second; + } + + public String getSize() { + return Size == null ? "" : Size; + } + + public void setSize(String size) { + Size = size; + } + + public String getUrl() { + return Url == null ? "" : Url; + } + + public void setUrl(String url) { + Url = url; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/SystemMessageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/SystemMessageBean.java new file mode 100644 index 0000000..c838567 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/SystemMessageBean.java @@ -0,0 +1,31 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +public class SystemMessageBean { + private String title; + private String type; + private String content; + + public String getTitle() { + return title == null ? "" : title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getType() { + return type == null ? "" : type; + } + + public void setType(String type) { + this.type = type; + } + + public String getContent() { + return content == null ? "" : content; + } + + public void setContent(String content) { + this.content = content; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/VideoMessageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/VideoMessageBean.java new file mode 100644 index 0000000..c2337ee --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/imHistory/VideoMessageBean.java @@ -0,0 +1,40 @@ +package com.xjjk.healthyclients.bean.guidance.imHistory; + +public class VideoMessageBean { + private String ThumbUrl; + private String VideoUrl; + private int ThumbHeight; + private int ThumbWidth; + + public String getThumbUrl() { + return ThumbUrl == null ? "" : ThumbUrl; + } + + public void setThumbUrl(String thumbUrl) { + ThumbUrl = thumbUrl; + } + + public String getVideoUrl() { + return VideoUrl == null ? "" : VideoUrl; + } + + public void setVideoUrl(String videoUrl) { + VideoUrl = videoUrl; + } + + public int getThumbHeight() { + return ThumbHeight; + } + + public void setThumbHeight(int thumbHeight) { + ThumbHeight = thumbHeight; + } + + public int getThumbWidth() { + return ThumbWidth; + } + + public void setThumbWidth(int thumbWidth) { + ThumbWidth = thumbWidth; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/searchComprehensiveBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/searchComprehensiveBean.java new file mode 100644 index 0000000..bdc4a2a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/searchComprehensiveBean.java @@ -0,0 +1,808 @@ +package com.xjjk.healthyclients.bean.guidance; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class searchComprehensiveBean { + + @SerializedName("SicksList") + private List sicksList; + @SerializedName("DepartmentList") + private List departmentList; + @SerializedName("DoctorList") + private List doctorList; + private List hospitalList; + + public List getSicksList() { + return sicksList; + } + + public void setSicksList(List sicksList) { + this.sicksList = sicksList; + } + + public List getDepartmentList() { + return departmentList; + } + + public void setDepartmentList(List departmentList) { + this.departmentList = departmentList; + } + + public List getDoctorList() { + return doctorList; + } + + public void setDoctorList(List doctorList) { + this.doctorList = doctorList; + } + + public List getHospitalList() { + return hospitalList; + } + + public void setHospitalList(List hospitalList) { + this.hospitalList = hospitalList; + } + + public static class SicksListDTO { + private String id; + private String departmentId; + private String sicksName; + private Object descript; + private int doctorNum; + private int status; + private int delFlag; + private Object createBy; + private Object createTime; + private Object updateBy; + private Object updateTime; + private Object memo; + private Object sicksCode; + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentId() { + return departmentId; + } + + public void setDepartmentId(String departmentId) { + this.departmentId = departmentId; + } + + public String getSicksName() { + return sicksName; + } + + public void setSicksName(String sicksName) { + this.sicksName = sicksName; + } + + public Object getDescript() { + return descript; + } + + public void setDescript(Object descript) { + this.descript = descript; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public Object getCreateTime() { + return createTime; + } + + public void setCreateTime(Object createTime) { + this.createTime = createTime; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getMemo() { + return memo; + } + + public void setMemo(Object memo) { + this.memo = memo; + } + + public Object getSicksCode() { + return sicksCode; + } + + public void setSicksCode(Object sicksCode) { + this.sicksCode = sicksCode; + } + } + + public static class DepartmentListDTO { + private String id; + private String departmentName; + private String othername; + private int doctorNum; + private String mark; + private String sicks; + private String createName; + private Object createBy; + private Object createTime; + private Object updateName; + private Object updateBy; + private Object updateTime; + private Object delDate; + private int delFlag; + private String officeLevel; + private String officeCode; + private String officeparid; + private String resourceId; + private String resourceName; + private String image; + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public String getOthername() { + return othername; + } + + public void setOthername(String othername) { + this.othername = othername; + } + + public String getMark() { + return mark; + } + + public void setMark(String mark) { + this.mark = mark; + } + + public String getSicks() { + return sicks; + } + + public void setSicks(String sicks) { + this.sicks = sicks; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public Object getCreateTime() { + return createTime; + } + + public void setCreateTime(Object createTime) { + this.createTime = createTime; + } + + public Object getUpdateName() { + return updateName; + } + + public void setUpdateName(Object updateName) { + this.updateName = updateName; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getDelDate() { + return delDate; + } + + public void setDelDate(Object delDate) { + this.delDate = delDate; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public String getOfficeLevel() { + return officeLevel; + } + + public void setOfficeLevel(String officeLevel) { + this.officeLevel = officeLevel; + } + + public String getOfficeCode() { + return officeCode; + } + + public void setOfficeCode(String officeCode) { + this.officeCode = officeCode; + } + + public String getOfficeparid() { + return officeparid; + } + + public void setOfficeparid(String officeparid) { + this.officeparid = officeparid; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + } + + public static class DoctorListDTO { + + private String id; + private String doctorName; + private String photo; + private String doctorTitle; + private String resourceId; + private String resourceName; + private String departmentId; + private String departmentName; + private Object tfFollow; + private Object doctorLabel; + private String overallMerit; + private String responseRate; + private String degreeHeat; + private Object introduction; + private String goodAt; + private Object doctorScore; + private String hospitalLevel; + private String type; + private String tfShowFire; + private String messageNum; + private String doctorStatus; + private String audioStatus; + + public String getAudioStatus() { + return audioStatus == null ? "" : audioStatus; + } + + public void setAudioStatus(String audioStatus) { + this.audioStatus = audioStatus; + } + + public String getDoctorStatus() { + return doctorStatus == null ? "" : doctorStatus; + } + + public void setDoctorStatus(String doctorStatus) { + this.doctorStatus = doctorStatus; + } + + public String getTfShowFire() { + return tfShowFire == null ? "" : tfShowFire; + } + + public void setTfShowFire(String tfShowFire) { + this.tfShowFire = tfShowFire; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDoctorName() { + return doctorName == null ? "" : doctorName; + } + + public void setDoctorName(String doctorName) { + this.doctorName = doctorName; + } + + public String getPhoto() { + return photo == null ? "" : photo; + } + + public void setPhoto(String photo) { + this.photo = photo; + } + + public String getDoctorTitle() { + return doctorTitle == null ? "" : doctorTitle; + } + + public void setDoctorTitle(String doctorTitle) { + this.doctorTitle = doctorTitle; + } + + public String getResourceId() { + return resourceId == null ? "" : resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getResourceName() { + return resourceName == null ? "" : resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getDepartmentId() { + return departmentId == null ? "" : departmentId; + } + + public void setDepartmentId(String departmentId) { + this.departmentId = departmentId; + } + + public String getDepartmentName() { + return departmentName == null ? "" : departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public Object getTfFollow() { + return tfFollow; + } + + public void setTfFollow(Object tfFollow) { + this.tfFollow = tfFollow; + } + + public Object getDoctorLabel() { + return doctorLabel; + } + + public void setDoctorLabel(Object doctorLabel) { + this.doctorLabel = doctorLabel; + } + + public String getOverallMerit() { + return overallMerit == null ? "" : overallMerit; + } + + public void setOverallMerit(String overallMerit) { + this.overallMerit = overallMerit; + } + + public String getResponseRate() { + return responseRate == null ? "" : responseRate; + } + + public void setResponseRate(String responseRate) { + this.responseRate = responseRate; + } + + public String getDegreeHeat() { + return degreeHeat == null ? "" : degreeHeat; + } + + public void setDegreeHeat(String degreeHeat) { + this.degreeHeat = degreeHeat; + } + + public Object getIntroduction() { + return introduction; + } + + public void setIntroduction(Object introduction) { + this.introduction = introduction; + } + + public String getGoodAt() { + return goodAt == null ? "" : goodAt; + } + + public void setGoodAt(String goodAt) { + this.goodAt = goodAt; + } + + public Object getDoctorScore() { + return doctorScore; + } + + public void setDoctorScore(Object doctorScore) { + this.doctorScore = doctorScore; + } + + public String getHospitalLevel() { + return hospitalLevel == null ? "" : hospitalLevel; + } + + public void setHospitalLevel(String hospitalLevel) { + this.hospitalLevel = hospitalLevel; + } + + public String getType() { + return type == null ? "" : type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessageNum() { + return messageNum == null ? "" : messageNum; + } + + public void setMessageNum(String messageNum) { + this.messageNum = messageNum; + } + } + + public static class HospitalListDTO { + private String id; + private String resourceName; + private int doctorNum; + private double longitude; + private double latitude; + private String type; + private Object secondType; + private Object aidrange; + private String gdId; + private String url; + private String province; + private String city; + private Object area; + private String address; + private String level; + private String img; + private String synopsis; + private int sort; + private int status; + private int delFlag; + private Object createBy; + private Object createTime; + private Object updateBy; + private Object updateTime; + private Object memo; + private String keyDepartments; + private String userScore; + private String userScoreNum; + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Object getSecondType() { + return secondType; + } + + public void setSecondType(Object secondType) { + this.secondType = secondType; + } + + public Object getAidrange() { + return aidrange; + } + + public void setAidrange(Object aidrange) { + this.aidrange = aidrange; + } + + public String getGdId() { + return gdId; + } + + public void setGdId(String gdId) { + this.gdId = gdId; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Object getArea() { + return area; + } + + public void setArea(Object area) { + this.area = area; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getImg() { + return img; + } + + public void setImg(String img) { + this.img = img; + } + + public String getSynopsis() { + return synopsis; + } + + public void setSynopsis(String synopsis) { + this.synopsis = synopsis; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public Object getCreateTime() { + return createTime; + } + + public void setCreateTime(Object createTime) { + this.createTime = createTime; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getMemo() { + return memo; + } + + public void setMemo(Object memo) { + this.memo = memo; + } + + public String getKeyDepartments() { + return keyDepartments; + } + + public void setKeyDepartments(String keyDepartments) { + this.keyDepartments = keyDepartments; + } + + public String getUserScore() { + return userScore; + } + + public void setUserScore(String userScore) { + this.userScore = userScore; + } + + public String getUserScoreNum() { + return userScoreNum; + } + + public void setUserScoreNum(String userScoreNum) { + this.userScoreNum = userScoreNum; + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/searchConDepartmentAllBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/searchConDepartmentAllBean.java new file mode 100644 index 0000000..a61d44e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/searchConDepartmentAllBean.java @@ -0,0 +1,176 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class searchConDepartmentAllBean { + + private String id; + private String departmentName; + private String othername; + private String mark; + private String sicks; + private String createName; + private String createBy; + private String createTime; + private String updateName; + private String updateBy; + private String updateTime; + private String delDate; + private int delFlag; + private String officeLevel; + private String officeCode; + private String officeparid; + private String resourceId; + private String resourceName; + private String image; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public String getOthername() { + return othername; + } + + public void setOthername(String othername) { + this.othername = othername; + } + + public String getMark() { + return mark; + } + + public void setMark(String mark) { + this.mark = mark; + } + + public String getSicks() { + return sicks; + } + + public void setSicks(String sicks) { + this.sicks = sicks; + } + + public String getCreateName() { + return createName; + } + + public void setCreateName(String createName) { + this.createName = createName; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getUpdateName() { + return updateName; + } + + public void setUpdateName(String updateName) { + this.updateName = updateName; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getDelDate() { + return delDate; + } + + public void setDelDate(String delDate) { + this.delDate = delDate; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public String getOfficeLevel() { + return officeLevel; + } + + public void setOfficeLevel(String officeLevel) { + this.officeLevel = officeLevel; + } + + public String getOfficeCode() { + return officeCode; + } + + public void setOfficeCode(String officeCode) { + this.officeCode = officeCode; + } + + public String getOfficeparid() { + return officeparid; + } + + public void setOfficeparid(String officeparid) { + this.officeparid = officeparid; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/searchConResourceAllBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/searchConResourceAllBean.java new file mode 100644 index 0000000..777d161 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/searchConResourceAllBean.java @@ -0,0 +1,248 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class searchConResourceAllBean { + + private String id; + private String resourceName; + private double longitude; + private double latitude; + private String type; + private Object secondType; + private Object aidrange; + private String gdId; + private String url; + private String province; + private String city; + private Object area; + private String address; + private String level; + private String img; + private String synopsis; + private int sort; + private int status; + private int delFlag; + private Object createBy; + private Object createTime; + private Object updateBy; + private Object updateTime; + private Object memo; + private String keyDepartments; + private String userScore; + private String userScoreNum; + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getResourceName() { + return resourceName == null ? "" : resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public String getType() { + return type == null ? "" : type; + } + + public void setType(String type) { + this.type = type; + } + + public Object getSecondType() { + return secondType; + } + + public void setSecondType(Object secondType) { + this.secondType = secondType; + } + + public Object getAidrange() { + return aidrange; + } + + public void setAidrange(Object aidrange) { + this.aidrange = aidrange; + } + + public String getGdId() { + return gdId == null ? "" : gdId; + } + + public void setGdId(String gdId) { + this.gdId = gdId; + } + + public String getUrl() { + return url == null ? "" : url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getProvince() { + return province == null ? "" : province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city == null ? "" : city; + } + + public void setCity(String city) { + this.city = city; + } + + public Object getArea() { + return area; + } + + public void setArea(Object area) { + this.area = area; + } + + public String getAddress() { + return address == null ? "" : address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getLevel() { + return level == null ? "" : level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getImg() { + return img == null ? "" : img; + } + + public void setImg(String img) { + this.img = img; + } + + public String getSynopsis() { + return synopsis == null ? "" : synopsis; + } + + public void setSynopsis(String synopsis) { + this.synopsis = synopsis; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getDelFlag() { + return delFlag; + } + + public void setDelFlag(int delFlag) { + this.delFlag = delFlag; + } + + public Object getCreateBy() { + return createBy; + } + + public void setCreateBy(Object createBy) { + this.createBy = createBy; + } + + public Object getCreateTime() { + return createTime; + } + + public void setCreateTime(Object createTime) { + this.createTime = createTime; + } + + public Object getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(Object updateBy) { + this.updateBy = updateBy; + } + + public Object getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public Object getMemo() { + return memo; + } + + public void setMemo(Object memo) { + this.memo = memo; + } + + public String getKeyDepartments() { + return keyDepartments == null ? "" : keyDepartments; + } + + public void setKeyDepartments(String keyDepartments) { + this.keyDepartments = keyDepartments; + } + + public String getUserScore() { + return userScore == null ? "" : userScore; + } + + public void setUserScore(String userScore) { + this.userScore = userScore; + } + + public String getUserScoreNum() { + return userScoreNum == null ? "" : userScoreNum; + } + + public void setUserScoreNum(String userScoreNum) { + this.userScoreNum = userScoreNum; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectDictListByNHDSBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectDictListByNHDSBean.java new file mode 100644 index 0000000..7ae5aa2 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectDictListByNHDSBean.java @@ -0,0 +1,203 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class selectDictListByNHDSBean { + + private String id; + private String doctorName; + private String photo; + private String doctorTitle; + private String resourceId; + private String resourceName; + private Object departmentId; + private String departmentName; + private Object tfFollow; + private Object doctorLabel; + private Object overallMerit; + private String responseRate; + private Object degreeHeat; + private Object introduction; + private String goodAt; + private Object messageNum; + private Object doctorScore; + private String hospitalLevel; + private String type; + private String tfShowFire; + private String doctorStatus; + private String audioStatus; + + public String getDoctorStatus() { + return doctorStatus == null ? "" : doctorStatus; + } + + public void setDoctorStatus(String doctorStatus) { + this.doctorStatus = doctorStatus; + } + + public String getAudioStatus() { + return audioStatus == null ? "" : audioStatus; + } + + public void setAudioStatus(String audioStatus) { + this.audioStatus = audioStatus; + } + + public String getTfShowFire() { + return tfShowFire == null ? "" : tfShowFire; + } + + public void setTfShowFire(String tfShowFire) { + this.tfShowFire = tfShowFire; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDoctorName() { + return doctorName; + } + + public void setDoctorName(String doctorName) { + this.doctorName = doctorName; + } + + public String getPhoto() { + return photo; + } + + public void setPhoto(String photo) { + this.photo = photo; + } + + public String getDoctorTitle() { + return doctorTitle; + } + + public void setDoctorTitle(String doctorTitle) { + this.doctorTitle = doctorTitle; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public Object getDepartmentId() { + return departmentId; + } + + public void setDepartmentId(Object departmentId) { + this.departmentId = departmentId; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public Object getTfFollow() { + return tfFollow; + } + + public void setTfFollow(Object tfFollow) { + this.tfFollow = tfFollow; + } + + public Object getDoctorLabel() { + return doctorLabel; + } + + public void setDoctorLabel(Object doctorLabel) { + this.doctorLabel = doctorLabel; + } + + public Object getOverallMerit() { + return overallMerit; + } + + public void setOverallMerit(Object overallMerit) { + this.overallMerit = overallMerit; + } + + public String getResponseRate() { + return responseRate; + } + + public void setResponseRate(String responseRate) { + this.responseRate = responseRate; + } + + public Object getDegreeHeat() { + return degreeHeat; + } + + public void setDegreeHeat(Object degreeHeat) { + this.degreeHeat = degreeHeat; + } + + public Object getIntroduction() { + return introduction; + } + + public void setIntroduction(Object introduction) { + this.introduction = introduction; + } + + public String getGoodAt() { + return goodAt==null?"":goodAt; + } + + public void setGoodAt(String goodAt) { + this.goodAt = goodAt; + } + + public Object getMessageNum() { + return messageNum; + } + + public void setMessageNum(Object messageNum) { + this.messageNum = messageNum; + } + + public Object getDoctorScore() { + return doctorScore; + } + + public void setDoctorScore(Object doctorScore) { + this.doctorScore = doctorScore; + } + + public String getHospitalLevel() { + return hospitalLevel==null?"":hospitalLevel; + } + + public void setHospitalLevel(String hospitalLevel) { + this.hospitalLevel = hospitalLevel; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectDictListByNHDSRequestBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectDictListByNHDSRequestBean.java new file mode 100644 index 0000000..61f62dc --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectDictListByNHDSRequestBean.java @@ -0,0 +1,76 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class selectDictListByNHDSRequestBean { + private String doctorName; + private String hospitalId; + private boolean isSelectHospital=false; + private String departmentId; + private String sickId; + private String tfSort="1"; + private String pageNo="1"; + private String pageSize="100"; + + public boolean isSelectHospital() { + return isSelectHospital; + } + + public void setSelectHospital(boolean selectHospital) { + isSelectHospital = selectHospital; + } + + public String getDoctorName() { + return doctorName == null ? "" : doctorName; + } + + public void setDoctorName(String doctorName) { + this.doctorName = doctorName; + } + + public String getHospitalId() { + return hospitalId == null ? "" : hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getDepartmentId() { + return departmentId == null ? "" : departmentId; + } + + public void setDepartmentId(String departmentId) { + this.departmentId = departmentId; + } + + public String getSickId() { + return sickId == null ? "" : sickId; + } + + public void setSickId(String sickId) { + this.sickId = sickId; + } + + public String getTfSort() { + return tfSort == null ? "" : tfSort; + } + + public void setTfSort(String tfSort) { + this.tfSort = tfSort; + } + + public String getPageNo() { + return pageNo == null ? "" : pageNo; + } + + public void setPageNo(String pageNo) { + this.pageNo = pageNo; + } + + public String getPageSize() { + return pageSize == null ? "" : pageSize; + } + + public void setPageSize(String pageSize) { + this.pageSize = pageSize; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectDoctorByHospitalIdBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectDoctorByHospitalIdBean.java new file mode 100644 index 0000000..03a84db --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectDoctorByHospitalIdBean.java @@ -0,0 +1,185 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class selectDoctorByHospitalIdBean { + + private String id; + private String doctorName; + private String photo; + private String doctorTitle; + private String resourceId; + private Object resourceName; + private String departmentId; + private String departmentName; + private Object tfFollow; + private Object doctorLabel; + private Object overallMerit; + private Object responseRate; + private Object degreeHeat; + private Object introduction; + private String goodAt; + private Object messageNum; + private Object tfShowFire; + private Object doctorScore; + private Object hospitalLevel; + private String type; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDoctorName() { + return doctorName; + } + + public void setDoctorName(String doctorName) { + this.doctorName = doctorName; + } + + public String getPhoto() { + return photo; + } + + public void setPhoto(String photo) { + this.photo = photo; + } + + public String getDoctorTitle() { + return doctorTitle; + } + + public void setDoctorTitle(String doctorTitle) { + this.doctorTitle = doctorTitle; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public Object getResourceName() { + return resourceName; + } + + public void setResourceName(Object resourceName) { + this.resourceName = resourceName; + } + + public String getDepartmentId() { + return departmentId; + } + + public void setDepartmentId(String departmentId) { + this.departmentId = departmentId; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public Object getTfFollow() { + return tfFollow; + } + + public void setTfFollow(Object tfFollow) { + this.tfFollow = tfFollow; + } + + public Object getDoctorLabel() { + return doctorLabel; + } + + public void setDoctorLabel(Object doctorLabel) { + this.doctorLabel = doctorLabel; + } + + public Object getOverallMerit() { + return overallMerit; + } + + public void setOverallMerit(Object overallMerit) { + this.overallMerit = overallMerit; + } + + public Object getResponseRate() { + return responseRate; + } + + public void setResponseRate(Object responseRate) { + this.responseRate = responseRate; + } + + public Object getDegreeHeat() { + return degreeHeat; + } + + public void setDegreeHeat(Object degreeHeat) { + this.degreeHeat = degreeHeat; + } + + public Object getIntroduction() { + return introduction; + } + + public void setIntroduction(Object introduction) { + this.introduction = introduction; + } + + public String getGoodAt() { + return goodAt; + } + + public void setGoodAt(String goodAt) { + this.goodAt = goodAt; + } + + public Object getMessageNum() { + return messageNum; + } + + public void setMessageNum(Object messageNum) { + this.messageNum = messageNum; + } + + public Object getTfShowFire() { + return tfShowFire; + } + + public void setTfShowFire(Object tfShowFire) { + this.tfShowFire = tfShowFire; + } + + public Object getDoctorScore() { + return doctorScore; + } + + public void setDoctorScore(Object doctorScore) { + this.doctorScore = doctorScore; + } + + public Object getHospitalLevel() { + return hospitalLevel; + } + + public void setHospitalLevel(Object hospitalLevel) { + this.hospitalLevel = hospitalLevel; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectHospitalListBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectHospitalListBean.java new file mode 100644 index 0000000..bec91b2 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectHospitalListBean.java @@ -0,0 +1,187 @@ +package com.xjjk.healthyclients.bean.guidance; + +import java.util.List; + +public class selectHospitalListBean { + + private List sickList; + private List hostitalList; + private List departList; + + public List getSickList() { + return sickList; + } + + public void setSickList(List sickList) { + this.sickList = sickList; + } + + public List getHostitalList() { + return hostitalList; + } + + public void setHostitalList(List hostitalList) { + this.hostitalList = hostitalList; + } + + public List getDepartList() { + return departList; + } + + public void setDepartList(List departList) { + this.departList = departList; + } + + public static class SickListDTO { + private String id; + private String departmentId; + private String sicksName; + private Object descript; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentId() { + return departmentId; + } + + public void setDepartmentId(String departmentId) { + this.departmentId = departmentId; + } + + public String getSicksName() { + return sicksName; + } + + public void setSicksName(String sicksName) { + this.sicksName = sicksName; + } + + public Object getDescript() { + return descript; + } + + public void setDescript(Object descript) { + this.descript = descript; + } + } + + public static class HostitalListDTO { + private String id; + private String resourceName; + private Object longitude; + private Object latitude; + private Object address; + private Object level; + private Object img; + private Object synopsis; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public Object getLongitude() { + return longitude; + } + + public void setLongitude(Object longitude) { + this.longitude = longitude; + } + + public Object getLatitude() { + return latitude; + } + + public void setLatitude(Object latitude) { + this.latitude = latitude; + } + + public Object getAddress() { + return address; + } + + public void setAddress(Object address) { + this.address = address; + } + + public Object getLevel() { + return level; + } + + public void setLevel(Object level) { + this.level = level; + } + + public Object getImg() { + return img; + } + + public void setImg(Object img) { + this.img = img; + } + + public Object getSynopsis() { + return synopsis; + } + + public void setSynopsis(Object synopsis) { + this.synopsis = synopsis; + } + } + + public static class DepartListDTO { + private String id; + private String departmentName; + private int doctorNum; + private int mark; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public int getDoctorNum() { + return doctorNum; + } + + public void setDoctorNum(int doctorNum) { + this.doctorNum = doctorNum; + } + + public int getMark() { + return mark; + } + + public void setMark(int mark) { + this.mark = mark; + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectHostitalAverageScoreBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectHostitalAverageScoreBean.java new file mode 100644 index 0000000..d798e75 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectHostitalAverageScoreBean.java @@ -0,0 +1,23 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class selectHostitalAverageScoreBean { + + private String score; + private String userScoreNum; + + public String getScore() { + return score; + } + + public void setScore(String score) { + this.score = score; + } + + public String getUserScoreNum() { + return userScoreNum; + } + + public void setUserScoreNum(String userScoreNum) { + this.userScoreNum = userScoreNum; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectKnowledgeCategoryBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectKnowledgeCategoryBean.java new file mode 100644 index 0000000..6da25de --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectKnowledgeCategoryBean.java @@ -0,0 +1,32 @@ +package com.xjjk.healthyclients.bean.guidance; + +public class selectKnowledgeCategoryBean { + + private String id; + private String name; + private boolean isSelect=false; + + public boolean isSelect() { + return isSelect; + } + + public void setSelect(boolean select) { + isSelect = select; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectSessionListByUserIdBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectSessionListByUserIdBean.java new file mode 100644 index 0000000..be83bbb --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/guidance/selectSessionListByUserIdBean.java @@ -0,0 +1,294 @@ +package com.xjjk.healthyclients.bean.guidance; + + +public class selectSessionListByUserIdBean implements Comparable { + + private String id; + private String memberId; + private String toAccount; + private String toAccountHead; + private String toAccountName; + private String toAccountTitle; + private String departmentName; + private String resourceName; + private String hospitalLevel; + private String memberName; + private String memberSex; + private String memberAge; + private String imId; + private String rejectReason; + private String doctorStartTime; + private String doctorEndTime; + private String contentStatus; + private String contentType; + private String medicalRecordsId; + private String schedulingDateId; + private String createTime; + private String sessionDate; + private String week; + private String amPm; + private String reasonType; + private long createTimeLong; + private String sessionDateLong; + private String doctorStartTimeLong; + private String doctorEndTimeLong; + private String tfOwn; + private int unreadCount; + + public int getUnreadCount() { + return unreadCount; + } + + public void setUnreadCount(int unreadCount) { + this.unreadCount = unreadCount; + } + + public String getTfOwn() { + return tfOwn == null ? "" : tfOwn; + } + + public void setTfOwn(String tfOwn) { + this.tfOwn = tfOwn; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMemberId() { + return memberId == null ? "" : memberId; + } + + public void setMemberId(String memberId) { + this.memberId = memberId; + } + + public String getToAccount() { + return toAccount == null ? "" : toAccount; + } + + public void setToAccount(String toAccount) { + this.toAccount = toAccount; + } + + public String getToAccountHead() { + return toAccountHead == null ? "" : toAccountHead; + } + + public void setToAccountHead(String toAccountHead) { + this.toAccountHead = toAccountHead; + } + + public String getToAccountName() { + return toAccountName == null ? "" : toAccountName; + } + + public void setToAccountName(String toAccountName) { + this.toAccountName = toAccountName; + } + + public String getToAccountTitle() { + return toAccountTitle == null ? "" : toAccountTitle; + } + + public void setToAccountTitle(String toAccountTitle) { + this.toAccountTitle = toAccountTitle; + } + + public String getDepartmentName() { + return departmentName == null ? "" : departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public String getResourceName() { + return resourceName == null ? "" : resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getHospitalLevel() { + return hospitalLevel == null ? "" : hospitalLevel; + } + + public void setHospitalLevel(String hospitalLevel) { + this.hospitalLevel = hospitalLevel; + } + + public String getMemberName() { + return memberName == null ? "" : memberName; + } + + public void setMemberName(String memberName) { + this.memberName = memberName; + } + + public String getMemberSex() { + return memberSex == null ? "" : memberSex; + } + + public void setMemberSex(String memberSex) { + this.memberSex = memberSex; + } + + public String getMemberAge() { + return memberAge == null ? "" : memberAge; + } + + public void setMemberAge(String memberAge) { + this.memberAge = memberAge; + } + + public String getImId() { + return imId == null ? "" : imId; + } + + public void setImId(String imId) { + this.imId = imId; + } + + public String getRejectReason() { + return rejectReason == null ? "" : rejectReason; + } + + public void setRejectReason(String rejectReason) { + this.rejectReason = rejectReason; + } + + public String getDoctorStartTime() { + return doctorStartTime == null ? "" : doctorStartTime; + } + + public void setDoctorStartTime(String doctorStartTime) { + this.doctorStartTime = doctorStartTime; + } + + public String getDoctorEndTime() { + return doctorEndTime == null ? "" : doctorEndTime; + } + + public void setDoctorEndTime(String doctorEndTime) { + this.doctorEndTime = doctorEndTime; + } + + public String getContentStatus() { + return contentStatus == null ? "" : contentStatus; + } + + public void setContentStatus(String contentStatus) { + this.contentStatus = contentStatus; + } + + public String getContentType() { + return contentType == null ? "" : contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getMedicalRecordsId() { + return medicalRecordsId == null ? "" : medicalRecordsId; + } + + public void setMedicalRecordsId(String medicalRecordsId) { + this.medicalRecordsId = medicalRecordsId; + } + + public String getSchedulingDateId() { + return schedulingDateId == null ? "" : schedulingDateId; + } + + public void setSchedulingDateId(String schedulingDateId) { + this.schedulingDateId = schedulingDateId; + } + + public String getCreateTime() { + return createTime == null ? "" : createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getSessionDate() { + return sessionDate == null ? "" : sessionDate; + } + + public void setSessionDate(String sessionDate) { + this.sessionDate = sessionDate; + } + + public String getWeek() { + return week == null ? "" : week; + } + + public void setWeek(String week) { + this.week = week; + } + + public String getAmPm() { + return amPm == null ? "" : amPm; + } + + public void setAmPm(String amPm) { + this.amPm = amPm; + } + + public String getReasonType() { + return reasonType == null ? "" : reasonType; + } + + public void setReasonType(String reasonType) { + this.reasonType = reasonType; + } + + public long getCreateTimeLong() { + return createTimeLong; + } + + public void setCreateTimeLong(long createTimeLong) { + this.createTimeLong = createTimeLong; + } + + public String getSessionDateLong() { + return sessionDateLong == null ? "" : sessionDateLong; + } + + public void setSessionDateLong(String sessionDateLong) { + this.sessionDateLong = sessionDateLong; + } + + public String getDoctorStartTimeLong() { + return doctorStartTimeLong == null ? "" : doctorStartTimeLong; + } + + public void setDoctorStartTimeLong(String doctorStartTimeLong) { + this.doctorStartTimeLong = doctorStartTimeLong; + } + + public String getDoctorEndTimeLong() { + return doctorEndTimeLong == null ? "" : doctorEndTimeLong; + } + + public void setDoctorEndTimeLong(String doctorEndTimeLong) { + this.doctorEndTimeLong = doctorEndTimeLong; + } + + @Override + public int compareTo(selectSessionListByUserIdBean o) { + if (this.getUnreadCount()>o.getUnreadCount()){ + return -1; + }else{ + return 1; + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/CheckRecordUserInfoBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/CheckRecordUserInfoBean.java new file mode 100644 index 0000000..4012892 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/CheckRecordUserInfoBean.java @@ -0,0 +1,175 @@ +package com.xjjk.healthyclients.bean.healthrecord; + +import java.util.ArrayList; +import java.util.List; + +public class CheckRecordUserInfoBean { + + private String id; + private String userId; + private String userName; + private String sex; + private String sex_dictText; + private String age; + private String card; + private String mobilePhone; + private String email; + private String empNativeplace; + private String peQueueDate; + private String empBirthday; + private String conclusion; + private String suggest; + private String medicalYear; + private String hospitalName; + private ArrayList resultItemResList; + + private List imageItemList; + + public String getHospitalName() { + return hospitalName == null ? "" : hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public ArrayList getResultItemResList() { + if (resultItemResList == null) { + return new ArrayList<>(); + } + return resultItemResList; + } + + public void setResultItemResList(ArrayList resultItemResList) { + this.resultItemResList = resultItemResList; + } + + public List getImageItemList() { + return imageItemList; + } + + public void setImageItemList(List imageItemList) { + this.imageItemList = imageItemList; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUserId() { + return userId == null ? "" : userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserName() { + return userName == null ? "" : userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getSex() { + return sex == null ? "" : sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getSex_dictText() { + return sex_dictText == null ? "" : sex_dictText; + } + + public void setSex_dictText(String sex_dictText) { + this.sex_dictText = sex_dictText; + } + + public String getAge() { + return age == null ? "" : age; + } + + public void setAge(String age) { + this.age = age; + } + + public String getCard() { + return card == null ? "" : card; + } + + public void setCard(String card) { + this.card = card; + } + + public String getMobilePhone() { + return mobilePhone == null ? "" : mobilePhone; + } + + public void setMobilePhone(String mobilePhone) { + this.mobilePhone = mobilePhone; + } + + public String getEmail() { + return email == null ? "" : email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getEmpNativeplace() { + return empNativeplace == null ? "" : empNativeplace; + } + + public void setEmpNativeplace(String empNativeplace) { + this.empNativeplace = empNativeplace; + } + + public String getPeQueueDate() { + return peQueueDate == null ? "" : peQueueDate; + } + + public void setPeQueueDate(String peQueueDate) { + this.peQueueDate = peQueueDate; + } + + public String getEmpBirthday() { + return empBirthday == null ? "" : empBirthday; + } + + public void setEmpBirthday(String empBirthday) { + this.empBirthday = empBirthday; + } + + public String getConclusion() { + return conclusion == null ? "" : conclusion; + } + + public void setConclusion(String conclusion) { + this.conclusion = conclusion; + } + + public String getSuggest() { + return suggest == null ? "" : suggest; + } + + public void setSuggest(String suggest) { + this.suggest = suggest; + } + + public String getMedicalYear() { + return medicalYear == null ? "" : medicalYear; + } + + public void setMedicalYear(String medicalYear) { + this.medicalYear = medicalYear; + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/CheckRecordVoiceBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/CheckRecordVoiceBean.java new file mode 100644 index 0000000..5b09568 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/CheckRecordVoiceBean.java @@ -0,0 +1,23 @@ +package com.xjjk.healthyclients.bean.healthrecord; + +public class CheckRecordVoiceBean { + + private String conVoiceUrl;//结论 + private String sugVoiceUrl;//建议 + + public String getConVoiceUrl() { + return conVoiceUrl; + } + + public void setConVoiceUrl(String conVoiceUrl) { + this.conVoiceUrl = conVoiceUrl; + } + + public String getSugVoiceUrl() { + return sugVoiceUrl; + } + + public void setSugVoiceUrl(String sugVoiceUrl) { + this.sugVoiceUrl = sugVoiceUrl; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/GetHistoryReportByPageBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/GetHistoryReportByPageBean.java new file mode 100644 index 0000000..de75790 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/GetHistoryReportByPageBean.java @@ -0,0 +1,199 @@ +package com.xjjk.healthyclients.bean.healthrecord; + +import java.util.List; + +public class GetHistoryReportByPageBean { + + private List records; + private int total; + private int size; + private int current; + private List orders; + private boolean optimizeCountSql; + private boolean searchCount; + private Object countId; + private Object maxLimit; + private int pages; + + public List getRecords() { + return records; + } + + public void setRecords(List records) { + this.records = records; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public int getCurrent() { + return current; + } + + public void setCurrent(int current) { + this.current = current; + } + + public List getOrders() { + return orders; + } + + public void setOrders(List orders) { + this.orders = orders; + } + + public boolean isOptimizeCountSql() { + return optimizeCountSql; + } + + public void setOptimizeCountSql(boolean optimizeCountSql) { + this.optimizeCountSql = optimizeCountSql; + } + + public boolean isSearchCount() { + return searchCount; + } + + public void setSearchCount(boolean searchCount) { + this.searchCount = searchCount; + } + + public Object getCountId() { + return countId; + } + + public void setCountId(Object countId) { + this.countId = countId; + } + + public Object getMaxLimit() { + return maxLimit; + } + + public void setMaxLimit(Object maxLimit) { + this.maxLimit = maxLimit; + } + + public int getPages() { + return pages; + } + + public void setPages(int pages) { + this.pages = pages; + } + + public static class RecordsDTO { + private String id; + private String userId; + private String userName; + private String sex; + private String sex_dictText; + private String age; + private String card; + private String hospitalId; + private String hospitalName; + private String peQueueDate; + private String medicalYear; + + public String getMedicalYear() { + return medicalYear == null ? "" : medicalYear; + } + + public void setMedicalYear(String medicalYear) { + this.medicalYear = medicalYear; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getSex_dictText() { + return sex_dictText; + } + + public void setSex_dictText(String sex_dictText) { + this.sex_dictText = sex_dictText; + } + + public String getAge() { + return age; + } + + public void setAge(String age) { + this.age = age; + } + + public String getCard() { + return card; + } + + public void setCard(String card) { + this.card = card; + } + + public String getHospitalId() { + return hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getHospitalName() { + return hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public String getPeQueueDate() { + return peQueueDate; + } + + public void setPeQueueDate(String peQueueDate) { + this.peQueueDate = peQueueDate; + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/HealthCheckImageItemList.java b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/HealthCheckImageItemList.java new file mode 100644 index 0000000..f75c1ef --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/HealthCheckImageItemList.java @@ -0,0 +1,76 @@ +package com.xjjk.healthyclients.bean.healthrecord; + +public class HealthCheckImageItemList { + private String imageClass; + private String imageClassName; + private String imageCheckName; + private String reportContent; + private String reportUrl; + private String reportDate; + private String studyInsId; + private String imageShowUrl; + + public String getImageClass() { + return imageClass; + } + + public void setImageClass(String imageClass) { + this.imageClass = imageClass; + } + + public String getImageClassName() { + return imageClassName; + } + + public void setImageClassName(String imageClassName) { + this.imageClassName = imageClassName; + } + + public String getImageCheckName() { + return imageCheckName; + } + + public void setImageCheckName(String imageCheckName) { + this.imageCheckName = imageCheckName; + } + + public String getReportContent() { + return reportContent; + } + + public void setReportContent(String reportContent) { + this.reportContent = reportContent; + } + + public String getReportUrl() { + return reportUrl; + } + + public void setReportUrl(String reportUrl) { + this.reportUrl = reportUrl; + } + + public String getReportDate() { + return reportDate; + } + + public void setReportDate(String reportDate) { + this.reportDate = reportDate; + } + + public String getStudyInsId() { + return studyInsId; + } + + public void setStudyInsId(String studyInsId) { + this.studyInsId = studyInsId; + } + + public String getImageShowUrl() { + return imageShowUrl; + } + + public void setImageShowUrl(String imageShowUrl) { + this.imageShowUrl = imageShowUrl; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/ResultItemListBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/ResultItemListBean.java new file mode 100644 index 0000000..4f368ba --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/healthrecord/ResultItemListBean.java @@ -0,0 +1,177 @@ +package com.xjjk.healthyclients.bean.healthrecord; + +import java.util.List; + +public class ResultItemListBean { + + private String analysisId; + private String analysisName; + private List senResultRes; + + public String getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(String analysisId) { + this.analysisId = analysisId; + } + + public String getAnalysisName() { + return analysisName == null ? "" : analysisName; + } + + public void setAnalysisName(String analysisName) { + this.analysisName = analysisName; + } + + public List getSenResultRes() { + return senResultRes; + } + + public void setSenResultRes(List senResultRes) { + this.senResultRes = senResultRes; + } + + + public static class SenResultResDTO { + private String uniItemClassId; + private String uniItemClassName; + private List thirdResultRes; + + public String getUniItemClassId() { + return uniItemClassId; + } + + public void setUniItemClassId(String uniItemClassId) { + this.uniItemClassId = uniItemClassId; + } + + public String getUniItemClassName() { + return uniItemClassName; + } + + public void setUniItemClassName(String uniItemClassName) { + this.uniItemClassName = uniItemClassName; + } + + public List getThirdResultRes() { + return thirdResultRes; + } + + public void setThirdResultRes(List thirdResultRes) { + this.thirdResultRes = thirdResultRes; + } + + public static class ThirdResultResDTO { + private Object userResultId; + private String id; + private String peItemName; + private Object uniItemId; + private String printContext; + private String peResult; + private String unit; + private String colour; + private Object uniItemClassId; + private Object uniItemClassName; + private Object analysisId; + private Object analysisName; + + public String getColour() { + return colour == null ? "" : colour; + } + + public void setColour(String colour) { + this.colour = colour; + } + + public Object getUserResultId() { + return userResultId; + } + + public void setUserResultId(Object userResultId) { + this.userResultId = userResultId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getPeItemName() { + return peItemName; + } + + public void setPeItemName(String peItemName) { + this.peItemName = peItemName; + } + + public Object getUniItemId() { + return uniItemId; + } + + public void setUniItemId(Object uniItemId) { + this.uniItemId = uniItemId; + } + + public String getPrintContext() { + return printContext; + } + + public void setPrintContext(String printContext) { + this.printContext = printContext; + } + + public String getPeResult() { + return peResult; + } + + public void setPeResult(String peResult) { + this.peResult = peResult; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public Object getUniItemClassId() { + return uniItemClassId; + } + + public void setUniItemClassId(Object uniItemClassId) { + this.uniItemClassId = uniItemClassId; + } + + public Object getUniItemClassName() { + return uniItemClassName; + } + + public void setUniItemClassName(Object uniItemClassName) { + this.uniItemClassName = uniItemClassName; + } + + public Object getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(Object analysisId) { + this.analysisId = analysisId; + } + + public Object getAnalysisName() { + return analysisName; + } + + public void setAnalysisName(Object analysisName) { + this.analysisName = analysisName; + } + } + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/im/IMInfoBean.kt b/app/src/main/java/com/xjjk/healthyclients/bean/im/IMInfoBean.kt new file mode 100644 index 0000000..e956438 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/im/IMInfoBean.kt @@ -0,0 +1,7 @@ +package com.xjjk.healthyclients.bean.im + +data class IMInfoBean( + val userSig: String, + val userId: String, + val sdkAppId: String + ) diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/user/PhysicalHistoryInfoBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/user/PhysicalHistoryInfoBean.java new file mode 100644 index 0000000..87ba80f --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/user/PhysicalHistoryInfoBean.java @@ -0,0 +1,103 @@ +package com.xjjk.healthyclients.bean.user; + +import com.tencent.qcloud.tuikit.tuichat.bean.message.MedicalExaminationReportMessageBean; + +public class PhysicalHistoryInfoBean { + private String id; + private String card; + private String hospitalName; + private String year; + private String name; + private String birthday; + private String sex; + private String peQueueDate; + private String age; + + public String getPeQueueDate() { + return peQueueDate == null ? "" : peQueueDate; + } + + public void setPeQueueDate(String peQueueDate) { + this.peQueueDate = peQueueDate; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCard() { + return card == null ? "" : card; + } + + public void setCard(String card) { + this.card = card; + } + + public String getBirthday() { + return birthday == null ? "" : birthday; + } + + public void setBirthday(String birthday) { + this.birthday = birthday; + } + + public String getSex() { + return sex == null ? "" : sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getAge() { + return age== null ? "" : age; + } + + public void setAge(String age) { + this.age = age; + } + + public String getName() { + return name == null ? "" : name; + } + + public void setName(String name) { + this.name = name; + } + + public String getHospitalName() { + return hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + public MedicalExaminationReportMessageBean toIMMedicalExaminationReportMessage(String idCard){ + MedicalExaminationReportMessageBean bean = new MedicalExaminationReportMessageBean(); + bean.setName(getName()); + bean.setCardNum(idCard); + bean.setRecordId(getId()); + bean.setAge(getAge()); + if ("2".equals(getSex())) { + bean.setGender("男"); + }else{ + bean.setGender("女"); + } + + bean.setYear(getYear()); + bean.setHospital(getHospitalName()); + return bean; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/user/SelectEmergencyContactListBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/user/SelectEmergencyContactListBean.java new file mode 100644 index 0000000..6e0af20 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/user/SelectEmergencyContactListBean.java @@ -0,0 +1,60 @@ +package com.xjjk.healthyclients.bean.user; + +import java.io.Serializable; + +public class SelectEmergencyContactListBean implements Serializable { + private String id; + private String name; + private String phone; + private String idCard; + private String familyRelation; + private String familyRelation_dictText; + + public String getFamilyRelation_dictText() { + return familyRelation_dictText == null ? "" : familyRelation_dictText; + } + + public void setFamilyRelation_dictText(String familyRelation_dictText) { + this.familyRelation_dictText = familyRelation_dictText; + } + + public String getId() { + return id == null ? "" : id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name == null ? "" : name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone == null ? "" : phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getIdCard() { + return idCard == null ? "" : idCard; + } + + public void setIdCard(String idCard) { + this.idCard = idCard; + } + + public String getFamilyRelation() { + return familyRelation == null ? "" : familyRelation; + } + + public void setFamilyRelation(String familyRelation) { + this.familyRelation = familyRelation; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/user/UserContactsBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/user/UserContactsBean.java new file mode 100644 index 0000000..fbec7dd --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/user/UserContactsBean.java @@ -0,0 +1,33 @@ +package com.xjjk.healthyclients.bean.user; + +import java.io.Serializable; + +public class UserContactsBean implements Serializable { + private String name; + private String phone; + private String concern;//关系 + + public String getName() { + return name == null ? "" : name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone == null ? "" : phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getConcern() { + return concern == null ? "" : concern; + } + + public void setConcern(String concern) { + this.concern = concern; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bean/user/UserMenuBean.java b/app/src/main/java/com/xjjk/healthyclients/bean/user/UserMenuBean.java new file mode 100644 index 0000000..7017983 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bean/user/UserMenuBean.java @@ -0,0 +1,47 @@ +package com.xjjk.healthyclients.bean.user; + +public class UserMenuBean { + private int id; + private String name; + private int resource; + private int isShow; + + public UserMenuBean(int id,String name, int resource, int isShow) { + this.id = id; + this.name = name; + this.resource = resource; + this.isShow = isShow; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name == null ? "" : name; + } + + public void setName(String name) { + this.name = name; + } + + public int getResource() { + return resource; + } + + public void setResource(int resource) { + this.resource = resource; + } + + public int getIsShow() { + return isShow; + } + + public void setIsShow(int isShow) { + this.isShow = isShow; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/bottomtab/HomeBottomTabLayout.kt b/app/src/main/java/com/xjjk/healthyclients/bottomtab/HomeBottomTabLayout.kt new file mode 100644 index 0000000..ad6b615 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bottomtab/HomeBottomTabLayout.kt @@ -0,0 +1,357 @@ +package com.xjjk.healthyclients.bottomtab + +import android.content.Context +import android.content.res.TypedArray +import android.text.TextUtils +import android.util.AttributeSet +import android.util.TypedValue +import android.view.View +import android.view.ViewGroup +import android.view.ViewTreeObserver +import android.widget.ImageView +import android.widget.LinearLayout +import android.widget.TextView +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentActivity +import androidx.fragment.app.FragmentManager +import androidx.viewpager.widget.ViewPager +import com.moore.bottomtab.ItemConfig +import com.moore.bottomtab.TabConfig +import com.moore.bottomtab.TabFragmentPageAdapter +import com.moore.bottomtab.TabUtils +import com.xjjk.healthyclients.R +import java.io.IOException + +/** + * Created by moore on 2019/11/27. + */ +class HomeBottomTabLayout(context: Context, attrs: AttributeSet?) : LinearLayout(context, attrs), + View.OnClickListener { + + private lateinit var mTabConfig: TabConfig + + private var mFragmentList = ArrayList() + private var mTabContainerList: ArrayList? = null + + private var mOverSideTab = ArrayList(1) + private var mCurrentSelectedIndex = 0 + private var mViewPager: ViewPager? = null + private var mFragmentManager: FragmentManager? = null + private var mCallback: HomeBottomTabLayoutCallback? = null + private var mFragmentContainerId = -1 + private var mViewPagerId = -1 + private var isCurrentViewPager = false + private var mIsCanClickTab = true + + init { + val array: TypedArray = + context.obtainStyledAttributes(attrs, R.styleable.HomeBottomTabLayout) + mFragmentContainerId = array.getResourceId(R.styleable.HomeBottomTabLayout_container_id, -1) + mViewPagerId = array.getResourceId(R.styleable.HomeBottomTabLayout_viewPager_id, -1) + val configFile = array.getString(R.styleable.HomeBottomTabLayout_config_file_name) + isCurrentViewPager = mViewPagerId != -1 + array.recycle() + + this.orientation = HORIZONTAL + this.clipChildren = false + mFragmentManager = (context as FragmentActivity).supportFragmentManager + configFile?.let { + try { + val tabConfigFileInputStream = context.assets.open(it) + mTabConfig = + TabUtils.parseJsonToConfig(tabConfigFileInputStream) + ?: throw IllegalArgumentException("配置文件错误,请检查") + } catch (e: IOException) { + throw IllegalArgumentException("请检查${it}是否存在于assets中!") + } + } ?: let { + throw IllegalArgumentException("请使用config_file_name设置配置文件名称!") + } + initTabs() + } + + fun getFragmentSize():Int{ + return mFragmentList.size + } + + private fun initTabs() { + if (mTabConfig.tabs.isNullOrEmpty()) { + return + } + mTabContainerList = ArrayList(mTabConfig.tabs.size) + mTabConfig.tabs.forEach { tab -> + generateItemView(tab) + mFragmentList.add(null) + } + mOverSideTab.forEach { + viewTreeObserver.addOnGlobalLayoutListener(object : + ViewTreeObserver.OnGlobalLayoutListener { + override fun onGlobalLayout() { + val layoutParams = it.layoutParams as MarginLayoutParams + val height = (it.height * 2.5f).toInt() + layoutParams.height = height + layoutParams.width = height + if (!mTabConfig.isTitleVisible) { + layoutParams.setMargins(0, 0, 0, (it.height * 1.5f).toInt()) + } + it.layoutParams = layoutParams + viewTreeObserver.removeOnGlobalLayoutListener(this) + mOverSideTab.remove(it) + } + }) + } + } + + fun initFirstTab(index: Int) { + if (index < 0 || index > mTabContainerList?.size ?: 0) { + throw IndexOutOfBoundsException("没有这么多tab,index值:$index") + } + if (mCallback == null) { + throw IllegalStateException("需要先设置callback获取对应的Fragment") + } + if (isCurrentViewPager) { + setupViewPager(index) + } else { + changeTab(index) + } + } + + fun hideTab(index: Int) { + if (index < 0 || index > mTabContainerList?.size ?: 0) { + throw IndexOutOfBoundsException("没有这么多tab,index值:$index") + } + mTabContainerList?.get(index)?.visibility = View.GONE + } + + fun selectByTag(tabTag: String) { + mTabConfig.tabs.forEachIndexed { index, tabConfig -> + if (tabTag == tabConfig.tabTag) { + changeTab(index) + return + } + } + } + + fun getCurrentSelectedTag(): String { + return mTabConfig.tabs[mCurrentSelectedIndex].tabTag + } + + fun getCurrentSelectedIndex(): Int { + return mCurrentSelectedIndex + } + + fun getCurrentSelectedFragment(): Fragment? { + return mFragmentList[mCurrentSelectedIndex] + } + + fun getFragmentByTag(tabTag: String): Fragment? { + return mFragmentManager?.findFragmentByTag(tabTag) + } + + fun getFragmentList(): List? { + return mFragmentList + } + + fun setIsCanClickTab(isCanClick: Boolean) { + this.mIsCanClickTab = isCanClick + } + + fun setUnreadTip(tag: String, countStr: String?, isShowCount: Boolean = true) { + mTabConfig.tabs.forEachIndexed { index, tabConfig -> + if (tag == tabConfig.tabTag) { + if (isShowCount) { + val tvUnRead = + mTabContainerList?.get(index) + ?.findViewById(R.id.TabItem_tvUnReadTip) + tvUnRead?.visibility = View.VISIBLE + tvUnRead?.text = countStr + } else { + val viewPoint = + mTabContainerList?.get(index) + ?.findViewById(R.id.TabItem_viewPoint) + viewPoint?.visibility = View.VISIBLE + } + return + } + } + } + + fun hideUnReadTip(tag: String) { + mTabConfig.tabs.forEachIndexed { index, tabConfig -> + if (tag == tabConfig.tabTag) { + mTabContainerList?.get(index) + ?.findViewById(R.id.TabItem_tvUnReadTip)?.visibility = View.GONE + mTabContainerList?.get(index) + ?.findViewById(R.id.TabItem_viewPoint)?.visibility = View.GONE + return + } + } + } + + private fun setupViewPager(selectedIndex: Int) { + mViewPager = rootView.findViewById(mViewPagerId) + mTabConfig.tabs.forEachIndexed { index, itemConfig -> + mFragmentList[index] = mCallback!!.getFragmentByTag(itemConfig.tabTag) + } + val map = mFragmentList.map { it!! } + mFragmentManager?.let { + mViewPager?.adapter = TabFragmentPageAdapter(it, map) + } + mViewPager?.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { + override fun onPageScrollStateChanged(state: Int) { + + } + + override fun onPageScrolled( + position: Int, + positionOffset: Float, + positionOffsetPixels: Int + ) { + + } + + override fun onPageSelected(position: Int) { + setTabSelected(position) + } + }) + mViewPager?.currentItem = selectedIndex + } + + override fun onClick(v: View?) { + if (!mIsCanClickTab) { + return + } + var tempIndex = 0 + val tag = v?.tag as String + mTabContainerList?.forEachIndexed { index, viewGroup -> + if ((viewGroup.tag as String) == tag) { + tempIndex = index + return@forEachIndexed + } + } + changeTab(tempIndex) + mCallback?.onClickChangeTab(tempIndex, tag) + } + + /** + * 切换tab操作,分两步 + * 1、切换按钮状态 + * 2、切换fragment + */ + public fun changeTab(selectedIndex: Int) { + if (isCurrentViewPager) { + mViewPager?.currentItem = selectedIndex + } else { + //tab状态改变 + setTabSelected(selectedIndex) + //fragment改变 + setFragmentSelected(selectedIndex) + } + //更改当前下标 + mCurrentSelectedIndex = selectedIndex + } + + /** + * 切换按钮状态 + */ + private fun setTabSelected(selectedIndex: Int) { + mTabContainerList?.forEachIndexed { index, viewGroup -> + val ivIcon = viewGroup.findViewById(R.id.TabItem_ivIcon) + val tvName = viewGroup.findViewById(R.id.TabItem_tvTitle) + val itemConfig = mTabConfig.tabs[index] + val textColor: Int + val iconResource: Int + val textSize: Float + if (index == selectedIndex) { + textColor = mTabConfig.tabSelectedColor + textSize = mTabConfig.tabSelectedTextSize.toFloat() + iconResource = TabUtils.getResourceDrawableId(context, itemConfig.iconSelected) + viewGroup.isEnabled = false + } else { + textColor = mTabConfig.tabNormalColor + textSize = mTabConfig.tabNormalTextSize.toFloat() + iconResource = TabUtils.getResourceDrawableId(context, itemConfig.iconNormal) + viewGroup.isEnabled = true + } + ivIcon.setImageResource(iconResource) + tvName.setTextColor(textColor) + tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize) + } + } + + /** + * 切换fragment + */ + private fun setFragmentSelected(selectedIndex: Int) { + val beginTransaction = mFragmentManager?.beginTransaction() + val itemConfig = mTabConfig.tabs[selectedIndex] + var fragmentByTag = mFragmentManager?.findFragmentByTag(itemConfig.tabTag) + val isFirstInit: Boolean + if (fragmentByTag == null) { + fragmentByTag = mCallback?.getFragmentByTag(itemConfig.tabTag) + mFragmentList[selectedIndex] = fragmentByTag + isFirstInit = true + } else { + isFirstInit = false + } + mFragmentList.forEach { fragment -> + if (fragment != null && fragment.isAdded) { + beginTransaction?.hide(fragment) + } + } + fragmentByTag?.let { + if (isFirstInit) { + beginTransaction?.add(mFragmentContainerId, fragmentByTag, itemConfig.tabTag) + } else { + beginTransaction?.show(fragmentByTag) + } + } + beginTransaction?.commitAllowingStateLoss() + } + + private fun generateItemView(itemConfig: ItemConfig) { + val view: ViewGroup = + View.inflate(context, R.layout.bottom_tab_item_layout, null) as ViewGroup + val tvName = view.findViewById(R.id.TabItem_tvTitle) + val ivIcon = view.findViewById(R.id.TabItem_ivIcon) + //tabTitle + if (mTabConfig.isTabNameResId) { + tvName.text = TabUtils.getStringByResId(context, itemConfig.tabName) + } else { + tvName.text = itemConfig.tabName + } + tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mTabConfig.tabNormalTextSize.toFloat()) + tvName.setTextColor(mTabConfig.tabNormalColor) + //tabIcon + ivIcon.setImageResource(TabUtils.getResourceDrawableId(context, itemConfig.iconNormal)) + //bg + itemConfig.itemBg.apply { + if (!TextUtils.isEmpty(this)) { + ivIcon.setBackgroundResource(TabUtils.getResourceDrawableId(context, this!!)) + } + } + if (itemConfig.isOverSide) { + mOverSideTab.add(ivIcon) + } + if (!mTabConfig.isTitleVisible) { + tvName.visibility = View.GONE + } + val weight = if (itemConfig.isOverSide) 1.1f else 1f + val params = LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, weight) + + view.setOnClickListener(this) + view.tag = itemConfig.tabTag + this.addView(view, params) + mTabContainerList?.add(view) + } + + fun setHomeBottomTabLayoutCallback(homeBottomTabLayoutCallback: HomeBottomTabLayoutCallback?) { + this.mCallback = homeBottomTabLayoutCallback + } + + interface HomeBottomTabLayoutCallback { + fun getFragmentByTag(tabTag: String): Fragment? + + fun onClickChangeTab(selectedIndex: Int, selectedTag: String?) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bottomtab/TabConfig.kt b/app/src/main/java/com/xjjk/healthyclients/bottomtab/TabConfig.kt new file mode 100644 index 0000000..730ebe1 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bottomtab/TabConfig.kt @@ -0,0 +1,25 @@ +package com.moore.bottomtab + +import java.io.Serializable + +/** + * Created by moore on 2019/11/21. + */ +data class TabConfig( + var tabNormalColor: Int, + var tabSelectedColor: Int, + var tabNormalTextSize: Int, + var tabSelectedTextSize: Int, + var isTabNameResId: Boolean = true, + var isTitleVisible: Boolean = true, + var tabs: List +) : Serializable + +data class ItemConfig( + var tabName: String, + var tabTag: String, + var iconNormal: String, + var iconSelected: String, + var isOverSide: Boolean = false, + var itemBg: String? = null +) : Serializable \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bottomtab/TabFragmentPageAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/bottomtab/TabFragmentPageAdapter.kt new file mode 100644 index 0000000..783b57b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bottomtab/TabFragmentPageAdapter.kt @@ -0,0 +1,24 @@ +package com.moore.bottomtab + +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentManager +import androidx.fragment.app.FragmentPagerAdapter + +/** + * @author moore + * @date 2020/9/3 + */ +class TabFragmentPageAdapter( + fragmentManager: FragmentManager, private val fragments: List +) : FragmentPagerAdapter( + fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT +) { + + override fun getItem(position: Int): Fragment { + return fragments[position] + } + + override fun getCount(): Int { + return fragments.size + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/bottomtab/TabUtils.kt b/app/src/main/java/com/xjjk/healthyclients/bottomtab/TabUtils.kt new file mode 100644 index 0000000..04842c2 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/bottomtab/TabUtils.kt @@ -0,0 +1,119 @@ +package com.moore.bottomtab + +import android.content.Context +import android.graphics.Color +import android.text.TextUtils +import org.json.JSONException +import org.json.JSONObject +import java.io.ByteArrayOutputStream +import java.io.InputStream +import java.util.regex.Pattern + +/** + * Created by moore on 2019/11/27. + */ +object TabUtils { + /** + * 检查颜色是否合法 + */ + fun isColorLegal(color: String): Boolean { + if (TextUtils.isEmpty(color)) { + return false + } + //#aabbcc + val matchRegix1 = "^#[0-9a-fA-F]{6}" + //#00aabbcc + val matchRegix2 = "^#[0-9a-fA-F]{8}" + //#ccc + val matchRegix3 = "^#[0-9a-fA-F]{3}" + //去匹配 + val compile = Pattern.compile(matchRegix1) + if (compile.matcher(color).find()) { + return true + } + val compile1 = Pattern.compile(matchRegix2) + if (compile1.matcher(color).find()) { + return true + } + val compile2 = Pattern.compile(matchRegix3) + if (compile2.matcher(color).find()) { + return true + } + return false + } + + fun parseJsonToConfig(inputStream: InputStream): TabConfig? { + val resultArray = ByteArrayOutputStream() + val temp = ByteArray(256) + var read = inputStream.read(temp) + while (read != -1) { + resultArray.write(temp, 0, read) + read = inputStream.read(temp) + resultArray.flush() + } + val readJson = resultArray.toString("utf-8") + inputStream.close() + resultArray.close() + if (readJson.isNotEmpty()) { + try { + val obj = JSONObject(readJson) + //颜色 + val textColorNormal = obj.optString("textColorNormal") + val textColorSelected = obj.optString("textColorSelected") + val normalColor = if (isColorLegal(textColorNormal)) { + Color.parseColor(textColorNormal) + } else { + Color.BLACK + } + val selectedColor = if (isColorLegal(textColorSelected)) { + Color.parseColor(textColorSelected) + } else { + Color.GRAY + } + val textSizeNormal = obj.optInt("textSizeNormal", 14) + val textSizeSelected = obj.optInt("textSizeSelected", 14) + val isTabNameResId = obj.optBoolean("isNameResId", true) + val isTitleVisible = obj.optBoolean("isTitleVisible", true) + //标签 + val itemList = ArrayList() + val tabs = obj.optJSONArray("tabs") + if (tabs != null && tabs.length() > 0) { + for (i in 0 until tabs.length()) { + val tabJson = tabs.optJSONObject(i) + val tabName = tabJson.optString("tabName") + val tabTag = tabJson.optString("tabTag") + val tabIconNormal = tabJson.optString("iconNormal") + val tabIconSelected = tabJson.optString("iconSelected") + val isOverSide = tabJson.optBoolean("isOverSide", false) + val tabItemConfig = + ItemConfig(tabName, tabTag, tabIconNormal, tabIconSelected, isOverSide) + val itemBg = tabJson.optString("itemBg", "") + tabItemConfig.itemBg = itemBg + itemList.add(tabItemConfig) + } + } + return TabConfig( + normalColor, + selectedColor, + textSizeNormal, + textSizeSelected, + isTabNameResId, + isTitleVisible, + itemList + ) + } catch (e: JSONException) { + e.printStackTrace() + } + } + return null + } + + fun getResourceDrawableId(context: Context, drawableName: String): Int { + return context.resources.getIdentifier(drawableName, "drawable", context.packageName) + } + + fun getStringByResId(context: Context, strResId: String): String { + val resId = context.resources.getIdentifier(strResId, "string", context.packageName) + return context.resources.getString(resId) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/chart/DoubleWheelBPicker.java b/app/src/main/java/com/xjjk/healthyclients/chart/DoubleWheelBPicker.java new file mode 100644 index 0000000..ebf0a7c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/chart/DoubleWheelBPicker.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016-present 贵州纳雍穿青人李裕江<1032694760@qq.com> + * + * The software is licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +package com.xjjk.healthyclients.chart; + +import android.app.Activity; +import android.view.View; +import android.widget.ProgressBar; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.StyleRes; + +import com.github.gzuliyujiang.dialog.ModalDialog; +import com.github.gzuliyujiang.wheelpicker.contract.LinkageProvider; +import com.github.gzuliyujiang.wheelpicker.contract.OnLinkagePickedListener; +import com.github.gzuliyujiang.wheelpicker.widget.LinkageWheelLayout; +import com.github.gzuliyujiang.wheelview.widget.WheelView; + +/** + * 二三级联动选择器 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @see com.github.gzuliyujiang.wheelview.contract.TextProvider + * @see LinkageProvider + * @see LinkageWheelLayout + * @see OnLinkagePickedListener + * @since 2019/6/17 11:21 + */ +@SuppressWarnings({"WeakerAccess", "unused"}) +public class DoubleWheelBPicker extends ModalDialog { + protected DoubleWheelBaseLayout wheelLayout; + private OnLinkagePickedListener onLinkagePickedListener; + + public DoubleWheelBPicker(@NonNull Activity activity) { + super(activity); + } + + public DoubleWheelBPicker(@NonNull Activity activity, @StyleRes int themeResId) { + super(activity, themeResId); + } + + @NonNull + @Override + protected View createBodyView() { + wheelLayout = new DoubleWheelBaseLayout(activity); + return wheelLayout; + } + + @Override + protected void onCancel() { + + } + + @Override + protected void onOk() { + if (onLinkagePickedListener != null) { + Object first = wheelLayout.getFirstWheelView().getCurrentItem(); + Object second = wheelLayout.getSecondWheelView().getCurrentItem(); + Object third = wheelLayout.getThirdWheelView().getCurrentItem(); + onLinkagePickedListener.onLinkagePicked(first, second, third); + } + } + + public void setData(@NonNull LinkageProvider data) { + wheelLayout.setData(data); + } + + public void setDefaultValue(Object first, Object second, Object third) { + wheelLayout.setDefaultValue(first, second, third); + } + + public void setOnLinkagePickedListener(OnLinkagePickedListener onLinkagePickedListener) { + this.onLinkagePickedListener = onLinkagePickedListener; + } + + public final DoubleWheelBaseLayout getWheelLayout() { + return wheelLayout; + } + + public final WheelView getFirstWheelView() { + return wheelLayout.getFirstWheelView(); + } + + public final WheelView getSecondWheelView() { + return wheelLayout.getSecondWheelView(); + } + + public final WheelView getThirdWheelView() { + return wheelLayout.getThirdWheelView(); + } + + public final TextView getFirstLabelView() { + return wheelLayout.getFirstLabelView(); + } + + public final TextView getSecondLabelView() { + return wheelLayout.getSecondLabelView(); + } + + public final TextView getThirdLabelView() { + return wheelLayout.getThirdLabelView(); + } + + public final ProgressBar getLoadingView() { + return wheelLayout.getLoadingView(); + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/chart/DoubleWheelBaseLayout.java b/app/src/main/java/com/xjjk/healthyclients/chart/DoubleWheelBaseLayout.java new file mode 100644 index 0000000..926e64b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/chart/DoubleWheelBaseLayout.java @@ -0,0 +1,289 @@ +/* + * Copyright (c) 2016-present 贵州纳雍穿青人李裕江<1032694760@qq.com> + * + * The software is licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +package com.xjjk.healthyclients.chart; + +import android.content.Context; +import android.content.res.TypedArray; +import android.util.AttributeSet; +import android.widget.ProgressBar; +import android.widget.TextView; + +import androidx.annotation.CallSuper; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.github.gzuliyujiang.wheelpicker.R; +import com.github.gzuliyujiang.wheelpicker.contract.LinkageProvider; +import com.github.gzuliyujiang.wheelpicker.contract.OnLinkageSelectedListener; +import com.github.gzuliyujiang.wheelpicker.widget.BaseWheelLayout; +import com.github.gzuliyujiang.wheelview.annotation.ScrollState; +import com.github.gzuliyujiang.wheelview.contract.WheelFormatter; +import com.github.gzuliyujiang.wheelview.widget.WheelView; + +import java.util.Arrays; +import java.util.List; + +/** + * 二三级联动滚轮控件 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2019/6/15 11:55 + */ +@SuppressWarnings("unused") +public class DoubleWheelBaseLayout extends BaseWheelLayout { + private WheelView firstWheelView, secondWheelView, thirdWheelView; + private TextView firstLabelView, secondLabelView, thirdLabelView; + private ProgressBar loadingView; + private Object firstValue, secondValue, thirdValue; + private int firstIndex, secondIndex, thirdIndex; + private LinkageProvider dataProvider; + private OnLinkageSelectedListener onLinkageSelectedListener; + + public DoubleWheelBaseLayout(Context context) { + super(context); + } + + public DoubleWheelBaseLayout(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public DoubleWheelBaseLayout(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public DoubleWheelBaseLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + @Override + protected int provideLayoutRes() { + return R.layout.wheel_picker_linkage; + } + + @CallSuper + @Override + protected List provideWheelViews() { + return Arrays.asList(firstWheelView, secondWheelView, thirdWheelView); + } + + @CallSuper + @Override + protected void onInit(@NonNull Context context) { + firstWheelView = findViewById(R.id.wheel_picker_linkage_first_wheel); + secondWheelView = findViewById(R.id.wheel_picker_linkage_second_wheel); + thirdWheelView = findViewById(R.id.wheel_picker_linkage_third_wheel); + firstLabelView = findViewById(R.id.wheel_picker_linkage_first_label); + secondLabelView = findViewById(R.id.wheel_picker_linkage_second_label); + thirdLabelView = findViewById(R.id.wheel_picker_linkage_third_label); + loadingView = findViewById(R.id.wheel_picker_linkage_loading); + } + + @CallSuper + @Override + protected void onAttributeSet(@NonNull Context context, @Nullable AttributeSet attrs) { + TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.LinkageWheelLayout); + setFirstVisible(typedArray.getBoolean(R.styleable.LinkageWheelLayout_wheel_firstVisible, true)); + setThirdVisible(typedArray.getBoolean(R.styleable.LinkageWheelLayout_wheel_thirdVisible, true)); + String firstLabel = typedArray.getString(R.styleable.LinkageWheelLayout_wheel_firstLabel); + String secondLabel = typedArray.getString(R.styleable.LinkageWheelLayout_wheel_secondLabel); + String thirdLabel = typedArray.getString(R.styleable.LinkageWheelLayout_wheel_thirdLabel); + typedArray.recycle(); + setLabel(firstLabel, secondLabel, thirdLabel); + } + + @CallSuper + @Override + public void onWheelSelected(WheelView view, int position) { + int id = view.getId(); + if (id == R.id.wheel_picker_linkage_first_wheel) { + firstIndex = position; +// secondIndex = 0; +// thirdIndex = 0; +// changeSecondData(); +// changeThirdData(); + selectedCallback(); + return; + } + if (id == R.id.wheel_picker_linkage_second_wheel) { + secondIndex = position; + thirdIndex = 0; + changeThirdData(); + selectedCallback(); + return; + } + if (id == R.id.wheel_picker_linkage_third_wheel) { + thirdIndex = position; + selectedCallback(); + } + } + + @CallSuper + @Override + public void onWheelScrollStateChanged(WheelView view, @ScrollState int state) { + int id = view.getId(); + if (id == R.id.wheel_picker_linkage_first_wheel) { + secondWheelView.setEnabled(state == ScrollState.IDLE); + thirdWheelView.setEnabled(state == ScrollState.IDLE); + return; + } + if (id == R.id.wheel_picker_linkage_second_wheel) { + firstWheelView.setEnabled(state == ScrollState.IDLE); + thirdWheelView.setEnabled(state == ScrollState.IDLE); + return; + } + if (id == R.id.wheel_picker_linkage_third_wheel) { + firstWheelView.setEnabled(state == ScrollState.IDLE); + secondWheelView.setEnabled(state == ScrollState.IDLE); + } + } + + public void setData(@NonNull LinkageProvider provider) { + setFirstVisible(provider.firstLevelVisible()); + setThirdVisible(provider.thirdLevelVisible()); + if (firstValue != null) { + firstIndex = provider.findFirstIndex(firstValue); + } + if (secondValue != null) { + secondIndex = provider.findSecondIndex(firstIndex, secondValue); + } + if (thirdValue != null) { + thirdIndex = provider.findThirdIndex(firstIndex, secondIndex, thirdValue); + } + dataProvider = provider; + changeFirstData(); + changeSecondData(); + changeThirdData(); + } + + public void setDefaultValue(Object first, Object second, Object third) { + if (dataProvider != null) { + firstIndex = dataProvider.findFirstIndex(first); + secondIndex = dataProvider.findSecondIndex(firstIndex, second); + thirdIndex = dataProvider.findThirdIndex(firstIndex, secondIndex, third); + changeFirstData(); + changeSecondData(); + changeThirdData(); + } else { + this.firstValue = first; + this.secondValue = second; + this.thirdValue = third; + } + } + + public void setFormatter(WheelFormatter first, WheelFormatter second, WheelFormatter third) { + firstWheelView.setFormatter(first); + secondWheelView.setFormatter(second); + thirdWheelView.setFormatter(third); + } + + public void setLabel(CharSequence first, CharSequence second, CharSequence third) { + firstLabelView.setText(first); + secondLabelView.setText(second); + thirdLabelView.setText(third); + } + + public void showLoading() { + loadingView.setVisibility(VISIBLE); + } + + public void hideLoading() { + loadingView.setVisibility(GONE); + } + + public void setOnLinkageSelectedListener(OnLinkageSelectedListener onLinkageSelectedListener) { + this.onLinkageSelectedListener = onLinkageSelectedListener; + } + + public void setFirstVisible(boolean visible) { + if (visible) { + firstWheelView.setVisibility(VISIBLE); + firstLabelView.setVisibility(VISIBLE); + } else { + firstWheelView.setVisibility(GONE); + firstLabelView.setVisibility(GONE); + } + } + + public void setThirdVisible(boolean visible) { + if (visible) { + thirdWheelView.setVisibility(VISIBLE); + thirdLabelView.setVisibility(VISIBLE); + } else { + thirdWheelView.setVisibility(GONE); + thirdLabelView.setVisibility(GONE); + } + } + + private void selectedCallback() { + if (onLinkageSelectedListener == null) { + return; + } + thirdWheelView.post(new Runnable() { + @Override + public void run() { + Object first = firstWheelView.getCurrentItem(); + Object second = secondWheelView.getCurrentItem(); + Object third = thirdWheelView.getCurrentItem(); + onLinkageSelectedListener.onLinkageSelected(first, second, third); + } + }); + } + + private void changeFirstData() { + firstWheelView.setData(dataProvider.provideFirstData()); + firstWheelView.setDefaultPosition(firstIndex); + } + + private void changeSecondData() { + secondWheelView.setData(dataProvider.linkageSecondData(firstIndex)); + secondWheelView.setDefaultPosition(secondIndex); + } + + private void changeThirdData() { + if (!dataProvider.thirdLevelVisible()) { + return; + } + thirdWheelView.setData(dataProvider.linkageThirdData(firstIndex, secondIndex)); + thirdWheelView.setDefaultPosition(thirdIndex); + } + + public final WheelView getFirstWheelView() { + return firstWheelView; + } + + public final WheelView getSecondWheelView() { + return secondWheelView; + } + + public final WheelView getThirdWheelView() { + return thirdWheelView; + } + + public final TextView getFirstLabelView() { + return firstLabelView; + } + + public final TextView getSecondLabelView() { + return secondLabelView; + } + + public final TextView getThirdLabelView() { + return thirdLabelView; + } + + public final ProgressBar getLoadingView() { + return loadingView; + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/chart/EmptyXAxisFormatter.kt b/app/src/main/java/com/xjjk/healthyclients/chart/EmptyXAxisFormatter.kt new file mode 100644 index 0000000..6a996fc --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/chart/EmptyXAxisFormatter.kt @@ -0,0 +1,11 @@ +package com.xjjk.healthyclients.chart + +import com.github.mikephil.charting.components.AxisBase +import com.github.mikephil.charting.formatter.ValueFormatter + +class EmptyXAxisFormatter : ValueFormatter() { + private val days = arrayOf("", "", "", "", "", "", "") + override fun getAxisLabel(value: Float, axis: AxisBase?): String { + return days.getOrNull(value.toInt()) ?: value.toString() + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/chart/HeartRateProvider.java b/app/src/main/java/com/xjjk/healthyclients/chart/HeartRateProvider.java new file mode 100644 index 0000000..588af4a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/chart/HeartRateProvider.java @@ -0,0 +1,84 @@ + +package com.xjjk.healthyclients.chart; + +import androidx.annotation.NonNull; + +import com.github.gzuliyujiang.wheelpicker.contract.LinkageProvider; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + + +public class HeartRateProvider implements LinkageProvider { + private static final String[] MIN_ARRS = { + "40次/分钟", "45次/分钟", "50次/分钟"}; + private static final String[] MAX_ARRS = { + "100次/分钟", "110次/分钟", "120次/分钟", "130次/分钟", "140次/分钟", "150次/分钟"}; + + @Override + public boolean firstLevelVisible() { + return true; + } + + @Override + public boolean thirdLevelVisible() { + return false; + } + + @NonNull + @Override + public List provideFirstData() { + List provinces = new ArrayList<>(); + Collections.addAll(provinces, MIN_ARRS); + return provinces; + } + + @NonNull + @Override + public List linkageSecondData(int firstIndex) { + List letters = new ArrayList<>(); + Collections.addAll(letters, MAX_ARRS); + return letters; + } + + @NonNull + @Override + public List linkageThirdData(int firstIndex, int secondIndex) { + return new ArrayList<>(); + } + + @Override + public int findFirstIndex(Object firstValue) { + if (firstValue == null) { + return INDEX_NO_FOUND; + } + for (int i = 0, n = MIN_ARRS.length; i < n; i++) { + String abbreviation = MIN_ARRS[i]; + if (abbreviation.equals(firstValue.toString())) { + return i; + } + } + return INDEX_NO_FOUND; + } + + @Override + public int findSecondIndex(int firstIndex, Object secondValue) { + if (secondValue == null) { + return INDEX_NO_FOUND; + } + for (int i = 0, n = MAX_ARRS.length; i < n; i++) { + String abbreviation = MAX_ARRS[i]; + if (abbreviation.equals(secondValue.toString())) { + return i; + } + } + return INDEX_NO_FOUND; + } + + @Override + public int findThirdIndex(int firstIndex, int secondIndex, Object thirdValue) { + return 0; + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/chart/TemperatureProvider.java b/app/src/main/java/com/xjjk/healthyclients/chart/TemperatureProvider.java new file mode 100644 index 0000000..d128e04 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/chart/TemperatureProvider.java @@ -0,0 +1,110 @@ + +package com.xjjk.healthyclients.chart; + +import androidx.annotation.NonNull; + +import com.github.gzuliyujiang.wheelpicker.contract.LinkageProvider; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; + + +public class TemperatureProvider implements LinkageProvider { + List firstDataList = new ArrayList<>(); + List secondDataList = new ArrayList<>(); + + @Override + public boolean firstLevelVisible() { + return true; + } + + @Override + public boolean thirdLevelVisible() { + return false; + } + + @NonNull + @Override + public List provideFirstData() { + List floatList = getDataList(34, 36, 0.1f); + for (String i : floatList) { + firstDataList.add(i + "℃"); + } + return firstDataList; + } + + public List getDataList(double min, double max, double step) { + DecimalFormat df = new DecimalFormat("#.0"); + double minValue = Math.min(min, max); + double maxValue = Math.max(min, max); + // 指定初始容量,避免OutOfMemory + int capacity = (int) ((maxValue - minValue) / step); + List data = new ArrayList<>(capacity); + for (double i = minValue; i <= maxValue; i = i + step) { + data.add(df.format(i)); + } + return data; + } + + @NonNull + @Override + public List linkageSecondData(int firstIndex) { + + List floatList = getDataList(37.2f, 38.5f, 0.1f); + for (String i : floatList) { + secondDataList.add(i + "℃"); + } + return secondDataList; + } + + @NonNull + @Override + public List linkageThirdData(int firstIndex, int secondIndex) { + return new ArrayList<>(); + } + + @Override + public int findFirstIndex(Object firstValue) { + if (firstValue == null) { + return INDEX_NO_FOUND; + } + for (int i = 0; i < firstDataList.size(); i++) { + if (firstDataList.get(i).equals(firstValue.toString())) { + return i; + } + } +// for (int i = 0, n = MIN_ARRS.length; i < n; i++) { +// String abbreviation = MIN_ARRS[i]; +// if (abbreviation.equals(firstValue.toString())) { +// return i; +// } +// } + return INDEX_NO_FOUND; + } + + @Override + public int findSecondIndex(int firstIndex, Object secondValue) { + if (secondValue == null) { + return INDEX_NO_FOUND; + } + for (int i = 0; i < secondDataList.size(); i++) { + if (secondDataList.get(i).equals(secondValue.toString())) { + return i; + } + } +// for (int i = 0, n = MAX_ARRS.length; i < n; i++) { +// String abbreviation = MAX_ARRS[i]; +// if (abbreviation.equals(secondValue.toString())) { +// return i; +// } +// } + return INDEX_NO_FOUND; + } + + @Override + public int findThirdIndex(int firstIndex, int secondIndex, Object thirdValue) { + return 0; + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/CommonApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/CommonApi.kt new file mode 100644 index 0000000..e818495 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/CommonApi.kt @@ -0,0 +1,101 @@ +package com.xjjk.healthyclients.data.api + +import com.google.gson.JsonObject +import com.xjjk.healthyclients.bean.AppUpdateBean +import com.xjjk.healthyclients.bean.CommonSettingMenuBean +import com.xjjk.healthyclients.bean.LoginBean +import com.xjjk.healthyclients.bean.SelectUserInfoBean +import com.xjjk.healthyclients.bean.SelectUserMessageListBean +import com.xjjk.healthyclients.bean.UploadFileResultBean +import com.xjjk.healthyclients.data.bean.ApiResponse +import com.xjjk.healthyclients.event.UserNoticeBean +import okhttp3.MultipartBody +import okhttp3.RequestBody +import retrofit2.Call +import retrofit2.http.Body +import retrofit2.http.GET +import retrofit2.http.Multipart +import retrofit2.http.POST +import retrofit2.http.Part +import retrofit2.http.PartMap +import retrofit2.http.QueryMap + +interface CommonApi { + /** + * 获取后台配置的菜单(例如:咨询人中与本人的关系) + */ + @GET("/health-consultation/api/consult/conDoctor/selectDictList") + suspend fun getCommonSettingMenuList(@QueryMap params: MutableMap): ApiResponse> + + /** + * 上传文件 + */ + @Multipart + @POST("/sys/upload/uploadFile") + suspend fun uploadFile(@Part part: MultipartBody.Part, @Part("biz") path: RequestBody): ApiResponse + /** + * 上传文件 + */ + @Multipart + @POST("/sys/upload/uploadFileMany") + suspend fun uploadFile(@PartMap params: MutableMap, @Part("biz") path: RequestBody): ApiResponse> + + /** + * 首页系统功能介绍弹窗 + */ + @GET("/health-consultation/api/consult/notice/selectUserNotice") + suspend fun selectUserNotice(@QueryMap params: MutableMap): ApiResponse + + /** + * 查询用户信息 + */ + @GET("/health-system/sys/api/selectUserInfo") + suspend fun selectUserInfo(@QueryMap params: MutableMap): ApiResponse + + /** + * 校验token是否过期 + */ + @GET("/health-consultation/api/consult/msgRecord/selectTokenExpire") + suspend fun selectTokenExpire(@QueryMap params: MutableMap): ApiResponse + + /** + * 校验用户信息 + */ + @POST("health-system/api/anon/sys/checkUser") + suspend fun checkUserInfo(@Body requestBody: RequestBody): ApiResponse + /** + * 修改密码 + */ + @POST("health-system/api/anon/sys/resetUserPwd") + suspend fun resetUserPwd(@Body requestBody: RequestBody): ApiResponse + + /** + * 首页消息 + */ + @GET("/sys/api/messageRemind/selectUserMessageList") + suspend fun selectUserMessageList(@QueryMap params: MutableMap): ApiResponse> + /** + * 首页消息已读 + */ + @GET("/sys/api/messageRemind/changeAlRead") + suspend fun changeAlRead(@QueryMap params: MutableMap): ApiResponse + + /** + * 检查更新 + */ + @GET("/health-system/version/getSysVersionDetailByPackageName") + suspend fun getAppUpdateInfo(@QueryMap params: MutableMap): ApiResponse + + /** + * 登录接口 + */ + @POST("/sys/mLogin") + fun mLogin(@Body any: LoginBean): Call + /** + * 首页系统功能介绍弹窗-选择多少天不在提示 + */ + @GET("/health-consultation/api/consult/notice/chooseToDontShowUp") + suspend fun chooseToDontShowUp(@QueryMap params: MutableMap): ApiResponse + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/ConsultantManagerApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/ConsultantManagerApi.kt new file mode 100644 index 0000000..7f7a925 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/ConsultantManagerApi.kt @@ -0,0 +1,71 @@ +package com.xjjk.healthyclients.data.api + +import com.sw.healthyclients.bean.guidance.ConsultDoctorIMChatInfo +import com.xjjk.healthyclients.bean.guidance.ArchivesBean +import com.xjjk.healthyclients.bean.guidance.BaseHealthyInfoResultBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.data.bean.ApiResponse +import okhttp3.RequestBody +import retrofit2.http.Body +import retrofit2.http.GET +import retrofit2.http.POST +import retrofit2.http.QueryMap + +interface ConsultantManagerApi { + /** + * 选择人管理 + */ + @GET("health-consultation/api/consult/familyMembers/selectMenberList") + suspend fun getConsultantArchivesData(@QueryMap params: MutableMap): ApiResponse> + /** + * 咨询人管理 + */ + @GET("health-consultation/api/consult/familyMembers/selectMenberOnlyList") + suspend fun getConsultantManagerData(@QueryMap params: MutableMap): ApiResponse> + /** + * 添加咨询人 + */ + @POST("health-consultation/api/consult/familyMembers/insertFamilyMembers") + suspend fun addConsultant(@Body requestBody: RequestBody): ApiResponse + /** + * 修改咨询人 + */ + @POST("health-consultation/api/consult/familyMembers/updateFamilyMembers") + suspend fun updateConsultant(@Body requestBody: RequestBody): ApiResponse + /** + * 删除咨询人 + */ + @POST("health-consultation/api/consult/familyMembers/removeMemberById") + suspend fun deleteConsultant(@Body requestBody: RequestBody): ApiResponse + /** + * 添加疾病档案 + */ + @POST("health-consultation/api/consult/medicalRecords/insertConMedicalRecords") + suspend fun addArchives(@Body requestBody: RequestBody): ApiResponse + /** + * 疾病档案详情 + */ + @GET("health-consultation/api/consult/medicalRecords/selectConMedicalRecordsById") + suspend fun getArchivesDetail(@QueryMap params: MutableMap): ApiResponse + /** + * 提交视频咨询预约申请 + */ + @POST("health-consultation/api/consult/conSession/insertTelephoneSession") + suspend fun submitAudioVideoConsultApply(@Body requestBody: RequestBody): ApiResponse + + /** + * 获取基本健康信息 + */ + @GET("health-consultation/api/consult/healthInfo/selectHealthInfo") + suspend fun getBaseHealthyInfoSettingList(@QueryMap params: MutableMap): ApiResponse> + /** + * 提交基本健康信息 + */ + @POST("health-consultation/api/consult/healthInfo/inserOrUpdatetHealthInfoAnswer") + suspend fun submitBaseHealthInfo(@Body requestBody: RequestBody): ApiResponse + /** + * 提交图文咨询申请 + */ + @POST("health-consultation/api/consult/conSession/insertPictureTextSession") + suspend fun submitImageTextConsultApply(@Body requestBody: RequestBody): ApiResponse +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/DoctorApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/DoctorApi.kt new file mode 100644 index 0000000..87ba099 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/DoctorApi.kt @@ -0,0 +1,41 @@ +package com.xjjk.healthyclients.data.api + +import com.xjjk.healthyclients.bean.guidance.AppraiseBean +import com.sw.healthyclients.bean.guidance.DoctorBean +import com.xjjk.healthyclients.bean.guidance.AppointmentTimeBean +import com.xjjk.healthyclients.data.bean.ApiResponse +import retrofit2.http.GET +import retrofit2.http.QueryMap + +interface DoctorApi { + /** + * 获取医生信息 + */ + @GET("/health-consultation/api/consult/conDoctor/selectDoctorInfo") + suspend fun getDoctorInfo(@QueryMap params: MutableMap): ApiResponse + /** + * 获取医生评价 + */ + @GET("/health-consultation/api/consult/conEvaluate/selectConEvaluateList") + suspend fun getDoctorAppraise(@QueryMap params: MutableMap): ApiResponse> + /** + * 医生 - 关注 + */ + @GET("/health-consultation/api/consult/conDoctorFollow/followDoctor") + suspend fun followDoctor(@QueryMap params: MutableMap): ApiResponse + /** + * 医生 - 取消关注 + */ + @GET("/health-consultation/api/consult/conDoctorFollow/cancelDoctor") + suspend fun cancelFollowDoctor(@QueryMap params: MutableMap): ApiResponse + /** + * 获取医生评价汇总信息 + */ + @GET("/health-consultation/api/consult/conDoctor/selectDoctorAverageScore") + suspend fun getDoctorAppraiseData(@QueryMap params: MutableMap): ApiResponse + /** + * 获取医生可预约时间 + */ + @GET("/health-consultation/api/consult/conDoctorSchedulingDate/selectSchedulingDateListByDoctorId") + suspend fun getDoctorSchedulingDate(@QueryMap params: MutableMap): ApiResponse> +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/EmergencyApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/EmergencyApi.kt new file mode 100644 index 0000000..f9e3752 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/EmergencyApi.kt @@ -0,0 +1,86 @@ +package com.xjjk.healthyclients.data.api + +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.HospitalBean +import com.xjjk.healthyclients.bean.emergency.OrderThroughBean +import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean +import com.xjjk.healthyclients.data.bean.ApiResponse +import okhttp3.RequestBody +import retrofit2.http.Body +import retrofit2.http.GET +import retrofit2.http.POST +import retrofit2.http.QueryMap + +interface EmergencyApi { + /** + * 应急首页数据获取 + */ + @GET("/health-emergency/api/emergency/resource/home") + suspend fun getEmergencyData(@QueryMap params: MutableMap): ApiResponse + + /** + * 大病就医列表 + */ + @GET("/health-emergency/api/emergency/disease/selectEmergencySeriousDiseaseListByState") + suspend fun selectEmergencySeriousDiseaseListByState(@QueryMap params: MutableMap): ApiResponse> + /** + * 医院 + */ + @GET("/health-emergency/api/emergency/resource/selectStationHospitalList") + suspend fun selectStationHospitalList(): ApiResponse> + + /** + * 大病就医详情 + */ + @GET("/health-emergency/api/emergency/disease/selectEmergencySeriousDiseaseDOById") + suspend fun selectEmergencySeriousDiseaseDOById(@QueryMap params: MutableMap): ApiResponse + + /** + * 应急就医 + */ + @GET("/health-emergency/api/emergency/order/initUserOrderPage") + suspend fun initUserOrderPage(@QueryMap params: MutableMap): ApiResponse + + /** + * 应急就医小结 + */ + @GET("/health-emergency/api/emergency/order/orderThrough") + suspend fun orderThrough(@QueryMap params: MutableMap): ApiResponse + /** + * 应急就医小结 + */ + @GET("/health-emergency/api/emergency/order/getOrderById") + suspend fun getOrderBySessionId(@QueryMap params: MutableMap): ApiResponse + + /** + * 医院 + */ + @POST("/health-emergency/api/emergency/disease/appointmentSeeDoctor") + suspend fun appointmentSeeDoctor(@Body requestBody: RequestBody): ApiResponse + + /** + * 呼叫救援 + */ + @POST("/health-emergency/api/emergency/call") + suspend fun getEmergencyCall(@Body requestBody: RequestBody): ApiResponse + /** + * 呼叫回调 + */ + @POST("/health-emergency/api/emergency/call/back") + suspend fun getEmergencyCallBack(@Body requestBody: RequestBody): ApiResponse + /** + * 结束会话 + */ + @POST("/health-emergency/api/emergency/session/over") + suspend fun getEmergencyCallOver(@Body requestBody: RequestBody): ApiResponse + /** + * 获取应急IM群组信息 + */ + @GET("/health-emergency/api/emergency/createGroupMag") + suspend fun getIMGroupInfo(@QueryMap params: MutableMap): ApiResponse + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/GuidanceApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/GuidanceApi.kt new file mode 100644 index 0000000..e68101f --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/GuidanceApi.kt @@ -0,0 +1,247 @@ +package com.xjjk.healthyclients.data.api + +import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo +import com.xjjk.healthyclients.bean.guidance.AppointmentInformationBean +import com.xjjk.healthyclients.bean.guidance.ArchivesBean +import com.xjjk.healthyclients.bean.guidance.ConsultArchivesDetailBean +import com.xjjk.healthyclients.bean.guidance.DepartListBean +import com.xjjk.healthyclients.bean.guidance.DepartListBeanNew +import com.xjjk.healthyclients.bean.guidance.DoctorRecommendBeanNetWork +import com.xjjk.healthyclients.bean.guidance.GuidanceListBean +import com.xjjk.healthyclients.bean.guidance.HospitalCommentBean +import com.xjjk.healthyclients.bean.guidance.SearchDepartListBean +import com.xjjk.healthyclients.bean.guidance.SickListBean +import com.xjjk.healthyclients.bean.guidance.hospitalDetailBean +import com.xjjk.healthyclients.bean.guidance.searchComprehensiveBean +import com.xjjk.healthyclients.bean.guidance.searchConDepartmentAllBean +import com.xjjk.healthyclients.bean.guidance.searchConResourceAllBean +import com.xjjk.healthyclients.bean.guidance.selectDictListByNHDSBean +import com.xjjk.healthyclients.bean.guidance.selectDoctorByHospitalIdBean +import com.xjjk.healthyclients.bean.guidance.selectHospitalListBean +import com.xjjk.healthyclients.bean.guidance.selectHostitalAverageScoreBean +import com.xjjk.healthyclients.bean.guidance.selectSessionListByUserIdBean +import com.xjjk.healthyclients.bean.healthrecord.GetHistoryReportByPageBean +import com.xjjk.healthyclients.bean.user.SelectEmergencyContactListBean +import com.xjjk.healthyclients.data.bean.ApiResponse +import okhttp3.RequestBody +import retrofit2.http.Body +import retrofit2.http.GET +import retrofit2.http.POST +import retrofit2.http.QueryMap + +interface GuidanceApi { + /** + * 咨询首页数据获取 + */ +// @GET("health-consultation/api/consult/conDoctor/selectDoctorRecommend") + @GET("health-consultation/api/consult/conDoctor/selectDoctorRecommendNew") + suspend fun selectDoctorRecommend(): ApiResponse + /** + * 咨询首页数据获取 + */ +// @GET("health-consultation/api/consult/conDoctor/selectDoctorRecommend") + @GET("health-consultation/api/consult/conSession/selectSessionListByDoctorIdUnit") + suspend fun selectSessionListByDoctorIdUnit(@QueryMap params: MutableMap): ApiResponse> + + /** + * 全科医生咨询记录 + */ +// @GET("health-consultation/api/consult/conDoctor/selectDoctorRecommend") + @GET("health-consultation/api/consult/conSession/selectSessionListByDoctorIdHelper") + suspend fun selectSessionListByDoctorIdHelper(@QueryMap params: MutableMap): ApiResponse> + + /** + * 医生全部列表 + */ + @GET("health-consultation/api/consult/es/searchConResourceAll") + suspend fun searchConResourceAll(@QueryMap params: MutableMap): ApiResponse> + + /** + * 医生全部列表 + */ + @GET("health-consultation/api/consult/es/searchConDepartmentAll") + suspend fun searchConDepartmentAll(@QueryMap params: MutableMap): ApiResponse> + + /** + * 疾病全部列表 + */ + @GET("health-consultation/api/consult/es/searchconSicksAll") + suspend fun searchconSicksAll(@QueryMap params: MutableMap): ApiResponse> + + /** + * 综合搜索 + */ + @GET("health-consultation/api/consult/es/searchComprehensive") + suspend fun searchComprehensive(@QueryMap params: MutableMap): ApiResponse + /** + * 医生搜索 + */ + @GET("health-consultation/api/consult/es/searchConDoctor") + suspend fun searchConDoctor(@QueryMap params: MutableMap): ApiResponse> + /** + * 医院搜索 + */ + @GET("health-consultation/api/consult/es/searchConResource") + suspend fun searchConResource(@QueryMap params: MutableMap): ApiResponse> + /** + * 疾病搜索 + */ + @GET("health-consultation/api/consult/es/searchconSicksList") + suspend fun searchconSicksList(@QueryMap params: MutableMap): ApiResponse> + /** + * 科室搜索 + */ + @GET("health-consultation/api/consult/es/searchConDepartment") + suspend fun searchConDepartment(@QueryMap params: MutableMap): ApiResponse> + /** + * 科室搜索 + */ + @GET("health-consultation/api/consult/conDepartment/selectDepartListByHospitalId") + suspend fun selectDepartListByHospitalId(@QueryMap params: MutableMap): ApiResponse> + /** + * 疾病一级列表搜索 + */ + @GET("health-consultation/api/consult/conDepartment/selectDepartListSickVersionTwo") + suspend fun selectDepartListSick(@QueryMap params: MutableMap): ApiResponse> + /** + * 科室搜索 + */ + @GET("health-consultation/api/consult/conDepartment/selectDepartListVersionThree") + suspend fun selectDepartListNew(@QueryMap params: MutableMap): ApiResponse + + /** + * 筛选头的搜索 + */ + @GET("health-consultation/api/consult/conDepartment/selectDepartListByHospitalIdVersionTwo") + suspend fun selectDepartListByHospitalIdVersionTwo(@QueryMap params: MutableMap): ApiResponse + + /** + * 疾病搜索 + */ + @GET("health-consultation/api/consult/conSicks/selectSickListByDepartmentId") + suspend fun selectSickListByDepartmentId(@QueryMap params: MutableMap): ApiResponse> + /** + * 疾病搜索 + */ + @GET("health-consultation/api/consult/conResource/selectHospitalListVersionTwo") + suspend fun selectHospitalList(): ApiResponse + /** + * 个人中心进行中数量 + */ + @GET("health-consultation/api/consult/conSession/sessioningNum") + suspend fun sessioningNum(): ApiResponse + + /** + * 紧急联系人列表 + */ + @GET("/sys/api/emergencyContact/selectEmergencyContactList") + suspend fun selectEmergencyContactList(): ApiResponse> + /** + * 筛选医生搜索 + */ + @GET("health-consultation/api/consult/conDoctor/selectDictListByNHDS") + suspend fun selectDictListByNHDS(@QueryMap params: MutableMap): ApiResponse> + /** + * 关联医生搜索 + */ + @POST("health-consultation/api/consult/conDoctor/selectDictListBySickAndDepartment") + suspend fun selectDictListBySickAndDepartment(@Body requestBody: RequestBody): ApiResponse> + /** + * 根据医院id搜索医生 + */ + @GET("health-consultation/api/consult/conDoctor/selectDoctorByHospitalId") + suspend fun selectDoctorByHospitalId(@QueryMap params: MutableMap): ApiResponse> + /** + * 医院详情 + */ + @GET("health-consultation/api/consult/conResource/hospitalDetail") + suspend fun hospitalDetail(@QueryMap params: MutableMap): ApiResponse + + /** + * 医院关注 + */ + @GET("health-consultation/api/consult/conHospitalFollow/followHostital") + suspend fun followHostital(@QueryMap params: MutableMap): ApiResponse + + /** + * 科室搜索 + */ + @GET("health-consultation/api/consult/conDepartment/searchDepartList") + suspend fun searchDepartList(@QueryMap params: MutableMap): ApiResponse> + + /** + * 取消医院关注 + */ + @GET("health-consultation/api/consult/conHospitalFollow/cancelHostital") + suspend fun cancelHostital(@QueryMap params: MutableMap): ApiResponse + /** + * 医院评论 + */ + @GET("health-consultation/api/consult/conEvaluate/selectConEvaluateListByHospitalId") + suspend fun selectConEvaluateListByHospitalId(@QueryMap params: MutableMap): ApiResponse> + + /** + * 我的咨询 + */ + @GET("health-consultation/api/consult/conSession/selectSessionListByUserIdVersionTwo") + suspend fun selectSessionListByUserId(@QueryMap params: MutableMap): ApiResponse> + + /** + * 个人我的咨询 + */ + @GET("health-consultation/api/consult/conSession/selectSessionListByUserIdVersionThree") + suspend fun selectSessionListByUserIdVersionThree(@QueryMap params: MutableMap): ApiResponse> + + /** + * 通过IM会话列表匹配对应的图文咨询列表 + */ + @POST("/health-consultation/api/consult/conSession/selectSessionListPictureByUserId") + suspend fun selectSessionListPictureByUserId(@Body requestBody: RequestBody): ApiResponse> + + /** + * 医院评论 + */ + @GET("health-consultation/api/consult/conResource/selectHostitalAverageScore") + suspend fun selectHostitalAverageScore(@QueryMap params: MutableMap): ApiResponse + /** + * 获取预约详情 + */ + @GET("health-consultation/api/consult/conSession/sessionDetail") + suspend fun getAppointmentDetail(@QueryMap params: MutableMap): ApiResponse + /** + * 查询体检报告 + */ + @POST("health-archives/historyReport/getHistoryReportByPage") + suspend fun getPhysicalExaminationReport(@Body requestBody: RequestBody): ApiResponse + /** + * 取消音视频预约 + */ + @GET("health-consultation/api/consult/conSession/cancelSession") + suspend fun cancelAppointment(@QueryMap params: MutableMap): ApiResponse + /** + * 咨询评价 + */ + @POST("health-consultation/api/consult/conEvaluate/insertConEvaluate") + suspend fun submitConsultAppraise(@Body requestBody: RequestBody): ApiResponse + /** + * 咨询(预约单)详情的档案详情 + */ + @GET("/health-consultation/api/consult/medicalRecords/selectConMedicalRecordsByIdDoctor") + suspend fun getConsultArchivesDetail(@QueryMap params: MutableMap): ApiResponse + /** + * 咨询小助手 + */ + @GET("health-consultation/api/consult/conSession/insertUserAndHelperSession") + suspend fun submitAssistantConsultApply(): ApiResponse + /** + * 获取档案列表 + */ + @GET("health-consultation/api/consult/medicalRecords/selectConMedicalRecordsByMemberId") + suspend fun getArchivesList(@QueryMap params: MutableMap): ApiResponse> + + /** + * im历史消息 + */ + @GET("health-consultation/api/consult/conSession/selectImMessagePageListSession") + suspend fun selectImMessagePageListSession(@QueryMap params: MutableMap): ApiResponse> +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/HealthCheckNetApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/HealthCheckNetApi.kt new file mode 100644 index 0000000..9308948 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/HealthCheckNetApi.kt @@ -0,0 +1,338 @@ +package com.xjjk.healthyclients.data.api + +import com.xjjk.healthyclients.bean.CvdMainBean +import com.xjjk.healthyclients.bean.CvdRiskInfoBean +import com.xjjk.healthyclients.bean.CvdWarningHistoryBean +import com.xjjk.healthyclients.retrofit.intervention.CustomInterventionResponseResult +import retrofit2.Call +import retrofit2.http.GET +import retrofit2.http.Query + +interface HealthCheckNetApi { +// /** +// * 获取体检额度 +// */ +// @GET("cqyt/medicalUserLimitController/getUserLimit/{userId}") +// fun getUserLimit( +// @Path("userId") userid: String = "", +// @Query("hospitalId") hospitalId: String = "" +// ): Call> +// +// /** +// * 获取体检计划 +// */ +// @GET("cqyt/medicalPlanController/getMyMedicalPlan/{userId}") +// fun getMyMedicalPlan( +// @Path("userId") userid: String = DataStoreManager.getUserId().toString() +// ): Call> +// +// /** +// * 判断用户是否有体检记录 +// */ +// @GET("cqyt/medicalItemPackageController/checkUserSFHaveHospitalInfo/{userId}/{planId}") +// fun checkUserSFHaveHospitalInfo( +// @Path("userId") userid: String = DataStoreManager.getUserId().toString(), +// @Path("planId") planId: String +// ): Call> +// +// /** +// * 判断用户当前体检状态 +// */ +// @GET("cqyt/medicalUserFormController/getNowMedicalStatus/{userId}") +// fun getNowMedicalStatus( +// @Path("userId") userid: String = DataStoreManager.getUserId().toString() +// ): Call> +// +// /** +// * 获取体检首页视频 +// */ +// @GET("cqyt/medicalVideoController/{curPage}/{pageSize}") +// fun medicalVideoController( +// @Path("curPage") curPage: String = "1", +// @Path("pageSize") pageSize: String = "5" +// ): Call>> +// +// /** +// * 获取个人体检状态 +// */ +// @GET("cqyt/medicalPlanController/getMedicalOwnStatus/{departId}/{userId}") +// fun getMedicalOwnStatus( +// @Path("departId") curPage: String = DataStoreManager.getUserInfo().secondDepart.id, +// @Path("userId") pageSize: String = DataStoreManager.getUserId().toString() +// ): Call> +// +// /** +// * 查询体检医院 +// */ +// @GET("cqyt/medicalHospitalController/getMyHospitalList/{planId}/{userId}") +// fun getMyHospitalList( +// @Path("planId") planId: String, +// @Path("userId") pageSize: String = DataStoreManager.getUserId().toString() +// ): Call>> +// +// /** +// * 查询参检人员信息 +// */ +// @GET("cqyt/medicalUserFormController/getMedicalUserInfo/{userId}") +// fun getMedicalUserInfo( +// @Path("userId") userId: String = DataStoreManager.getUserId().toString() +// ): Call> +// +// /** +// * 根据医院id获取互斥项目 +// */ +// @GET("cqyt/medicalItemMutexController/getMutexListByHospitalId/{hospitalId}") +// fun getMutexListByHospitalId(@Path("hospitalId") hospitalId: String): Call>> +// +// /** +// * 根据身份证查询体检列表 +// */ +// @GET("cqyt/middleController/getCheckItemList") +// fun getCheckItemList(@Query("sfzh") sfzh: String?): Call>> +// +// /** +// * 新版体检列表 +// */ +// @GET("health-archives/historyReport/getHistoryReportByPage") +// fun getHistoryReportByPage(@Body requestBody: RequestBody): Call>> +// +// /** +// * 保存员工所选项目 +// */ +// @POST("cqyt/medicalUserFormController/saveOrUpdate/{userId}/{planId}/{saveStatus}") +// fun saveOrUpdate( +// @Path("userId") hospitalId: String, +// @Path("planId") planId: String, +// @Path("saveStatus") saveStatus: String, +// @Body any: SubmitItemBean +// ): Call> +// +// /** +// * 通过员工id获取体检套餐信息 +// */ +// @GET("cqyt/medicalItemPackageController/mealMustInterface/{userId}/{planId}") +// fun mealMustInterface( +// @Path("planId") planId: String, +// @Path("userId") userId: String = DataStoreManager.getUserId().toString(), +// @Query("hospitalId") hospitalId: String, +// @Query("queryFlag") queryFlag: String = "0" +// ): Call> +// +// /** +// * 参检日期及人数查询 +// */ +// @GET("cqyt/medicalUserFormController/getMedicalDatesAndNumOfPeople/{hospitalId}/{month}/{planId}") +// fun getMedicalDatesAndNumOfPeople( +// @Path("hospitalId") hospitalId: String, +// @Path("month") month: String, +// @Path("planId") planId: String +// ): Call> +// +// /** +// * 提交预约 +// */ +// @Headers("TIMEOUT:60000") +// @POST("cqyt/medicalOrder/addOrders") +// fun addOrders(@Body any: addOrdersRequestBean): Call> +// +// /** +// * 取消预约 +// */ +// @POST("cqyt/medicalOrder/cancelOrders") +// fun cancelOrders(@Body any: addOrdersRequestBean): Call> +// +// /** +// * 根据人员类型获取公告 +// */ +// @GET("cqyt/medicalAnnouncementInfoController/getNewInfo/{personType}") +// fun getNewInfo( +// @Path("personType") personType: String, +// @Query("departId") departId: String +// ): Call> +// +// /** +// * 获取预约二维码信息 +// */ +// @GET("cqyt/medicalUserFormController/appointmentQRCodeInterface//{userId}") +// fun appointmentQRCodeInterface( +// @Path("userId") personType: String = DataStoreManager.getUserId().toString() +// ): Call> +// +// /** +// * 查询体检信息 +// */ +// @GET("cqyt/middleController/getCheckItemBySfzhTotal") +// fun getCheckItemBySfzhTotal( +// @Query("sfzh") sfzh: String, +// @Query("tjrq") tjrq: String, +// @Query("type") type: String = "" +// ): Call> +// +// /** +// * 更新婚姻状态 +// */ +// @POST("cqyt/medicalUserFormController/updateMdMarriageStatus/{userId}/{status}") +// fun updateMdMarriageStatus( +// @Path("userId") userId: String = DataStoreManager.getUserId().toString(), +// @Path("status") status: String +// ): Call> +// +//// /** +//// * 查询体检信息(old) +//// */ +//// @GET("cqyt/middleController/getLastCheckItemException") +//// fun getLastCheckItemException(@Query("sfzh") sfzh: String): Call>> +// /** +// * 查询体检信息(new) +// */ +// @GET("health-archives/historyReport/getHistoryReportByNew") +// fun getLastCheckItemException(): Call> +// +// /** +// * 根据classId查询关联科室和疾病id数组 +// */ +// @POST("medical/uniItemClass/getOfficeIdsAndSicksIdsRelByClassId") +// fun getOfficeIdsAndSicksIdsRelByClassId(@Query("classId") classId: String): Call> +// +// /** +// * 登录接口 +// */ +// @POST("/sys/mLogin") +// fun mLogin(@Body any: LoginBean): Call + + /** + * 查询心血管首页数据 + */ + @GET("health-watch/watchH5Api/indexDataNew") + fun getCvdHomeData(@Query("userId") userId: String): Call> + /** + * 防范心梗 查询是否填写问卷 + */ + @GET("health-intervene/api/risk/riskMyocardialSuddenDeath/selectTfFillQuestion") + fun selectTfFillQuestion(@Query("type") type: String): Call> + /** + * 防范心梗 查询危险因素 + */ + @GET("health-intervene/api/risk/angiocarpyPreventionWarning/selectAngiocarpyPreventionWarningDOByUserId") + fun selectAngiocarpyPreventionWarningDOByUserId(@Query("type") type: String): Call> + + /** + * 查询预警历史数据 + */ + @GET("health-watch/watchH5Api/historicalWarn") + fun getCvdHistoryWarning( + @Query("eventType") eventType: String, + @Query("queryDate") queryDate: String, + @Query("userId") userId: String, + @Query("pageNo") pageNo: Int, + @Query("pageSize") pageSize: Int + ): Call>> + + /** + * 阈值设置 + */ + @GET("health-watch/watchH5Api/thresholdSetting") + fun thresholdSetting( + @Query("eventType") eventType: String, + @Query("uerId") userId: String, + @Query("warnMin") warnMin: Float, + @Query("warnMax") warnMax: Float + ): Call> +// +// /** +// * 获取胃肠镜检前问卷 +// */ +// @GET("medicalGi/phone/paperList/{userId}") +// fun getGiPaperList(@Path("userId") userId: String): Call>> +// +// /** +// * 提交胃肠镜检前问卷 +// */ +// @POST("medicalGi/phone/addApp") +// fun addGiPaperList(@Body any: HashMap): Call> +// +// /** +// * 获取胃肠镜体检状态 +// */ +// @GET("medicalGi/phone/getUserState/{userId}") +// fun getGiUserState( +// @Path("userId") userId: String = DataStoreManager.getUserId().toString() +// ): Call> +// +// /** +// * 获取参检日期及人数 +// */ +// @GET("medicalGi/phone/getDatesAndPeoples/{userId}")//health-medical-gi/ +// fun getGiDatesAndPeoples(@Path("userId") userId: String): Call>> +// +// /** +// * 取消胃肠镜体检预约 +// */ +// @POST("medicalGi/phone/cancelOrder") +// fun cancelGiOrder(@Body any: HashMap): Call> +// +// /** +// * 胃肠镜体检预约 +// */ +// @POST("medicalGi/phone/orderDate") +// fun orderGiDate(@Body any: HashMap): Call> +// +// /** +// * 查看胃肠镜报告列表 +// */ +// @GET("medicalGi/phone/reportList/{userId}") +// fun getGiReportList(@Path("userId") userId: String): Call>> +// +// /** +// * 胃肠镜体检报告详情 +// */ +// @GET("medicalGi/phone/report/{id}") +// fun getGiReport(@Path("id") id: String): Call> +// +// /** +// * 根据giType查询关联科室和疾病id数组 +// */ +// @POST("/medical/uniItemClass/getOfficeIdsAndSicksIdsRelByGiType") +// fun getOfficeIdsAndSicksIdsRelByGiType(@Query("giType") giType: String): Call> +// +// +// /** +// * 查询胃肠镜问卷报告 +// */ +// @GET("medicalGi/phone/getPaper/{userId}/{medicalYear}") +// fun getGiPaper( +// @Path("userId") id: String, +// @Path("medicalYear") medicalYear: String +// ): Call>> +// +// /** +// * 获取胃肠镜检查医院列表 +// */ +// @GET("medicalGi/phone/getGiHospitals/{prePlanId}/{userId}") +// fun getGiHospitals( +// @Path("prePlanId") prePlanId: String, +// @Path("userId") userId: String = DataStoreManager.getUserId().toString() +// ): Call>> +// +// /** +// * 保存预选医院信息 +// */ +// @POST("/medicalGi/phone/savePreSelect") +// fun saveHospitalPreSelect(@Body any: HashMap): Call> +// +// /** +// * 胃肠镜选择医院 +// */ +// @POST("/medicalGi/phone/saveSelectHospital") +// fun saveSelectHospital(@Body any: HashMap): Call> +// +// /** +// * 获取医院列表 +// */ +// @GET("/medicalGi/phone/getPlanGiHospitalList/{planId}/{userId}") +// fun getPlanGiHospitalList( +// @Path("planId") planId: String, +// @Path("userId") userId: String = DataStoreManager.getUserId().toString() +// ): Call>> +// +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/HealthRecordApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/HealthRecordApi.kt new file mode 100644 index 0000000..442517b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/HealthRecordApi.kt @@ -0,0 +1,170 @@ +package com.xjjk.healthyclients.data.api + + +import com.xjjk.healthyclients.bean.healthrecord.CheckRecordUserInfoBean +import com.xjjk.healthyclients.data.bean.ApiResponse +import retrofit2.http.GET +import retrofit2.http.QueryMap + +/** + * @author nanfeifei + * @time 2023/8/4 13:22 + * @description + */ +interface HealthRecordApi { +// /** +// * 健康数据分析 +// */ +// @GET("health-archives/api/archives/medicalDataAnalysis/selectMedicalDataAnalysisVOList") +// suspend fun getHealthDataAnalysisData(): ApiResponse> +// +// /** +// * 健康数据分析子项(比如:化学检查列表) +// */ +// @GET("health-archives/api/archives/medicalDataAnalysis/selectMedicalUniItemClassList") +// suspend fun getHealthDataAnalysisItemData(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 健康数据分析子项详情(比如:血常规) +// */ +// @GET("health-archives/api/archives/medicalUserResult/selectMedicalUserResult") +// suspend fun getHealthDataAnalysisItemDetailData(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 检查子项记录(比如:白细胞数) +// */ +// @GET("health-archives/api/archives/medicalUserResult/selectMedicalUserResultInfoById") +// suspend fun getHealthCheckItemRecordData(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 腰臀比 +// */ +// @GET("health-archives/api/archives/compute/waistHipRatio") +// suspend fun waistHipRatio(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 理想体重 +// */ +// @GET("health-archives/api/archives/compute/idealBodyWeight") +// suspend fun idealBodyWeight(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 能量需求 +// */ +// @GET("health-archives/api/archives/compute/energyDemand") +// suspend fun energyDemand(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 所有运动 +// */ +// @GET("health-archives/api/archives/compute/allExercise") +// suspend fun allExercise(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 减掉一公斤 +// */ +// @GET("health-archives/api/archives/compute/loseKilo") +// suspend fun loseKilo(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 一分钟了解自己 +// */ +// @GET("health-archives/api/archives/compute/knowYourselfInMinute") +// suspend fun knowYourselfInMinute(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 健康监测首页 +// */ +// @GET("health-archives/api/archives/healthMonitoring/selectHealthMonitoringInfo") +// suspend fun selectHealthMonitoringInfo(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 体重记录 +// */ +// @GET("health-archives/api/archives/healthMonitoring/selectHeightAndWeightBmiList") +// suspend fun selectHeightAndWeightBmiList(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 血脂记录 +// */ +// @GET("health-archives/api/archives/healthMonitoring/selectBloodFat") +// suspend fun selectBloodFat(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 血糖记录 +// */ +// @GET("health-archives/api/archives/healthMonitoring/selectBloodSugarList") +// suspend fun selectBloodSugarList(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 血压记录 +// */ +// @GET("health-archives/api/archives/healthMonitoring/selectBloodPresureList") +// suspend fun selectBloodPresureList(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 血糖详情 +// */ +// @GET("health-archives/api/archives/healthMonitoring/selectBloodSugarInfo") +// suspend fun selectBloodSugarInfo(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * BMI首页 +// */ +// @GET("health-archives/api/archives/healthMonitoring/selectHeightAndWeightBmi") +// suspend fun getBMIHomeData(): ApiResponse +// +// /** +// * 血压详情 +// */ +// @GET("health-archives/api/archives/healthMonitoring/selectBloodPresure") +// suspend fun selectBloodPresure(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 异常项列表 +// */ +// @GET("health-archives/api/archives/healthQuo/exceptionList") +// suspend fun getExceptionData(): ApiResponse> +// +// /** +// * 健康现状首页 +// */ +// @GET("health-archives/api/archives/healthQuo/info") +// suspend fun getHealthStatusData(): ApiResponse +// +// /** +// * 健康现状首页 +// */ +// @GET("health-archives/api/archives/medicalUserResult/selectMedicalMiddleResultExtVO") +// suspend fun getConclusionSuggestionData(@QueryMap params: MutableMap): ApiResponse +// + /** + * 体检报告人员信息 + */ + @GET("health-archives/historyReport/getHistoryReportById") + suspend fun getHistoryReportNoDetail(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 历年体检列表 +// */ +// @POST("health-archives/historyReport/getHistoryReportByPage") +// suspend fun getHistoryReportByPage(@Body requestBody: RequestBody): ApiResponse +// +// /** +// * 获取存在结论建议的日期列表 +// */ +// @GET("health-archives/api/archives/medicalUserResult/selectMedicalUserResultInfoExDate") +// suspend fun getConclusionSuggestionDateList(): ApiResponse> +// +// /** +// * 获取体检结论、建议语音文件 +// */ +// @GET("health-archives/historyReport/getVoiceUrl") +// suspend fun getReportVoiceUrl(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 生成体检结论、建议语音文件 +// */ +// @GET("health-archives/historyReport/convertVoice2") +// suspend fun convertReportVoiceUrl(@QueryMap params: MutableMap): ApiResponse +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/IMApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/IMApi.kt new file mode 100644 index 0000000..defcef0 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/IMApi.kt @@ -0,0 +1,28 @@ +package com.xjjk.healthyclients.data.api + +import com.xjjk.healthyclients.bean.im.IMInfoBean +import com.xjjk.healthyclients.data.bean.ApiResponse +import okhttp3.RequestBody +import retrofit2.http.Body +import retrofit2.http.GET +import retrofit2.http.POST +import retrofit2.http.QueryMap + +interface IMApi { + /** + * 获取IM登录参数 + */ + @GET("/health-im/wnapp/userSigAndroid") + suspend fun getIMSig(): ApiResponse + /** + * 结束IM应急咨询 + */ + @POST("/health-emergency/api/emergency/order/orderOver") + suspend fun finishIMEmergency(@Body requestBody: RequestBody): ApiResponse + /** + * 结束IM图文聊天 + */ + @GET("/health-consultation/api/consult/conSession/finishSession") + suspend fun finishIMImageText(@QueryMap params: MutableMap): ApiResponse + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/InterventionApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/InterventionApi.kt new file mode 100644 index 0000000..51f8cfd --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/InterventionApi.kt @@ -0,0 +1,447 @@ +package com.xjjk.healthyclients.data.api + +import com.sw.healthyclients.bean.intervention.NearbyAmbulanceBean +import com.xjjk.healthyclients.bean.AedNetworkingBean +import com.xjjk.healthyclients.bean.NearbyResourceBean +import com.xjjk.healthyclients.data.bean.ApiResponse +import retrofit2.http.GET +import retrofit2.http.QueryMap + +// +//import com.sw.healthyclients.bean.common.CommonSettingMenuBean +//import com.sw.healthyclients.bean.emergency.EmergencyGroupInfo +//import com.sw.healthyclients.bean.home.HomeWeightRankBean +//import com.sw.healthyclients.bean.intervention.AEDResultBean +//import com.sw.healthyclients.bean.intervention.DoctorListBean +//import com.sw.healthyclients.bean.intervention.ElectronicBookBean +//import com.sw.healthyclients.bean.intervention.EmergencySearchResponse +//import com.sw.healthyclients.bean.intervention.ImageTextBean +//import com.sw.healthyclients.bean.intervention.InterventionPlanBean +//import com.sw.healthyclients.bean.intervention.KnowledgeSuggestBean +//import com.sw.healthyclients.bean.intervention.KnowledgeSuggestDetailBean +//import com.sw.healthyclients.bean.intervention.MySportBean +//import com.sw.healthyclients.bean.intervention.MySportDetailBean +//import com.sw.healthyclients.bean.intervention.NearbyAmbulanceBean +//import com.sw.healthyclients.bean.intervention.NearbyResourceBean +//import com.sw.healthyclients.bean.intervention.PostHealthBean +//import com.sw.healthyclients.bean.intervention.PostHealthSecondaryBean +//import com.sw.healthyclients.bean.intervention.PsychologyConceptBean +//import com.sw.healthyclients.bean.intervention.ResourceStaffBean +//import com.sw.healthyclients.bean.intervention.RiskAssessmentResultBean +//import com.sw.healthyclients.bean.intervention.SelectFollowUpListBean +//import com.sw.healthyclients.bean.intervention.SelectMedicalResourceBean +//import com.sw.healthyclients.bean.intervention.SelectMedicinePrescriptionDTOListBean +//import com.sw.healthyclients.bean.intervention.SelectUserHaveNewTabBean +//import com.sw.healthyclients.bean.intervention.SportEffectBean +//import com.sw.healthyclients.bean.intervention.SportEffectVideoBean +//import com.sw.healthyclients.bean.intervention.SportWayBean +//import com.sw.healthyclients.bean.intervention.VisitRecordBean +//import com.sw.healthyclients.data.bean.ApiResponse +//import com.sw.healthyclients.ui.intervene2.bean.AskFollowCheckBean +//import com.sw.healthyclients.ui.intervene2.bean.DiabetesQuestionBean +//import com.sw.healthyclients.ui.intervene2.bean.EnrollBean +//import com.sw.healthyclients.ui.intervene2.bean.FoodOverWeightInterventionActionBean +//import com.sw.healthyclients.ui.intervene2.bean.FoodOverWeightListBean +//import com.sw.healthyclients.ui.intervene2.bean.FoodOverWeightRankBean +//import com.sw.healthyclients.ui.intervene2.bean.FoodWarningBean +//import com.sw.healthyclients.ui.intervene2.bean.MonitorResultBean +//import com.sw.healthyclients.ui.intervene2.bean.PracticeBean +//import com.sw.healthyclients.ui.intervene2.bean.RankBean +//import com.sw.healthyclients.ui.intervene2.bean.RankListResult +//import com.sw.healthyclients.ui.intervene2.bean.UserWeightInfoBean +//import com.sw.healthyclients.ui.intervene2.bean.WeightChangeBean +//import com.sw.healthyclients.ui.intervene2.bean.WeightChangeTrendBean +//import okhttp3.RequestBody +//import retrofit2.http.Body +//import retrofit2.http.GET +//import retrofit2.http.POST +//import retrofit2.http.QueryMap +// +interface InterventionApi { +// +// /** +// * 专家知识列表 +// */ +// @POST("health-intervene/api/knowledge/post/queryKnowledgeBySpecialist") +// suspend fun queryKnowledgeBySpecialist(@Body requestBody: RequestBody): ApiResponse> +// /** +// * 公共知识列表 +// */ +// @POST("health-intervene/api/knowledge/post/queryKnowledgeList") +// suspend fun queryKnowledgeList(@Body requestBody: RequestBody): ApiResponse> +// +// /** +// * 专家列表 +// */ +// @POST("health-intervene/api/knowledge/post/querySpecialistList") +// suspend fun querySpecialistList(@Body requestBody: RequestBody): ApiResponse> +// +// /** +// * 健康技能-电子书列表 +// */ +// @POST("health-intervene/api/knowledge/post/querySpecialistList") +// suspend fun getElectronicBookList(@Body requestBody: RequestBody): ApiResponse> +// /** +// * 体检可视化-Fragment中一级标签 +// */ +// @POST("health-intervene/api/knowledge/post/querySpecialistList") +// suspend fun getPrimaryTagListData(@Body requestBody: RequestBody): ApiResponse> +// /** +// * 体检可视化-Fragment中二级标签 +// */ +// @POST("health-intervene/api/knowledge/post/querySpecialistList") +// suspend fun getSecondaryTagListData(@Body requestBody: RequestBody): ApiResponse> +// +// /** +// * 岗位列表 +// */ +// @GET("health-intervene/health-answer/class/app/list") +// suspend fun selectPostListById(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 岗位列表 +// */ +// @GET("health-intervene/api/knowledge/post/knowledgeListByPostId") +// suspend fun knowledgeListByPostId(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 运动效果-视频列表 +// */ +// @GET("health-intervene/rest/health-food-exercise/fitness/class/list") +// suspend fun getSportVideoListData(@QueryMap params: MutableMap): ApiResponse +// /** +// * 运动效果-详情 +// */ +// @GET("health-intervene/rest/health-food-exercise/fitness/detail") +// suspend fun getSportVideoDetailData(@QueryMap params: MutableMap): ApiResponse +// /** +// * 我的运动 +// */ +// @GET("health-intervene/rest/health-food-exercise/fitness/record") +// suspend fun getMySportListData(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 获取运动方式 +// */ +// @GET("health-intervene/rest/health-food-exercise/fitness/fitnessList") +// suspend fun getSportWayListData(): ApiResponse> +// /** +// * 上传运动 +// */ +// @POST("health-intervene/rest/health-food-exercise/fitness/upload") +// suspend fun uploadSportData(@Body requestBody: RequestBody): ApiResponse +// +// /** +// * 急救联动-资源列表 +// */ +// @POST("health-intervene/rest/aid/resource/search") +// suspend fun getEmergencySearch(@Body requestBody: RequestBody): ApiResponse +// /** +// * 急救联动-AED +// */ +// @GET("health-emergency/api/aed/nearbyAed") +// suspend fun getNearbyAed(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 我的运动详情 +// */ +// @GET("health-intervene/rest/health-food-exercise/fitness/analysisInfo") +// suspend fun getMySportDetailData(@QueryMap params: MutableMap): ApiResponse +// /** +// * 获取应急IM群组信息 +// */ +// @GET("/health-emergency/api/emergency/createGroupMag") +// suspend fun getIMGroupInfo(@QueryMap params: MutableMap): ApiResponse +// /** +// * 干预-测评列表 +// */ +// @GET("health-intervene/rest/health-survey/assess/template/listNew") +// suspend fun getRiskAssessmentListData(@QueryMap params: MutableMap): ApiResponse +// + /** + * 附近医疗点 + */ + @GET("medical-center/api/resource/nearbyResource") + suspend fun nearbyResource(@QueryMap params: MutableMap): ApiResponse> + /** + * 附近救护车 + */ + @GET("medical-center/api/ambulance/nearbyAmbulance") + suspend fun nearbyAmbulance(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 查询最近医疗点和就诊记录 +// */ +// @POST("medical-center/api/chronicDiseaseUser/selectMedicalResource") +// suspend fun selectMedicalResource(@QueryMap params: MutableMap): ApiResponse +// /** +// * 通过id查询医疗点 +// */ +// @GET("medical-center/medicalCenter/medicalResource/queryById") +// suspend fun MedicalResourcequeryById(@QueryMap params: MutableMap): ApiResponse +// /** +// * 通过id查询医疗点 +// */ +// @GET("medical-center/api/resource/resourceStaff") +// suspend fun resourceStaff(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 查询慢病管理的tab +// */ +// @GET("medical-center/api/followUpRecord/user/tab") +// suspend fun selectUserHaveTab(@QueryMap params: MutableMap): ApiResponse +// /** +// * 随访记录 +// */ +// @GET("medical-center/api/followUpRecord/selectFollowUpList") +// suspend fun selectFollowUpList(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 申请随访校验 +// */ +// @GET("medical-center/api/followUpRecord/apply-check") +// suspend fun askFollowCheck(@QueryMap params: MutableMap): ApiResponse +// /** +// * 申请随访提交 +// */ +// @POST("medical-center/api/followUpRecord/user-apply") +// suspend fun askFollowSubmit(@Body requestBody: RequestBody): ApiResponse +// /** +// * 膳食处方 +// */ +// @GET("medical-center/api/dietaryPrescription/selectDietaryPrescriptionList") +// suspend fun selectDietaryPrescriptionList(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 运动处方 +// */ +// @GET("medical-center/api/sportsPrescription/selectSportsPrescriptionDTOList") +// suspend fun selectSportsPrescriptionDTOList(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 用药方案 +// */ +// @GET("medical-center/api/medicinePrescription/selectMedicinePrescriptionDTOList") +// suspend fun selectMedicinePrescriptionDTOList(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 就诊记录 +// */ +// @GET("medical-center/api/dailyDiagnosis/list") +// suspend fun quertVisitRecordList(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 是否填写基础问卷 +// */ +// @GET("health-intervene/api/psychology/psychologyEvaluateBase/selectPsychologyBaseExist") +// suspend fun selectPsychologyBaseExist(@QueryMap params: MutableMap): ApiResponse +// /** +// * 心理概念知识 +// */ +// @GET("health-intervene/app/psychology/psychologyConceptKnow/list") +// suspend fun psychologyConcept(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 心理答题知识推荐 +// */ +// @GET("health-intervene/api/psychology/answer/knowledge/page") +// suspend fun knowledgeSuggest(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 心理答题知识推荐详情 +// */ +// @GET("health-intervene/api/psychology/answer/knowledge") +// suspend fun knowledgeAnswerDetails(@QueryMap params: MutableMap): ApiResponse +// +// +// /** +// * 体重管理-首页活动列表 +// */ +// @GET("health-intervene/api/intervene/activity/list") +// suspend fun list(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 体重管理-用户报名活动 +// */ +// @GET("health-intervene/api/intervene/activity/user/registration") +// suspend fun registration(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 体重管理-用户报名数据 +// */ +// @GET("health-intervene/api/intervene/activity/signUp") +// suspend fun signUp(@QueryMap params: MutableMap): ApiResponse +// /** +// * 体重管理-体重变化 +// */ +// @GET("health-intervene/api/intervene/activity/weightChange") +// suspend fun weightChange(@QueryMap params: MutableMap): ApiResponse +// /** +// * 体重管理-活动排名 +// */ +// @GET("health-intervene/api/intervene/activity/rank") +// suspend fun rank(@QueryMap params: MutableMap): ApiResponse +// /** +// * 体重管理-更新体重 +// */ +// @GET("health-intervene/api/intervene/activity/user/updateWeight") +// suspend fun updateWeight(@QueryMap params: MutableMap): ApiResponse +// /** +// * 体重管理-数据监控 +// */ +// @GET("health-intervene/api/intervene/activity/monitor") +// suspend fun monitor(@QueryMap params: MutableMap): ApiResponse +// /** +// * 体重管理-活动历史 +// */ +// @GET("health-intervene/api/intervene/activity/history") +// suspend fun history(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 体重管理-全部排名 +// */ +// @GET("health-intervene/api/intervene/activity/all/rank") +// suspend fun actionRank(@QueryMap params: MutableMap): ApiResponse +// /** +// * 体重管理-体重变化趋势 +// */ +// @GET("health-intervene/api/intervene/activity/user/weightChangeTrend") +// suspend fun weightChangeTrend(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 营养慢病-实测 +// */ +// @GET("health-intervene/meals/api/cd-nutrient/calculate/practice") +// suspend fun practice(@QueryMap params: MutableMap): ApiResponse +// /** +// * 营养慢病-模拟 +// */ +// @POST("health-intervene/meals/api/cd-nutrient/calculate/simulate") +// suspend fun simulate(@Body requestBody: RequestBody): ApiResponse +// +// /** +// * 慢病预警-查询用户是否提交过问卷 +// */ +// @GET("health-intervene/meals/api/cd-forecast/survey/check") +// suspend fun surveyCheck(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 慢病预警-获取问卷信息 +// */ +// @GET("health-intervene/meals/api/cd-forecast/survey/info") +// suspend fun surveyInfo(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 提交问卷-慢病预警 +// */ +// @POST("health-intervene/meals/api/cd-forecast/survey/submit") +// suspend fun postAnswerSurveyData(@Body requestBody: RequestBody): ApiResponse +// +// +// /** +// * 慢病预警-实测 +// */ +// @GET("health-intervene/meals/api/cd-forecast/user/practice") +// suspend fun getUserPractice(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 慢病预警-模拟 +// */ +// @POST("health-intervene/meals/api/cd-forecast/user/simulate") +// suspend fun postUserSimulate(@Body requestBody: RequestBody): ApiResponse +// +// +// /** +// * 干预首页-心理数据(返回最新的心理评估结果) +// */ +// @GET("health-intervene/intervene-home/psychology") +// suspend fun interveneHomePsychology(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 干预首页-最新一天的膳食摄入(千卡) +// */ +// @GET("health-intervene/intervene-home/meals") +// suspend fun interveneHomeMeals(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 干预首页-知识模块数据(返回学习时长) +// */ +// @GET("health-intervene/intervene-home/knowledge") +// suspend fun interveneHomeKnowledge(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 干预首页-最新一天的运动消耗(卡) +// */ +// @GET("health-intervene/intervene-home/exercise") +// suspend fun interveneHomeExercise(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 干预首页-环境数据(返回最近的室外空气质量设备数据) +// */ +// @GET("health-intervene/intervene-home/environment") +// suspend fun interveneHomeEnvironment(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 干预首页-糖尿病(返回最新血糖) +// */ +// @GET("health-intervene/intervene-home/diabetes") +// suspend fun interveneHomeDiabetes(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 干预首页-心血管(手表返回最新心率) +// */ +// @GET("health-intervene/intervene-home/cardiovascular") +// suspend fun interveneHomeCardiovascular(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 干预首页-癌症(返回重点指标是否异常) +// */ +// @GET("health-intervene/intervene-home/cancer") +// suspend fun interveneHomeCancer(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 体重管理-获取当前用户是否已经参加活动 +// */ +// @GET("health-intervene/app/healthMealsWeightPlan/getJoinPlanId") +// suspend fun getWeightJoinPlanId(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 体重管理-活动列表 +// */ +// @GET("health-intervene/app/healthMealsWeightPlan/list") +// suspend fun getWeightPlanList(@QueryMap params: MutableMap): ApiResponse> +// +// /** +// * 体重管理-获取当前登录人身高体重及目标体重 +// */ +// @GET("health-intervene/app/healthMealsWeightPlan/getUserInfoByPlanId") +// suspend fun getUserWeightInfo(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 体重管理-活动报名 +// */ +// @POST("health-intervene/app/healthMealsWeightPlan/signUp") +// suspend fun postWeightPlanSignUp(@Body requestBody: RequestBody): ApiResponse +// +// /** +// * 体重管理-获取活动详情 +// */ +// @GET("health-intervene/app/healthMealsWeightPlan/getPlanInfo") +// suspend fun getWeightPlanInfo(@QueryMap params: MutableMap): ApiResponse +// /** +// * 体重管理-获取历史参与记录 +// */ +// @GET("health-intervene/app/healthMealsWeightPlan/joinHistory") +// suspend fun getWeightJoinHistory(@QueryMap params: MutableMap): ApiResponse> +// /** +// * 体重管理-分页获取计划排行榜 +// */ +// @GET("health-intervene/app/healthMealsWeightPlan/getPlanRank") +// suspend fun getWeightRank(@QueryMap params: MutableMap): ApiResponse +// /** +// * 体重管理-分页获取计划排行榜 +// */ +// @GET("health-intervene/app/healthMealsWeightPlan/getPlanRankNew") +// suspend fun getWeightRankNew(@QueryMap params: MutableMap): ApiResponse +// +// /** +// * 体重管理-更新体重 +// */ +// @GET("health-intervene/app/healthMealsWeightPlan/updateWeight") +// suspend fun getMealsUpdateWeight(@QueryMap params: MutableMap): ApiResponse +// +// +// + /** + * 心血管-AED组网 + */ + @GET("health-intervene/intervene/v2/aedEquipmentManger/nearbyAed") + suspend fun getAedNetworkingData(@QueryMap params: MutableMap): ApiResponse> + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/api/InterventionNetApi.kt b/app/src/main/java/com/xjjk/healthyclients/data/api/InterventionNetApi.kt new file mode 100644 index 0000000..726bd1b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/api/InterventionNetApi.kt @@ -0,0 +1,129 @@ +package com.xjjk.healthyclients.data.api + +import com.xjjk.healthyclients.retrofit.intervention.CustomInterventionResponseResult +import retrofit2.Call +import retrofit2.http.Body +import retrofit2.http.GET +import retrofit2.http.Header +import retrofit2.http.Headers +import retrofit2.http.POST +import retrofit2.http.Query +import java.util.SortedMap + +interface InterventionNetApi { + + /** + * 获取公钥 + */ + @Headers("urlType:levelTwo") + @GET("/gateway/sys/getPublicKey") + fun getPublicKey( + @Header("X-TIMESTAMP") timeStamp: String, + @Header("X-Sign") timeSign: String, + @Query("timeSign") timeSignStr: String + ): Call> + + /** + * 通过身份证获取Token + */ + @Headers("urlType:levelTwo") + @POST("/gateway/sys/thirdAppGetTokenByIdCard") + fun getTokenByIdCard( + @Header("X-TIMESTAMP") timeStamp: String, + @Header("X-Sign") signStr: String, + @Body idCardJson: SortedMap + ): Call> +// +// /** +// * 获取健康干预膳食信息 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/getOneUserNutrimentHealthScores") +// fun getUserNutriment(): Call> +// +// /** +// * 获取膳食信息顶部用户数据 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/getHomePageUserInfo") +// fun getFoodHomePageUserInfo(): Call> +// +// +// /** +// * 获取膳食信息底部数据 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/nutritionFood") +// fun getFoodHomePageNutritionFood(@Query("day") day: String): Call> +// +// /** +// * 获取单餐营养分析 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/queryUserTimes") +// fun getNutritionUserTimes( +// @Query("timesName") timesName: String, +// @Query("mainTimeDay") mainTimeDay: String +// ): Call> +// +// /** +// * 获取更多营养素 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/otherEnergyVOList") +// fun getOtherEnergyList( +// @Query("timesName") timesName: String, +// @Query("mainTimeDay") mainTimeDay: String +// ): Call>> +// +// +// /** +// * 食物营养排行榜 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/getQueryStFoodNutritionVOList") +// fun getStFoodNutritionList( +// @Query("timesName") timesName: String, +// @Query("mainTimeDay") mainTimeDay: String, +// @Query("type") type: Int +// ): Call>> +// +// /** +// * 获取单餐就餐数据 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/getWeChatOneTimesVOList") +// fun getOneTimesFoodList( +// @Query("timesName") timesName: String, +// @Query("mainTimeDay") mainTimeDay: String +// ): Call> +// +// /** +// * 获取单日营养分析 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/queryUserDayTimesNew") +// fun getDayNutritionUser( +// @Query("mainTimeDay") mainTimeDay: String +// ): Call> +// +// +// /** +// * 获取日就餐数据 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/getUserEatWeekTimes") +// fun getUserEatWeekTimes( +// @Query("days") mainTimeDay: String +// ): Call>> +// +// /** +// * 获取日就餐数据 +// */ +// @Headers("urlType:levelTwo") +// @GET("/gateway/thirdAppProgram/getMonthCalendarAndStatus") +// fun getMonthCalendarAndStatus( +// @Query("monthTime") monthTime: String +// ): Call> + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/bean/ApiResponse.kt b/app/src/main/java/com/xjjk/healthyclients/data/bean/ApiResponse.kt new file mode 100644 index 0000000..bc2c6dc --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/bean/ApiResponse.kt @@ -0,0 +1,17 @@ +package com.xjjk.healthyclients.data.bean + +/** + * 接口返回外层封装实体 + * + * @author LTP 2022/3/22 + */ +data class ApiResponse( + val result: T?, + var code: Int, + val message: String?, + val success: Boolean, + val timestamp: Long, + val ok: Boolean, + val msg: String?, + val data: T? +) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/repository/CommonRepository.kt b/app/src/main/java/com/xjjk/healthyclients/data/repository/CommonRepository.kt new file mode 100644 index 0000000..7b790d3 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/repository/CommonRepository.kt @@ -0,0 +1,145 @@ +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.CommonSettingMenuBean +import com.xjjk.healthyclients.bean.SelectUserInfoBean +import com.xjjk.healthyclients.bean.SelectUserMessageListBean +import com.xjjk.healthyclients.bean.UploadFileResultBean +import com.xjjk.healthyclients.data.api.CommonApi +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.superfuntion.toJson +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.MultipartBody +import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.asRequestBody +import okhttp3.RequestBody.Companion.toRequestBody +import java.io.File + + +object CommonRepository { + private val service by lazy { RetrofitManager.getService(CommonApi::class.java) } + suspend fun getCommonSettingMenuList(menuKey: String): ApiResponse> { + val params = mutableMapOf() + params["dictKey"] = menuKey + return apiCall { service.getCommonSettingMenuList(params)} + } + suspend fun uploadFile(file: File): ApiResponse{ + return apiCall { + val photoPart = MultipartBody.Part.createFormData("file", file.name, file.asRequestBody( + FileUtils.getMimeTypeFromMediaUrl(file.path)?.toMediaTypeOrNull() + )) + service.uploadFile(photoPart, "".toRequestBody("".toMediaTypeOrNull())) + } + } + suspend fun uploadFile(filesPath: MutableList, typeName: String = ""): ApiResponse>{ + val photos: LinkedHashMap = LinkedHashMap() //需要保证装在Map中顺序不变,所以需要使用LinkedHashMap + if (filesPath.size > 0) { + for (index in filesPath.indices) { + val file = File(filesPath[index]) + val photoPart = file.asRequestBody(FileUtils.getMimeTypeFromMediaUrl(file.path)?.toMediaTypeOrNull()) + //这里前面一部分是服务器要求你传的key,加上一个i,就可以动态设置key的长度 + photos["files" + "\"; filename=\"" + file.name] = photoPart + } + } + return apiCall { service.uploadFile(photos, typeName.toRequestBody("".toMediaTypeOrNull())) } + } + /** + * 首页用户弹窗 + */ + suspend fun selectUserNotice(type:String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map.put("type",type) + service.selectUserNotice(map) + } + } + + /** + * 查询用户信息 + */ + suspend fun selectUserInfo(): ApiResponse { + return apiCall { + val map = mutableMapOf() +// map.put("type",type) + service.selectUserInfo(map) + } + } + /** + * 校验token有效性 + */ + suspend fun selectTokenExpire(token:String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map.put("token",token) + service.selectTokenExpire(map) + } + } + /** + * 校验用户信息 + */ + suspend fun checkUserInfo(realname:String,idCard:String,phone:String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map.put("realname",realname) + map.put("idCard",idCard) + map.put("phone",phone) + service.checkUserInfo(map.toJson().toRequestBody()) + } + } + /** + * 修改密码 + */ + suspend fun resetUserPwd(newPassword:String,newPasswordConfirm:String,resetCode:String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map.put("newPassword",newPassword) + map.put("newPasswordConfirm",newPasswordConfirm) + map.put("resetCode",resetCode) + service.resetUserPwd(map.toJson().toRequestBody()) + } + } + /** + * 首页消息 + */ + suspend fun selectUserMessageList(pageNo:Int,pageSize:Int): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map.put("pageNo",pageNo) + map.put("pageSize",pageSize) + service.selectUserMessageList(map) + } + } + /** + * 首页消息已读 + */ + suspend fun changeAlRead(id:String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map.put("id",id) + service.changeAlRead(map) + } + } + /** + * 首页用户弹窗-选择多少天不显示 + */ + suspend fun chooseToDontShowUp(id:String,notShow:Int): ApiResponse { + return apiCall { + val map = mutableMapOf() + map.put("id",id) + map.put("notShow",notShow) + service.chooseToDontShowUp(map) + } + } + suspend fun getAppUpdateInfo(): ApiResponse{ + val params = mutableMapOf() + params["androidOrIos"] = 1 + params["packageName"] = BuildConfig.APPLICATION_ID + return apiCall { service.getAppUpdateInfo(params) } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/repository/ConsultantManagerRepository.kt b/app/src/main/java/com/xjjk/healthyclients/data/repository/ConsultantManagerRepository.kt new file mode 100644 index 0000000..cd6161a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/repository/ConsultantManagerRepository.kt @@ -0,0 +1,124 @@ +package com.xjjk.healthyclients.data.repository + +import com.sw.healthyclients.bean.guidance.ConsultDoctorIMChatInfo +import com.xjjk.healthyclients.bean.CommonSettingMenuBean +import com.xjjk.healthyclients.bean.guidance.ArchivesBean +import com.xjjk.healthyclients.bean.guidance.BaseHealthyInfoChildBean +import com.xjjk.healthyclients.bean.guidance.BaseHealthyInfoResultBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.data.api.ConsultantManagerApi +import com.xjjk.healthyclients.data.bean.ApiResponse +import com.xjjk.healthyclients.data.repository.EmergencyRepository.apiCall +import com.xjjk.healthyclients.retrofit.RetrofitManager +import com.xjjk.healthyclients.retrofit.RetrofitManager.toRequestBody +import com.xjjk.healthyclients.superfuntion.toJson +import com.xjjk.healthyclients.utils.ConstantUtils + + +object ConsultantManagerRepository { + private val service by lazy { RetrofitManager.getService(ConsultantManagerApi::class.java) } + suspend fun getConsultantArchivesData( + pageNumber: Int, + pageSize: Int + ): ApiResponse> { + val params = mutableMapOf() + params["pageNo"] = pageNumber + params["pageSize"] = pageSize + return apiCall { + service.getConsultantArchivesData( + params + ) + } + } + + suspend fun getConsultantManagerData( + pageNumber: Int, + pageSize: Int + ): ApiResponse> { + val params = mutableMapOf() + params["pageNo"] = pageNumber + params["pageSize"] = pageSize + return apiCall { + service.getConsultantManagerData( + params + ) + } + } + + suspend fun getMemberRelationList(): ApiResponse> { + return CommonRepository.getCommonSettingMenuList("family_member_relation") + } + + suspend fun addConsultant(consultantBean: ConsultantBean): ApiResponse { + return apiCall { service.addConsultant(consultantBean.toJson().toRequestBody()) } + } + + suspend fun updateConsultant(consultantBean: ConsultantBean): ApiResponse { + return apiCall { service.updateConsultant(consultantBean.toJson().toRequestBody()) } + } + + suspend fun deleteConsultant(idList: MutableList): ApiResponse { + val params = mutableMapOf() + params["param"] = idList + return apiCall { service.deleteConsultant(params.toJson().toRequestBody()) } + } + + suspend fun getMedicalHaveTimeList(): ApiResponse> { + return CommonRepository.getCommonSettingMenuList("medical_have_time") + } + + suspend fun getPhysicalExaminationReportList(): ApiResponse> { + return CommonRepository.getCommonSettingMenuList("tf_permission_health") + } + + suspend fun getLookMedicalList(): ApiResponse> { + return CommonRepository.getCommonSettingMenuList("tf_look_medical") + } + + suspend fun addArchives(archivesBean: ArchivesBean): ApiResponse { + return apiCall { service.addArchives(archivesBean.toJson().toRequestBody()) } + } + + suspend fun getArchivesDetail(id: String): ApiResponse { + val params = mutableMapOf() + params["id"] = id + return apiCall { service.getArchivesDetail(params) } + } + + /** + * 提交视频咨询预约申请 + * @param consultType 咨询类型,1代表图文, 2代表音视频,此处其实只有音视频会使用,所以给默认值音视频 + */ + suspend fun submitAudioVideoConsultApply( + doctorId: String?, + memberId: String?, + archivesId: String?, + appointmentTimeId: String?, + consultType: ConstantUtils.ConsultType = ConstantUtils.ConsultType.AUDIO_VIDEO_CONSULT + ): ApiResponse { + val params = mutableMapOf() + params["toAccount"] = doctorId + params["memberId"] = memberId + params["medicalRecordsId"] = archivesId + params["schedulingDateId"] = appointmentTimeId + params["contentType"] = consultType.type + return apiCall { service.submitAudioVideoConsultApply(params.toJson().toRequestBody()) } + } + suspend fun getBaseHealthyInfoSettingList(memberId: String?): ApiResponse> { + val params = mutableMapOf() + params["memberId"] = memberId + return apiCall { service.getBaseHealthyInfoSettingList(params) } + } + suspend fun submitBaseHealthInfo(list: MutableList): ApiResponse{ + val params = mutableMapOf() + params["list"] = list + return apiCall { service.submitBaseHealthInfo(params.toJson().toRequestBody()) } + } + suspend fun submitImageTextConsultApply(doctorId: String?, memberId: String?, archivesId: String?): ApiResponse { + val params = mutableMapOf() + params["memberId"] = memberId + params["toAccount"] = doctorId + params["medicalRecordsId"] = archivesId + return apiCall { service.submitImageTextConsultApply(params.toJson().toRequestBody()) } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/repository/DoctorRepository.kt b/app/src/main/java/com/xjjk/healthyclients/data/repository/DoctorRepository.kt new file mode 100644 index 0000000..36d503e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/repository/DoctorRepository.kt @@ -0,0 +1,46 @@ +package com.xjjk.healthyclients.data.repository + +import com.xjjk.healthyclients.bean.guidance.AppraiseBean +import com.sw.healthyclients.bean.guidance.DoctorBean +import com.xjjk.healthyclients.bean.guidance.AppointmentTimeBean +import com.xjjk.healthyclients.data.api.DoctorApi +import com.xjjk.healthyclients.data.bean.ApiResponse +import com.xjjk.healthyclients.data.repository.EmergencyRepository.apiCall +import com.xjjk.healthyclients.retrofit.RetrofitManager + + +object DoctorRepository { + private val service by lazy { RetrofitManager.getService(DoctorApi::class.java) } + suspend fun getDoctorInfo(doctorId: String?): ApiResponse { + val params = mutableMapOf() + params["doctorId"] = doctorId + return apiCall {service.getDoctorInfo(params)} + } + suspend fun getDoctorAppraise(doctorId: String?, pageNumber: Int, pageSize: Int): ApiResponse> { + val params = mutableMapOf() + params["doctorId"] = doctorId + params["pageNo"] = pageNumber + params["pageSize"] = pageSize + return apiCall {service.getDoctorAppraise(params)} + } + suspend fun followDoctor(doctorId: String?): ApiResponse { + val params = mutableMapOf() + params["doctorId"] = doctorId + return apiCall {service.followDoctor(params)} + } + suspend fun cancelFollowDoctor(doctorId: String?): ApiResponse { + val params = mutableMapOf() + params["doctorId"] = doctorId + return apiCall {service.cancelFollowDoctor(params)} + } + suspend fun getDoctorAppraiseData(doctorId: String?): ApiResponse { + val params = mutableMapOf() + params["doctorId"] = doctorId + return apiCall {service.getDoctorAppraiseData(params)} + } + suspend fun getDoctorSchedulingDate(doctorId: String?): ApiResponse> { + val params = mutableMapOf() + params["doctorId"] = doctorId + return apiCall {service.getDoctorSchedulingDate(params)} + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/repository/EmergencyRepository.kt b/app/src/main/java/com/xjjk/healthyclients/data/repository/EmergencyRepository.kt new file mode 100644 index 0000000..735ab0b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/repository/EmergencyRepository.kt @@ -0,0 +1,117 @@ +package com.xjjk.healthyclients.data.repository + +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.HospitalBean +import com.xjjk.healthyclients.bean.emergency.OrderThroughBean +import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean +import com.xjjk.healthyclients.data.api.EmergencyApi +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 EmergencyRepository : BaseRepository() { + private val service by lazy { RetrofitManager.getService(EmergencyApi::class.java) } + suspend fun getEmergencyData( + type: String, + latitude: Double, + longitude: Double + ): ApiResponse { + val map = mutableMapOf() + map["type"] = type + map["longitude"] = longitude + map["latitude"] = latitude + return apiCall { service.getEmergencyData(map) } + } + + suspend fun getEmergencyCall( + callType: String, + resourceId: String, + longitude: Double, + latitude: Double + ): ApiResponse { + var map = mutableMapOf() + map["callType"] = callType + map["resourceId"] = resourceId + map["longitude"] = longitude + map["latitude"] = latitude + return apiCall { service.getEmergencyCall(map.toJson().toRequestBody()) } + } + + suspend fun getEmergencyCallBack( + orderId: String, + sessionId: String, + operationUserId: String, + majorUserId: String + ): ApiResponse { + var map = mutableMapOf() + map["orderId"] = orderId + map["sessionId"] = sessionId + map["operationUserId"] = operationUserId + map["majorUserId"] = majorUserId + return apiCall { service.getEmergencyCallBack(map.toJson().toRequestBody()) } + } + + suspend fun getEmergencyCallOver(sessionId: String): ApiResponse { + var map = mutableMapOf() + map["param"] = sessionId + return apiCall { service.getEmergencyCallOver(map.toJson().toRequestBody()) } + } + suspend fun selectEmergencySeriousDiseaseListByState(pageNo:Int,pageSize:Int,state:Int): ApiResponse> { + val map = mutableMapOf() + map.put("pageNo",pageNo) + map.put("pageSize",pageSize) + map.put("state",state) + return apiCall { service.selectEmergencySeriousDiseaseListByState(map) } + } + suspend fun selectStationHospitalList(): ApiResponse> { + return apiCall { service.selectStationHospitalList() } + } + suspend fun selectEmergencySeriousDiseaseDOById(id:String): ApiResponse { + var map = mutableMapOf() + map["id"] = id + return apiCall { service.selectEmergencySeriousDiseaseDOById(map) } + } + suspend fun initUserOrderPage(pageNo:Int,pageSize:Int): ApiResponse { + var map = mutableMapOf() + map.put("pageNo",pageNo) + map.put("pageSize",pageSize) + return apiCall { service.initUserOrderPage(map) } + } + suspend fun orderThrough(id:String): ApiResponse { + var map = mutableMapOf() + map.put("id",id) + return apiCall { service.orderThrough(map) } + } + suspend fun getOrderBySessionId(sessionId:String): ApiResponse { + var map = mutableMapOf() + map.put("id",sessionId) + return apiCall { service.getOrderBySessionId(map) } + } + suspend fun appointmentSeeDoctor(bean: AddBigDiseaseSubmitBean): ApiResponse { + return apiCall { service.appointmentSeeDoctor(bean.toJson().toRequestBody()) } + } + + suspend fun getCommonSettingMenuList(): ApiResponse> { + return CommonRepository.getCommonSettingMenuList("category") + } + + + + suspend fun getIMGroupInfo(groupName: String, longitude: Double, + latitude: Double): ApiResponse { + var map = mutableMapOf() + map["longitude"] = longitude + map["latitude"] = latitude + map["name"] = groupName //群聊名称改为后台生成 + return apiCall { service.getIMGroupInfo(map) } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/repository/GuidanceRepository.kt b/app/src/main/java/com/xjjk/healthyclients/data/repository/GuidanceRepository.kt new file mode 100644 index 0000000..cbea853 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/repository/GuidanceRepository.kt @@ -0,0 +1,430 @@ +package com.xjjk.healthyclients.data.repository + +import com.xjjk.healthyclients.base.repository.BaseRepository +import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo +import com.xjjk.healthyclients.bean.guidance.AppointmentInformationBean +import com.xjjk.healthyclients.bean.guidance.ArchivesBean +import com.xjjk.healthyclients.bean.guidance.ConsultArchivesDetailBean +import com.xjjk.healthyclients.bean.guidance.DepartListBean +import com.xjjk.healthyclients.bean.guidance.DepartListBeanNew +import com.xjjk.healthyclients.bean.guidance.GuidanceListBean +import com.xjjk.healthyclients.bean.guidance.HospitalCommentBean +import com.xjjk.healthyclients.bean.guidance.SearchDepartListBean +import com.xjjk.healthyclients.bean.guidance.SickListBean +import com.xjjk.healthyclients.bean.guidance.hospitalDetailBean +import com.xjjk.healthyclients.bean.guidance.searchComprehensiveBean +import com.xjjk.healthyclients.bean.guidance.searchConDepartmentAllBean +import com.xjjk.healthyclients.bean.guidance.searchConResourceAllBean +import com.xjjk.healthyclients.bean.guidance.selectDictListByNHDSBean +import com.xjjk.healthyclients.bean.guidance.selectDictListByNHDSRequestBean +import com.xjjk.healthyclients.bean.guidance.selectDoctorByHospitalIdBean +import com.xjjk.healthyclients.bean.guidance.selectHospitalListBean +import com.xjjk.healthyclients.bean.guidance.selectHostitalAverageScoreBean +import com.xjjk.healthyclients.bean.guidance.selectSessionListByUserIdBean +import com.xjjk.healthyclients.bean.healthrecord.GetHistoryReportByPageBean +import com.xjjk.healthyclients.bean.user.SelectEmergencyContactListBean +import com.xjjk.healthyclients.data.api.GuidanceApi +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 GuidanceRepository : BaseRepository() { + private val service by lazy { RetrofitManager.getService(GuidanceApi::class.java) } + suspend fun selectDoctorRecommend( + pageNumber: Int, + pageSize: Int, + ): ApiResponse> { + val map = mutableMapOf() + map["pageNo"] = pageNumber + map["pageSize"] = pageSize + return apiCall { service.selectSessionListByDoctorIdUnit(map) } + } + + suspend fun selectSessionListByDoctorIdHelper( + pageNumber: Int, + pageSize: Int, + ): ApiResponse> { + val map = mutableMapOf() + map["pageNo"] = pageNumber + map["pageSize"] = pageSize + return apiCall { service.selectSessionListByDoctorIdHelper(map) } + } + +// suspend fun searchFirstpage(): ApiResponse { +// return apiCall { service.searchFirstpage() } +// } + + suspend fun searchConResourceAll( + pageNumber: Int, + pageSize: Int + ): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["pageNumber"] = pageNumber + map["pageSize"] = pageSize + service.searchConResourceAll(map) + } + } + + suspend fun searchConDepartmentAll( + pageNumber: Int, + pageSize: Int + ): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["pageNumber"] = pageNumber + map["pageSize"] = pageSize + service.searchConDepartmentAll(map) + } + } + + suspend fun searchconSicksAll( + pageNumber: Int, + pageSize: Int + ): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["pageNumber"] = pageNumber + map["pageSize"] = pageSize + service.searchConDepartmentAll(map) + } + } + + suspend fun searchComprehensive(content: String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map["search"] = content + service.searchComprehensive(map) + } + } + + suspend fun searchConDoctor( + content: String, + pageNumber: Int, + pageSize: Int + ): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["search"] = content + map["pageNumber"] = pageNumber + map["pageSize"] = pageSize + service.searchConDoctor(map) + } + } + + suspend fun searchConResource( + content: String, + pageNumber: Int, + pageSize: Int + ): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["search"] = content + map["pageNumber"] = pageNumber + map["pageSize"] = pageSize + service.searchConResource(map) + } + } + + suspend fun searchconSicksList( + content: String, + pageNumber: Int, + pageSize: Int + ): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["search"] = content + map["pageNumber"] = pageNumber + map["pageSize"] = pageSize + service.searchconSicksList(map) + } + } + + suspend fun searchConDepartment( + content: String, + pageNumber: Int, + pageSize: Int + ): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["search"] = content + map["pageNumber"] = pageNumber + map["pageSize"] = pageSize + service.searchConDepartment(map) + } + } + + suspend fun selectDepartListByHospitalId(parentId: String): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["hospitalId"] = parentId + service.selectDepartListByHospitalId(map) + } + } + suspend fun selectDepartListSick(parentId: String): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["parentId"] = parentId + service.selectDepartListSick(map) + } + } + suspend fun selectDepartListNew(parentId: String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map["parentId"] = parentId + service.selectDepartListNew(map) + } + } + + suspend fun selectDepartListByHospitalIdVersionTwo(hospitalId: String,departmentId: String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map["hospitalId"] = hospitalId + map["departmentId"] = departmentId + service.selectDepartListByHospitalIdVersionTwo(map) + } + } + + suspend fun selectSickListByDepartmentId(parentId: String): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["departmentId"] = parentId + service.selectSickListByDepartmentId(map) + } + } + + /** + * 查询医院,科室,疾病 + */ + suspend fun selectHospitalList(): ApiResponse { + return apiCall { + service.selectHospitalList() + } + } + /** + * 个人中心进行中数量 + */ + suspend fun sessioningNum(): ApiResponse { + return apiCall { + service.sessioningNum() + } + } + /** + * 紧急联系人列表 + */ + suspend fun selectEmergencyContactList(): ApiResponse> { + return apiCall { + service.selectEmergencyContactList() + } + } + + /** + * 查询医院,科室,疾病 + */ + suspend fun selectDictListByNHDS(bean: selectDictListByNHDSRequestBean): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["doctorName"] = bean.doctorName + map["hospitalId"] = bean.hospitalId + map["departmentId"] = bean.departmentId + map["sickId"] = bean.sickId + map["tfSort"] = bean.tfSort + map["pageNo"] = bean.pageNo + map["pageSize"] = bean.pageSize + service.selectDictListByNHDS(map) + } + } + /** + * 查询关联科室,疾病 + */ + suspend fun selectDictListBySickAndDepartment(officeIds:ArrayList,sicksIds:ArrayList): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["departmentIds"] = officeIds + map["sickIds"] = sicksIds + map["pageNo"] = 1 + map["pageSize"] = 100 + service.selectDictListBySickAndDepartment(map.toJson().toRequestBody()) + } + } + + /** + * 根据医院id查询医生 + */ + suspend fun selectDoctorByHospitalId(hospitalId: String): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["hospitalId"] = hospitalId + map["pageNo"] = "1" + map["pageSize"] = "6" + service.selectDoctorByHospitalId(map) + } + } + + /** + * 根据医院id查询详情 + */ + suspend fun hospitalDetail(hospitalId: String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map["id"] = hospitalId + service.hospitalDetail(map) + } + } + + + + /** + * 根据医院id查询详情 + */ + suspend fun followHostital(hospitalId: String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map["hospitalId"] = hospitalId + service.followHostital(map) + } + } + /** + * 科室搜索 + */ + suspend fun searchDepartList(search: String): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["name"] = search + service.searchDepartList(map) + } + } + + /** + * 根据医院id查询详情 + */ + suspend fun cancelHostital(hospitalId: String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map["hospitalId"] = hospitalId + service.cancelHostital(map) + } + } + + /** + * 医院评论 + */ + suspend fun selectConEvaluateListByHospitalId(hospitalId: String,pageNumber: Int,pageSize: Int): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["hospitalId"] = hospitalId + map["pageNo"] = pageNumber + map["pageSize"] = pageSize + service.selectConEvaluateListByHospitalId(map) + } + } + + /** + * 咨询列表 + */ + suspend fun selectSessionListByUserId(type: String,status: String,pageNumber: Int,pageSize: Int): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["type"] = type + map["status"] = status + map["pageNo"] = pageNumber + map["pageSize"] = pageSize + service.selectSessionListByUserId(map) + } + } + + /** + * 个人中心咨询列表 + */ + suspend fun selectSessionListByUserIdVersionThree(type: String,status: String,pageNumber: Int,pageSize: Int): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["type"] = type + map["status"] = status + map["pageNo"] = pageNumber + map["pageSize"] = pageSize + service.selectSessionListByUserIdVersionThree(map) + } + } + + suspend fun selectSessionListPictureByUserId(imIdList: MutableList): ApiResponse>{ + val params = mutableMapOf() + params["imIds"] = imIdList + return apiCall { service.selectSessionListPictureByUserId(params.toJson().toRequestBody()) } + } + + /** + * 医院全部评论 + */ + suspend fun selectHostitalAverageScore(hospitalId: String): ApiResponse { + return apiCall { + val map = mutableMapOf() + map["hospitalId"] = hospitalId + service.selectHostitalAverageScore(map) + } + } + suspend fun getAppointmentDetail(appointmentId: String): ApiResponse{ + val params = mutableMapOf() + params["id"] = appointmentId + return apiCall {service.getAppointmentDetail(params)} + } + suspend fun getPhysicalExaminationReport(pageNo: String,pageSize:String="100",userId:String): ApiResponse{ + val params = mutableMapOf() +// params["sfzh"] = cardNum + params["pageNo"] = pageNo + params["pageSize"] = pageSize + params["userId"] = userId + return apiCall { service.getPhysicalExaminationReport(params.toJson().toRequestBody()) } + } + suspend fun cancelAppointment(appointmentId: String): ApiResponse{ + val params = mutableMapOf() + params["id"] = appointmentId + return apiCall { service.cancelAppointment(params) } + } + + /** + * @param doctorId + * @param sessionId + * @param score + * @param content 评价内容 + * @param anonymity 是否匿名 true,匿名 false,不匿名 + */ + suspend fun submitConsultAppraise(doctorId: String?, sessionId: String?, score: Float, content: String, anonymity: Boolean): ApiResponse{ + val params = mutableMapOf() + if(!doctorId.isNullOrEmpty()){ + params["expert"] = doctorId + } + params["sessionId"] = sessionId + params["score"] = score.toString() + params["context"] = content + params["tfUnknow"] = if(anonymity) "1" else "0" + return apiCall { service.submitConsultAppraise(params.toJson().toRequestBody()) } + } + suspend fun getConsultArchivesDetail(archivesId: String): ApiResponse{ + val params = mutableMapOf() + params["id"] = archivesId + return apiCall { service.getConsultArchivesDetail(params) } + } + suspend fun submitAssistantConsultApply(): ApiResponse{ + return apiCall { service.submitAssistantConsultApply() } + } + suspend fun getArchivesList(memberId: String?): ApiResponse>{ + val params = mutableMapOf() + params["memberId"] = memberId + return apiCall { service.getArchivesList(params) } + } + + /** + * im历史消息 + */ + suspend fun selectImMessagePageListSession(groupid: String): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["groupId"] = groupid + map["pageNo"] = 1 + map["pageSize"] = 100 + service.selectImMessagePageListSession(map) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/repository/HealthRecordRepository.kt b/app/src/main/java/com/xjjk/healthyclients/data/repository/HealthRecordRepository.kt new file mode 100644 index 0000000..99294bf --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/repository/HealthRecordRepository.kt @@ -0,0 +1,149 @@ +import com.xjjk.healthyclients.base.repository.BaseRepository +import com.xjjk.healthyclients.bean.healthrecord.CheckRecordUserInfoBean +import com.xjjk.healthyclients.data.api.HealthRecordApi +import com.xjjk.healthyclients.data.bean.ApiResponse +import com.xjjk.healthyclients.retrofit.RetrofitManager + + +/** + * @author nanfeifei + * @time 2023/8/4 13:30 + * @description + */ +object HealthRecordRepository : BaseRepository() { + private val service by lazy { RetrofitManager.getService(HealthRecordApi::class.java) } +// suspend fun getHealthDataAnalysisData(): ApiResponse> { +// return apiCall { service.getHealthDataAnalysisData() } +// } +// suspend fun getHealthDataAnalysisItemData(id: String): ApiResponse> { +// val params = mutableMapOf() +// params["classId"] = id +// return apiCall { service.getHealthDataAnalysisItemData(params) } +// } +// suspend fun getHealthDataAnalysisItemDetailData(id: String): ApiResponse> { +// val params = mutableMapOf() +// params["modeId"] = id +// return apiCall { service.getHealthDataAnalysisItemDetailData(params) } +// } +// suspend fun getHealthCheckItemRecordData(id: String): ApiResponse { +// val params = mutableMapOf() +// params["modeId"] = id +// return apiCall { service.getHealthCheckItemRecordData(params) } +// } +// suspend fun waistHipRatio(sex: String,waist: String,hip: String): ApiResponse { +// val params = mutableMapOf() +// params["sex"] = sex +// params["waist"] = waist +// params["hip"] = hip +// return apiCall {service.waistHipRatio(params)} +// } +// +// suspend fun idealBodyWeight(age: String,height: String): ApiResponse { +// val params = mutableMapOf() +// params["age"] = age +// params["height"] = height +// return apiCall {service.idealBodyWeight(params)} +// } +// suspend fun energyDemand(sex: String,age: String,height: String,weight: String): ApiResponse { +// val params = mutableMapOf() +// params["sex"] = sex +// params["age"] = age +// params["height"] = height +// params["weight"] = weight +// return apiCall {service.energyDemand(params)} +// } +// suspend fun allExercise(): ApiResponse> { +// val params = mutableMapOf() +// return apiCall {service.allExercise(params)} +// } +// suspend fun loseKilo(exerciseId:String,weight:String): ApiResponse { +// val params = mutableMapOf() +// params["exerciseId"] = exerciseId +// params["weight"] = weight +// return apiCall {service.loseKilo(params)} +// } +// suspend fun knowYourselfInMinute(sex: String,age: String,height: String,weight: String): ApiResponse { +// val params = mutableMapOf() +// params["sex"] = sex +// params["age"] = age +// params["height"] = height +// params["weight"] = weight +// return apiCall {service.knowYourselfInMinute(params)} +// } +// suspend fun selectHealthMonitoringInfo(): ApiResponse { +// val params = mutableMapOf() +// return apiCall {service.selectHealthMonitoringInfo(params)} +// } +// suspend fun selectHeightAndWeightBmiList(year:String): ApiResponse> { +// val params = mutableMapOf() +// params["year"] = year +// return apiCall {service.selectHeightAndWeightBmiList(params)} +// } +// suspend fun selectBloodFat(year:String): ApiResponse> { +// val params = mutableMapOf() +// params["year"] = year +// return apiCall {service.selectBloodFat(params)} +// } +// suspend fun selectBloodSugarList(year:String): ApiResponse> { +// val params = mutableMapOf() +// params["year"] = year +// return apiCall { service.selectBloodSugarList(params) } +// } +// +// suspend fun getBMIHomeData(): ApiResponse { +// return apiCall {service.getBMIHomeData()} +// } +// suspend fun selectBloodPresureList(year:String): ApiResponse> { +// val params = mutableMapOf() +// params["year"] = year +// return apiCall {service.selectBloodPresureList(params)} +// } +// suspend fun selectBloodSugarInfo(): ApiResponse { +// val params = mutableMapOf() +// return apiCall {service.selectBloodSugarInfo(params)} +// } +// suspend fun selectBloodPresure(): ApiResponse { +// val params = mutableMapOf() +// return apiCall { service.selectBloodPresure(params) } +// } +// suspend fun getExceptionData(): ApiResponse> { +// return apiCall {service.getExceptionData()} +// } +// suspend fun getHealthStatusData(): ApiResponse { +// return apiCall {service.getHealthStatusData()} +// } +// suspend fun getConclusionSuggestionData(date: String): ApiResponse { +// val params = mutableMapOf() +// params["year"] = date +// return apiCall {service.getConclusionSuggestionData(params)} +// } + suspend fun getHistoryReportNoDetail(id: String): ApiResponse { + val params = mutableMapOf() + params["id"] = id + return apiCall {service.getHistoryReportNoDetail(params)} + } +// suspend fun getHistoryReportByPage(pageNo: String,pageSize:String="100",userId:String): ApiResponse { +// val params = mutableMapOf() +// params["pageNo"] = pageNo +// params["pageSize"] = pageSize +// params["userId"] = userId +// return apiCall { service.getHistoryReportByPage(params.toJson().toRequestBody()) } +// } +// +// suspend fun getConclusionSuggestionDateList(): ApiResponse> { +// return apiCall {service.getConclusionSuggestionDateList()} +// } +// +// suspend fun getReportVoiceUrl(id: String): ApiResponse { +// val params = mutableMapOf() +// params["resultId"] = id +// return apiCall {service.getReportVoiceUrl(params)} +// } +// +// suspend fun convertReportVoiceUrl(id: String, type: Int): ApiResponse { +// val params = mutableMapOf() +// params["resultId"] = id +// params["type"] = type +// return apiCall {service.convertReportVoiceUrl(params)} +// } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/repository/IMRepository.kt b/app/src/main/java/com/xjjk/healthyclients/data/repository/IMRepository.kt new file mode 100644 index 0000000..4d3535d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/repository/IMRepository.kt @@ -0,0 +1,30 @@ +package com.xjjk.healthyclients.data.repository + +import com.xjjk.healthyclients.base.repository.BaseRepository +import com.xjjk.healthyclients.bean.im.IMInfoBean +import com.xjjk.healthyclients.data.api.IMApi +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 IMRepository: BaseRepository() { + private val service by lazy { RetrofitManager.getService(IMApi::class.java) } + suspend fun getIMSig(): ApiResponse { + return apiCall { service.getIMSig() } + } + suspend fun finishIMEmergency(id: String): ApiResponse{ + val map = mutableMapOf() + map["id"] = id + return apiCall { service.finishIMEmergency(map.toJson().toRequestBody()) } + } + + suspend fun finishIMImageText(id: String): ApiResponse{ + val map = mutableMapOf() + map["id"] = id + return apiCall { service.finishIMImageText(map) } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/data/repository/InterventionRepository.kt b/app/src/main/java/com/xjjk/healthyclients/data/repository/InterventionRepository.kt new file mode 100644 index 0000000..7b06fa5 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/repository/InterventionRepository.kt @@ -0,0 +1,771 @@ +import com.sw.healthyclients.bean.intervention.NearbyAmbulanceBean +import com.xjjk.healthyclients.bean.AedNetworkingBean +import com.xjjk.healthyclients.bean.NearbyResourceBean +import com.xjjk.healthyclients.data.api.InterventionApi +import com.xjjk.healthyclients.data.bean.ApiResponse +import com.xjjk.healthyclients.data.repository.EmergencyRepository.apiCall +import com.xjjk.healthyclients.retrofit.RetrofitManager + +// +//import com.sw.healthyclients.bean.common.CommonSettingMenuBean +//import com.sw.healthyclients.bean.emergency.EmergencyGroupInfo +//import com.sw.healthyclients.bean.home.HomeWeightRankBean +//import com.sw.healthyclients.bean.intervention.AEDBeanRequest +//import com.sw.healthyclients.bean.intervention.AEDResultBean +//import com.sw.healthyclients.bean.intervention.DoctorListBean +//import com.sw.healthyclients.bean.intervention.ElectronicBookBean +//import com.sw.healthyclients.bean.intervention.EmergencySearchRequest +//import com.sw.healthyclients.bean.intervention.EmergencySearchResponse +//import com.sw.healthyclients.bean.intervention.ImageTextBean +//import com.sw.healthyclients.bean.intervention.InterventionPlanBean +//import com.sw.healthyclients.bean.intervention.KnowledgeSuggestBean +//import com.sw.healthyclients.bean.intervention.KnowledgeSuggestDetailBean +//import com.sw.healthyclients.bean.intervention.MySportBean +//import com.sw.healthyclients.bean.intervention.MySportDetailBean +//import com.sw.healthyclients.bean.intervention.NearbyAmbulanceBean +//import com.sw.healthyclients.bean.intervention.NearbyResourceBean +//import com.sw.healthyclients.bean.intervention.PostHealthBean +//import com.sw.healthyclients.bean.intervention.PostHealthSecondaryBean +//import com.sw.healthyclients.bean.intervention.PsychologyConceptBean +//import com.sw.healthyclients.bean.intervention.ResourceStaffBean +//import com.sw.healthyclients.bean.intervention.RiskAssessmentResultBean +//import com.sw.healthyclients.bean.intervention.SelectFollowUpListBean +//import com.sw.healthyclients.bean.intervention.SelectMedicalResourceBean +//import com.sw.healthyclients.bean.intervention.SelectMedicinePrescriptionDTOListBean +//import com.sw.healthyclients.bean.intervention.SelectUserHaveNewTabBean +//import com.sw.healthyclients.bean.intervention.SportEffectBean +//import com.sw.healthyclients.bean.intervention.SportEffectVideoBean +//import com.sw.healthyclients.bean.intervention.SportWayBean +//import com.sw.healthyclients.bean.intervention.VisitRecordBean +//import com.sw.healthyclients.data.api.InterventionApi +//import com.sw.healthyclients.data.bean.ApiResponse +//import com.sw.healthyclients.data.repository.EmergencyRepository.apiCall +//import com.sw.healthyclients.retrofit.RetrofitManager +//import com.sw.healthyclients.retrofit.RetrofitManager.toRequestBody +//import com.sw.healthyclients.superfuntion.toJson +//import com.sw.healthyclients.ui.intervene2.bean.AskFollowCheckBean +//import com.sw.healthyclients.ui.intervene2.bean.DiabetesQuestionBean +//import com.sw.healthyclients.ui.intervene2.bean.EnrollBean +//import com.sw.healthyclients.ui.intervene2.bean.FoodOverWeightInterventionActionBean +//import com.sw.healthyclients.ui.intervene2.bean.FoodOverWeightListBean +//import com.sw.healthyclients.ui.intervene2.bean.FoodOverWeightRankBean +//import com.sw.healthyclients.ui.intervene2.bean.FoodWarningBean +//import com.sw.healthyclients.ui.intervene2.bean.MonitorResultBean +//import com.sw.healthyclients.ui.intervene2.bean.PracticeBean +//import com.sw.healthyclients.ui.intervene2.bean.RankBean +//import com.sw.healthyclients.ui.intervene2.bean.RankListResult +//import com.sw.healthyclients.ui.intervene2.bean.UserWeightInfoBean +//import com.sw.healthyclients.ui.intervene2.bean.UserWeightSignUpBean +//import com.sw.healthyclients.ui.intervene2.bean.WeightChangeBean +//import com.sw.healthyclients.ui.intervene2.bean.WeightChangeTrendBean +// +object InterventionRepository { + private val service by lazy { RetrofitManager.getService(InterventionApi::class.java) } +// +// /** +// * 专家知识列表 +// */ +// suspend fun queryKnowledgeBySpecialist( +// specialistId: String, +// pageNo: Int, +// pageSize: Int +// ): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["pageNo"] = pageNo +// map["pageSize"] = pageSize +// map["specialistId"] = specialistId +// service.queryKnowledgeBySpecialist(map.toJson().toRequestBody()) +// } +// } +// +// /** +// * 公共知识列表 +// */ +// suspend fun queryKnowledgeList( +// knowledgeType: String, +// sourceType: Int?, +// pageNo: Int, +// pageSize: Int +// ): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["pageNo"] = pageNo +// map["pageSize"] = pageSize +// map["flag"] = knowledgeType +// if (sourceType != null) { +// map["type"] = sourceType.toString() +// } +// service.queryKnowledgeList(map.toJson().toRequestBody()) +// } +// } +// +// /** +// * 专家列表 +// */ +// suspend fun querySpecialistList(pageNo: Int, pageSize: Int): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["pageNo"] = pageNo +// map["pageSize"] = pageSize +// service.querySpecialistList(map.toJson().toRequestBody()) +// } +// } +// +// suspend fun getElectronicBookList( +// pageNo: Int, +// pageSize: Int +// ): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["pageNo"] = pageNo +// map["pageSize"] = pageSize +// service.getElectronicBookList(map.toJson().toRequestBody()) +// } +// } +// +// suspend fun getPrimaryTagListData(): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// service.getPrimaryTagListData(map.toJson().toRequestBody()) +// } +// } +// +// suspend fun getSecondaryTagListData(): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// service.getSecondaryTagListData(map.toJson().toRequestBody()) +// } +// } +// +// /** +// * 岗位列表 +// */ +// suspend fun selectPostListById(classPatentNo: String="",classNo: String=""): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["classPatentNo"] = classPatentNo +// map["classNo"] = classNo +// service.selectPostListById(map) +// } +// } +// /** +// * 查询慢病管理的tab +// */ +// suspend fun selectUserHaveTab(): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// service.selectUserHaveTab(map) +// } +// } +// /** +// * 随访记录 +// */ +// suspend fun selectFollowUpList(type:Int,pageNo:Int,pageSize:Int): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["type"]=type +// map["pageNo"]=pageNo +// map["pageSize"]=pageSize +// service.selectFollowUpList(map) +// } +// } +// +// /** +// * 申请随访记录校验 +// */ +// suspend fun askFollowCheck(): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// service.askFollowCheck(map) +// } +// } +// +// /** +// * 申请随访提交 +// */ +// suspend fun askFollowSubmit(content:String): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map.put("applications",content) +// service.askFollowSubmit(map.toJson().toRequestBody()) +// } +// } +// /** +// * 膳食处方 +// */ +// suspend fun selectDietaryPrescriptionList(type:Int): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["type"]=type +// service.selectDietaryPrescriptionList(map) +// } +// } +// /** +// * 运动处方 +// */ +// suspend fun selectSportsPrescriptionDTOList(type:Int): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["type"]=type +// service.selectSportsPrescriptionDTOList(map) +// } +// } +// /** +// * 用药方案 +// */ +// suspend fun selectMedicinePrescriptionDTOList(type:Int): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["type"]=type +// service.selectMedicinePrescriptionDTOList(map) +// } +// } +// /** +// * 就诊记录 +// */ +// suspend fun quertVisitRecordList(): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// service.quertVisitRecordList(map) +// } +// } +// +// /** +// * 岗位二级列表 +// */ +// suspend fun knowledgeListByPostId( +// flag: String, +// id: String +// ): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["postId"] = id +// map["flag"] = flag +// service.knowledgeListByPostId(map) +// } +// } +// +// suspend fun getSportVideoListData(tabId: String): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// if (tabId.isNotEmpty()) { +// map["category"] = tabId +// } +// service.getSportVideoListData(map) +// } +// } +// +// suspend fun getSportVideoDetailData(itemId: Int): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["fitnessNo"] = itemId +// service.getSportVideoDetailData(map) +// } +// } +// +// suspend fun getMySportListData( +// pageNo: Int, +// pageSize: Int +// ): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["pageNum"] = pageNo +// map["pageSize"] = pageSize +// service.getMySportListData(map) +// } +// } +// +// suspend fun getEmergencySearch(bean: EmergencySearchRequest): ApiResponse { +// return apiCall { +// service.getEmergencySearch(bean.toJson().toRequestBody()) +// } +// } +// suspend fun getNearbyAed(bean: AEDBeanRequest): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// if(bean.longitude>0){ +// map["longitude"] = bean.longitude +// } +// if(bean.latitude>0){ +// map["latitude"] = bean.latitude +// } +// map["radiusRange"] = bean.radiusRange +// map["aedNum"] = "" +// service.getNearbyAed(map) +// } +// } +// +// suspend fun getSportWayListData(): ApiResponse> { +// return apiCall { service.getSportWayListData() } +// } +// +// suspend fun uploadSportData( +// sportWayId: Int, +// sportMinutes: Int, +// videoPath: String +// ): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["fitnessNo"] = sportWayId +// map["minutes"] = sportMinutes +// map["video"] = videoPath +// service.uploadSportData(map.toJson().toRequestBody()) +// } +// } +// +// suspend fun getMySportDetailData(id: Int): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["id"] = id +// service.getMySportDetailData(map) +// } +// } +// +// /** +// * 急救联动发起咨询 +// * @param type 咨询类型0:图文 1:视频 +// */ +// suspend fun getIMGroupInfo(name: String, longitude: Double, +// latitude: Double, type: String): ApiResponse { +// var map = mutableMapOf() +// map["longitude"] = longitude +// map["latitude"] = latitude +// map["type"] = type +// map["name"] = name +// return apiCall { service.getIMGroupInfo(map) } +// } +// suspend fun getRiskAssessmentListData(pageType: Int): ApiResponse{ +// var map = mutableMapOf() +// map["module"] = pageType +// return apiCall { service.getRiskAssessmentListData(map) } +// } +// + suspend fun nearbyResource(name:String="",longitude: Double,latitude:Double,resourceNum:Int): ApiResponse> { + var map = mutableMapOf() + map["name"] = name + map["longitude"] = longitude + map["latitude"] = latitude + map["radiusRange"] = 100000 + map["resourceNum"] = resourceNum + return apiCall { service.nearbyResource(map) } + } + + suspend fun nearbyAmbulance(longitude: Double,latitude:Double): ApiResponse> { + var map = mutableMapOf() + map["longitude"] = longitude + map["latitude"] = latitude + map["radiusRange"] = 100000 + return apiCall { service.nearbyAmbulance(map) } + } +// +// suspend fun selectMedicalResource(longitude: Double,latitude:Double): ApiResponse{ +// var map = mutableMapOf() +// map["longitude"] = longitude +// map["latitude"] = latitude +// return apiCall { service.selectMedicalResource(map) } +// } +// suspend fun MedicalResourcequeryById(id:String): ApiResponse{ +// var map = mutableMapOf() +// map["id"] = id +// return apiCall { service.MedicalResourcequeryById(map) } +// } +// suspend fun resourceStaff(id:String): ApiResponse>{ +// var map = mutableMapOf() +// map["resourceId"] = id +// return apiCall { service.resourceStaff(map) } +// } +// +// /** +// * 体重管理-首页活动列表 +// */ +// suspend fun list( +// isJoin: Boolean, +// pageNo: Int, +// pageSize: Int +// ): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["isJoin"] = isJoin +// map["pageNo"] = pageNo +// map["pageSize"] = pageSize +// service.list(map) +// } +// } +// +// /** +// * 体重管理-用户报名 +// */ +// suspend fun registration( +// interveneId: String, +// height: String, +// weight: String, +// type: String +// ): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["interveneId"] = interveneId +// map["height"] = height +// map["weight"] = weight +// map["type"] = type +// service.registration(map) +// } +// } +// /** +// * 体重管理-用户报名数据 +// */ +// suspend fun signUp( +// interveneId: String +// ): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["interveneId"] = interveneId +// service.signUp(map) +// } +// } +// /** +// * 体重管理-体重变化 +// */ +// suspend fun weightChange( +// matchId: String +// ): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["matchId"] = matchId +// service.weightChange(map) +// } +// } +// /** +// * 体重管理-活动排名 +// */ +// suspend fun rank( +// interveneId: String +// ): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["interveneId"] = interveneId +// service.rank(map) +// } +// } +// /** +// * 体重管理-更新体重 +// */ +// suspend fun updateWeight( +// interveneId: String, +// weight: String +// ): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["interveneId"] = interveneId +// map["weight"] = weight +// service.updateWeight(map) +// } +// } +// /** +// * 体重管理-数据监控 +// */ +// suspend fun monitor( +// interveneId: String, +// startTime: String, +// endTime: String +// ): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["interveneId"] = interveneId +// map["startTime"] = startTime +// map["endTime"] = endTime +// service.monitor(map) +// } +// } +// +// /** +// * 体重管理-活动历史 +// */ +// suspend fun history( +// pageNo: Int, +// pageSize: Int +// ): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["pageNo"] = pageNo +// map["pageSize"] = pageSize +// service.history(map) +// } +// } +// /** +// * 体重管理-全部排名 +// */ +// suspend fun actionRank(column:String,interveneId:String, +// pageNo: Int, +// pageSize: Int +// ): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["pageNo"] = pageNo +// map["pageSize"] = pageSize +// map["column"] = column +// map["order"] = "asc" +// map["interveneId"] = interveneId +// service.actionRank(map) +// } +// } +// /** +// * 体重管理-全部排名 +// */ +// suspend fun weightChangeTrend(matchId:String +// ): ApiResponse> { +// return apiCall { +// val map = mutableMapOf() +// map["matchId"] = matchId +// service.weightChangeTrend(map) +// } +// } +// /** +// * 营养慢病-实测 +// */ +// suspend fun practice(startDate:String,endDate:String +// ): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["startDate"] = startDate +// map["endDate"] = endDate +// service.practice(map) +// } +// } +// /** +// * 营养慢病-实测 +// */ +// suspend fun simulate(bean : PracticeBean.BasicDataDTO): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// service.simulate(bean.toJson().toRequestBody()) +// } +// } +// +// +// /** +// * 慢病预警-查询用户是否提交过问卷 +// */ +// suspend fun surveyCheck(): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// service.surveyCheck(map) +// } +// } +// +// /** +// * 慢病预警-获取问卷信息 +// */ +// suspend fun surveyInfo(): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// service.surveyInfo(map) +// } +// } +// +// +// /** +// * 提交问卷-慢病预警 +// */ +// suspend fun postAnswerSurveyData(map: MutableMap): ApiResponse { +// return apiCall { +// service.postAnswerSurveyData(map.toJson().toRequestBody()) +// +// } +// } +// +// /** +// * 慢病预警-实测 +// */ +// suspend fun getUserPractice(startDate:String,endDate:String): ApiResponse { +// return apiCall { +// val map = mutableMapOf() +// map["startDate"] = startDate +// map["endDate"] = endDate +// service.getUserPractice(map) +// } +// } +// +// /** +// * 慢病预警-实测 +// */ +// suspend fun postUserSimulate(bean: FoodWarningBean.BasicData): ApiResponse { +// return apiCall { +// service.postUserSimulate(bean.toJson().toRequestBody()) +// } +// } +// +// suspend fun selectPsychologyBaseExist(): ApiResponse{ +// var map = mutableMapOf() +// return apiCall { service.selectPsychologyBaseExist(map) } +// } +// suspend fun psychologyConcept(): ApiResponse>{ +// var map = mutableMapOf() +// map.put("pageNo",1) +// map.put("pageSize",100) +// return apiCall { service.psychologyConcept(map) } +// } +// suspend fun knowledgeSuggest(): ApiResponse>{ +// var map = mutableMapOf() +// map.put("pageNo",1) +// map.put("pageSize",100) +// return apiCall { service.knowledgeSuggest(map) } +// } +// suspend fun knowledgeAnswerDetails(id:String): ApiResponse{ +// var map = mutableMapOf() +// map.put("id",id) +// return apiCall { service.knowledgeAnswerDetails(map) } +// } +// +// /** +// * 干预首页 8个接口 +// */ +// suspend fun interveneHomePsychology(): ApiResponse{ +// val map = mutableMapOf() +// return apiCall { service.interveneHomePsychology(map) } +// } +// suspend fun interveneHomeMeals(): ApiResponse{ +// val map = mutableMapOf() +// return apiCall { service.interveneHomeMeals(map) } +// } +// suspend fun interveneHomeKnowledge(): ApiResponse{ +// val map = mutableMapOf() +// return apiCall { service.interveneHomeKnowledge(map) } +// } +// suspend fun interveneHomeExercise(): ApiResponse{ +// val map = mutableMapOf() +// return apiCall { service.interveneHomeExercise(map) } +// } +// suspend fun interveneHomeEnvironment(longitude: Double, latitude: Double): ApiResponse{ +// val map = mutableMapOf() +// map["longitude"] = longitude +// map["latitude"] = latitude +// return apiCall { service.interveneHomeEnvironment(map) } +// } +// suspend fun interveneHomeDiabetes(): ApiResponse{ +// val map = mutableMapOf() +// return apiCall { service.interveneHomeDiabetes(map) } +// } +// suspend fun interveneHomeCardiovascular(): ApiResponse{ +// val map = mutableMapOf() +// return apiCall { service.interveneHomeCardiovascular(map) } +// } +// suspend fun interveneHomeCancer(): ApiResponse{ +// val map = mutableMapOf() +// return apiCall { service.interveneHomeCancer(map) } +// } +// +// /** +// * 体重管理-获取当前用户是否已经参加活动 +// */ +// suspend fun getWeightJoinPlanId(): ApiResponse{ +// val map = mutableMapOf() +// return apiCall { service.getWeightJoinPlanId(map) } +// } +// +// /** +// * 体重管理-活动列表 +// */ +// suspend fun getWeightPlanList(): ApiResponse>{ +// val map = mutableMapOf() +// map["pageNo"] = 1 +// map["pageSize"] = 100 +// map["state"] = 1 +// return apiCall { service.getWeightPlanList(map) } +// } +// +// /** +// * 体重管理-获取当前登录人身高体重及目标体重 +// */ +// suspend fun getUserWeightInfo(planId:String): ApiResponse{ +// val map = mutableMapOf() +// map["planId"] = planId +// return apiCall { service.getUserWeightInfo(map) } +// } +// +// /** +// * 体重管理-活动报名 +// */ +// suspend fun postWeightPlanSignUp(bean: UserWeightSignUpBean): ApiResponse { +// return service.postWeightPlanSignUp(bean.toJson().toRequestBody()) +// } +// +// /** +// * 体重管理-获取活动详情 +// */ +// suspend fun getWeightPlanInfo(planId:String,time:String): ApiResponse { +// val map = mutableMapOf() +// map["planId"] = planId +// map["time"] = time +// return apiCall { service.getWeightPlanInfo(map) } +// } +// +// /** +// * 体重管理-获取历史参与记录 +// */ +// suspend fun getWeightJoinHistory(): ApiResponse> { +// val map = mutableMapOf() +// return apiCall { service.getWeightJoinHistory(map) } +// } +// +// /** +// * 体重管理-分页获取计划排行榜 +// */ +// suspend fun getWeightRank( +// planId: String, +// type: Int, +// pageNo: Int, +// pageSize: Int +// ): ApiResponse { +// val map = mutableMapOf() +// map["planId"] = planId +// map["type"] = type +// map["pageNo"] = pageNo +// map["pageSize"] = pageSize +// return apiCall { service.getWeightRank(map) } +// } +// +// /** +// * 体重管理-分页获取计划排行榜-new +// */ +// suspend fun getWeightRankNew( +// planId: String?, +// type: Int, +// pageNo: Int, +// pageSize: Int +// ): ApiResponse { +// val map = mutableMapOf() +// map["planId"] = planId +// map["type"] = type +// map["pageNo"] = pageNo +// map["pageSize"] = pageSize +// return apiCall { service.getWeightRankNew(map) } +// } +// +// /** +// * 体重管理-更新体重 +// */ +// suspend fun getMealsUpdateWeight( +// planId: String, +// weight: String +// ): ApiResponse { +// val map = mutableMapOf() +// map["planId"] = planId +// map["weight"] = weight +// return apiCall { service.getMealsUpdateWeight(map) } +// } +// +/** + *心血管-AED组网 + */ +suspend fun getAedNetworkingData(longitude: Double,latitude: Double,radiusRange: Int,aedNum: String): ApiResponse> { + return apiCall { + val map = mutableMapOf() + map["longitude"] = longitude + map["latitude"] = latitude + map["radiusRange"] = radiusRange + map["aedNum"] = aedNum + service.getAedNetworkingData(map) + } +} +} diff --git a/app/src/main/java/com/xjjk/healthyclients/data/repository/LoginRepository.kt b/app/src/main/java/com/xjjk/healthyclients/data/repository/LoginRepository.kt new file mode 100644 index 0000000..15a6ecf --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/data/repository/LoginRepository.kt @@ -0,0 +1,4 @@ +package com.xjjk.healthyclients.data.repository + +object LoginRepository { +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/event/AppraiseFinishEvent.kt b/app/src/main/java/com/xjjk/healthyclients/event/AppraiseFinishEvent.kt new file mode 100644 index 0000000..5956780 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/AppraiseFinishEvent.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.event + +/** + * @author nanfeifei + * @time 2023/7/10 16:12 + * @description + */ +class AppraiseFinishEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/event/ConsultantManagerEvent.kt b/app/src/main/java/com/xjjk/healthyclients/event/ConsultantManagerEvent.kt new file mode 100644 index 0000000..45efd84 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/ConsultantManagerEvent.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.event + +/** + * @author nanfeifei + * @time 2023/6/6 15:13 + * @description + */ +class ConsultantManagerEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/event/DoctorPagerEvent.java b/app/src/main/java/com/xjjk/healthyclients/event/DoctorPagerEvent.java new file mode 100644 index 0000000..434fd87 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/DoctorPagerEvent.java @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.event; + +public class DoctorPagerEvent { + public final int message;//1 刷新预约列表数据 + + public DoctorPagerEvent(int message) { + this.message = message; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/event/EditArchivesEvent.kt b/app/src/main/java/com/xjjk/healthyclients/event/EditArchivesEvent.kt new file mode 100644 index 0000000..30edcd4 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/EditArchivesEvent.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.event + +/** + * @author nanfeifei + * @time 2023/6/14 14:44 + * @description + */ +class EditArchivesEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/event/EditConsultantEvent.kt b/app/src/main/java/com/xjjk/healthyclients/event/EditConsultantEvent.kt new file mode 100644 index 0000000..6eda583 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/EditConsultantEvent.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.event + +/** + * @author nanfeifei + * @time 2023/6/25 15:17 + * @description + */ +class EditConsultantEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/event/FollowDoctorEvent.kt b/app/src/main/java/com/xjjk/healthyclients/event/FollowDoctorEvent.kt new file mode 100644 index 0000000..7581198 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/FollowDoctorEvent.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.event + +/** + * @author nanfeifei + * @time 2023/6/13 15:09 + * @description + */ +class FollowDoctorEvent(var followStatus: Boolean) { +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/event/GlobalEvent.java b/app/src/main/java/com/xjjk/healthyclients/event/GlobalEvent.java new file mode 100644 index 0000000..6ea400e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/GlobalEvent.java @@ -0,0 +1,14 @@ +package com.xjjk.healthyclients.event; + +public class GlobalEvent { + public final int message;//0 重新登录 + public Object object; + + public GlobalEvent(int message) { + this.message = message; + } + public GlobalEvent(int message, Object object) { + this.message = message; + this.object=object; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/event/RefreshEvent.java b/app/src/main/java/com/xjjk/healthyclients/event/RefreshEvent.java new file mode 100644 index 0000000..963023d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/RefreshEvent.java @@ -0,0 +1,6 @@ +package com.xjjk.healthyclients.event; + +public class RefreshEvent { + public RefreshEvent() { + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/event/UserInfoEvent.kt b/app/src/main/java/com/xjjk/healthyclients/event/UserInfoEvent.kt new file mode 100644 index 0000000..6b81e28 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/UserInfoEvent.kt @@ -0,0 +1,5 @@ +package com.xjjk.healthyclients.event + + +class UserInfoEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/event/UserNoticeBean.java b/app/src/main/java/com/xjjk/healthyclients/event/UserNoticeBean.java new file mode 100644 index 0000000..5d004a9 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/UserNoticeBean.java @@ -0,0 +1,41 @@ +package com.xjjk.healthyclients.event; + +public class UserNoticeBean { + + private String id; + private String content; + private String title; + private int isRead=0; //1已读 2未读 + + public int getIsRead() { + return isRead; + } + + public void setIsRead(int isRead) { + this.isRead = isRead; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getContent() { + return content == null ? "" : content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getTitle() { + return title == null ? "" : title; + } + + public void setTitle(String title) { + this.title = title; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/event/WebActionFinishEvent.kt b/app/src/main/java/com/xjjk/healthyclients/event/WebActionFinishEvent.kt new file mode 100644 index 0000000..ef06aec --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/WebActionFinishEvent.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.event + +/** + * @author nanfeifei + * @time 2023/9/26 14:08 + * @description + */ +class WebActionFinishEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/event/WebReloadEvent.kt b/app/src/main/java/com/xjjk/healthyclients/event/WebReloadEvent.kt new file mode 100644 index 0000000..b2a8e53 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/event/WebReloadEvent.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.event + +/** + * @author nanfeifei + * @time 2023/9/26 14:08 + * @description + */ +class WebReloadEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/fragment/EmergencyFragment.kt b/app/src/main/java/com/xjjk/healthyclients/fragment/EmergencyFragment.kt new file mode 100644 index 0000000..f468c44 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/fragment/EmergencyFragment.kt @@ -0,0 +1,378 @@ +package com.xjjk.healthyclients.fragment + +import android.Manifest +import android.content.Intent +import android.graphics.BitmapFactory +import android.graphics.Color +import android.net.Uri +import android.os.Build +import android.os.Bundle +import android.util.Log +import android.view.View +import androidx.annotation.RequiresApi +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import com.amap.api.location.AMapLocation +import com.amap.api.location.AMapLocationClient +import com.amap.api.location.AMapLocationClientOption +import com.amap.api.location.AMapLocationClientOption.AMapLocationMode +import com.amap.api.location.AMapLocationListener +import com.amap.api.maps.AMap +import com.amap.api.maps.CameraUpdateFactory +import com.amap.api.maps.LocationSource +import com.amap.api.maps.MapView +import com.amap.api.maps.MapsInitializer +import com.amap.api.maps.model.BitmapDescriptorFactory +import com.amap.api.maps.model.LatLng +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.tuikit.tuichat.bean.WorkBean +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBFragment +import com.xjjk.healthyclients.bean.emergency.EmergencyDictBean +import com.xjjk.healthyclients.bean.emergency.LocationResourceBean +import com.xjjk.healthyclients.databinding.FragmentEmergencyBinding +import com.xjjk.healthyclients.superfuntion.getMarkerInfo +import com.xjjk.healthyclients.superfuntion.startGroupChat +import com.xjjk.healthyclients.ui.viewmodel.EmergencyViewModel +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.flow.collectLatest +import kotlinx.coroutines.launch + + +/** + *应急fragment + */ +class EmergencyFragment : + BaseVMBFragment(R.layout.fragment_emergency), + LocationSource, AMapLocationListener, AMap.OnMarkerClickListener { + var mlocationClient: AMapLocationClient? = null + var mLocationOption: AMapLocationClientOption? = null + var firstLocation = true + + //我当前位置的经纬度 + var mCurrentLat: Double = 34.327271 + var mCurrentLon: Double = 108.949845 + + //所选目标的经纬度 + var mLat = 0.0 + var mLon = 0.0 + var mPhone = ""; + var titleId = "1" + + var mMapView: MapView? = null + var mAMap: AMap? = null + var mPermissionList = arrayListOf( + Manifest.permission.ACCESS_COARSE_LOCATION, + Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.QUERY_ALL_PACKAGES + ) + var mListener: LocationSource.OnLocationChangedListener? = null + + override fun initView(root: View?, savedInstanceState: Bundle?) { +// fitTransparentStatusBar(mBinding.tvTitle) + MapsInitializer.updatePrivacyShow(context, true, true) + MapsInitializer.updatePrivacyAgree(context, true) + mMapView = mBinding.fragmentEmergencyMapMapview + mMapView?.onCreate(savedInstanceState) + if (mAMap == null) { + mAMap = mMapView?.getMap() + } + PermissionX.init(this@EmergencyFragment) + .permissions(mPermissionList) + .request { allGranted, grantedList, deniedList -> setUpMap() } + } + + override fun initData() { + super.initData() +// mViewModel.getEmergencyData( +// titleId, +// 0.0, +// 0.0 +// ) + var mHeadType= mutableListOf() +// mHeadType.add(EmergencyDictBean("全部","全部","全部","0",true)) + mHeadType.add(EmergencyDictBean("油田医院","油田医院","油田医院","1",true)) + mHeadType.add(EmergencyDictBean("合作医院","合作医院","合作医院","2",false)) + mHeadType.add(EmergencyDictBean("医疗点","医疗点","医疗点","3",false)) + mHeadType.add(EmergencyDictBean("AED","AED","AED","4",false)) + mHeadType.add(EmergencyDictBean("救护车","救护车","救护车","5",false)) + + mBinding.fragmentEmergencyHeadRv.setHeadData(mHeadType) { titleBean -> + if (titleBean.value.equals("3")) { + mViewModel.nearbyResource(mCurrentLat,mCurrentLon,100) + } else if (titleBean.value.equals("4")) { + mViewModel.getAedNetworkingData(mCurrentLon,mCurrentLat) + } else if (titleBean.value.equals("5")) { + mViewModel.nearbyAmbulance(mCurrentLat,mCurrentLon) + } else { + titleId = titleBean.value + mViewModel.getEmergencyData(titleBean.value, mCurrentLat, mCurrentLon) + } + } + } + + override fun createObserve() { + super.createObserve() +// lifecycleScope.launch { +// repeatOnLifecycle(Lifecycle.State.CREATED) { +// mViewModel.titleList.collectLatest { +// if (mBinding.fragmentEmergencyHeadRv.mList.isNullOrEmpty()) { +// +// } +// } +// } +// } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.markList.collectLatest { + setMarker(it) + } + } + } + } + + private fun setUpMap() { + // 自定义系统定位小蓝点 + val myLocationStyle = MyLocationStyle() + myLocationStyle.myLocationIcon( + BitmapDescriptorFactory + .fromResource(R.mipmap.ic_my_location) + ) // 设置小蓝点的图标 + myLocationStyle.strokeColor(Color.BLACK) // 设置圆形的边框颜色 + myLocationStyle.radiusFillColor(Color.argb(100, 0, 0, 180)) // 设置圆形的填充颜色 + // myLocationStyle.anchor(int,int)//设置小蓝点的锚点 + myLocationStyle.strokeWidth(1.0f) // 设置圆形的边框粗细 + myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_SHOW) + mAMap?.myLocationStyle = myLocationStyle + mAMap?.setLocationSource(this@EmergencyFragment) // 设置定位监听 + mAMap?.moveCamera(CameraUpdateFactory.zoomTo(13F)) + mAMap?.uiSettings?.isMyLocationButtonEnabled = true // 设置默认定位按钮是否显示 + mAMap?.isMyLocationEnabled = true // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false + AMapLocationClient.updatePrivacyShow(context, true, true) + AMapLocationClient.updatePrivacyAgree(context, true) + // aMap.setMyLocationType() + mAMap?.setOnMarkerClickListener(this@EmergencyFragment) + } + + override fun onResume() { + super.onResume() + mMapView?.onResume() + } + override fun onPause() { + super.onPause() + mMapView?.onPause() + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + mMapView?.onSaveInstanceState(outState) + } + + override fun onDestroy() { + super.onDestroy() + mMapView?.onDestroy() + } + + override fun activate(listener: LocationSource.OnLocationChangedListener?) { + mListener = listener + if (mlocationClient == null) { + try { + mlocationClient = AMapLocationClient(context) + } catch (e: Exception) { + e.printStackTrace() + } + mLocationOption = AMapLocationClientOption() + mlocationClient!! + //设置定位监听 + mlocationClient!!.setLocationListener(this@EmergencyFragment) + //设置为高精度定位模式 + mLocationOption!!.locationMode = AMapLocationMode.Hight_Accuracy + //设置定位参数 + mlocationClient!!.setLocationOption(mLocationOption) + mlocationClient!!.startLocation() + } + } + + + override fun deactivate() { + mListener = null + if (mlocationClient != null) { + mlocationClient!!.stopLocation() + mlocationClient!!.onDestroy() + } + mlocationClient = null + } + + @RequiresApi(Build.VERSION_CODES.M) + override fun bindEvent() { + mBinding.apply { + fragmentEmergencyPlatRlRoot.setOnClickListener(this@EmergencyFragment) + fragmentEmergencyCall120.setOnClickListener(this@EmergencyFragment) + fragmentEmergencySeekDoctor.setOnClickListener(this@EmergencyFragment) + fragmentEmergencyAddressCardClose.setOnClickListener(this@EmergencyFragment) + fragmentEmergencyPhone.setOnClickListener(this@EmergencyFragment) + fragmentEmergencyCardNavigation.setOnClickListener(this@EmergencyFragment) + fragmentEmergencyMarkerInfo.setOnClickListener(this@EmergencyFragment) + } + } + + override fun onClick(p0: View?) { + when (p0?.id) { + R.id.fragment_emergency_address_card_close -> { + mBinding.fragmentEmergencyMarkerInfo.visibility = View.GONE + } + + R.id.fragment_emergency_card_navigation -> { + //导航 + context?.let { + goNavigation(mLat, mLon, it) + } + } + + R.id.fragment_emergency_phone -> { + //打电话 + try { + var phone = mBinding.fragmentEmergencyHospitalLandline.text.toString().trim() + var intent = Intent(Intent.ACTION_DIAL, Uri.parse("tel: ${phone}")) + startActivity(intent) + } catch (e: Exception) { + } + } + + R.id.fragment_emergency_call_120 -> { + mViewModel.getEmergencyCall( + EmergencyViewModel.CALL_TYPE_MOBILE, + titleId, + mCurrentLon, + mCurrentLat + ) + try { + var intent = Intent(Intent.ACTION_DIAL, Uri.parse("tel: 120")) + startActivity(intent) + } catch (e: Exception) { + } + } + + R.id.fragment_emergency_seek_doctor -> { +// mViewModel.getEmergencyCall(EmergencyViewModel.CALL_TYPE_CHAT, titleId, mCurrentLon, mCurrentLat) + mViewModel.getIMGroupInfo( + getString(R.string.title_emergency), + mCurrentLon, + mCurrentLat, + successCall = { + IMInputActionSettingUtils.createEmergencySetting() + activity?.startGroupChat( + it.groupId, + getString(R.string.title_emergency), + "1" == it.tfNew, + it.member, + workBean = WorkBean(it.id, TUIUtils.WORK_TYPE_EMERGENCY) + ) + }) + } + R.id.fragment_emergency_marker_info -> { + + } + + else -> { + } + } + } + + override fun getStatusbarStyle(): Int { + return 1 + } + + override fun onLocationChanged(amapLocation: AMapLocation?) { + if (mListener != null && amapLocation != null) { + if (amapLocation != null + && amapLocation.errorCode == 0 + ) { + mCurrentLat = amapLocation.latitude + mCurrentLon = amapLocation.longitude + mListener!!.onLocationChanged(amapLocation) // 显示系统小蓝点 + if (firstLocation) { + mViewModel.getEmergencyData( + titleId, + amapLocation.latitude, + amapLocation.longitude + ) + firstLocation = false + } + } else { + val errText = + "定位失败," + amapLocation.errorCode + ": " + amapLocation.errorInfo + Log.e("AmapErr", errText) + } + } + } + + fun setMarker(markerList: MutableList) { + mAMap?.clear() //清除点位 + if (markerList.isNullOrEmpty()) { + return + } + lifecycleScope.launch { + var newlist= mutableListOf() + for (index in 0 until markerList.size) { + if(markerList[index].latitude>0.0&&markerList[index].longitude>0.0){ + newlist.add(markerList[index]) + val markerOption = MarkerOptions() + markerOption.position( + LatLng( + markerList[index].latitude, + markerList[index].longitude + ) + ) + markerOption.title(markerList[index].name).snippet(markerList[index].address) + markerOption.draggable(true) + markerOption.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory + .decodeResource( + resources, + MapUtils.getMarkerIcon(markerList[index].type) + ) + ) + ) + mAMap?.addMarker(markerOption) + } + MapUtils.setMapZoonlo(mAMap, 200, ArrayList(newlist)) + } + } + + } + + override fun onMarkerClick(marker: Marker?): Boolean { + var position = marker?.position + mLat = position?.latitude!! + mLon = position?.longitude!! + var bean = getMarkerInfo(mLat, mLon, mViewModel.markList.value) + if (bean != null) { + mBinding?.let { + it.fragmentEmergencyHospitalTag.text = bean?.level + it.fragmentEmergencyHospitalName.text = bean?.name + if(bean?.mobile?.isNullOrEmpty() == true){ + it.fragmentEmergencyPhone.visibility=View.INVISIBLE + }else{ + it.fragmentEmergencyPhone.visibility=View.VISIBLE + } + it.fragmentEmergencyHospitalLandline.text = bean?.mobile + it.fragmentEmergencyHospitalAddress.text = bean?.address + it.fragmentEmergencyCardNavigation.visibility = View.VISIBLE + } + mBinding.fragmentEmergencyMarkerInfo.visibility = View.VISIBLE + } else { + mBinding.fragmentEmergencyMarkerInfo.visibility = View.GONE + } + return true + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/fragment/GuidanceFragment.kt b/app/src/main/java/com/xjjk/healthyclients/fragment/GuidanceFragment.kt new file mode 100644 index 0000000..1875b95 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/fragment/GuidanceFragment.kt @@ -0,0 +1,231 @@ +package com.xjjk.healthyclients.fragment + +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.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 +import com.xjjk.healthyclients.base.BaseVMBFragment +import com.xjjk.healthyclients.bean.guidance.GuidanceListBean +import com.xjjk.healthyclients.databinding.FragmentGuidanceBinding +import com.xjjk.healthyclients.event.RefreshEvent +import com.xjjk.healthyclients.superfuntion.initColors +import com.xjjk.healthyclients.superfuntion.startAppointmentWaitAffirmActivity +import com.xjjk.healthyclients.superfuntion.startGeneralPracticeGuidanceActivity +import com.xjjk.healthyclients.superfuntion.startGroupChat +import com.xjjk.healthyclients.superfuntion.startLoginActivity +import com.xjjk.healthyclients.superfuntion.startMyGuidanceActivity +import com.xjjk.healthyclients.ui.activity.guidance.adapter.GuidanceFragmentDoctorAdapter +import com.xjjk.healthyclients.ui.viewmodel.GuidanceFragmentViewModel +import com.xjjk.healthyclients.utils.ConstantUtils +import com.xjjk.healthyclients.utils.IMInputActionSettingUtils +import com.xjjk.healthyclients.utils.TUIUtils +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + *咨询fragment + */ +class GuidanceFragment : + BaseVMBFragment(R.layout.fragment_guidance), + SwipeRefreshLayout.OnRefreshListener { + var mDoctorList = arrayListOf() + var mGuidanceFragmentDoctorAdapter: GuidanceFragmentDoctorAdapter? = null + override fun initView(root: View?, savedInstanceState: Bundle?) { + mBinding.apply { + swipeRefresh.initColors() + swipeRefresh.setOnRefreshListener(this@GuidanceFragment) + + var manager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) + 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 + } + + }) + fragmentGuidanceRvDoctor.adapter = mGuidanceFragmentDoctorAdapter + } + + } + + override fun initData() { + super.initData() + onRefresh() + } + + override fun onHiddenChanged(hidden: Boolean) { + super.onHiddenChanged(hidden) + if (!hidden) { + onRefresh() + } + } + + override fun onResume() { + super.onResume() + onRefresh() + } + + override fun createObserve() { + super.createObserve() + mBinding.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.mDoctorList.collectLatest { list -> + if (list.size == 0) { + fragmentGuidanceRvDoctor.visibility = View.GONE + llEmpty.visibility = View.VISIBLE + } else { + fragmentGuidanceRvDoctor.visibility = View.VISIBLE + llEmpty.visibility = View.GONE + mDoctorList.clear() + mDoctorList.addAll(list) + } + mGuidanceFragmentDoctorAdapter?.notifyDataSetChanged() + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isRefreshing.collectLatest { + swipeRefresh.isRefreshing = it + } + } + } + } + } + + + override fun onClick(p0: View?) { + when (p0?.id) { + R.id.iv_left -> { + if (DataStoreManager.getToken().isNullOrEmpty()) { + startLoginActivity(requireContext()) + } else { + mViewModel.submitAssistantConsultApply(successCall = { + if (it == null) { + return@submitAssistantConsultApply + } + IMInputActionSettingUtils.createAssistantSetting() + requireContext().startGroupChat( + it.groupId, + getString(R.string.title_assistant_consult), + workBean = WorkBean( + it.id, + TUIUtils.WORK_TYPE_ASSISTANT + ) + ) + }) + } + + } + + R.id.iv_right -> { + if (DataStoreManager.getToken().isNullOrEmpty()) { + startLoginActivity(requireContext()) + } else { + requireContext().startGeneralPracticeGuidanceActivity() + } + } + + R.id.tv_doctor_more -> { + context?.let { + if (ConstantUtils.mCheckToken) { + if (DataStoreManager.getToken().isNullOrEmpty()) { + startLoginActivity(it) + } else { + startMyGuidanceActivity(it, "") + } + }else{ + startLoginActivity(requireContext()) + } + } + } + } + } + + + override fun bindEvent() { + mBinding.apply { + ivLeft?.setOnClickListener(this@GuidanceFragment) + ivRight?.setOnClickListener(this@GuidanceFragment) + tvDoctorMore?.setOnClickListener(this@GuidanceFragment) + } + + } + + override fun getStatusbarStyle(): Int { + activity?.let { StatusbarUtil.customColorMode(it, "#2dcac1", false) } + return 2 + } + + override fun onRefresh() { + mBinding.swipeRefresh.isRefreshing = false + if (ConstantUtils.mCheckToken) { + mViewModel.selectDoctorRecommendHome() + } + } + + override fun onMessageEvent(event: Any?) { + if (event is RefreshEvent) { + onRefresh() + } + super.onMessageEvent(event) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/fragment/MonitorFragment.kt b/app/src/main/java/com/xjjk/healthyclients/fragment/MonitorFragment.kt new file mode 100644 index 0000000..d7797a5 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/fragment/MonitorFragment.kt @@ -0,0 +1,473 @@ +package com.xjjk.healthyclients.fragment + +import android.graphics.Color +import android.os.Bundle +import android.text.TextUtils +import android.view.View +import com.github.gzuliyujiang.wheelpicker.NumberPicker +import com.github.gzuliyujiang.wheelview.contract.WheelFormatter +import com.sw.healthyclients.data.local.DataStoreManager +import com.sw.healthyclients.utils.DateUtil +import com.xjjk.healthyclients.R +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.CvdRiskInfoBean +import com.xjjk.healthyclients.bean.TitleTagBean +import com.xjjk.healthyclients.chart.DoubleWheelBPicker +import com.xjjk.healthyclients.chart.HeartRateProvider +import com.xjjk.healthyclients.chart.TemperatureProvider +import com.xjjk.healthyclients.data.api.HealthCheckNetApi +import com.xjjk.healthyclients.databinding.FragmentMonitorBinding +import com.xjjk.healthyclients.event.WebReloadEvent +import com.xjjk.healthyclients.retrofit.getHealthCheckRetrofit +import com.xjjk.healthyclients.retrofit.intervention.CallbackInterventionManager +import com.xjjk.healthyclients.ui.activity.CvdWarningHistoryActivity +import com.xjjk.healthyclients.ui.activity.InterventionWebActivity + +class MonitorFragment: BaseVMBFragment(R.layout.fragment_monitor) { + private val COLOR_PICKER_OK = "#21BEBD" + private val TYPE_HEART_RATE = "heart_rate" + private val TYPE_SPO2 = "spo2" + private val TYPE_STRESS = "stress" + private val TYPE_TEMPERATURE = "temperature" + + var heartRateDefaultMin: String = "40次/分钟" + var heartRateDefaultMax: String = "110次/分钟" + var temperatureDefaultMin: String = "35.5℃" + var temperatureDefaultMax: String = "37.3℃" + var spo2DefaultMin: Int = 85 + var StressDefaultMin: Int = 85 + + private var mApi = getHealthCheckRetrofit().create(HealthCheckNetApi::class.java) + + // private var titleTextAdapter: TitleTextAdapter = TitleTextAdapter() + private var cvdMainAdapter: CvdMainAdapter = CvdMainAdapter() + + private var mUserId: String = "" + private var mToken: String = "" + var mType=2 + override fun initView(root: View?, savedInstanceState: Bundle?) { + mBinding.ccdwvAnswer.initView(mType) + } + + override fun initData() { + super.initData() + mToken = DataStoreManager.getToken() + mUserId = DataStoreManager.getUserId().toString() +// mUserId = "09fd6195cd4c4f1fb457f34678fa0011" + + + +// titleTextAdapter.setList(getTitleTagList()) +// mBinding.tagRecyclerView.adapter = titleTextAdapter + + mBinding.recyclerView.adapter = cvdMainAdapter + initListData() + } + + override fun lazyLoadData() { + super.lazyLoadData() + getHomePageUserInfo() + answer() + } + + private fun initListData() { + var listData: MutableList = mutableListOf() + + listData.add( + CvdMainBean().dataBean( + TYPE_HEART_RATE, + "心率", + DateUtil.nowStringDateShort, + "--" + ) + ) + listData.add(CvdMainBean().dataBean(TYPE_SPO2, "血氧", DateUtil.nowStringDateShort, "--")) + listData.add(CvdMainBean().dataBean(TYPE_STRESS, "压力", DateUtil.nowStringDateShort, "--")) + listData.add( + CvdMainBean().dataBean( + TYPE_TEMPERATURE, + "体温", + DateUtil.nowStringDateShort, + "--" + ) + ) + + cvdMainAdapter.setList(listData) + } + + override fun bindEvent() { + mBinding.let { + addClickViews(it.stepLayout, it.sleepLayout) + + + } + +// titleTextAdapter.setOnItemClickListener { adapter, view, position -> +// resetTitleTagStatus(position) +// } + + cvdMainAdapter.setOnItemClickListener { adapter, view, position -> + var data = adapter.data[position] as CvdMainBean.dataBean + when (position) { + 0 -> { + var bundle = Bundle() + bundle.putString("path", "heartRate") + bundle.putString("date", data.dataDate) + toActivity(InterventionWebActivity::class.java, bundle) + } + + 1 -> { + var bundle = Bundle() + bundle.putString("path", "oxygenSaturation") + bundle.putString("date", data.dataDate) + toActivity(InterventionWebActivity::class.java, bundle) + } + + 2 -> { + var bundle = Bundle() + bundle.putString("path", "pressure") + bundle.putString("date", data.dataDate) + toActivity(InterventionWebActivity::class.java, bundle) + } + + 3 -> { + var bundle = Bundle() + bundle.putString("path", "temperature") + bundle.putString("date", data.dataDate) + toActivity(InterventionWebActivity::class.java, bundle) + } + } + } + +// cvdMainAdapter.setOnItemChildClickListener(object : OnItemChildClickListener) + + cvdMainAdapter.addChildClickViewIds(R.id.thresholdTv, R.id.warningTv) + cvdMainAdapter.setOnItemChildClickListener { adapter, view, position -> + if (view.id == R.id.thresholdTv) { + when (position) { + 0 -> {//心率 + showHeartPicker() + } + 1 -> {//血氧 + showSpo2Picker() + } + 2 -> {//压力 + showStressPicker() + } + 3 -> {//体温 + showTemperaturePicker() + } + } + + } + if (view.id == R.id.warningTv) { + var bundle = Bundle() + bundle.putInt("position", position) + toActivity(CvdWarningHistoryActivity::class.java, bundle) + } + } + } + + override fun onClick(v: View?) { + when (v?.id) { + R.id.step_layout -> { + var bundle = Bundle() + bundle.putString("path", "stepNumber") + bundle.putString("date", mBinding.stepDateTv.text.toString()) + toActivity(InterventionWebActivity::class.java, bundle) + } + + R.id.sleep_layout -> { + var bundle = Bundle() + bundle.putString("path", "sleep") + bundle.putString("date", mBinding.sleepDateTv.text.toString()) + toActivity(InterventionWebActivity::class.java, bundle) + } + + } + } + private fun getHomePageUserInfo() { + dialog?.show() + var getCvdHomeData = mApi.getCvdHomeData(mUserId) + getCvdHomeData.enqueue(object : CallbackInterventionManager() { + + override fun onSuccess( + code: Int, + result: CvdMainBean?, + message: String, + ok: Boolean + ) { + dialog?.dismiss() + result?.let { + + mBinding.wearTimeTv.text = "佩戴${result.days}天" + + mBinding.sleepValue2Tv.text = + "平均睡眠${result.aveSleep.toInt() / 60}小时${result.aveSleep.toInt() % 60}分钟" + mBinding.stepValue2Tv.text = "累计约步行${result.distance / 1000}公里" + + var indexItemVos = result.indexItemVos + + 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() + 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}" + + 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()}次/分钟" + } + } + if (dataBean.wdType.equals(TYPE_SPO2)) { + if (!TextUtils.isEmpty(dataBean.warnMin)) { + spo2DefaultMin = dataBean.warnMin.toFloat().toInt() + } + } + if (dataBean.wdType.equals(TYPE_TEMPERATURE)) { + if (!TextUtils.isEmpty(dataBean.warnMin) && !TextUtils.isEmpty(dataBean.warnMax)) { + temperatureDefaultMin = "${dataBean.warnMin}℃" + temperatureDefaultMax = "${dataBean.warnMax}℃" + } + } + if (dataBean.wdType.equals(TYPE_STRESS)) { + if (!TextUtils.isEmpty(dataBean.warnMax)) { + StressDefaultMin = dataBean.warnMax.toFloat().toInt() + } + } + } + + cvdMainAdapter.setList(indexItemVos) + } + } + + override fun onFail(code: Int, errMsg: String?) { + dialog?.dismiss() + showToast(errMsg) + } + + }) + + } + + + fun answer(){ + dialog?.show() + var getCvdHomeData = mApi.selectTfFillQuestion(mType.toString()) + getCvdHomeData.enqueue(object : CallbackInterventionManager() { + + override fun onSuccess( + code: Int, + result: Boolean?, + message: String, + ok: Boolean + ) { + dialog?.dismiss() + result?.let { + if (it) { + //已填写问卷 + mBinding?.ccdwvAnswer?.answerState(true) + getRiskInfo() + }else{ + mBinding?.ccdwvAnswer?.answerState(false) + } + } + } + + override fun onFail(code: Int, errMsg: String?) { + dialog?.dismiss() + showToast(errMsg) + } + + }) + } + + fun getRiskInfo(){ + var getCvdHomeData = mApi.selectAngiocarpyPreventionWarningDOByUserId(mType.toString()) + getCvdHomeData.enqueue(object : CallbackInterventionManager() { + + override fun onSuccess( + code: Int, + result: CvdRiskInfoBean?, + message: String, + ok: Boolean + ) { + dialog?.dismiss() + mBinding?.ccdwvAnswer?.setRiskInfo(result) + } + + override fun onFail(code: Int, errMsg: String?) { + showToast(errMsg) + } + + }) + } + + + private fun showHeartPicker() { + val picker = DoubleWheelBPicker(requireActivity()) + picker.setData(HeartRateProvider()) + picker.setOnLinkagePickedListener { first, second, third -> + var min: Float = first.toString().replace("次/分钟", "").toFloat() + var max: Float = second.toString().replace("次/分钟", "").toFloat() + thresholdSetting(TYPE_HEART_RATE, mUserId, min, max) + + heartRateDefaultMin = first.toString() + heartRateDefaultMax = second.toString() + } + picker.setDefaultValue(heartRateDefaultMin, heartRateDefaultMax, "") + picker.setTitle("心率阈值") + picker.okView.text = "保存并同步" + picker.okView.setTextColor(Color.parseColor(COLOR_PICKER_OK)) + picker.show() + } + + private fun showTemperaturePicker() { + val picker = DoubleWheelBPicker(requireActivity()) + picker.setData(TemperatureProvider()) + picker.setOnLinkagePickedListener { first, second, third -> + var min: Float = first.toString().replace("℃", "").toFloat() + var max: Float = second.toString().replace("℃", "").toFloat() + thresholdSetting(TYPE_TEMPERATURE, mUserId, min, max) + + temperatureDefaultMin = first.toString() + temperatureDefaultMax = second.toString() + } + picker.setDefaultValue(temperatureDefaultMin, temperatureDefaultMax, "") + picker.setTitle("体温阈值") + picker.okView.text = "保存并同步" + picker.okView.setTextColor(Color.parseColor(COLOR_PICKER_OK)) + picker.show() + } + + + private fun showSpo2Picker() { + val picker = NumberPicker(requireActivity()) + picker.setOnNumberPickedListener { position, item -> + thresholdSetting(TYPE_SPO2, mUserId, item.toFloat(), 0f) + + spo2DefaultMin = item.toInt() + } +// picker.getWheelLayout() +// .setOnNumberSelectedListener(OnNumberSelectedListener { position, item -> +// picker.getTitleView().setText(picker.getWheelView().formatItem(position)) +// }) + picker.setFormatter(WheelFormatter { item -> "$item %" }) + picker.setRange(75, 90, 5) + picker.setDefaultValue(spo2DefaultMin) + picker.setTitle("血氧阈值") + picker.okView.text = "保存并同步" + picker.okView.setTextColor(Color.parseColor(COLOR_PICKER_OK)) + picker.show() + } + + + private fun showStressPicker() { + val picker = NumberPicker(requireActivity()) + picker.setOnNumberPickedListener { position, item -> + thresholdSetting(TYPE_STRESS, mUserId, 0f, item.toFloat()) + + StressDefaultMin = item.toInt() + } +// picker.getWheelLayout() +// .setOnNumberSelectedListener(OnNumberSelectedListener { position, item -> +// picker.getTitleView().setText(picker.getWheelView().formatItem(position)) +// }) + picker.setFormatter(WheelFormatter { item -> "$item" }) + picker.setRange(80, 99, 1) + picker.setDefaultValue(StressDefaultMin) + picker.setTitle("压力阈值") + picker.okView.text = "保存并同步" + picker.okView.setTextColor(Color.parseColor(COLOR_PICKER_OK)) + picker.show() + } + + private fun getTitleTagList(): MutableList { + val titleList: MutableList = mutableListOf() + var titleTag = TitleTagBean() + titleTag.text = "防范心梗" + titleTag.isSelect = true + titleList.add(titleTag) + + titleTag = TitleTagBean() + titleTag.text = "吃动平衡" + titleTag.isSelect = false + titleList.add(titleTag) + + titleTag = TitleTagBean() + titleTag.text = "血管健康" + titleTag.isSelect = false + titleList.add(titleTag) + + titleTag = TitleTagBean() + titleTag.text = "防脑卒中" + titleTag.isSelect = false + titleList.add(titleTag) + + return titleList + } + +// private fun resetTitleTagStatus(position: Int) { +// titleTextAdapter.data +// for ((index, item) in titleTextAdapter.data.withIndex()) { +// item.isSelect = index == position +// } +// titleTextAdapter.notifyDataSetChanged() +// } + + private fun thresholdSetting( + eventType: String, + userId: String, + min: Float, + max: Float + ) { + dialog?.show() + var getCvdWarningData = + mApi.thresholdSetting(eventType, userId, min, max) + getCvdWarningData.enqueue(object : + CallbackInterventionManager() { + + override fun onSuccess( + code: Int, + result: String?, + message: String, + ok: Boolean + ) { + dialog?.dismiss() + result?.let { + showToast("保存成功") + } + } + + override fun onFail(code: Int, errMsg: String?) { + dialog?.dismiss() + showToast(errMsg) + } + + }) + + } + + override fun onMessageEvent(event: Any?) { + super.onMessageEvent(event) + if (event is WebReloadEvent) { + answer() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/fragment/UserInfoFragment.kt b/app/src/main/java/com/xjjk/healthyclients/fragment/UserInfoFragment.kt new file mode 100644 index 0000000..469b8f7 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/fragment/UserInfoFragment.kt @@ -0,0 +1,270 @@ + +import android.os.Bundle +import android.os.SystemClock +import android.view.View +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.RecyclerView +import com.sw.healthyclients.data.local.DataStoreManager +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter +import com.xjjk.healthyclients.adapter.user.UserMenuAdapter +import com.xjjk.healthyclients.base.BaseVMBFragment +import com.xjjk.healthyclients.bean.user.UserMenuBean +import com.xjjk.healthyclients.databinding.FragmentUserInfoBinding +import com.xjjk.healthyclients.event.UserInfoEvent +import com.xjjk.healthyclients.retrofit.UrlConfig +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.startUserInfoSettingActivity +import com.xjjk.healthyclients.superfuntion.startUserMyGuidanceActivity +import com.xjjk.healthyclients.superfuntion.startUserSettingActivity +import com.xjjk.healthyclients.ui.viewmodel.UserInfoFragmentViewModel +import com.xjjk.healthyclients.utils.ConstantUtils +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + *我的fragment + */ +class UserInfoFragment: BaseVMBFragment(R.layout.fragment_user_info){ + var mList= arrayListOf() + var mUserMenuAdapter : UserMenuAdapter?=null + + var time: Long = 2000 + var mCount = 5 + var mLastTime = 0L + var mHits = LongArray(mCount) + override fun transparentStatusBar(): Boolean { + return true + } + override fun initView(root: View?, savedInstanceState: Bundle?) { + mBinding?.apply { + userCoAfoot.setOrderStateInfo("进行中", R.drawable.ic_user_order_afoot) + userCoWaitRate.setOrderStateInfo("待评价", R.drawable.ic_user_order_wait_rate) + userCoRated.setOrderStateInfo("已评价", R.drawable.ic_user_order_rated) + userCoHistory.setOrderStateInfo("历史", R.drawable.ic_user_order_history) + + 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)) + + mUserMenuAdapter= + UserMenuAdapter(requireContext(), R.layout.dialog_user_menu_item, mList) + rvMenu.adapter=mUserMenuAdapter + if (UrlConfig.baseUrlType != UrlConfig.BaseUrlType.PRODUCT) { + versionType.text = UrlConfig.baseUrlType.name.lowercase() + } else { + versionType.text = "" + } + toolbarLay.titleTvName.setOnClickListener { + if ("admin"== DataStoreManager.getUserInfo2().username||"admin"==DataStoreManager.getUserInfo().username) { + mLastTime = System.currentTimeMillis() + System.arraycopy(mHits, 1, mHits, 0, mHits.size - 1) + mHits[mHits.size - 1] = SystemClock.uptimeMillis() + if (mHits[0] >= (SystemClock.uptimeMillis() - time)) { + //数组重新初始化 + mHits = LongArray(mCount) +// startSimulateUserActivity(requireContext()) + } + } + + } + } + + } + + override fun initData() { + super.initData() + + var userInfo= DataStoreManager.getUserInfo() + if (userInfo!=null) { + if (userInfo.realname.isNullOrEmpty()) { + mBinding.userTvName.text="" + }else{ + mBinding.userTvName.text= DataStoreManager.getUserInfo().realname + } + + mBinding?.apply { + userIvHead.loadCircle(userInfo.avatar, R.drawable.ic_masculino) + } + + } + if (DataStoreManager.getToken().isNotEmpty()) { + mBinding?.tvLoginOut?.visibility=View.VISIBLE + }else{ + mBinding?.tvLoginOut?.visibility=View.GONE + mBinding?.userTvName?.text="去登录" + } + } + + override fun onHiddenChanged(hidden: Boolean) { + super.onHiddenChanged(hidden) + if (!hidden) { + if (DataStoreManager.getToken().isNotEmpty()) { + mViewModel.sessioningNum() + } + } + } + + override fun onResume() { + super.onResume() + if (DataStoreManager.getToken().isNotEmpty()) { + mViewModel.sessioningNum() + } + } + + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.number.collectLatest { + var value=0 + try { + value=it.toInt() + } catch (e: Exception) { + } + mBinding?.userCoAfoot?.setsetOrderStateNumber(value) + } + } + } + } + + override fun bindEvent() { + mBinding?.apply { + addClickViews(userTvLookAll,userCoAfoot,userCoWaitRate,userCoRated,userCoHistory,userIvHead,tvLoginOut,toolbarLay.titleIvRight,userTvName) + } + + mUserMenuAdapter?.setOnItemClickListener(object : MultiItemTypeAdapter.OnItemClickListener { + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + when (mList[position].id) { + 1 -> { + context?.let{ + if (DataStoreManager.getToken().isNullOrEmpty()) { + startLoginActivity(it) + }else{ + startConsultantManagerActivity(it,true) + } + } + } + 3 -> { + context?.let { startEmergencySeekDoctorActivity(it) } + } + else -> {} + } + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int, + ): Boolean { + return false + } + }) + + } + + override fun getStatusbarStyle(): Int { + return 1 + } + + override fun onClick(v: View?) { + when(v?.id){ + R.id.user_tv_look_all -> { + context?.let { + if (ConstantUtils.mCheckToken) { + if (DataStoreManager.getToken().isNullOrEmpty()) { + startLoginActivity(it) + } else { + startUserMyGuidanceActivity(it, "全部") + } + } + } + } + R.id.user_co_afoot -> { + context?.let { + if (ConstantUtils.mCheckToken) { + if (DataStoreManager.getToken().isNullOrEmpty()) { + startLoginActivity(it) + } else { + startUserMyGuidanceActivity(it, "进行中") + } + } + } + } + R.id.user_co_wait_rate -> { + context?.let { + if (ConstantUtils.mCheckToken) { + if (DataStoreManager.getToken().isNullOrEmpty()) { + startLoginActivity(it) + } else { + startUserMyGuidanceActivity(it, "待评价") + } + } + } + } + R.id.user_co_rated -> { + context?.let { + if (ConstantUtils.mCheckToken) { + if (DataStoreManager.getToken().isNullOrEmpty()) { + startLoginActivity(it) + } else { + startUserMyGuidanceActivity(it, "已评价") + } + } + } + } + R.id.user_co_history -> { + context?.let { + if (ConstantUtils.mCheckToken) { + if (DataStoreManager.getToken().isNullOrEmpty()) { + startLoginActivity(it) + } else { + startUserMyGuidanceActivity(it, "全部") + } + } + } + } + R.id.user_iv_head -> { + context?.let { + var token= DataStoreManager.getToken() + if (token.isNotEmpty()) { + startUserInfoSettingActivity(it) + }else{ + startLoginActivity(it) + } + } + } + R.id.user_tv_name -> { + context?.let { + var token= DataStoreManager.getToken() + if (token.isNotEmpty()) { + }else{ + startLoginActivity(it) + } + } + } + R.id.title_iv_right -> { + context?.let { startUserSettingActivity(it) } + } + R.id.tv_login_out -> { + context?.let { + startLoginActivity(it) + requireActivity().finish() + } + } + } + } + + override fun onMessageEvent(event: Any?) { + super.onMessageEvent(event) + if (event is UserInfoEvent) { + initData() + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/imActivity/FragmentAdapter.java b/app/src/main/java/com/xjjk/healthyclients/imActivity/FragmentAdapter.java new file mode 100644 index 0000000..7cc692e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/imActivity/FragmentAdapter.java @@ -0,0 +1,46 @@ +package com.xjjk.healthyclients.imActivity; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; +import androidx.lifecycle.Lifecycle; +import androidx.viewpager2.adapter.FragmentStateAdapter; + +import java.util.List; + +public class FragmentAdapter extends FragmentStateAdapter { + private static final String TAG = FragmentAdapter.class.getSimpleName(); + + private List fragmentList; + + public FragmentAdapter(@NonNull FragmentActivity fragmentActivity) { + super(fragmentActivity); + } + + public FragmentAdapter(@NonNull Fragment fragment) { + super(fragment); + } + + public FragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) { + super(fragmentManager, lifecycle); + } + + public void setFragmentList(List fragmentList) { + this.fragmentList = fragmentList; + } + + @NonNull + @Override + public Fragment createFragment(int position) { + if (fragmentList == null || fragmentList.size() <= position) { + return new Fragment(); + } + return fragmentList.get(position); + } + + @Override + public int getItemCount() { + return fragmentList == null ? 0 : fragmentList.size(); + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/imActivity/IMMainActivity.java b/app/src/main/java/com/xjjk/healthyclients/imActivity/IMMainActivity.java new file mode 100644 index 0000000..f919164 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/imActivity/IMMainActivity.java @@ -0,0 +1,579 @@ +package com.xjjk.healthyclients.imActivity; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Build; +import android.os.Bundle; +import android.text.TextUtils; +import android.util.Log; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +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.xjjk.healthyclients.utils.TUIUtils; +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.TitleBarLayout; +import com.tencent.qcloud.tuicore.component.action.PopActionClickListener; +import com.tencent.qcloud.tuicore.component.action.PopMenuAction; +import com.tencent.qcloud.tuicore.component.activities.BaseLightActivity; +import com.tencent.qcloud.tuicore.component.interfaces.ITitleBarLayout; +import com.tencent.qcloud.tuicore.util.ErrorMessageConverter; +import com.tencent.qcloud.tuicore.util.ToastUtil; +import com.tencent.qcloud.tuikit.tuicontact.TUIContactConstants; +import com.tencent.qcloud.tuikit.tuicontact.classicui.pages.TUIContactFragment; +import com.tencent.qcloud.tuikit.tuiconversation.TUIConversationConstants; +import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragment; + +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 IMMainActivity extends BaseLightActivity { + + private static final String TAG = IMMainActivity.class.getSimpleName(); + private TextView mCommunityBtnText; + private TextView mConversationBtnText; + private TextView mContactBtnText; + private TextView mProfileSelfBtnText; + private View mConversationBtn; + private ImageView mCommunityBtnIcon; + private ImageView mConversationBtnIcon; + private ImageView mContactBtnIcon; + private ImageView mProfileSelfBtnIcon; + private TextView mMsgUnread; + private TextView mNewFriendUnread; + private View mainNavigationBar; + + private TitleBarLayout mainTitleBar; + private Menu menu; + + private ViewPager2 mainViewPager; + private List fragments; + + private int count = 0; + private long lastClickTime = 0; + private HashMap markUnreadMap = new HashMap<>(); + + private static WeakReference 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(MainActivity.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.im_activity); + + mainTitleBar = findViewById(R.id.main_title_bar); + initMenuAction(); + mCommunityBtnText = findViewById(R.id.tab_community_tv); + mConversationBtnText = findViewById(R.id.conversation); + mContactBtnText = findViewById(R.id.contact); + mProfileSelfBtnText = findViewById(R.id.mine); + mCommunityBtnIcon = findViewById(R.id.tab_community_icon); + mConversationBtnIcon = findViewById(R.id.tab_conversation_icon); + mContactBtnIcon = findViewById(R.id.tab_contact_icon); + mProfileSelfBtnIcon = findViewById(R.id.tab_profile_icon); + mConversationBtn = findViewById(R.id.conversation_btn_group); + mMsgUnread = findViewById(R.id.msg_total_unread); + mNewFriendUnread = findViewById(R.id.new_friend_total_unread); + mainNavigationBar = findViewById(R.id.main_navigation_bar); + + fragments = new ArrayList<>(); + fragments.add(new TUIConversationFragment()); +// fragments.add(new TUICommunityFragment()); + fragments.add(new TUIContactFragment()); +// fragments.add(new ProfileFragment()); + + 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); + setConversationTitleBar(); + + prepareToClearAllUnreadMessage(); + } + + private void initMenuAction() { + int titleBarIconSize = 23; + mainTitleBar.getLeftIcon().setMaxHeight(titleBarIconSize); + mainTitleBar.getLeftIcon().setMaxWidth(titleBarIconSize); + mainTitleBar.getRightIcon().setMaxHeight(titleBarIconSize); + mainTitleBar.getRightIcon().setMaxWidth(titleBarIconSize); + mainTitleBar.setOnRightClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (menu == null) { + return; + } + if (menu.isShowing()) { + menu.hide(); + } else { + menu.show(); + } + } + }); + } + + 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(IMMainActivity.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(IMMainActivity.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>() { + @Override + public void onSuccess(HashMap stringV2TIMConversationHashMap) { + if (stringV2TIMConversationHashMap.size() == 0) { + return; + } + List unreadConversationIDList = new ArrayList<>(); + Iterator> iterator = markUnreadMap.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + unreadConversationIDList.add(entry.getKey()); + } + + V2TIMManager.getConversationManager().markConversation(unreadConversationIDList, + V2TIMConversation.V2TIM_CONVERSATION_MARK_TYPE_UNREAD, + false, + new V2TIMValueCallback>() { + @Override + public void onSuccess(List 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> callback) { + if (fromStart) { + markUnreadMap.clear(); + } + V2TIMManager.getConversationManager().getConversationListByFilter(filter, nextSeq, count, new V2TIMValueCallback() { + @Override + public void onSuccess(V2TIMConversationResult v2TIMConversationResult) { + List 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: + mainTitleBar.setVisibility(View.VISIBLE); + mainViewPager.setCurrentItem(0, false); + setConversationTitleBar(); + break; + case R.id.community_btn_group: + mainTitleBar.setVisibility(View.GONE); + mainViewPager.setCurrentItem(1, false); + setCommunityBackground(); + break; + case R.id.contact_btn_group: + mainTitleBar.setVisibility(View.VISIBLE); + mainViewPager.setCurrentItem(2, false); + setContactTitleBar(); + break; + case R.id.myself_btn_group: + mainTitleBar.setVisibility(View.VISIBLE); + mainViewPager.setCurrentItem(3, false); + setProfileTitleBar(); + break; + default: + break; + } + } + + private void setCommunityBackground() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + getWindow().setStatusBarColor(getResources().getColor(R.color.demo_community_page_status_bar_color)); + } + mainNavigationBar.setBackgroundColor(getResources().getColor(R.color.demo_community_page_navigate_bar_color)); + } + + private void setConversationTitleBar() { + mainTitleBar.setTitle(getResources().getString(R.string.conversation_title), ITitleBarLayout.Position.MIDDLE); + mainTitleBar.getLeftGroup().setVisibility(View.GONE); + mainTitleBar.getRightGroup().setVisibility(View.VISIBLE); + int titleBarIconSize = 23; + ViewGroup.LayoutParams params = mainTitleBar.getRightIcon().getLayoutParams(); + params.width = titleBarIconSize; + params.height = titleBarIconSize; + mainTitleBar.getRightIcon().setLayoutParams(params); + setConversationMenu(); + } + + private void setConversationMenu() { + menu = new Menu(this, mainTitleBar.getRightIcon()); + PopActionClickListener popActionClickListener = new PopActionClickListener() { + @Override + public void onActionClick(int position, Object data) { + PopMenuAction action = (PopMenuAction) data; + if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.start_conversation))) { + TUIUtils.startActivity("StartC2CChatActivity", null); + } + + if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.create_private_group))) { + Bundle bundle = new Bundle(); + bundle.putInt(TUIConversationConstants.GroupType.TYPE, TUIConversationConstants.GroupType.PRIVATE); + TUIUtils.startActivity("StartGroupChatActivity", bundle); + } + if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.create_group_chat))) { + Bundle bundle = new Bundle(); + bundle.putInt(TUIConversationConstants.GroupType.TYPE, TUIConversationConstants.GroupType.PUBLIC); + TUIUtils.startActivity("StartGroupChatActivity", bundle); + } + if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.create_chat_room))) { + Bundle bundle = new Bundle(); + bundle.putInt(TUIConversationConstants.GroupType.TYPE, TUIConversationConstants.GroupType.CHAT_ROOM); + TUIUtils.startActivity("StartGroupChatActivity", bundle); + } + if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.create_community))) { + Bundle bundle = new Bundle(); + bundle.putInt(TUIConversationConstants.GroupType.TYPE, TUIConversationConstants.GroupType.COMMUNITY); + TUIUtils.startActivity("StartGroupChatActivity", bundle); + } + menu.hide(); + } + }; + + List menuActions = new ArrayList<>(); + + PopMenuAction action = new PopMenuAction(); + + action.setActionName(getResources().getString(R.string.start_conversation)); + action.setActionClickListener(popActionClickListener); + action.setIconResId(R.drawable.create_c2c); + menuActions.add(action); + + action = new PopMenuAction(); + action.setActionName(getResources().getString(R.string.create_group_chat)); + action.setIconResId(R.drawable.group_icon); + action.setActionClickListener(popActionClickListener); + menuActions.add(action); + + menu.setMenuAction(menuActions); + } + + private void setContactTitleBar() { + mainTitleBar.setTitle(getResources().getString(R.string.contact_title), ITitleBarLayout.Position.MIDDLE); + mainTitleBar.getLeftGroup().setVisibility(View.GONE); + mainTitleBar.getRightGroup().setVisibility(View.VISIBLE); + setContactMenu(); + } + + public void setContactMenu() { + menu = new Menu(this, mainTitleBar.getRightIcon()); + List menuActionList = new ArrayList<>(2); + PopActionClickListener popActionClickListener = new PopActionClickListener() { + @Override + public void onActionClick(int index, Object data) { + PopMenuAction action = (PopMenuAction) data; + if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.add_friend))) { + Bundle bundle = new Bundle(); + bundle.putBoolean(TUIContactConstants.GroupType.GROUP, false); + TUIUtils.startActivity("AddMoreActivity", bundle); + } + if (TextUtils.equals(action.getActionName(), getResources().getString(R.string.add_group))) { + Bundle bundle = new Bundle(); + bundle.putBoolean(TUIContactConstants.GroupType.GROUP, true); + TUIUtils.startActivity("AddMoreActivity", bundle); + } + menu.hide(); + } + }; + PopMenuAction action = new PopMenuAction(); + action.setActionName(getResources().getString(R.string.add_friend)); + action.setIconResId(com.tencent.qcloud.tuikit.tuicontact.R.drawable.contact_add_friend); + action.setActionClickListener(popActionClickListener); + menuActionList.add(action); + + action = new PopMenuAction(); + action.setActionName(getResources().getString(R.string.add_group)); + action.setIconResId(com.tencent.qcloud.tuikit.tuicontact.R.drawable.contact_add_group); + action.setActionClickListener(popActionClickListener); + menuActionList.add(action); + menu.setMenuAction(menuActionList); + } + + private void setProfileTitleBar() { + mainTitleBar.getLeftGroup().setVisibility(View.GONE); + mainTitleBar.getRightGroup().setVisibility(View.GONE); + mainTitleBar.setTitle(getResources().getString(R.string.profile), ITitleBarLayout.Position.MIDDLE); + } + + private void resetMenuState() { + + } + + private final V2TIMFriendshipListener friendshipListener = new V2TIMFriendshipListener() { + @Override + public void onFriendApplicationListAdded(List applicationList) { + refreshFriendApplicationUnreadCount(); + } + + @Override + public void onFriendApplicationListDeleted(List 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 registerUnreadListener() { + V2TIMManager.getFriendshipManager().addFriendListener(friendshipListener); + refreshFriendApplicationUnreadCount(); + } + + private void refreshFriendApplicationUnreadCount() { + V2TIMManager.getFriendshipManager().getFriendApplicationList(new V2TIMValueCallback() { + @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(); + } + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/imActivity/MainMinimalistActivity.java b/app/src/main/java/com/xjjk/healthyclients/imActivity/MainMinimalistActivity.java new file mode 100644 index 0000000..44016c7 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/imActivity/MainMinimalistActivity.java @@ -0,0 +1,445 @@ +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 fragments; + + private HashMap markUnreadMap = new HashMap<>(); + + private static WeakReference 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>() { + @Override + public void onSuccess(HashMap stringV2TIMConversationHashMap) { + if (stringV2TIMConversationHashMap.size() == 0) { + return; + } + List unreadConversationIDList = new ArrayList<>(); + Iterator> iterator = markUnreadMap.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + unreadConversationIDList.add(entry.getKey()); + } + + V2TIMManager.getConversationManager().markConversation(unreadConversationIDList, + V2TIMConversation.V2TIM_CONVERSATION_MARK_TYPE_UNREAD, + false, + new V2TIMValueCallback>() { + @Override + public void onSuccess(List 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> callback) { + if (fromStart) { + markUnreadMap.clear(); + } + V2TIMManager.getConversationManager().getConversationListByFilter(filter, nextSeq, count, new V2TIMValueCallback() { + @Override + public void onSuccess(V2TIMConversationResult v2TIMConversationResult) { + List 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 applicationList) { + refreshFriendApplicationUnreadCount(); + } + + @Override + public void onFriendApplicationListDeleted(List 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() { + @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(); + } + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/imActivity/Menu.java b/app/src/main/java/com/xjjk/healthyclients/imActivity/Menu.java new file mode 100644 index 0000000..03ee489 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/imActivity/Menu.java @@ -0,0 +1,172 @@ +package com.xjjk.healthyclients.imActivity; + +import android.app.Activity; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PixelFormat; +import android.graphics.RectF; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ListView; +import android.widget.PopupWindow; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.tencent.qcloud.tuicore.R; +import com.tencent.qcloud.tuicore.component.action.PopMenuAction; +import com.tencent.qcloud.tuicore.component.action.PopMenuAdapter; +import com.tencent.qcloud.tuicore.util.ScreenUtil; + +import java.util.ArrayList; +import java.util.List; + +public class Menu { + + private static final int SHADOW_WIDTH = 10; + private static final int Y_OFFSET = 4; + + private ListView mMenuList; + private PopMenuAdapter mMenuAdapter; + private PopupWindow mMenuWindow; + private List mActions = new ArrayList<>(); + private Activity mActivity; + private View mAttachView; + + public Menu(Activity activity, View attach) { + mActivity = activity; + mAttachView = attach; + } + + public void setMenuAction(List menuActions) { + mActions.clear(); + mActions.addAll(menuActions); + } + + public boolean isShowing() { + if (mMenuWindow == null) { + return false; + } + return mMenuWindow.isShowing(); + } + + public void hide() { + mMenuWindow.dismiss(); + } + + public void show() { + if (mActions == null || mActions.size() == 0) { + return; + } + mMenuWindow = new PopupWindow(mActivity); + mMenuWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); + mMenuWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); + mMenuWindow.setBackgroundDrawable(new ColorDrawable()); + + mMenuAdapter = new PopMenuAdapter(); + mMenuAdapter.setDataSource(mActions); + View menuView = LayoutInflater.from(mActivity).inflate(R.layout.core_pop_menu, null); + menuView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); + mMenuWindow.setContentView(menuView); + mMenuList = menuView.findViewById(R.id.menu_pop_list); + mMenuList.setAdapter(mMenuAdapter); + mMenuList.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + PopMenuAction action = (PopMenuAction) mMenuAdapter.getItem(position); + if (action != null && action.getActionClickListener() != null) { + action.getActionClickListener().onActionClick(position, mActions.get(position)); + } + } + }); + + int paddingLeftRight = ScreenUtil.dip2px(15.0f); + int paddingTopBottom = ScreenUtil.dip2px(12.0f); + + int itemWidth = mActivity.getResources().getDimensionPixelSize(R.dimen.core_pop_menu_item_width); + int itemHeight = mActivity.getResources().getDimensionPixelSize(R.dimen.core_pop_menu_item_height); + float anchorWidth = mAttachView.getWidth(); + float anchorHeight = mAttachView.getHeight(); + + mMenuWindow.getContentView().measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); + + int[] location = new int[2]; + mAttachView.getLocationOnScreen(location); + int rowCount = mActions.size(); + int indicatorHeight = mActivity.getResources().getDimensionPixelOffset(R.dimen.core_pop_menu_indicator_height); + + int popWidth = itemWidth + paddingLeftRight * 2 - SHADOW_WIDTH; + int popHeight = itemHeight * rowCount + paddingTopBottom * 2 - SHADOW_WIDTH; + + float indicatorX = anchorWidth / 2; + int screenWidth = ScreenUtil.getScreenWidth(mActivity); + int x = location[0]; + int y; + float xOffset = anchorWidth / 2; + // If it is on the right, the x-coordinate of the small arrow and the x-position of the pop-up window will change + if (location[0] * 2 + anchorWidth > screenWidth) { + indicatorX = popWidth - anchorWidth / 2 - xOffset; + x = (int) (location[0] + anchorWidth - popWidth + xOffset); + } + + y = (int) (location[1] + anchorHeight) + Y_OFFSET; + popHeight = popHeight - indicatorHeight; + + Drawable backgroundDrawable = getBackgroundDrawable(popWidth, popHeight, indicatorX, indicatorHeight, 16); + menuView.setBackground(backgroundDrawable); + + mMenuWindow.setFocusable(true); + mMenuWindow.setTouchable(true); + mMenuWindow.setOutsideTouchable(true); + mMenuWindow.showAtLocation(mAttachView, Gravity.NO_GRAVITY, x, y); + } + + /** + * Draw a popup background with small triangles + */ + public Drawable getBackgroundDrawable(final float widthPixel, final float heightPixel, float indicatorX, float indicatorHeight, float radius) { + int borderWidth = SHADOW_WIDTH; + + Path path = new Path(); + Drawable drawable = new Drawable() { + + @Override + public void draw(@NonNull Canvas canvas) { + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setStyle(Paint.Style.FILL); + paint.setShadowLayer(borderWidth, 0,0,0xFFAAAAAA); + path.addRoundRect(new RectF(borderWidth, indicatorHeight + borderWidth, widthPixel - borderWidth, heightPixel + indicatorHeight - borderWidth), radius, radius, Path.Direction.CW); + path.moveTo(indicatorX - indicatorHeight, indicatorHeight + borderWidth); + path.lineTo(indicatorX, borderWidth); + path.lineTo(indicatorX + indicatorHeight, indicatorHeight + borderWidth); + path.close(); + canvas.drawPath(path, paint); + } + + @Override + public void setAlpha(int alpha) { + + } + + @Override + public void setColorFilter(@Nullable ColorFilter colorFilter) { + + } + + @Override + public int getOpacity() { + return PixelFormat.TRANSLUCENT; + } + }; + return drawable; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/CallbackManager.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/CallbackManager.kt new file mode 100644 index 0000000..dcaff1a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/CallbackManager.kt @@ -0,0 +1,43 @@ +package com.xuanjia.us.retrofit + +import com.xjjk.healthyclients.event.GlobalEvent +import com.xjjk.healthyclients.retrofit.CustomResponseResult +import org.greenrobot.eventbus.EventBus +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response + + +/** + * type + * + * 401 重新登录 410 刷新token + */ +public abstract class CallbackManager : Callback> { + + override fun onResponse(call: Call>, response: Response>) { + if (response.code() == 200) { + response?.body()?.let { + onSuccess(it.code,it.data,it.message) + } + } else if (response.code() == 422) { + onFail(response.code(),"${response.code()}-${response.message()}") + }else if (response.code() == 401) { + EventBus.getDefault().post(GlobalEvent(0)) + onFail(response.code(),"") + }else{ + onFail(response.code(),"${response.code()}-${response.message()}") + } + } + + override fun onFailure(call: Call>, t: Throwable) { + t.message?.let{ + println("服务器异常${it.toString()}") + onFail(-1,"服务器走丢了,请稍后重试") + } + } + + + protected abstract fun onSuccess(code: Int,data: T?,message:String) + protected abstract fun onFail(code: Int,errMsg: String?) +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/CustomResponseResult.java b/app/src/main/java/com/xjjk/healthyclients/retrofit/CustomResponseResult.java new file mode 100644 index 0000000..e567aa0 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/CustomResponseResult.java @@ -0,0 +1,39 @@ +package com.xjjk.healthyclients.retrofit; + +/** + */ +public class CustomResponseResult { + private int code; + private String message; + public T data; + + + public int getCode() { + return code; + } + + public CustomResponseResult setCode(int code) { + code = code; + return this; + } + + public String getMessage() { + if (message==null) + message="返回数据异常"; + return message; + } + + public CustomResponseResult setMessage(String message) { + message = message; + + return this; + } + + public T getData() { + return data; + } + + public void setData(T data) { + data = data; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/HealthCheckRetrofitHelper.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/HealthCheckRetrofitHelper.kt new file mode 100644 index 0000000..2970933 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/HealthCheckRetrofitHelper.kt @@ -0,0 +1,26 @@ +package com.xjjk.healthyclients.retrofit + +import com.xjjk.healthyclients.retrofit.UrlConfig.getDefaultBaseUrl +import com.xjjk.healthyclients.retrofit.interceptor.LoggingInterceptor2 +import com.xjjk.healthyclients.utils.ApiDns +import okhttp3.OkHttpClient +import retrofit2.Retrofit +import retrofit2.converter.gson.GsonConverterFactory +import java.util.concurrent.TimeUnit + +fun getHealthCheckRetrofit(): Retrofit { + val builder = OkHttpClient.Builder() + builder.connectTimeout(30, TimeUnit.SECONDS) + builder.readTimeout(30, TimeUnit.SECONDS) + builder.addInterceptor(LoggingInterceptor2()) + builder.dns(ApiDns()) + var baseUrl="" + baseUrl = getDefaultBaseUrl() + return Retrofit.Builder() + .baseUrl(baseUrl) +// .addConverterFactory(MoshiConverterFactory.create()) + .addConverterFactory(GsonConverterFactory.create()) + .client(builder.build()) + .build() + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/NetApi.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/NetApi.kt new file mode 100644 index 0000000..c7f4f30 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/NetApi.kt @@ -0,0 +1,22 @@ +package com.xjjk.healthyclients.retrofit + +import com.google.gson.JsonObject +import retrofit2.Call +import retrofit2.http.Headers +import retrofit2.http.POST +import retrofit2.http.Path + + +/** + * 注意:请求方法标记Headers,即使注解的是全路径,在拦截器还是会更换域名,除非拦截器验证是否包含域名 + */ +interface NetApi { + + /** + *刷新token + */ + @Headers("header:noHeader") + @POST("refreshtoken/{refreshToken}") + fun RefreshToken2(@Path("refreshToken")refreshToken:String): Call + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/RequestStatus.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/RequestStatus.kt new file mode 100644 index 0000000..6fcd555 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/RequestStatus.kt @@ -0,0 +1,9 @@ +package com.bihu.myapplication.retrofit + +enum class RequestStatus { + LOADCACHE, + START, + SUCCESS, + COMPLETE, + ERROR +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/ResultData.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/ResultData.kt new file mode 100644 index 0000000..5898f6b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/ResultData.kt @@ -0,0 +1,53 @@ +package com.xjjk.healthyclients.retrofit + +import com.bihu.myapplication.retrofit.RequestStatus + + +data class ResultData(val requestStatus: RequestStatus, + val data: T?, + val isCache: Boolean = false, + val error: Throwable? = null, + val tag: Any? = null) { + companion object { + fun loadCache(data: T?): ResultData { + return ResultData( + RequestStatus.LOADCACHE, + data + ) + } + + fun start(): ResultData { + return ResultData( + RequestStatus.START, + null + ) + } + + fun success(data: T?, isCache: Boolean = false): ResultData { + return ResultData( + RequestStatus.SUCCESS, + data, + isCache + ) + } + + fun complete(data: T?): ResultData { + return ResultData( + RequestStatus.COMPLETE, + data, + false + ) + } + + fun error(error: Throwable?): ResultData { + return ResultData( + RequestStatus.ERROR, + null, + false, + error + ) + } + + } +} + diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/RetrofitManager.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/RetrofitManager.kt new file mode 100644 index 0000000..b47b04e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/RetrofitManager.kt @@ -0,0 +1,90 @@ +package com.xjjk.healthyclients.retrofit + +import com.franmontiel.persistentcookiejar.PersistentCookieJar +import com.franmontiel.persistentcookiejar.cache.SetCookieCache +import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersistor +import com.orhanobut.logger.Logger +import com.xjjk.healthyclients.MyApplication.Companion.appContext +import com.xjjk.healthyclients.retrofit.UrlConfig.getDefaultBaseUrl +import com.xjjk.healthyclients.retrofit.gson.GsonConverterFactoryNew +import com.xjjk.healthyclients.retrofit.interceptor.CustomSignInterceptor +import com.xjjk.healthyclients.retrofit.interceptor.logInterceptor +import com.xjjk.healthyclients.utils.ApiDns +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.OkHttpClient +import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.toRequestBody +import retrofit2.Retrofit +import java.util.concurrent.TimeUnit + +/** + * Retrofit管理类 + * + * @author nanfeifei 2022/3/21 + */ +object RetrofitManager { + /** 请求超时时间 */ + private const val TIME_OUT_SECONDS = 30 + + /** 请求cookie */ + val cookieJar: PersistentCookieJar by lazy { + PersistentCookieJar( + SetCookieCache(), + SharedPrefsCookiePersistor(appContext) + ) + } + + /** 请求根地址 */ + private val BASE_URL: String get() = + getDefaultBaseUrl() + + + /** OkHttpClient相关配置 */ + private val client: OkHttpClient + get() = OkHttpClient.Builder() + .addInterceptor(CustomSignInterceptor()) + // 请求过滤器 + .addInterceptor(logInterceptor) + .dns(ApiDns()) + //设置缓存配置,缓存最大10M,设置了缓存之后可缓存请求的数据到data/data/包名/cache/net_cache目录中 +// .cache(Cache(File(appContext.cacheDir, "net_cache"), 10 * 1024 * 1024)) + //添加缓存拦截器 可传入缓存天数 +// .addInterceptor(CacheInterceptor(30)) + // 请求超时时间 + .connectTimeout(TIME_OUT_SECONDS.toLong(), TimeUnit.SECONDS) + .readTimeout(TIME_OUT_SECONDS.toLong(), TimeUnit.SECONDS) + .writeTimeout(TIME_OUT_SECONDS.toLong(), TimeUnit.SECONDS) +// .cookieJar(cookieJar) + .build() + /** + * Retrofit相关配置 + */ + private fun initRetrofit(client: OkHttpClient, baseUrl: String?): Retrofit{ + return Retrofit.Builder() + .client(client) + // 使用Moshi更适合Kotlin + .addConverterFactory(GsonConverterFactoryNew.create()) + .baseUrl(baseUrl ?: BASE_URL) + .build() + } + + private val retrofit: Retrofit by lazy { + initRetrofit(client, BASE_URL) + } + + public fun getRetrofits():Retrofit{ + return retrofit + } + + fun getService(serviceClass: Class, baseUrl: String? = null): T { + Logger.e(BASE_URL) + if(retrofit != null && baseUrl.isNullOrEmpty()){ + return retrofit.create(serviceClass) + } + return initRetrofit(client, baseUrl).create(serviceClass) + } + + fun String.toRequestBody(): RequestBody { + return toRequestBody("application/json; charset=utf-8".toMediaTypeOrNull()) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/UrlConfig.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/UrlConfig.kt new file mode 100644 index 0000000..98cc505 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/UrlConfig.kt @@ -0,0 +1,152 @@ +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://health-api.tzgl.shuziweidao.com" +// private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "http://192.168.1.98/" + + 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://console.shuziweidao.com" + + val baseUrlType: BaseUrlType = BaseUrlType.PRODUCT + + + var testDeviceList = mutableListOf("7e8e7e49a26340b1","bb2d17cc138d109f")//测试设备列表 荣耀 oppo vivo + var isTestDevice: Boolean = false + var isOpenIm: Boolean = false + + enum class BaseUrlType(val type: Int) { + DEBUG(1), + TEST(2), + PRODUCT(3) + } + + private fun getBaseUrl(baseUrlType: BaseUrlType = BaseUrlType.DEBUG): String { + return when (baseUrlType) { + BaseUrlType.DEBUG -> { + DEBUG_DEFAULT_IP_ADDRESS_REMOTE + } + + BaseUrlType.TEST -> { + TEST_DEFAULT_IP_ADDRESS_REMOTE + } + + BaseUrlType.PRODUCT -> { + PRODUCT_DEFAULT_IP_ADDRESS_REMOTE + } + } + } + fun getH5BaseUrl(baseUrlType: BaseUrlType = BaseUrlType.DEBUG): String { + return when (baseUrlType) { + BaseUrlType.DEBUG -> { + DEBUG_H5_ADDRESS_REMOTE + } + + BaseUrlType.TEST -> { + TEST_H5_ADDRESS_REMOTE + } + + BaseUrlType.PRODUCT -> { + PRODUCT_H5_ADDRESS_REMOTE + } + } + } + /** + * 方便后续加一些其他逻辑 + */ + fun getDefaultBaseUrl(): String { + return getBaseUrl(baseUrlType) + } + + /** + * 方便在APP运行之后切换环境所以用 get获取 + */ + val IMAGE_BASE_URL: String get() = getDefaultBaseUrl() + "/file/show/" + + /** + * H5访问地址 + * test地址 http://cms.dev.yg.dt.io/ + */ + fun getH5Url(): String{ +// return "http://192.168.1.32:9000"+ "/static/mobile" + return getH5BaseUrl(baseUrlType) + "/static/mobile" + } + + /** + * 手表部分的h5,原来防脑萃中模块的本地h5文件 + */ + fun getH5MonitorUrl(): String{ + return getH5BaseUrl(baseUrlType) + "/static/monitor/index.html?" + } + + + /** + * 获取评估报告模块地址 + * @param type 0,健康风险 1,心理评估 + */ + + fun getEvaluationReportUrl(type: Int): String { + var httpUrl = getDefaultBaseUrl().toHttpUrl() + return getH5Url() + + "/?scheme=" + httpUrl.scheme + + "&host=" + httpUrl.host + + "&mobile=0" + + "&tokenF=" + DataStoreManager.getToken() + + "&type=" + type + } + fun getKnowledgeDetailUrl(@UrlH5RouteUtils.RouteType routeType: String, map: MutableMap = mutableMapOf()):String{ +// return "http://192.168.1.22:9000/#/rich-text?id=sacsacasc&value=123132132" + var params="" + map.mapKeys { + params += "&${it.key}=${it.value}" + } + var httpUrl = getDefaultBaseUrl().toHttpUrl() + return getH5Url() + "/" +routeType+ + "?scheme=" + httpUrl.scheme + + "&host=" + httpUrl.host + + "&tokenF=" + DataStoreManager.getToken() + + params + } + + + /** + * 获取健康干预-膳食 接口地址 + */ + fun getInterventionFoodUrl():String { + return when (baseUrlType) { + BaseUrlType.DEBUG,BaseUrlType.TEST -> { + "https://vip.shuziweidao.com" + } + BaseUrlType.PRODUCT -> { + "https://yyjk.shuziweidao.com/" + } + } + } + + /** + * H5访问地址 + */ + fun getH5PdfUrl(): String { +// https://jkgy.wcrcnet.cn/static/mobile/indexSon? +// // scheme=http +// // s&host=jkgy.wcrcnet.cn +// // &hostAfter=gateway +// // &pdfUrl=temp/20240530/AED%E4%BD%BF%E7%94%A8.pdf_1717056401896.pdf + + val baseUrl = getH5BaseUrl(baseUrlType) + "/static/mobile/indexSon?" + var httpUrl = getDefaultBaseUrl().toHttpUrl() + return baseUrl + + "scheme=" + httpUrl.scheme + + "&host=" + httpUrl.host + + "&title=" + "文件详情" + + "&pdfUrl=" + + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/gson/GsonConverterFactoryNew.java b/app/src/main/java/com/xjjk/healthyclients/retrofit/gson/GsonConverterFactoryNew.java new file mode 100644 index 0000000..b40ea37 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/gson/GsonConverterFactoryNew.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2015 Square, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.xjjk.healthyclients.retrofit.gson; + +import com.google.gson.Gson; +import com.google.gson.TypeAdapter; +import com.google.gson.reflect.TypeToken; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import retrofit2.Converter; +import retrofit2.Retrofit; + +/** + * A {@linkplain Converter.Factory converter} which uses Gson for JSON. + * + *

Because Gson is so flexible in the types it supports, this converter assumes that it can + * handle all types. If you are mixing JSON serialization with something else (such as protocol + * buffers), you must {@linkplain Retrofit.Builder#addConverterFactory(Converter.Factory) add this + * instance} last to allow the other converters a chance to see their types. + */ +public final class GsonConverterFactoryNew extends Converter.Factory { + public static GsonConverterFactoryNew create() { + return create(new Gson()); + } + + public static GsonConverterFactoryNew create(Gson gson) { + return new GsonConverterFactoryNew(gson); + } + + private final Gson gson; + + private GsonConverterFactoryNew(Gson gson) { + if (gson == null) throw new NullPointerException("gson == null"); + this.gson = gson; + } + + @Override + public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { + TypeAdapter adapter = gson.getAdapter(TypeToken.get(type)); + + return new GsonResponseBodyConverter<>(gson, adapter); + } + + @Override + public Converter requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { + TypeAdapter adapter = gson.getAdapter(TypeToken.get(type)); + return new GsonRequestBodyConverter<>(gson, adapter); + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/gson/GsonRequestBodyConverter.java b/app/src/main/java/com/xjjk/healthyclients/retrofit/gson/GsonRequestBodyConverter.java new file mode 100644 index 0000000..c240423 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/gson/GsonRequestBodyConverter.java @@ -0,0 +1,38 @@ +package com.xjjk.healthyclients.retrofit.gson; + +import com.google.gson.Gson; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.nio.charset.Charset; + +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okio.Buffer; +import retrofit2.Converter; + +public final class GsonRequestBodyConverter implements Converter { + private static final MediaType MEDIA_TYPE = MediaType.get("application/json; charset=UTF-8"); + private static final Charset UTF_8 = Charset.forName("UTF-8"); + + private final Gson gson; + private final TypeAdapter adapter; + + public GsonRequestBodyConverter(Gson gson, TypeAdapter adapter) { + this.gson = gson; + this.adapter = adapter; + } + + @Override + public RequestBody convert(T value) throws IOException { + Buffer buffer = new Buffer(); + Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8); + JsonWriter jsonWriter = gson.newJsonWriter(writer); + adapter.write(jsonWriter, value); + jsonWriter.close(); + return RequestBody.create(MEDIA_TYPE, buffer.readByteString()); + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/gson/GsonResponseBodyConverter.java b/app/src/main/java/com/xjjk/healthyclients/retrofit/gson/GsonResponseBodyConverter.java new file mode 100644 index 0000000..c3cc01c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/gson/GsonResponseBodyConverter.java @@ -0,0 +1,90 @@ +package com.xjjk.healthyclients.retrofit.gson; + +import static com.google.common.base.Charsets.UTF_8; + +import com.google.gson.Gson; +import com.google.gson.JsonIOException; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; +import retrofit2.Converter; + +public final class GsonResponseBodyConverter implements Converter { + private final Gson gson; + private final TypeAdapter adapter; + + public GsonResponseBodyConverter(Gson gson, TypeAdapter adapter) { + this.gson = gson; + this.adapter = adapter; + } + + @Override + public T convert(ResponseBody value) throws IOException { + try { + String response = value.string(); + JSONObject jsonObject= null; + try { + jsonObject = new JSONObject(response); + } catch (JSONException e) { + e.printStackTrace(); + } + boolean success = jsonObject.optBoolean("success"); + boolean ok = jsonObject.optBoolean("ok"); + String message = jsonObject.optString("message"); + JsonReader jsonReader =null; + MediaType mediaType = value.contentType(); + Charset charset=mediaType!=null?mediaType.charset(UTF_8):UTF_8; + InputStream inputStream=new ByteArrayInputStream(response.getBytes()); + jsonReader=gson.newJsonReader(new InputStreamReader(inputStream,charset)); + if (success||ok) { + int code=jsonObject.optInt("code"); + if(code==0){ + return adapter.read(jsonReader); + }else if(code!=200){ + value.close(); +// throw new JsonIOException(message); + try { + jsonObject.put("result", JSONObject.NULL); + jsonObject.put("data", JSONObject.NULL); + JsonReader jsonReader2=gson.newJsonReader(new InputStreamReader(new ByteArrayInputStream(jsonObject.toString().getBytes()),charset)); + return adapter.read(jsonReader2); + } catch (JSONException e) { + throw new RuntimeException(e); + } + }else{ + return adapter.read(jsonReader); + } + }else{ + int code=jsonObject.optInt("code"); + if(code!=200){ + value.close(); +// throw new JsonIOException(message); + try { + jsonObject.put("result", JSONObject.NULL); + jsonObject.put("data", JSONObject.NULL); + JsonReader jsonReader2=gson.newJsonReader(new InputStreamReader(new ByteArrayInputStream(jsonObject.toString().getBytes()),charset)); + return adapter.read(jsonReader2); + } catch (JSONException e) { + throw new RuntimeException(e); + } + }else{ + return adapter.read(jsonReader); + } + } + } finally { + value.close(); + } + + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/BaseCustomDynamicInterceptor.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/BaseCustomDynamicInterceptor.kt new file mode 100644 index 0000000..69ba340 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/BaseCustomDynamicInterceptor.kt @@ -0,0 +1,228 @@ +/* + * Copyright (C) 2017 zhouyou(478319399@qq.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.xjjk.healthyclients.retrofit.interceptor + +import com.orhanobut.logger.Logger +import okhttp3.* +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull +import okhttp3.MultipartBody.Part.Companion.createFormData +import okhttp3.RequestBody.Companion.toRequestBody +import okio.Buffer +import java.io.File +import java.io.IOException +import java.io.UnsupportedEncodingException +import java.net.URLDecoder +import java.net.URLEncoder +import java.util.* + +/** + * + * 描述:动态拦截器 + * 主要功能是针对参数:

+ * 1.可以获取到全局公共参数和局部参数,统一进行签名sign

+ * 2.可以自定义动态添加参数,类似时间戳timestamp是动态变化的,token(登录了才有),参数签名等

+ * 3.参数值是经过UTF-8编码的

+ * 4.默认提供询问是否动态签名(签名需要自定义),动态添加时间戳等

+ * 作者: nanfeifei

+ * 日期: 2017/5/3 15:32

+ * 版本: v1.0

+ */ +abstract class BaseCustomDynamicInterceptor : Interceptor { + private var httpUrl: HttpUrl? = null + + @Throws(IOException::class) + override fun intercept(chain: Interceptor.Chain): Response { + var request: Request = chain.request() + var newBuilder: Request.Builder = request.newBuilder() + getHttpUrl(request.url)?.let { newBuilder = newBuilder.url(it) } + request = dynamicHeader(newBuilder).build() + if (request.method == "GET") { + httpUrl = parseUrl(request.url.toUrl().toString()).toHttpUrlOrNull() + request = addGetParamsSign(request) + } else if (request.method == "POST") { + httpUrl = request.url + request = addPostParamsSign(request) + } + return chain.proceed(request) + } + + private fun getHttpUrl(httpUrl: HttpUrl): HttpUrl? { +// var oldUri = httpUrl.toUri() +// Logger.d(oldUri.path) + + return httpUrl + } + + //get 添加签名和公共动态参数 + @Throws(UnsupportedEncodingException::class) + private fun addGetParamsSign(request: Request): Request { + var request = request + var httpUrl: HttpUrl = request.url + val newBuilder: HttpUrl.Builder = httpUrl.newBuilder() + + //获取原有的参数 + val nameSet: Set = httpUrl.queryParameterNames + val nameList = ArrayList() + nameList.addAll(nameSet) + val oldparams = TreeMap() + for (i in nameList.indices) { + + val value: String = if (httpUrl.queryParameterValues(nameList[i]) != null + && httpUrl.queryParameterValues(nameList[i]).isNotEmpty() + ) + httpUrl.queryParameterValues(nameList[i])[0].toString() else "" + oldparams[nameList[i]] = value + } + val nameKeys = listOf(nameList).toString() + //拼装新的参数 + val newParams = dynamic(oldparams) + for ((key, value) in newParams) { + val urlValue = URLEncoder.encode(value, Charsets.UTF_8.name()) + //原来的URl: https://xxx.xxx.xxx/app/chairdressing/skinAnalyzePower/skinTestResult?appId=10101 + if (!nameKeys.contains(key)) { //避免重复添加 + newBuilder.addQueryParameter(key, urlValue) + } + } + httpUrl = newBuilder.build() + request = request.newBuilder().url(httpUrl).build() + return request + } + + //post 添加签名和公共动态参数 + @Throws(UnsupportedEncodingException::class) + private fun addPostParamsSign(request: Request): Request { + var request = request + if (request.body is FormBody) { + val bodyBuilder = FormBody.Builder() + var formBody: FormBody? = request.body as FormBody? + + //原有的参数 + val oldparams = TreeMap() + if (formBody != null) { + for (i in 0 until formBody.size) { + oldparams[formBody.encodedName(i)] = formBody.encodedValue(i) + } + } + + //拼装新的参数 + val newParams = dynamic(oldparams) + //Logc.i("======post请求参数==========="); + for ((key, value1) in newParams) { + val value = URLDecoder.decode(value1, Charsets.UTF_8.name()) + bodyBuilder.addEncoded(key, value) + //Logc.i(entry.getKey() + " -> " + value); + } + formBody = bodyBuilder.build() + request = request.newBuilder().post(formBody).build() + } else if (request.body is MultipartBody) { + var multipartBody: MultipartBody? = request.body as MultipartBody? + val bodyBuilder: MultipartBody.Builder = + MultipartBody.Builder().setType(MultipartBody.FORM) + val oldparts: List = multipartBody?.parts ?: ArrayList() + + //拼装新的参数 + val newparts: MutableList = ArrayList() + newparts.addAll(oldparts) + val oldparams = TreeMap() + val newParams = dynamic(oldparams) + for ((key, value) in newParams) { + val part: MultipartBody.Part = createFormData(key, value) + newparts.add(part) + } + for (part in newparts) { + bodyBuilder.addPart(part) + } + multipartBody = bodyBuilder.build() + request = request.newBuilder().post(multipartBody).build() + } else if (isPlainJson(request.body!!.contentType())) { + var oldJsonStr = bodyToString(request) + val postJsonStr = dynamicJson(oldJsonStr) + val requestBody: RequestBody = + postJsonStr.toRequestBody(request.body!!.contentType()) + request = request.newBuilder().post(requestBody).build() + } + return request + } + + //解析前:https://xxx.xxx.xxx/app/chairdressing/skinAnalyzePower/skinTestResult?appId=10101 + //解析后:https://xxx.xxx.xxx/app/chairdressing/skinAnalyzePower/skinTestResult + private fun parseUrl(url: String): String { + var url = url + if ("" != url && url.contains("?")) { // 如果URL不是空字符串 + url = url.substring(0, url.indexOf('?')) + } + return url + } + + /** + * 将提交内容转化为字符串 + * @param request + * @return + */ + private fun bodyToString(request: Request): String? { + try { + val copy = request.newBuilder().build() + val buffer = Buffer() + copy.body!!.writeTo(buffer) + return buffer.readUtf8() + } catch (e: Exception) { + e.printStackTrace() + } + return null + } + + /** + * 动态处理Header + * + * @param builder + * @return 返回新的参数集合 + */ + abstract fun dynamicHeader(builder: Request.Builder): Request.Builder + + /** + * 动态处理参数(不包含Json形式) + * + * @param dynamicMap + * @return 返回新的参数集合 + */ + abstract fun dynamic(dynamicMap: TreeMap?): TreeMap + + /** + * 动态处理参数(Json形式) + * + * @param json + * @return 返回新的参数集合 + */ + abstract fun dynamicJson(json: String?): String + + companion object { + /** + * 判断提交内容是不是json格式 + * @param mediaType + * @return + */ + fun isPlainJson(mediaType: MediaType?): Boolean { + if (mediaType == null) return false + var subtype = mediaType.subtype + if (subtype != null) { + subtype = subtype.lowercase(Locale.getDefault()) + if (subtype.contains("json")) // + return true + } + return false + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/CacheInterceptor.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/CacheInterceptor.kt new file mode 100644 index 0000000..b43630e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/CacheInterceptor.kt @@ -0,0 +1,39 @@ +//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 +// } +//} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/CustomSignInterceptor.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/CustomSignInterceptor.kt new file mode 100644 index 0000000..d6a60b1 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/CustomSignInterceptor.kt @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2017 zhouyou(478319399@qq.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.xjjk.healthyclients.retrofit.interceptor + +import android.text.TextUtils +import com.google.gson.JsonObject +import com.google.gson.JsonParser +import com.orhanobut.logger.Logger +import com.sw.healthyclients.data.local.DataStoreManager +import com.sw.healthyclients.data.local.DataStoreManager.getInterventionToken +import com.xjjk.healthyclients.retrofit.UrlConfig +import com.xjjk.healthyclients.superfuntion.toFormatInt +import com.xjjk.healthyclients.superfuntion.toJson +import okhttp3.HttpUrl +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull +import okhttp3.Interceptor +import okhttp3.Request +import okhttp3.Response +import java.util.TreeMap +import java.util.concurrent.TimeUnit + + +/** + * + * 描述:对参数进行签名、添加token、时间戳处理的拦截器 + * 主要功能说明:

+ * 因为参数签名没办法统一,签名的规则不一样,签名加密的方式也不同有MD5、BASE64等等,只提供自己能够扩展的能力。

+ * 作者: nanfeifei

+ * 日期: 2017/5/4 15:21

+ * 版本: v1.0

+ */ +class CustomSignInterceptor : BaseCustomDynamicInterceptor() { + companion object { + var marketId = 10029 + const val BODY_NO_ENCODE = "bodyNoEncode" + } + + override fun dynamicHeader(builder: Request.Builder): Request.Builder { +// builder.addHeader("Content-Type", "application/json") + builder.addHeader("X-Access-Token", DataStoreManager.getToken()) + return builder + } + + override fun intercept(chain: Interceptor.Chain): Response { + var requestTimeout = chain.connectTimeoutMillis() + //获取request + val request = chain.request() + //从request中获取原有的HttpUrl实例oldHttpUrl + val oldHttpUrl = request.url + //获取request的创建者builder + val builder = request.newBuilder() + println("动态修改超时时间--${requestTimeout}") + //读取新的动态超时时间 + val requestTimeoutNew = request.header("TIMEOUT") + if (!requestTimeoutNew.isNullOrEmpty()) { + requestTimeout = requestTimeoutNew.toFormatInt() + println("动态修改超时时间connectTimeout:${requestTimeout}") + } + + + //从request中获取headers,通过给定的键url_name + val headerValues = request.headers("urlType") + if (headerValues != null && headerValues.size > 0) { + //如果有这个header,先将配置的header删除,因此header仅用作app和okhttp之间使用 + builder.removeHeader("urlType") + //匹配获得新的BaseUrl + val headerValue = headerValues[0] + var newBaseUrl: HttpUrl? = null + newBaseUrl = if ("levelTwo" == headerValue) { + UrlConfig.getInterventionFoodUrl().toHttpUrlOrNull() + } else { + oldHttpUrl + } + //重建新的HttpUrl,修改需要修改的url部分 + val newFullUrl = oldHttpUrl + .newBuilder() + .scheme("https") //更换网络协议 + .host(newBaseUrl!!.host) //更换主机名 + .port(newBaseUrl!!.port) //更换端口 + .build() + //重建这个request,通过builder.url(newFullUrl).build(); + if (getInterventionToken() != null && !getInterventionToken().isEmpty()) { + builder.header("X-Access-Token", getInterventionToken()) + } + // 然后返回一个response至此结束修改 + return chain.withConnectTimeout(requestTimeout, TimeUnit.MILLISECONDS) + .withReadTimeout(requestTimeout, TimeUnit.MILLISECONDS) + .withWriteTimeout(requestTimeout, TimeUnit.MILLISECONDS) + .proceed(builder.url(newFullUrl).build()) + } + return super.intercept( + chain.withConnectTimeout(requestTimeout, TimeUnit.MILLISECONDS) + .withReadTimeout(requestTimeout, TimeUnit.MILLISECONDS) + .withWriteTimeout(requestTimeout, TimeUnit.MILLISECONDS) + ) + } + + override fun dynamic(dynamicMap: TreeMap?): TreeMap { + //dynamicMap:是原有的全局参数+局部参数 +// dynamicMap?.set("marketId".asEncode(), marketId.toString()) //示例 + return dynamicMap!! //dynamicMap:是原有的全局参数+局部参数+新增的动态参数 + } + + override fun dynamicJson(json: String?): String { + var jsonObj: Any + jsonObj = if (TextUtils.isEmpty(json)) { + JsonObject() + } else { + JsonParser.parseString(json) + } + json?.let { Logger.d(it) } + return if (jsonObj is JsonObject) { + // jsonObj.addProperty("marketId".asEncode(), marketId) //示例 + if (jsonObj.has(BODY_NO_ENCODE)) { + jsonObj.remove(BODY_NO_ENCODE) + encrypt(jsonObj.toJson(), false) + } else { + jsonObj.remove(BODY_NO_ENCODE) + encrypt(jsonObj.toJson(), true) + } + } else { + json!! + } + } + + /** + * @param requestJson 请求字符串 + * @param isBodySign Body是否加密,无要求直接返回即可 + */ + private fun encrypt(requestJson: String, isBodySign: Boolean): String { + Logger.d(requestJson) + return requestJson + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/LogInterceptor.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/LogInterceptor.kt new file mode 100644 index 0000000..7b4d2d5 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/LogInterceptor.kt @@ -0,0 +1,16 @@ +package com.xjjk.healthyclients.retrofit.interceptor + +import com.orhanobut.logger.Logger +import com.xjjk.healthyclients.BuildConfig +import okhttp3.logging.HttpLoggingInterceptor + +/** + * okhttp 日志拦截器 + * @author nanfeifei 2022/3/21 + */ +val logInterceptor = HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger { + override fun log(message: String) { + // 使用自己的日志工具接管 + Logger.d(message) + } +}).setLevel(if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.BASIC) \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/LoggingInterceptor2.java b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/LoggingInterceptor2.java new file mode 100644 index 0000000..8d030fc --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/LoggingInterceptor2.java @@ -0,0 +1,177 @@ +package com.xjjk.healthyclients.retrofit.interceptor; + +import com.sw.healthyclients.data.local.DataStoreManager; +import com.orhanobut.logger.Logger; + +import java.io.EOFException; +import java.io.IOException; +import java.net.URLDecoder; +import java.nio.charset.Charset; +import java.nio.charset.UnsupportedCharsetException; + +import okhttp3.Headers; +import okhttp3.Interceptor; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import okhttp3.internal.http.HttpHeaders; +import okio.Buffer; +import okio.BufferedSource; + + +/** + * Created by Administrator on 2017/11/17. + */ + +public class LoggingInterceptor2 implements Interceptor { + public static String REQUESTPARAMS = ""; + public static String RESPONSEPARAMS = ""; + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + String path = request.url().encodedPath(); + + if (request.url().toString().contains("refreshtoken/") && request.method() == "POST") { + System.out.println("刷新token"); + return chain.proceed(request); + } + + long t1 = System.nanoTime(); + if (request.body() == null) { + REQUESTPARAMS = String.format("Sending request %s on %s%n%s%n%s", + request.url(), chain.connection(), request.headers(), request.body()); + if (!REQUESTPARAMS.contains("image/jpg")) { + Logger.e(REQUESTPARAMS); + } + } else { + REQUESTPARAMS = String.format("Sending request %s on %s%n%s%n%s", + request.url(), chain.connection(), request.headers(), getParam(request.body())); + if (!REQUESTPARAMS.contains("image/jpg")) { + Logger.e(REQUESTPARAMS); + } + } + Request.Builder requestBuilder = request.newBuilder(); + if (DataStoreManager.INSTANCE.getToken()!=null&&!DataStoreManager.INSTANCE.getToken().isEmpty() ) { + requestBuilder.header("X-Access-Token", DataStoreManager.INSTANCE.getToken()); + } +// requestBuilder.header("Platform", ConstantUtils.mPlatform); +// requestBuilder.header("VersionName", BuildConfig.VERSION_NAME); +// requestBuilder.header("VersionCode", BuildConfig.VERSION_CODE+""); +// requestBuilder.header("DeviceKey", ConstantUtils.Serial); +// requestBuilder.header("DeviceSn", ConstantUtils.DeviceSn); +// System.out.println("ConstantUtils.Serial--"+ConstantUtils.Serial); +// System.out.println("ConstantUtils.DeviceSn--"+ConstantUtils.DeviceSn); + request = requestBuilder.build(); + + Response response = chain.proceed(request); + +// ResponseBody responseBody = response.body(); + ResponseBody responseBody = response.peekBody(1024 * 1024); + long contentLength = responseBody.contentLength(); + if (!HttpHeaders.hasBody(response)) { + //END HTTP + } else if (bodyEncoded(response.headers())) { + //HTTP (encoded body omitted) + } else { + BufferedSource source = responseBody.source(); + source.request(Long.MAX_VALUE); // Buffer the entire body. + Buffer buffer = source.buffer(); + Charset charset = Charset.forName("UTF-8"); + MediaType contentType = responseBody.contentType(); + if (contentType != null) { + try { + charset = contentType.charset(Charset.forName("UTF-8")); + } catch (UnsupportedCharsetException e) { + return response; + } + } + if (!isPlaintext(buffer)) { + return response; + } + if (contentLength != 0) { + //获取到response的body的string字符串 +// String result = buffer.clone().readString(charset); + //当状态码返回的是400或者410,即代表过期 +// if (response.code() == 401) { +// long t2 = System.nanoTime(); +// RESPONSEPARAMS = String.format("Received Data: [%s] %njson:%s %n耗时: %.1fms%n%s", +// response.request().url(), +// responseBody.string(), +// (t2 - t1) / 1e6d, +// response.headers()); +// Logger.e(RESPONSEPARAMS); +// Logger.json(responseBody.string()); +//// IntentUtils.startLogin(); +// return response; +// } else { +// //此时没有过期 +// Log.d("============", "intercept: token ------------"); +// } + } + } + long t2 = System.nanoTime(); + RESPONSEPARAMS = String.format("Received Data: [%s] %njson:%s %n耗时: %.1fms%n%s", + response.request().url(), + responseBody.string(), + (t2 - t1) / 1e6d, + response.headers()); + Logger.e(RESPONSEPARAMS); + Logger.json(responseBody.string()); + return response; + } + + static synchronized String refreshToken() { + return ""; + } + + static boolean isPlaintext(Buffer buffer) throws EOFException { + try { + Buffer prefix = new Buffer(); + long byteCount = buffer.size() < 64 ? buffer.size() : 64; + buffer.copyTo(prefix, 0, byteCount); + for (int i = 0; i < 16; i++) { + if (prefix.exhausted()) { + break; + } + int codePoint = prefix.readUtf8CodePoint(); + if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) { + return false; + } + } + return true; + } catch (EOFException e) { + return false; // Truncated UTF-8 sequence. + } + } + + private boolean bodyEncoded(Headers headers) { + String contentEncoding = headers.get("Content-Encoding"); + return contentEncoding != null && !contentEncoding.equalsIgnoreCase("identity"); + } + + /** + * 读取参数 + * + * @param requestBody + * @return + */ + private String getParam(RequestBody requestBody) { + Buffer buffer = new Buffer(); + String logparm; + try { + requestBody.writeTo(buffer); + logparm = buffer.readUtf8(); + String s = logparm + .replaceAll("%(?![0-9a-fA-F]{2})", "%25") + .replaceAll("\\+", "%2B"); + logparm = URLDecoder.decode(s, "utf-8"); + } catch (IOException e) { + e.printStackTrace(); + return ""; + } + return logparm; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/UrlInterceptor.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/UrlInterceptor.kt new file mode 100644 index 0000000..592a6b4 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/interceptor/UrlInterceptor.kt @@ -0,0 +1,47 @@ +package com.xjjk.healthyclients.retrofit.interceptor + +import okhttp3.Interceptor +import okhttp3.Response + + +class UrlInterceptor : Interceptor { + override fun intercept(chain: Interceptor.Chain): Response { +// val request = chain.request() +// val body=request.body() +// +// val oldHttpUrl = request.url() +// val builder = request.newBuilder() +// val headerValues = request.headers("url_name") +// if (headerValues != null && headerValues.size > 0) { +// // 如果有这个header,先将配置的header删除,因此header仅用作app和okhttp之间使用 +// builder.removeHeader("url_name") +// // 匹配获得新的BaseUrl +// val headerValue = headerValues[0] +// var newBaseUrl: HttpUrl? = null +// newBaseUrl = if ("weather" == headerValue) { +// HttpUrl.parse(UrlConfig.BASE_URL_WEATHER) +// } else if ("book" == headerValue) { +// HttpUrl.parse(UrlConfig.BASE_URL_WEATHER2) +// } else { +// oldHttpUrl +// } +// // 重建新的HttpUrl,修改需要修改的url部分 +// val newFullUrl = oldHttpUrl +// .newBuilder() // 更换网络协议 +// .scheme(newBaseUrl!!.scheme()) // 更换主机名 +// .host(newBaseUrl!!.host()) // 更换端口 +// .port(newBaseUrl!!.port()) +// .build() +// // 重建这个request,通过builder.url(newFullUrl).build(); +// // 然后返回一个response至此结束修改 +// var request=builder.url(newFullUrl).build() +// Logger.e("网络请求--${request.method()}\n${request.url()}\n${request.headers()}\n${if (request.method().equals("POST")) Gson().toJson(body) else body}") +// return chain.proceed(request) +// } +// Logger.e("网络请求--${request.method()}\n${request.url()}\n${request.headers()}\n${if (request.method().equals("POST")) Gson().toJson(body) else body}") + return chain.proceed(chain.request()) + } + + +} + diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/CallbackInterventionManager.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/CallbackInterventionManager.kt new file mode 100644 index 0000000..7296126 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/CallbackInterventionManager.kt @@ -0,0 +1,56 @@ +package com.xjjk.healthyclients.retrofit.intervention + +import org.greenrobot.eventbus.EventBus +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response + + +/** + * type + * + * 401 重新登录 410 刷新token + */ +public abstract class CallbackInterventionManager : + Callback> { + + override fun onResponse( + call: Call>, + response: Response> + ) { + try { + if (response.code() == 200) { + var body = response?.body() + response?.body()?.let { + if (it.isSuccess) { + onSuccess(it.code, it.result, it.message, it.isSuccess) + } else { + onFail(110, it.message) + } + } + } else if (response.code() == 422) { + onFail(response.code(), "${response.code()}-${response.message()}") + } else if (response.code() == 401) { +// EventBus.getDefault().post(GlobalEvent(0)) + onFail(response.code(), "${response.message()}") + } else { + onFail(response.code(), "${response.code()}-${response.message()}") + } + } catch (e: Exception) { + onFail(110, "数据解析异常") + } + } + + override fun onFailure(call: Call>, t: Throwable) { + t.message?.let { + if (!"Canceled".equals(it)) { + println("服务器异常${it.toString()}") + onFail(-1, "服务器走丢了,请稍后重试") + } + } + } + + + protected abstract fun onSuccess(code: Int, result: T?, message: String, ok: Boolean) + protected abstract fun onFail(code: Int, errMsg: String?) +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/CustomInterventionResponseResult.java b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/CustomInterventionResponseResult.java new file mode 100644 index 0000000..3d4ea12 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/CustomInterventionResponseResult.java @@ -0,0 +1,51 @@ +package com.xjjk.healthyclients.retrofit.intervention; + +/** + */ +public class CustomInterventionResponseResult { + private boolean success; + private String message; + private int code; + public T result; + private long timestamp; + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public T getResult() { + return result; + } + + public void setResult(T result) { + this.result = result; + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/IdcardBean.java b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/IdcardBean.java new file mode 100644 index 0000000..c2a86fa --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/IdcardBean.java @@ -0,0 +1,13 @@ +package com.xjjk.healthyclients.retrofit.intervention; + +public class IdcardBean { + private String idcard; + + public String getIdcard() { + return idcard; + } + + public void setIdcard(String idcard) { + this.idcard = idcard; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/InterventionRetrofitHelper.kt b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/InterventionRetrofitHelper.kt new file mode 100644 index 0000000..68da559 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/InterventionRetrofitHelper.kt @@ -0,0 +1,30 @@ +package com.bihu.myapplication.retrofit + +import com.xjjk.healthyclients.retrofit.RetrofitManager +import com.xjjk.healthyclients.retrofit.interceptor.LoggingInterceptor2 +import com.xjjk.healthyclients.retrofit.UrlConfig.getDefaultBaseUrl +import com.xjjk.healthyclients.retrofit.UrlConfig.getInterventionFoodUrl +import com.xjjk.healthyclients.retrofit.gson.GsonConverterFactoryNew +import com.xjjk.healthyclients.retrofit.intervention.TokenHeaderInterceptor +import com.xjjk.healthyclients.utils.ApiDns +import okhttp3.OkHttpClient +import retrofit2.Retrofit +import retrofit2.converter.gson.GsonConverterFactory +import java.util.concurrent.TimeUnit + +fun getInterventionRetrofit(): Retrofit { +// val builder = OkHttpClient.Builder() +// builder.connectTimeout(30, TimeUnit.SECONDS) +// builder.readTimeout(30, TimeUnit.SECONDS) +// builder.addInterceptor(TokenHeaderInterceptor()) +// builder.dns(ApiDns()) +//// baseUrl = getDefaultBaseUrl() +// return Retrofit.Builder() +// .baseUrl(getInterventionFoodUrl()) +//// .addConverterFactory(MoshiConverterFactory.create()) +// .addConverterFactory(GsonConverterFactory.create()) +// .client(builder.build()) +// .build() + return RetrofitManager.getRetrofits() + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/TokenHeaderInterceptor.java b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/TokenHeaderInterceptor.java new file mode 100644 index 0000000..acb4399 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/retrofit/intervention/TokenHeaderInterceptor.java @@ -0,0 +1,173 @@ +package com.xjjk.healthyclients.retrofit.intervention; + +import com.orhanobut.logger.Logger; +import com.sw.healthyclients.data.local.DataStoreManager; + +import java.io.EOFException; +import java.io.IOException; +import java.net.URLDecoder; +import java.nio.charset.Charset; +import java.nio.charset.UnsupportedCharsetException; + +import okhttp3.Headers; +import okhttp3.Interceptor; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import okhttp3.internal.http.HttpHeaders; +import okio.Buffer; +import okio.BufferedSource; + +//在请求头里添加token的拦截器处理 +public class TokenHeaderInterceptor implements Interceptor { + public static String REQUESTPARAMS = ""; + public static String RESPONSEPARAMS = ""; + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + String path = request.url().encodedPath(); + + if (request.url().toString().contains("refreshtoken/") && request.method() == "POST") { + System.out.println("刷新token"); + return chain.proceed(request); + } + + long t1 = System.nanoTime(); + if (request.body() == null) { + REQUESTPARAMS = String.format("Sending request %s on %s%n%s%n%s", + request.url(), chain.connection(), request.headers(), request.body()); + if (!REQUESTPARAMS.contains("image/jpg")) { + Logger.e(REQUESTPARAMS); + } + } else { + REQUESTPARAMS = String.format("Sending request %s on %s%n%s%n%s", + request.url(), chain.connection(), request.headers(), getParam(request.body())); + if (!REQUESTPARAMS.contains("image/jpg")) { + Logger.e(REQUESTPARAMS); + } + } + Request.Builder requestBuilder = request.newBuilder(); + if (DataStoreManager.INSTANCE.getInterventionToken()!=null&&!DataStoreManager.INSTANCE.getInterventionToken().isEmpty() ) { + requestBuilder.header("X-Access-Token", DataStoreManager.INSTANCE.getInterventionToken()); + } +// requestBuilder.header("Platform", ConstantUtils.mPlatform); +// requestBuilder.header("VersionName", BuildConfig.VERSION_NAME); +// requestBuilder.header("VersionCode", BuildConfig.VERSION_CODE+""); +// requestBuilder.header("DeviceKey", ConstantUtils.Serial); +// requestBuilder.header("DeviceSn", ConstantUtils.DeviceSn); +// System.out.println("ConstantUtils.Serial--"+ConstantUtils.Serial); +// System.out.println("ConstantUtils.DeviceSn--"+ConstantUtils.DeviceSn); + request = requestBuilder.build(); + + Response response = chain.proceed(request); + +// ResponseBody responseBody = response.body(); + ResponseBody responseBody = response.peekBody(1024 * 1024); + long contentLength = responseBody.contentLength(); + if (!HttpHeaders.hasBody(response)) { + //END HTTP + } else if (bodyEncoded(response.headers())) { + //HTTP (encoded body omitted) + } else { + BufferedSource source = responseBody.source(); + source.request(Long.MAX_VALUE); // Buffer the entire body. + Buffer buffer = source.buffer(); + Charset charset = Charset.forName("UTF-8"); + MediaType contentType = responseBody.contentType(); + if (contentType != null) { + try { + charset = contentType.charset(Charset.forName("UTF-8")); + } catch (UnsupportedCharsetException e) { + return response; + } + } + if (!isPlaintext(buffer)) { + return response; + } + if (contentLength != 0) { + //获取到response的body的string字符串 +// String result = buffer.clone().readString(charset); + //当状态码返回的是400或者410,即代表过期 +// if (response.code() == 401) { +// long t2 = System.nanoTime(); +// RESPONSEPARAMS = String.format("Received Data: [%s] %njson:%s %n耗时: %.1fms%n%s", +// response.request().url(), +// responseBody.string(), +// (t2 - t1) / 1e6d, +// response.headers()); +// Logger.e(RESPONSEPARAMS); +// Logger.json(responseBody.string()); +//// IntentUtils.startLogin(); +// return response; +// } else { +// //此时没有过期 +// Log.d("============", "intercept: token ------------"); +// } + } + } + long t2 = System.nanoTime(); + RESPONSEPARAMS = String.format("Received Data: [%s] %njson:%s %n耗时: %.1fms%n%s", + response.request().url(), + responseBody.string(), + (t2 - t1) / 1e6d, + response.headers()); + Logger.e(RESPONSEPARAMS); + Logger.json(responseBody.string()); + return response; + } + + static synchronized String refreshToken() { + return ""; + } + + static boolean isPlaintext(Buffer buffer) throws EOFException { + try { + Buffer prefix = new Buffer(); + long byteCount = buffer.size() < 64 ? buffer.size() : 64; + buffer.copyTo(prefix, 0, byteCount); + for (int i = 0; i < 16; i++) { + if (prefix.exhausted()) { + break; + } + int codePoint = prefix.readUtf8CodePoint(); + if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) { + return false; + } + } + return true; + } catch (EOFException e) { + return false; // Truncated UTF-8 sequence. + } + } + + private boolean bodyEncoded(Headers headers) { + String contentEncoding = headers.get("Content-Encoding"); + return contentEncoding != null && !contentEncoding.equalsIgnoreCase("identity"); + } + + /** + * 读取参数 + * + * @param requestBody + * @return + */ + private String getParam(RequestBody requestBody) { + Buffer buffer = new Buffer(); + String logparm; + try { + requestBody.writeTo(buffer); + logparm = buffer.readUtf8(); + String s = logparm + .replaceAll("%(?![0-9a-fA-F]{2})", "%25") + .replaceAll("\\+", "%2B"); + logparm = URLDecoder.decode(s, "utf-8"); + } catch (IOException e) { + e.printStackTrace(); + return ""; + } + return logparm; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/superfuntion/BaseActivityFuntion.kt b/app/src/main/java/com/xjjk/healthyclients/superfuntion/BaseActivityFuntion.kt new file mode 100644 index 0000000..354eea9 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/superfuntion/BaseActivityFuntion.kt @@ -0,0 +1,169 @@ +package com.xjjk.healthyclients.superfuntion + +import android.content.Context +import android.util.Log +import com.tencent.imsdk.BaseConstants +import com.tencent.imsdk.v2.V2TIMConversation +import com.tencent.qcloud.tuicore.TUILogin +import com.tencent.qcloud.tuicore.interfaces.TUICallback +import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean +import com.xjjk.healthyclients.MyApplication +import com.xjjk.healthyclients.MyApplication.Companion.appContext +import com.xjjk.healthyclients.MyApplication.Companion.appViewModel +import com.xjjk.healthyclients.bean.UserInfo +import com.xjjk.healthyclients.retrofit.UrlConfig +import com.xjjk.healthyclients.utils.TUIUtils +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch + +/** + * 腾讯im登录方法 + */ +fun Context.loginIm(successCall: () -> Unit = {}) { + var userId = appViewModel.imUserId.value + var userSig: String = appViewModel.imSig.value + if (userSig.isNullOrEmpty() || userId.isNullOrEmpty()) { + CoroutineScope(Dispatchers.Main).launch { + appViewModel.getIMSig(successCall = { + loginIm(userId, it.userSig, successCall) + }) + } + } else { + loginIm(userId, userSig, successCall) + } +} + +fun Context.loginIm(userId: String, userSig: String, successCall: () -> Unit = {}) { + if (!UrlConfig.isOpenIm){ + return + } + if (TUILogin.isUserLogined() && userId == TUILogin.getUserId()) { + return + } + TUILogin.login( + appContext, + appViewModel.imAppId.value.toInt(), + userId, + userSig, + TUIUtils.loginConfig, + object : TUICallback() { + override fun onError(code: Int, desc: String) { + when (code) { + BaseConstants.ERR_SVR_ACCOUNT_USERSIG_EXPIRED, + BaseConstants.ERR_USER_SIG_EXPIRED -> {//UserSig过期 + userSigExpired() + } + } + Log.i( + MyApplication.TAG, + "imLogin errorCode = $code, errorInfo = $desc" + ) + } + + override fun onSuccess() { + UserInfo.getInstance().isAutoLogin = true + UserInfo.getInstance().isDebugLogin = true + appViewModel.setUserIMInfo() + successCall.invoke() + } + }) +} +fun Context.userSigExpired(loginSuccessCall: () -> Unit = {}){ + logout(successCall = { + loginIm(loginSuccessCall) + }) +} +fun logout(successCall: () -> Unit = {}){ + if (!TUILogin.isUserLogined()){ + return + } + CoroutineScope(Dispatchers.Main).launch{ + appViewModel.imSig.emit("") //清空本地缓存的UserSig + appViewModel.imUserId.emit("") + } + TUILogin.logout(object : TUICallback(){ + override fun onSuccess() { + successCall.invoke() + } + + override fun onError(errorCode: Int, errorMessage: String?) { + Log.i(MyApplication.TAG,"IM logout errorCode = $errorCode, errorInfo = $errorMessage") + } + }) +} +fun Context.startC2CChat(chatId: String, groupName: String, + autoSendMessage: String? = null, + consultantId: String? = "", + workBean: WorkBean? = null) { + if (TUILogin.isUserLogined()) { + // TUIUtils.createGroup("VHMQIUMM", "android测试组", V2TIMConversation.V2TIM_GROUP) + TUIUtils.startChat( + chatId, + groupName, + V2TIMConversation.V2TIM_C2C, + true, + null, + autoSendMessage, + consultantId, + workBean + ) + } else { + loginIm(successCall = { + TUIUtils.startChat( + chatId, + groupName, + V2TIMConversation.V2TIM_C2C, + false, + null, + autoSendMessage, + consultantId, + workBean + ) + }) + } +} + +/** + * 发起群聊 + * @param groupId 群组ID + * @param groupName 群组名称 + * @param initiateVideoCall 是否直接发起视频通话,需配合userIds使用 + * @param userIds 参与视频通话的成员 + */ +fun Context.startGroupChat( + groupId: String, + groupName: String = "", + initiateVideoCall: Boolean = false, + userIds: ArrayList? = null, + autoSendMessage: String? = null, + consultantId: String? = "", + workBean: WorkBean? = null +) { + if (TUILogin.isUserLogined()) { + // TUIUtils.createGroup("VHMQIUMM", "android测试组", V2TIMConversation.V2TIM_GROUP) + TUIUtils.startChat( + groupId, + groupName, + V2TIMConversation.V2TIM_GROUP, + initiateVideoCall, + userIds, + autoSendMessage, + consultantId, + workBean + ) + } else { + loginIm(successCall = { + TUIUtils.startChat( + groupId, + groupName, + V2TIMConversation.V2TIM_GROUP, + initiateVideoCall, + userIds, + autoSendMessage, + consultantId, + workBean + ) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/superfuntion/BaseViewModelExt.kt b/app/src/main/java/com/xjjk/healthyclients/superfuntion/BaseViewModelExt.kt new file mode 100644 index 0000000..d44a316 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/superfuntion/BaseViewModelExt.kt @@ -0,0 +1,191 @@ +package com.xjjk.healthyclients.superfuntion + +import androidx.lifecycle.viewModelScope +import com.google.gson.JsonSyntaxException +import com.orhanobut.logger.Logger +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 +import com.xjjk.healthyclients.data.bean.ApiResponse +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import org.json.JSONException + +/** + * BaseViewModel的一些扩展方法 + * + * @author LTP 2022/3/22 + */ + +/** + * 启动协程,封装了viewModelScope.launch + * + * @param showDialog 是否显示加载框 + * @param tryBlock try语句运行的函数 + * @param catchBlock catch语句运行的函数,可以用来做一些网络异常等的处理,默认空实现 + * @param finallyBlock finally语句运行的函数,可以用来做一些资源回收等,默认空实现 + */ +fun BaseViewModel.launch( + showDialog: Boolean, + tryBlock: suspend CoroutineScope.() -> Unit, + catchBlock: suspend CoroutineScope.() -> Unit = {}, + finallyBlock: suspend CoroutineScope.() -> Unit = {} +) { + // 默认是执行在主线程,相当于launch(Dispatchers.Main) + viewModelScope.launch { + try { + if(showDialog){ + loadingDialog.value = LOADING_STATE_SHOW + } + tryBlock() + } catch (e: Exception) { + if (e is JsonSyntaxException) { + var exceptionClassInfo=this@launch.javaClass.simpleName + Logger.e("json解析异常:${exceptionClassInfo}----${e.toString()}") + exception.value = JSONException("数据解析异常") + }else{ + exception.value = e + } + + catchBlock() + } finally { + finallyBlock() + } + } +} +fun BaseViewModel.launch( + tryBlock: suspend CoroutineScope.() -> Unit, + catchBlock: suspend CoroutineScope.() -> Unit = {}, + finallyBlock: suspend CoroutineScope.() -> Unit = {}, + isAutoShowEmpty: Boolean=false +) { + isAutoEmpty.value=isAutoShowEmpty + launch(true, tryBlock, catchBlock, finallyBlock) +} + +fun BaseViewModel.launch( + showDialog: Boolean, + tryBlock: suspend CoroutineScope.() -> Unit, + catchBlock: suspend CoroutineScope.() -> Unit = {}, + finallyBlock: suspend CoroutineScope.() -> Unit = {}, + isAutoShowEmpty: Boolean=false +) { + isAutoEmpty.value=isAutoShowEmpty + launch(showDialog, tryBlock, catchBlock, finallyBlock) +} + +/** + * 请求结果处理 + * + * @param response ApiResponse + * @param successBlock 服务器请求成功返回成功码的执行回调,默认空实现 + * @param errorBlock 服务器请求成功返回错误码的执行回调,默认返回false的空实现,函数返回值true:拦截统一错误处理,false:不拦截 + */ +suspend fun BaseViewModel.handleRequest( + response: ApiResponse, + successBlock: suspend CoroutineScope.(response: ApiResponse) -> Unit = {}, + errorBlock: suspend CoroutineScope.(response: ApiResponse) -> Boolean = { false } +) { + coroutineScope { + if(response.success||response.ok||200==response.code){ + if (loadingDialog.value== LOADING_STATE_SHOW) { + loadingDialog.value = LOADING_STATE_HIDE + } + if (response.data==null&&response.result==null){ + if(isAutoEmpty.value == true){ + showEmpty.value = isAutoEmpty.value == true + } + }else if (response.data is List<*>){ + if(isAutoEmpty.value == true) { + if (response.data.size == 0) { + showEmpty.value = isAutoEmpty.value == true + } else { + showEmpty.value = isAutoEmpty.value == false + } + } + }else if(response.result is List<*>){ + if(isAutoEmpty.value == true) { + if (response.result.size == 0) { + showEmpty.value = isAutoEmpty.value == true + } else { + showEmpty.value = isAutoEmpty.value == false + } + } + }else{ + if(isAutoEmpty.value == true) { + showEmpty.value = isAutoEmpty.value == false + } + } + successBlock(response) + }else{ +// when (response.code) { +// else -> { // 服务器返回的其他错误码 + if (!errorBlock(response)) { + // 只有errorBlock返回false不拦截处理时,才去统一提醒错误提示 + errorResponse.value = response + } + showEmpty.value = isAutoEmpty.value == true +// } + } + + } +} + +/** + * 请求结果处理 + * + * @param response ApiResponse + * @param successBlock 服务器请求成功返回成功码的执行回调,默认空实现 + * @param errorBlock 服务器请求成功返回错误码的执行回调,默认返回false的空实现,函数返回值true:拦截统一错误处理,false:不拦截 + * 为了兼容其他系统平移过来的 + */ +suspend fun BaseViewModel.handleRequest2( + response: ApiResponse, + successBlock: suspend CoroutineScope.(response: ApiResponse) -> Unit = {}, + errorBlock: suspend CoroutineScope.(response: ApiResponse) -> Boolean = { false } +) { + coroutineScope { + if(response.success||response.ok||response.code==200){ + if (loadingDialog.value== LOADING_STATE_SHOW) { + loadingDialog.value = LOADING_STATE_HIDE + } + if (response.data==null&&response.result==null){ + if(isAutoEmpty.value == true){ + showEmpty.value = isAutoEmpty.value == true + } + }else if (response.data is List<*>){ + if(isAutoEmpty.value == true) { + if (response.data.size == 0) { + showEmpty.value = isAutoEmpty.value == true + } else { + showEmpty.value = isAutoEmpty.value == false + } + } + }else if(response.result is List<*>){ + if(isAutoEmpty.value == true) { + if (response.result.size == 0) { + showEmpty.value = isAutoEmpty.value == true + } else { + showEmpty.value = isAutoEmpty.value == false + } + } + }else{ + if(isAutoEmpty.value == true) { + showEmpty.value = isAutoEmpty.value == false + } + } + successBlock(response) + }else{ +// when (response.code) { +// else -> { // 服务器返回的其他错误码 + if (!errorBlock(response)) { + // 只有errorBlock返回false不拦截处理时,才去统一提醒错误提示 + errorResponse.value = response + } + showEmpty.value = isAutoEmpty.value == true +// } + } + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/superfuntion/BindingViewExt.kt b/app/src/main/java/com/xjjk/healthyclients/superfuntion/BindingViewExt.kt new file mode 100644 index 0000000..a14d2c4 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/superfuntion/BindingViewExt.kt @@ -0,0 +1,35 @@ +package com.xjjk.healthyclients.superfuntion + +import android.widget.ImageView +import androidx.databinding.BindingAdapter +import com.allen.library.SuperTextView + +/** + * DataBinding的自定义属性 + * @author nanfeifie 2022/4/2 + */ + +@BindingAdapter("imageUrl") +fun ImageView.setImageUrl(url: String) { + load(url) +} + +/** + * ImageView设置圆形图片 + */ +@BindingAdapter("circleImageUrl") +fun ImageView.setCircleImageUrl(url: String?) { + loadCircle(url) +} +@BindingAdapter("sLeftTextString") +fun SuperTextView.setLeftTextString(text: CharSequence) { + setLeftString(text) +} +@BindingAdapter("sCenterTextString") +fun SuperTextView.setCenterTextString(text: CharSequence) { + setCenterString(text) +} +@BindingAdapter("sRightTextString") +fun SuperTextView.setRightTextString(text: CharSequence) { + setRightString(text) +} diff --git a/app/src/main/java/com/xjjk/healthyclients/superfuntion/EmergencyActivityFuntion.kt b/app/src/main/java/com/xjjk/healthyclients/superfuntion/EmergencyActivityFuntion.kt new file mode 100644 index 0000000..0e4e95e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/superfuntion/EmergencyActivityFuntion.kt @@ -0,0 +1,63 @@ +//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? { +// 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)) +//} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/superfuntion/EmergencyFragmentFuntion.kt b/app/src/main/java/com/xjjk/healthyclients/superfuntion/EmergencyFragmentFuntion.kt new file mode 100644 index 0000000..c54cc1d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/superfuntion/EmergencyFragmentFuntion.kt @@ -0,0 +1,66 @@ +package com.xjjk.healthyclients.superfuntion + +import android.content.Context +import android.content.Intent +import android.net.Uri +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.bean.emergency.LocationResourceBean +import com.xjjk.healthyclients.fragment.EmergencyFragment +import com.xjjk.healthyclients.utils.MapUtils +import com.xjjk.healthyclients.view.WindowDialogView + +fun EmergencyFragment.getMarkerInfo( + mLat: Double, + mLon: Double, + mMarkerList: MutableList +): 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 EmergencyFragment.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)) +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/superfuntion/SeekDoctorSearchActivityFuntion.kt b/app/src/main/java/com/xjjk/healthyclients/superfuntion/SeekDoctorSearchActivityFuntion.kt new file mode 100644 index 0000000..3eea714 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/superfuntion/SeekDoctorSearchActivityFuntion.kt @@ -0,0 +1,88 @@ +package com.xjjk.healthyclients.superfuntion + +import android.os.Build +import android.view.View +import android.view.View.OnLongClickListener +import androidx.annotation.RequiresApi +import com.google.android.material.tabs.TabLayout +import com.xjjk.healthyclients.ui.activity.guidance.SeekDoctorSearchActivity + +fun SeekDoctorSearchActivity.getTab(name: String): TabLayout.Tab { + var newTab = mBinding.seekDoctorSearchTab.newTab() + newTab.view.setOnLongClickListener(object : OnLongClickListener { + override fun onLongClick(v: View?): Boolean { + return true + } + }) + newTab.setText(name) + return newTab +} + + +/** + * 切换tab刷新相关操作 + * //0 综合 1专家 2医院 3疾病 4科室 + * 切换 + */ +fun SeekDoctorSearchActivity.switchTabRefresh(position: Int) { + mBinding?.apply { + when (position) { + 0 -> { + seekDoctorDepartmentListRoot.visibility = View.VISIBLE + seekDoctorDoctorListRoot.visibility = View.VISIBLE + seekDoctorHospitalListRoot.visibility = View.VISIBLE + seekDoctorDiseaseListRoot.visibility = View.VISIBLE + + rlDoctor.visibility=View.GONE + rlHospital.visibility=View.GONE + rlDisease.visibility=View.GONE + rlDepartment.visibility=View.GONE + } + 1 -> { + seekDoctorDoctorListRoot.visibility = View.VISIBLE + seekDoctorDepartmentListRoot.visibility = View.GONE + seekDoctorHospitalListRoot.visibility = View.GONE + seekDoctorDiseaseListRoot.visibility = View.GONE + + rlDoctor.visibility=View.GONE + rlHospital.visibility=View.GONE + rlDisease.visibility=View.GONE + rlDepartment.visibility=View.GONE + } + 2 -> { + seekDoctorHospitalListRoot.visibility = View.VISIBLE + seekDoctorDoctorListRoot.visibility = View.GONE + seekDoctorDepartmentListRoot.visibility = View.GONE + seekDoctorDiseaseListRoot.visibility = View.GONE + + rlDoctor.visibility=View.GONE + rlHospital.visibility=View.GONE + rlDisease.visibility=View.GONE + rlDepartment.visibility=View.GONE + } + 3 -> { + seekDoctorHospitalListRoot.visibility = View.GONE + seekDoctorDoctorListRoot.visibility = View.GONE + seekDoctorDepartmentListRoot.visibility = View.GONE + seekDoctorDiseaseListRoot.visibility = View.VISIBLE + + rlDoctor.visibility=View.GONE + rlHospital.visibility=View.GONE + rlDisease.visibility=View.GONE + rlDepartment.visibility=View.GONE + } + 4 -> { + seekDoctorHospitalListRoot.visibility = View.GONE + seekDoctorDoctorListRoot.visibility = View.GONE + seekDoctorDepartmentListRoot.visibility = View.VISIBLE + seekDoctorDiseaseListRoot.visibility = View.GONE + + rlDoctor.visibility=View.GONE + rlHospital.visibility=View.GONE + rlDisease.visibility=View.GONE + rlDepartment.visibility=View.GONE + } + } + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/superfuntion/StartActivityManager.kt b/app/src/main/java/com/xjjk/healthyclients/superfuntion/StartActivityManager.kt new file mode 100644 index 0000000..1b3985d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/superfuntion/StartActivityManager.kt @@ -0,0 +1,1404 @@ +package com.xjjk.healthyclients.superfuntion + +import android.content.Context +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import androidx.core.view.ContentInfoCompat +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.ui.activity.ChangePassWordActivity +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.UserInfoSettingActivity +import com.xjjk.healthyclients.ui.activity.UserSettingActivity +import com.xjjk.healthyclients.ui.activity.WebActivity +import com.xjjk.healthyclients.ui.activity.emergency.AddBigDiseaseActivity +import com.xjjk.healthyclients.ui.activity.emergency.EmergencySeekDoctorActivity +import com.xjjk.healthyclients.ui.activity.emergency.EmergencySeekDoctorDetailsActivity +import com.xjjk.healthyclients.ui.activity.guidance.AppointmentDetailActivity +import com.xjjk.healthyclients.ui.activity.guidance.ArchivesDetailActivity +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.FilterSearchDoctorActivity +import com.xjjk.healthyclients.ui.activity.guidance.GeneralPracticeGuidanceActivity +import com.xjjk.healthyclients.ui.activity.guidance.GuidanceNoticeActivity +import com.xjjk.healthyclients.ui.activity.guidance.MyGuidanceActivity +import com.xjjk.healthyclients.ui.activity.guidance.SelectAppointmentTimeActivity +import com.xjjk.healthyclients.ui.activity.guidance.SelectConsultantActivity +import com.xjjk.healthyclients.ui.activity.guidance.UserMyGuidanceActivity +import com.xjjk.healthyclients.utils.ConstantUtils + +//package com.xjjk.healthyclients.superfuntion +// +//import android.content.Context +//import android.content.Intent +//import android.net.Uri +//import android.os.Bundle +//import androidx.core.view.ContentInfoCompat +//import com.sw.healthexpertclient.ui.other.SimulateUserActivity +//import com.sw.healthyclients.bean.common.SelectUserMessageListBean +//import com.xjjk.healthyclients.bean.guidance.ConsultantBean +//import com.sw.healthyclients.bean.user.SelectEmergencyContactListBean +//import com.sw.healthyclients.ui.common.AnswerWebActivity +//import com.sw.healthyclients.ui.common.ChangePassWordActivity +//import com.sw.healthyclients.ui.common.LoginActivity +//import com.sw.healthyclients.ui.common.RetrievePassWordActivity +//import com.sw.healthyclients.ui.common.WebActivity +//import com.sw.healthyclients.ui.common.WebAppDownLoadActivity +//import com.sw.healthyclients.ui.emergency.AddBigDiseaseActivity +//import com.sw.healthyclients.ui.emergency.BigDiseaseActivity +//import com.sw.healthyclients.ui.emergency.BigDiseaseDetailsActivity +//import com.sw.healthyclients.ui.emergency.EmergencySeekDoctorActivity +//import com.sw.healthyclients.ui.emergency.EmergencySeekDoctorDetailsActivity +//import com.sw.healthyclients.ui.guidance.AppointmentDetailActivity +//import com.sw.healthyclients.ui.guidance.ArchivesDetailActivity +//import com.sw.healthyclients.ui.guidance.BaseHealthyInfoAddActivity +//import com.sw.healthyclients.ui.guidance.ConsultArchivesDetailActivity +//import com.sw.healthyclients.ui.guidance.ConsultantManagerActivity +//import com.sw.healthyclients.ui.guidance.DepartmentSearchActivity +//import com.sw.healthyclients.ui.guidance.DoctorAllAppraiseActivity +//import com.sw.healthyclients.ui.guidance.DoctorHomepageActivity +//import com.sw.healthyclients.ui.guidance.DoctorsGuidanceActivity +//import com.sw.healthyclients.ui.guidance.EditConsultantActivity +//import com.sw.healthyclients.ui.guidance.FilterSearchDoctorActivity +//import com.sw.healthyclients.ui.guidance.FullScreenImageActivity +//import com.sw.healthyclients.ui.guidance.GuidanceNoticeActivity +//import com.sw.healthyclients.ui.guidance.HospitalDetailsActivity +//import com.sw.healthyclients.ui.guidance.HospitalDetailsInfoActivity +//import com.sw.healthyclients.ui.guidance.IMHistoryActivity +//import com.sw.healthyclients.ui.guidance.KnowledgeAnswerDetailsActivity +//import com.sw.healthyclients.ui.guidance.MyGuidanceActivity +//import com.sw.healthyclients.ui.guidance.SearchDiseaseActivity +//import com.sw.healthyclients.ui.guidance.SeekDoctorActivity +//import com.sw.healthyclients.ui.guidance.SeekDoctorDepartmentActivity +//import com.sw.healthyclients.ui.guidance.SeekDoctorHospitalActivity +//import com.sw.healthyclients.ui.guidance.SeekDoctorSearchActivity +//import com.sw.healthyclients.ui.guidance.SelectAppointmentTimeActivity +//import com.sw.healthyclients.ui.guidance.SelectConsultantActivity +//import com.sw.healthyclients.ui.guidance.UserMyGuidanceActivity +//import com.sw.healthyclients.ui.guidance.UserRateActivity +//import com.sw.healthyclients.ui.guidance.ViewLocationActivity +//import com.sw.healthyclients.ui.healthcheck.CheckUpDetailActivity +//import com.sw.healthyclients.ui.healthcheck.FullscreenVideoActivity +//import com.sw.healthyclients.ui.healthcheck.RecordListActivity +//import com.sw.healthyclients.ui.healthrecord.BMIDataActivity +//import com.sw.healthyclients.ui.healthrecord.BloodFatActivity +//import com.sw.healthyclients.ui.healthrecord.BloodFatListActivity +//import com.sw.healthyclients.ui.healthrecord.BloodStressActivity +//import com.sw.healthyclients.ui.healthrecord.BloodStressListActivity +//import com.sw.healthyclients.ui.healthrecord.BloodSugarActivity +//import com.sw.healthyclients.ui.healthrecord.BloodSugarListActivity +//import com.sw.healthyclients.ui.healthrecord.CheckItemRecordChartActivity +//import com.sw.healthyclients.ui.healthrecord.CheckItemRecordTextActivity +//import com.sw.healthyclients.ui.healthrecord.CheckRecordDetailInfoActivity2 +//import com.sw.healthyclients.ui.healthrecord.CheckRecordDetailInfoActivityNew +//import com.sw.healthyclients.ui.healthrecord.CheckRecordListActivity +//import com.sw.healthyclients.ui.healthrecord.ConclusionSuggestionActivity +//import com.sw.healthyclients.ui.healthrecord.EnergyDemandActivity +//import com.sw.healthyclients.ui.healthrecord.ExceptionItemActivity +//import com.sw.healthyclients.ui.healthrecord.HealthCheckItemActivity +//import com.sw.healthyclients.ui.healthrecord.HealthCheckItemDetailActivity +//import com.sw.healthyclients.ui.healthrecord.HealthMonitorActivity +//import com.sw.healthyclients.ui.healthrecord.HealthRateActivity +//import com.sw.healthyclients.ui.healthrecord.HealthStatusActivity +//import com.sw.healthyclients.ui.healthrecord.IdealWeightActivity +//import com.sw.healthyclients.ui.healthrecord.KnowSelfActivity +//import com.sw.healthyclients.ui.healthrecord.LoseOneKiloActivity +//import com.sw.healthyclients.ui.healthrecord.MotionConsumptionActivity +//import com.sw.healthyclients.ui.healthrecord.SelectMotionActivity +//import com.sw.healthyclients.ui.healthrecord.WaistToHipRatioActivity +//import com.sw.healthyclients.ui.healthrecord.WeightRecordActivity +//import com.sw.healthyclients.ui.intervene2.activity.AedNetworkingDetailActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.ArticleDetailsActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.BloodVesselHealthActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.CardiovascularFirstAidDetailActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.DietStatActivity +//import com.sw.healthyclients.ui.intervene2.activity.EnrollActionDetailsActivity +//import com.sw.healthyclients.ui.intervene2.activity.EnrollActionHistoryDetailActivity +//import com.sw.healthyclients.ui.intervene2.activity.EnrollActionRankActivity +//import com.sw.healthyclients.ui.intervene2.activity.EnvironmentDetailActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.EnvironmentDetailPollenActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.EnvironmentDetectionActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.EnvironmentTabActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.EtiologicalResultActivity +//import com.sw.healthyclients.ui.intervene2.activity.ExpertDetailsActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.FirstAidAnswerResultActivity +//import com.sw.healthyclients.ui.intervene2.activity.FullscreenVideoActivityV2 +//import com.sw.healthyclients.ui.intervene2.activity.MedicalPointFragmentActivity +//import com.sw.healthyclients.ui.intervene2.activity.MotionStatActivity +//import com.sw.healthyclients.ui.intervene2.activity.QuestionActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.SportAllRankActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.SportEffectRecordListActivity +//import com.sw.healthyclients.ui.intervene2.activity.TrainAllRankActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.VideoDetailsActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.VideoDetailsActivityNew2 +//import com.sw.healthyclients.ui.intervene2.activity.VideoDetailsCenterActivity +//import com.sw.healthyclients.ui.intervene2.activity.VideoPlayActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.WarnDataActivityNew +//import com.sw.healthyclients.ui.intervene2.activity.WeightChangeActivity +//import com.sw.healthyclients.ui.intervene2.activity.WeightRankGreenActivity +//import com.sw.healthyclients.ui.intervene2.bean.AedNetworkingBean +//import com.sw.healthyclients.ui.intervene2.bean.CardiovascularFirstAidBean +//import com.sw.healthyclients.ui.intervene2.bean.FoodOverWeightInterventionActionBean +//import com.sw.healthyclients.ui.intervene2.bean.InterventionExpertBean +//import com.sw.healthyclients.ui.intervene2.bean.SportDetailBean +//import com.sw.healthyclients.ui.intervene2.bean.SportEffectPlanDetailBean +//import com.sw.healthyclients.ui.intervene2.utils.InterventionFragmentUtils +//import com.sw.healthyclients.ui.intervention.ChronicManagerActivity +//import com.sw.healthyclients.ui.intervention.InterventionTabPageActivity +//import com.sw.healthyclients.ui.intervention.InterventionTabPageActivityGreen +//import com.sw.healthyclients.ui.intervention.MedicalPointActivity +//import com.sw.healthyclients.ui.intervention.MedicalPointDetailsActivity +//import com.sw.healthyclients.ui.intervention.PhysicalExaminationViewDetailActivity +//import com.sw.healthyclients.ui.intervention.PostSecondaryActivity +//import com.sw.healthyclients.ui.intervention.VisitRecordActivity +//import com.sw.healthyclients.ui.knowledge.NoticeDetailsActivity +//import com.sw.healthyclients.ui.user.EmergencyContactActivity +//import com.sw.healthyclients.ui.user.LickAndCollectActivity +//import com.sw.healthyclients.ui.user.UserInfoSettingActivity +//import com.sw.healthyclients.ui.user.UserSettingActivity +//import com.sw.healthyclients.ui.user.UserSoSContactsActivity +//import com.sw.healthyclients.utils.ConstantUtils +//import java.io.Serializable +// +fun startActivity( + context: Context, @ContentInfoCompat.Flags flags: MutableList? = null, + bundle: Bundle? = null, targetClass: Class<*> +) { + var intent = Intent(context, targetClass) + if (!flags.isNullOrEmpty()) { + for (flag in flags) { + intent.flags = flag + } + } + if (bundle != null) { + intent.putExtras(bundle) + } + context.startActivity(intent) +} + +/** + * 咨询人管理 + */ +fun startConsultantManagerActivity(context: Context,darkStyle:Boolean=false) { + val bundle = Bundle() + bundle.putBoolean("darkStyle", darkStyle) + startActivity(context, bundle = bundle,targetClass = ConsultantManagerActivity::class.java) +} +// +///** +// * 我的咨询 +// */ +//fun startMyGuidanceActivity(context: Context, value: String) { +// val bundle = Bundle() +// bundle.putString("title", value) +// startActivity(context, bundle = bundle, targetClass = MyGuidanceActivity::class.java) +//} +// +/** + * 我的咨询 source=1 深色背景 + */ +fun startUserMyGuidanceActivity(context: Context, value: String, source: Int = 0) { + val bundle = Bundle() + bundle.putString("title", value) + bundle.putInt("source", source) + startActivity(context, bundle = bundle, targetClass = UserMyGuidanceActivity::class.java) +} + +/** + * 添加咨询人 + */ +fun startEditConsultantActivity(context: Context, consultantBean: ConsultantBean? = null) { + val bundle = Bundle() + bundle.putParcelable("consultantBean", consultantBean) + startActivity(context, bundle = bundle, targetClass = EditConsultantActivity::class.java) +} +// +///** +// * 找专家 +// */ +//fun startSeekDoctorActivity(context: Context) { +// startActivity(context, targetClass = SeekDoctorActivity::class.java) +//} +// +///** +// * 科室搜索 +// * type 0 科室 1 疾病 2医院 +// */ +//fun startDepartmentSearchActivity(context: Context, value: String, type: Int) { +// val bundle = Bundle() +// bundle.putString("search", value) +// bundle.putInt("type", type) +// startActivity(context, bundle = bundle, targetClass = DepartmentSearchActivity::class.java) +//} +// +///** +// * 找专家搜索结果页 +// */ +//fun startSeekDoctorSearchActivity(context: Context, value: String) { +// val bundle = Bundle() +// bundle.putString("search", value) +// startActivity(context, bundle = bundle, targetClass = SeekDoctorSearchActivity::class.java) +//} +// +///** +// * 医院主页 +// */ +//fun startHospitalDetailsActivity(context: Context, hospitalId: String) { +// val bundle = Bundle() +// bundle.putString("hospitalId", hospitalId) +// startActivity(context, bundle = bundle, targetClass = HospitalDetailsActivity::class.java) +//} +// +///** +// * 医院概况详情 +// */ +//fun startHospitalDetailsInfoActivity(context: Context, hospitalId: String) { +// val bundle = Bundle() +// bundle.putString("hospitalId", hospitalId) +// startActivity(context, bundle = bundle, targetClass = HospitalDetailsInfoActivity::class.java) +//} +// +///** +// * 医院评论 +// */ +//fun startUserRateActivity(context: Context, hospitalId: String) { +// val bundle = Bundle() +// bundle.putString("hospitalId", hospitalId) +// startActivity(context, bundle = bundle, targetClass = UserRateActivity::class.java) +//} +// +///** +// * 找专家搜索-全部医院 +// */ +//fun startSeekDoctorSearchAllHospitalActivity(context: Context) { +// startActivity(context, targetClass = SeekDoctorHospitalActivity::class.java) +//} +// +///** +// * 找专家搜索-按科室 +// */ +//fun startSeekDoctorSearchAllDepartmentActivity(context: Context) { +// startActivity(context, targetClass = SeekDoctorDepartmentActivity::class.java) +//} +// +///** +// * 体检列表 +// */ +//fun startRecordListActivity(context: Context) { +// startActivity(context, targetClass = RecordListActivity::class.java) +//} +// +/** + * 带筛选框的找专家 + */ +fun startFilterSearchDoctorActivity(context: Context, value: String = "", bundle: Bundle) { + bundle.putString("search", value) + startActivity(context, bundle = bundle, targetClass = FilterSearchDoctorActivity::class.java) +} +///** +// * 专家库咨询 +// */ +//fun startDoctorsGuidanceActivity(context: Context, officeIds: ArrayList, sicksIds: ArrayList) { +// val bundle = Bundle() +// bundle.putStringArrayList("officeIds", officeIds) +// bundle.putStringArrayList("sicksIds", sicksIds) +// startActivity(context, bundle = bundle, targetClass = DoctorsGuidanceActivity::class.java) +//} + +/** + * 选择咨询人 + */ +fun startSelectConsultantActivity( + context: Context, + consultType: ConstantUtils.ConsultType?, + doctorId: String? = null, + appointmentTimeId: String? = null +) { + val bundle = Bundle() + if (!doctorId.isNullOrEmpty()) { + bundle.putString("doctorId", doctorId) + } + if (!appointmentTimeId.isNullOrEmpty()) { + bundle.putString("appointmentTimeId", appointmentTimeId) + } + bundle.putParcelable("consultType", consultType) + startActivity(context, bundle = bundle, targetClass = SelectConsultantActivity::class.java) +} +// +///** +// * 找专家搜索-按疾病 +// */ +//fun startSearchDiseaseActivity(context: Context) { +// startActivity(context, targetClass = SearchDiseaseActivity::class.java) +//} + +/** + * 设置中心 + */ +fun startUserSettingActivity(context: Context) { + startActivity(context, targetClass = UserSettingActivity::class.java) +} +// +///** +// * web详情 +// */ +////@Deprecated( +//// "已废弃", ReplaceWith( +//// "startActivity(context, bundle = bundle, targetClass = WebActivity::class.java)", +//// "com.sw.healthyclients.ui.common.WebActivity" +//// ) +////) +////fun startWebDetailsActivity(context: Context, url: String) { +//// val bundle = Bundle() +//// bundle.putString("url", url) +//// startActivity(context, bundle = bundle, targetClass = WebDetailsActivity::class.java) +////} + +/** + * 选择预约时间 + * @param doctorId 医生id + */ +fun startSelectAppointmentTimeActivity(context: Context, doctorId: String? = null) { + val bundle = Bundle() + bundle.putString("doctorId", doctorId) + startActivity(context, bundle = bundle, targetClass = SelectAppointmentTimeActivity::class.java) +} + +/** + * 预约待确认 + * @param appointmentId 预约单ID + */ +fun startAppointmentWaitAffirmActivity( + context: Context, + appointmentId: String? = null, + isGuidance: Boolean? = false +) { + val bundle = Bundle() + bundle.putString("appointmentId", appointmentId) + if (isGuidance != null) { + bundle.putBoolean("isGuidance", isGuidance) + } + startActivity(context, bundle = bundle, targetClass = AppointmentDetailActivity::class.java) +} +// +///** +// * 预约待开始 +// */ +////fun startAppointmentWaitStartActivity(context: Context) { +//// startActivity(context, targetClass = AppointmentWaitStartActivity::class.java) +////} +// +///** +// * 预约待评价 +// */ +////fun startAppointmentWaitAppraiseActivity(context: Context) { +//// startActivity(context, targetClass = AppointmentWaitAppraiseActivity::class.java) +////} +// +///** +// * 预约-取消预约 +// */ +////fun startAppointmentCancelActivity(context: Context) { +//// startActivity(context, targetClass = AppointmentCancelActivity::class.java) +////} +// +///** +// * 预约-完成 +// */ +////fun startAppointmentFinishActivity(context: Context) { +//// startActivity(context, targetClass = AppointmentFinishActivity::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音视频 + */ +fun startGuidanceNoticeActivity(context: Context, doctorId: String = "", type: String) { + val bundle = Bundle() + bundle.putString("doctorId", doctorId) + bundle.putString("type", type) + startActivity(context, bundle = bundle, targetClass = GuidanceNoticeActivity::class.java) +} + +/** + * 用户评价-专家 + */ +fun startDoctorAllAppraiseActivity(context: Context, doctorId: String? = "") { + val bundle = Bundle() + bundle.putString("doctorId", doctorId) + startActivity(context, bundle = bundle, targetClass = DoctorAllAppraiseActivity::class.java) +} + +/** + * 登录 + */ +fun startLoginActivity(context: Context) { + startActivity(context, targetClass = LoginActivity::class.java) +} + +/** + * 个人信息设置 + */ +fun startUserInfoSettingActivity(context: Context) { + startActivity(context, targetClass = UserInfoSettingActivity::class.java) +} +// +///** +// * 紧急联系人 +// */ +//fun startEmergencyContactActivity(context: Context, bean: SelectEmergencyContactListBean?) { +// val bundle = Bundle() +// bundle.putSerializable("peopleInfo", bean) +// startActivity(context, bundle = bundle, targetClass = EmergencyContactActivity::class.java) +//} + +/** + * 档案大图查看 + */ +fun startFullScreenImageActivity(context: Context, isFilePath: Boolean, url: String) { + val bundle = Bundle() + bundle.putSerializable("imageUrl", url) + bundle.putSerializable("isFilePath", isFilePath) + startActivity(context, bundle = bundle, targetClass = FullScreenImageActivity::class.java) +} + +/** + * 档案详情 + */ +fun startArchivesDetailActivity( + context: Context, + consultType: ConstantUtils.ConsultType? = null, + doctorId: String? = null, + appointmentTimeId: String? = null, + archivesId: String? = null, + consultantBean: ConsultantBean? = null +) { + val bundle = Bundle() + if (!doctorId.isNullOrEmpty()) { + bundle.putString("doctorId", doctorId) + } + if (!appointmentTimeId.isNullOrEmpty()) { + bundle.putString("appointmentTimeId", appointmentTimeId) + } + bundle.putString("archivesId", archivesId) + var newConsultantBean = consultantBean?.copy() ?: null + newConsultantBean?.list = mutableListOf() //详情不需要档案列表,所以在这里剔除,防止因数据量大导致Bundle丢数据,同时也提高存取效率 + bundle.putParcelable("consultantBean", newConsultantBean) + bundle.putParcelable("consultType", consultType) + startActivity(context, bundle = bundle, targetClass = ArchivesDetailActivity::class.java) +} +// +///** +// * 体检详情 +// * @param cardNo 身份证号 +// * @param year 体检报告年份(后台应该处理了返回最新的一条数据,没处理找他们) +// */ +//fun startCheckUpDetailActivityActivity(context: Context, cardNo: String, year: String) { +// val bundle = Bundle() +// bundle.putString("sfzh", cardNo) +// bundle.putString("tjrq", year) +// startActivity(context, bundle = bundle, targetClass = CheckUpDetailActivity::class.java) +//} + +/** + * 咨询(预约单)详情中的档案详情 + */ +fun startConsultArchivesDetailActivity(context: Context, archivesId: String) { + val bundle = Bundle() + bundle.putString("archivesId", archivesId) + startActivity(context, bundle = bundle, targetClass = ConsultArchivesDetailActivity::class.java) +} + +/** + * 基本健康信息添加 + */ +fun startBaseHealthyInfoAddActivity(context: Context, memberId: String?) { + val bundle = Bundle() + bundle.putString("memberId", memberId) + startActivity(context, bundle = bundle, targetClass = BaseHealthyInfoAddActivity::class.java) +} +// +///** +// * 消息详情 +// */ +//fun startNoticeDetailsActivity(context: Context, bean: SelectUserMessageListBean?) { +// val bundle = Bundle() +// bundle.putSerializable("peopleInfo", bean) +// bundle.putSerializable("message", bean) +// startActivity(context, bundle = bundle, targetClass = NoticeDetailsActivity::class.java) +//} +// +///** +// * 健康档案首页 +// */ +////fun Context.startHealthRecordHomeActivity() { +//// startActivity(this, targetClass = HealthRecordHomeActivity::class.java) +////} +// +///** +// * 健康状况 +// */ +//fun Context.startHealthStatusActivity() { +// startActivity(this, targetClass = HealthStatusActivity::class.java) +//} +// +///** +// * 血脂 +// */ +//fun Context.startBloodFatListActivity(source: Int=0) { +// val bundle = Bundle() +// bundle.putInt("source", source) +// startActivity(this, targetClass = BloodFatListActivity::class.java,bundle=bundle) +//} +// +///** +// * 大病就医 +// */ +//fun startBigDiseaseActivity(context: Context) { +// startActivity(context, targetClass = BigDiseaseActivity::class.java) +//}/** +// * 一线医疗 +// */ +//fun startMedicalPointFragmentActivity(context: Context) { +// startActivity(context, targetClass = MedicalPointFragmentActivity::class.java) +//} +// +/** + * 新增大病就医 + */ +fun startAddBigDiseaseActivity(context: Context) { + startActivity(context, targetClass = AddBigDiseaseActivity::class.java) +} + +/** + * 大病就医详情 + */ +//fun startBigDiseaseDetailsActivity(context: Context, id: String) { +// val bundle = Bundle() +// bundle.putSerializable("id", id) +// startActivity(context, bundle = bundle, targetClass = BigDiseaseDetailsActivity::class.java) +//} +// +///** +// * 异常项 +// */ +//fun Context.startExceptionItemActivity(year: String) { +// val bundle = Bundle() +// bundle.putString("year", year) +// startActivity(this, bundle = bundle, targetClass = ExceptionItemActivity::class.java) +//} +// +/** + * 应急就医 + */ +fun startEmergencySeekDoctorActivity(context: Context) { + + startActivity(context, targetClass = EmergencySeekDoctorActivity::class.java) +} + +/** + * 应急就医详情 + */ +fun startEmergencySeekDoctorDetailsActivity(context: Context, id: String, sessionId: String) { + + val bundle = Bundle() + bundle.putSerializable("id", id) + bundle.putSerializable("sessionId", sessionId) + startActivity( + context, + bundle = bundle, + targetClass = EmergencySeekDoctorDetailsActivity::class.java + ) +} +// +///** +// * 健康数据分析 +// */ +////fun Context.startHealthDataAnalysisActivity() { +//// startActivity(this, targetClass = HealthDataAnalysisActivity::class.java) +////} +// +///** +// * 健康检查项 +// */ +//fun Context.startHealthCheckItemActivity(id: String, title: String) { +// val bundle = Bundle() +// bundle.putString("id", id) +// bundle.putString("title", title) +// startActivity(this, bundle = bundle, targetClass = HealthCheckItemActivity::class.java) +//} +// +///** +// * 健康监测(原计划使用列表动态配置,现为了速度写死了,现页面为HealthMonitorActivity) +// */ +////@Deprecated( +//// "原计划使用列表动态配置,现为了速度写死了,现页面为HealthMonitorActivity", ReplaceWith( +//// "startActivity(context, targetClass = HealthMonitorActivity::class.java)", +//// "com.sw.healthyclients.ui.healthrecord.HealthMonitorActivity" +//// ) +////) +////fun startHealthMonitoringActivity(context: Context) { +//// startActivity(context, targetClass = HealthMonitoringActivity::class.java) +////} +// +///** +// * 理想体重 +// */ +//fun Context.startIdealWeightActivity() { +// startActivity(this, targetClass = IdealWeightActivity::class.java) +//} +// +///** +// * 腰臀比 +// */ +//fun Context.startWaistToHipRatioActivity() { +// startActivity(this, targetClass = WaistToHipRatioActivity::class.java) +//} +// +///** +// * 能量需求 +// */ +//fun Context.startEnergyDemandActivity() { +// startActivity(this, targetClass = EnergyDemandActivity::class.java) +//} +// +///** +// * 运动能耗 +// */ +//fun Context.startMotionConsumptionActivity() { +// startActivity(this, targetClass = MotionConsumptionActivity::class.java) +//} +// +///** +// * 选择运动 +// */ +//fun Context.startSelectMotionActivity() { +// startActivity(this, targetClass = SelectMotionActivity::class.java) +//} +// +///** +// * 减掉一公斤 +// */ +//fun Context.startLoseOneKiloActivity() { +// startActivity(this, targetClass = LoseOneKiloActivity::class.java) +//} +// +///** +// * 一分钟了解自己 +// */ +//fun Context.startKnowSelfActivity() { +// startActivity(this, targetClass = KnowSelfActivity::class.java) +//} +// +///** +// * 健康检查子项详情(例如:血常规) +// */ +//fun Context.startHealthCheckItemDetailActivity(id: String, title: String) { +// val bundle = Bundle() +// bundle.putString("id", id) +// bundle.putString("title", title) +// startActivity(this, bundle = bundle, targetClass = HealthCheckItemDetailActivity::class.java) +//} +// +///** +// * 检查子项历史记录图表(例如:白细胞数)source=1 深色背景 +// */ +//fun Context.startCheckItemRecordChartActivity(id: String, title: String, type: String, source: Int = 0) { +// val bundle = Bundle() +// bundle.putString("id", id) +// bundle.putString("title", title) +// bundle.putString("type", type) +// bundle.putInt("source", source) +// startActivity(this, bundle = bundle, targetClass = CheckItemRecordChartActivity::class.java) +//} +// +///** +// * 检查子项历史记录文本形式(例如:心电图) +// */ +//fun Context.startCheckItemRecordTextActivity(id: String, title: String) { +// val bundle = Bundle() +// bundle.putString("id", id) +// bundle.putString("title", title) +// startActivity(this, bundle = bundle, targetClass = CheckItemRecordTextActivity::class.java) +//} +// +///** +// * 健康监测 +// */ +//fun Context.startHealthMonitorActivity() { +// startActivity(this, targetClass = HealthMonitorActivity::class.java) +//} +// +///** +// * 体重记录 +// */ +//fun Context.startWeightRecordActivity(source: Int=0) { +// val bundle = Bundle() +// bundle.putInt("source", source) +// startActivity(this, targetClass = WeightRecordActivity::class.java,bundle=bundle) +//} +// +///** +// * 血糖记录 +// */ +//fun Context.startBloodSugarListActivity(source: Int=0) { +// val bundle = Bundle() +// bundle.putInt("source", source) +// startActivity(this, targetClass = BloodSugarListActivity::class.java,bundle=bundle) +//} +// +///** +// * 血糖 +// */ +//fun Context.startBloodSugarActivity(source: Int=0) { +// val bundle = Bundle() +// bundle.putInt("source", source) +// startActivity(this, targetClass = BloodSugarActivity::class.java,bundle=bundle) +//} +// +///** +// * 血压记录 +// */ +//fun Context.startBloodStressListActivity(source: Int=0) { +// val bundle = Bundle() +// bundle.putInt("source", source) +// startActivity(this, targetClass = BloodStressListActivity::class.java,bundle=bundle) +//} +// +///** +// * 检查子项历史记录文本形式(例如:心电图) +// * source == 0 默认深绿色主题 +// * source == 1 原有app主题色 +// */ +//fun Context.startBMIDataActivity(source: Int = 0) { +// val bundle = Bundle() +// bundle.putInt("source", source) +// startActivity(this, targetClass = BMIDataActivity::class.java, bundle = bundle) +//} +// +/** + * Web页面 source == 1 绿色主题 darkStyle=false 白色顶部 + */ +fun Context.startWebActivity(url: String, scale: Boolean = false,myTitle:String="", source: Int = 0,darkStyle: Boolean = true,isFull: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)//是否全屏 + startActivity(this, bundle = bundle, targetClass = WebActivity::class.java) +} +///** +// * Web页面 +// */ +//fun Context.startWebAppDownLoadActivity(url: String) { +// val bundle = Bundle() +// bundle.putString("url", url) +// startActivity(this, bundle = bundle, targetClass = WebAppDownLoadActivity::class.java) +//} +///** +// * Web页面 +// */ +//fun Context.startAnswerWebActivity(url: String) { +// val bundle = Bundle() +// bundle.putString("url", url) +// startActivity(this, bundle = bundle, targetClass = AnswerWebActivity::class.java) +//} +// +///** +// * 血压 +// * source == 0 默认深绿色主题 +// * source == 1 原有app主题色 +// */ +//fun Context.startBloodStressActivity(source: Int=0) { +// val bundle = Bundle() +// bundle.putInt("source", source) +// startActivity(this, targetClass = BloodStressActivity::class.java,bundle=bundle) +//} +// +///** +// * 结论建议 +// */ +//fun Context.startConclusionSuggestionActivity() { +// startActivity(this, targetClass = ConclusionSuggestionActivity::class.java) +//} +///** +// * 血脂 +// * source == 0 默认深绿色主题 +// * source == 1 原有app主题色 +// */ +//fun Context.startBloodFatActivity(source: Int=0) { +// val bundle = Bundle() +// bundle.putInt("source", source) +// startActivity(this, targetClass = BloodFatActivity::class.java, bundle = bundle) +//} +/** + * 体检详情 + */ +//fun Context.startCheckRecordDetailInfoActivity(sfzh:String,tjrq:String,id:String="1",isShowHistory:Boolean=true,userId:String="") { +// val bundle = Bundle() +// bundle.putString("sfzh", sfzh) +// bundle.putString("tjrq", tjrq) +// bundle.putString("id", id) +// bundle.putBoolean("isShowHistory", isShowHistory) +// bundle.putString("userId", userId) +// startActivity(this, bundle=bundle,targetClass = CheckRecordDetailInfoActivity2::class.java) +//} +// +///** +// * 体检详情-新 +// */ +//fun Context.startCheckRecordDetailInfoNewActivity(sfzh:String,tjrq:String,id:String="1",isShowHistory:Boolean=true) { +// val bundle = Bundle() +// bundle.putString("sfzh", sfzh) +// bundle.putString("tjrq", tjrq) +// bundle.putString("id", id) +// bundle.putBoolean("isShowHistory", isShowHistory) +// startActivity(this, bundle=bundle,targetClass = CheckRecordDetailInfoActivityNew::class.java) +//} +// +///** +// * 体检列表 +// */ +//fun Context.startCheckRecordListActivity() { +// startActivity(this, targetClass = CheckRecordListActivity::class.java) +//} +/** + * 跳转系统自带浏览器 + */ +fun Context.startSystemWebActivity(url: String){ + val intent: Intent = Intent() + intent.action = Intent.ACTION_VIEW//打开手机自带浏览器 + intent.data = Uri.parse(url) + startActivity(intent) +} +// +/** + * 找回密码 + */ +fun Context.startRetrievePassWordActivity() { + startActivity(this, targetClass = RetrievePassWordActivity::class.java) +} +/** + * 修改密码 + */ +fun Context.startChangePassWordActivity(code:String) { + val bundle = Bundle() + bundle.putString("code", code) + startActivity(this, bundle = bundle,targetClass = ChangePassWordActivity::class.java) +} +/** + * 全科历史消息 + */ +fun Context.startGeneralPracticeGuidanceActivity() { +// val bundle = Bundle() +// bundle.putString("groupid", groupid) + startActivity(this,targetClass = GeneralPracticeGuidanceActivity::class.java) +} + +/** + * 我的咨询 + */ +fun startMyGuidanceActivity(context: Context, value: String) { + val bundle = Bundle() + bundle.putString("title", value) + startActivity(context, bundle = bundle, targetClass = MyGuidanceActivity::class.java) +} + + +///** +// * 干预Tab形式子模块(膳食,运动,心理,糖尿病,癌症) +// */ +//fun Context.startInterventionTabPageActivity( +// @InterventionFragmentUtils.TabPageType pageType: String, +// pageIndex: Int = 0, pageName: String = "" +//) { +// val bundle = Bundle() +// bundle.putString("pageType", pageType) +// bundle.putInt("pageIndex", pageIndex) +// bundle.putString("pageName", pageName) +// startActivity(this, bundle = bundle, targetClass = InterventionTabPageActivity::class.java) +//} +// +// +//fun Context.startInterventionTabPageActivityGreen( +// @InterventionFragmentUtils.TabPageType pageType: String, +// pageIndex: Int = 0, pageName: String = "" +//) { +// val bundle = Bundle() +// bundle.putString("pageType", pageType) +// bundle.putInt("pageIndex", pageIndex) +// bundle.putString("pageName", pageName) +// startActivity(this, bundle = bundle, targetClass = InterventionTabPageActivityGreen::class.java) +//} +// +///** +// * 环境检测首页 +// */ +//fun Context.startEnvironmentDetectionActivity() { +// val bundle = Bundle() +// startActivity(this, bundle = bundle, targetClass = EnvironmentDetectionActivityNew::class.java) +//} +// +///** +// * 环境tab页面 +// */ +//fun Context.startEnvironmentTabActivity(tabList: MutableList?) { +// val bundle = Bundle() +// bundle.putSerializable("tabList",tabList as Serializable) +// startActivity(this, bundle = bundle, targetClass = EnvironmentTabActivityNew::class.java) +//} +// +///** +// * 环境检测详情界面 +// */ +//fun Context.startEnvironmentDetailActivity(tabName: String, meterCode: String?) { +// val bundle = Bundle() +// bundle.putString("meter_code", meterCode) +// bundle.putString("environment_tab_name", tabName) +// val targetClass = if (tabName != "花粉监测") { +// EnvironmentDetailActivityNew::class.java +// } else { +// EnvironmentDetailPollenActivityNew::class.java +// } +// startActivity(this, bundle = bundle, targetClass = targetClass) +//} +///** +// * 报警数据 +// */ +//fun Context.startWarnDataActivity(title: String, meterCode: String) { +// var bundle = Bundle() +// bundle.putString("meterCode", meterCode) +// bundle.putString("title", title) +// startActivity(this, bundle = bundle, targetClass = WarnDataActivityNew::class.java) +//} +// +// +///** +// * 视频全频播放 +// */ +//fun Context.startFullscreenVideoActivity(title:String="",subTitle:String="",videourl:String="") { +// val bundle = Bundle() +// bundle.putString("title",title) +// bundle.putString("subtitle",subTitle) +// bundle.putString("videoUrl",videourl) +// startActivity(this, bundle=bundle,targetClass = FullscreenVideoActivity::class.java) +//} +//fun Context.startFullscreenVideoActivity( +// mVideoUrl: String, +// title: String = "", +//) { +// var bundle = Bundle() +// bundle.putString("title", title) +// bundle.putString("videoUrl", mVideoUrl)//视频链接 +// startActivity(this, bundle = bundle, targetClass = FullscreenVideoActivity::class.java) +//} +///** +// * 视频播放器 +// * 关闭自动全屏,展示弹窗,监听视频播放状态,倍速功能 +// */ +//fun Context.startFullscreenVideoActivityV2( +// mVideoUrl: String, +// title: String? = "", +// autoFull: Boolean = true, +// hasSpeed: Boolean = false, +// listener: Boolean = false, +// desc: String? = "", +// otherParams: String = "" +//) { +// var bundle = Bundle() +// bundle.putString("title", title) +// bundle.putString("videoUrl", mVideoUrl)//视频链接 +// bundle.putBoolean("hasSpeed", hasSpeed)//是否显示倍速按钮 +// bundle.putBoolean("autoFull", autoFull)//是否关闭自动全屏 +// bundle.putBoolean("listener", listener)//是否需要视频播放状态监听器 +// bundle.putString("desc", desc)//视频简介 +// bundle.putString("otherParams", otherParams)//其他参数 +// startActivity(this, bundle = bundle, targetClass = FullscreenVideoActivityV2::class.java) +//} +///** +// * 专家详情 0 默认 1专家头像可以点击 +// */ +//fun Context.startDoctorSourceActivity(bean: InterventionExpertBean,source: Int = 0) { +// val bundle = Bundle() +// bundle.putSerializable("doctorInfo",bean) +// bundle.putInt("source",source) +// startActivity(this,bundle=bundle, targetClass = ExpertDetailsActivityNew::class.java) +//} +///** +// * 岗位二级列表 +// */ +//fun Context.startPostSecondaryActivity(id: String,name:String,subTitle:String,@InterventionFragmentUtils.TabPageType pageType: String) { +// val bundle = Bundle() +// bundle.putString("id",id) +// bundle.putString("name",name) +// bundle.putString("subTitle",subTitle) +// bundle.putString("pageType", pageType) +// startActivity(this,bundle=bundle, targetClass = PostSecondaryActivity::class.java) +//} +///** +// * 体检可视化-项目详情 +// */ +//fun Context.startPhysicalExaminationViewDetailActivity(itemId: String) { +// val bundle = Bundle() +// bundle.putString("itemId", itemId) +// startActivity(this, bundle=bundle, targetClass = PhysicalExaminationViewDetailActivity::class.java) +//} +///** +// * 我的运动 +// */ +////fun Context.startMySportActivity() { +//// startActivity(this, targetClass = MySportActivity::class.java) +////} +///** +// * 运动上传 +// */ +////fun Context.startSportUploadActivity() { +//// startActivity(this, targetClass = SportUploadActivity::class.java) +////} +///** +// * 运动效果详情 +// */ +////fun Context.startSportEffectDetailActivity(itemId: Int) { +//// val bundle = Bundle() +//// bundle.putInt("itemId", itemId) +//// startActivity(this, bundle=bundle, targetClass = SportEffectDetailActivity::class.java) +////} +///** +// * 我的运动详情 +// */ +////fun Context.startMySportDetailActivity(itemId: Int, title: String) { +//// val bundle = Bundle() +//// bundle.putInt("itemId", itemId) +//// bundle.putString("title", title) +//// startActivity(this, bundle=bundle, targetClass = MySportDetailActivity::class.java) +////} +///** +// * 急救联动-资源详情 +// */ +////fun Context.startFirstAidLinkageDetailActivity(resourcesDTO: EmergencySearchResponse.AedResourcesDTO) { +//// val bundle = Bundle() +//// bundle.putSerializable("resourcesDTO", resourcesDTO) +//// startActivity(this, bundle=bundle, targetClass = FirstAidLinkageDetailActivity::class.java) +////} +///** +// * 健康评估 +// */ +//fun Context.startHealthRateActivity() { +// startActivity(this, targetClass = HealthRateActivity::class.java) +//} +///** +// * 医疗点列表 +// */ +//fun Context.startMedicalPointActivity() { +// startActivity(this, targetClass = MedicalPointActivity::class.java) +//} +///** +// * 医疗点详情 +// */ +//fun Context.startMedicalPointDetailsActivity(id:String) { +// val bundle = Bundle() +// bundle.putString("id", id) +// startActivity(this, bundle=bundle,targetClass = MedicalPointDetailsActivity::class.java) +//} +///** +// * 医疗点详情 +// */ +//fun Context.startChronicManagerActivity(@InterventionFragmentUtils.TabPageType pageType: String, childType:Int) { +// val bundle = Bundle() +// bundle.putString("pageType", pageType) +// bundle.putInt("childType", childType) +// startActivity(this,bundle=bundle, targetClass = ChronicManagerActivity::class.java) +//} +///** +// * 就诊记录 +// */ +//fun Context.startVisitRecordActivity() { +// val bundle = Bundle() +// startActivity(this, targetClass = VisitRecordActivity::class.java) +//} +///** +// * im历史消息 +// */ +//fun Context.startIMHistoryActivity(groupid:String) { +// val bundle = Bundle() +// bundle.putString("groupid", groupid) +// startActivity(this,bundle=bundle, targetClass = IMHistoryActivity::class.java) +//} +// +///*-----------------------------------------------------干预2023-----------------------------------------------------------*/ +///** +// * 文章详情 +// */ +//fun Context.startArticleDetailsActivity(id: String, source: Int = 0) { +// var bundle = Bundle() +// bundle.putString("id", id) +//// bundle.putString("expert",expert) +// bundle.putInt("source", source) +// startActivity(this, bundle = bundle, targetClass = ArticleDetailsActivityNew::class.java) +//} +///** +// * 视频详情 source 0 默认 1健康技能 isHomeClick是否首页跳转过来的 +// */ +//fun Context.startVideoDetailsActivity(id: String, source: Int = 0) { +// var bundle = Bundle() +// bundle.putString("id", id) +// bundle.putInt("source", source) +//// bundle.putString("expert",expert) +// startActivity(this, bundle = bundle, targetClass = VideoDetailsActivityNew::class.java) +//} +// +//fun Context.startVideoDetailsActivity2(id: String, interventionExpertBean: InterventionExpertBean) { +// var bundle = Bundle() +// bundle.putString("id", id) +// bundle.putSerializable("interventionExpert", interventionExpertBean as Serializable) +// startActivity(this, bundle = bundle, targetClass = VideoDetailsActivityNew2::class.java) +//} +///** +// * 视频居中的播放器 +// */ +//fun Context.startVideoDetailsCenterActivity(id: String) { +// var bundle = Bundle() +// bundle.putString("id", id) +// startActivity(this, bundle = bundle, targetClass = VideoDetailsCenterActivity::class.java) +//} +///** +// * 问卷 +// */ +//fun Context.startQuestionActivity(questionType: Int, id: String? = "") { +// val bundle = Bundle() +// if (questionType > 0) { +// bundle.putInt("questionType", questionType) +// bundle.putString("id", id) +// startActivity(this, bundle = bundle, targetClass = QuestionActivityNew::class.java) +// } +//} +// +///** +// * 心血管-急救培训-答题结果 +// */ +//fun Context.startAnswerResultActivity(answerResult: String) { +// var bundle = Bundle() +// bundle.putString("answerResult", answerResult) +// startActivity(this, bundle = bundle, targetClass = FirstAidAnswerResultActivity::class.java) +//} +// +///** +// * 心血管-aed详情,急救包详情,救护车详情,医院详情,医疗点详情,应急中心详情 +// */ +//fun Context.startAedDetailActivity( +// aedDetailData: AedNetworkingBean?, +// type: Int? = null, +// id: String? = null, +// distance: String? = null +//) { +// val bundle = Bundle() +// if (aedDetailData != null) { +// bundle.putSerializable("aedDetailData", aedDetailData) +// } +// if (type != null) { +// bundle.putInt("type", type) +// bundle.putString("id", id) +// bundle.putString("distance", distance) +// } +// startActivity(this, bundle = bundle, targetClass = AedNetworkingDetailActivityNew::class.java) +//} +// +///** +// * 心血管详情 +// */ +//fun Context.startBloodVesselHealthActivity(type: Int) { +// val bundle = Bundle() +// bundle.putInt("type", type) +// startActivity(this, bundle = bundle, targetClass = BloodVesselHealthActivityNew::class.java) +//} +// +///** +// * 播放视频 +// */ +//fun Context.startVideoPlayActivity( +// id: String, +// videoTitle: String, +// videoPic: String, +// videoUrl: String +//) { +// var bundle = Bundle() +// bundle.putString("id", id) +// bundle.putString("videoTitle", videoTitle) +// bundle.putString("videoPic", videoPic) +// bundle.putString("videoUrl", videoUrl) +// startActivity(this, bundle = bundle, targetClass = VideoPlayActivityNew::class.java) +//} +// +///** +// * 运动-全部排名 +// */ +//fun Context.startSportALlRankActivity(rankData: SportDetailBean.Rank?) { +// val bundle = Bundle() +// bundle.putSerializable("rankData", rankData) +// startActivity(this, bundle = bundle, targetClass = SportAllRankActivityNew::class.java) +//} +// +///** +// * 心血管-急救培训详情 +// */ +//fun Context.startFirstAidDetailActivity(firstAidData: CardiovascularFirstAidBean) { +// var bundle = Bundle() +// bundle.putSerializable("firstAidData", firstAidData) +// startActivity( +// this, +// bundle = bundle, +// targetClass = CardiovascularFirstAidDetailActivityNew::class.java +// ) +//} +// +///** +// * 心血管-培训排名 +// */ +//fun Context.startTrainALlRankActivity(activityId: String) { +// val bundle = Bundle() +// bundle.putString("activityId", activityId) +// startActivity(this, bundle = bundle, targetClass = TrainAllRankActivityNew::class.java) +//} +// +///** +// * 病因溯源结论 +// */ +//fun Context.startEtiologicalResultActivity() { +// val bundle = Bundle() +// startActivity(this, bundle = bundle, targetClass = EtiologicalResultActivity::class.java) +//} +// +///** +// * 活动详情 +// */ +//fun Context.startEnrollActionDetailsActivity(mActionBean: FoodOverWeightInterventionActionBean) { +// val bundle = Bundle() +// bundle.putSerializable("actionBean",mActionBean) +// startActivity(this,bundle=bundle, targetClass = EnrollActionDetailsActivity::class.java) +//} +// +// +///** +// * 活动历史详情 +// */ +//fun Context.startEnrollActionHistoryDetailActivity(bean: FoodOverWeightInterventionActionBean) { +// val bundle = Bundle() +// bundle.putSerializable("bean",bean) +// startActivity(this, bundle=bundle,targetClass = EnrollActionHistoryDetailActivity::class.java) +//} +// +///** +// * 活动排名 +// */ +//fun Context.startEnrollActionRankActivity(id: String) { +// val bundle = Bundle() +// bundle.putSerializable("id",id) +// startActivity(this, bundle=bundle,targetClass = EnrollActionRankActivity::class.java) +//} +// +///** +// * 体重变化趋势 +// */ +//fun Context.startWeightChangeActivity(id: String) { +// val bundle = Bundle() +// bundle.putSerializable("id",id) +// startActivity(this, bundle=bundle,targetClass = WeightChangeActivity::class.java) +//} +///** +// * im消息查看定位 +// */ +//fun Context.startViewLocationActivity(latitude:Double,longitude:Double) { +// val bundle = Bundle() +// bundle.putDouble("latitude", latitude) +// bundle.putDouble("longitude", longitude) +// startActivity(this,bundle=bundle, targetClass = ViewLocationActivity::class.java) +//} +///** +// * 膳食报表 +// */ +//fun Context.startDietStatActivity() { +// val bundle = Bundle() +// startActivity(this,bundle=bundle, targetClass = DietStatActivity::class.java) +//} +///** +// * 运动报表 +// */ +//fun Context.startMotionStatActivity() { +// val bundle = Bundle() +// startActivity(this,bundle=bundle, targetClass = MotionStatActivity::class.java) +//} +///** +// * 运动报表 +// */ +//fun Context.startUserSoSContactsActivity() { +// val bundle = Bundle() +// startActivity(this,bundle=bundle, targetClass = UserSoSContactsActivity::class.java) +//} +///** +// * 我的收藏与我的点赞 +// */ +//fun Context.startLickAndCollectActivity(type:Int) { +// val bundle = Bundle() +// bundle.putInt("type", type) +// startActivity(this,bundle=bundle, targetClass = LickAndCollectActivity::class.java) +//} +// +///** +// * 模拟用户 +// */ +//fun startSimulateUserActivity(context: Context){ +// startActivity(context, targetClass = SimulateUserActivity::class.java) +//} +// +///** +// * 自由训练记录列表 +// */ +//fun Context.startSportEffectRecordActivity(modelId: String?) { +// val bundle = Bundle() +// bundle.putString("modelId", modelId) +// startActivity(this, bundle = bundle, targetClass = SportEffectRecordListActivity::class.java) +//} +// +///** +// * 运动效果-单位活动-活动详情-全部排名 +// */ +//fun Context.startSportEffectALlRankActivity(rankData: SportEffectPlanDetailBean.MyRank?) { +// val bundle = Bundle() +// bundle.putSerializable("effectRankData", rankData) +// startActivity(this, bundle = bundle, targetClass = SportAllRankActivityNew::class.java) +//} +// +///** +// * 推荐知识详情 +// */ +//fun Context.startKnowledgeAnswerDetailsActivity(id: String){ +// val bundle = Bundle() +// bundle.putString("id", id) +// startActivity(this, bundle=bundle, targetClass = KnowledgeAnswerDetailsActivity::class.java) +//} +// +///** +// * 体重管理-排名 +// */ +//fun Context.startWeightRankActivity(planId: String?, type: Int = 0) { +// val bundle = Bundle() +// bundle.putString("planId", planId) +// bundle.putInt("type", type) +// startActivity(this, bundle = bundle, targetClass = WeightRankGreenActivity::class.java) +//} diff --git a/app/src/main/java/com/xjjk/healthyclients/superfuntion/StringExt.kt b/app/src/main/java/com/xjjk/healthyclients/superfuntion/StringExt.kt new file mode 100644 index 0000000..b28ff97 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/superfuntion/StringExt.kt @@ -0,0 +1,316 @@ +package com.xjjk.healthyclients.superfuntion + +import android.annotation.SuppressLint +import android.content.Context +import android.net.Uri +import android.text.Html +import android.text.Spanned +import android.text.TextUtils +import android.widget.TextView +import com.amap.api.services.route.DriveRouteResultV2 +import com.google.gson.Gson +import com.google.gson.GsonBuilder +import com.sw.healthyclients.utils.ImageGetterUtils +import com.xjjk.healthyclients.retrofit.UrlConfig +import org.jsoup.Jsoup +import java.net.URLEncoder +import java.text.SimpleDateFormat +import java.util.Locale +import java.util.regex.Pattern +import kotlin.math.roundToInt + +/** + * String扩展类 + * @author nanfeifie 2022/3/25 + */ +fun String.toHtml(@SuppressLint("InlinedApi") flag: Int = Html.FROM_HTML_MODE_LEGACY): Spanned { + return if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + Html.fromHtml(this, flag) + } else { + Html.fromHtml(this) + } +} + +fun String.toHtml(view:TextView,conetxt:Context,@SuppressLint("InlinedApi") flag: Int = Html.FROM_HTML_MODE_LEGACY): Spanned { + return if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + Html.fromHtml(this, flag,ImageGetterUtils.MyImageGetter(conetxt,view),null) + } else { + Html.fromHtml(this,ImageGetterUtils.MyImageGetter(conetxt,view),null) + } +} + +/** 将对象转为JSON字符串 */ +fun Any?.toJson(): String { + return Gson().toJson(this) +} +/** 将对象转为key加密之后的字符串 */ +fun Any?.toEncryptJson(): String{ + return GsonBuilder() + .create().toJson(this) +} +fun String?.jsonToBean(clazz: Class): T { + return GsonBuilder() + .create().fromJson(this, clazz) +} + + +fun String.formatToPassWord(): String = this.replace("[^a-zA-Z0-9]*".toRegex(), "") +fun String.formatCheck(): Boolean { + var pattern=Pattern.compile("(?=.*[A-Z])(?=.*\\d)(?=.*[a-z])(?=.*\\d)[0-9A-Za-z]{8,16}") + return pattern.matcher(this).matches() +} + +fun String.phoneCheck(): Boolean { + var pattern=Pattern.compile("^1[3-9]\\d{9}\$") + return pattern.matcher(this).matches() +} +inline fun String?.orEmptyDefaultofIM(): String { + if (this.equals("null")||this.equals("Null")||this==null){ + return "管理员" + }else{ + return this + } +} +inline fun String?.orEmptyDefaultofQH(): String = this ?: "全科医生" + +fun String.lenghtFormat(): String { + var value="" + if(this.length>10){ + value=this.substring(0,10) + } + return value +} +inline fun String?.orEmptyDefault2(): String { + if (this.equals("null")||this.equals("Null")||this==null||this.equals("")){ + return "--" + }else{ + return this + } +} +fun String?.orEmptyDefault(str:String="--"): String { + if (this==null) { + return str + }else if (this=="null") { + return str + }else if (this=="") { + return str + }else{ + return this + } +} + +fun Int?.orEmptyDefaultInt(str:String="--"): String { + if (this==null) { + return str + }else{ + return this.toString() + } +} + +fun String?.toZeroDefault(f: Float = 0.0F): Float { + + return if (TextUtils.isEmpty(this)) { + f + } else if (this == "null") { + f + } else { + this!!.toFloat() + } +} + +fun String?.floatToInt(i: Int = 0): Int { + + return if (TextUtils.isEmpty(this)) { + i + } else if (this == "null") { + i + } else { + if (this!!.toFloatOrNull() != null) { + this.toFloatOrNull()!!.toInt() + } else { + i + } + } +} + +inline fun String?.orEmptyDefaultValue(): String = this ?: "" + +fun Float?.orEmptyDefault(): String { + return if (this == null || this == 0.0F) { + "--" + } else { + this.toString() + } +} +fun String.toFormatDouble(): String{ + var mStr="0" + try { + var dou=this.toDouble() +// if ((dou-dou.toInt())>0){ + mStr=String.format("%.2f",dou) +// }else{ +// mStr=dou.toInt().toString() +// } + } catch (e: Exception) { + } + return mStr +} + +fun String.toFormatInt(): Int{ + var value=0 + try { + if (this!=null&&this.length>0){ + value=this.toDouble().toInt() + } + } catch (e: Exception) { + } + return value +} +fun String.toFormatDoubleCounting(): String{ + var mStr="0" + try { + var dou=this.toDouble() + if(dou>10000){ + mStr=String.format("%.2f",(dou/10000.00))+"万" + }else{ + mStr=dou.toInt().toString() + } + } catch (e: Exception) { + } + return mStr +} +fun String.toFormatDouble0(): String{ + var mStr="0" + try { + var dou=this.toDouble() + mStr=dou.toInt().toString() + } catch (e: Exception) { + } + return mStr +} + +fun String.isEmptyStrValue(): Boolean{ + if (this==null||this==""||this=="0"||this=="0.00") { + return true + }else { + return false + } +} +/** + * 判断网络视频url是否包含前缀,若不包含则添加 + */ +fun String.toVideoUrl(): String{ + return if (this.contains("http")){ + this + }else{ + println("视频-url--${ UrlConfig.IMAGE_BASE_URL+this.UrlEncoder()}") + UrlConfig.IMAGE_BASE_URL + this.UrlEncoder() + } +} +fun String.UrlEncoder():String{ + var url= URLEncoder.encode(this, "UTF-8").replace("+","%20") + var url2= Uri.encode(this, "/").replace("+","%20") + return url2 +} + +/** + * img 标签添加头部 + */ +fun String.addImgHeader():String{ + try { + var doc= Jsoup.parse(this) + var imgElements =doc.select("img") + for (img in imgElements) { + var src = img.attr("src") + if (src.contains("file/show/")) { + var strList=src.split("file/show/") + var newStr=src + if (strList.size==2) { + newStr=strList[1] + } + img.attr("src", UrlConfig.IMAGE_BASE_URL+newStr) + }else{ + img.attr("src", UrlConfig.IMAGE_BASE_URL+src) + } + } + return doc.toString() + } catch (e: Exception) { + return "" + } +} + +fun Int.takeTime(): String { + return if (this <= 1000) { + //一个人一分钟约走66m 一个小时走66*60m + val hour = this / 66 / 60 + val min = this / 66 % 60 + + "${this}m " + "步行约${min}分钟" + } else { + "" + } + +} + +fun String.getDriveTime(it: DriveRouteResultV2?): String { + return if (it != null && !it.paths.isNullOrEmpty()) { + val hour = ((it.paths[0]?.cost!!.duration) / 60 / 60).toInt() + val min = ((it.paths[0]?.cost!!.duration) / 60 % 60).roundToInt() + if (hour > 0) { + this + "驾车约${hour}小时${min}分钟" + } else { + this + "驾车约${min}分钟" + } + } else { + this + "" + } +} + +fun String.toDateFormat1() : String { + val pattern = "yyyy年MM月dd日" + val simpleDateFormat = SimpleDateFormat(pattern) + val date = simpleDateFormat.parse(this) + val timeStamp = date.time + return SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(timeStamp) +} + +fun String.toDateFormat2() : String { + val pattern = "yyyy-MM-dd" + val simpleDateFormat = SimpleDateFormat(pattern) + val date = simpleDateFormat.parse(this) + val timeStamp = date.time + return SimpleDateFormat("MM.dd", Locale.getDefault()).format(timeStamp) +} + +fun String.toDateFormat3() : String { + val pattern = "yyyy-MM-dd" + val simpleDateFormat = SimpleDateFormat(pattern) + val date = simpleDateFormat.parse(this) + val timeStamp = date.time + return SimpleDateFormat("yyyy.MM", Locale.getDefault()).format(timeStamp) +} + +fun String.toDateFormatYear() : String { + val pattern = "yyyy-MM-dd" + val simpleDateFormat = SimpleDateFormat(pattern) + val date = simpleDateFormat.parse(this) + val timeStamp = date.time + return SimpleDateFormat("yyyy", Locale.getDefault()).format(timeStamp) +} + +fun String.toDateFormatMonth() : String { + val pattern = "yyyy-MM-dd" + val simpleDateFormat = SimpleDateFormat(pattern) + val date = simpleDateFormat.parse(this) + val timeStamp = date.time + return SimpleDateFormat("MM", Locale.getDefault()).format(timeStamp) +} + +fun String.toDateFormatDay() : String { + val pattern = "yyyy-MM-dd" + val simpleDateFormat = SimpleDateFormat(pattern) + val date = simpleDateFormat.parse(this) + val timeStamp = date.time + return SimpleDateFormat("dd", Locale.getDefault()).format(timeStamp) +} + diff --git a/app/src/main/java/com/xjjk/healthyclients/superfuntion/ViewExt.kt b/app/src/main/java/com/xjjk/healthyclients/superfuntion/ViewExt.kt new file mode 100644 index 0000000..7a49fd5 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/superfuntion/ViewExt.kt @@ -0,0 +1,602 @@ +package com.xjjk.healthyclients.superfuntion + +import android.annotation.SuppressLint +import android.app.ProgressDialog +import android.content.Context +import android.graphics.Bitmap +import android.graphics.drawable.Drawable +import android.text.TextUtils +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.view.Window +import android.widget.ImageView +import android.widget.TextView +import androidx.annotation.DrawableRes +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentActivity +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleRegistry +import androidx.recyclerview.widget.RecyclerView +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import androidx.viewpager2.widget.ViewPager2 +import com.bumptech.glide.Glide +import com.bumptech.glide.load.DataSource +import com.bumptech.glide.load.MultiTransformation +import com.bumptech.glide.load.engine.GlideException +import com.bumptech.glide.load.resource.bitmap.CenterCrop +import com.bumptech.glide.load.resource.bitmap.CircleCrop +import com.bumptech.glide.load.resource.bitmap.FitCenter +import com.bumptech.glide.load.resource.bitmap.RoundedCorners +import com.bumptech.glide.request.RequestListener +import com.bumptech.glide.request.RequestOptions +import com.bumptech.glide.request.target.Target +import com.google.android.material.tabs.TabLayout +import com.google.android.material.tabs.TabLayoutMediator +import com.sw.healthyclients.adapter.common.ViewPagerAdapter +import com.sw.healthyclients.bean.common.TabItemBean +import com.sw.healthyclients.data.local.DataStoreManager +import com.sw.healthyclients.utils.ScreenUtil.dp2px +import com.sw.healthyclients.view.LoadingDialog +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.retrofit.UrlConfig +import java.io.File + +fun addImageBaseUrl(url: String?): String? { + if (url != null) { + if (url.startsWith("http")) { + return url + } + } else { + return null + } + return UrlConfig.IMAGE_BASE_URL + url.replace("\\", "/") +} + +/** + * ImageView利用Glide加载图片 + * @param url 图片url(可远程可本地) + * @param showPlaceholder 是否展示placeholder,默认为true + */ +fun ImageView.load( + url: String?, + showPlaceholder: Boolean = true, + @DrawableRes defaultResId: Int = 0 +) { + if (TextUtils.isEmpty(url)) { + if (defaultResId != 0) { + setImageResource(defaultResId) + } + return + } + + if (showPlaceholder) { + val options = RequestOptions().transform() + if (defaultResId == 0) { + options.placeholder(R.drawable.ic_default) + .error(R.drawable.ic_default) + } else { + options.placeholder(defaultResId) + .error(defaultResId) + } + Glide.with(context).load(addImageBaseUrl(url)) + .apply(options) + .into(this) + } else { + Glide.with(context).load(addImageBaseUrl(url)) + .into(this) + } +} + +fun ImageView.loadGif( + url: String?, + showPlaceholder: Boolean = true, + @DrawableRes defaultResId: Int = 0 +) { + if (TextUtils.isEmpty(url)) { + if (defaultResId != 0) { + setImageResource(defaultResId) + } + return + } + + if (showPlaceholder) { + val options = RequestOptions().transform() + if (defaultResId == 0) { + options.placeholder(R.drawable.intervene_ic_default2) + .error(R.drawable.intervene_ic_default2) + } else { + options.placeholder(defaultResId) + .error(defaultResId) + } + Glide.with(context).asGif().load(addImageBaseUrl(url)).timeout(10 * 1000) + .apply(options) + .into(this) + } else { + Glide.with(context).asGif().load(addImageBaseUrl(url)).timeout(10 * 1000) + .into(this) + } +} + +/** + * ImageView利用Glide加载图片 + * @param url 图片url(可远程可本地) + * @param showPlaceholder 是否展示placeholder,默认为true + */ +fun ImageView.load( + file: File, + showPlaceholder: Boolean = true, + @DrawableRes defaultResId: Int = 0 +) { + Glide.with(context).load(file) + .into(this) +} + +/** + * ImageView利用Glide加载图片 + * @param resourceId 本地图片资源Id + * @param showPlaceholder 是否展示placeholder,默认为false + */ +fun ImageView.load( + @DrawableRes resourceId: Int, + showPlaceholder: Boolean = false, + @DrawableRes defaultResId: Int = 0 +) { + Glide.with(context).load(resourceId) + .into(this) +} + +/** + * ImageView利用Glide加载圆形图片 + * @param url 图片url(可远程可本地) + */ +fun ImageView.loadCircle(url: String?, @DrawableRes defaultResId: Int = 0) { + if (TextUtils.isEmpty(url)) { + if (defaultResId != 0) { + setImageResource(defaultResId) + } + return + } + + val options = RequestOptions + .bitmapTransform(CircleCrop()) + if (defaultResId == 0) { + options.placeholder(R.drawable.ic_default_doctor_head_img) + .error(R.drawable.ic_default_doctor_head_img) + } else { + options.placeholder(defaultResId) + .error(defaultResId) + } + Glide.with(context).load(addImageBaseUrl(url)) + .apply(options) + .into(this) +} + + +/** + * ImageView利用Glide加载圆形图片 并使用用户性别对应的默认头像 + * @param url 图片url(可远程可本地) + */ +fun ImageView.loadCircleAndSex(url: String?, defaultResId: Int = 0) { + + val bean = DataStoreManager.getUserInfo() + + var defaultImg: Int = if (bean.sex == "1") { + R.drawable.ic_mulher + } else { + R.drawable.ic_masculino + } + + if (defaultResId > 0) { + defaultImg = defaultResId + } + + if (TextUtils.isEmpty(url)) { + setImageResource(defaultImg) + return + } + + val options = RequestOptions + .bitmapTransform(CircleCrop()) + Glide.with(context).load(addImageBaseUrl(url)) + .apply(options) + .error(defaultImg) + .into(this) +} + +/** + * ImageView利用Glide加载圆形图片 + * @param url 图片url(可远程可本地) + */ +fun ImageView.loadCircle(file: File, @DrawableRes defaultResId: Int = 0) { + val options = RequestOptions + .bitmapTransform(CircleCrop()) + if (defaultResId == 0) { + options.placeholder(R.drawable.ic_default_doctor_head_img) + .error(R.drawable.ic_default_doctor_head_img) + } + Glide.with(context).load(file) + .apply(options) + .into(this) +} + +/** + * ImageView利用Glide加载圆形图片 + * @param resourceId 本地图片资源Id + */ +fun ImageView.loadCircle(@DrawableRes resourceId: Int) { + Glide.with(context).load(resourceId) +// .placeholder(R.drawable.ic_default_img) + .apply(RequestOptions.bitmapTransform(CircleCrop())) + .into(this) +} + +/** + * 加载图片到ImageView + * @param imageUrl 图片地址 + * @param imageView View + * @param placeholder 占位图 + */ +fun ImageView.loadRoundedImage( + url: String?, + roundingRadius: Float, + @DrawableRes defaultResId: Int = 0, + isCenterCrop: Boolean = true//是否中心裁剪 +) { + if (TextUtils.isEmpty(url)) { + if (defaultResId != 0) { + setImageResource(defaultResId) + } + return + } + //设置图片圆角角度 + val roundedCorners = RoundedCorners(dp2px(roundingRadius)) + val multiTransformation: MultiTransformation = MultiTransformation( + if (isCenterCrop) CenterCrop() else FitCenter(), roundedCorners + ) + val options = RequestOptions + .bitmapTransform(multiTransformation) + if (defaultResId == 0) { + options.placeholder(R.drawable.ic_default) + .error(R.drawable.ic_default) + } else { + options.placeholder(defaultResId) + .error(defaultResId) + } + Glide.with(context) + .load(addImageBaseUrl(url)) + .apply(options) + .into(this) +} + +/** + * 加载图片到ImageView + * @param imageUrl 图片地址 + * @param imageView View + * @param placeholder 占位图 + */ +fun ImageView.loadRoundedImage( + url: String?, + roundingRadius: Float, + @DrawableRes defaultResId: Int = 0, + method: (Boolean) -> Unit +) { + if (TextUtils.isEmpty(url)) { + if (defaultResId != 0) { + setImageResource(defaultResId) + } + return + } + //设置图片圆角角度 + val roundedCorners = RoundedCorners(dp2px(roundingRadius)) + val multiTransformation: MultiTransformation = MultiTransformation( + CenterCrop(), roundedCorners + ) + val options = RequestOptions + .bitmapTransform(multiTransformation) + if (defaultResId == 0) { + options.placeholder(R.drawable.ic_default) + .error(R.drawable.ic_default) + } else { + options.placeholder(defaultResId) + .error(defaultResId) + } + Glide.with(context) + .load(addImageBaseUrl(url)) + .listener(object : RequestListener { + override fun onLoadFailed( + p0: GlideException?, + p1: Any?, + p2: Target?, + p3: Boolean, + ): Boolean { + method(false) + return false + } + + override fun onResourceReady( + p0: Drawable?, + p1: Any?, + p2: Target?, + p3: DataSource?, + p4: Boolean, + ): Boolean { + method(true) + return false + } + }) + .apply(options) + .into(this) +} + +/** + * 加载图片到ImageView + * @param imageUrl 图片地址 + * @param imageView View + * @param placeholder 占位图 + */ +fun ImageView.loadRoundedImage( + file: File, + roundingRadius: Float +) { + + //设置图片圆角角度 + val roundedCorners = RoundedCorners(dp2px(roundingRadius)) + val multiTransformation: MultiTransformation = MultiTransformation( + CenterCrop(), roundedCorners + ) + val options = RequestOptions + .bitmapTransform(multiTransformation) + Glide.with(context) + .load(file) + .apply(options) + .into(this) +} + +/** + * 加载图片到ImageView + * @param imageUrl 图片地址 + * @param imageView View + * @param placeholder 占位图 + */ +fun ImageView.loadRoundedImage( + imageRes: Int, + roundingRadius: Float +) { + //设置图片圆角角度 + val roundedCorners = RoundedCorners(dp2px(roundingRadius)) + val multiTransformation: MultiTransformation = MultiTransformation( + CenterCrop(), roundedCorners + ) + val options = RequestOptions + .bitmapTransform(multiTransformation) + if (imageRes != 0) { + Glide.with(context) + .load(imageRes) + .apply(options) + .into(this) + } +} + +/** + * SwipeRefreshLayout设置加载主题颜色 + * @author LTP 2022/3/24 + */ +fun SwipeRefreshLayout.initColors() { + setColorSchemeResources( + R.color.theme_color + ) +} + +/** + * RecyclerView列表为空时的显示视图 + */ +fun RecyclerView.getEmptyView(message: String = context.getString(R.string.list_is_empty)): View { + return LayoutInflater.from(context) + .inflate(R.layout.layout_empty, parent as ViewGroup, false).apply { + findViewById(R.id.tv_empty).text = message + } +} + + +/** 加载框 */ +@SuppressLint("StaticFieldLeak") +private var mLoadingDialog: LoadingDialog? = null + +/** 打开加载框 */ +fun AppCompatActivity.showLoading(message: String = "请稍后") { + if (!this.isFinishing && !this.isDestroyed) { + if (mLoadingDialog == null) { + mLoadingDialog = LoadingDialog( + this, + ProgressDialog.STYLE_SPINNER, "请稍后" + ) + mLoadingDialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE) + mLoadingDialog!!.setCanceledOnTouchOutside(false) + mLoadingDialog!!.setCancelable(false) + mLoadingDialog!!.setMessage(if (message.isNullOrEmpty()) "请稍后" else message) + } + if (!this.isDestroyed) { + mLoadingDialog?.show() + } + } +} + +/** 打开加载框 */ +fun Fragment.showLoading(message: String = "请稍后") { + if (!this.isRemoving) { + if (mLoadingDialog == null) { + mLoadingDialog = LoadingDialog( + this.activity, + ProgressDialog.STYLE_SPINNER, "请稍后" + ) + mLoadingDialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE) + mLoadingDialog!!.setCanceledOnTouchOutside(false) + mLoadingDialog!!.setCancelable(false) + mLoadingDialog!!.setMessage(if (message.isNullOrEmpty()) "请稍后" else message) + } + if (this.activity?.isFinishing == false) { + mLoadingDialog?.show() + } + } +} + +/** 隐藏Loading加载框 */ +fun hideLoading() { + mLoadingDialog?.dismiss() + mLoadingDialog = null +} + +fun ViewPager2.init( + fa: FragmentActivity, + tabs: Array, + onCreateFragmentListener: ViewPagerAdapter.OnCreateFragmentListener, + offscreenPageLimit: Int = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT +) { + if (tabs.isNullOrEmpty()) { + return + } + this.offscreenPageLimit = offscreenPageLimit + this.adapter = ViewPagerAdapter(fa, tabs, onCreateFragmentListener) +} + +fun TabLayout.attachViewPager( + viewpager: ViewPager2, + tabs: Array, + isCustomStyle: Boolean = false, + tabStyle: Int = 1 +) { + if (tabs.isNullOrEmpty()) { + return + } + var mediator = TabLayoutMediator( + this, viewpager + ) { tab, position -> //这里可以自定义TabView + if (isCustomStyle) { + val tabView = LayoutInflater.from(this.context) + .inflate(getTabStyle(tabStyle), null) as TextView + tabView.text = tabs[position] + tab.customView = tabView + } else { + tab.text = tabs[position] + } + } + //要执行这一句才是真正将两者绑定起来 + mediator.attach() +} + +fun ViewPager2.init( + fa: FragmentActivity, + tabs: Array, + onCreateFragmentListener: ViewPagerAdapter.OnCreateFragmentListener, + offscreenPageLimit: Int = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT +) { + if (tabs.isNullOrEmpty()) { + return + } + this.offscreenPageLimit = offscreenPageLimit + this.adapter = ViewPagerAdapter( + fa.supportFragmentManager, + LifecycleRegistry(fa).apply { currentState = Lifecycle.State.RESUMED }, + tabs, + onCreateFragmentListener + ) +} + +fun ViewPager2.init( + fa: Fragment, + tabs: Array, + onCreateFragmentListener: ViewPagerAdapter.OnCreateFragmentListener, + offscreenPageLimit: Int = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT +) { + if (tabs.isNullOrEmpty()) { + return + } + this.offscreenPageLimit = offscreenPageLimit + this.adapter = ViewPagerAdapter(fa, tabs, onCreateFragmentListener) +} + + +/** + * 白色按钮,灰色背景的TabLayout + */ +fun TabLayout.onCreateTab( + tabList: Array, + tabStyle: Int = 2, + listener: (TabLayout.Tab?) -> Unit +) { + for (tabTitle in tabList) { + val tab = newTab() + onConfigureTab(context, tab, tabTitle, tabStyle) + addTab(tab, false) + } + selectTab(getTabAt(0)) + addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { + + override fun onTabSelected(tab: TabLayout.Tab?) { + listener.invoke(tab) + } + + override fun onTabUnselected(p0: TabLayout.Tab?) { + } + + override fun onTabReselected(p0: TabLayout.Tab?) { + } + }) +} + + +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 +} + + +fun TabLayout.attachViewPager( + viewpager: ViewPager2, + tabs: Array, + isCustomStyle: Boolean = false, + tabStyle: Int = 1 + +) { + if (tabs.isNullOrEmpty()) { + return + } + var mediator = TabLayoutMediator( + this, viewpager + ) { tab, position -> //这里可以自定义TabView + if (isCustomStyle) { + val tabView = LayoutInflater.from(this.context) + .inflate(getTabStyle(tabStyle), null) as TextView + tabView.text = tabs[position].tabTitle + tab.customView = tabView + } else { + tab.text = tabs[position].tabTitle + } + } + //要执行这一句才是真正将两者绑定起来 + mediator.attach() +} + +/** + * tab 样式 + * 1:通用样式 2:癌症结论tab样式 + */ +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//首页 + else -> R.layout.item_tablayout_group_title + } +} + +fun TabLayout.init(tabs: Array) { + this.removeAllTabs() + tabs.forEach { + this.addTab(this.newTab().setText(it.tabTitle)) + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/ChangePassWordActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/ChangePassWordActivity.kt new file mode 100644 index 0000000..0cb3059 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/ChangePassWordActivity.kt @@ -0,0 +1,108 @@ +package com.xjjk.healthyclients.ui.activity + +import android.os.Bundle +import android.text.method.HideReturnsTransformationMethod +import android.text.method.PasswordTransformationMethod +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.ActivityChangePasswordBinding +import com.xjjk.healthyclients.ui.viewmodel.LoginViewModel +import com.xjjk.healthyclients.utils.CommonUtils +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 找回密码 + */ +class ChangePassWordActivity: BaseVMBActivity(R.layout.activity_change_password) { + var mCode="" + override fun initView(savedInstanceState: Bundle?) { + } + + override fun initData() { + mCode= intent.getStringExtra("code").toString() + } + + override fun bindEvent() { + mBinding?.let{ + addClickViews(it.retrieveConfirm) + it.loginIvEye.setOnClickListener { + mBinding?.let { + var selection= it.tvNewPassword.selectionEnd + if (it.tvNewPassword.transformationMethod== PasswordTransformationMethod.getInstance()){ + it.tvNewPassword.setTransformationMethod( + HideReturnsTransformationMethod.getInstance()) + it.loginIvEye.setImageResource(R.mipmap.ic_password_show) + }else{ + it.tvNewPassword.setTransformationMethod( + PasswordTransformationMethod.getInstance()) + it.loginIvEye.setImageResource(R.mipmap.ic_password_hind) + } + it.tvNewPassword.setSelection(selection) + } + } + it.loginIvEye2.setOnClickListener { + mBinding?.let { + var selection= it.tvConfirmPassword.selectionEnd + if (it.tvConfirmPassword.transformationMethod== PasswordTransformationMethod.getInstance()){ + it.tvConfirmPassword.setTransformationMethod( + HideReturnsTransformationMethod.getInstance()) + it.loginIvEye2.setImageResource(R.mipmap.ic_password_show) + }else{ + it.tvConfirmPassword.setTransformationMethod( + PasswordTransformationMethod.getInstance()) + it.loginIvEye2.setImageResource(R.mipmap.ic_password_hind) + } + it.tvConfirmPassword.setSelection(selection) + } + } + } + } + override fun createObserve() { + super.createObserve() + mBinding.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.mChangeState.collectLatest { result -> + if (result){ + showToast("修改密码成功") + finish() + } + } + } + } + } + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + R.id.retrieve_confirm -> { + //密码需要为12-32位(包含数字、大写、小写字母、特殊字符) + // TODO: 2024/5/11 密码改为12-32位 + var newPassword=mBinding?.tvNewPassword?.text.toString().trim() + if (newPassword.isNullOrEmpty()) { + showToast("请输入新密码") + return + } + var confirmPassword=mBinding?.tvConfirmPassword?.text.toString().trim() + if (confirmPassword.isNullOrEmpty()) { + showToast("请输入验证码") + return + } + if (newPassword!=confirmPassword) { + showToast("两次密码输入不一致,请重新输入") + return + } + if (newPassword.length < 12 || newPassword.length > 32 || !CommonUtils.isPasswordMatches(newPassword)){ + showToast(getString(R.string.password_hint)) + return + } + mViewModel.resetUserPwd(newPassword,confirmPassword,mCode) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/CvdWarningHistoryActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/CvdWarningHistoryActivity.kt new file mode 100644 index 0000000..08b7367 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/CvdWarningHistoryActivity.kt @@ -0,0 +1,134 @@ +package com.xjjk.healthyclients.ui.activity + +import android.os.Bundle +import android.view.View +import com.sw.healthyclients.data.local.DataStoreManager +import com.sw.healthyclients.utils.DateUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.CvdWarningHistoryAdapter +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.base.viewmodel.TestViewModel +import com.xjjk.healthyclients.bean.CvdWarningHistoryBean +import com.xjjk.healthyclients.data.api.HealthCheckNetApi +import com.xjjk.healthyclients.databinding.ActivityCvdWarningHistoryBinding +import com.xjjk.healthyclients.retrofit.getHealthCheckRetrofit +import com.xjjk.healthyclients.retrofit.intervention.CallbackInterventionManager +import com.xjjk.healthyclients.superfuntion.getEmptyView + +/** + * 预警历史 + */ +class CvdWarningHistoryActivity() : + BaseVMBActivity(R.layout.activity_cvd_warning_history) { + private var mApi = getHealthCheckRetrofit().create(HealthCheckNetApi::class.java) + + private var cvdWarningHistoryAdapter: CvdWarningHistoryAdapter = CvdWarningHistoryAdapter() + + var eventType: String = "" + private var mUserId: String = "" + private var mToken: String = "" + + override fun initView(savedInstanceState: Bundle?) { +// mBinding.toolbarLay.rightText = "阈值设置" + } + + override fun initData() { + mBinding.dateTv.text = DateUtil.getNowMonthString() //DateUtil.getNowMonthString() + + mToken = DataStoreManager.getToken() + mUserId = DataStoreManager.getUserId().toString() +// mUserId = "09fd6195cd4c4f1fb457f34678fa0011" + + when (intent.getIntExtra("position", -1)) { + 0 -> { + eventType = "heart_rate" + cvdWarningHistoryAdapter.setType(0) + } + 1 -> { + eventType = "spo2" + cvdWarningHistoryAdapter.setType(1) + } + 2 -> { + eventType = "stress" + cvdWarningHistoryAdapter.setType(2) + } + 3 -> { + eventType = "temperature" + cvdWarningHistoryAdapter.setType(3) + } + } + getHistoryWarning(eventType, mBinding.dateTv.text.toString(), mUserId, 1, 100) + + + mBinding.recyclerView.adapter = cvdWarningHistoryAdapter + cvdWarningHistoryAdapter.setEmptyView(mBinding.recyclerView.getEmptyView()) + } + + + override fun bindEvent() { + mBinding.let { + addClickViews( + it.previousMonthLayout, it.nextMonthLayout, it.toolbarLay.titleTvRight + ) + } + + } + + + override fun processClick(v: View?) { + when (v?.id) { + R.id.previous_month_layout -> { + mBinding.dateTv.text = DateUtil.getPreviousMonth(mBinding.dateTv.text.toString()) + + getHistoryWarning(eventType, mBinding.dateTv.text.toString(), mUserId, 1, 100) + } + + R.id.next_month_layout -> { + mBinding.dateTv.text = DateUtil.getNextMonth(mBinding.dateTv.text.toString()) + + getHistoryWarning(eventType, mBinding.dateTv.text.toString(), mUserId, 1, 100) + } + R.id.title_tv_right -> { + + } + } + } + + + private fun getHistoryWarning( + eventType: String, + queryDate: String, + userId: String, + pageNo: Int, + pageSize: Int + ) { + dialog?.show() + var getCvdWarningData = + mApi.getCvdHistoryWarning(eventType, "${queryDate}-01", userId, pageNo, pageSize) + getCvdWarningData.enqueue(object : + CallbackInterventionManager>() { + + override fun onSuccess( + code: Int, + result: ArrayList?, + message: String, + ok: Boolean + ) { + dialog?.dismiss() + result?.let { + + + cvdWarningHistoryAdapter.setList(result) + } + } + + override fun onFail(code: Int, errMsg: String?) { + dialog?.dismiss() + showToast(errMsg) + } + + }) + + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/FullScreenImageActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/FullScreenImageActivity.kt new file mode 100644 index 0000000..5ba7318 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/FullScreenImageActivity.kt @@ -0,0 +1,57 @@ +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.base.viewmodel.TestViewModel +import com.xjjk.healthyclients.databinding.ActivityFullScreenImageBinding +import com.xjjk.healthyclients.superfuntion.load +import java.io.File + +/** + * 图片放大查看 + */ +class FullScreenImageActivity : BaseVMBActivity(R.layout.activity_full_screen_image){ + + var isFilePath=false + var imageUrl="" + + override fun initView(savedInstanceState: Bundle?) { + mBinding.apply { + } + } + + override fun initData() { + isFilePath=intent.getBooleanExtra("isFilePath",false) + imageUrl=intent.getStringExtra("imageUrl").toString() + mBinding?.apply { + ivBigView.load(imageUrl,false) + if (isFilePath) { + ivBigView.load(File(imageUrl),false) + }else{ + ivBigView.load(imageUrl,false) + } + } + } + + override fun createObserve() { + super.createObserve() + + } + + override fun bindEvent() { + mBinding?.apply{ + addClickViews() + } + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + } + } + + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/InterventionWebActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/InterventionWebActivity.kt new file mode 100644 index 0000000..0d07121 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/InterventionWebActivity.kt @@ -0,0 +1,221 @@ +package com.xjjk.healthyclients.ui.activity + +import android.graphics.Bitmap +import android.os.Bundle +import android.view.View +import android.webkit.WebChromeClient +import android.webkit.WebView +import android.webkit.WebViewClient +import com.bihu.myapplication.retrofit.getInterventionRetrofit +import com.sw.healthyclients.data.local.DataStoreManager +import com.sw.healthyclients.utils.DateUtil +import com.sw.healthyclients.utils.DateUtil.getEndDateOfMonth +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.base.viewmodel.TestViewModel +import com.xjjk.healthyclients.data.api.InterventionNetApi +import com.xjjk.healthyclients.databinding.ActivityInterventionWebBinding +import com.xjjk.healthyclients.retrofit.UrlConfig +import com.xjjk.healthyclients.retrofit.UrlConfig.getDefaultBaseUrl +import org.json.JSONObject +import java.text.SimpleDateFormat +import java.util.Calendar +import java.util.Date +import java.util.Locale + +class InterventionWebActivity() : + BaseVMBActivity(R.layout.activity_intervention_web) { + var mApi = getInterventionRetrofit().create(InterventionNetApi::class.java) + + private var isShowLoading = false + + override fun initView(savedInstanceState: Bundle?) { + mBinding.let { + mBinding.webView.settings.javaScriptEnabled = true + +// mBinding.webView.loadUrl("https://www.baidu.com") + + mBinding.webView.webViewClient = MyViewClient() + + mBinding.webView.webChromeClient = object : WebChromeClient() { // 设置加载进度 + override fun onProgressChanged(view: WebView?, newProgress: Int) { + if (newProgress == 100) { +// hideLoading() + } else { + if (isShowLoading) { +// showLoading() + isShowLoading = false + } + } + super.onProgressChanged(view, newProgress) + } + } + } + } + + var localAdress: String = UrlConfig.getH5MonitorUrl() + var urlType = "" + + override fun initData() { + var url = intent.getStringExtra("url") + var mToken = intent.getStringExtra("token") + var mUserId = DataStoreManager.getUserId().toString() +// mUserId = "09fd6195cd4c4f1fb457f34678fa0011" + var path = intent.getStringExtra("path") + if (mToken.isNullOrEmpty()) { + mToken = DataStoreManager.getToken() + } + if (url.isNullOrEmpty()) { + url = getDefaultBaseUrl() + } + + if (url.startsWith("https")) { + urlType = "https" + } else { + urlType = "http" + } + + url = url.replace("http://", "") + .replace("https://", "") + .replace("/", "") + + localAdress = "${localAdress}p=$path&r=${url}&t=${mToken}&id=${mUserId}" + + var date = intent.getStringExtra("date") + when (path) { + "weekly" -> { + mBinding.weeklyLayout.visibility = View.VISIBLE + mBinding.weeklyDateTv.text = + "${DateUtil.getFirstDayOfWeek(DateUtil.getNowDayString())} ~ ${ + DateUtil.getLastDayOfWeek( + DateUtil.getNowDayString() + ) + }" + date = DateUtil.getFirstDayOfWeek(DateUtil.getNowDayString()) + } + "monthly" -> { + mBinding.monthLayout.visibility = View.VISIBLE + mBinding.dateTv.text = DateUtil.getNowMonthString() + + date = "${DateUtil.getNowMonthString()}" + } + } + +// mBinding.webView.loadUrl("file:///android_asset/dist/index.html?p=$path&r=${url}&t=${mToken}&id=${mUserId}&d=${date}") + +// Log.e("mzf","file:///android_asset/dist/index.html?p=$path&r=${url}&t=${mToken}&id=${mUserId}&d=${date}") +// Log.e("mzf", "$localAdress&d=${date}") + mBinding.webView.loadUrl("$localAdress&d=${date}&h=${urlType}") + } + + override fun bindEvent() { + mBinding.let { + addClickViews( + it.previousWeeklyLayout, + it.nextWeeklyLayout, + it.previousMonthLayout, + it.nextMonthLayout + ) + + } + + } + + + override fun processClick(v: View?) { + when (v?.id) { + R.id.previous_weekly_layout -> { + val previousDay = + DateUtil.getPreviousDay(mBinding.weeklyDateTv.text.toString().split("~")[0]) + mBinding.weeklyDateTv.text = + "${DateUtil.getFirstDayOfWeek(previousDay)} ~ ${ + DateUtil.getLastDayOfWeek( + previousDay + ) + }" + + val date = DateUtil.getFirstDayOfWeek(previousDay) + mBinding.webView.loadUrl("$localAdress&d=${date}&h=${urlType}") + isShowLoading = true + } + R.id.next_weekly_layout -> { + val nextDay = + DateUtil.getNextDay(mBinding.weeklyDateTv.text.toString().split("~")[1]) + + if (!hasNext(nextDay)) { + showToast("没有更多数据了~") + return + } + mBinding.weeklyDateTv.text = + "${DateUtil.getFirstDayOfWeek(nextDay)} ~ ${DateUtil.getLastDayOfWeek(nextDay)}" + + val date = DateUtil.getFirstDayOfWeek(nextDay) + mBinding.webView.loadUrl("$localAdress&d=${date}&h=${urlType}") + isShowLoading = true + } + R.id.previous_month_layout -> { + mBinding.dateTv.text = DateUtil.getPreviousMonth(mBinding.dateTv.text.toString()) + + + val date = "${mBinding.dateTv.text.toString()}" + mBinding.webView.loadUrl("$localAdress&d=${date}&h=${urlType}") + isShowLoading = true + } + R.id.next_month_layout -> { + if (!hasNext(getEndDateOfMonth(mBinding.dateTv.text.toString() + "-01"))) { + showToast("没有更多数据了~") + return + } + mBinding.dateTv.text = DateUtil.getNextMonth(mBinding.dateTv.text.toString()) + + val date = "${mBinding.dateTv.text.toString()}" + mBinding.webView.loadUrl("$localAdress&d=${date}&h=${urlType}") + isShowLoading = true + } + } + } + + private class MyViewClient : WebViewClient() { + //页面加载完调用 + override fun onPageFinished(view: WebView?, url: String?) { + super.onPageFinished(view, url) + +// Log.e("mzf", "url=========$url") + //mWebView.loadUrl("javascript:方法名(参数)") + var json = JSONObject() + json.put("name", "Kotlin") + view?.loadUrl("javascript:showMessage(" + json.toString() + ")") + } + + override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { + super.onPageStarted(view, url, favicon) + } + } + + fun getToken(idcard: String) { +// dialog?.show() +// var getToken = mApi.getTokenByIdCard(idcard) +// getToken.enqueue(object : CallbackInterventionManager() { +// override fun onSuccess(code: Int, result: String?, message: String, ok: Boolean) { +// dialog?.dismiss() +// +// } +// +// override fun onFail(code: Int, errMsg: String?) { +// dialog?.dismiss() +// showToast(errMsg) +// } +// }) + + } + + fun hasNext(dateString: String): Boolean { + val date = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).parse(dateString) + val calendar = Calendar.getInstance() + calendar.time = Date() + calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR)) + // 判断给定日期是否在当前日期之后 + return date < calendar.time + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/LoginActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/LoginActivity.kt new file mode 100644 index 0000000..f35345c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/LoginActivity.kt @@ -0,0 +1,435 @@ +package com.xjjk.healthyclients.ui.activity + +import android.os.Bundle +import android.os.Handler +import android.os.Message +import android.os.SystemClock +import android.text.SpannableString +import android.text.Spanned +import android.text.TextPaint +import android.text.method.LinkMovementMethod +import android.text.style.ClickableSpan +import android.text.style.ForegroundColorSpan +import android.text.style.UnderlineSpan +import android.view.Gravity +import android.view.KeyEvent +import android.view.View +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import com.baileren.rsalibrary.RSACipherStrategy +import com.google.gson.Gson +import com.google.gson.JsonObject +import com.sw.healthyclients.data.local.DataStoreManager +import com.sw.healthyclients.utils.CustomActivityManager +import com.sw.healthyclients.utils.DevicesInfoUtils +import com.xjjk.healthyclients.MainActivity +import com.xjjk.healthyclients.MyApplication +import com.xjjk.healthyclients.R +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.retrofit.RetrofitManager +import com.xjjk.healthyclients.retrofit.UrlConfig +import com.xjjk.healthyclients.superfuntion.loginIm +import com.xjjk.healthyclients.superfuntion.startRetrievePassWordActivity +import com.xjjk.healthyclients.superfuntion.startWebActivity +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 +import retrofit2.Callback +import retrofit2.Response + + +class LoginActivity : BaseVMBActivity(R.layout.activity_login) { + var mApi = RetrofitManager.getRetrofits().create(CommonApi::class.java) + + var isRead=false + var mTextViewDialog : TextViewDialog?=null + + var time: Long = 2000 + var mCount = 5 + var mLastTime = 0L + var mHits = LongArray(mCount) + var isAdminEnable=false + override fun initView(savedInstanceState: Bundle?) { + CommonUtils.logoutClearData() + initAgreement() + mTextViewDialog= TextViewDialog(this) + mBinding?.let { +// it.loginEtUserName.setText("test8") +// it.loginEtUserPassword.setText("Aa123456") +// it.loginEtUserPassword.inputType = +// InputType.TYPE_CLASS_TEXT or InputType.TY PE_TEXT_VARIATION_PASSWORD +// it.loginEtUserPassword.setTransformationMethod(PasswordTransformationMethod.getInstance()) +// it.loginEtUserPassword.addTextChangedListener(LimitInputTextWatcher(it.loginEtUserPassword)) + + } + + } + + + + override fun initData() { + var state= DataStoreManager.isAgreePrivacyPolicyStatus() + if (state) { + if (state) { + isRead=true + mBinding.loginIvReadState.setImageResource(R.drawable.ic_login_green_select) + }else{ + isRead=false + mBinding.loginIvReadState.setImageResource(R.drawable.ic_login_no_select) + } + } + + mViewModel.getAgreement() + + } + + override fun createObserve() { + super.createObserve() + mBinding.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.list.collectLatest { list -> + if (list != null) { + list?.let { + for (index in 0 until it.size){ + when(it[index].value){ + "1" -> { + //用户协议 + if (it[index].text.isNotEmpty()) { + DataStoreManager.saveUserAgreementUrl(UrlConfig.getH5BaseUrl(UrlConfig.baseUrlType)+it[index].text) + } + } + "2" -> { + //隐私政策 + if (it[index].text.isNotEmpty()) { + DataStoreManager.savePrivacyAgreementUrl(UrlConfig.getH5BaseUrl(UrlConfig.baseUrlType)+it[index].text) + } + } + "3" -> { + //相关法律说明 + if (it[index].text.isNotEmpty()) { + DataStoreManager.saveLawUrl(UrlConfig.getH5BaseUrl(UrlConfig.baseUrlType)+it[index].text) + } + } + } + } + } + } + } + } + } + } + } + + + override fun bindEvent() { + mBinding?.apply { + addClickViews( + loginSubmit,loginIvReadState,loginAgreementRoot,loginRetrievePassword,testBtn,ivIconImg, + tvDebug,tvProd,tvTest + ) + } + mTextViewDialog?.let { + it.setDialogTitle("温馨提示", 18f) + it.setContent("您的密码不安全,请先修改密码", 14f) + it.setContentStyle(Gravity.LEFT) + it.setBtnText("确认", 18f) + it.setDialogCancelable(false) + it.setCancelBtnText("取消", 18f) + it.setOnAffirmClickListener(object : TextViewDialog.OnAffirmClickListener { + override fun onAffirmClick(viewDialog: TextViewDialog) { + mContext?.startRetrievePassWordActivity() + } + + override fun onCancelClick(viewDialog: TextViewDialog) { + + } + }) + } + mBinding?.ivIcon?.setOnClickListener { + mLastTime = System.currentTimeMillis() + System.arraycopy(mHits, 1, mHits, 0, mHits.size - 1) + mHits[mHits.size - 1] = SystemClock.uptimeMillis() + if (mHits[0] >= (SystemClock.uptimeMillis() - time)) { + //数组重新初始化 + mHits = LongArray(mCount) + isAdminEnable=true + mBinding.loginEtUserName.setText("admin") + mBinding.loginEtUserPassword.setInputContext("&ZzW$3**@VLA") + showToast("已开启专业模式") + mCount = 5 + + } + } + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + R.id.login_submit -> { +// var passWord=mBinding.loginEtUserPassword.text.toString().trim() +// if (!passWord.formatCheck()) { +// showToast("格式校验不通过") +// } + if (mBinding.loginEtUserName.text.toString().trim().length==0){ + showToast("请输入员工编号或用户名") + }else if (mBinding.loginEtUserPassword.getInputContext().length==0){ + showToast("请输入密码") + }else if (!isRead) { + showToast("请先阅读相关协议并勾选") + }else{ + if (mBinding.loginEtUserPassword.getInputContext().length<12||mBinding.loginEtUserPassword.getInputContext().length>32) { + mTextViewDialog?.show() + }else { + login( + mBinding.loginEtUserName.text.toString().trim(), + mBinding.loginEtUserPassword.getInputContext() + ) + } + } + } + R.id.login_iv_read_state,R.id.login_agreement_root -> { + mBinding?.let { + if (isRead) { + isRead=false + it.loginIvReadState.setImageResource(R.drawable.ic_login_no_select) + }else{ + isRead=true + it.loginIvReadState.setImageResource(R.drawable.ic_login_green_select) + } + } + } + R.id.login_retrieve_password -> { + //找回密码 + 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.tv_debug->{ + DataStoreManager.saveCurrentConfig(1) + System.exit(0); + } + + R.id.tv_test->{ + DataStoreManager.saveCurrentConfig(2) + System.exit(0); + } + + R.id.tv_prod->{ + DataStoreManager.saveCurrentConfig(3) + System.exit(0); + } +// R.id.login_iv_eye -> { +// mBinding?.let { +// var selection=it.loginEtUserPassword.selectionEnd +// if (it.loginEtUserPassword.transformationMethod==PasswordTransformationMethod.getInstance()){ +// it.loginEtUserPassword.setTransformationMethod( +// HideReturnsTransformationMethod.getInstance()) +// it.loginIvEye.setImageResource(R.mipmap.ic_password_show) +// }else{ +// it.loginEtUserPassword.setTransformationMethod(PasswordTransformationMethod.getInstance()) +// it.loginIvEye.setImageResource(R.mipmap.ic_password_hind) +// } +// it.loginEtUserPassword.setSelection(selection) +// } +// } + } + } + + + + + override fun transparentStatusBar(): Boolean { + return true + } + private fun initAgreement() { +// var text="已阅读并同意《用户协议》、《隐私政策》和《相关法律说明》" + var text="已阅读并同意《用户协议》、《隐私政策》" + var span= SpannableString(text) + span.setSpan(object : ClickableSpan() { + + override fun onClick(widget: View) { + DataStoreManager.getUserAgreementUrl()?.let { + if (it.isNotEmpty()) { + mContext?.startWebActivity(it) + } + } + } + // 表示点击整个text的长度都有效触发这个事件 + }, 6, 12, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + mContext?.let{ + span.setSpan(NoUnderlineSpan(),6 , 12, Spanned.SPAN_MARK_MARK) + span.setSpan( + ForegroundColorSpan(it.resources.getColor(R.color.link_blue_color)),6, 12, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + } + + span.setSpan(object : ClickableSpan() { + + override fun onClick(widget: View) { + DataStoreManager.getPrivacyAgreementUrl()?.let { + if (it.isNotEmpty()) { + mContext?.startWebActivity(it) + } + } + } + // 表示点击整个text的长度都有效触发这个事件 + }, 13, 19, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + mContext?.let{ + span.setSpan(NoUnderlineSpan(),13 , 19, Spanned.SPAN_MARK_MARK) + span.setSpan( + ForegroundColorSpan(it.resources.getColor(R.color.link_blue_color)),13, 19, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + } +// span.setSpan(object : ClickableSpan() { +// +// override fun onClick(widget: View) { +// DataStoreManager.getLawUrl()?.let { +// if (it.isNotEmpty()) { +// mContext?.startWebActivity(it) +// } +// } +// } +// // 表示点击整个text的长度都有效触发这个事件 +// }, 20, 28, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) +// mContext?.let{ +// span.setSpan(NoUnderlineSpan(),20 , 28, Spanned.SPAN_MARK_MARK) +// span.setSpan( +// ForegroundColorSpan(it.resources.getColor(R.color.link_blue_color)),20, 28, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) +// } + mBinding?.loginTvAgreement?.setText(span) + mBinding?.loginTvAgreement?.setMovementMethod(LinkMovementMethod.getInstance()) + } + + fun login(name:String,password:String){ + dialog?.show() + var bean= LoginBean() + try { + bean.deviceType="${DevicesInfoUtils.getDeviceBrand()}" + if ("HUAWEI"== DevicesInfoUtils.getDeviceBrand()) { + if ("12"== DevicesInfoUtils.getDeviceAndroidVersion()){ + bean.deviceSystem="${DevicesInfoUtils.getDeviceModel()}(Android:12||Harmony:${DevicesInfoUtils.getDeviceHarmonyOsVersion()})" + }else{ + bean.deviceSystem="${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})" + } + }else{ + bean.deviceSystem="${DevicesInfoUtils.getDeviceModel()}(Android${DevicesInfoUtils.getDeviceAndroidVersion()})" + } + + } catch (e: Exception) { + e.printStackTrace() + } + bean.username=name + bean.password=RSACipherStrategy().encrypt(ConstantUtils.mRSAKey,password) +// bean.password=password + var login=mApi.mLogin(bean) + login.enqueue(object : Callback{ + override fun onResponse(call: Call, response: Response) { + dialog?.dismiss() + try { + var bean= Gson().fromJson(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 + CustomActivityManager.getInstance() + .finishActivity(MainActivity::class.java) + if (bean != null && bean.result != null) { + DataStoreManager.saveToken(bean.result.token) + MyApplication.appViewModel?.getIMSig(successCall = { + this@LoginActivity?.loginIm(it.userId, it.userSig) + }) + if (bean.result.userInfo != null) { +// SpfConfig.getInstance().putBoolean("isReadAgreement",true) + CommonUtils.loginSaveData(bean.result.userInfo) + toActivity(MainActivity::class.java) + finish() + } + } + }else{ + showToast("账号或登录密码错误,请重试") + } + }else{ + showToast(bean.message) + } + + } catch (e: Exception) { + showToast("服务器走丢了,请稍后重试") + } + } + + override fun onFailure(call: Call, t: Throwable) { + dialog?.dismiss() +// if (t.message.toString().contains("No addressassociated with hostname")){ +// +// }else{ +// +// } + showToast("网络连接异常,请稍后重试!") + } + }) + } + +// fun setNoBootomLine(span:SpannableString){ +// span.setSpan(noUnderlineSpan,0 , trim.length(), Spanned.SPAN_MARK_MARK) +// } + internal class NoUnderlineSpan : UnderlineSpan() { + override fun updateDrawState(ds: TextPaint) { + ds.setColor(ds.linkColor) + ds.setUnderlineText(false) + } + } + + private var isExit = false + var mHandler: Handler = object : Handler() { + override fun handleMessage(msg: Message) { + super.handleMessage(msg) + isExit = false + } + } + private fun exit() { + if (!isExit) { + isExit = true + showToast("再按一次退出程序") + // 利用handler延迟发送更改状态信息 + mHandler.sendEmptyMessageDelayed(0, 2000) + } else { + CustomActivityManager.getInstance().finishAllActivity() +// System.exit(0) + } + } + + override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + if (keyCode == KeyEvent.KEYCODE_BACK) { +// exit() +// return false + CustomActivityManager.getInstance() + .finishActivity(MainActivity::class.java) + toActivity(MainActivity::class.java) + finish() + } + return super.onKeyDown(keyCode, event) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/RetrievePassWordActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/RetrievePassWordActivity.kt new file mode 100644 index 0000000..00904ea --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/RetrievePassWordActivity.kt @@ -0,0 +1,155 @@ +package com.xjjk.healthyclients.ui.activity + +import android.content.res.ColorStateList +import android.graphics.Color +import android.os.Bundle +import android.os.Handler +import android.os.Message +import android.view.View +import android.widget.RadioButton +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.ActivityRetrievePasswordBinding +import com.xjjk.healthyclients.superfuntion.phoneCheck +import com.xjjk.healthyclients.superfuntion.startChangePassWordActivity +import com.xjjk.healthyclients.ui.viewmodel.LoginViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 找回密码 + */ +class RetrievePassWordActivity: BaseVMBActivity(R.layout.activity_retrieve_password) { + var mNumber=60 + var mIsSendCode=true + var type=0 //0 信息找回 1 验证码找回 + var mhandler=object : Handler(){ + override fun handleMessage(msg: Message) { + super.handleMessage(msg) + when (msg.what) { + 0 -> { + if (type==1) { + if (mNumber==1) { + mIsSendCode=true + mNumber=60 + mBinding?.retrieveGetCheckCode?.text="重新发送" + mBinding?.retrieveGetCheckCode?.backgroundTintList = ColorStateList.valueOf(Color.parseColor("#21BEBD")) + }else{ + mIsSendCode=false + mNumber=mNumber-1 + mBinding?.retrieveGetCheckCode?.text="重新发送(${mNumber}s)" + sendEmptyMessageDelayed(0,1000) + } + }else{ + mNumber=60 + mBinding?.retrieveGetCheckCode?.text="获取验证码" + mBinding?.retrieveGetCheckCode?.backgroundTintList = ColorStateList.valueOf(Color.parseColor("#21BEBD")) + } + + + } + else -> {} + } + } + } + override fun initView(savedInstanceState: Bundle?) { + switchFindMode() + } + + override fun initData() { + } + + override fun bindEvent() { + mBinding?.let{ + addClickViews(it.retrieveGetCheckCode,it.retrieveConfirm) + } + mBinding?.radioGroup?.setOnCheckedChangeListener { group, checkedId -> + var radio=findViewById(checkedId) + var value=radio.text.toString() + if (value=="用户信息找回") { + type=0 + switchFindMode() + }else{ + type=1 + switchFindMode() + } + } + } + + fun switchFindMode(){ + if (type==0){ + mBinding?.llInfoFind?.visibility=View.VISIBLE + mBinding?.llCodeFind?.visibility=View.GONE + }else{ + mBinding?.llInfoFind?.visibility=View.GONE + mBinding?.llCodeFind?.visibility=View.VISIBLE + } + } + + override fun createObserve() { + super.createObserve() + mBinding.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.mCode.collectLatest { code -> + if (!code.isNullOrEmpty()) { + startChangePassWordActivity(code) + finish() + } + } + } + } + } + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + R.id.retrieve_get_check_code -> { + if (mIsSendCode) { + mBinding?.retrieveGetCheckCode?.backgroundTintList = ColorStateList.valueOf(Color.parseColor("#BBBBBB")) + mBinding?.retrieveGetCheckCode?.text="重新发送(${mNumber}s)" + mhandler.sendEmptyMessageDelayed(0,1000) + } + } + R.id.retrieve_confirm -> { + if (type==0) { + var name=mBinding?.tvUserName?.text.toString().trim() + var idcard=mBinding?.tvUserIdCard?.text.toString().trim() + var phone=mBinding?.tvUserPhone?.text.toString().trim() + if (name.isNullOrEmpty()) { + showToast("请输入姓名") + return + } + if (idcard.isNullOrEmpty()) { + showToast("请输入身份证号") + return + } + if (phone.isNullOrEmpty()) { + showToast("请输入手机号") + return + } + mViewModel.checkUserInfo(name,idcard,phone) + }else if (type==1) { + var phone=mBinding?.retrievePhone?.text.toString().trim() + if (phone.isNullOrEmpty()) { + showToast("请输入手机号") + return + } + if(!phone.phoneCheck()){ + showToast("手机号格式不正确") + return + } + var code=mBinding?.retrieveCheckCode?.text.toString().trim() + if (code.isNullOrEmpty()) { + showToast("请输入验证码") + return + } + } + + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/UserInfoSettingActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/UserInfoSettingActivity.kt new file mode 100644 index 0000000..dd91ad8 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/UserInfoSettingActivity.kt @@ -0,0 +1,117 @@ +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.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.databinding.ActivityUserInfoSettingBinding +import com.xjjk.healthyclients.ui.viewmodel.UserInfoSettingViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 个人信息设置页面 + */ +class UserInfoSettingActivity : + BaseVMBActivity(R.layout.activity_user_info_setting){ + + + override fun initView(savedInstanceState: Bundle?) { + mViewModel.selectUserInfo() + mBinding?.apply { + userInfoHeader.setheaderInfo("头像",""){} + userInfoName.setInfo("姓名","--") + userInfoSex.setInfo("性别","--") + userInfoWorkNumber.setInfo("工号","--") + userInfoPhone.setInfo("手机号","--") + userInfoIdCard.setInfo("身份证号","--") + userInfoPessoalType.setInfo("人员类型","--") + userInfoDepartamento.setInfo("所属部门", "--") + userInfoHealthType.setInfo("健康类型", "--") + userInfoBloodType.setInfo("血型", "--", false) + } + + + } + + override fun transparentStatusBar(): Boolean { + return false + } + + override fun initData() { + + + + } + + override fun onResume() { + super.onResume() + } + + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.userInfo.collectLatest { bean -> + if (bean==null) { + return@collectLatest + } + mBinding?.apply { + try { + userInfoHeader.setheaderInfo("头像",bean.avatar){ +// showToast("点击了头像") + } + userInfoName.setInfo("姓名",bean.realname.toString()) + var sexName="--" + if(bean.sex_dictText!=null&&bean.sex_dictText.length>0){ + sexName=bean.sex_dictText + } + userInfoSex.setInfo("性别",sexName) + userInfoWorkNumber.setInfo("工号","${bean.workNo}") + if(bean.phone.isNotEmpty()){ + userInfoPhone.setInfo("手机号","${bean.phone}") + } + if(bean.idCard.isNotEmpty()){ + userInfoIdCard.setInfo("身份证号","${bean.idCard}") + } + userInfoPessoalType.setInfo("人员类型","${bean.personType_dictText}") + if(bean.orgCode.isNotEmpty()) { + userInfoDepartamento.setInfo("所属部门", "${bean.orgCode}") + } + if (bean.healthType.isNotEmpty()&&bean.healthType!="null"){ + userInfoHealthType.visibility=View.VISIBLE + userInfoHealthType.setInfo("健康类型", "${bean.healthType_dictText}") + }else{ + userInfoHealthType.visibility=View.GONE + } + if (bean.bloodType.isNotEmpty()&&bean.bloodType!="null"){ + userInfoBloodType.visibility=View.VISIBLE + userInfoBloodType.setInfo("血型", "${bean.bloodType_dictText}", false) + }else{ + userInfoBloodType.visibility=View.GONE + } + + + } catch (e: Exception) { + } + } + } + } + } + } + + override fun bindEvent() { + mBinding?.apply { + } + + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/UserSettingActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/UserSettingActivity.kt new file mode 100644 index 0000000..ca4b252 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/UserSettingActivity.kt @@ -0,0 +1,68 @@ +package com.xjjk.healthyclients.ui.activity + +import android.os.Bundle +import android.view.View +import com.sw.healthyclients.data.local.DataStoreManager +import com.xjjk.healthyclients.AppViewModel +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.superfuntion.startWebActivity + +/** + * 个人信息设置页面 + */ +class UserSettingActivity : + BaseVMBActivity(R.layout.activity_setting) { + + + override fun initView(savedInstanceState: Bundle?) { + mBinding?.apply { + settingEditPassword.setOrderStateInfo("账号与安全(修改密码)",0,View.GONE) + settingUserAgreement.setOrderStateInfo("用户协议",0,View.VISIBLE) + settingUserPrivacyPolicy.setOrderStateInfo("隐私政策",0,View.VISIBLE) + } + + } + + override fun transparentStatusBar(): Boolean { + return false + } + + override fun initData() { + + + } + + override fun bindEvent() { + mBinding?.apply { + addClickViews(settingEditPassword,settingUserAgreement,settingUserPrivacyPolicy,settingUserVersion) + } + + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + R.id.setting_edit_password -> { + mContext?.startRetrievePassWordActivity() + } + R.id.setting_user_agreement -> { + DataStoreManager.getUserAgreementUrl()?.let { + if (it.isNotEmpty()) { + mContext?.startWebActivity(it) + } + } + } + R.id.setting_user_privacy_policy -> { + DataStoreManager.getPrivacyAgreementUrl()?.let { + if (it.isNotEmpty()) { + mContext?.startWebActivity(it) + } + } + } + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/WebActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/WebActivity.kt new file mode 100644 index 0000000..2861622 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/WebActivity.kt @@ -0,0 +1,312 @@ +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 +import android.webkit.DownloadListener +import android.webkit.JsResult +import android.webkit.WebResourceRequest +import android.webkit.WebSettings +import android.webkit.WebView +import android.widget.FrameLayout +import androidx.lifecycle.lifecycleScope +import com.just.agentweb.AbsAgentWebSettings +import com.just.agentweb.AgentWeb +import com.just.agentweb.IAgentWebSettings +import com.just.agentweb.PermissionInterceptor +import com.just.agentweb.WebChromeClient +import com.just.agentweb.WebListenerManager +import com.just.agentweb.WebViewClient +import com.sw.healthyclients.utils.StatusbarUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.databinding.ActivityWebBinding +import com.xjjk.healthyclients.superfuntion.hideLoading +import com.xjjk.healthyclients.superfuntion.showLoading +import com.xjjk.healthyclients.superfuntion.startSystemWebActivity +import com.xjjk.healthyclients.ui.viewmodel.WebViewModel +import com.xjjk.healthyclients.utils.AndroidInterface +import com.xjjk.healthyclients.view.TextViewDialog +import kotlinx.coroutines.launch +import okhttp3.HttpUrl.Companion.toHttpUrl + + +/** + * @author nanfeifei + * @time 2023/8/9 16:30 + * @description Web页面 + */ +class WebActivity : BaseVMBActivity(R.layout.activity_web) { + private lateinit var mAgentWeb: AgentWeb + private lateinit var mUrl: String + private lateinit var mTitle: String + private var mIsScale = false + private var customTitle:String ?="" + + /** + * 是否需要交给H5确认是否需要退出页面 + */ + var jsAffirmBack = "" + val textViewDialog by lazy { TextViewDialog(this) } + val androidInterface: AndroidInterface by lazy { AndroidInterface(mAgentWeb, this) } + override fun initView(savedInstanceState: Bundle?) { + + mAgentWeb = AgentWeb.with(this) + .setAgentWebParent(mBinding.flWeb, FrameLayout.LayoutParams(-1, -1)) + .closeIndicator() + .setPermissionInterceptor(mPermissionInterceptor) //权限拦截 2.0.0 加入。 + .setAgentWebWebSettings(getSettings()) + .setWebChromeClient(mWebChromeClient) + .setWebViewClient(mWebViewClient) + .createAgentWeb() + .ready() + .go(getUrl()) + mAgentWeb.agentWebSettings.webSettings.javaScriptEnabled = true + 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 + 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) + if (mIsScale) { + mAgentWeb.agentWebSettings.webSettings.setSupportZoom(true) + mAgentWeb.agentWebSettings.webSettings.builtInZoomControls = true + } + } + + /** + * 监听横竖屏切换改变状态栏,页面本身设置为强制竖屏模式,触发切换只存在于H5中视频的全屏播放,全屏播放时需要为透明状态栏 + */ + override fun onConfigurationChanged(newConfig: Configuration) { + super.onConfigurationChanged(newConfig) + if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {//横屏 + setTransparentStatusBar(isTransparent = true, isStatusBarDarkFont = false) + } else {//竖屏 + setTransparentStatusBar(isTransparent = false, isStatusBarDarkFont = false) + } + } + + override fun onBackEvent() { + if (!mAgentWeb.back()) { + if (jsAffirmBack.isNullOrEmpty()) { + super.onBackEvent() + } else { + mAgentWeb.jsAccessEntrace.quickCallJs("interceptBack", + { value -> + if ("1" != value) { + finish() + } + }) + } + + } + } + + private fun getUrl(): String { + mUrl = intent.extras?.getString("url").toString() + println("webUrl--$mUrl") + return mUrl + } + + private val mWebViewClient: WebViewClient = object : WebViewClient() { + override fun onPageStarted(view: WebView?, url: String, favicon: Bitmap?) { + jsAffirmBack = url.toHttpUrl().queryParameter("affirmBack") ?: "" + showLoading() + } + + override fun onPageFinished(view: WebView?, url: String?) { + super.onPageFinished(view, url) + hideLoading() + } + + override fun shouldOverrideUrlLoading(view: WebView?, url: String): Boolean { + return super.shouldOverrideUrlLoading(view, url) + } + + override fun shouldOverrideUrlLoading( + view: WebView?, + request: WebResourceRequest? + ): Boolean { + var url = request?.url.toString() + return super.shouldOverrideUrlLoading(view, request) + } + } + private val mWebChromeClient: WebChromeClient = object : WebChromeClient() { + override fun onReceivedTitle(view: WebView?, title: String?) { + super.onReceivedTitle(view, title) + mTitle = title ?: "" + if (mTitle.startsWith("http")) { + mTitle = getString(R.string.app_name) + } + lifecycleScope.launch { + if (TextUtils.isEmpty(customTitle)) { + mViewModel.title.emit(mTitle) + } else { + mViewModel.title.emit(customTitle!!) + } + } + } + + override fun onProgressChanged(view: WebView, newProgress: Int) { + if (newProgress > 90) { + hideLoading() + } + } + + override fun onJsAlert( + view: WebView?, + url: String?, + message: String?, + result: JsResult? + ): Boolean { + message?.let { + textViewDialog.setContent(it, 14f) + textViewDialog.setDialogCancelable(false) + textViewDialog.setOnAffirmClickListener(object : + TextViewDialog.OnAffirmClickListener { + override fun onAffirmClick(viewDialog: TextViewDialog) { + result?.confirm() + } + + override fun onCancelClick(viewDialog: TextViewDialog) { + } + + }) + textViewDialog.show() + return true + } + return super.onJsAlert(view, url, message, result) + } + + override fun onJsConfirm( + view: WebView?, + url: String?, + message: String?, + result: JsResult? + ): Boolean { + message?.let { + textViewDialog.setContent(it) + textViewDialog.setCancelBtnText(getString(R.string.dialog_cancel)) + textViewDialog.setDialogCancelable(false) + textViewDialog.setOnAffirmClickListener(object : + TextViewDialog.OnAffirmClickListener { + override fun onAffirmClick(viewDialog: TextViewDialog) { + result?.confirm() + } + + override fun onCancelClick(viewDialog: TextViewDialog) { + result?.cancel() + } + + }) + textViewDialog.show() + return true + } + return super.onJsConfirm(view, url, message, result) + } + } + private var mPermissionInterceptor = + PermissionInterceptor { url, permissions, action -> + + /** + * PermissionInterceptor 能达到 url1 允许授权, url2 拒绝授权的效果。 + * @param url + * @param permissions + * @param action + * @return true 该Url对应页面请求权限进行拦截 ,false 表示不拦截。 + */ + false + } + + /** + * @return IAgentWebSettings + */ + fun getSettings(): IAgentWebSettings { + return object : AbsAgentWebSettings() { + private val mAgentWeb: AgentWeb? = null + override fun bindAgentWebSupport(agentWeb: AgentWeb) { + this.mAgentWeb = agentWeb + } + + /** + * AgentWeb 4.0.0 内部删除了 DownloadListener 监听 ,以及相关API ,将 Download 部分完全抽离出来独立一个库, + * 如果你需要使用 AgentWeb Download 部分 , 请依赖上 compile 'com.download.library:Downloader:4.1.1' , + * 如果你需要监听下载结果,请自定义 AgentWebSetting , New 出 DefaultDownloadImpl + * 实现进度或者结果监听,例如下面这个例子,如果你不需要监听进度,或者下载结果,下面 setDownloader 的例子可以忽略。 + * @param webView + * @param downloadListener + * @return WebListenerManager + */ + override fun setDownloader( + webView: WebView, + downloadListener: DownloadListener? + ): WebListenerManager { + + return super.setDownloader( + webView + ) { url, userAgent, contentDisposition, mimetype, contentLength -> + url?.let { + startSystemWebActivity(it) + } + } + } + } + } + var isRefresh = false + + + override fun onResume() { + mAgentWeb.webLifeCycle.onResume() + if (getUrl().contains("motionClock")&&isRefresh) {//动打卡链接,同步微信步数再次刷新界面 + mAgentWeb.urlLoader.reload() + } + super.onResume() + } + + override fun bindEvent() { + + } + + override fun processClick(v: View?) { + } + + override fun onPause() { + mAgentWeb.webLifeCycle.onPause() + isRefresh = true + super.onPause() + } + + override fun onDestroy() { + mAgentWeb.webLifeCycle.onDestroy() + super.onDestroy() + } + + fun changedConfig(int: Int) { + if (int == 1) { + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE + } else if (int == 2) { + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/AddBigDiseaseActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/AddBigDiseaseActivity.kt new file mode 100644 index 0000000..eae6e79 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/AddBigDiseaseActivity.kt @@ -0,0 +1,234 @@ +package com.xjjk.healthyclients.ui.activity.emergency + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import com.github.gzuliyujiang.wheelpicker.DatePicker +import com.github.gzuliyujiang.wheelpicker.OptionPicker +import com.github.gzuliyujiang.wheelpicker.TimePicker +import com.github.gzuliyujiang.wheelpicker.annotation.DateMode +import com.github.gzuliyujiang.wheelpicker.annotation.TimeMode +import com.github.gzuliyujiang.wheelpicker.entity.DateEntity +import com.sw.healthyclients.data.local.DataStoreManager +import com.sw.healthyclients.utils.DateUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.CommonSettingMenuBean +import com.xjjk.healthyclients.bean.emergency.AddBigDiseaseSubmitBean +import com.xjjk.healthyclients.bean.emergency.HospitalBean +import com.xjjk.healthyclients.databinding.ActivityBigAddDiseaseBinding +import com.xjjk.healthyclients.ui.viewmodel.AddBigDiseaseViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 大病就医 + */ +class AddBigDiseaseActivity : BaseVMBActivity(R.layout.activity_big_add_disease){ + val hospitalPicker: OptionPicker by lazy { OptionPicker(this) } + val registerTypePicker: OptionPicker by lazy { OptionPicker(this) } + val timePicker: DatePicker by lazy { DatePicker(this) } + val timePicker2: TimePicker by lazy { TimePicker(this) } + lateinit var currentDate: DateEntity + var mHospitalList= arrayListOf() + var mRegisterType= arrayListOf() + var mbean= AddBigDiseaseSubmitBean() + + + override fun initView(savedInstanceState: Bundle?) { + mBinding?.apply { + addDiseaseTime.text="${DateUtil.nowYear}-${DateUtil.nowMonth}-${DateUtil.nowDay}" + addDiseaseTime2.text="${DateUtil.nowHour}:${DateUtil.nowMinute}" + } + + } + + override fun initData() { + var defaultDate = DateEntity.yearOnFuture(0) + var name= DataStoreManager.getUserInfo().realname + if (name.isNullOrEmpty()) { + name= DataStoreManager.getUserInfo().username.toString() + } + mBinding?.addDiseaseName?.text=name + currentDate = DateEntity.target(defaultDate.year, defaultDate.month, defaultDate.day) + mViewModel.selectStationHospitalList() + mViewModel.getCommonSettingMenuList() + } + + override fun createObserve() { + super.createObserve() + mBinding?.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.messageList.collectLatest {list -> + mHospitalList.clear() + mHospitalList.addAll(list) + hospitalPicker.setData(mHospitalList) + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.registerType.collectLatest {list -> + mRegisterType.clear() + mRegisterType.addAll(list) + registerTypePicker.setData(mRegisterType) + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.isSubmit.collectLatest {isClose -> + if (isClose){ + finish() + } + } + } + } + } + + } + + + + + override fun bindEvent() { + mBinding?.apply { + addClickViews(addDiseaseSelectHospital,addDiseaseTime,addDiseaseRegisterType,bigDiseaseSubmit,addDiseaseTime2) + } + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + R.id.add_disease_select_hospital -> { + showHospitalPicker() + } + R.id.add_disease_time -> { + showDatePicker() + } + R.id.add_disease_time_2 -> { + showDatePicker2() + } + R.id.add_disease_register_type -> { + showRegisterTypePicker() + } + R.id.big_disease_submit -> { + mBinding?.apply { + if(addDiseaseSelectHospital.text.toString().trim().isEmpty()){ + showToast("请选择医院") + return + } + if(addDiseaseRegisterType.text.toString().trim().isEmpty()){ + showToast("请选择挂号类型") + return + } + if(addDiseaseTime.text.toString().trim().isEmpty()){ + showToast("请选择预约时间") + return + } + var time=addDiseaseTime.text.toString()+" "+addDiseaseTime2.text.toString() + var date= DateUtil.strToDateLong2(time) + mbean.desireTime = date.time + mbean.hospitalName=addDiseaseSelectHospital.text.toString().trim() + mbean.medicalCardNo=addDiseaseRegisterIdCard.text.toString().trim() + mbean.reservationOffice=addDiseaseDeparment.text.toString().trim() + mbean.reservationDoctor=addDiseaseDoctorName.text.toString().trim() + mbean.diseaseDescribe=addDiseaseSick.text.toString().trim() + mViewModel.appointmentSeeDoctor(mbean) + } + + } + } + } + + private fun showDatePicker() { + timePicker.setBackgroundResource(R.drawable.rectangle_top_round_corner20_white) + timePicker.setTitle("选择预约时间") +// (picker.headerView as TextView).gravity = Gravity.START + var wheelLayout = timePicker.wheelLayout + wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY) + wheelLayout.setRange(DateEntity.target(currentDate.year, 1, 1), DateEntity.target(currentDate.year+10, 1, 1), currentDate) + wheelLayout.setResetWhenLinkage(false) + timePicker.setOnDatePickedListener { year, month, day -> + setBirthDay(year, month, day) + } + timePicker.show() + } + private fun showDatePicker2() { + timePicker2.setBackgroundResource(R.drawable.rectangle_top_round_corner20_white) + timePicker2.setTitle("选择预约时间") +// (picker.headerView as TextView).gravity = Gravity.START + var wheelLayout = timePicker2.wheelLayout + wheelLayout.setTimeMode(TimeMode.HOUR_24_NO_SECOND) + wheelLayout.setResetWhenLinkage(false) + timePicker2.setOnTimePickedListener { hour, minute, day -> + mBinding?.apply { + var m="$minute" + if(minute<10){ + m="0$minute" + } + addDiseaseTime2.text="${hour}:${m}" + } +// setBirthDay(year, month, day) + } + timePicker2.show() + } + + private fun setBirthDay(year: Int, month: Int, day: Int) { + currentDate = DateEntity.target(year, month, day) + mBinding.addDiseaseTime.text = currentDate.toString() + mBinding.addDiseaseTime.setTextColor(mContext!!.resources.getColor(R.color.text_black_33)) + } + + private fun showHospitalPicker() { + if(mHospitalList.size==0){ + showToast("暂无可选择医院数据") + return + } + hospitalPicker.setBackgroundResource(R.drawable.rectangle_top_round_corner20_white) + hospitalPicker.setTitle("选择预约医院") + hospitalPicker.setDefaultPosition(0) + hospitalPicker.wheelView.setFormatter { value -> + (value as HospitalBean).name + } + hospitalPicker.setOnOptionPickedListener { position, item -> + setHospitalText(item as HospitalBean) + + } + hospitalPicker.show() + } + private fun setHospitalText(commonSettingMenuBean: HospitalBean) { + mBinding.addDiseaseSelectHospital.text = commonSettingMenuBean.name + mBinding.addDiseaseSelectHospital.setTextColor(mContext!!.resources.getColor(R.color.text_black_33)) + mbean.hospitalId = commonSettingMenuBean.id.toString() + } + + private fun showRegisterTypePicker() { + if (mRegisterType.size==0){ + showToast("暂无可选择挂号类型数据") + return + } + registerTypePicker.setBackgroundResource(R.drawable.rectangle_top_round_corner20_white) + registerTypePicker.setTitle("选择挂号类型") + registerTypePicker.setDefaultPosition(0) + registerTypePicker.wheelView.setFormatter { value -> + (value as CommonSettingMenuBean).text + } + registerTypePicker.setOnOptionPickedListener { position, item -> + setRelationText(item as CommonSettingMenuBean) + + } + registerTypePicker.show() + } + private fun setRelationText(commonSettingMenuBean: CommonSettingMenuBean) { + mBinding.addDiseaseRegisterType.text = commonSettingMenuBean.text + mBinding.addDiseaseRegisterType.setTextColor(mContext!!.resources.getColor(R.color.text_black_33)) + mbean.registerCategory = commonSettingMenuBean.value + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/EmergencySeekDoctorActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/EmergencySeekDoctorActivity.kt new file mode 100644 index 0000000..264db4c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/EmergencySeekDoctorActivity.kt @@ -0,0 +1,115 @@ +package com.xjjk.healthyclients.ui.activity.emergency + +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 com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.listener.OnItemClickListener +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean +import com.xjjk.healthyclients.databinding.ActivityEmergencySeekDoctorBinding +import com.xjjk.healthyclients.superfuntion.getEmptyView +import com.xjjk.healthyclients.superfuntion.startEmergencySeekDoctorDetailsActivity +import com.xjjk.healthyclients.ui.activity.emergency.adapter.EmergencySeekDoctorAdapter +import com.xjjk.healthyclients.ui.viewmodel.EmergencySeekDoctorViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 应急就医 + */ +class EmergencySeekDoctorActivity : BaseVMBActivity( + R.layout.activity_emergency_seek_doctor), + OnItemClickListener { + private val mEmergencySeekDoctorAdapter: EmergencySeekDoctorAdapter by lazy { EmergencySeekDoctorAdapter(mContext!!) } + private var mHospitalList=arrayListOf() + override fun initView(savedInstanceState: Bundle?) { + mBinding?.apply { + val linearLayoutManager = LinearLayoutManager(this@EmergencySeekDoctorActivity) + rvSeekDoctorList.layoutManager = linearLayoutManager + } + + } + + override fun initData() { + mViewModel.initUserOrderPage(true) + } + + override fun createObserve() { + super.createObserve() + mBinding?.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mList.collectLatest {list -> + if(mViewModel.isRefreshing.value){ + mEmergencySeekDoctorAdapter.setNewInstance(list) + }else{ + mEmergencySeekDoctorAdapter.addData(list) + } + mHospitalList.addAll(list) + + mEmergencySeekDoctorAdapter.loadMoreModule.loadMoreComplete() + if (rvSeekDoctorList.adapter==null) { + mEmergencySeekDoctorAdapter.setEmptyView(rvSeekDoctorList.getEmptyView()) + mEmergencySeekDoctorAdapter.setOnItemClickListener(this@EmergencySeekDoctorActivity) + initLoadMore() + rvSeekDoctorList.adapter = mEmergencySeekDoctorAdapter + }else{ + mEmergencySeekDoctorAdapter.setEmptyView(rvSeekDoctorList.getEmptyView()) + } +// mHospitalList.clear() +// mHospitalList.addAll(list) +// mSeekDoctorHospitalAdapter?.notifyDataSetChanged() + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isLoadMoreEnd.collectLatest { + if (it) { + mEmergencySeekDoctorAdapter.loadMoreModule.loadMoreEnd(it) + } + } + } + } + } + + } + + private fun initLoadMore() { + mEmergencySeekDoctorAdapter.loadMoreModule.setOnLoadMoreListener { + mViewModel.initUserOrderPage(false) + } + mEmergencySeekDoctorAdapter.loadMoreModule.isEnableLoadMore = true + mEmergencySeekDoctorAdapter.loadMoreModule.isAutoLoadMore = true + //当自动加载开启,同时数据不满一屏时,是否继续执行自动加载更多(默认为true) + mEmergencySeekDoctorAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = false + } + + + + + + override fun bindEvent() { + mBinding?.apply { + addClickViews() + } + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + } + } + + override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + mContext?.let{ + startEmergencySeekDoctorDetailsActivity(it,mHospitalList[position].id,mHospitalList[position].sessionId) + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/EmergencySeekDoctorDetailsActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/EmergencySeekDoctorDetailsActivity.kt new file mode 100644 index 0000000..123412e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/EmergencySeekDoctorDetailsActivity.kt @@ -0,0 +1,216 @@ +package com.xjjk.healthyclients.ui.activity.emergency + +import android.graphics.Typeface +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 com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.emergency.GetOrderBySessionIdBean +import com.xjjk.healthyclients.databinding.ActivityEmergencySeekDoctorDetailsBinding +import com.xjjk.healthyclients.superfuntion.startAddBigDiseaseActivity +import com.xjjk.healthyclients.superfuntion.toHtml +import com.xjjk.healthyclients.ui.activity.emergency.adapter.EmergencySeekDoctorDetailsAdapter +import com.xjjk.healthyclients.ui.viewmodel.EmergencySeekDoctorDetailsViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 应急就医详情 + */ +class EmergencySeekDoctorDetailsActivity : BaseVMBActivity(R.layout.activity_emergency_seek_doctor_details){ + + var mEmergencySeekDoctorDetailsAdapter: EmergencySeekDoctorDetailsAdapter?=null + var mMessageList:ArrayList = arrayListOf() + var id="" + var sessionId="" + + + override fun initView(savedInstanceState: Bundle?) { + mBinding?.apply { + cerlOrderState.setStyleInfo("工单状态","") + cerlOrderInitiate.setStyleInfo("发起人","") + cerlOrderResort.setStyleInfo("求助人","") + cerlOrderNo.setStyleInfo("工单号","") + cerlOrderResortTime.setStyleInfo("求助时间","") + cerlOrderHelpTime.setStyleInfo("救助时间","") + + + cerlDispatchOrderOperatorName.setStyleInfo("操作人员","") + cerlDispatchOrderTime.setStyleInfo("派单时间","") + cerlDispatchOrderCurrentState.setStyleInfo("当前状态","") + cerlDispatchOrderDispatchBusiness.setStyleInfo("派单业务","") + cerlDispatchOrderDispatchHospital.setStyleInfo("派单医院","") + cerlDispatchResidentName.setStyleInfo("驻场人员","") + cerlDispatchOrderSeizedTime.setStyleInfo("接单时间","") + + var manager=LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false) + rvDispatchHistory.layoutManager=manager + mEmergencySeekDoctorDetailsAdapter= EmergencySeekDoctorDetailsAdapter(mContext, + R.layout.item_emergency_seekdoctor_details,mMessageList) + rvDispatchHistory.adapter=mEmergencySeekDoctorDetailsAdapter + } + + } + + override fun initData() { + id= intent.getStringExtra("id").toString() +// sessionId= intent.getStringExtra("sessionId").toString() + sessionId= id + if (sessionId.isNotEmpty()) { + mViewModel.getOrderBySessionId(sessionId) + } + } + + override fun createObserve() { + super.createObserve() + mBinding?.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mSummarizeBean.collectLatest {bean -> + if (!bean.orderThrough.isNullOrEmpty()) { + tvPass.text="${bean.orderThrough}".toHtml() + } + if (!bean.orderResult.isNullOrEmpty()){ + tvSummarize.text="${bean.orderResult}".toHtml() + } + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mOrderInfoBean.collectLatest {bean -> + if(bean?.orderStatus_dictText != null){ + if (bean.orderStatus=="5") { + ivOrderSuccess.visibility=View.VISIBLE + } + cerlOrderState.setStyleInfo("工单状态",bean.orderStatus_dictText) + cerlOrderInitiate.setStyleInfo("发起人",bean.initiatorUserName) + cerlOrderResort.setStyleInfo("求助人",bean.salvageUserName) + cerlOrderNo.setStyleInfo("工单号",bean.id) + cerlOrderResortTime.setStyleInfo("求助时间",bean.createTime) + cerlOrderHelpTime.setStyleInfo("救助时间",bean.majorResponseTime) + + cerlDispatchOrderOperatorName.setStyleInfo("操作人员",bean.operationUserName) + cerlDispatchOrderTime.setStyleInfo("派单时间",bean.operationSendOrderTime) + cerlDispatchOrderCurrentState.setStyleInfo("当前状态",bean.isDispatch_dictText) + cerlDispatchOrderDispatchBusiness.setStyleInfo("派单业务",bean.stationBusiness_dictText) + cerlDispatchOrderDispatchHospital.setStyleInfo("派单医院",bean.sendOrderHospital) + cerlDispatchResidentName.setStyleInfo("驻场人员",bean.stationUserName) + cerlDispatchOrderSeizedTime.setStyleInfo("接单时间",bean.stationResponseTime) + + mMessageList.clear() + bean.orderSendRecordList?.let { list-> + if(list.size>1){ + for (index in 1 until list.size){ + mMessageList.add(list[index]) + } + refershData(bean.operationUserName,list[0]) + tvDispatchHistory.visibility=View.VISIBLE + llOrderRootView.visibility=View.VISIBLE + }else if(list.size==1){ + refershData(bean.operationUserName,list[0]) + tvDispatchHistory.visibility=View.GONE + llOrderRootView.visibility=View.VISIBLE + }else{ + tvDispatchHistory.visibility=View.GONE + llOrderRootView.visibility=View.GONE + } + + } +// mMessageList.addAll(bean.orderSendRecordList) +// if(mMessageList.size>0){ +// tvDispatchHistory.visibility=View.VISIBLE +// }else{ +// tvDispatchHistory.visibility=View.GONE +// } + mEmergencySeekDoctorDetailsAdapter?.notifyDataSetChanged() + } + } + } + } + } + + } + + fun refershData(name:String,bean: GetOrderBySessionIdBean.OrderSendRecordListDTO){ + mBinding?.apply { + cerlDispatchOrderOperatorName.setStyleInfo("操作人员",name) + cerlDispatchOrderTime.setStyleInfo("派单时间",bean.createTime) + cerlDispatchOrderCurrentState.setStyleInfo("当前状态",bean.accept_dictText) + cerlDispatchOrderDispatchBusiness.setStyleInfo("派单业务",bean.stationBusiness_dictText) + cerlDispatchOrderDispatchHospital.setStyleInfo("派单医院",bean.sendOrderHospital) + cerlDispatchResidentName.setStyleInfo("驻场人员",bean.stationUserName) + cerlDispatchOrderSeizedTime.setStyleInfo("接单时间",bean.transferOrderTime) + } + } + + + override fun bindEvent() { + mBinding?.apply { + addClickViews(rlBigDiseaseInProgress,rlBigDiseaseHistory) + } + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + R.id.rl_big_disease_in_progress -> { + switchMenu(0) + } + R.id.rl_big_disease_history -> { + switchMenu(1) + } + R.id.big_disease_add -> { + mContext?.let { startAddBigDiseaseActivity(it) } + } + else -> {} + } + } + + /** + * type 0 工单信息 1小结 + */ + fun switchMenu(type:Int){ + when (type) { + 0 -> { + mBinding?.apply { + mContext?.let{ + bigDiseaseInProgress.setTextColor(it.resources.getColor(R.color.text_black_33)) + bigDiseaseInProgress.setTypeface(null,Typeface.BOLD) + bigDiseaseHistory.setTextColor(it.resources.getColor(R.color.text_black_66)) + bigDiseaseHistory.setTypeface(null,Typeface.NORMAL) + bigDiseaseInProgressLine.visibility=View.VISIBLE + bigDiseaseHistoryLine.visibility=View.INVISIBLE + nscSummarizeRoot.visibility=View.GONE + nscOrderInfoRoot.visibility=View.VISIBLE + } + } + if (sessionId.isNotEmpty()) { + mViewModel.getOrderBySessionId(sessionId) + } + } + 1 -> { + mBinding?.apply { + mContext?.let{ + bigDiseaseInProgress.setTextColor(it.resources.getColor(R.color.text_black_66)) + bigDiseaseInProgress.setTypeface(null,Typeface.NORMAL) + bigDiseaseHistory.setTextColor(it.resources.getColor(R.color.text_black_33)) + bigDiseaseHistory.setTypeface(null,Typeface.BOLD) + bigDiseaseInProgressLine.visibility=View.INVISIBLE + bigDiseaseHistoryLine.visibility=View.VISIBLE + nscSummarizeRoot.visibility=View.VISIBLE + nscOrderInfoRoot.visibility=View.GONE + } + } + mViewModel.orderThrough(id) + } + else -> {} + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/adapter/EmergencySeekDoctorAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/adapter/EmergencySeekDoctorAdapter.kt new file mode 100644 index 0000000..45e717d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/adapter/EmergencySeekDoctorAdapter.kt @@ -0,0 +1,36 @@ +package com.xjjk.healthyclients.ui.activity.emergency.adapter + +import android.content.Context +import android.widget.TextView +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.xjjk.healthyclients.R +import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean + + +class EmergencySeekDoctorAdapter(var mContext: Context) : BaseQuickAdapter(R.layout.item_emergency_seek_doctor), + LoadMoreModule { + override fun convert(holder: BaseViewHolder, bean: initUserOrderPageBean.RecordsDTO) { + holder?.getView(R.id.item_emergency_seek_doctor_name)?.let{ + it.text="求助人:${bean?.initiatorUserName}" + } + holder?.getView(R.id.item_emergency_seek_doctor_time)?.let{ + it.text="求救时间:${bean?.createTime}" + } + holder?.getView(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(R.id.item_emergency_seek_doctor_state)?.let{ + it.text="${bean?.orderStatus_dictText}" + } + + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/adapter/EmergencySeekDoctorDetailsAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/adapter/EmergencySeekDoctorDetailsAdapter.kt new file mode 100644 index 0000000..ef60c49 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/emergency/adapter/EmergencySeekDoctorDetailsAdapter.kt @@ -0,0 +1,36 @@ +package com.xjjk.healthyclients.ui.activity.emergency.adapter + +import android.content.Context +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.CommonAdapter +import com.xjjk.healthyclients.adapter.common.ViewHolder +import com.xjjk.healthyclients.bean.emergency.GetOrderBySessionIdBean +import com.xjjk.healthyclients.view.CustomEmergencyRelativeLayout + +class EmergencySeekDoctorDetailsAdapter( + var mContext: Context?, + var layoutId: Int, + var datas: ArrayList? +) : CommonAdapter(mContext, layoutId, datas) { + override fun convert(holder: ViewHolder?, bean: GetOrderBySessionIdBean.OrderSendRecordListDTO?, position: Int) { + holder?.getView(R.id.cerl_dispatch_time)?.let{ + it.setStyleInfo("派单时间","${bean?.createTime}") + } + holder?.getView(R.id.cerl_dispatch_state)?.let{ + it.setStyleInfo("当前状态","${bean?.accept_dictText}") + } + holder?.getView(R.id.cerl_dispatch_business)?.let{ + it.setStyleInfo("派单业务","${bean?.stationBusiness_dictText}") + } + holder?.getView(R.id.cerl_dispatch_hospital)?.let{ + it.setStyleInfo("派单医院","${bean?.sendOrderHospital}") + } + holder?.getView(R.id.cerl_dispatch_resident_name)?.let{ + it.setStyleInfo("驻场人员","${bean?.stationUserName}") + } + holder?.getView(R.id.cerl_dispatch_transfer_order)?.let{ + it.setStyleInfo("转单时间","${bean?.transferOrderTime}") + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/AppointmentDetailActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/AppointmentDetailActivity.kt new file mode 100644 index 0000000..67032e9 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/AppointmentDetailActivity.kt @@ -0,0 +1,143 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import com.sw.healthyclients.utils.CustomActivityManager +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.guidance.AppointmentInformationBean +import com.xjjk.healthyclients.databinding.ActivityAppointmentDetailBinding +import com.xjjk.healthyclients.superfuntion.startConsultArchivesDetailActivity +import com.xjjk.healthyclients.ui.viewmodel.AppointmentInformationViewModel +import com.xjjk.healthyclients.view.AppointmentInformationView +import com.xjjk.healthyclients.view.AppraiseDialog +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 咨询(预约单)详情 + */ +class AppointmentDetailActivity : + BaseVMBActivity(R.layout.activity_appointment_detail) { + var appointmentId: String? = null + var isGuidance=false + private val appraiseDialog: AppraiseDialog by lazy { + AppraiseDialog(this@AppointmentDetailActivity) + .setOnSubmitClickListener(object : AppraiseDialog.OnSubmitClickListener{ + override fun onSubmitClick(viewDialog: AppraiseDialog) { + mViewModel.submitAppraise(viewDialog.getRating(), viewDialog.getAppraiseContext(), viewDialog.getAnonymityStatus()) + } + }) + } + override fun initView(savedInstanceState: Bundle?) { + appointmentId = intent.extras?.getString("appointmentId") + isGuidance = intent.extras?.getBoolean("isGuidance",false) == true + lifecycleScope.launch { + appointmentId?.let { mViewModel.appointmentId.emit(it) } + } + } + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.appointmentInformationBean.collectLatest { bean -> + mBinding.llAppointmentInformation.setData(bean) + initOperateButton(bean) + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.physicalExaminationReportBean.collect { + mBinding.llAppointmentInformation.setPhysicalExaminationReport(it) + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.followStatus.collectLatest { + mBinding.llAppointmentInformation.getFollowView().isSelected = it + } + } + } + } + private fun initOperateButton(appointmentInfoBean: AppointmentInformationBean){ + var statusStr: String = appointmentInfoBean.conSession?.contentStatus ?: "" + when(statusStr){ + AppointmentInformationView.AppointmentStatus.WAIT_CONFIRM.status.toString(), + AppointmentInformationView.AppointmentStatus.WAIT_START.status.toString() -> { + mBinding.btnCancel.visibility = View.VISIBLE + mBinding.btnAppraise.visibility = View.GONE + } + AppointmentInformationView.AppointmentStatus.WAIT_APPRAISE.status.toString() -> { + mBinding.btnCancel.visibility = View.GONE + mBinding.btnAppraise.visibility = View.VISIBLE + } + else -> { + mBinding.btnCancel.visibility = View.GONE + mBinding.btnAppraise.visibility = View.GONE + } + } + } + override fun initData() { + mViewModel.getAppointmentInformation() + } + + override fun bindEvent() { + addClickViews( + mBinding.btnCancel, + mBinding.btnAppraise, + mBinding.llAppointmentInformation.getFollowView(), + mBinding.llAppointmentInformation.mBinding.tvArchivesDetail + ) + mBinding.llAppointmentInformation.mBinding.stvPhysicalExaminationReportInfo.setRightTvClickListener { +// mViewModel.physicalExaminationReportBean.value?.let { +//// var year = DateUtil.dateToStrYear(DateUtil.strToDateShort(it.tjrq)) +//// startCheckUpDetailActivityActivity(this@AppointmentDetailActivity, mViewModel.cardNo, year) +// mContext?.startCheckRecordDetailInfoActivity(it.card,it.year,it.id,false) +// +// } + + } + } + + override fun onBackEvent() { + super.onBackEvent() + if (!isGuidance) { + if (CustomActivityManager.getInstance().isActivityExist(DoctorsGuidanceActivity::class.java)) { + CustomActivityManager.getInstance().finishActivityTohome(DoctorsGuidanceActivity::class.java) + }else if (CustomActivityManager.getInstance().isActivityExist(DoctorHomepageActivity::class.java)) { + CustomActivityManager.getInstance().finishActivityTohome(DoctorHomepageActivity::class.java) + }else if (CustomActivityManager.getInstance().isActivityExist(FilterSearchDoctorActivity::class.java)){ + CustomActivityManager.getInstance().finishActivityTohome(FilterSearchDoctorActivity::class.java) + }else if (CustomActivityManager.getInstance().isActivityExist(SeekDoctorSearchActivity::class.java)){ + CustomActivityManager.getInstance().finishActivityTohome(SeekDoctorSearchActivity::class.java) + } + } + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + R.id.btn_cancel -> { + mViewModel.cancelAppointment() + } + R.id.btn_appraise -> { + appraiseDialog.show() + } + R.id.btn_follow -> { + mViewModel.followDoctor() + } + R.id.tv_archives_detail -> { + mViewModel.appointmentInformationBean.value.conMedicalRecordsListDO?.id?.let { + startConsultArchivesDetailActivity(this, + it + ) + } + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/ArchivesDetailActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/ArchivesDetailActivity.kt new file mode 100644 index 0000000..e6f2146 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/ArchivesDetailActivity.kt @@ -0,0 +1,443 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.view.View +import androidx.core.view.ViewCompat +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.GridLayoutManager +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.listener.OnItemChildClickListener +import com.chad.library.adapter.base.listener.OnItemClickListener +import com.luck.picture.lib.basic.PictureSelectionModel +import com.luck.picture.lib.basic.PictureSelector +import com.luck.picture.lib.config.SelectMimeType +import com.luck.picture.lib.config.SelectModeConfig +import com.luck.picture.lib.entity.LocalMedia +import com.luck.picture.lib.interfaces.OnResultCallbackListener +import com.luck.picture.lib.utils.SandboxTransformUtils +import com.sw.healthyclients.utils.pictureSelector.GlideEngine +import com.sw.healthyclients.utils.pictureSelector.ImageFileCompressEngine +import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.ImageBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.databinding.ActivityArchivesDetailBinding +import com.xjjk.healthyclients.event.EditArchivesEvent +import com.xjjk.healthyclients.superfuntion.startAppointmentWaitAffirmActivity +import com.xjjk.healthyclients.superfuntion.startFullScreenImageActivity +import com.xjjk.healthyclients.superfuntion.startGroupChat +import com.xjjk.healthyclients.superfuntion.toJson +import com.xjjk.healthyclients.ui.activity.guidance.adapter.ImageAdapter +import com.xjjk.healthyclients.ui.viewmodel.ArchivesDetailViewModel +import com.xjjk.healthyclients.utils.CommonUtils +import com.xjjk.healthyclients.utils.ConstantUtils +import com.xjjk.healthyclients.utils.IMInputActionSettingUtils +import com.xjjk.healthyclients.utils.TUIUtils +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch +import org.greenrobot.eventbus.EventBus + +/** + * @author nanfeifei + * @time 2023/6/7 18:14 + * @description 档案详情 + */ +class ArchivesDetailActivity : + BaseVMBActivity( + R.layout.activity_archives_detail + ), OnItemClickListener, OnItemChildClickListener { + companion object { + const val maxImageNum = 9 + } + + private val imageAdapter by lazy { ImageAdapter(maxImageNum) } + lateinit var pageStatus: PageStatus + private var consultType: ConstantUtils.ConsultType? = null + var doctorId: String? = null + var appointmentTimeId: String? = null + var archivesId: String? = null + var consultantBean: ConsultantBean? = null + override fun transparentStatusBar(): Boolean { + return true + } + + override fun initView(savedInstanceState: Bundle?) { + consultType = intent.extras?.getParcelable("consultType") + doctorId = intent.extras?.getString("doctorId") + appointmentTimeId = intent.extras?.getString("appointmentTimeId") + archivesId = intent.extras?.getString("archivesId") + consultantBean = intent.extras?.getParcelable("consultantBean") + setConsultantInfo(consultantBean) + mBinding.apply { + val gridLayoutManager = GridLayoutManager(this@ArchivesDetailActivity, 5) + layInspectionReport.rvList.layoutManager = gridLayoutManager + imageAdapter.setOnItemClickListener(this@ArchivesDetailActivity) + imageAdapter.setOnItemChildClickListener(this@ArchivesDetailActivity) + mBinding.layInspectionReport.rvList.adapter = imageAdapter + 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)) + } + } + + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.archivesBean.collectLatest { + mBinding.tvSubmitTime.text = + getString(R.string.archives_detail_create_time, it.updateTime) + mBinding.layArchivesName.context = it.recordsName + mBinding.layQuestionForConsult.context = it.medicalDescribe + mBinding.layQuestionForHelp.context = it.desire + mBinding.etLookOffice.setText(it.lookOffice) + mBinding.etLookMedicalName.setText(it.lookMedicalName) + mBinding.viewQuestionDiseaseDuration.setDefaultValue(it.haveTime) + mBinding.viewQuestionHaveDoctor.setDefaultValue(it.tfLook) + mBinding.viewQuestionPhysicalExaminationReport.setDefaultValue(it.tfPermission) + it.tfLook?.let { tfLook -> isShowSeeDoctorExplainLay(tfLook) } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.diseaseDurationList.collectLatest { + if (it.isNullOrEmpty()) { + return@collectLatest + } + mBinding.viewQuestionDiseaseDuration.setData(it) + mBinding.viewQuestionDiseaseDuration.disableRadioGroup(mViewModel.noEdit.value) + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.haveDoctorList.collectLatest { + if (it.isNullOrEmpty()) { + return@collectLatest + } + mBinding.viewQuestionHaveDoctor.setData(it) + mBinding.viewQuestionHaveDoctor.disableRadioGroup(mViewModel.noEdit.value) + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.physicalExaminationReportList.collectLatest { + if (it.isNullOrEmpty()) { + return@collectLatest + } + mBinding.viewQuestionPhysicalExaminationReport.setData(it) + mBinding.viewQuestionPhysicalExaminationReport.disableRadioGroup(mViewModel.noEdit.value) + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.imageList.collectLatest { list -> + setImageNum(list.size) + imageAdapter.setList(list) + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.noEdit.collectLatest { noEdit -> + mBinding.apply { + layArchivesName.noEdit = noEdit + layQuestionForConsult.noEdit = noEdit + layQuestionForHelp.noEdit = noEdit + etLookMedicalName.isFocusable = !noEdit + etLookMedicalName.isFocusableInTouchMode = !noEdit + etLookOffice.isFocusable = !noEdit + etLookOffice.isFocusableInTouchMode = !noEdit + viewQuestionHaveDoctor.disableRadioGroup(noEdit) + viewQuestionPhysicalExaminationReport.disableRadioGroup(noEdit) + viewQuestionDiseaseDuration.disableRadioGroup(noEdit) + imageAdapter.isEditModel(!noEdit) + } + } + } + } + } + + override fun initData() { + if (archivesId == null) { + setPageModel(PageStatus.ADD) + } else { + archivesId?.let { mViewModel.getArchivesDetail(it) } + setPageModel(PageStatus.SEE) + } + } + + override fun bindEvent() { + mBinding?.apply { + addClickViews(btnLeft, btnRight) + viewQuestionHaveDoctor.getRadioGroup().setOnCheckedChangeListener { group, checkedId -> + isShowSeeDoctorExplainLay(checkedId.toString()) + } + } + } + + fun setImageNum(size: Int) { + mBinding.layInspectionReport.tvImageNum.text = getString( + R.string.archives_detail_question_image_list_num, + size, + maxImageNum + ) + } + + private fun isShowSeeDoctorExplainLay(value: String) { + when (value) { + "1" -> { + mBinding.llSeeDoctorExplain.visibility = View.VISIBLE + } + + "0" -> { + mBinding.llSeeDoctorExplain.visibility = View.GONE + } + } + } + + override fun processClick(paramView: View?) { + mViewModel.archivesBean.value.tfLook = mBinding.viewQuestionHaveDoctor.getCheckDataValue() + mViewModel.archivesBean.value.tfPermission ="2" + mViewModel.archivesBean.value.haveTime = + mBinding.viewQuestionDiseaseDuration.getCheckDataValue() + when (paramView?.id) { + R.id.btn_left -> { + when (pageStatus) { + PageStatus.ADD -> { + mViewModel.addArchives(imageAdapter.getImageList(), successCall = { + EventBus.getDefault().post(EditArchivesEvent()) + finish() + }) + } + + PageStatus.EDIT -> { + mViewModel.addArchives(imageAdapter.getImageList(), successCall = { + EventBus.getDefault().post(EditArchivesEvent()) + submitConsultApply() + }) + } + + PageStatus.SEE -> { + setPageModel(PageStatus.EDIT) + } + + PageStatus.NO_EDIT -> { + + } + } + } + + R.id.btn_right -> { + submitConsultApply() + } + } + } + + private fun submitConsultApply() { + if (doctorId.isNullOrEmpty()) { + return + } + if (consultType == null) { + return + } + when (consultType!!) { + ConstantUtils.ConsultType.IMAGE_TEXT_CONSULT -> { + mViewModel.submitImageTextConsultantApply(doctorId!!, successCall = { + consultantBean?.id?.let { consultantId -> + IMInputActionSettingUtils.createImageTextConsultSetting(consultantBean!!.isSelf()) + startGroupChat( + groupId = it.groupId, + groupName = getString(R.string.title_image_text_consult), + autoSendMessage = if ("1" == it.tfNew) mViewModel.archivesBean.value.toIMArchivesMessageBean(consultantBean).toJson() else null, + consultantId = consultantId, + workBean = WorkBean(it.id, TUIUtils.WORK_TYPE_IMAGE_TEXT_CONSULT) + ) + } + }) + } + + ConstantUtils.ConsultType.AUDIO_VIDEO_CONSULT -> { + if (appointmentTimeId.isNullOrEmpty()) { + return + } + mViewModel.submitAudioVideoAppointment( + doctorId!!, + appointmentTimeId!!, + successCall = { + startAppointmentWaitAffirmActivity(this, it) + finish() + }) + } + } + } + + override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + val imageBean: ImageBean = adapter.getItem(position) as ImageBean + imageBean?.let { it -> + if (it.isAddButton) { + initPictureSelectorModel() + .forResult(object : OnResultCallbackListener { + override fun onResult(result: ArrayList?) { + result?.let { list -> + var resultList = localMediaToImageList(list) + imageAdapter.addData(resultList) + setImageNum(imageAdapter.getImageSize()) + } + } + + override fun onCancel() {} + }) + }else { + mContext?.let { it1 -> startFullScreenImageActivity(it1,it.isFilePath,it.imageUrl) } + if (it.isFilePath) { + + }else{ + + } + } + } + } + + override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + adapter.removeAt(position) + } + + private fun setConsultantInfo(consultantBean: ConsultantBean?) { + if (consultantBean == null) { + return + } + lifecycleScope.launch { + mViewModel.memberId.emit(consultantBean.id) + } + mBinding.stvConsultPeopleInfo.apply { + setLeftTopString( + getString( + R.string.consult_information_consult_people_name, + consultantBean.name + ) + ) + setCenterTopString( + getString( + R.string.consult_information_consult_people_gender, + CommonUtils.getGenderText(consultantBean.gender) + ) + ) + setRightTopString( + getString( + R.string.consult_information_consult_people_age, + consultantBean.age + ) + ) + setLeftBottomString( + getString( + R.string.consult_information_consult_people_height, + if (consultantBean.height.isNullOrEmpty()) getString(R.string.string_empty) else consultantBean.height + ) + ) + setCenterBottomString( + getString( + R.string.consult_information_consult_people_weight, + if (consultantBean.weight.isNullOrEmpty()) getString(R.string.string_empty) else consultantBean.weight + ) + ) + } + } + + enum class PageStatus(val status: Int) { + ADD(1), + EDIT(2), + SEE(3), + NO_EDIT(4) + } + + private fun setPageModel(status: PageStatus) { + this.pageStatus = status + mBinding?.apply { + when (status) { + PageStatus.ADD -> { + btnLeft.setText(R.string.archives_detail_submit) + btnRight.visibility = View.GONE + mBinding.tvConsultPeopleTitle.setBackgroundResource(R.drawable.rectangle_round_top_corner8_white) + mBinding.tvSubmitTime.visibility = View.GONE + lifecycleScope.launch { + mViewModel.noEdit.emit(false) + } + } + + PageStatus.EDIT -> { + btnLeft.setText(R.string.archives_detail_save) + btnRight.visibility = View.GONE + lifecycleScope.launch { + mViewModel.noEdit.emit(false) + } + } + + PageStatus.SEE -> { + btnLeft.setText(R.string.archives_detail_edit) + btnLeft.visibility = View.VISIBLE + btnRight.visibility = View.VISIBLE + lifecycleScope.launch { + mViewModel.noEdit.emit(true) + } + } + + PageStatus.NO_EDIT -> { + btnLeft.visibility = View.GONE + btnRight.visibility = View.GONE + lifecycleScope.launch { + mViewModel.noEdit.emit(true) + } + } + } + } + } + + fun localMediaToImageList(result: ArrayList): MutableList { + var imageList = mutableListOf() + var imageBean: ImageBean + result.forEach { + it?.let { + imageBean = ImageBean(getImagePath(it), true) + imageList.add(imageBean) + } + } + return imageList + } + + private fun getImagePath(localMedia: LocalMedia): String { + if (!localMedia.cutPath.isNullOrEmpty()) { + return localMedia.cutPath + } + if (!localMedia.compressPath.isNullOrEmpty()) { + return localMedia.compressPath + } + if (!localMedia.sandboxPath.isNullOrEmpty()) { + return localMedia.sandboxPath + } + return localMedia.path + } + + private fun initPictureSelectorModel(): PictureSelectionModel { + return PictureSelector.create(this) + .openGallery(SelectMimeType.TYPE_IMAGE) + .setSelectionMode(SelectModeConfig.MULTIPLE) + .setMaxSelectNum(maxImageNum - imageAdapter.getImageSize()) + .setCompressEngine(ImageFileCompressEngine()) + .setImageEngine(GlideEngine.createGlideEngine()) + .setSandboxFileEngine { context, srcPath, mineType, call -> + if (call != null) { + var sandboxPath = + SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType) + call.onCallback(srcPath, sandboxPath) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/BaseHealthyInfoAddActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/BaseHealthyInfoAddActivity.kt new file mode 100644 index 0000000..a55c8b6 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/BaseHealthyInfoAddActivity.kt @@ -0,0 +1,84 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.view.View +import androidx.databinding.DataBindingUtil +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.LinearLayoutManager +import com.buddy.kredit.android.view.SpaceItemDecoration +import com.sw.healthyclients.utils.AndroidBug5497Workaround +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.databinding.ActivityBaseHealthyInfoAddBinding +import com.xjjk.healthyclients.databinding.ViewFooterBaseHealthyInfoAddBinding +import com.xjjk.healthyclients.ui.activity.guidance.adapter.BaseHealthyInfoAddAdapter +import com.xjjk.healthyclients.ui.viewmodel.BaseHealthyInfoAddViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * @author nanfeifei + * @time 2023/6/21 9:49 + * @description 基本健康信息添加 + */ +class BaseHealthyInfoAddActivity : + BaseVMBActivity( + R.layout.activity_base_healthy_info_add + ) { + val mAdapter by lazy { BaseHealthyInfoAddAdapter() } + var memberId: String? = null + override fun initView(savedInstanceState: Bundle?) { + AndroidBug5497Workaround.assistActivity(this) + memberId = intent.extras?.getString("memberId") + mBinding.apply { + val linearLayoutManager = LinearLayoutManager(this@BaseHealthyInfoAddActivity) + rvList.addItemDecoration(SpaceItemDecoration(this@BaseHealthyInfoAddActivity, 0, 1f)) + rvList.layoutManager = linearLayoutManager + } + } + + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.healthyInfoList.collectLatest { list -> + mAdapter.setList(list) + if (mBinding.rvList.adapter == null) { + mAdapter.addFooterView(getFooterView()) + mBinding.rvList.adapter = mAdapter + } + } + } + } + } + + override fun initData() { + mViewModel.getBaseHealthyInfoSettingList(memberId) + } + private fun getFooterView(): View { + val footerBinding: ViewFooterBaseHealthyInfoAddBinding = + DataBindingUtil.inflate( + layoutInflater, + R.layout.view_footer_base_healthy_info_add, + mBinding.rvList, + false + ) + addClickViews(footerBinding.btnSubmit) + return footerBinding.root + } + override fun bindEvent() { + + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + R.id.btn_submit -> { + mViewModel.submitBaseHealthInfo(mAdapter.data, successCall = { + finish() + }) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/ConsultArchivesDetailActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/ConsultArchivesDetailActivity.kt new file mode 100644 index 0000000..ed01c28 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/ConsultArchivesDetailActivity.kt @@ -0,0 +1,153 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.view.View +import androidx.core.view.ViewCompat +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.GridLayoutManager +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.listener.OnItemClickListener +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.ImageBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.databinding.ActivityConsultArchivesDetailBinding +import com.xjjk.healthyclients.superfuntion.startFullScreenImageActivity +import com.xjjk.healthyclients.ui.activity.guidance.adapter.ImageAdapter +import com.xjjk.healthyclients.ui.viewmodel.ConsultArchivesDetailViewModel +import com.xjjk.healthyclients.utils.CommonUtils +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * @author nanfeifei + * @time 2023/5/4 18:50 + * @description 咨询(预约单)详情中的档案详情 + */ +class ConsultArchivesDetailActivity : + BaseVMBActivity(R.layout.activity_consult_archives_detail), + OnItemClickListener { + companion object { + const val maxImageNum = 9 + } + + private val imageAdapter by lazy { ImageAdapter(maxImageNum) } + private var archivesId: String = "" + override fun transparentStatusBar(): Boolean { + return true + } + + override fun initView(savedInstanceState: Bundle?) { + archivesId = intent.extras?.getString("archivesId") ?: "" + mBinding.apply { + val gridLayoutManager = GridLayoutManager(this@ConsultArchivesDetailActivity, 5) + layInspectionReport.rvList.layoutManager = gridLayoutManager + mBinding.layInspectionReport.rvList.adapter = imageAdapter + ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false) + } + } + + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.consultantBean.collectLatest { + setConsultantInfo(it) + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.imageList.collectLatest { + if(it.isNullOrEmpty()){ + mBinding.layInspectionReport.root.visibility = View.GONE + }else{ + mBinding.layInspectionReport.root.visibility = View.VISIBLE + mBinding.layInspectionReport.tvImageNum.text = getString( + R.string.archives_detail_question_image_list_num, + it.size, + maxImageNum + ) + imageAdapter.setList(it) + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.answer.collectLatest { + mBinding.viewBaseHealthyInfo.visibility = + if (it.isNullOrEmpty()) View.GONE else View.VISIBLE + mBinding.viewBaseHealthyInfo.setData(it) + } + } + } + } + + override fun initData() { + mViewModel.getArchivesDetail(archivesId) + } + + private fun setConsultantInfo(consultInfoBean: ConsultantBean?) { + consultInfoBean?.let { + mBinding.apply { + stvConsultPeopleInfo.setLeftTopString( + getString( + R.string.consult_information_consult_people_name, + consultInfoBean.name + ) + ) + stvConsultPeopleInfo.setCenterTopString( + getString( + R.string.consult_information_consult_people_gender, + CommonUtils.getGenderText(consultInfoBean.gender) + ) + ) + stvConsultPeopleInfo.setRightTopString( + getString( + R.string.consult_information_consult_people_age, + consultInfoBean.age + ) + ) + stvConsultPeopleInfo.setLeftBottomString( + getString( + R.string.consult_information_consult_people_height, + if (consultInfoBean.height.isNullOrEmpty()) getString(R.string.string_empty) else consultInfoBean.height + ) + ) + stvConsultPeopleInfo.setCenterBottomString( + getString( + R.string.consult_information_consult_people_weight, + if (consultInfoBean.weight.isNullOrEmpty()) getString(R.string.string_empty) else consultInfoBean.weight + ) + ) + } + } + } + + override fun bindEvent() { + imageAdapter.setOnItemClickListener(this@ConsultArchivesDetailActivity) + } + + override fun processClick(paramView: View?) { + + } + + override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + val imageBean: ImageBean = adapter.getItem(position) as ImageBean + imageBean?.let { it -> + if (it.isAddButton) { + + }else { + mContext?.let { it1 -> startFullScreenImageActivity(it1,it.isFilePath,it.imageUrl) } + if (it.isFilePath) { + + }else{ + + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/ConsultantManagerActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/ConsultantManagerActivity.kt new file mode 100644 index 0000000..73c90e1 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/ConsultantManagerActivity.kt @@ -0,0 +1,139 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.view.View +import androidx.databinding.DataBindingUtil +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.LinearLayoutManager +import com.buddy.kredit.android.view.SpaceItemDecoration +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.listener.OnItemChildClickListener +import com.chad.library.adapter.base.listener.OnItemClickListener +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.databinding.ActivityConsultantManagerBinding +import com.xjjk.healthyclients.databinding.ViewFooterConsultantManagerBinding +import com.xjjk.healthyclients.event.ConsultantManagerEvent +import com.xjjk.healthyclients.superfuntion.getEmptyView +import com.xjjk.healthyclients.superfuntion.startEditConsultantActivity +import com.xjjk.healthyclients.ui.activity.guidance.adapter.ConsultantManagerAdapter +import com.xjjk.healthyclients.ui.viewmodel.ConsultantManagerViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode + +/** + * 咨询人管理 + */ +class ConsultantManagerActivity : + BaseVMBActivity(R.layout.activity_consultant_manager), + OnItemClickListener, OnItemChildClickListener { + private val mAdapter: ConsultantManagerAdapter by lazy { ConsultantManagerAdapter() } + override fun initView(savedInstanceState: Bundle?) { + mBinding.apply { + val linearLayoutManager = LinearLayoutManager(this@ConsultantManagerActivity) + rvList.addItemDecoration(SpaceItemDecoration(this@ConsultantManagerActivity, 0, 1f)) + rvList.layoutManager = linearLayoutManager + } + } + + + override fun createObserve() { + super.createObserve() + mBinding.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.consultantManagerList.collectLatest { list -> + list?.let { + if(mViewModel.isRefreshing.value){ + mAdapter.setNewInstance(list) + }else{ + mAdapter.addData(list) + } + mAdapter.loadMoreModule.loadMoreComplete() + if (rvList.adapter == null) { + mAdapter.enabledCheckMode = true +// mAdapter.addFooterView(getFooterView()) + mAdapter.setEmptyView(rvList.getEmptyView()) + mAdapter.setOnItemClickListener(this@ConsultantManagerActivity) + mAdapter.setOnItemChildClickListener(this@ConsultantManagerActivity) + rvList.adapter = mAdapter + } + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isLoadMoreEnd.collectLatest { + mAdapter.loadMoreModule.loadMoreEnd(it) + } + } + } + } + + } + + override fun initData() { + var darkStyle=intent.getBooleanExtra("darkStyle",false) + lifecycleScope.launch { + mViewModel.darkStyle.emit(darkStyle) + } + onRefresh() + } + private fun onRefresh() { + mViewModel.getConsultantManagerList(true) + } + override fun bindEvent() { + mBinding?.apply { + addClickViews(layOperate.btnAdd, layOperate.btnDelete) + } + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + R.id.btn_add -> { + startEditConsultantActivity(this) + } + + R.id.btn_delete -> { + mViewModel.deleteConsultant(mAdapter.checkedItems) + } + } + } + + private fun getFooterView(): View { + val headerBinding: ViewFooterConsultantManagerBinding = + DataBindingUtil.inflate( + layoutInflater, + R.layout.view_footer_consultant_manager, + mBinding.rvList, + false + ) + + return headerBinding.root + } + + override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + (adapter as BaseCheckRecycleViewAdapter).clickItem(position, false) + } + override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + var consultantBean: ConsultantBean = adapter.getItem(position) as ConsultantBean + when(view?.id){ + R.id.btn_edit -> { + startEditConsultantActivity(this, consultantBean) + } + } + } + @Subscribe(threadMode = ThreadMode.MAIN) + fun onEvent(event: ConsultantManagerEvent) { + onRefresh() + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/DoctorAllAppraiseActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/DoctorAllAppraiseActivity.kt new file mode 100644 index 0000000..55b2cca --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/DoctorAllAppraiseActivity.kt @@ -0,0 +1,137 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.text.SpannableString +import android.text.Spanned +import android.text.style.AbsoluteSizeSpan +import android.view.View +import androidx.databinding.DataBindingUtil +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import com.buddy.kredit.android.view.SpaceItemDecoration +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.databinding.ActivityDoctorAllAppraiseBinding +import com.xjjk.healthyclients.databinding.ViewHeaderAllAppraiseBinding +import com.xjjk.healthyclients.superfuntion.initColors +import com.xjjk.healthyclients.ui.activity.guidance.adapter.AppraiseAdapter +import com.xjjk.healthyclients.ui.viewmodel.DoctorAllAppraiseViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * @author nanfeifei + * @time 2023/6/12 18:48 + * @description 用户评价-医生 + */ +class DoctorAllAppraiseActivity: BaseVMBActivity( + R.layout.activity_doctor_all_appraise), SwipeRefreshLayout.OnRefreshListener { + var doctorId: String? = null + private val mAdapter: AppraiseAdapter = AppraiseAdapter() + lateinit var headerBinding: ViewHeaderAllAppraiseBinding + override fun initView(savedInstanceState: Bundle?) { + doctorId = intent.extras?.getString("doctorId") + lifecycleScope.launch { + mViewModel.doctorId.emit(doctorId) + } + mBinding.apply { + swipeRefresh.initColors() + swipeRefresh.setOnRefreshListener(this@DoctorAllAppraiseActivity) + val linearLayoutManager = LinearLayoutManager(this@DoctorAllAppraiseActivity) + rvList.layoutManager = linearLayoutManager + rvList.addItemDecoration(SpaceItemDecoration(this@DoctorAllAppraiseActivity, R.drawable.decoration_item_gray, 1f)) + } + } + override fun createObserve() { + super.createObserve() + mBinding.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.appraiseList.collectLatest { list -> + if(mViewModel.isRefreshing.value){ + mAdapter.setNewInstance(list) + }else{ + mAdapter.addData(list) + } + mAdapter.loadMoreModule.loadMoreComplete() + if (rvList.adapter == null) { + mAdapter.addHeaderView(getHeaderView()) + initLoadMore() + rvList.adapter = mAdapter + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isRefreshing.collectLatest { + swipeRefresh.isRefreshing = it + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isLoadMoreEnd.collectLatest { + mAdapter.loadMoreModule.loadMoreEnd(it) + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.doctorBean.collectLatest { + if(it == null || !this@DoctorAllAppraiseActivity::headerBinding.isInitialized){ + return@collectLatest + } + headerBinding.tvAppraiseNum.text = getString(R.string.doctor_homepage_user_appraise_score, it.userScoreNum) + try { + var spannableString = SpannableString(getString( + R.string.doctor_homepage_user_appraise_num, String.format("%.1f", + it.score.toDouble()))) + spannableString.setSpan(AbsoluteSizeSpan(34, true), 0, it.score.length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + headerBinding.tvAppraiseScore.text = spannableString + } catch (e: Exception) { + } + if(!it.score.isNullOrEmpty()){ + headerBinding.ratingBar.rating = it.score.toFloat() + } + } + } + } + } + } + override fun initData() { + onRefresh() + } + private fun initLoadMore() { + mAdapter.loadMoreModule.setOnLoadMoreListener { mViewModel.getAppraiseList(false) } + mAdapter.loadMoreModule.isEnableLoadMore = true + mAdapter.loadMoreModule.isAutoLoadMore = true + //当自动加载开启,同时数据不满一屏时,是否继续执行自动加载更多(默认为true) + mAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = false + } + private fun getHeaderView(): View { + headerBinding = + DataBindingUtil.inflate( + layoutInflater, + R.layout.view_header_all_appraise, + mBinding.rvList, + false + ) + return headerBinding.root + } + override fun bindEvent() { + + } + + override fun processClick(paramView: View?) { + + } + + override fun onRefresh() { + mViewModel.getAppraiseList(true) + mViewModel.getDoctorAppraiseData() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/DoctorHomepageActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/DoctorHomepageActivity.kt new file mode 100644 index 0000000..91957b7 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/DoctorHomepageActivity.kt @@ -0,0 +1,192 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.content.res.ColorStateList +import android.graphics.Color +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 com.buddy.kredit.android.view.SpaceItemDecoration +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.databinding.ActivityDoctorHomepageBinding +import com.xjjk.healthyclients.event.FollowDoctorEvent +import com.xjjk.healthyclients.superfuntion.startDoctorAllAppraiseActivity +import com.xjjk.healthyclients.superfuntion.startGuidanceNoticeActivity +import com.xjjk.healthyclients.superfuntion.startSelectAppointmentTimeActivity +import com.xjjk.healthyclients.superfuntion.startSelectConsultantActivity +import com.xjjk.healthyclients.ui.activity.guidance.adapter.AppraiseAdapter +import com.xjjk.healthyclients.ui.viewmodel.DoctorHomepageViewModel +import com.xjjk.healthyclients.utils.ConstantUtils +import com.xjjk.healthyclients.view.DoctorBaseInfoView +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode + +/** + * @author nanfeifei + * @time 2023/5/5 18:35 + * @description 专家主页 + */ +class DoctorHomepageActivity : + BaseVMBActivity( + R.layout.activity_doctor_homepage + ) { + private val mAdapter: AppraiseAdapter = AppraiseAdapter() + var doctorStatus = "" + var audioStatus = "" + var doctorId: String? = null + var mType=""//1 图文 0音视频 + override fun initView(savedInstanceState: Bundle?) { + doctorId = intent.extras?.getString("doctorId") + mBinding.apply { + val linearLayoutManager = LinearLayoutManager(this@DoctorHomepageActivity) + rvList.layoutManager = linearLayoutManager + rvList.addItemDecoration( + SpaceItemDecoration( + this@DoctorHomepageActivity, + R.drawable.decoration_item_gray, + 1f + ) + ) + } + } + + override fun createObserve() { + super.createObserve() + mBinding.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.doctorBean.collectLatest { doctorBean -> + doctorStatus= doctorBean?.doctorStatus.toString() + audioStatus= doctorBean?.audioStatus.toString() + if(doctorBean?.doctorStatus=="3"){ + btnImageTextConsult.backgroundTintList= ColorStateList.valueOf(Color.parseColor("#C3C3C3")) + btnAudioVideoConsult.backgroundTintList= ColorStateList.valueOf(Color.parseColor("#C3C3C3")) + }else{ + if(doctorBean?.audioStatus=="1"){ + btnAudioVideoConsult.backgroundTintList= ColorStateList.valueOf(Color.parseColor("#21BEBD")) + }else{ + btnAudioVideoConsult.backgroundTintList= ColorStateList.valueOf(Color.parseColor("#C3C3C3")) + } + } + + viewDoctorBaseInfo.setData( + doctorBean, + DoctorBaseInfoView.PageStatus.APPOINTMENT_CONSULT + ) + doctorBean?.let { + tvIntroContent.text = it.experience + tvAdeptContent.text = it.goodAt + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.appraiseList.collectLatest { list -> + if (list.isNullOrEmpty()) { + rlAppraiseLay.visibility = View.GONE + } else { + rlAppraiseLay.visibility = View.VISIBLE + } + mAdapter.setNewInstance(list) + if (rvList.adapter == null) { + rvList.adapter = mAdapter + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.followStatus.collectLatest { + mBinding.viewDoctorBaseInfo.getFollowView().isSelected = it + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.noticeBean.collectLatest {bean -> + if (bean!=null) { + if (bean.isRead==1) { + if (mType=="1") { + startSelectConsultantActivity( + this@DoctorHomepageActivity, + ConstantUtils.ConsultType.IMAGE_TEXT_CONSULT, + doctorId + ) + }else if (mType=="0"){ + startSelectAppointmentTimeActivity(this@DoctorHomepageActivity, doctorId) + } + }else if (bean.isRead==2){ + if (mType=="1") { + doctorId?.let { startGuidanceNoticeActivity(this@DoctorHomepageActivity, it,"1") } + }else if (mType=="0"){ + doctorId?.let { startGuidanceNoticeActivity(this@DoctorHomepageActivity, it,"0") } + } + } + + } + } + } + } + } + } + + override fun initData() { + mViewModel.getDoctorInfo(doctorId) + mViewModel.getAppraiseList(doctorId) + } + + override fun bindEvent() { + addClickViews( + mBinding.btnImageTextConsult, + mBinding.btnAudioVideoConsult, + mBinding.viewDoctorBaseInfo.getFollowView(), + mBinding.tvMoreAppraise + ) + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + R.id.btn_image_text_consult -> { + if (doctorStatus!="3") { + mType="1" + mViewModel.selectUserNotice("1") + } + + } + + R.id.btn_audio_video_consult -> { + if (doctorStatus!="3") { + if (audioStatus=="1"){ + mType="0" + mViewModel.selectUserNotice("2") + } + } + } + + R.id.btn_follow -> { + mViewModel.followDoctor(doctorId) + } + + R.id.tv_more_appraise -> { + startDoctorAllAppraiseActivity(this, doctorId) + } + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + open fun onMessageEvent(event: FollowDoctorEvent) { + if (event == null) { + return + } + lifecycleScope.launch { + mViewModel.followStatus.emit(event.followStatus) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/DoctorsGuidanceActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/DoctorsGuidanceActivity.kt new file mode 100644 index 0000000..7a3fefa --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/DoctorsGuidanceActivity.kt @@ -0,0 +1,122 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.app.ProgressDialog +import android.os.Bundle +import android.view.View +import android.view.Window +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.sw.healthyclients.view.LoadingDialog +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.guidance.DoctorChildBean +import com.xjjk.healthyclients.bean.guidance.selectDictListByNHDSRequestBean +import com.xjjk.healthyclients.databinding.ActivityDoctorsGuidanceBinding +import com.xjjk.healthyclients.superfuntion.startDoctorHomepageActivity +import com.xjjk.healthyclients.ui.activity.guidance.adapter.SeekDoctorDoctorAdapter +import com.xjjk.healthyclients.ui.viewmodel.DoctorsGuidanceViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 专家库咨询 + */ +class DoctorsGuidanceActivity : + BaseVMBActivity(R.layout.activity_doctors_guidance){ + private var mDoctorList=arrayListOf() //医生列表 + private var mSeekDoctorDoctorAdapter: SeekDoctorDoctorAdapter?=null + + //科室数据 + + var mOfficeIds = arrayListOf() + var mSicksIds = arrayListOf() + var mDialog:LoadingDialog?=null + var mBean= selectDictListByNHDSRequestBean() + override fun initView(savedInstanceState: Bundle?) { + mBinding?.apply { + mSeekDoctorDoctorAdapter= SeekDoctorDoctorAdapter(mContext!!, + R.layout.item_recycle_seek_doctor_doctor_child,mDoctorList) + val doctorLayoutManager = LinearLayoutManager(this@DoctorsGuidanceActivity) + mFilterContentView.layoutManager = doctorLayoutManager + mFilterContentView.adapter = mSeekDoctorDoctorAdapter + } + + + } + + override fun transparentStatusBar(): Boolean { + return false + } + + override fun initData() { + var intents=intent + var office=intents.getStringArrayListExtra("officeIds") + if (office!=null) { + mOfficeIds.addAll(office) + } + var sick= intents.getStringArrayListExtra("sicksIds") + if (sick!=null) { + mSicksIds.addAll(sick) + } + mViewModel.selectDictListBySickAndDepartment(mOfficeIds,mSicksIds) + + } + + override fun createObserve() { + super.createObserve() + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDoctorSoure.collectLatest {list -> + mDoctorList.clear() + mDoctorList.addAll(list) + if(mDoctorList.size>0){ + mBinding?.includeEmpty?.visibility=View.GONE + } + mSeekDoctorDoctorAdapter?.notifyDataSetChanged() + } + } + } + + } + + override fun bindEvent() { + + mSeekDoctorDoctorAdapter?.setOnItemClickListener(object : + MultiItemTypeAdapter.OnItemClickListener { + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + mContext?.let { startDoctorHomepageActivity(it,mDoctorList[position].id) } + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + } + } + + + fun createDialog2() { + mDialog = LoadingDialog( + mContext, + ProgressDialog.STYLE_SPINNER, "数据加载中" + ) + mDialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE) + mDialog!!.setCanceledOnTouchOutside(false) + mDialog!!.setCancelable(false) + mDialog!!.setMessage("请稍后...") + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/EditConsultantActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/EditConsultantActivity.kt new file mode 100644 index 0000000..16b8483 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/EditConsultantActivity.kt @@ -0,0 +1,221 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import com.afollestad.date.dayOfMonth +import com.afollestad.date.month +import com.afollestad.date.year +import com.github.gzuliyujiang.wheelpicker.DatePicker +import com.github.gzuliyujiang.wheelpicker.OptionPicker +import com.github.gzuliyujiang.wheelpicker.annotation.DateMode +import com.github.gzuliyujiang.wheelpicker.entity.DateEntity +import com.sw.healthyclients.utils.DateUtil +import com.sw.healthyclients.utils.DecimalDigitsInputFilter +import com.sw.healthyclients.utils.KeyboardUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.CommonSettingMenuBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.databinding.ActivityEditConsultantBinding +import com.xjjk.healthyclients.event.EditConsultantEvent +import com.xjjk.healthyclients.superfuntion.startBaseHealthyInfoAddActivity +import com.xjjk.healthyclients.ui.viewmodel.EditConsultantViewModel +import com.xjjk.healthyclients.view.TextViewDialog +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode +import java.util.GregorianCalendar + + +/** + * 添加/编辑咨询人 + */ +class EditConsultantActivity : + BaseVMBActivity( + R.layout.activity_edit_consultant + ) { + val dataPicker: DatePicker by lazy { DatePicker(this) } + val relationPicker: OptionPicker by lazy { OptionPicker(this) } + val perfectInfoDialog: TextViewDialog by lazy { TextViewDialog(this) } + lateinit var currentDate: DateEntity + var consultantBean: ConsultantBean? = null + companion object{ + const val DEFAULT_YEAR_ON_FUTURE = -20 //默认选中日期为20年前 + } + override fun initView(savedInstanceState: Bundle?) { + consultantBean = intent.extras?.getParcelable("consultantBean") ?: null + if (consultantBean==null) { + mBinding?.clInlet?.visibility=View.GONE + } + consultantBean?.let { + lifecycleScope.launch { + mViewModel.consultantBean.emit(it) + } + initConsultantInfo(it) + } + mBinding.etHeight.filters = DecimalDigitsInputFilter(3, 1).toFilters() + mBinding.etWeight.filters = DecimalDigitsInputFilter(3, 1).toFilters() + } + + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.relationList.collectLatest { + if (it.isNullOrEmpty()){ + return@collectLatest + } + relationPicker.setData(it) + if (consultantBean == null){ + setRelationText(it[0]) + }else{ + it.forEach { commonSettingMenuBean -> + if (consultantBean!!.familyRelation == commonSettingMenuBean.text + ||consultantBean!!.familyRelation == commonSettingMenuBean.value){ + setRelationText(commonSettingMenuBean) + } + } + } + } + } + } + + } + + override fun initData() { + if (consultantBean == null){ + var defaultDate = DateEntity.yearOnFuture(DEFAULT_YEAR_ON_FUTURE) + currentDate = DateEntity.target(defaultDate.year, defaultDate.month+1, defaultDate.day) + }else{ + var date = GregorianCalendar() + date.timeInMillis = consultantBean!!.birthdayLong + setBirthDay(date.year, date.month, date.dayOfMonth) + } + + } + + private fun initConsultantInfo(consultantBean: ConsultantBean) { + mBinding.apply { + consultantBean?.let { + if ("1" == it.gender) { + rbWoman.isChecked = true + }else{ + rbMan.isChecked = true + } + tvBirthday.text = consultantBean.birthdayLong?.let { birthdayLong -> DateUtil.getShortDateStr(birthdayLong) } + } + } + } + + override fun bindEvent() { + mBinding.rgGender.setOnCheckedChangeListener { group, checkedId -> + when(checkedId){ + R.id.rb_man -> { + mViewModel.consultantBean.value.gender = "2" + } + R.id.rb_woman -> { + mViewModel.consultantBean.value.gender = "1" + } + } + } + mBinding.apply { + addClickViews(tvBirthday, tvRelation, btnSave,tvHealthInfoValue,tvHealthRecordValue) + } + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + R.id.tv_birthday -> { + showDatePicker() + } + + R.id.tv_relation -> { + showRelationPicker() + } + + R.id.btn_save -> { + mViewModel.editConsultant(successCall = { isShowDialog, id -> + if(isShowDialog){ + showPerfectInfoDialog(id) + }else{ + finish() + } + }) + } + R.id.tv_health_info_value -> { + KeyboardUtil.hideSoftInput(this@EditConsultantActivity) + startBaseHealthyInfoAddActivity(this@EditConsultantActivity, consultantBean?.id) + } + R.id.tv_health_record_value -> { + KeyboardUtil.hideSoftInput(this@EditConsultantActivity) + showToast("档案") + } + } + } + + private fun showDatePicker() { + dataPicker.setBackgroundResource(R.drawable.rectangle_top_round_corner20_white) + dataPicker.setTitle(R.string.edit_consultant_birthday_title) +// (picker.headerView as TextView).gravity = Gravity.START + var wheelLayout = dataPicker.wheelLayout + wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY) + wheelLayout.setRange(DateEntity.target(1920, 1, 1), DateEntity.today(), currentDate) + wheelLayout.setResetWhenLinkage(false) + dataPicker.setOnDatePickedListener { year, month, day -> + setBirthDay(year, month, day) + } + dataPicker.show() + } + + private fun setBirthDay(year: Int, month: Int, day: Int) { + currentDate = DateEntity.target(year, month, day) + mBinding.tvBirthday.text = currentDate.toString() + mViewModel.consultantBean.value.birthdayLong = currentDate.toTimeInMillis() + } + + private fun showRelationPicker() { + relationPicker.setBackgroundResource(R.drawable.rectangle_top_round_corner20_white) + relationPicker.setTitle(R.string.edit_consultant_relation_title) + relationPicker.setDefaultPosition(0) + relationPicker.wheelView.setFormatter { value -> + (value as CommonSettingMenuBean).text + } + relationPicker.setOnOptionPickedListener { position, item -> + setRelationText(item as CommonSettingMenuBean) + + } + relationPicker.show() + } + + private fun setRelationText(commonSettingMenuBean: CommonSettingMenuBean) { + mBinding.tvRelation.text = commonSettingMenuBean.text + mViewModel.consultantBean.value.familyRelation = commonSettingMenuBean.value + } + + private fun showPerfectInfoDialog(id: String) { + perfectInfoDialog.setContent(getString(R.string.dialog_perfect_info_content)) + .setBtnText(getString(R.string.dialog_perfect_info_affirm)) + .setCancelBtnText(getString(R.string.dialog_perfect_info_cancel)) + .setOnAffirmClickListener(object : TextViewDialog.OnAffirmClickListener { + override fun onAffirmClick(viewDialog: TextViewDialog) { + if(consultantBean == null|| consultantBean!!.id.isNullOrEmpty()){//区分是添加咨询人还是修改咨询人 + startBaseHealthyInfoAddActivity(this@EditConsultantActivity, id) + finish() + } + } + + override fun onCancelClick(viewDialog: TextViewDialog) { + finish() + } + }) + .show() + } + @Subscribe(threadMode = ThreadMode.MAIN) + fun onEvent(event: EditConsultantEvent) { + finish() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/FilterSearchDoctorActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/FilterSearchDoctorActivity.kt new file mode 100644 index 0000000..15e25a4 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/FilterSearchDoctorActivity.kt @@ -0,0 +1,333 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.app.ProgressDialog +import android.os.Bundle +import android.view.View +import android.view.Window +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.sw.healthyclients.view.LoadingDialog +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter +import com.xjjk.healthyclients.base.BaseVMBActivity +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.databinding.ActivityFilterSearchDoctorBinding +import com.xjjk.healthyclients.superfuntion.startDoctorHomepageActivity +import com.xjjk.healthyclients.ui.activity.guidance.adapter.SeekDoctorDoctorAdapter +import com.xjjk.healthyclients.ui.viewmodel.FilterSearchDoctorViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 带筛选的找专家 + */ +class FilterSearchDoctorActivity : + BaseVMBActivity(R.layout.activity_filter_search_doctor){ + private var mDoctorList=arrayListOf() //医生列表 + private var mHospitalList=arrayListOf() //医院 + private var mDepartList=arrayListOf() //科室 + private var mSickList=arrayListOf() //疾病 + private var mSeekDoctorDoctorAdapter: SeekDoctorDoctorAdapter?=null + + //科室数据 + private var mDepartmentListLeft=arrayListOf() //科室列表 + private var mSickListLeft=arrayListOf() //科室列表 + private var mDepartmentListRight=arrayListOf() //科室列表 + private var mSickListRight=arrayListOf() //科室列表 + + var Re_hospitalId="" + var Re_search="" + var Re_hospitalName="" + var Re_departId="" + var Re_departName="" + var Re_sickId="" + var Re_sickName="" + var mDialog: LoadingDialog?=null + var mBean= selectDictListByNHDSRequestBean() + override fun initView(savedInstanceState: Bundle?) { +// initFilterDropDownView() + mBinding?.apply { + mSeekDoctorDoctorAdapter= SeekDoctorDoctorAdapter(mContext!!, + R.layout.item_recycle_seek_doctor_doctor_child,mDoctorList) + val doctorLayoutManager = LinearLayoutManager(this@FilterSearchDoctorActivity) + mFilterContentView.layoutManager = doctorLayoutManager + mFilterContentView.adapter = mSeekDoctorDoctorAdapter + } + + + } + + override fun transparentStatusBar(): Boolean { + return false + } + + override fun initData() { + var intents=intent + Re_search=intents.getStringExtra("search").toString() + Re_hospitalId= intents.getStringExtra("hospitalId").toString() + Re_hospitalName=intents.getStringExtra("hospitalName").toString() + Re_departId=intents.getStringExtra("departId").toString() + Re_departName=intents.getStringExtra("departName").toString() + Re_sickId=intents.getStringExtra("sickId").toString() + Re_sickName=intents.getStringExtra("sickName").toString() + mBinding.seekDoctorSearch.initEtContext(Re_search) + refreshState() + + lifecycleScope.launch { + if (Re_hospitalName.isNotEmpty()) { + mViewModel.titleText.emit(Re_hospitalName) + }else{ + mViewModel.titleText.emit("找专家") + } + } + + //科室左侧数据 + mViewModel.selectDepartListByHospitalId(Re_hospitalId,"0") + + //疾病左侧数据 + mViewModel.selectDepartListSick("0") + mViewModel.selectSickListByDepartmentId("0") + + } + + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDepartmentSoure.collectLatest {list -> + mDepartList.clear() + mDepartList.addAll(list) + mBinding.dropDownMenu.setDepartData(mDepartList) + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mHospitalSoure.collectLatest {list -> + mHospitalList.clear() + mHospitalList.addAll(list) + mBinding.dropDownMenu.setHospitalData(mHospitalList) + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDiseaseSoure.collectLatest {list -> + mSickList.clear() + mSickList.addAll(list) + mBinding.dropDownMenu.setSickData(mSickList) + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDoctorSoure.collectLatest {list -> + mDoctorList.clear() + mDoctorList.addAll(list) + mSeekDoctorDoctorAdapter?.notifyDataSetChanged() + if (mDoctorList.size==0) { + showEmptys() + }else{ + hindEmptys() + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mCloseDialog.collectLatest {isClose -> + if (isClose) { + mDialog?.dismiss() + } + } + } + } + + //科室左侧数据 + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mLeftSoure.collectLatest { + mDepartmentListLeft.clear() + mDepartmentListLeft.addAll(it) + if(mDepartmentListLeft.size>0){ + mDepartmentListLeft[0].isSelect=true +// mViewModel.selectDepartList(mDepartmentListLeft[0].id) + mViewModel.selectDepartListByHospitalId(Re_hospitalId,mDepartmentListLeft[0].id) + mBinding.dropDownMenu.setLeftData(mDepartmentListLeft) + } + + } + } + } + //科室右侧数据 + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mRightSoure.collectLatest { + mDepartmentListRight.clear() + mDepartmentListRight.addAll(it) + mBinding.dropDownMenu.setDepartRightData(mDepartmentListRight) + } + } + } + //疾病左侧数据 + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mLeftSickSoure.collectLatest { + mSickListLeft.clear() + mSickListLeft.addAll(it) + if(mSickListLeft.size>0){ + mSickListLeft[0].isSelect=true + } + mBinding.dropDownMenu.setSickLeftData(mSickListLeft) + } + } + } + //疾病右侧数据 + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mRightSickSoure.collectLatest { + mSickListRight.clear() + mSickListRight.addAll(it) + mBinding.dropDownMenu.setSickRightData(mSickListRight) + } + } + } + } + + override fun bindEvent() { + mBinding.dropDownMenu.setFilterListener { + //二级筛选条件 + if (it.tfSort.isNotEmpty()) { + mBean.tfSort= it.tfSort + } + if (it.hospitalId.isNotEmpty()) { + mBean.hospitalId= it.hospitalId + } + if (it.isSelectHospital) { + mBean.hospitalId="" + } + + mBean.departmentId= it.departmentId + mBean.sickId= it.sickId + if(Re_hospitalId!=mBean.hospitalId){ + Re_hospitalId=mBean.hospitalId + mBean.departmentId="" + mBean.sickId="" + mBinding.dropDownMenu.setDepartResettingText("全部科室") + mBinding.dropDownMenu.setSickResettingText("全部疾病") + }else{ + Re_hospitalId=mBean.hospitalId + } + if(Re_departId!= it.departmentId){ + Re_departId= it.departmentId + mBean.sickId="" + mBinding.dropDownMenu.setSickResettingText("全部疾病") + }else{ + Re_departId= it.departmentId + } + mViewModel.selectDepartListByHospitalId(Re_hospitalId,"0") + + + mBean.doctorName= mBinding.seekDoctorSearch.getInoputText() + mViewModel.selectDictListByNHDS(mBean) + } + + mBinding.seekDoctorSearch.setOnCustomClickListener { + mBean.doctorName=mBinding.seekDoctorSearch.getInoputText() + mViewModel.selectDictListByNHDS(mBean) + } + + mBinding.dropDownMenu.setDoubleListListener { type, id -> + // type 0 科室 1疾病 + when(type){ + 0 -> { +// mViewModel.selectDepartList(id) + mViewModel.selectDepartListByHospitalId(Re_hospitalId,id) + } + 1 -> { + mViewModel.selectSickListByDepartmentId(id) + } + } + } + + mSeekDoctorDoctorAdapter?.setOnItemClickListener(object : + MultiItemTypeAdapter.OnItemClickListener { + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + mContext?.let { startDoctorHomepageActivity(it,mDoctorList[position].id) } + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + } + } + + fun showEmptys(){ + mBinding?.tvEmpty?.visibility=View.VISIBLE + } + fun hindEmptys(){ + mBinding?.tvEmpty?.visibility=View.GONE + } + + fun refreshState(){ + if (Re_hospitalId.isNotEmpty()&&Re_hospitalName.isNotEmpty()){ + //从医院详情页点击全部科室 + mBinding.dropDownMenu.hideHospitalFilter() + }else if (Re_departId.isNotEmpty()&&Re_departName.isNotEmpty()){ + //点击科室进来的 + if (Re_departName.contains("全部")) { + Re_departId="" + }else{ + mBinding.dropDownMenu.setDepartText(Re_departName,Re_departId) + } + }else if (Re_sickId.isNotEmpty()&&Re_sickName.isNotEmpty()){ + //点击疾病进来的 + if (Re_sickName.contains("全部")) { + Re_sickId="" + }else{ + mBinding.dropDownMenu.setSickText(Re_sickName,Re_sickId) + } + } + createDialog2() + mDialog?.show() + mBean.doctorName= mBinding.seekDoctorSearch.getInoputText() + mBean.sickId=Re_sickId + mBean.departmentId=Re_departId + mBean.hospitalId=Re_hospitalId + mBinding.dropDownMenu.setDataBean(mBean) + mViewModel.selectDictListByNHDS(mBean) + + mSeekDoctorDoctorAdapter?.notifyDataSetChanged() + } + + fun createDialog2() { + mDialog = LoadingDialog( + mContext, + ProgressDialog.STYLE_SPINNER, "数据加载中" + ) + mDialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE) + mDialog!!.setCanceledOnTouchOutside(false) + mDialog!!.setCancelable(false) + mDialog!!.setMessage("请稍后...") + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/GeneralPracticeGuidanceActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/GeneralPracticeGuidanceActivity.kt new file mode 100644 index 0000000..344b738 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/GeneralPracticeGuidanceActivity.kt @@ -0,0 +1,160 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +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.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.listener.OnItemClickListener +import com.github.gzuliyujiang.wheelpicker.DatePicker +import com.github.gzuliyujiang.wheelpicker.entity.DateEntity +import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.guidance.GuidanceListBean +import com.xjjk.healthyclients.databinding.ActivityWarnDataNewBinding +import com.xjjk.healthyclients.superfuntion.getEmptyView +import com.xjjk.healthyclients.superfuntion.initColors +import com.xjjk.healthyclients.superfuntion.startGroupChat +import com.xjjk.healthyclients.ui.activity.guidance.adapter.GuidanceHistoryAdapterNew +import com.xjjk.healthyclients.ui.viewmodel.GuidanceFragmentViewModel +import com.xjjk.healthyclients.utils.IMInputActionSettingUtils +import com.xjjk.healthyclients.utils.TUIUtils +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 找专家-全部医院 + */ +class GeneralPracticeGuidanceActivity : BaseVMBActivity(R.layout.activity_warn_data_new), + OnItemClickListener, SwipeRefreshLayout.OnRefreshListener { + + var mMeterCode ="" + var title ="" + val dataPicker: DatePicker by lazy { DatePicker(this) } + lateinit var currentDate: DateEntity + var mDoctorList= arrayListOf() + var mStartTime="" + var mEndTime="" + private val mWarnDataAdapter: GuidanceHistoryAdapterNew by lazy { GuidanceHistoryAdapterNew(R.layout.item_warn_data_new) } + + + override fun initView(savedInstanceState: Bundle?) { + mBinding.apply { + swipeRefresh.initColors() + swipeRefresh.setOnRefreshListener(this@GeneralPracticeGuidanceActivity) + toolbarLay.vLine.visibility=View.GONE + } + } + + override fun dataBindingFinish() { + mBinding?.let { + it.toolbarLay.vLine.visibility=View.GONE + } + super.dataBindingFinish() + + } + + override fun initData() { + } + + override fun createObserve() { + super.createObserve() + mBinding?.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.mDoctorList.collectLatest { list -> + if(list == null){ + return@collectLatest + } + if (mViewModel.isRefreshing.value) { + mWarnDataAdapter.setNewInstance(list) + } else { + mWarnDataAdapter.addData(list) + } + mWarnDataAdapter.loadMoreModule.loadMoreComplete() + if (rvList.adapter == null) { + mWarnDataAdapter.setEmptyView(rvList.getEmptyView()) + mWarnDataAdapter.setOnItemClickListener(this@GeneralPracticeGuidanceActivity) + initLoadMore() + rvList.adapter = mWarnDataAdapter + } + mBinding?.let { + it.toolbarLay.vLine.visibility=View.GONE + } + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isRefreshing.collectLatest { + swipeRefresh.isRefreshing = it + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isLoadMoreEnd.collectLatest { + if (it) { + mWarnDataAdapter.loadMoreModule.loadMoreEnd(it) + } + } + } + } + } + } + + override fun onResume() { + super.onResume() + onRefresh() + } + + override fun onRefresh() { + mViewModel?.selectSessionListByDoctorIdHelper(isRefresh =true) + } + + private fun initLoadMore() { + mWarnDataAdapter.loadMoreModule.setOnLoadMoreListener { mViewModel?.selectSessionListByDoctorIdHelper(isRefresh =false) } + mWarnDataAdapter.loadMoreModule.isEnableLoadMore = true + mWarnDataAdapter.loadMoreModule.isAutoLoadMore = true + //当自动加载开启,同时数据不满一屏时,是否继续执行自动加载更多(默认为true) + mWarnDataAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = false + } + + override fun bindEvent() { + mBinding?.apply { + + } + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + + } + } + + + + override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + var bean=mWarnDataAdapter.getItem(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) + startGroupChat(bean.imId,"图文咨询", consultantId = bean.memberId, + workBean = WorkBean(bean.id, TUIUtils.WORK_TYPE_IMAGE_TEXT_CONSULT) + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/GuidanceNoticeActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/GuidanceNoticeActivity.kt new file mode 100644 index 0000000..9d01b64 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/GuidanceNoticeActivity.kt @@ -0,0 +1,115 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +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.ActivityGuidanceNoticeBinding +import com.xjjk.healthyclients.superfuntion.startSelectAppointmentTimeActivity +import com.xjjk.healthyclients.superfuntion.startSelectConsultantActivity +import com.xjjk.healthyclients.superfuntion.toHtml +import com.xjjk.healthyclients.ui.viewmodel.GuidanceNoticeViewModel +import com.xjjk.healthyclients.utils.ConstantUtils +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 咨询须知 + */ +class GuidanceNoticeActivity : BaseVMBActivity(R.layout.activity_guidance_notice){ + + + var type=3;//7天0 1个月1 以后不再 3 + var id="" + var doctorId: String? = null + var mPageType: String? = null// 1 图文 0音视频 + override fun initView(savedInstanceState: Bundle?) { + doctorId = intent.extras?.getString("doctorId") + mPageType = intent.extras?.getString("type") + mBinding.apply { + } + } + + override fun initData() { + mPageType?.let { mViewModel.selectUserNotice(it) } + } + + override fun createObserve() { + super.createObserve() + //用户弹窗 + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.noticeBean.collectLatest {bean -> + if (bean.title.isNotEmpty()&&bean.content.isNotEmpty()){ + mBinding.guidanceNoticeContent.text=bean.content.toHtml() + id=bean.id + } + } + } + } + + //用户弹窗-结果提交 + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.userNoticeResult.collectLatest {bean -> + if (bean) { + if (mPageType=="1") { + startSelectConsultantActivity( + this@GuidanceNoticeActivity, + ConstantUtils.ConsultType.IMAGE_TEXT_CONSULT, + doctorId + ) + }else{ + startSelectAppointmentTimeActivity(this@GuidanceNoticeActivity, doctorId) + } + finish() + } + } + } + } + + } + + override fun bindEvent() { + mBinding?.apply{ + dialogConfirm7DayNoRemindLl.setOnClickListener { + type=0 + dialogConfirm7DayNoRemindIv.setImageResource(R.drawable.ic_marital_state_select) + dialogConfirm1MonthNoRemindIv.setImageResource(R.drawable.ic_marital_state_no_select) + dialogConfirmNoRemindIv.setImageResource(R.drawable.ic_marital_state_no_select) + } + dialogConfirm1MonthNoRemindLl.setOnClickListener { + type=1 + dialogConfirm1MonthNoRemindIv.setImageResource(R.drawable.ic_marital_state_select) + dialogConfirm7DayNoRemindIv.setImageResource(R.drawable.ic_marital_state_no_select) + dialogConfirmNoRemindIv.setImageResource(R.drawable.ic_marital_state_no_select) + } + dialogConfirmNoRemindLl.setOnClickListener { + type=3 + 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) + } + submit.setOnClickListener { + mViewModel.chooseToDontShowUp(id,type) + } + } + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + R.id.hospital_detail_navigation -> { + mContext?.let{ + + } + } + } + } + + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/MyGuidanceActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/MyGuidanceActivity.kt new file mode 100644 index 0000000..15277d5 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/MyGuidanceActivity.kt @@ -0,0 +1,341 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +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 com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.listener.OnItemClickListener +import com.tencent.imsdk.v2.V2TIMManager +import com.tencent.imsdk.v2.V2TIMValueCallback +import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.guidance.selectSessionListByUserIdBean +import com.xjjk.healthyclients.databinding.ActivityMyGuidanceBinding +import com.xjjk.healthyclients.event.AppraiseFinishEvent +import com.xjjk.healthyclients.superfuntion.getEmptyView +import com.xjjk.healthyclients.superfuntion.startAppointmentWaitAffirmActivity +import com.xjjk.healthyclients.superfuntion.startGroupChat +import com.xjjk.healthyclients.ui.activity.guidance.adapter.MyGuidanceAdapter +import com.xjjk.healthyclients.ui.viewmodel.MyGuidanceActivityViewModel +import com.xjjk.healthyclients.utils.IMInputActionSettingUtils +import com.xjjk.healthyclients.utils.TUIUtils +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + + +/** + * 我的咨询 + */ +class MyGuidanceActivity : BaseVMBActivity(R.layout.activity_my_guidance), + OnItemClickListener { + var mPosition=0 + var mIsFirst=true + var knowledgeList= arrayListOf() + private var mTitleType="1" + private var mTitleState="3" + private val mMyGuidanceAdapter: MyGuidanceAdapter by lazy { MyGuidanceAdapter(mContext!!,R.layout.item_my_guidance,knowledgeList) } + override fun initView(savedInstanceState: Bundle?) { + mBinding?.apply { + twoRiceMebu(0) + var manager=LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false) + myGuidanceRv.layoutManager=manager + } + } + + override fun initData() { + var title=intent.getStringExtra("title") + if (title != null) { + if (title.isNotEmpty()) { + when(title){ + //从个人中心进来 + "进行中" -> { + mTitleState="3" + orderState(3) + } + "待评价" -> { + mTitleState="4" + orderState(4) + } + "已评价" -> { + mTitleState="5" + orderState(5) + } + "全部" -> { + mTitleState="5" + orderState(5) + } + } + + }else{ + if (mTitleType=="1"&&mTitleState=="3"){ + knowledgeList.clear() + mViewModel.refreshIndex() + mViewModel.getImageTextUnderwayConsultList() + }else{ + mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + } + } + + + } + + override fun onResume() { + if (!mIsFirst) { + listenerMessage() + } + super.onResume() + } + + + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.knowledgeList.collectLatest {list -> + if(list.size>0){ + mIsFirst=false + } + if(knowledgeList.size==0){ + mMyGuidanceAdapter.setNewInstance(list) + }else{ + mMyGuidanceAdapter.addData(list) + } + knowledgeList.addAll(list) + mMyGuidanceAdapter.loadMoreModule.loadMoreComplete() + if (mBinding.myGuidanceRv.adapter==null) { + if(knowledgeList.size==0){ + mBinding?.myGuidanceRv?.getEmptyView() + ?.let { mMyGuidanceAdapter.setEmptyView(it) } + } + mMyGuidanceAdapter.setOnItemClickListener(this@MyGuidanceActivity) + initLoadMore() + mBinding.myGuidanceRv.adapter = mMyGuidanceAdapter + } + mMyGuidanceAdapter?.notifyDataSetChanged() + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isLoadMoreEnd.collectLatest { + if (it) { + mMyGuidanceAdapter.loadMoreModule.loadMoreEnd(it) + } + } + } + } + } + + private fun initLoadMore() { + mMyGuidanceAdapter.loadMoreModule.setOnLoadMoreListener { + mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + mMyGuidanceAdapter.loadMoreModule.isEnableLoadMore = true + mMyGuidanceAdapter.loadMoreModule.isAutoLoadMore = true + //当自动加载开启,同时数据不满一屏时,是否继续执行自动加载更多(默认为true) + mMyGuidanceAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = false + } + + override fun bindEvent() { + addClickViews(mBinding.myGuidanceChat,mBinding.myGuidanceCall,mBinding.myGuidanceStateInProgress,mBinding.myGuidanceStateWaiteConfirm,mBinding.myGuidanceStateFinish) + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + R.id.my_guidance_chat -> { + //图文咨询 只有进行中,已完成 + mTitleType="1" + twoRiceMebu(0) + mBinding.myGuidanceChat.setTextColor(mContext!!.resources.getColor(R.color.text_black_33)) + mBinding.myGuidanceCall.setTextColor(mContext!!.resources.getColor(R.color.text_black_66)) + mBinding.myGuidanceChatLine.visibility=View.VISIBLE + mBinding.myGuidanceCallLine.visibility=View.INVISIBLE + mTitleState="3" + orderState(3) +// knowledgeList.clear() +// mViewModel.refreshIndex() +// mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + R.id.my_guidance_call -> { + //视频咨询 + mTitleType="2" + twoRiceMebu(1) + mBinding.myGuidanceCall.setTextColor(mContext!!.resources.getColor(R.color.text_black_33)) + mBinding.myGuidanceChat.setTextColor(mContext!!.resources.getColor(R.color.text_black_66)) + mBinding.myGuidanceCallLine.visibility=View.VISIBLE + mBinding.myGuidanceChatLine.visibility=View.INVISIBLE + mTitleState="3" + orderState(3) +// knowledgeList.clear() +// mViewModel.refreshIndex() +// mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + R.id.my_guidance_state_in_progress -> { + //进行中 + orderState(3) + } + R.id.my_guidance_state_waite_confirm -> { + //待确认 + orderState(1) + } + R.id.my_guidance_state_finish -> { + //已完成 + orderState(5) + } + } + } + + /** + * 1 待开始 3 进行中 5已完成 + */ + fun orderState(state:Int){ + mTitleState="$state" + mBinding?.apply { + when(state){ + 3 -> { + mContext?.let{ + myGuidanceStateInProgress.setTextColor(it.resources.getColor(R.color.white)) + myGuidanceStateInProgress.background=it.resources.getDrawable(R.drawable.bg_blue_background_shap) + myGuidanceStateWaiteConfirm.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateWaiteConfirm.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateFinish.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateFinish.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + } + knowledgeList.clear() + mViewModel.refreshIndex() + if (mTitleType=="1") { + //图文咨询 + mViewModel.getImageTextUnderwayConsultList() + }else{ + mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + + } + 1 -> { + mContext?.let{ + myGuidanceStateInProgress.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateInProgress.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateWaiteConfirm.setTextColor(it.resources.getColor(R.color.white)) + myGuidanceStateWaiteConfirm.background=it.resources.getDrawable(R.drawable.bg_blue_background_shap) + myGuidanceStateFinish.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateFinish.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + } + knowledgeList.clear() + mViewModel.refreshIndex() + mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + 5 -> { + mContext?.let{ + myGuidanceStateInProgress.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateInProgress.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateWaiteConfirm.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateWaiteConfirm.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateFinish.setTextColor(it.resources.getColor(R.color.white)) + myGuidanceStateFinish.background=it.resources.getDrawable(R.drawable.bg_blue_background_shap) + } + knowledgeList.clear() + mViewModel.refreshIndex() + mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + } + } + + } + + /** + * 0 图文咨询 1视频咨询 2 其他 + */ + fun twoRiceMebu(type:Int){ + when(type){ + 0 ->{ + mBinding?.apply { + myGuidanceStateInProgress.visibility=View.VISIBLE + myGuidanceStateWaiteConfirm.visibility=View.GONE + myGuidanceStateFinish.visibility=View.VISIBLE + } + } + 1 -> { + mBinding?.apply { + myGuidanceStateInProgress.visibility=View.VISIBLE + myGuidanceStateWaiteConfirm.visibility=View.VISIBLE + myGuidanceStateFinish.visibility=View.VISIBLE + } + } + 2 -> { + + } + } + } + + + override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + var bean=knowledgeList[position] + if (bean.contentType=="1") { + var isSelf=false + isSelf = bean.tfOwn=="1" + //大于等于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) + startGroupChat(bean.imId,"图文咨询", consultantId = bean.memberId, + workBean = WorkBean(bean.id, TUIUtils.WORK_TYPE_IMAGE_TEXT_CONSULT) + ) + }else{ + mContext?.let { startAppointmentWaitAffirmActivity(it,bean.id,true) } + } + } + + override fun onMessageEvent(event: Any?) { + super.onMessageEvent(event) + try { + event?.let { event -> + if (event is AppraiseFinishEvent) { + knowledgeList.clear() + mViewModel.refreshIndex() + if (mTitleType=="1"&&mTitleState=="3") { + mViewModel.getImageTextUnderwayConsultList() + }else{ + mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + } + } + } catch (e: Exception) { + } + } + + fun listenerMessage(){ + V2TIMManager.getConversationManager() + .getTotalUnreadMessageCount(object : V2TIMValueCallback { + override fun onSuccess(aLong: Long?) { + knowledgeList.clear() + mViewModel.refreshIndex() + if (mTitleType=="1"&&mTitleState=="3"){ + mViewModel.getImageTextUnderwayConsultList() + }else{ + mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + } + + override fun onError(code: Int, desc: String) { + + } + }) + } + + override fun onDestroy() { +// V2TIMManager.getConversationManager().removeConversationListener() + super.onDestroy() + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/SeekDoctorSearchActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/SeekDoctorSearchActivity.kt new file mode 100644 index 0000000..77ef00b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/SeekDoctorSearchActivity.kt @@ -0,0 +1,459 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.google.android.flexbox.AlignItems +import com.google.android.flexbox.FlexDirection +import com.google.android.flexbox.FlexWrap +import com.google.android.flexbox.FlexboxLayoutManager +import com.google.android.material.tabs.TabLayout +import com.google.android.material.tabs.TabLayout.OnTabSelectedListener +import com.sw.healthyclients.bean.guidance.DiseaseBean +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter +import com.xjjk.healthyclients.base.BaseVMBActivity +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.databinding.ActivitySeekDoctorSearchBinding +import com.xjjk.healthyclients.superfuntion.getTab +import com.xjjk.healthyclients.superfuntion.startDoctorHomepageActivity +import com.xjjk.healthyclients.superfuntion.startFilterSearchDoctorActivity +import com.xjjk.healthyclients.superfuntion.switchTabRefresh +import com.xjjk.healthyclients.ui.activity.guidance.adapter.DiseaseAdapter +import com.xjjk.healthyclients.ui.activity.guidance.adapter.SeekDoctorDepartmentAdapter +import com.xjjk.healthyclients.ui.activity.guidance.adapter.SeekDoctorDoctorAdapter +import com.xjjk.healthyclients.ui.activity.guidance.adapter.SeekDoctorHospitalAdapter +import com.xjjk.healthyclients.ui.viewmodel.SeekDoctorSearchActivityViewModel +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 找专家-搜索页 + */ +class SeekDoctorSearchActivity : BaseVMBActivity(R.layout.activity_seek_doctor_search){ + private var mSeekDoctorHospitalAdapter: SeekDoctorHospitalAdapter?=null + private var mSeekDoctorDoctorAdapter: SeekDoctorDoctorAdapter?=null + private var mSeekDoctorDepartmentAdapter: SeekDoctorDepartmentAdapter?=null + private var mDiseaseAdapter: DiseaseAdapter?=null + private var mDoctorList=arrayListOf() //医生列表 + private var mHospitalList=arrayListOf() //医院列表 + private var mDepartmentList=arrayListOf() //科室列表 + private var mDiseaseList=arrayListOf() //疾病 + private var mPosition=0 //0 综合 1专家 2医院 3疾病 4科室 + override fun initView(savedInstanceState: Bundle?) { + mBinding.apply { + seekDoctorSearch.initView(getString(R.string.search_input_hint)) + //tablayout + seekDoctorSearchTab.addTab(getTab("综合")) + seekDoctorSearchTab.addTab(getTab("专家")) + seekDoctorSearchTab.addTab(getTab("医院")) + seekDoctorSearchTab.addTab(getTab("疾病")) + seekDoctorSearchTab.addTab(getTab("科室")) + //医生 + mSeekDoctorDoctorAdapter= SeekDoctorDoctorAdapter(mContext!!,R.layout.item_recycle_seek_doctor_doctor_child,mDoctorList) + val doctorLayoutManager = LinearLayoutManager(this@SeekDoctorSearchActivity) + seekDoctorDoctorList.layoutManager = doctorLayoutManager + seekDoctorDoctorList.adapter = mSeekDoctorDoctorAdapter + //医院 + mSeekDoctorHospitalAdapter= SeekDoctorHospitalAdapter(mContext!!, + R.layout.item_recycle_seek_doctor_hospital_child,mHospitalList) + val linearLayoutManager = LinearLayoutManager(this@SeekDoctorSearchActivity) + seekDoctorHospitalList.layoutManager = linearLayoutManager + seekDoctorHospitalList.adapter = mSeekDoctorHospitalAdapter + //科室 + mSeekDoctorDepartmentAdapter= SeekDoctorDepartmentAdapter(mContext!!, + R.layout.item_recycle_seek_doctor_department_child,mDepartmentList) + val linearLayoutManager2 = GridLayoutManager(this@SeekDoctorSearchActivity,2,GridLayoutManager.VERTICAL,false) + seekDoctorDepartmentList.layoutManager = linearLayoutManager2 + seekDoctorDepartmentList.adapter = mSeekDoctorDepartmentAdapter + //疾病 + var manager= FlexboxLayoutManager(mContext) + manager.setFlexDirection(FlexDirection.ROW) + //设置是否换行 + manager.setFlexWrap(FlexWrap.WRAP) + manager.setAlignItems(AlignItems.STRETCH) + seekDoctorDiseaseList.layoutManager=manager + mDiseaseAdapter= DiseaseAdapter(mContext, + R.layout.item_recycle_seek_doctor_disease_child,mDiseaseList){} + seekDoctorDiseaseList.adapter=mDiseaseAdapter + + rlDoctor.visibility=View.GONE + rlHospital.visibility=View.GONE + rlDisease.visibility=View.GONE + rlDepartment.visibility=View.GONE + } + } + + override fun initData() { + + var mIntent=intent + var content=mIntent.getStringExtra("search") + mBinding?.apply { + seekDoctorSearch.initEtContext(content) + if (content != null) { + mViewModel.searchComprehensive(content) + } + } + + + } + + override fun createObserve() { + super.createObserve() + mBinding?.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mHospitalSoure.collectLatest {list -> +// if(list.size==0){ +// mBinding?.seekDoctorHospitalListRoot?.visibility=View.GONE +// }else{ +// mBinding?.seekDoctorHospitalListRoot?.visibility=View.VISIBLE + mHospitalList.clear() + mHospitalList.addAll(list) + mSeekDoctorHospitalAdapter?.notifyDataSetChanged() +// } + + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDepartmentSoure.collectLatest {list -> +// if(list.size==0){ +// mBinding?.seekDoctorDepartmentListRoot?.visibility=View.GONE +// }else{ +// mBinding?.seekDoctorDepartmentListRoot?.visibility=View.VISIBLE + mDepartmentList.clear() + mDepartmentList.addAll(list) + mSeekDoctorDepartmentAdapter?.notifyDataSetChanged() +// } + + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDiseaseSoure.collectLatest {list -> +// if(list.size==0){ +// mBinding?.seekDoctorDiseaseListRoot?.visibility=View.GONE +// }else{ +// mBinding?.seekDoctorDiseaseListRoot?.visibility=View.VISIBLE + mDiseaseList.clear() + mDiseaseList.addAll(list) + mDiseaseAdapter?.notifyDataSetChanged() +// } + + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDoctorSoure.collectLatest {list -> +// if(list.size==0){ +// mBinding?.seekDoctorDoctorListRoot?.visibility=View.GONE +// }else{ +// mBinding?.seekDoctorDoctorListRoot?.visibility=View.VISIBLE + mDoctorList.clear() + mDoctorList.addAll(list) + mSeekDoctorDoctorAdapter?.notifyDataSetChanged() +// } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mAllState.collectLatest {state -> + if(!state){ + if (mPosition==0) { + showEmptys() + }else{ + hindEmptys() + } + }else{ + hindEmptys() + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mHospitalSoureState.collectLatest {state -> + if(!state){ + if (mPosition==2) { + showEmptys() + }else{ + hindEmptys() + } + mBinding?.seekDoctorHospitalListRoot?.visibility=View.GONE + if (mPosition==0){ + rlHospital.visibility=View.GONE + } + }else{ + if (mPosition==0){ + rlHospital.visibility=View.VISIBLE + } + mBinding?.seekDoctorHospitalListRoot?.visibility=View.VISIBLE + hindEmptys() + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDoctorSoureState.collectLatest {state -> + if(!state){ + mBinding?.seekDoctorDoctorListRoot?.visibility=View.GONE + if (mPosition==1) { + showEmptys() + }else{ + hindEmptys() + } + if (mPosition==0) { + rlDoctor.visibility=View.GONE + } + }else{ + mBinding?.seekDoctorDoctorListRoot?.visibility=View.VISIBLE + hindEmptys() + if (mPosition==0) { + rlDoctor.visibility=View.VISIBLE + } + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDepartmentSoureState.collectLatest {state -> + if(!state){ + if (mPosition==4) { + showEmptys() + }else{ + hindEmptys() + } + mBinding?.seekDoctorDepartmentListRoot?.visibility=View.GONE + if (mPosition==0){ + rlDepartment.visibility=View.GONE + } + }else{ + mBinding?.seekDoctorDepartmentListRoot?.visibility=View.VISIBLE + hindEmptys() + if (mPosition==0){ + rlDepartment.visibility=View.VISIBLE + } + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.mDiseaseSoureState.collectLatest {state -> + if(!state){ + if (mPosition==3) { + showEmptys() + }else{ + hindEmptys() + } + mBinding?.seekDoctorDiseaseListRoot?.visibility=View.GONE + if (mPosition==0) { + rlDisease.visibility=View.GONE + } + }else{ + mBinding?.seekDoctorDiseaseListRoot?.visibility=View.VISIBLE + hindEmptys() + if (mPosition==0) { + rlDisease.visibility=View.VISIBLE + } + } + } + } + } + } + } + + fun showEmptys(){ + mBinding?.tvEmpty?.visibility=View.VISIBLE + } + fun hindEmptys(){ + mBinding?.tvEmpty?.visibility=View.GONE + } + + override fun bindEvent() { + mBinding.seekDoctorSearch.setOnCustomClickListener { + if(it.isNotEmpty()){ +// mViewModel.searchComprehensive(it) + when(mPosition){ + 0 -> { + mViewModel.searchComprehensive(it) + } + 1 -> { + mViewModel.searchConDoctor(it) + } + 2 -> { + mViewModel.searchConResource(it) + } + 3 -> { + mViewModel.searchconSicksList(it) + } + 4 -> { + mViewModel.searchConDepartment(it) + } + } + }else{ + showToast("搜索内容不能为空") + } + } + mBinding?.apply{ + addClickViews(tvDoctorMore,tvHospitalMore,tvDiseaseMore,tvDepartmentMore) + } + + mBinding.seekDoctorSearchTab.addOnTabSelectedListener(object:OnTabSelectedListener{ + override fun onTabSelected(tab: TabLayout.Tab?) { + mPosition=tab?.position!! + switchTabRefresh(mPosition) + mBinding?.let{ + when(mPosition){ + 0 -> { + mViewModel.searchComprehensive(it.seekDoctorSearch.getInoputText()) + } + 1 -> { + mViewModel.searchConDoctor(it.seekDoctorSearch.getInoputText()) + } + 2 -> { + mViewModel.searchConResource(it.seekDoctorSearch.getInoputText()) + } + 3 -> { + mViewModel.searchconSicksList(it.seekDoctorSearch.getInoputText()) + } + 4 -> { + mViewModel.searchConDepartment(it.seekDoctorSearch.getInoputText()) + } + } + } + + } + + override fun onTabUnselected(tab: TabLayout.Tab?) { + } + + override fun onTabReselected(tab: TabLayout.Tab?) { + } + }) + + mSeekDoctorDoctorAdapter?.setOnItemClickListener(object : MultiItemTypeAdapter.OnItemClickListener{ + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + mContext?.let { startDoctorHomepageActivity(it,mDoctorList[position].id) } + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + + mSeekDoctorHospitalAdapter?.setOnItemClickListener(object : MultiItemTypeAdapter.OnItemClickListener{ + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + mContext?.let { + + val bundle = Bundle() + bundle.putString("hospitalId", mHospitalList[position].id) + bundle.putString("hospitalName", mHospitalList[position].name) + bundle.putString("departId", "") + bundle.putString("departName", "") + bundle.putString("sickId", "") + bundle.putString("sickName", "") + startFilterSearchDoctorActivity(it,"",bundle) + } + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + mDiseaseAdapter?.setOnItemClickListener(object : MultiItemTypeAdapter.OnItemClickListener{ + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + mContext?.let { + + val bundle = Bundle() + bundle.putString("hospitalId", "") + bundle.putString("hospitalName", "") + bundle.putString("departId", "") + bundle.putString("departName", "") + bundle.putString("sickId", mDiseaseList[position].id) + bundle.putString("sickName", mDiseaseList[position].name) + startFilterSearchDoctorActivity(it,"",bundle) + } + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + mSeekDoctorDepartmentAdapter?.setOnItemClickListener(object : MultiItemTypeAdapter.OnItemClickListener{ + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + mContext?.let { + + val bundle = Bundle() + bundle.putString("hospitalId", "") + bundle.putString("hospitalName", "") + bundle.putString("departId", mDepartmentList[position].departmentId) + bundle.putString("departName", mDepartmentList[position].departmentName) + bundle.putString("sickId", "") + bundle.putString("sickName", "") + startFilterSearchDoctorActivity(it,"",bundle) + + } + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + R.id.tv_doctor_more -> { + mBinding.seekDoctorSearchTab.getTabAt(1)?.select() + } + R.id.tv_hospital_more -> { + mBinding.seekDoctorSearchTab.getTabAt(2)?.select() + } + R.id.tv_disease_more -> { + mBinding.seekDoctorSearchTab.getTabAt(3)?.select() + } + R.id.tv_department_more -> { + mBinding.seekDoctorSearchTab.getTabAt(4)?.select() + } + else -> {} + } + } + +// override fun onClick(view: View) { +// when(view?.id){ +// +// } +// } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/SelectAppointmentTimeActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/SelectAppointmentTimeActivity.kt new file mode 100644 index 0000000..f378c8a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/SelectAppointmentTimeActivity.kt @@ -0,0 +1,170 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.view.View +import androidx.databinding.DataBindingUtil +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.GridLayoutManager +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.listener.OnItemClickListener +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.databinding.ActivitySelectAppointmentTimeBinding +import com.xjjk.healthyclients.databinding.ViewFooterSelectAppointmentTimeBinding +import com.xjjk.healthyclients.databinding.ViewHeaderSelectAppointmentTimeBinding +import com.xjjk.healthyclients.event.DoctorPagerEvent +import com.xjjk.healthyclients.event.FollowDoctorEvent +import com.xjjk.healthyclients.superfuntion.startSelectConsultantActivity +import com.xjjk.healthyclients.ui.activity.guidance.adapter.SelectAppointmentTimeAdapter +import com.xjjk.healthyclients.ui.viewmodel.SelectAppointmentTimeViewModel +import com.xjjk.healthyclients.utils.ConstantUtils +import com.xjjk.healthyclients.view.DoctorBaseInfoView +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode + +/** + * 选择预约时间 + */ +class SelectAppointmentTimeActivity : + BaseVMBActivity( + R.layout.activity_select_appointment_time + ), OnItemClickListener { + private val mAdapter: SelectAppointmentTimeAdapter by lazy { + SelectAppointmentTimeAdapter( + mViewModel.appointmentTimeList.value + ) + } + var doctorId: String? = null + private lateinit var headerBinding: ViewHeaderSelectAppointmentTimeBinding + override fun initView(savedInstanceState: Bundle?) { + doctorId = intent.extras?.getString("doctorId") + mBinding.apply { + val gridLayoutManager = GridLayoutManager(this@SelectAppointmentTimeActivity, 4) + rvList.layoutManager = gridLayoutManager +// rvList.addItemDecoration(GridSpacingItemDecoration(Int.MAX_VALUE, dp2px(8f), true)) + mAdapter.enabledCheckMode = true + mAdapter.singleMode = true + mAdapter.singleModeIsCanCancel = false + mAdapter.addHeaderView(getHeaderView()) + mAdapter.addFooterView(getFooterView()) + mAdapter.setOnItemClickListener(this@SelectAppointmentTimeActivity) + } + } + + override fun createObserve() { + super.createObserve() + mBinding.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.doctorBean.collectLatest { doctorBean -> + headerBinding.viewDoctorBaseInfo.setData( + doctorBean, + DoctorBaseInfoView.PageStatus.APPOINTMENT_CONSULT + ) + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.appointmentTimeList.collectLatest { list -> + mAdapter.setNewInstance(list) + if (rvList.adapter == null) { + rvList.adapter = mAdapter + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.followStatus.collectLatest { + headerBinding.viewDoctorBaseInfo.getFollowView().isSelected = it + } + } + } + } + + } + + override fun initData() { + mViewModel.getDoctorInfo(doctorId) + mViewModel.getAppointmentTimeList(doctorId) + } + + override fun onResume() { + super.onResume() + + } + + override fun bindEvent() { + addClickViews(headerBinding.viewDoctorBaseInfo.getFollowView()) + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + R.id.btn_submit -> { + if (mAdapter.checkedItems.size == 0) { + return + } + startSelectConsultantActivity( + this, + ConstantUtils.ConsultType.AUDIO_VIDEO_CONSULT, + doctorId, + mAdapter.checkedItems[0].id + ) + } + + R.id.btn_follow -> { + mViewModel.followDoctor(doctorId) + } + } + } + + private fun getHeaderView(): View { + headerBinding = + DataBindingUtil.inflate( + layoutInflater, + R.layout.view_header_select_appointment_time, + mBinding.rvList, + false + ) + + return headerBinding.root + } + + private fun getFooterView(): View { + val headerBinding: ViewFooterSelectAppointmentTimeBinding = + DataBindingUtil.inflate( + layoutInflater, + R.layout.view_footer_select_appointment_time, + mBinding.rvList, + false + ) + addClickViews(headerBinding.btnSubmit) + return headerBinding.root + } + @Subscribe(threadMode = ThreadMode.MAIN) + override fun onMessageEvent(event: Any?) { + if (event is FollowDoctorEvent) { + if (event == null) { + return + } + lifecycleScope.launch { + mViewModel.followStatus.emit(event.followStatus) + } + }else if (event is DoctorPagerEvent){ + if (event.message==1) { + mViewModel.getAppointmentTimeList(doctorId) + } + } + + } + override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + (adapter as BaseCheckRecycleViewAdapter).clickItem(position, false) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/SelectConsultantActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/SelectConsultantActivity.kt new file mode 100644 index 0000000..d8eb801 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/SelectConsultantActivity.kt @@ -0,0 +1,245 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.os.Bundle +import android.view.View +import androidx.databinding.DataBindingUtil +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.LinearLayoutManager +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.listener.OnItemChildClickListener +import com.chad.library.adapter.base.listener.OnItemClickListener +import com.sw.healthyclients.bean.guidance.ConsultDoctorIMChatInfo +import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.guidance.ArchivesBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.databinding.ActivitySelectConsultantBinding +import com.xjjk.healthyclients.databinding.ViewFooterSelectConsultantBinding +import com.xjjk.healthyclients.event.ConsultantManagerEvent +import com.xjjk.healthyclients.event.DoctorPagerEvent +import com.xjjk.healthyclients.event.EditArchivesEvent +import com.xjjk.healthyclients.superfuntion.getEmptyView +import com.xjjk.healthyclients.superfuntion.startAppointmentWaitAffirmActivity +import com.xjjk.healthyclients.superfuntion.startArchivesDetailActivity +import com.xjjk.healthyclients.superfuntion.startConsultantManagerActivity +import com.xjjk.healthyclients.superfuntion.startGroupChat +import com.xjjk.healthyclients.superfuntion.toJson +import com.xjjk.healthyclients.ui.activity.guidance.adapter.SelectConsultantAdapter +import com.xjjk.healthyclients.ui.viewmodel.SelectConsultantViewModel +import com.xjjk.healthyclients.utils.ConstantUtils +import com.xjjk.healthyclients.utils.IMInputActionSettingUtils +import com.xjjk.healthyclients.utils.TUIUtils +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch +import org.greenrobot.eventbus.EventBus +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode + +/** + * 选择咨询人 + */ +class SelectConsultantActivity : + BaseVMBActivity(R.layout.activity_select_consultant), + OnItemClickListener, OnItemChildClickListener { + private val mAdapter: SelectConsultantAdapter by lazy { SelectConsultantAdapter() } + var doctorId: String? = null + var appointmentTimeId: String? = null + var consultType: ConstantUtils.ConsultType? = null + override fun initView(savedInstanceState: Bundle?) { + doctorId = intent.extras?.getString("doctorId") + appointmentTimeId = intent.extras?.getString("appointmentTimeId") + consultType = intent.extras?.getParcelable("consultType") + mBinding.apply { + val linearLayoutManager = LinearLayoutManager(this@SelectConsultantActivity) + rvList.layoutManager = linearLayoutManager + when (consultType) { + ConstantUtils.ConsultType.IMAGE_TEXT_CONSULT -> { + mBinding.layOperate.btnSkip.visibility = View.VISIBLE + } + + ConstantUtils.ConsultType.AUDIO_VIDEO_CONSULT -> {} + else -> {} + } + } + } + + override fun createObserve() { + super.createObserve() + mBinding.apply { + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.consultantList.collectLatest { list -> + list?.let { + if (mViewModel.isRefreshing.value) { + mAdapter.setList(list) + } else { + mAdapter.addData(list) + } + mAdapter.loadMoreModule.loadMoreComplete() + if (rvList.adapter == null) { + mAdapter.doctorId = doctorId + mAdapter.appointmentTimeId = appointmentTimeId + mAdapter.consultType = consultType +// mAdapter.addFooterView(getFooterView()) + mAdapter.setEmptyView(rvList.getEmptyView()) + mAdapter.setOnItemClickListener(this@SelectConsultantActivity) + mAdapter.setOnItemChildClickListener(this@SelectConsultantActivity) + rvList.adapter = mAdapter + } + } + } + } + } + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isLoadMoreEnd.collectLatest { + mAdapter.loadMoreModule.loadMoreEnd(it) + } + } + } + } + + } + + override fun initData() { + onRefresh() + } + + private fun onRefresh() { + mViewModel.getConsultantArchivesData(true) + } + + override fun bindEvent() { + addClickViews( + mBinding.toolbarLay.titleTvRight, + mBinding.layOperate.btnSkip, + mBinding.layOperate.btnNext + ) + } + + override fun processClick(paramView: View?) { + when (paramView?.id) { + R.id.title_tv_right -> { + startConsultantManagerActivity(this) + } + + R.id.btn_skip -> { + mViewModel.submitImageTextConsultantApply(doctorId, "", "", successCall = { + startIMImageTextConsultant(it, isSelf = true,workState=1) + }) + } + + R.id.btn_next -> { + when (consultType) { + ConstantUtils.ConsultType.IMAGE_TEXT_CONSULT -> { + var archivesBean: ArchivesBean? = mAdapter.getCheckedArchives() + if (archivesBean != null) { + mViewModel.submitImageTextConsultantApply( + doctorId, + archivesBean.memberId, + archivesBean.id, + successCall = { + startIMImageTextConsultant( + it, + archivesBean.toIMArchivesMessageBean().toJson(), + archivesBean.memberId, + archivesBean.isSelf, + 1 + ) + }) + } else { + showToast(getString(R.string.select_consultant_empty_tips)) + } + } + + ConstantUtils.ConsultType.AUDIO_VIDEO_CONSULT -> { + var archivesBean: ArchivesBean? = mAdapter.getCheckedArchives() + if (archivesBean != null) { + mViewModel.submitAudioVideoConsultantApply( + doctorId, + archivesBean.memberId, + archivesBean.id, + appointmentTimeId, + successCall = { + startAppointmentWaitAffirmActivity(this, it) + EventBus.getDefault().post(DoctorPagerEvent(1)) + }) + } else { + showToast(getString(R.string.select_consultant_empty_tips)) + } + } + + else -> {} + } + } + } + } + + private fun startIMImageTextConsultant( + bean: ConsultDoctorIMChatInfo, + autoSendMessage: String? = null, + consultantId: String? = null, + isSelf: Boolean, + workState: Int=-1 + ) { + IMInputActionSettingUtils.createImageTextConsultSetting(isSelf) + startGroupChat( + groupId = bean.groupId, + groupName = getString(R.string.title_image_text_consult), + autoSendMessage = if("1" == bean.tfNew) autoSendMessage else null, + consultantId = consultantId, + workBean = WorkBean(bean.id, TUIUtils.WORK_TYPE_IMAGE_TEXT_CONSULT,workState) + ) + } + + private fun getFooterView(): View { + val headerBinding: ViewFooterSelectConsultantBinding = + DataBindingUtil.inflate( + layoutInflater, + R.layout.view_footer_select_consultant, + mBinding.rvList, + false + ) + addClickViews(headerBinding.btnSkip, headerBinding.btnNext) + when (consultType) { + ConstantUtils.ConsultType.IMAGE_TEXT_CONSULT -> { + headerBinding.btnSkip.visibility = View.VISIBLE + } + + ConstantUtils.ConsultType.AUDIO_VIDEO_CONSULT -> {} + else -> {} + } + return headerBinding.root + } + + override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + + } + + override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + when (view?.id) { + R.id.tv_add_archives -> { + startArchivesDetailActivity( + this@SelectConsultantActivity, + consultType, + doctorId = doctorId, + appointmentTimeId = appointmentTimeId, + consultantBean = adapter.getItem(position) as ConsultantBean + ) + } + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + fun onEvent(event: ConsultantManagerEvent) { + onRefresh() + } + + @Subscribe(threadMode = ThreadMode.MAIN) + open fun onEvent(event: EditArchivesEvent) { + onRefresh() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/UserMyGuidanceActivity.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/UserMyGuidanceActivity.kt new file mode 100644 index 0000000..91dab77 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/UserMyGuidanceActivity.kt @@ -0,0 +1,385 @@ +package com.xjjk.healthyclients.ui.activity.guidance + +import android.graphics.Color +import android.os.Bundle +import android.view.Gravity +import android.view.View +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import androidx.recyclerview.widget.LinearLayoutManager +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.listener.OnItemClickListener +import com.gyf.immersionbar.ktx.immersionBar +import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.BaseVMBActivity +import com.xjjk.healthyclients.bean.guidance.selectSessionListByUserIdBean +import com.xjjk.healthyclients.databinding.ActivityMyGuidanceUserBinding +import com.xjjk.healthyclients.event.AppraiseFinishEvent +import com.xjjk.healthyclients.superfuntion.getEmptyView +import com.xjjk.healthyclients.superfuntion.startAppointmentWaitAffirmActivity +import com.xjjk.healthyclients.superfuntion.startGroupChat +import com.xjjk.healthyclients.ui.activity.guidance.adapter.MyGuidanceAdapter +import com.xjjk.healthyclients.ui.viewmodel.MyGuidanceActivityViewModel +import com.xjjk.healthyclients.utils.IMInputActionSettingUtils +import com.xjjk.healthyclients.utils.TUIUtils +import com.xjjk.healthyclients.view.TextViewDialog +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +/** + * 我的咨询 + */ +class UserMyGuidanceActivity : BaseVMBActivity(R.layout.activity_my_guidance_user), + OnItemClickListener { + var mPosition=0 + var knowledgeList= arrayListOf() + private var mTitleType="1" + private var mTitleState="3" + private val mMyGuidanceAdapter: MyGuidanceAdapter by lazy { MyGuidanceAdapter(mContext!!, + R.layout.item_my_guidance,knowledgeList) } + var textViewDialog : TextViewDialog?=null + override fun initView(savedInstanceState: Bundle?) { + mBinding?.apply { +// twoRiceMebu(0) + var manager=LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false) + myGuidanceRv.layoutManager=manager + + textViewDialog = mContext?.let { TextViewDialog(it) } + textViewDialog?.setDialogTitle("温馨提示", 18f) + textViewDialog?.setContent("咨询已结束,是否查看咨询记录!", 14f) + textViewDialog?.setContentStyle(Gravity.LEFT) + textViewDialog?.setBtnText("确认", 18f) + textViewDialog?.setDialogCancelable(false) + textViewDialog?.setCancelBtnText("取消", 18f) + } + } + + override fun initData() { + var title=intent.getStringExtra("title") + if (title != null) { + if (title.isNotEmpty()) { + when(title){ + //从个人中心进来 + "进行中" -> { + mTitleState="3" + twoRiceMebu(0) + orderState(3) + } + "待评价" -> { + mTitleState="4" + twoRiceMebu(1) + orderState(4) + mBinding.myGuidanceCall.setTextColor(mContext!!.resources.getColor(R.color.text_black_33)) + mBinding.myGuidanceChat.setTextColor(mContext!!.resources.getColor(R.color.text_black_66)) + mBinding.myGuidanceCallLine.visibility=View.VISIBLE + mBinding.myGuidanceChatLine.visibility=View.INVISIBLE + } + "已评价" -> { + mTitleState="5" + twoRiceMebu(0) + orderState(5) + } + "全部" -> { + mTitleState="" + twoRiceMebu(0) + orderState(6) + } + } + + }else{ + if (mTitleType=="1"&&mTitleState=="3"){ + mViewModel.getImageTextUnderwayConsultList() + }else{ + mViewModel.selectSessionListByUserIdVersionThree(mTitleType,mTitleState) + } + } + } + + } + + override fun dataBindingFinish() { + val source = intent.getIntExtra("source",0) + if (source == 1) { + mBinding.toolbarLay.rlTitleLay.setBackgroundColor(Color.parseColor("#117474")) + immersionBar { + statusBarColorInt(Color.parseColor("#117474")) + .fitsSystemWindows(false) //解决状态栏和布局重叠问题 + + } + } + } + + override fun createObserve() { + super.createObserve() + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED){ + mViewModel.knowledgeList.collectLatest {list -> + if(knowledgeList.size==0){ + mMyGuidanceAdapter.setNewInstance(list) + }else{ + mMyGuidanceAdapter.addData(list) + } + knowledgeList.addAll(list) + mMyGuidanceAdapter.loadMoreModule.loadMoreComplete() + if (mBinding.myGuidanceRv.adapter==null) { + mMyGuidanceAdapter.setOnItemClickListener(this@UserMyGuidanceActivity) + mMyGuidanceAdapter.setEmptyView(mBinding.myGuidanceRv.getEmptyView()) + initLoadMore() + mBinding.myGuidanceRv.adapter = mMyGuidanceAdapter + } + mMyGuidanceAdapter?.notifyDataSetChanged() + } + } + } + + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.CREATED) { + mViewModel.isLoadMoreEnd.collectLatest { + if (it) { + mMyGuidanceAdapter.loadMoreModule.loadMoreEnd(it) + } + } + } + } + } + + private fun initLoadMore() { + mMyGuidanceAdapter.loadMoreModule.setOnLoadMoreListener { + mViewModel.selectSessionListByUserIdVersionThree(mTitleType,mTitleState) + } + mMyGuidanceAdapter.loadMoreModule.isEnableLoadMore = true + mMyGuidanceAdapter.loadMoreModule.isAutoLoadMore = true + //当自动加载开启,同时数据不满一屏时,是否继续执行自动加载更多(默认为true) + mMyGuidanceAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = false + } + + override fun bindEvent() { + addClickViews(mBinding.myGuidanceChat,mBinding.myGuidanceCall,mBinding.myGuidanceStateInProgress,mBinding.myGuidanceStateWaiteConfirm,mBinding.myGuidanceStateFinish,mBinding.myGuidanceStateAll) + } + + override fun processClick(paramView: View?) { + when(paramView?.id){ + R.id.my_guidance_chat -> { + //图文咨询 只有进行中,已完成 + mTitleType="1" + twoRiceMebu(0) + mBinding.myGuidanceChat.setTextColor(mContext!!.resources.getColor(R.color.text_black_33)) + mBinding.myGuidanceCall.setTextColor(mContext!!.resources.getColor(R.color.text_black_66)) + mBinding.myGuidanceChatLine.visibility=View.VISIBLE + mBinding.myGuidanceCallLine.visibility=View.INVISIBLE + mTitleState="3" + orderState(3) +// knowledgeList.clear() +// mViewModel.refreshIndex() +// mViewModel.selectSessionListByUserIdVersionThree(mTitleType,mTitleState) + } + R.id.my_guidance_call -> { + //视频咨询 + mTitleType="2" + twoRiceMebu(1) + mBinding.myGuidanceCall.setTextColor(mContext!!.resources.getColor(R.color.text_black_33)) + mBinding.myGuidanceChat.setTextColor(mContext!!.resources.getColor(R.color.text_black_66)) + mBinding.myGuidanceCallLine.visibility=View.VISIBLE + mBinding.myGuidanceChatLine.visibility=View.INVISIBLE + mTitleState="3" + orderState(3) +// knowledgeList.clear() +// mViewModel.refreshIndex() +// mViewModel.selectSessionListByUserIdVersionThree(mTitleType,mTitleState) + } + R.id.my_guidance_state_in_progress -> { + //进行中 + orderState(3) + } + R.id.my_guidance_state_waite_confirm -> { + //待评价 + orderState(4) + } + R.id.my_guidance_state_finish -> { + //已评价 + orderState(5) + } + R.id.my_guidance_state_all -> { + //历史 + orderState(6) + } + } + } + + /** + * 1 待开始 3 进行中 5已完成 + */ + fun orderState(state:Int){ + mTitleState="$state" + mBinding?.apply { + when(state){ + 3 -> { + mContext?.let{ + myGuidanceStateInProgress.setTextColor(it.resources.getColor(R.color.white)) + myGuidanceStateInProgress.background=it.resources.getDrawable(R.drawable.bg_blue_background_shap) + myGuidanceStateWaiteConfirm.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateWaiteConfirm.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateFinish.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateFinish.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateAll.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateAll.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + } + knowledgeList.clear() + mViewModel.refreshIndex() + if (mTitleType=="1") { + //图文咨询 + mViewModel.getImageTextUnderwayConsultList() + }else{ + mViewModel.selectSessionListByUserIdVersionThree(mTitleType,mTitleState) + } + + } + 1 -> { + mContext?.let{ + myGuidanceStateInProgress.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateInProgress.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateWaiteConfirm.setTextColor(it.resources.getColor(R.color.white)) + myGuidanceStateWaiteConfirm.background=it.resources.getDrawable(R.drawable.bg_blue_background_shap) + myGuidanceStateFinish.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateFinish.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateAll.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateAll.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + } + knowledgeList.clear() + mViewModel.refreshIndex() + mViewModel.selectSessionListByUserIdVersionThree(mTitleType,mTitleState) + } + 5 -> { + mContext?.let{ + myGuidanceStateInProgress.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateInProgress.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateWaiteConfirm.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateWaiteConfirm.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateFinish.setTextColor(it.resources.getColor(R.color.white)) + myGuidanceStateFinish.background=it.resources.getDrawable(R.drawable.bg_blue_background_shap) + myGuidanceStateAll.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateAll.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + } + knowledgeList.clear() + mViewModel.refreshIndex() + mViewModel.selectSessionListByUserIdVersionThree(mTitleType,mTitleState) + } + 4 -> { + mContext?.let{ + myGuidanceStateInProgress.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateInProgress.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateFinish.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateFinish.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateWaiteConfirm.setTextColor(it.resources.getColor(R.color.white)) + myGuidanceStateWaiteConfirm.background=it.resources.getDrawable(R.drawable.bg_blue_background_shap) + myGuidanceStateAll.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateAll.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + } + knowledgeList.clear() + mViewModel.refreshIndex() + mViewModel.selectSessionListByUserIdVersionThree(mTitleType,mTitleState) + } + 6 -> { + mTitleState="" + mContext?.let{ + myGuidanceStateInProgress.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateInProgress.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateWaiteConfirm.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateWaiteConfirm.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateFinish.setTextColor(it.resources.getColor(R.color.text_black_33)) + myGuidanceStateFinish.background=it.resources.getDrawable(R.drawable.bg_grey_background_shap) + myGuidanceStateAll.setTextColor(it.resources.getColor(R.color.white)) + myGuidanceStateAll.background=it.resources.getDrawable(R.drawable.bg_blue_background_shap) + } + knowledgeList.clear() + mViewModel.refreshIndex() + mViewModel.selectSessionListByUserIdVersionThree(mTitleType,mTitleState) + } + } + } + + } + + /** + * 0 图文咨询 1视频咨询 2 其他 + */ + fun twoRiceMebu(type:Int){ + when(type){ + 0 ->{ + mTitleType="1" + mBinding?.apply { + myGuidanceStateInProgress.visibility=View.VISIBLE + myGuidanceStateWaiteConfirm.visibility=View.GONE + myGuidanceStateFinish.visibility=View.VISIBLE + } + } + 1 -> { + mTitleType="2" + mBinding?.apply { + myGuidanceStateInProgress.visibility=View.VISIBLE + myGuidanceStateWaiteConfirm.visibility=View.VISIBLE + myGuidanceStateFinish.visibility=View.VISIBLE + } + } + 2 -> { + + } + } + } + + override fun onMessageEvent(event: Any?) { + super.onMessageEvent(event) + try { + event?.let { event -> + if (event is AppraiseFinishEvent) { + knowledgeList.clear() + mViewModel.refreshIndex() + if (mTitleType=="1"&&mTitleState=="3") { + mViewModel.getImageTextUnderwayConsultList() + }else{ + mViewModel.selectSessionListByUserId(mTitleType,mTitleState) + } + } + } + } catch (e: Exception) { + } + } + + + override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) { + var bean=knowledgeList[position] + if (bean.contentType=="1") { + var isSelf=false + isSelf = bean.tfOwn=="1" + //大于等于4 不可发消息 + var status=0 + var sendMessage=false + try { + status=bean.contentStatus.toInt() + } catch (e: Exception) { + } + sendMessage = status>=4 +// if(status>=4){ +// textViewDialog?.setOnAffirmClickListener(object : TextViewDialog.OnAffirmClickListener { +// override fun onAffirmClick(viewDialog: TextViewDialog) { +// mContext?.startIMHistoryActivity(bean.imId) +// } +// +// override fun onCancelClick(viewDialog: TextViewDialog) { +// } +// }) +// textViewDialog?.show() +// }else{ + IMInputActionSettingUtils.createImageTextConsultSetting(isSelf,disableSendMessage =sendMessage,disableEvaluate=status==5) + startGroupChat(bean.imId,"图文咨询", consultantId = bean.memberId, + workBean = WorkBean(bean.id, TUIUtils.WORK_TYPE_IMAGE_TEXT_CONSULT) + ) +// } + }else{ + mContext?.let { startAppointmentWaitAffirmActivity(it,bean.id,true) } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/AppraiseAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/AppraiseAdapter.kt new file mode 100644 index 0000000..d53bf96 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/AppraiseAdapter.kt @@ -0,0 +1,25 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.widget.RatingBar +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.xjjk.healthyclients.bean.guidance.AppraiseBean +import com.xjjk.healthyclients.R + +/** + * 医生评价 + */ +class AppraiseAdapter : + BaseQuickAdapter( + R.layout.item_recycle_doctor_appraise + ), LoadMoreModule { + override fun convert(holder: BaseViewHolder, item: AppraiseBean) { + holder.setText(R.id.tv_name, item.userName) + holder.setText(R.id.tv_date, item.time) + holder.setText(R.id.tv_content, item.context) + if(!item.score.isNullOrEmpty()){ + holder.getView(R.id.rating_bar).rating = item.score.toFloat() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/BaseHealthyInfoAddAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/BaseHealthyInfoAddAdapter.kt new file mode 100644 index 0000000..e94a232 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/BaseHealthyInfoAddAdapter.kt @@ -0,0 +1,85 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import androidx.core.view.ViewCompat +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.buddy.kredit.android.view.SpaceItemDecoration +import com.chad.library.adapter.base.BaseSectionQuickAdapter +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import com.xjjk.healthyclients.bean.guidance.BaseHealthyInfoChildBean + +/** + * @author nanfeifei + * @time 2023/6/21 9:51 + * @description + */ +class BaseHealthyInfoAddAdapter : + BaseSectionQuickAdapter( + R.layout.item_recycle_seek_doctor_header, + R.layout.item_recycle_healthy_info_add, + ) { + var adapterMap = mutableMapOf() + override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) { + super.onItemViewHolderCreated(viewHolder, viewType) + } + + override fun convert(holder: BaseViewHolder, item: BaseHealthyInfoChildBean) { + holder.setText(R.id.tv_title, item.itemProblem) + holder.getView(R.id.rv_answer_list)?.let { + var layoutManager: LinearLayoutManager = LinearLayoutManager(context) + if ("1" == item.type) { + layoutManager = GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false) + } else if ("4" == item.type) { + layoutManager = LinearLayoutManager(context) + } + it.layoutManager = layoutManager + if (it.itemDecorationCount == 0){ + it.addItemDecoration(SpaceItemDecoration(context, 0, 15f)) + } + ViewCompat.setNestedScrollingEnabled(it, false) + } + val position = getItemPosition(item) + var mAdapter = adapterMap[position] + if (mAdapter == null) { + mAdapter = + BaseHealthyInfoRadioAdapter(item.answerList) + mAdapter.enabledCheckMode = true + if ("1" == item.type||"4" == item.type){ + mAdapter.singleMode = true + } + mAdapter.singleModeIsCanCancel = false + mAdapter.setOnItemClickListener { adapter, view, position -> + (adapter as BaseCheckRecycleViewAdapter).clickItem(position, false) + } + adapterMap[position] = mAdapter + } else { + mAdapter.setList(item.answerList) + } + if(mAdapter.checkedItems.size > 0){ + var checkIndex = mAdapter.getCheckedItemPosition() + if (checkIndex >= 0){ + mAdapter.clickItem(mAdapter.getCheckedItemPosition(), false) + } + } + holder.getView(R.id.rv_answer_list).adapter = mAdapter + } + + override fun convertHeader(helper: BaseViewHolder, item: BaseHealthyInfoChildBean) { + helper.setText(R.id.tv_header_title, item.headerName) + helper.setGone(R.id.tv_header_all, true) + } + + + + override fun setNewInstance(list: MutableList?) { + adapterMap.clear() + super.setNewInstance(list) + } + override fun setList(list: Collection?) { + adapterMap.clear() + super.setList(list) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/BaseHealthyInfoRadioAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/BaseHealthyInfoRadioAdapter.kt new file mode 100644 index 0000000..708b611 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/BaseHealthyInfoRadioAdapter.kt @@ -0,0 +1,71 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.text.Editable +import android.text.TextWatcher +import android.widget.EditText +import android.widget.RadioButton +import com.chad.library.adapter.base.module.LoadMoreModule +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import com.xjjk.healthyclients.bean.guidance.HealthyInfoRadioBean + +class BaseHealthyInfoRadioAdapter(data: MutableList) : + BaseCheckRecycleViewAdapter( + R.layout.item_radio_healthy_info_edit, + data + ), LoadMoreModule { + override fun bindViewClickListener(viewHolder: BaseViewHolder, viewType: Int) { +// addChildClickViewIds(R.id.radio_button) + super.bindViewClickListener(viewHolder, viewType) + } + + override fun convert(holder: BaseViewHolder, item: HealthyInfoRadioBean) { + holder.setText(R.id.radio_button, item.radioText) + holder.setText( + R.id.et_explain, + item.explain + ) + if ((4 == item.itemType)) { + if (item.checked) { + holder.getView(R.id.et_explain).isEnabled=true + }else{ + holder.getView(R.id.et_explain).isEnabled=false + } + + } + holder.setGone(R.id.et_explain, !(4 == item.itemType && "有" == item.radioText)) + val contentWatcher = object : TextWatcher { + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + } + + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + } + override fun afterTextChanged(s: Editable?) { + val value = s.toString() + item.explain = value + } + } + holder.getView(R.id.radio_button).let{ + it.setOnCheckedChangeListener { buttonView, isChecked -> + if (isChecked&&(4 == item.itemType && "有" == item.radioText)) { + holder.getView(R.id.et_explain).isEnabled=true + }else{ + holder.getView(R.id.et_explain).isEnabled=false + } + } + } + holder.getView(R.id.et_explain).let { + it.setText(item.explain) + it.setOnFocusChangeListener { v, hasFocus -> + if (hasFocus){ + it.addTextChangedListener(contentWatcher) + }else{ + it.removeTextChangedListener(contentWatcher) + } + } + + } + this@BaseHealthyInfoRadioAdapter.handleCompoundButton(holder.getView(R.id.radio_button), item) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/ConsultantManagerAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/ConsultantManagerAdapter.kt new file mode 100644 index 0000000..fbc9140 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/ConsultantManagerAdapter.kt @@ -0,0 +1,33 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +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.adapter.common.BaseCheckRecycleViewAdapter +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.utils.CommonUtils + +class ConsultantManagerAdapter() : + BaseCheckRecycleViewAdapter( + R.layout.item_recycle_consultant_manager + ), LoadMoreModule { + override fun bindViewClickListener(viewHolder: BaseViewHolder, viewType: Int) { + addChildClickViewIds(R.id.btn_edit) + super.bindViewClickListener(viewHolder, viewType) + } + + override fun convert(holder: BaseViewHolder, item: ConsultantBean) { + holder.setText(R.id.tv_name, item.name) + holder.setText( + R.id.tv_info, + context.getString( + R.string.consultant_manager_personnel_info, + CommonUtils.getGenderText(item.gender), + item.age, + DateUtil.getShortDateStr(item.birthdayLong) + ) + ) + this@ConsultantManagerAdapter.handleCompoundButton(holder.getView(R.id.check_manager), item) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/CustomFilterAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/CustomFilterAdapter.kt new file mode 100644 index 0000000..953f683 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/CustomFilterAdapter.kt @@ -0,0 +1,37 @@ +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.FilterSearchBean + +class CustomFilterAdapter( + var mContext: Context?, + var layoutId: Int, + var mType:Int, + var datas: ArrayList?, + var method: () -> Unit +) : CommonAdapter(mContext, layoutId, datas) { + override fun convert(holder: ViewHolder?, bean: FilterSearchBean?, position: Int) { + holder?.getView(R.id.item_custom_filter_name)?.let{ + when(mType){ + 0 -> { + it.text=bean?.hospitalName + } + 1 -> { + it.text=bean?.departmentName + } + 2 -> { + it.text=bean?.sicksName + } + } + } + } + + fun setDataType(type:Int){ + mType=type + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/DiseaseAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/DiseaseAdapter.kt new file mode 100644 index 0000000..ab64328 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/DiseaseAdapter.kt @@ -0,0 +1,27 @@ +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?, + var method: () -> Unit +) : CommonAdapter(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(R.id.item_recycler_seek_doctor_disease_child_name)?.setText(it.name) + holder?.getView(R.id.item_recycler_seek_doctor_disease_child_hint)?.setText(doctorHint) + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/FilterSearchDepartment2Adapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/FilterSearchDepartment2Adapter.kt new file mode 100644 index 0000000..00e16e4 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/FilterSearchDepartment2Adapter.kt @@ -0,0 +1,26 @@ +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?) : CommonAdapter(mContext,layoutId,datas){ + override fun convert(holder: ViewHolder?, bean: DepartListBean?, position: Int) { + holder?.getView(R.id.item_key)?.let{ + it.text=bean?.departmentName + } + holder?.getView(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) + } + } + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/GuidanceFragmentDoctorAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/GuidanceFragmentDoctorAdapter.kt new file mode 100644 index 0000000..aa90098 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/GuidanceFragmentDoctorAdapter.kt @@ -0,0 +1,89 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.content.Context +import android.graphics.Color +import android.view.View +import android.widget.ImageView +import android.widget.TextView +import com.allen.library.shape.ShapeTextView +import com.sw.healthyclients.utils.ScreenUtil +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.GuidanceListBean +import com.xjjk.healthyclients.superfuntion.loadCircle +import com.xjjk.healthyclients.superfuntion.orEmptyDefault + + +class GuidanceFragmentDoctorAdapter( + var mContext: Context?, + var layoutId: Int, + var datas: ArrayList?, + var method: () -> Unit +) : CommonAdapter(mContext, layoutId, datas) { + override fun convert(holder: ViewHolder?, t: GuidanceListBean?, position: Int) { + t?.let{ bean-> + mContext?.let{ context -> + holder?.getView(R.id.item_iv_icon)?.let{ img-> + img.loadCircle(bean.toAccountHead, R.drawable.ic_default_doctor_head_img) + } + holder?.getView(R.id.item_tv_name)?.let{ + it.text=bean.toAccountName + } + holder?.getView(R.id.item_type)?.let{ + if (bean.contentType=="1") { + it.setTextColor(Color.parseColor("#07C28F")) + it.text="图文咨询" + var drawable = context.resources.getDrawable(R.drawable.ic_type_image) + drawable.setBounds(0, 0, ScreenUtil.dp2px(20f),ScreenUtil.dp2px(20f)) + it.setCompoundDrawablesWithIntrinsicBounds(drawable,null,null,null) + + val attributeSetData = it.attributeSetData + attributeSetData.solidColor = Color.parseColor("#EBFFFA") + attributeSetData.strokeColor = Color.parseColor("#07C28F") + it.shapeBuilder?.init(it, attributeSetData) + }else if (bean.contentType=="2") { + it.setTextColor(Color.parseColor("#3365DF")) + it.text="视频咨询" + var drawable = context.resources.getDrawable(R.drawable.ic_type_video) + drawable.setBounds(0, 0, ScreenUtil.dp2px(20f),ScreenUtil.dp2px(20f)) + it.setCompoundDrawablesWithIntrinsicBounds(drawable,null,null,null) + + val attributeSetData = it.attributeSetData + attributeSetData.solidColor = Color.parseColor("#F0F3FF") + attributeSetData.strokeColor = Color.parseColor("#3365DF") + it.shapeBuilder?.init(it, attributeSetData) + } else { + it.visibility=View.INVISIBLE + } + } + holder?.getView(R.id.item_guidance_state)?.let{ + if (bean.contentStatus.isNotEmpty()) { + var state=bean.contentStatus.toInt() + if (state>3) { + it.setImageDrawable(context.resources.getDrawable(R.drawable.ic_guidance_finish)) + }else { + it.setImageDrawable(context.resources.getDrawable(R.drawable.ic_guidance_afoot)) + } + } + + } + holder?.getView(R.id.item_tag)?.let{ + it.text=bean.hospitalLevel.orEmptyDefault() + } + holder?.getView(R.id.item_hospital_name)?.let{ + it.text=bean.resourceName.orEmptyDefault() + } + holder?.getView(R.id.tv_guidance_name)?.let{ + it.text="咨询人: ${bean.memberName.orEmptyDefault()}" + } + holder?.getView(R.id.tv_guidance_time)?.let{ + it.text=bean.createTime.orEmptyDefault() + } + + } + + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/GuidanceHistoryAdapterNew.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/GuidanceHistoryAdapterNew.kt new file mode 100644 index 0000000..5c7cf11 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/GuidanceHistoryAdapterNew.kt @@ -0,0 +1,45 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.widget.ImageView +import android.widget.TextView +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.xjjk.healthyclients.R +import com.xjjk.healthyclients.bean.guidance.GuidanceListBean +import com.xjjk.healthyclients.superfuntion.loadCircle +import com.xjjk.healthyclients.superfuntion.orEmptyDefault +import com.xjjk.healthyclients.superfuntion.orEmptyDefaultofQH + +/** + * 体检项目选择adapter + */ +class GuidanceHistoryAdapterNew( + var layoutId: Int, +) : BaseQuickAdapter(layoutId), LoadMoreModule { + override fun convert(holder: BaseViewHolder, bean: GuidanceListBean) { + bean?.let { + holder?.getView(R.id.item_tv_name)?.let{ + it.text=bean.toAccountName.orEmptyDefaultofQH() + } + holder?.getView(R.id.tv_guidance_time)?.let{ + it.text=bean.createTime.orEmptyDefault() + } + holder?.getView(R.id.item_guidance_state)?.let{ + if (bean.contentStatus.isNotEmpty()) { + var state=bean.contentStatus.toInt() + if (state>3) { + it.setImageDrawable(context.resources.getDrawable(R.drawable.ic_guidance_finish)) + }else { + it.setImageDrawable(context.resources.getDrawable(R.drawable.ic_guidance_afoot)) + } + } + } + holder?.getView(R.id.item_iv_icon)?.let{ + it.loadCircle(bean.toAccountHead.orEmptyDefault()) + } + } + + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/HealthInfoAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/HealthInfoAdapter.kt new file mode 100644 index 0000000..19fa8e6 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/HealthInfoAdapter.kt @@ -0,0 +1,30 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder +import com.sw.healthyclients.bean.guidance.HealthInfoBean +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.BaseDataBindingAdapter +import com.xjjk.healthyclients.databinding.ItemRecycleHealthInfoBinding + +/** + * @author nanfeifei + * @time 2023/5/25 18:01 + * @description + */ +class HealthInfoAdapter: BaseDataBindingAdapter( + R.layout.item_recycle_health_info +) { + + override fun convert( + holder: BaseDataBindingHolder, + item: HealthInfoBean + ) { + val mBinding = holder.dataBinding + mBinding?.let { + mBinding.stvHealthInfo.leftTextView.maxEms = 5 + mBinding.stvHealthInfo.leftTextView.minEms = 5 + mBinding.stvHealthInfo.setLeftString(context.getString(R.string.appointment_information_appointment_people_health_information_format, item.answerKey)) + mBinding.stvHealthInfo.setCenterString(item.answerValue) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/ImageAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/ImageAdapter.kt new file mode 100644 index 0000000..069d266 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/ImageAdapter.kt @@ -0,0 +1,128 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.view.View +import com.chad.library.adapter.base.module.LoadMoreModule +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.ImageBean +import com.xjjk.healthyclients.databinding.ItemRecycleImageBinding +import com.xjjk.healthyclients.superfuntion.loadRoundedImage +import java.io.File + +/** + * @author nanfeifei + * @time 2023/5/25 18:01 + * @description + */ +class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter( + R.layout.item_recycle_image +), LoadMoreModule { + private var isEditModel = false + private var editImageShow = false + override fun bindViewClickListener( + viewHolder: BaseDataBindingHolder, + viewType: Int + ) { + addChildClickViewIds(R.id.btn_delete) + super.bindViewClickListener(viewHolder, viewType) + } + override fun convert( + holder: BaseDataBindingHolder, + item: ImageBean + ) { + val mBinding = holder.dataBinding + mBinding?.let { + if(item.isAddButton){ + mBinding.ivImage.setImageResource(R.drawable.icon_image_add) + mBinding.btnDelete.visibility = View.GONE + }else{ + if(item.isFilePath){ + mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f) + }else{ + mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default_archives_image) + } + if(isEditModel){ + mBinding.btnDelete.visibility = View.VISIBLE + }else{ + mBinding.btnDelete.visibility = View.GONE + } + } + } + } + fun isEditModel(isEdit: Boolean){ + isEditModel = isEdit + notifyDataSetChanged() + if(isEditModel && !editImageShow){ + showAddButton(true) + } + } + + override fun setList(list: Collection?) { + super.setList(list) + if(isEditModel){ + showAddButton(true) + } + } + override fun setNewInstance(list: MutableList?) { + super.setNewInstance(list) + if(isEditModel){ + showAddButton(true) + } + } + + override fun addData(newData: Collection) { + if(isEditModel){ + if(editImageShow){ + var lastPosition = data.size - 1 + if(lastPosition < 0){ + lastPosition = 0 + } + addData(lastPosition, newData) + }else{ + showAddButton(true) + } + if(data.size > maxNum){ + showAddButton(false) + } + }else{ + super.addData(newData) + } + } + + override fun removeAt(position: Int) { + super.removeAt(position) + if(isEditModel && !editImageShow){ + showAddButton(true) + } + } + fun getImageList(): MutableList{ + var list = mutableListOf() + data.forEach { imageBean -> + if(!imageBean.isAddButton){ + list.add(imageBean) + } + } + return list + } + fun getImageSize(): Int { + if(isEditModel && editImageShow){ + return getDefItemCount() - 1 + } + return getDefItemCount() + } + + /** + * 显示添加图片按钮 + * @param isShow true为显示 false为隐藏 + */ + private fun showAddButton(isShow: Boolean){ + editImageShow = if(isShow){ + addData(ImageBean(isAddButton = true)) + true + }else{ + removeAt(data.size-1) + false + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/MyGuidanceAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/MyGuidanceAdapter.kt new file mode 100644 index 0000000..d8ed5db --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/MyGuidanceAdapter.kt @@ -0,0 +1,78 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.content.Context +import android.view.View +import android.widget.ImageView +import android.widget.TextView +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.xjjk.healthyclients.R +import com.xjjk.healthyclients.bean.guidance.selectSessionListByUserIdBean +import com.xjjk.healthyclients.superfuntion.loadCircle +import com.xjjk.healthyclients.utils.CommonUtils + +class MyGuidanceAdapter( + var mContext: Context?, + var layoutId: Int, + var datas: ArrayList? +) : BaseQuickAdapter(layoutId, datas), + LoadMoreModule { + override fun convert(holder: BaseViewHolder, bean: selectSessionListByUserIdBean) { + bean?.let { + holder?.getView(R.id.item_my_guidance_doctor_name)?.setText(it.toAccountName) + holder?.getView(R.id.item_my_guidance_doctor_title) + ?.setText("${it.toAccountTitle} ${it.departmentName}") + if (it.hospitalLevel.length == 0) { + holder?.getView(R.id.item_my_guidance_hospital_tag)?.visibility=View.INVISIBLE + }else{ + holder?.getView(R.id.item_my_guidance_hospital_tag) + ?.setText("${it.hospitalLevel}") + } + + holder?.getView(R.id.item_my_guidance_hospital_name) + ?.setText("${it.resourceName}") + holder?.getView(R.id.item_my_guidance_patuent) + ?.setText("就诊人:${it.memberName} \n${it.createTime} ") + holder?.getView(R.id.item_my_guidance_type)?.let { view -> + //咨询类型 +// if (it.contentType == "1") { +// view.text = "图文咨询" +// } else { +// view.text = "视频咨询" +// } + view.visibility=View.INVISIBLE + } + holder?.getView(R.id.item_my_guidance_state)?.let { view -> + if (it.contentType == "1") { + if (it.contentStatus=="3"&&it.unreadCount>0){ + view.setText("待回复") + view.setTextColor(mContext!!.resources.getColor(R.color.guidance_state_color_green)) + }else{ + view.setText("") + } + + } else { + var state = CommonUtils.getGuidanceStateText(it.contentStatus) + if (state == "取消") { + if (mContext != null) { + view.setTextColor(mContext!!.resources.getColor(R.color.text_color_black_99)) + } + } else { + if (mContext != null) { + view.setTextColor(mContext!!.resources.getColor(R.color.guidance_state_color_green)) + } + } + view.setText(state) + } + } + mContext?.let { context -> + holder?.getView(R.id.item_my_guidance_doctor_icon)?.let { img -> + img.loadCircle(it.toAccountHead) + } + } + + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorDepartment3Adapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorDepartment3Adapter.kt new file mode 100644 index 0000000..9c95054 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorDepartment3Adapter.kt @@ -0,0 +1,18 @@ +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.DepartListBean + + +class SeekDoctorDepartment3Adapter(var mContext: Context, var layoutId: Int, var datas: ArrayList?) : CommonAdapter(mContext,layoutId,datas){ + override fun convert(holder: ViewHolder?, bean: DepartListBean?, position: Int) { + holder?.getView(R.id.item_key)?.let{ + //医院名称 + it.text=bean?.departmentName + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorDepartmentAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorDepartmentAdapter.kt new file mode 100644 index 0000000..0f19881 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorDepartmentAdapter.kt @@ -0,0 +1,41 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.content.Context +import android.widget.TextView +import com.allen.library.CircleImageView +import com.sw.healthyclients.utils.StringUtils +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.DepartmentchildBean +import com.xjjk.healthyclients.superfuntion.load + + +class SeekDoctorDepartmentAdapter(var mContext: Context, var layoutId: Int, var datas: ArrayList?) : CommonAdapter(mContext,layoutId,datas){ + override fun convert(holder: ViewHolder?, bean: DepartmentchildBean?, position: Int) { + holder?.getView(R.id.item_recycler_seek_doctor_department_img)?.let{ + //加载医院icon +// ImageLoader.loadImage( +// mContext, +// it, +// bean?.departmentImg, +// R.drawable.ic_default +// ) + it.load(bean?.departmentImg,true, R.drawable.ic_department_default) + } + holder?.getView(R.id.item_recycler_seek_doctor_department_name)?.let{ + //医院名称 + it.text=bean?.departmentName + } + holder?.getView(R.id.item_recycler_seek_doctor_number)?.let{ + var doctorNumber=bean?.doctorNum + var value="有${doctorNumber}名专家" + StringUtils.setSizeSpan(mContext, + it,value,1,1+(doctorNumber.toString().length),10,mContext.resources.getColor(R.color.text_green_BD),true) + } + holder?.getView(R.id.item_recycler_seek_doctor_department_hint)?.let{ + //医院重点科室 + it.text=bean?.hint + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorDoctorAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorDoctorAdapter.kt new file mode 100644 index 0000000..2b8f799 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorDoctorAdapter.kt @@ -0,0 +1,150 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.content.Context +import android.view.View +import android.widget.ImageView +import android.widget.LinearLayout +import android.widget.TextView +import com.allen.library.CircleImageView +import com.sw.healthyclients.utils.TextViewSpanUtil +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.DoctorChildBean +import com.xjjk.healthyclients.superfuntion.load +import com.xjjk.healthyclients.superfuntion.startSelectAppointmentTimeActivity +import com.xjjk.healthyclients.superfuntion.startSelectConsultantActivity +import com.xjjk.healthyclients.utils.ConstantUtils + + +class SeekDoctorDoctorAdapter(var mContext: Context, var layoutId: Int, var datas: ArrayList?) : CommonAdapter(mContext,layoutId,datas){ + override fun convert(holder: ViewHolder?, bean: DoctorChildBean?, position: Int) { + holder?.getView(R.id.item_recycle_seek_doctor_doctor_icon)?.let{ + //医生icon +// ImageLoader.loadImage( +// mContext, +// it, +// bean?.icon, +// R.drawable.ic_default +// ) + it.load(bean?.icon,defaultResId= R.drawable.ic_default_doctor_head_img) + } + holder?.getView(R.id.item_recycle_seek_doctor_doctor_name)?.let{ + //医生姓名 + it.text=bean?.name + } + holder?.getView(R.id.item_recycle_seek_doctor_guidance_root)?.let{ + if (bean?.doctorStatus=="3") { + holder?.getView(R.id.item_recycle_seek_doctor_video)?.let { view-> + view.setTextColor(mContext.resources.getColor(R.color.text_color_black_99)) + it.setOnClickListener {} + } + holder?.getView(R.id.item_recycle_seek_doctor_image_text)?.let { view-> + view.setTextColor(mContext.resources.getColor(R.color.text_color_black_99)) + it.setOnClickListener {} + } + }else{ +// it.visibility=View.VISIBLE + holder?.getView(R.id.item_recycle_seek_doctor_video)?.let { view-> + view.setTextColor(mContext.resources.getColor(R.color.text_green_BD)) + } + holder?.getView(R.id.item_recycle_seek_doctor_image_text)?.let { view-> + view.setTextColor(mContext.resources.getColor(R.color.text_green_BD)) + } + } + } + holder?.getView(R.id.item_recycle_seek_doctor_doctor_title)?.let{ + //医生名称 + it.text=bean?.title + } + holder?.getView(R.id.item_recycle_seek_doctor_doctor_hot)?.let{ + //医生名称 + if (!bean?.tfShowFire.isNullOrEmpty()){ + it.visibility=View.VISIBLE + }else{ + it.visibility=View.INVISIBLE + } + } + holder?.getView(R.id.item_recycle_seek_doctor_doctor_history)?.let{ + //医生历史咨询 + if (bean?.history.isNullOrEmpty()) { + it.visibility=View.INVISIBLE + }else{ + it.visibility=View.VISIBLE + } + } + holder?.getView(R.id.item_recycle_seek_doctor_doctor_tag)?.let{ + //医生所属医院tag + if (bean?.tag.isNullOrEmpty()) { + it.visibility=View.INVISIBLE + }else{ + it.visibility=View.VISIBLE + } + it.text=bean?.tag + } + holder?.getView(R.id.item_recycle_seek_doctor_doctor_hospital_name)?.let{ + //医生所属医院名字 + it.text=bean?.hospitalName + } + holder?.getView(R.id.item_recycle_seek_doctor_doctor_hint)?.let{ + //医生擅长描述 + it.text=bean?.hint + TextViewSpanUtil.toggleEllipsize(mContext,it,3,bean?.hint,"", R.color.red,false) + } + holder?.getView(R.id.item_recycle_seek_doctor_doctor_rate)?.let{ + //医生擅长描述 + var evaluate="0" + if (!bean?.evaluate.isNullOrEmpty()) { + evaluate= bean?.evaluate.toString() + } + if (evaluate == "null"){ + evaluate="0" + } + var guidanceNumber="0" + if (!bean?.guidanceNumber.isNullOrEmpty()) { + guidanceNumber= bean?.guidanceNumber.toString() + } + if (guidanceNumber=="null"){ + guidanceNumber="0" + } + var reply="0" + if (!bean?.reply.isNullOrEmpty()) { + reply= bean?.reply.toString() + } + if (reply=="null"){ + reply="0" + } + it.text="/综合评价:${evaluate} / 回复率:${reply} / 咨询量:${guidanceNumber}" + } + + holder?.getView(R.id.item_recycle_seek_doctor_image_text)?.let{ + if (bean?.doctorStatus!="3") { + it.setOnClickListener { + bean?.id?.let { it1 -> + startSelectConsultantActivity( + mContext, + ConstantUtils.ConsultType.IMAGE_TEXT_CONSULT, + it1 + ) + } + } + }else{ + it.setOnClickListener {} + } + } + + holder?.getView(R.id.item_recycle_seek_doctor_video)?.let{ + if (bean?.doctorStatus!="3") { + if (bean?.audioStatus == "1") { + it.setTextColor(mContext.resources.getColor(R.color.text_green_BD)) + it.setOnClickListener { + bean?.id?.let { it1 -> startSelectAppointmentTimeActivity(mContext, it1) } + } + } else { + it.setTextColor(mContext.resources.getColor(R.color.text_color_black_99)) + it.setOnClickListener {} + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorHospitalAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorHospitalAdapter.kt new file mode 100644 index 0000000..321a253 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorHospitalAdapter.kt @@ -0,0 +1,113 @@ +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?) : CommonAdapter(mContext,layoutId,datas){ + override fun convert(holder: ViewHolder?, bean: HospitalchildBean?, position: Int) { + holder?.getView(R.id.item_recycler_seek_doctor_hospital_img)?.let{ + it.loadRoundedImage(bean?.img,5f, R.drawable.ic_hospital_default) + } + holder?.getView(R.id.item_recycler_seek_doctor_hospital_tag)?.let{ + //医院等级 + it.text=bean?.tag + } + holder?.getView(R.id.item_recycler_seek_doctor_hospital_name)?.let{ + //医院名称 + it.text=bean?.name + } + holder?.getView(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(R.id.item_recycler_seek_doctor_hospital_navigation)?.let{ + it.setOnClickListener { + if (bean!=null) { + goNavigation(bean.lat, bean.lon,mContext) + } + } + } + holder?.getView(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(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)) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorSick3Adapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorSick3Adapter.kt new file mode 100644 index 0000000..22787b2 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SeekDoctorSick3Adapter.kt @@ -0,0 +1,18 @@ +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?) : CommonAdapter(mContext,layoutId,datas){ + override fun convert(holder: ViewHolder?, bean: SickListBean?, position: Int) { + holder?.getView(R.id.item_key)?.let{ + //医院名称 + it.text=bean?.sicksName + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SelectAppointmentTimeAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SelectAppointmentTimeAdapter.kt new file mode 100644 index 0000000..d18bce1 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SelectAppointmentTimeAdapter.kt @@ -0,0 +1,60 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.widget.CheckBox +import android.widget.LinearLayout +import android.widget.TextView +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.sw.healthyclients.utils.DateUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import com.xjjk.healthyclients.bean.guidance.AppointmentTimeBean + +class SelectAppointmentTimeAdapter(data: MutableList) : + BaseCheckRecycleViewAdapter( + R.layout.item_recycle_appointment_time, + data + ) { + override fun onBindViewHolder(holder: BaseViewHolder, position: Int) { + super.onBindViewHolder(holder, position) + holder.setIsRecyclable(false)//禁止复用,不然背景会乱,这里不会太多数据,懒得去看哪里漏逻辑了 + } + override fun convert(holder: BaseViewHolder, item: AppointmentTimeBean) { + holder.setText(R.id.tv_date, item.schedulingDate) + holder.setText( + R.id.tv_time, + DateUtil.getWeekStrChinese(item.week) + + context.getString( + if (item.type == "0") + R.string.select_appointment_morning + else R.string.select_appointment_afternoon + ) + ) + var statusStr: String = context.getString(R.string.select_appointment_not_appointment) + holder.getView(R.id.tv_date).isActivated = item.checked + holder.getView(R.id.tv_time).isActivated = item.checked + holder.getView(R.id.tv_status).isActivated = item.checked + holder.getView(R.id.ll_lay).isActivated = item.checked + if(!item.schedulingNum.isNullOrEmpty()){ + if (item.schedulingNum.toInt() > 0){ + if (!item.readySchedulingNum.isNullOrEmpty()){ + if(item.readySchedulingNum.toInt() < item.schedulingNum.toInt()){ + var canAppointmentNum = item.schedulingNum.toInt() - item.readySchedulingNum.toInt() + statusStr = context.getString(R.string.select_appointment_can_appointment, canAppointmentNum) + holder.itemView.isClickable = true + }else{ + statusStr = context.getString(R.string.select_appointment_appointment_full) + holder.itemView.isClickable = false + holder.getView(R.id.ll_lay).isSelected = true + } + } + }else{ + statusStr = context.getString(R.string.select_appointment_not_appointment) + holder.itemView.isClickable = false + holder.getView(R.id.ll_lay).isSelected = true + } + } + holder.setText(R.id.tv_status, statusStr) + val checkBox = holder.getView(R.id.check_box) + handleCompoundButton(checkBox, item) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SelectConsultantAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SelectConsultantAdapter.kt new file mode 100644 index 0000000..6f52264 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SelectConsultantAdapter.kt @@ -0,0 +1,180 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import android.view.ViewGroup +import androidx.core.view.ViewCompat +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.SimpleItemAnimator +import com.buddy.kredit.android.view.SpaceItemDecoration +import com.chad.library.adapter.base.module.LoadMoreModule +import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import com.xjjk.healthyclients.adapter.common.BaseDataBindingAdapter +import com.xjjk.healthyclients.bean.guidance.ArchivesBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.databinding.ItemRecycleSelectConsultantBinding +import com.xjjk.healthyclients.superfuntion.orEmptyDefault +import com.xjjk.healthyclients.superfuntion.startArchivesDetailActivity +import com.xjjk.healthyclients.utils.ConstantUtils + +/** + * @author nanfeifei + * @time 2023/5/25 18:01 + * @description + */ +class SelectConsultantAdapter: BaseDataBindingAdapter( + R.layout.item_recycle_select_consultant +), LoadMoreModule { + var consultType: ConstantUtils.ConsultType? = null + var doctorId: String? = null + var appointmentTimeId: String? = null + var adapterMap = mutableMapOf() + override fun onCreateDefViewHolder( + parent: ViewGroup, + viewType: Int + ): BaseDataBindingHolder { + return super.onCreateDefViewHolder(parent, viewType) + } + + override fun bindViewClickListener( + viewHolder: BaseDataBindingHolder, + viewType: Int + ) { + addChildClickViewIds(R.id.tv_add_archives) + super.bindViewClickListener(viewHolder, viewType) + } + + override fun onItemViewHolderCreated( + viewHolder: BaseDataBindingHolder, + viewType: Int + ) { + super.onItemViewHolderCreated(viewHolder, viewType) + viewHolder.dataBinding?.let { + val linearLayoutManager = LinearLayoutManager(context) + it.rvArchivesList.layoutManager = linearLayoutManager + it.rvArchivesList.addItemDecoration(SpaceItemDecoration(context, 0, 8f)) + var itemAnimator = it.rvArchivesList.itemAnimator + if (itemAnimator is SimpleItemAnimator){ + itemAnimator.supportsChangeAnimations = false + } + ViewCompat.setNestedScrollingEnabled(it.rvArchivesList, false) + } + } + + override fun convert( + holder: BaseDataBindingHolder, + item: ConsultantBean, + payloads: List + ) { + super.convert(holder, item, payloads) + setViewDate(holder, item, payloads) + } + override fun convert( + holder: BaseDataBindingHolder, + item: ConsultantBean + ) { + setViewDate(holder, item, null) + } + + /** + * 因BaseQuickAdapter封装和原生Adapter问题带或者不带payloads的convert方法只走一个,所以需要拆离出来处理 + */ + private fun setViewDate(holder: BaseDataBindingHolder, + item: ConsultantBean, + payloads: List?){ + val mBinding = holder.dataBinding + mBinding?.let { + mBinding.tvName.text = item.name + mBinding.tvAge.text = context.getString(R.string.select_consultant_age, item.age) + mBinding.tvAge.setCompoundDrawablesWithIntrinsicBounds(0, 0, if ("1" == item.gender) R.drawable.icon_woman else R.drawable.icon_man, 0) + mBinding.tvHeightWeight.text = context.getString(R.string.select_consultant_height_weight, item.height.orEmptyDefault(), item.weight.orEmptyDefault()) + var mAdapter = adapterMap[getItemPosition(item)] + if(mAdapter == null){ + mAdapter = SelectConsultantChildAdapter(item.list) + mAdapter.enabledCheckMode = true + mAdapter.singleMode = true + mAdapter.singleModeIsCanCancel = true + mAdapter.setOnItemChildClickListener { adapter, view, position -> + if (R.id.btn_check == view?.id) { + if (!item.checked){ + resetChecked() + item.checked = true + } + (adapter as BaseCheckRecycleViewAdapter).clickItem(position, false) + } + } + mAdapter.setOnItemClickListener { adapter, view, position -> + if (consultType == null){ + throw Exception("consultType is null,跳转咨询详情需要传入咨询类型") + } + startArchivesDetailActivity(context= context, + consultType = consultType!!, doctorId = doctorId, appointmentTimeId = appointmentTimeId, archivesId = (adapter.getItem(position) as ArchivesBean?)?.id, consultantBean = item) + } + adapterMap[getItemPosition(item)] = mAdapter + }else{ + if (payloads.isNullOrEmpty()){ + mAdapter.setList(item.list) + }else{ + payloads.forEach { + mAdapter.notifyItemChanged(it as Int) + } + } + } + mBinding.rvArchivesList.adapter = mAdapter + } + } + + override fun setNewInstance(list: MutableList?) { + adapterMap.clear() + super.setNewInstance(list) + } + override fun setList(list: Collection?) { + adapterMap.clear() + super.setList(list) + } + + /** + * 重置子列表选中项 + */ + private fun resetChecked() { + if (data.isNullOrEmpty()) { + return + } + data.forEachIndexed { index, consultantBean -> + if (consultantBean.checked){ + consultantBean.checked = false + consultantBean.list?.forEachIndexed { childIndex, archivesBean -> + if (archivesBean.checked){ + archivesBean.checked = false + notifyItemChanged(index, childIndex) + } + } + + } + } + } + /** + * 获取选中的档案 + */ + fun getCheckedArchives(): ArchivesBean? { + if (data.isNullOrEmpty()) { + return null + } + data.forEach { consultantBean -> + if (consultantBean.checked){ + consultantBean.list?.forEach { archivesBean -> + if (archivesBean.checked){ + archivesBean.memberId = consultantBean.id + archivesBean.name = consultantBean.name.orEmpty() + archivesBean.gender = consultantBean.gender + archivesBean.age = consultantBean.age + archivesBean.isSelf = consultantBean.isSelf() + return archivesBean + } + } + + } + } + return null + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SelectConsultantChildAdapter.kt b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SelectConsultantChildAdapter.kt new file mode 100644 index 0000000..bc677fc --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/activity/guidance/adapter/SelectConsultantChildAdapter.kt @@ -0,0 +1,24 @@ +package com.xjjk.healthyclients.ui.activity.guidance.adapter + +import com.chad.library.adapter.base.module.LoadMoreModule +import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.BaseCheckRecycleViewAdapter +import com.xjjk.healthyclients.bean.guidance.ArchivesBean + +class SelectConsultantChildAdapter(data: MutableList?) : + BaseCheckRecycleViewAdapter( + R.layout.item_recycle_select_consultant_child, + data + ), LoadMoreModule { + override fun bindViewClickListener(viewHolder: BaseViewHolder, viewType: Int) { + addChildClickViewIds(R.id.btn_check) + super.bindViewClickListener(viewHolder, viewType) + } + override fun convert(holder: BaseViewHolder, item: ArchivesBean) { + holder.setText(R.id.tv_archives_title, item.recordsName) + holder.setText(R.id.tv_archives_intro, item.medicalDescribe) + this@SelectConsultantChildAdapter.handleCompoundButton(holder.getView(R.id.check_manager), item) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/AddBigDiseaseViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/AddBigDiseaseViewModel.kt new file mode 100644 index 0000000..a774eec --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/AddBigDiseaseViewModel.kt @@ -0,0 +1,70 @@ +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()) + var registerType = MutableStateFlow(mutableListOf()) + 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 = { + } + ) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/AppointmentInformationViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/AppointmentInformationViewModel.kt new file mode 100644 index 0000000..d9e289f --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/AppointmentInformationViewModel.kt @@ -0,0 +1,117 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.xjjk.healthyclients.bean.guidance.AppraiseBean +import com.sw.healthyclients.data.local.DataStoreManager +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.guidance.AppointmentInformationBean +import com.xjjk.healthyclients.bean.user.PhysicalHistoryInfoBean +import com.xjjk.healthyclients.data.repository.DoctorRepository +import com.xjjk.healthyclients.data.repository.GuidanceRepository +import com.xjjk.healthyclients.event.AppraiseFinishEvent +import com.xjjk.healthyclients.event.FollowDoctorEvent +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableStateFlow +import org.greenrobot.eventbus.EventBus + +class AppointmentInformationViewModel: BaseViewModel() { + var appointmentInformationBean = MutableStateFlow(AppointmentInformationBean()) + var appraiseList = MutableStateFlow(mutableListOf()) + var appointmentId = MutableStateFlow("") + var physicalExaminationReportBean = MutableStateFlow(null) + var followStatus = MutableStateFlow(false) + private var doctorId: String? = "" + private var sessionId: String? = "" + var cardNo: String = "" + override fun init() { + } + fun getAppointmentInformation(){ + launch( + { + handleRequest(GuidanceRepository.getAppointmentDetail(appointmentId.value), successBlock = { + it.result?.let { result -> + appointmentInformationBean.emit(result) + doctorId = result.conDoctorDO?.id + sessionId = result.conSession?.id + followStatus.emit("1" == result.conDoctorDO?.tfFollow ?: false) + result.conMedicalRecordsListDO?.let { + if("1" == result.conMedicalRecordsListDO!!.tfPermission){ + result.idNo?.let { idNo -> + cardNo = idNo + getPhysicalExaminationReport(idNo) + } + } + } + } + }) + } + ) + } + private fun getPhysicalExaminationReport(cardNum: String){ + if(cardNum.isNullOrEmpty()){ + return + } + launch(false, { + handleRequest( + GuidanceRepository.getPhysicalExaminationReport("1","100", + DataStoreManager.getUserId()!!), successBlock = { + it.result?.let { data -> + if(data.records.size>0){ + var bean= PhysicalHistoryInfoBean() + bean.id=data.records[0].id + bean.card=data.records[0].card + bean.hospitalName=data.records[0].hospitalName + bean.year=data.records[0].medicalYear + bean.name=data.records[0].userName + bean.birthday="" + bean.peQueueDate=data.records[0].peQueueDate + bean.sex=data.records[0].sex + try { + bean.age=data.records[0].age + } catch (e: Exception) { + } + physicalExaminationReportBean.emit(bean) + }else{ + physicalExaminationReportBean.emit(null) + } + } + + }) + }) + } + fun followDoctor(){ + launch({ + if(!followStatus.value){ + handleRequest(DoctorRepository.followDoctor(doctorId), successBlock = { + toastMessage.emit(it.message) + followStatus.emit(true) + EventBus.getDefault().post(FollowDoctorEvent(followStatus.value)) + }) + }else{ + handleRequest(DoctorRepository.cancelFollowDoctor(doctorId), successBlock = { + toastMessage.emit(it.message) + followStatus.emit(false) + EventBus.getDefault().post(FollowDoctorEvent(followStatus.value)) + }) + } + + }) + } + fun cancelAppointment(){ + launch({ + handleRequest(GuidanceRepository.cancelAppointment(appointmentId.value), successBlock = { + toastMessage.emit(it.message) + getAppointmentInformation() + }) + }) + } + fun submitAppraise(score: Float, content: String, anonymity: Boolean){ + launch({ + handleRequest(GuidanceRepository.submitConsultAppraise(doctorId, sessionId, score, content, anonymity), successBlock = { + toastMessage.emit(it.message) + getAppointmentInformation() + EventBus.getDefault().post(AppraiseFinishEvent()) + }) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/ArchivesDetailViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/ArchivesDetailViewModel.kt new file mode 100644 index 0000000..f8fda46 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/ArchivesDetailViewModel.kt @@ -0,0 +1,222 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import android.text.TextUtils +import androidx.lifecycle.viewModelScope +import com.sw.healthyclients.bean.guidance.ConsultDoctorIMChatInfo +import com.xjjk.healthyclients.MyApplication.Companion.appContext +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.CommonSettingMenuBean +import com.xjjk.healthyclients.bean.ImageBean +import com.xjjk.healthyclients.bean.guidance.ArchivesBean +import com.xjjk.healthyclients.data.repository.CommonRepository +import com.xjjk.healthyclients.data.repository.ConsultantManagerRepository +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.launch + +/** + * @author nanfeifei + * @time 2023/6/7 18:15 + * @description + */ +class ArchivesDetailViewModel : BaseViewModel() { + var diseaseDurationList = MutableStateFlow(mutableListOf()) + var haveDoctorList = MutableStateFlow(mutableListOf()) + var physicalExaminationReportList = MutableStateFlow(mutableListOf()) + var archivesBean = MutableStateFlow(ArchivesBean()) + var imageList = MutableStateFlow(mutableListOf()) + var memberId = MutableStateFlow("") + var noEdit = MutableStateFlow(false) + override fun init() { + getMedicalHaveTimeList() + getPhysicalExaminationReportList() + getLookMedicalList() + } + + fun getMedicalHaveTimeList() { + launch({ + handleRequest(ConsultantManagerRepository.getMedicalHaveTimeList(), successBlock = { + it.result?.let { it1 -> diseaseDurationList.emit(it1) } + }) + }) + } + + fun getPhysicalExaminationReportList() { + launch({ + handleRequest( + ConsultantManagerRepository.getPhysicalExaminationReportList(), + successBlock = { + it.result?.let { it1 -> physicalExaminationReportList.emit(it1) } + }) + }) + } + + fun getLookMedicalList() { + launch({ + handleRequest(ConsultantManagerRepository.getLookMedicalList(), successBlock = { + it.result?.let { it1 -> haveDoctorList.emit(it1) } + }) + }) + } + + fun addArchives(imageList: MutableList, successCall: () -> Unit = {}) { + if (archivesBean.value == null) { + return + } + viewModelScope.launch { + if (archivesBean.value.recordsName.isNullOrEmpty()) { + toastMessage.emit( + appContext.getString(R.string.archives_detail_archives_name_hint) + ) + return@launch + } + if (archivesBean.value.haveTime.isNullOrEmpty()||"-1"== archivesBean.value.haveTime) { + toastMessage.emit( + appContext + .getString(R.string.archives_detail_question_disease_duration_hint) + ) + return@launch + } + if (archivesBean.value.medicalDescribe.isNullOrEmpty()) { + toastMessage.emit( + appContext + .getString(R.string.archives_detail_question_for_consult_hint) + ) + return@launch + } + if (archivesBean.value.tfLook.isNullOrEmpty()||"-1"== archivesBean.value.tfLook) { + toastMessage.emit( + appContext + .getString(R.string.archives_detail_question_have_doctor_hint) + ) + return@launch + } else { + if ("1" == archivesBean.value.tfLook) {//就诊过对应value为1,此处要求后台不能随意调整value,如出错检查后台分会配置 +// if (archivesBean.value.lookOffice.isNullOrEmpty()) { +// toastMessage.emit( +// appContext +// .getString(R.string.archives_detail_hospital_hint) +// ) +// return@launch +// } +// if (archivesBean.value.lookMedicalName.isNullOrEmpty()) { +// toastMessage.emit( +// appContext +// .getString(R.string.archives_detail_disease_hint) +// ) +// return@launch +// } + } else { + archivesBean.value.lookOffice = "" + archivesBean.value.lookMedicalName = "" + } + } + if (archivesBean.value.desire.isNullOrEmpty()) { + toastMessage.emit( + appContext + .getString(R.string.archives_detail_question_for_help_hint) + ) + return@launch + } + if (archivesBean.value.tfPermission.isNullOrEmpty()||"-1"== archivesBean.value.tfPermission) { + toastMessage.emit( + appContext + .getString(R.string.archives_detail_question_physical_examination_report_hint) + ) + return@launch + } + uploadImageList(imageList, successCall = { imageStr -> + archivesBean.value.image = imageStr + archivesBean.value.memberId = memberId.value + launch({ + handleRequest( + ConsultantManagerRepository.addArchives(archivesBean.value), + successBlock = { + toastMessage.emit(it.message) + successCall.invoke() + }) + }) + }) + } + } + + private fun uploadImageList(imageList: MutableList, successCall: (String) -> Unit = {}) { + var noUploadImageList = mutableListOf() + var hasUploadImageList = mutableListOf() + imageList.forEach { + if (it.isFilePath){ + noUploadImageList.add(it.imageUrl) + }else{ + hasUploadImageList.add(it.imageUrl) + } + } + launch({ + if(noUploadImageList.isNullOrEmpty()){ + return@launch + } + handleRequest(CommonRepository.uploadFile(noUploadImageList, "consult"), successBlock = { + if (it.result.isNullOrEmpty()) { + } else { + hasUploadImageList.addAll(it.result!!) + } + }, errorBlock = { + false + }) + }, finallyBlock = { + successCall.invoke(imageListToStr(hasUploadImageList)) + }) + } + + private fun imageListToStr(list: MutableList): String { + return TextUtils.join(",", list) + } + + fun getArchivesDetail(id: String) { + launch({ + handleRequest(ConsultantManagerRepository.getArchivesDetail(id), successBlock = { + it.result?.let { it1 -> + archivesBean.emit(it1) + imageList.emit(imageStrToImageList(it1.image)) + } + }) + }) + } + + private fun imageStrToImageList(imageStr: String): MutableList { + var imageList = mutableListOf() + var list = imageStr.split(",") + var imageBean: ImageBean + list.forEach { + if (it.isNotEmpty()){ + imageBean = ImageBean(it) + imageList.add(imageBean) + } + } + return imageList + } + + fun submitAudioVideoAppointment(doctorId: String, dateId: String, successCall: (String) -> Unit = {}) { + launch({ + handleRequest( + ConsultantManagerRepository.submitAudioVideoConsultApply( + doctorId, + memberId.value, + archivesBean.value.id, + dateId + ), successBlock = { + toastMessage.emit(it.message) + it.result?.let { it1 -> successCall.invoke(it1) } + }) + }) + } + fun submitImageTextConsultantApply(doctorId: String?, successCall: (ConsultDoctorIMChatInfo) -> Unit = {}){ + launch({ + handleRequest(ConsultantManagerRepository.submitImageTextConsultApply(doctorId, memberId.value, archivesBean.value.id), successBlock = { +// toastMessage.emit(it.message) + it.result?.let { it1 -> successCall.invoke(it1) } + }) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/BaseHealthyInfoAddViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/BaseHealthyInfoAddViewModel.kt new file mode 100644 index 0000000..f127b56 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/BaseHealthyInfoAddViewModel.kt @@ -0,0 +1,123 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.google.gson.JsonObject +import com.xjjk.healthyclients.MyApplication +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.guidance.BaseHealthyInfoChildBean +import com.xjjk.healthyclients.bean.guidance.BaseHealthyInfoResultBean +import com.xjjk.healthyclients.bean.guidance.HealthyInfoRadioBean +import com.xjjk.healthyclients.data.repository.ConsultantManagerRepository +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.jsonToBean +import com.xjjk.healthyclients.superfuntion.launch +import com.xjjk.healthyclients.superfuntion.toJson +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.launch + +/** + * @author nanfeifei + * @time 2023/6/21 10:00 + * @description + */ +class BaseHealthyInfoAddViewModel: BaseViewModel() { + var healthyInfoList = MutableStateFlow(mutableListOf()) + var memberId: String? = null + override fun init() { + + } + fun getBaseHealthyInfoSettingList(memberId: String?){ + this.memberId = memberId + launch({ + handleRequest(ConsultantManagerRepository.getBaseHealthyInfoSettingList(memberId), successBlock = { + it.result?.let { result -> + healthyInfoList.emit(resultListToChildList(result)) + } + }) + }) + } + private fun resultListToChildList(list: MutableList): MutableList{ + var childList = mutableListOf() + list.forEach { + if (it != null){ + var bean = BaseHealthyInfoChildBean() + bean.headerName = it.text + bean.isHeader = true + childList.add(bean) + if (!it.childList.isNullOrEmpty()){ + it.childList.forEachIndexed { index, baseHealthyInfoChildBean -> + if (index == 0){ + baseHealthyInfoChildBean.hideLine = true + } + baseHealthyInfoChildBean.memberId = memberId + baseHealthyInfoChildBean.answerList = answerToList(baseHealthyInfoChildBean) + childList.add(baseHealthyInfoChildBean) + } + } + } + } + return childList + } + private fun answerToList(item: BaseHealthyInfoChildBean): MutableList { + if (item.answerList.isNotEmpty()){ + return item.answerList + } + var jsonObject: JsonObject = item.itemOptions.jsonToBean(JsonObject::class.java) + var set = jsonObject.keySet() + var list = mutableListOf() + var healthyInfoRadioBean: HealthyInfoRadioBean + for (index in set.indices) { + var key = set.elementAt(index) + val value = jsonObject.get(key) + healthyInfoRadioBean = HealthyInfoRadioBean( + key, + if ("是" == key || "有" == key) item.answerContent else "", + value.toString().replace("\"", ""), + item.type.toInt(), + "1" == value.toString().replace("\"", "") + ) + list.add(healthyInfoRadioBean) + } + return list + } + fun submitBaseHealthInfo(list: MutableList, successCall: () -> Unit = {}){ + if (list.isNullOrEmpty()){ + return + } + var allChecked = true + var responseList: MutableList = mutableListOf() + list.forEachIndexed { index, baseHealthyInfoChildBean -> + if (!baseHealthyInfoChildBean.answerList.isNullOrEmpty()){ + var map = HashMap() + var hasChecked = false + baseHealthyInfoChildBean.answerList.forEach { healthyInfoRadioBean -> + map[healthyInfoRadioBean.radioText] = if (healthyInfoRadioBean.checked) "1" else "0" + if (healthyInfoRadioBean.checked){ + hasChecked = true + } + if (!healthyInfoRadioBean.explain.isNullOrEmpty()&&healthyInfoRadioBean.checked){ + baseHealthyInfoChildBean.answerContent = healthyInfoRadioBean.explain + }else{ + baseHealthyInfoChildBean.answerContent = "" + } + } + if (!hasChecked){ + allChecked = false + exception.value = Exception(MyApplication.appContext.getString(R.string.base_healthy_info_add_input_hint, baseHealthyInfoChildBean.itemProblem)) + return + } + baseHealthyInfoChildBean.itemOptions = map.toJson() + } + if (!baseHealthyInfoChildBean.isHeader){ + responseList.add(baseHealthyInfoChildBean) + } + } + launch({ + handleRequest(ConsultantManagerRepository.submitBaseHealthInfo(responseList), successBlock = { + toastMessage.emit(it.message) + successCall.invoke() + }) + }) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/ConsultArchivesDetailViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/ConsultArchivesDetailViewModel.kt new file mode 100644 index 0000000..2a8f52b --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/ConsultArchivesDetailViewModel.kt @@ -0,0 +1,54 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.sw.healthyclients.bean.guidance.HealthInfoBean +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.ImageBean +import com.xjjk.healthyclients.bean.guidance.ArchivesBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.data.repository.GuidanceRepository +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableStateFlow + +/** + * @author nanfeifei + * @time 2023/5/4 18:52 + * @description + */ +class ConsultArchivesDetailViewModel: BaseViewModel() { + var answer: MutableStateFlow?> = MutableStateFlow(mutableListOf()) + var archivesBean = MutableStateFlow(ArchivesBean(recordsName = "dfsdfsdf")) + var consultantBean = MutableStateFlow(ConsultantBean()) + var imageList = MutableStateFlow(mutableListOf()) + override fun init() { + + } + fun getArchivesDetail(archivesId: String){ + launch({ + handleRequest(GuidanceRepository.getConsultArchivesDetail(archivesId), successBlock = { + it.result?.let { result -> + if (result.conMedicalRecordsDO != null){ + archivesBean.emit(result.conMedicalRecordsDO) + imageList.emit(imageStrToImageList(result.conMedicalRecordsDO!!.image)) + } + if(result.conFamilyMembersDO != null){ + consultantBean.emit(result.conFamilyMembersDO) + } + answer.emit(result.answer) + } + }) + }) + } + private fun imageStrToImageList(imageStr: String): MutableList { + var imageList = mutableListOf() + var list = imageStr.split(",") + var imageBean: ImageBean + list.forEach { + if (it.isNotEmpty()){ + imageBean = ImageBean(it) + imageList.add(imageBean) + } + } + return imageList + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/ConsultantManagerViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/ConsultantManagerViewModel.kt new file mode 100644 index 0000000..cd027bb --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/ConsultantManagerViewModel.kt @@ -0,0 +1,62 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.data.repository.ConsultantManagerRepository +import com.xjjk.healthyclients.event.ConsultantManagerEvent +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import org.greenrobot.eventbus.EventBus + +class ConsultantManagerViewModel: BaseViewModel() { + var consultantManagerList = MutableStateFlow?>(null) + var isRefreshing = MutableStateFlow(false) //如果需要下拉刷新监听此Flow更改刷新组件状态 + var isLoadMoreEnd = MutableSharedFlow() + var darkStyle = MutableStateFlow(false) + private val pageSize = Int.MAX_VALUE + var pageIndex = 1 + override fun init() { + } + fun getConsultantManagerList(isRefresh: Boolean){ + launch(tryBlock = { + if (isRefresh) { + isRefreshing.emit(true) + isLoadMoreEnd.emit(false) + pageIndex = 1 + } + handleRequest(ConsultantManagerRepository.getConsultantManagerData(pageIndex, pageSize), successBlock = { + if (it.result.isNullOrEmpty()) { + isLoadMoreEnd.emit(true) + consultantManagerList.emit(mutableListOf()) + } else { + consultantManagerList.emit(it.result!!) + pageIndex++ + if (it.result!!.size < pageSize) { + isLoadMoreEnd.emit(true) + } + } + }) + }, finallyBlock = { + isRefreshing.emit(false) + }) + } + fun deleteConsultant(consultantList: MutableList){ + if (consultantList.isNullOrEmpty()){ + return + } + launch({ + handleRequest(ConsultantManagerRepository.deleteConsultant(getConsultantIdListByConsultantList(consultantList)), successBlock = { + EventBus.getDefault().post(ConsultantManagerEvent()) + }) + }) + } + private fun getConsultantIdListByConsultantList(consultantList: MutableList): MutableList{ + var idList = mutableListOf() + consultantList.forEach { + it.id?.let { id -> idList.add(id) } + } + return idList + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DepartmentSearchViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DepartmentSearchViewModel.kt new file mode 100644 index 0000000..727d941 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DepartmentSearchViewModel.kt @@ -0,0 +1,120 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.amap.api.col.`3l`.it +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()) //科室列表 + var mDepartmentSoureState = MutableSharedFlow() + var mDataSoure=MutableStateFlow(ArrayList()) //医院 + var mDiseaseSoure=MutableStateFlow(arrayListOf()) //疾病 + var mDiseaseSoureState = MutableSharedFlow() + var titleText = MutableStateFlow("") + var mHospitalSoure=MutableStateFlow(ArrayList()) //医院列表 + override fun init() { +// selectDoctorRecommend() + } + + /** + * 疾病搜索 + */ + fun searchconSicksList(value:String){ + launch( + { + handleRequest( + GuidanceRepository.searchconSicksList(value,pag,pagNumber), + successBlock = { + it.result?.let{ result -> + var disease= arrayListOf() + 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() + 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() + 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) + } + } + }) + } + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DoctorAllAppraiseViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DoctorAllAppraiseViewModel.kt new file mode 100644 index 0000000..e61f6c2 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DoctorAllAppraiseViewModel.kt @@ -0,0 +1,59 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.sw.healthyclients.bean.guidance.DoctorBean +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.guidance.AppraiseBean +import com.xjjk.healthyclients.data.repository.DoctorRepository +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/6/12 18:48 + * @description + */ +class DoctorAllAppraiseViewModel: BaseViewModel() { + var appraiseList = MutableStateFlow(mutableListOf()) + var pageIndex = MutableStateFlow(1) + var isRefreshing = MutableStateFlow(false) + var isLoadMoreEnd = MutableSharedFlow() + var doctorId = MutableStateFlow(null) + var doctorBean = MutableStateFlow(null) + private val pageSize = 20 + override fun init() { + + } + fun getAppraiseList(isRefresh: Boolean){ + launch(tryBlock = { + if(isRefresh){ + isRefreshing.emit(true) + isLoadMoreEnd.emit(false) + pageIndex.emit(1) + } + handleRequest(DoctorRepository.getDoctorAppraise(doctorId.value, pageIndex.value, pageSize), successBlock = { + if (it.result.isNullOrEmpty()) { + isLoadMoreEnd.emit(true) + appraiseList.emit(mutableListOf()) + } else { + appraiseList.emit(it.result!!) + pageIndex.value++ + if (it.result!!.size < pageSize) { + isLoadMoreEnd.emit(true) + } + } + }) + + }, finallyBlock = { + isRefreshing.emit(false) + }) + } + fun getDoctorAppraiseData(){ + launch({ + handleRequest(DoctorRepository.getDoctorAppraiseData(doctorId.value), successBlock = { + doctorBean.emit(it.result) + }) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DoctorHomepageViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DoctorHomepageViewModel.kt new file mode 100644 index 0000000..b018032 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DoctorHomepageViewModel.kt @@ -0,0 +1,81 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.sw.healthyclients.bean.guidance.DoctorBean +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.guidance.AppraiseBean +import com.xjjk.healthyclients.data.repository.CommonRepository +import com.xjjk.healthyclients.data.repository.DoctorRepository +import com.xjjk.healthyclients.event.UserNoticeBean +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableStateFlow + +/** + * @author nanfeifei + * @time 2023/5/5 18:34 + * @description + */ +class DoctorHomepageViewModel: BaseViewModel() { + var appraiseList = MutableStateFlow(mutableListOf()) + var doctorBean = MutableStateFlow(null) + var followStatus = MutableStateFlow(false) + var noticeBean = MutableStateFlow(UserNoticeBean()) + override fun init() { + + } + fun getDoctorInfo(doctorId: String?){ + launch({ + handleRequest(DoctorRepository.getDoctorInfo(doctorId), successBlock = { + it.result?.let { it1 -> + doctorBean.emit(it1) + followStatus.emit("1" == it1.tfFollow) + } + }) + }) + } + fun getAppraiseList(doctorId: String?){ + launch({ + handleRequest(DoctorRepository.getDoctorAppraise(doctorId, 1, 4), successBlock = { + it.result?.let { it1 -> appraiseList.emit(it1) } + }) + + }) + } + fun followDoctor(doctorId: String?){ + launch({ + if(!followStatus.value){ + handleRequest(DoctorRepository.followDoctor(doctorId), successBlock = { + toastMessage.emit(it.message) + followStatus.emit(true) + }) + }else{ + handleRequest(DoctorRepository.cancelFollowDoctor(doctorId), successBlock = { + toastMessage.emit(it.message) + followStatus.emit(false) + }) + } + + }) + } + fun selectUserNotice(type:String) { + launch( + { + handleRequest( + CommonRepository.selectUserNotice(type), + successBlock = { + if (it.result==null) { + var bean = UserNoticeBean() + bean.isRead=1 + noticeBean.emit(bean) + }else{ + it.result?.let { result -> + result.isRead=2 + noticeBean.emit(result) + } + } + }) + } + ) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DoctorsGuidanceViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DoctorsGuidanceViewModel.kt new file mode 100644 index 0000000..1b10e41 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/DoctorsGuidanceViewModel.kt @@ -0,0 +1,57 @@ +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()) //疾病 + + + override fun init() { + } + + fun selectDictListBySickAndDepartment(officeIds:ArrayList,sicksIds:ArrayList) { + launch( + { + handleRequest( + GuidanceRepository.selectDictListBySickAndDepartment(officeIds,sicksIds), + successBlock = { + it.result?.let{result -> + //疾病 + var doctorList= arrayListOf() + 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("请求结束了") + }) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EditConsultantViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EditConsultantViewModel.kt new file mode 100644 index 0000000..c4e6017 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EditConsultantViewModel.kt @@ -0,0 +1,75 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.xjjk.healthyclients.MyApplication.Companion.appContext +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.CommonSettingMenuBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.data.repository.ConsultantManagerRepository +import com.xjjk.healthyclients.event.ConsultantManagerEvent +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableStateFlow +import org.greenrobot.eventbus.EventBus + +class EditConsultantViewModel: BaseViewModel() { + var consultantBean = MutableStateFlow(ConsultantBean()) + var relationList = MutableStateFlow(mutableListOf()) + override fun init() { + getRelationList() + } + private fun getRelationList(){ + launch({ + handleRequest(ConsultantManagerRepository.getMemberRelationList(), successBlock = { + it.result?.let { it1 -> + relationList.emit(it1) + } + }) + }) + } + + /** + *@param successCall 成功的函数,函数参数为true,代表需要弹窗补充基本健康信息 + */ + fun editConsultant(successCall: (Boolean, String) -> Unit = { isShowDialog: Boolean, id: String -> }){ + launch({ + if (consultantBean.value.name.isNullOrEmpty()){ + exception.value = Exception(appContext.getString(R.string.consult_information_consult_people_name_empty)) + return@launch + } + if(consultantBean.value.gender.isNullOrEmpty()){ + exception.value = Exception(appContext.getString(R.string.consult_information_consult_people_gender_empty)) + return@launch + } + if (consultantBean.value.birthdayLong == 0L){ + exception.value = Exception(appContext.getString(R.string.consult_information_consult_people_age_empty)) + return@launch + } + if (consultantBean.value.height.isNullOrEmpty()){ + exception.value = Exception(appContext.getString(R.string.consult_information_consult_people_height_empty)) + return@launch + } + if (consultantBean.value.weight.isNullOrEmpty()){ + exception.value = Exception(appContext.getString(R.string.consult_information_consult_people_weight_empty)) + return@launch + } + if (consultantBean.value.familyRelation.isNullOrEmpty()){ + exception.value = Exception("") + return@launch + } + if(consultantBean.value.id.isNullOrEmpty()){ + handleRequest(ConsultantManagerRepository.addConsultant(consultantBean.value), successBlock = { +// toastMessage.emit(it.message) + EventBus.getDefault().post(ConsultantManagerEvent()) + it.result?.let { id -> successCall.invoke(true, id) } + }) + }else{ + handleRequest(ConsultantManagerRepository.updateConsultant(consultantBean.value), successBlock = { + toastMessage.emit(it.message) + EventBus.getDefault().post(ConsultantManagerEvent()) + it.result?.let { id -> successCall.invoke(false, id) } + }) + } + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EmergencySeekDoctorDetailsViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EmergencySeekDoctorDetailsViewModel.kt new file mode 100644 index 0000000..07dc1ce --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EmergencySeekDoctorDetailsViewModel.kt @@ -0,0 +1,55 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.emergency.GetOrderBySessionIdBean +import com.xjjk.healthyclients.bean.emergency.OrderThroughBean +import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean +import com.xjjk.healthyclients.data.repository.EmergencyRepository +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import okhttp3.RequestBody.Companion.toRequestBody + + +class EmergencySeekDoctorDetailsViewModel : BaseViewModel() { + var mSummarizeBean = MutableStateFlow(OrderThroughBean()) + var mOrderInfoBean = MutableStateFlow(GetOrderBySessionIdBean()) + var mList = MutableStateFlow(mutableListOf()) + + override fun init() { + + } + + + fun orderThrough(id:String) { + launch(tryBlock = { + handleRequest( + EmergencyRepository.orderThrough(id), + successBlock = { + it.result?.let { result -> + mSummarizeBean.emit(result) + } + }) + }, finallyBlock = { + } + + ) + } + + fun getOrderBySessionId(sessionId:String) { + launch(tryBlock = { + handleRequest( + EmergencyRepository.getOrderBySessionId(sessionId), + successBlock = { + it.result?.let { result -> + mOrderInfoBean.emit(result) + } + }) + }, finallyBlock = { + } + + ) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EmergencySeekDoctorViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EmergencySeekDoctorViewModel.kt new file mode 100644 index 0000000..e176369 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EmergencySeekDoctorViewModel.kt @@ -0,0 +1,62 @@ +package com.xjjk.healthyclients.ui.viewmodel + + +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.emergency.BigDiseaseDetailsBean +import com.xjjk.healthyclients.bean.emergency.initUserOrderPageBean +import com.xjjk.healthyclients.data.repository.EmergencyRepository +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import okhttp3.RequestBody.Companion.toRequestBody + + +class EmergencySeekDoctorViewModel : BaseViewModel() { + var mBean = MutableStateFlow(BigDiseaseDetailsBean()) + var mList = MutableStateFlow(mutableListOf()) + var isRefreshing = MutableStateFlow(false) + var isLoadMoreEnd = MutableSharedFlow() + private val pageSize = 20 + var pageIndex = MutableStateFlow(1) + + override fun init() { + + } + + + fun initUserOrderPage(isRefresh: Boolean) { + launch(tryBlock = { + if (isRefresh) { + isRefreshing.emit(true) + pageIndex.emit(1) + } + + handleRequest( + EmergencyRepository.initUserOrderPage(pageIndex.value, pageSize), + successBlock = { + it.result?.let { result -> + if(result==null){ + isLoadMoreEnd.emit(true) + mList.emit(arrayListOf()) + }else{ + //医院 + mList.emit(result.records) + pageIndex.value++ + if(it.result!!.size < pageSize){ + isLoadMoreEnd.emit(true) + }else{ + isLoadMoreEnd.emit(false) + } + } + + } + }) + }, finallyBlock = { + isRefreshing.emit(false) + } + + ) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EmergencyViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EmergencyViewModel.kt new file mode 100644 index 0000000..720905e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/EmergencyViewModel.kt @@ -0,0 +1,198 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import InterventionRepository +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo +import com.xjjk.healthyclients.bean.emergency.LocationResourceBean +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 + +/** + * @author nanfeifei + * @time 2023/5/8 10:47 + * @description + */ +class EmergencyViewModel : BaseViewModel() { + companion object { + const val CALL_TYPE_MOBILE = "0" + const val CALL_TYPE_CHAT = "1" + } + + // var titleList = MutableStateFlow(mutableListOf()) + var markList = MutableStateFlow(mutableListOf()) + var sessionId = MutableStateFlow("") + + override fun init() { + + } + + fun getEmergencyData(type: String, latitude: Double, longitude: Double) { + launch( + { + handleRequest( + EmergencyRepository.getEmergencyData(type, latitude, longitude), + successBlock = { +// it.result?.dicts?.let { list -> titleList.emit(list) } + it.result?.resources?.let { list -> markList.emit(list) } + it.result?.sessionId?.let { it1 -> sessionId.emit(it1) } + }) + } + ) + } + + fun getEmergencyCall( + callType: String, + resourceId: String, + longitude: Double, + latitude: Double + ) { + launch( + { + handleRequest( + EmergencyRepository.getEmergencyCall(callType, resourceId, longitude, latitude), + successBlock = { + + }) + } + ) + } + + fun getEmergencyCallBack( + orderId: String, + sessionId: String, + operationUserId: String, + majorUserId: String + ) { + launch( + { + handleRequest( + EmergencyRepository.getEmergencyCallBack( + orderId, + sessionId, + operationUserId, + majorUserId + ) + ) + } + ) + } + + fun getEmergencyCallOver(sessionId: String) { + launch({ + handleRequest(EmergencyRepository.getEmergencyCallOver(sessionId)) + }) + } + + fun getIMGroupInfo( + groupName: String, longitude: Double, + latitude: Double, successCall: (EmergencyGroupInfo) -> Unit = {} + ) { + launch({ + handleRequest( + EmergencyRepository.getIMGroupInfo(groupName, longitude, latitude), + successBlock = { + it.result?.let { it1 -> + successCall.invoke(it1) + } + }) + }) + } + + /** + * 附近医疗点 + */ + fun nearbyResource(latitude: Double, longitude: Double, resourceNum: Int) { + launch( + { + handleRequest( + InterventionRepository.nearbyResource( + "", + longitude, + latitude, resourceNum + ), + successBlock = { + val mutableListOf = mutableListOf() + it.result?.forEach { + mutableListOf.add( + LocationResourceBean( + address = it.address, + mobile = it.mobile, + latitude = it.latitude, + longitude = it.longitude, + name = it.name, + type = "3", + ) + ) + } + markList.emit(mutableListOf) + }) + } + ) + } + + /** + * 附近救护车 + */ + fun nearbyAmbulance(latitude: Double, longitude: Double) { + launch( + { + handleRequest( + InterventionRepository.nearbyAmbulance(longitude, latitude), + successBlock = { + val mutableListOf = mutableListOf() + it.result?.forEach { + mutableListOf.add( + LocationResourceBean( + mobile = it.phone, + latitude = it.latitude, + longitude = it.longitude, + address = it.propagateArea.orEmptyDefault(), + name = it.belongName.orEmptyDefault(), + type = "5", + ) + ) + } + markList.emit(mutableListOf) + }) + } + ) + } + + /** + * 心血管-aed组网 + */ + fun getAedNetworkingData( + longitude: Double, + latitude: Double, + radiusRange: Int = 100000, + aedNum: String = "" + ) { + + launch( + { + handleRequest( + InterventionRepository.getAedNetworkingData( + longitude, latitude, radiusRange, aedNum + ), successBlock = { + val mutableListOf = mutableListOf() + it.result?.forEach { + mutableListOf.add( + LocationResourceBean( + address = it.installAddress.orEmptyDefault(), + mobile = it.chargeFirstMobile.orEmptyDefault(), + latitude = it.latitude, + longitude = it.longitude, + name = it.name.orEmptyDefault(), + type = "4", + ) + ) + } + markList.emit(mutableListOf) + }) + } + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/FilterSearchDoctorViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/FilterSearchDoctorViewModel.kt new file mode 100644 index 0000000..3e391ad --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/FilterSearchDoctorViewModel.kt @@ -0,0 +1,263 @@ +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()) //医院列表 + var mDepartmentSoure=MutableStateFlow(arrayListOf()) //科室列表 + var mDiseaseSoure=MutableStateFlow(arrayListOf()) //疾病 + var mDoctorSoure=MutableStateFlow(arrayListOf()) //疾病 + + //科室 + var mLeftSoure = MutableStateFlow(ArrayList()) //科室和疾病左侧列表 + var mRightSoure = MutableStateFlow(arrayListOf()) //科室右侧列表 + //疾病 + var mLeftSickSoure = MutableStateFlow(ArrayList()) //疾病左侧列表 + var mRightSickSoure = MutableStateFlow(arrayListOf())//疾病右侧列表 + 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() +// 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() + 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() +// 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() + 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() + 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() + 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() + var bean = DepartListBean() + bean.id = " " + bean.departmentName = "全部科室" + bean.secondDepartmentNum = 0 + list.add(bean) + list.addAll(result.list) + mLeftSoure.emit(list) + + } else { + var list = arrayListOf() + 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() + var bean2 = DepartListBean() + bean2.id = "0" + bean2.departmentName = "全部疾病" + bean2.secondDepartmentNum = 0 + list2.add(bean2) + list2.addAll(result) + mLeftSickSoure.emit(list2) + } else { + var list = arrayListOf() + 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() + if (value=="0"){ + var sick = SickListBean() + sick.id = value + sick.sicksName = "全部(${result.size})" + list.add(sick) + } + list.addAll(result) + mRightSickSoure.emit(list) + } + }) + } + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/GuidanceFragmentViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/GuidanceFragmentViewModel.kt new file mode 100644 index 0000000..c72d61d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/GuidanceFragmentViewModel.kt @@ -0,0 +1,77 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.emergency.EmergencyGroupInfo +import com.xjjk.healthyclients.bean.guidance.GuidanceListBean +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 GuidanceFragmentViewModel: BaseViewModel() { + var mDoctorList = MutableStateFlow(ArrayList()) + var isRefreshing = MutableStateFlow(false) + var mHaveSessioning="0" + private val pageSize = 10 + var pageIndex = MutableStateFlow(0) + var isLoadMoreEnd = MutableSharedFlow() + override fun init() { + } + fun selectSessionListByDoctorIdHelper(isRefresh: Boolean) { + launch( + { + if (isRefresh) { + isRefreshing.emit(true) + isLoadMoreEnd.emit(false) + pageIndex.emit(1) + } + handleRequest( + GuidanceRepository.selectSessionListByDoctorIdHelper(pageIndex.value,pageSize), + successBlock = { + it.result?.let{ result -> + if(it.result.isNullOrEmpty()){ + isLoadMoreEnd.emit(true) + mDoctorList.emit(arrayListOf()) + }else{ + mDoctorList.emit(result) + pageIndex.value++ + if(it.result!!.size < pageSize){ + isLoadMoreEnd.emit(true) + }else{ + isLoadMoreEnd.emit(false) + } + } + } + }) + },finallyBlock = { + isRefreshing.emit(false) + } + ) + } + fun selectDoctorRecommendHome() { + launch( + { + + handleRequest( + GuidanceRepository.selectDoctorRecommend(1,3), + successBlock = { + it.result?.let{ result -> + if (result.isNotEmpty()) { + mDoctorList.emit(result) + }else{ + mDoctorList.emit(ArrayList()) + } + } + }) + } + ) + } + fun submitAssistantConsultApply(successCall: (EmergencyGroupInfo) -> Unit = {}){ + launch({ + handleRequest(GuidanceRepository.submitAssistantConsultApply(), successBlock = { + it.result?.let { it1 -> successCall.invoke(it1) } + }) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/GuidanceNoticeViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/GuidanceNoticeViewModel.kt new file mode 100644 index 0000000..16faceb --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/GuidanceNoticeViewModel.kt @@ -0,0 +1,51 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.data.repository.CommonRepository +import com.xjjk.healthyclients.event.UserNoticeBean +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow + +class GuidanceNoticeViewModel: BaseViewModel() { + var noticeBean = MutableStateFlow(UserNoticeBean()) + var userNoticeResult = MutableSharedFlow() + override fun init() { +// selectDoctorRecommend() + } + + /** + * 首页用户弹窗 + */ + fun selectUserNotice(type:String) { + launch( + { + handleRequest( + CommonRepository.selectUserNotice(type), + successBlock = { + it.result?.let { result -> + noticeBean.emit(result) + } + }) + } + ) + } + + /** + * 首页用户弹窗 + */ + fun chooseToDontShowUp(id:String,notShow:Int) { + launch( + { + handleRequest( + CommonRepository.chooseToDontShowUp(id,notShow), + successBlock = { + userNoticeResult.emit(true) + }) + } + ) + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/LoginViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/LoginViewModel.kt new file mode 100644 index 0000000..0b17ea9 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/LoginViewModel.kt @@ -0,0 +1,45 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.baileren.rsalibrary.RSACipherStrategy +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.CommonSettingMenuBean +import com.xjjk.healthyclients.data.repository.CommonRepository +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import com.xjjk.healthyclients.utils.ConstantUtils +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow + +/** + */ +class LoginViewModel: BaseViewModel() { + var list = MutableStateFlow?>(null) + var mCode = MutableStateFlow("") + var mChangeState = MutableSharedFlow() + override fun init() { + + } + fun getAgreement(){ + launch({ + handleRequest(CommonRepository.getCommonSettingMenuList("jump_url"), successBlock = { + it.result?.let { it1 -> list.emit(it1) } + }) + },isAutoShowEmpty=true) + } + fun checkUserInfo(realname:String,idCard:String,phone:String){ + launch({ + handleRequest(CommonRepository.checkUserInfo(realname,idCard,phone), successBlock = { + it.result?.let { it1 -> mCode.emit(it1) } + }) + },isAutoShowEmpty=false) + } + fun resetUserPwd(password:String,confirmPassword:String,resetCode:String){ + var newPassword= RSACipherStrategy().encrypt(ConstantUtils.mRSAKey,password) + var newPasswordConfirm=RSACipherStrategy().encrypt(ConstantUtils.mRSAKey,confirmPassword) + launch({ + handleRequest(CommonRepository.resetUserPwd(newPassword,newPasswordConfirm,resetCode), successBlock = { + it.result?.let { it1 -> mChangeState.emit(true) } + }) + },isAutoShowEmpty=false) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/MyGuidanceActivityViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/MyGuidanceActivityViewModel.kt new file mode 100644 index 0000000..d13d15d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/MyGuidanceActivityViewModel.kt @@ -0,0 +1,190 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import android.util.Log +import com.tencent.imsdk.v2.V2TIMConversation +import com.tencent.imsdk.v2.V2TIMConversationListFilter +import com.tencent.imsdk.v2.V2TIMConversationResult +import com.tencent.imsdk.v2.V2TIMManager +import com.tencent.imsdk.v2.V2TIMValueCallback +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.guidance.selectKnowledgeCategoryBean +import com.xjjk.healthyclients.bean.guidance.selectSessionListByUserIdBean +import com.xjjk.healthyclients.data.repository.GuidanceRepository +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.async +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.withContext +import java.util.Collections +import kotlin.coroutines.resume +import kotlin.coroutines.suspendCoroutine + + +class MyGuidanceActivityViewModel : BaseViewModel() { + var titleList = MutableStateFlow(mutableListOf()) + var knowledgeList = MutableStateFlow(ArrayList()) + + private val pageSize = 10 + var pageIndex = MutableStateFlow(0) + var isLoadMoreEnd = MutableSharedFlow() + private var nextSeq: Long = 0 + + override fun init() { + + } + + + fun refreshIndex(){ + launch(tryBlock = { + pageIndex.emit(0) + } + ) + + } + + fun selectSessionListByUserId(type: String,status: String) { + launch( + { + handleRequest( + GuidanceRepository.selectSessionListByUserId(type,status,pageIndex.value,pageSize), + successBlock = { + if(it.result.isNullOrEmpty()){ + isLoadMoreEnd.emit(true) + knowledgeList.emit(arrayListOf()) + }else{ + it.result?.let { result -> + knowledgeList.emit(result) + } + pageIndex.value++ + if(it.result!!.size < pageSize){ + isLoadMoreEnd.emit(true) + }else{ + isLoadMoreEnd.emit(false) + } + } + + }) + }, finallyBlock = { + isLoadMoreEnd.emit(false) + } + ) + } + + fun selectSessionListByUserIdVersionThree(type: String,status: String) { + launch( + { + handleRequest( + GuidanceRepository.selectSessionListByUserIdVersionThree(type,status,pageIndex.value,pageSize), + successBlock = { + if(it.result.isNullOrEmpty()){ + isLoadMoreEnd.emit(true) + knowledgeList.emit(arrayListOf()) + }else{ + it.result?.let { result -> + knowledgeList.emit(result) + } + pageIndex.value++ + if(it.result!!.size < pageSize){ + isLoadMoreEnd.emit(true) + }else{ + isLoadMoreEnd.emit(false) + } + } + + }) + }, finallyBlock = { + isLoadMoreEnd.emit(false) + } + ) + } + + /** + * 获取图文咨询进行中列表 + */ + fun getImageTextUnderwayConsultList() { + launch(tryBlock = { + var v2TIMConversationList: MutableList = + withContext(Dispatchers.IO) { + getIMConversationList(0, 100) + } + val imIdList = mutableListOf() + val imUnReadList= hashMapOf() + for (v2TIMConversation in v2TIMConversationList) { + Log.i("imsdk", "success showName:" + v2TIMConversation.showName) + var imId=if (v2TIMConversation.groupID.isNullOrEmpty()) v2TIMConversation.userID else v2TIMConversation.groupID + imIdList.add(imId) + imUnReadList.put(imId,v2TIMConversation.unreadCount) + } + handleRequest( + GuidanceRepository.selectSessionListPictureByUserId(imIdList), + successBlock = { + if(it.result.isNullOrEmpty()){ + isLoadMoreEnd.emit(true) + knowledgeList.emit(arrayListOf()) + }else{ + it.result?.let { result -> + for (bean in result){ + var value=imUnReadList.get(bean.imId) + if (value!=null) { + bean.unreadCount=value + } + } + Collections.sort(result) + knowledgeList.emit(result) + } + pageIndex.value++ + if(it.result!!.size < pageSize){ + isLoadMoreEnd.emit(true) + }else{ + isLoadMoreEnd.emit(false) + } + } + + }) + }, finallyBlock = { + isLoadMoreEnd.emit(false) + }) + } + + /** + * 获取IM会话列表 + * @param pageStartNo 会话开始位置 + * @param pageSize 每页请求的数量 + */ + private suspend fun getIMConversationList( + pageStartNo: Long, + pageSize: Int + ): MutableList { + var conversationListAsync = CoroutineScope(Dispatchers.Default).async { + suspendCoroutine { async -> + val filter = V2TIMConversationListFilter() + filter.conversationType = V2TIMConversation.V2TIM_GROUP + V2TIMManager.getConversationManager().getConversationListByFilter( + filter, + pageStartNo, + pageSize, + object : V2TIMValueCallback { + override fun onSuccess(v2TIMConversationResult: V2TIMConversationResult) { +// nextSeq = v2TIMConversationResult.nextSeq + Log.i( + "imsdk--", + "success nextSeq:" + nextSeq + ", isFinish:" + v2TIMConversationResult.isFinished + ) + val v2TIMConversationList = v2TIMConversationResult.conversationList + async.resume(v2TIMConversationList) + } + + override fun onError(code: Int, desc: String) { + Log.i("imsdk--", "failure, code:$code, desc:$desc") + } + }) + } + } + return conversationListAsync.await() + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/SeekDoctorSearchActivityViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/SeekDoctorSearchActivityViewModel.kt new file mode 100644 index 0000000..7b9fc0c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/SeekDoctorSearchActivityViewModel.kt @@ -0,0 +1,269 @@ +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()) //医院列表 + var mHospitalSoureState = MutableSharedFlow() + var mAllState = MutableSharedFlow() + var mDepartmentSoure=MutableStateFlow(arrayListOf()) //科室列表 + var mDepartmentSoureState = MutableSharedFlow() + var mDiseaseSoure=MutableStateFlow(arrayListOf()) //疾病 + var mDiseaseSoureState = MutableSharedFlow() + var mDoctorSoure=MutableStateFlow(arrayListOf()) //专家 + var mDoctorSoureState = MutableSharedFlow() + override fun init() { + } + + /** + * 综合搜索 + */ + fun searchComprehensive(value:String) { + launch( + { + handleRequest( + GuidanceRepository.searchComprehensive(value), + successBlock = { + it.result?.let{ result -> + //医院 + var hospital= arrayListOf() + 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() + 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() + 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() + 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() + 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() + 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() + 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() + 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) + } + } + }) + } + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/SelectAppointmentTimeViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/SelectAppointmentTimeViewModel.kt new file mode 100644 index 0000000..337c564 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/SelectAppointmentTimeViewModel.kt @@ -0,0 +1,61 @@ +package com.xjjk.healthyclients.ui.viewmodel + + +import com.sw.healthyclients.bean.guidance.DoctorBean +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.guidance.AppointmentTimeBean +import com.xjjk.healthyclients.data.repository.DoctorRepository +import com.xjjk.healthyclients.event.FollowDoctorEvent +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableStateFlow +import org.greenrobot.eventbus.EventBus + +class SelectAppointmentTimeViewModel : BaseViewModel() { + var appointmentTimeList = MutableStateFlow(mutableListOf()) + var doctorBean = MutableStateFlow(DoctorBean()) + var followStatus = MutableStateFlow(false) + override fun init() { + } + + fun getDoctorInfo(doctorId: String?) { + launch({ + handleRequest(DoctorRepository.getDoctorInfo(doctorId), successBlock = { + it.result?.let { it1 -> + doctorBean.emit(it1) + followStatus.emit("1" == it1.tfFollow) + } + }) + }) + } + + fun followDoctor(doctorId: String?) { + launch({ + if (!followStatus.value) { + handleRequest(DoctorRepository.followDoctor(doctorId), successBlock = { + toastMessage.emit(it.message) + followStatus.emit(true) + EventBus.getDefault().post(FollowDoctorEvent(followStatus.value)) + }) + } else { + handleRequest(DoctorRepository.cancelFollowDoctor(doctorId), successBlock = { + toastMessage.emit(it.message) + followStatus.emit(false) + EventBus.getDefault().post(FollowDoctorEvent(followStatus.value)) + }) + } + + }) + } + + fun getAppointmentTimeList(doctorId: String?) { + launch( + { + handleRequest(DoctorRepository.getDoctorSchedulingDate(doctorId), successBlock = { + it.result?.let { it1 -> appointmentTimeList.emit(it1) } + }) + } + ) + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/SelectConsultantViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/SelectConsultantViewModel.kt new file mode 100644 index 0000000..3d6179d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/SelectConsultantViewModel.kt @@ -0,0 +1,61 @@ +package com.xjjk.healthyclients.ui.viewmodel + + +import com.sw.healthyclients.bean.guidance.ConsultDoctorIMChatInfo +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.data.repository.ConsultantManagerRepository +import com.xjjk.healthyclients.superfuntion.handleRequest +import com.xjjk.healthyclients.superfuntion.launch +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow + +class SelectConsultantViewModel: BaseViewModel() { + var consultantList = MutableStateFlow?>(null) + var isRefreshing = MutableStateFlow(false) //如果需要下拉刷新监听此Flow更改刷新组件状态 + var isLoadMoreEnd = MutableSharedFlow() + var initEmptyView = MutableStateFlow(false) + private val pageSize = Int.MAX_VALUE + var pageIndex = 1 + override fun init() { + } + fun getConsultantArchivesData(isRefresh: Boolean){ + launch(tryBlock = { + if (isRefresh) { + isRefreshing.emit(true) + isLoadMoreEnd.emit(false) + pageIndex = 1 + } + handleRequest(ConsultantManagerRepository.getConsultantArchivesData(pageIndex, pageSize), successBlock = { + if (it.result.isNullOrEmpty()) { + isLoadMoreEnd.emit(true) + consultantList.emit(mutableListOf()) + } else { + consultantList.emit(it.result!!) + pageIndex++ + if (it.result!!.size < pageSize) { + isLoadMoreEnd.emit(true) + } + } + }) + }, finallyBlock = { + isRefreshing.emit(false) + }) + } + fun submitAudioVideoConsultantApply(doctorId: String?, memberId: String?, archivesId: String?, appointmentTimeId: String?, successCall: (String) -> Unit = {}){ + launch({ + handleRequest(ConsultantManagerRepository.submitAudioVideoConsultApply(doctorId, memberId, archivesId, appointmentTimeId), successBlock = { + toastMessage.emit(it.message) + it.result?.let { it1 -> successCall.invoke(it1) } + }) + }) + } + fun submitImageTextConsultantApply(doctorId: String?, memberId: String?, archivesId: String?, successCall: (ConsultDoctorIMChatInfo) -> Unit = {}){ + launch({ + handleRequest(ConsultantManagerRepository.submitImageTextConsultApply(doctorId, memberId, archivesId), successBlock = { +// toastMessage.emit(it.message) + it.result?.let { it1 -> successCall.invoke(it1) } + }) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/UserInfoFragmentViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/UserInfoFragmentViewModel.kt new file mode 100644 index 0000000..197300a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/UserInfoFragmentViewModel.kt @@ -0,0 +1,34 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +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 UserInfoFragmentViewModel : BaseViewModel() { + var number = MutableStateFlow(String()) + override fun init() { + + } + + + /** + * 个人中心进行中数量 + */ + fun sessioningNum() { + launch( + { + handleRequest( + GuidanceRepository.sessioningNum(), + successBlock = { + it.result?.let { result -> + number.emit(result) + } + }) + } + ) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/UserInfoSettingViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/UserInfoSettingViewModel.kt new file mode 100644 index 0000000..80df3bb --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/UserInfoSettingViewModel.kt @@ -0,0 +1,55 @@ +package com.xjjk.healthyclients.ui.viewmodel + +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import com.xjjk.healthyclients.bean.SelectUserInfoBean +import com.xjjk.healthyclients.bean.user.SelectEmergencyContactListBean +import com.xjjk.healthyclients.data.repository.CommonRepository +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 UserInfoSettingViewModel : BaseViewModel() { + var bean = MutableStateFlow(mutableListOf()) + var userInfo = MutableStateFlow(SelectUserInfoBean()) + override fun init() { + + } + + + /** + * 紧急联系人列表 + */ + fun selectUserInfo() { + launch( + { + handleRequest( + CommonRepository.selectUserInfo(), + successBlock = { + it.result?.let { result -> + userInfo.emit(result) + } + }) + } + ) + } + + /** + * 紧急联系人列表 + */ + fun selectEmergencyContactList() { + launch( + { + handleRequest( + GuidanceRepository.selectEmergencyContactList(), + successBlock = { + it.result?.let { result -> + bean.emit(result) + } + }) + },isAutoShowEmpty=true + ) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/WebViewModel.kt b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/WebViewModel.kt new file mode 100644 index 0000000..e6857ec --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/ui/viewmodel/WebViewModel.kt @@ -0,0 +1,9 @@ +package com.xjjk.healthyclients.ui.viewmodel +import com.xjjk.healthyclients.base.viewmodel.BaseViewModel +import kotlinx.coroutines.flow.MutableStateFlow + +class WebViewModel: BaseViewModel() { + var title = MutableStateFlow("") + override fun init() { + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/AndroidInterface.kt b/app/src/main/java/com/xjjk/healthyclients/utils/AndroidInterface.kt new file mode 100644 index 0000000..97d6c90 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/AndroidInterface.kt @@ -0,0 +1,119 @@ +package com.xjjk.healthyclients.utils + +import android.app.Activity +import android.app.DownloadManager +import android.content.Context.DOWNLOAD_SERVICE +import android.content.Intent +import android.net.Uri +import android.os.Build +import android.os.Environment +import android.webkit.JavascriptInterface +import android.webkit.URLUtil +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import com.just.agentweb.AgentWeb +import com.xjjk.healthyclients.event.WebActionFinishEvent +import com.xjjk.healthyclients.event.WebReloadEvent +import com.xjjk.healthyclients.superfuntion.startSystemWebActivity +import com.xjjk.healthyclients.superfuntion.startWebActivity +import com.youth.banner.util.LogUtils +import okhttp3.HttpUrl.Companion.toHttpUrl +import org.greenrobot.eventbus.EventBus +import java.lang.reflect.Type + + +/** + * @author nanfeifei + * @time 2023/8/15 15:50 + * @description + */ +class AndroidInterface(val agentWeb: AgentWeb, val context: Activity) { + @JavascriptInterface + fun downloadFiles(fiLeList: String) { + var gson = Gson() + val type: Type = object : TypeToken>() {}.type + var list = gson.fromJson>(fiLeList, type) + context.runOnUiThread { + list.forEach { + downloadBySystem(it, null, mimeType = "application/pdf") + } + } + } + + @JavascriptInterface + fun onRouteChange(url: String) { + var params: String = url.toHttpUrl().queryParameter("startNewActivity") ?: "" + if (params == "1") { + context?.startWebActivity(url) + } + } + + @JavascriptInterface + fun refreshBeforeWeb() { + EventBus.getDefault().post(WebReloadEvent()) + } + + @JavascriptInterface + fun finishActivity() { + context.runOnUiThread { + EventBus.getDefault().post(WebReloadEvent()) + context.finish() + } + } + + @JavascriptInterface + fun finishEvent() { + context.runOnUiThread { + EventBus.getDefault().post(WebActionFinishEvent()) + } + } + + @JavascriptInterface + fun callPhone(tel: String) { + try { + val intent: Intent = if (tel.contains("tel")) { + Intent(Intent.ACTION_DIAL, Uri.parse(tel)) + } else { + Intent(Intent.ACTION_DIAL, Uri.parse("tel: ${tel}")) + } + context.startActivity(intent) + } catch (e: Exception) { + } + } + + fun downloadBySystem(url: String, contentDisposition: String?, mimeType: String) { + try { + //使用系统时间命名文件 + val fileName = URLUtil.guessFileName(url, contentDisposition, mimeType) + val uri = Uri.parse(url) + //得到系统的下载管理 + val manager = context.getSystemService(DOWNLOAD_SERVICE) as DownloadManager + //得到连接请求对象 + val request = DownloadManager.Request(uri) + //指定在什么网络下允许下载 + request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI) + request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE) + //指定下载文件的保存路径{缓存目录还是sd卡或者手机存储}。注意:用手机自带的文件管理器看不到缓存路径(Android\data\项目包名\files\Download\subPath) + /*request.setDestinationInExternalFilesDir(context,Environment.DIRECTORY_DOWNLOADS,subPath);*/ + request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName) + //设置显示下载界面 + request.setVisibleInDownloadsUi(true) + //MIME_MapTable是所有文件的后缀名所对应的MIME类型的一个String数组 比如{".apk", "application/vnd.android.package-archive"}, + request.setMimeType(mimeType) + // 下载完成后该Notification才会被显示 + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) { + // Android 3.0版本 以后才有该方法 + //在下载过程中通知栏会一直显示该下载的Notification,在下载完成后该Notification会继续显示,直到用户点击该Notification或者消除该Notification + request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) + } + //启动下载,该方法返回系统为当前下载请求分配的一个唯一的ID + val downLoadId = manager.enqueue(request) + LogUtils.d("" + downLoadId) + } catch (e: Exception) { + context.startSystemWebActivity(url) + } + + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/ApiDns.java b/app/src/main/java/com/xjjk/healthyclients/utils/ApiDns.java new file mode 100644 index 0000000..64e01c1 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/ApiDns.java @@ -0,0 +1,36 @@ +package com.xjjk.healthyclients.utils; + +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.List; + +import okhttp3.Dns; + +public class ApiDns implements Dns { + @Override + public List lookup(String hostname) throws UnknownHostException { + if (hostname == null) { + throw new UnknownHostException("hostname == null"); + } else { + try { + List mInetAddressesList = new ArrayList<>(); + InetAddress[] mInetAddresses = InetAddress.getAllByName(hostname); + for (InetAddress address : mInetAddresses) { + if (address instanceof Inet4Address) { + mInetAddressesList.add(0, address); + } else { + mInetAddressesList.add(address); + } + } + return mInetAddressesList; + } catch (NullPointerException var4) { + UnknownHostException unknownHostException = new UnknownHostException("Broken system behaviour"); + unknownHostException.initCause(var4); + throw unknownHostException; + } + } + } +} + diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/AppStoreUtils.java b/app/src/main/java/com/xjjk/healthyclients/utils/AppStoreUtils.java new file mode 100644 index 0000000..36da8f0 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/AppStoreUtils.java @@ -0,0 +1,18 @@ +package com.xjjk.healthyclients.utils; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; + +public class AppStoreUtils { + public static int getVersionFromAppstore(String appUrl) { + int version=1; + try { + Document doc = Jsoup.connect(appUrl).get(); + String elements = doc.select("span[class=AppInfo_version__hfAIG]").text().replace("版本号 ",""); + version=Integer.parseInt(elements.replace(".","")); + } catch (Exception e) { + e.printStackTrace(); + } + return version; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/BrandUtil.java b/app/src/main/java/com/xjjk/healthyclients/utils/BrandUtil.java new file mode 100644 index 0000000..cd764f2 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/BrandUtil.java @@ -0,0 +1,84 @@ +package com.xjjk.healthyclients.utils; + +import com.tencent.qcloud.tuicore.util.TUIBuild; + +public class BrandUtil { + /** + * Xiaomi device + */ + public static boolean isBrandXiaoMi() { + return "xiaomi".equalsIgnoreCase(getBuildBrand()) + || "xiaomi".equalsIgnoreCase(getBuildManufacturer()); + } + + /** + * huawei device + */ + public static boolean isBrandHuawei() { + return "huawei".equalsIgnoreCase(getBuildBrand()) || + "huawei".equalsIgnoreCase(getBuildManufacturer()) || + "honor".equalsIgnoreCase(getBuildBrand()); + } + + /** + * meizu device + */ + public static boolean isBrandMeizu() { + return "meizu".equalsIgnoreCase(getBuildBrand()) + || "meizu".equalsIgnoreCase(getBuildManufacturer()) + || "22c4185e".equalsIgnoreCase(getBuildBrand()); + } + + /** + * oppo device + * + * @return + */ + public static boolean isBrandOppo() { + return "oppo".equalsIgnoreCase(getBuildBrand()) || + "realme".equalsIgnoreCase(getBuildBrand()) || + "oneplus".equalsIgnoreCase(getBuildBrand()) || + "oppo".equalsIgnoreCase(getBuildManufacturer()) || + "realme".equalsIgnoreCase(getBuildManufacturer()) || + "oneplus".equalsIgnoreCase(getBuildManufacturer()); + } + + /** + * vivo device + * + * @return + */ + public static boolean isBrandVivo() { + return "vivo".equalsIgnoreCase(getBuildBrand()) + || "vivo".equalsIgnoreCase(getBuildManufacturer()); + } + + /** + * honor device + * + * @return + */ + public static boolean isBrandHonor() { + return "honor".equalsIgnoreCase(getBuildBrand()) && "honor".equalsIgnoreCase(getBuildManufacturer()); + } + + public static String getBuildBrand() { + return TUIBuild.getBrand(); + } + + public static String getBuildManufacturer() { + return TUIBuild.getManufacturer(); + } + + public static String getBuildModel() { + return TUIBuild.getModel(); + } + + public static String getBuildVersionRelease() { + return TUIBuild.getVersion(); + } + + public static int getBuildVersionSDKInt() { + return TUIBuild.getVersionInt(); + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/CommonUtils.kt b/app/src/main/java/com/xjjk/healthyclients/utils/CommonUtils.kt new file mode 100644 index 0000000..471bec3 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/CommonUtils.kt @@ -0,0 +1,153 @@ +package com.xjjk.healthyclients.utils + +import android.graphics.Color +import com.google.gson.Gson +import com.xjjk.healthyclients.MyApplication +import com.xjjk.healthyclients.R +import com.sw.healthyclients.bean.common.UserInfoBean +import com.sw.healthyclients.data.local.DataStoreManager +import com.xjjk.healthyclients.superfuntion.logout +import java.util.regex.Matcher +import java.util.regex.Pattern +import kotlin.random.Random +import kotlin.random.asJavaRandom + +object CommonUtils { + fun getConsultTypeText(type: String?): String { + return when(type){ + "1" -> { + MyApplication.appContext.getString(R.string.consult_type_image_text) + } + + "2" -> { + MyApplication.appContext.getString(R.string.consult_type_audio_video) + } + + else -> { + "" + } + } + } + fun getGenderText(gender: String?): String{ + return when(gender){ + "1" -> { + MyApplication.appContext.getString(R.string.gender_woman) + } + + "2" -> { + MyApplication.appContext.getString(R.string.gender_man) + } + + else -> { + "" + } + } + } + fun getAmPmText(amPm: String?): String { + return when(amPm){ + "0" -> { + MyApplication.appContext.getString(R.string.consult_time_am) + } + + "1" -> { + MyApplication.appContext.getString(R.string.consult_time_pm) + } + + else -> { + "" + } + } + } + + fun getGuidanceStateText(state: String?): String { + return when(state){ + "1" -> { + "待确认" + } + "2" -> { + "待开始" + } + "3" -> { + "已开始" + } + "4" -> { + "待评价" + } + "5" -> { + "已完成" + } + "6" -> { + "拒绝" + } + "7" -> { + "取消" + } + else -> { + "" + } + } + } + fun loginSaveData(userInfoBean: UserInfoBean){ + DataStoreManager.saveAgreePrivacyPolicyStatus(true) + DataStoreManager.saveUserId(userInfoBean.id) + DataStoreManager.saveIdCard(userInfoBean.idCard) + DataStoreManager.saveUserInfo(Gson().toJson(userInfoBean)) + } + fun logoutClearData(){ + DataStoreManager.saveUserInfo("") + DataStoreManager.saveToken("") + DataStoreManager.saveIdCard("") + DataStoreManager.saveInterventionToken("") + logout() + } + fun getRandomColor(): Int { + val rnd = Random.asJavaRandom() + return Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)) + } + /** + * 规则3:必须同时包含大小写字母及数字 + * 是否包含 + * + * @param str + * @return + */ + fun isPasswordMatches(str: String): Boolean { + var isDigit = false //定义一个boolean值,用来表示是否包含数字 + var isLowerCase = false //定义一个boolean值,用来表示是否包含字母 + var isUpperCase = false + for (i in str.indices) { + if (Character.isDigit(str[i])) { //用char包装类中的判断数字的方法判断每一个字符 + isDigit = true + } else if (Character.isLowerCase(str[i])) { //用char包装类中的判断字母的方法判断每一个字符 + isLowerCase = true + } else if (Character.isUpperCase(str[i])) { + isUpperCase = true + } + } + val regex = "^[a-zA-Z0-9]+$" + return isDigit && isLowerCase && isUpperCase && isSpecialCharacter(str) && str.matches(Regex(".*\\d.*")) + } + + + + /** + * 密码规则校验 + */ + private const val PASSWORD_PATTERN = + "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{12,20}$" + private val pattern = Pattern.compile(PASSWORD_PATTERN) + fun PasswordFormatCheck(password: String?): Boolean { + return pattern.matcher(password).matches() + } + + /** + * 判断字符串中是否包含特殊字符 + */ + fun isSpecialCharacter(str: String): Boolean{ +// "!\\\"#\$%&'()*+,-./:;<=>?@\\\\]\\\\[^_`{|}~" + val speChat = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]" + val pattern: Pattern = Pattern.compile(speChat) + val matcher: Matcher = pattern.matcher(str) + return matcher.find() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/ConstantUtils.kt b/app/src/main/java/com/xjjk/healthyclients/utils/ConstantUtils.kt new file mode 100644 index 0000000..91f0e94 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/ConstantUtils.kt @@ -0,0 +1,276 @@ +package com.xjjk.healthyclients.utils + +import android.os.Parcelable +import kotlinx.android.parcel.Parcelize + +object ConstantUtils { + const val mIsDebug = false + const val mRSAKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmZfR/bA9X3vp86y1aEpvwzXJYKRRF1fLau2+05/ZtaITLpV8bhkmSf3neSy/Q9gAdvG75Fr73E+GWE+K5b0BpvIS1jDGo319+PpZR39SaZTKZ27XFXrosmJTZutN79t819HS1VseleunHAFgMVufE9U5jP6LGzl/wbkSy01GhzwIDAQAB" + var mCurrentLat = 34.327271 + var mCheckToken = false + var mCurrentLon = 108.949845 + var mNutritionMonitor = false + var mIsCloseDialog = false + var mPrivacy = "本平台由西安仁康信息科技有限公司开发和运维,平台深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则,保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。同时,我们承诺将采取相应的安全保护措施来保护您的个人信息。请在使用平台服务前,仔细阅读并了解本隐私权政策,我们将按照本政策收集、处理及披露您的信息。\n" + + "本政策将帮助您了解以下内容:\n" + + "1、定义\n" + + "2、我们可能收集的信息\n" + + "3、我们如何收集和使用您的个人信息\n" + + "4、我们如何使用 Cookie 和同类技术\n" + + "5、我们如何共享、转让、公开披露您的个人信息\n" + + "6、员工业务数据和公开信息\n" + + "7、我们如何保护您的个人信息\n" + + "8、您如何管理您的个人信息\n" + + "9、我们如何处理未成年人的个人信息\n" + + "10、本声明和政策如何更新\n" + + "11、如何联系我们\n" + + "一、定义\n" + + "1. 个人信息:\n" + + "指以电子或者其他方式记录的与已识别或者可识别的自然人有关的各种信息,不包括匿名化处理后的信息\n" + + "2. 个人健康信息\n" + + "指以电子或者其他方式记录的能够单独或者与其他信息结合识别特定自然人身份或者反映特定自然人活动情况的各种健康信息,一旦泄露或者非法使用,可能导致个人受到歧视或者人身、财产受到严重危害的个人信息,包括如姓名、出生日期、身份证件号码、体检信息、就医信息、住址、通讯联系方式、通信记录和内容、账号密码、行踪轨迹、民族、个人生物特征、医疗健康、金融账户、个人行踪、不满十四周岁未成年人信息等。\n" + + "3. 未成年人:指不满18周岁的自然人。\n" + + "4. 儿童:指不满14周岁的自然人。\n" + + "5. 设备信息\n" + + "包括设备标识符 (IMEI、IDFA、Android1D、MAC、OAID、IMSI、SIM 卡序列号 (ICCID) 、设备序列号及其他设备相关信息),应用信息 (应用崩溃信息、通知开关状态、运行中进程、应用安装列表及其他应用相关信息) ,设备参数及系统信息(设备类型、设备型号、操作系统及硬件相关信息),设备网络环境信息 (IP地址,WiFi信息,基站信息及其他网络相关信息),蓝牙信息,广播组件通讯信息,运营商信息,传感器 (陀螺仪、重力传感器、加速度传感器、环境传感器、光学心率传感器),剪切板。以产品实际采集情况为准。\n" + + "6. 业务数据\n" + + "不同于个人信息,是指平台员工利用平台的服务上传、下载、分发等通过平台的技术服务处理的数据。\n" + + "二、我们可能收集的信息\n" + + "我们提供服务时,可能会收集、储存和使用下列与个人有关的信息。如果您不提供相关信息,可能无法注册成为平台员工或无法享受平台的某些服务,或者无法达到相关服务拟达到的效果。\n" + + "2.1 与个人身份无关\n" + + "当您使用平台的服务时,我们可能收集和汇总诸如员工的来源途径、访问顺序、停留时间等信息,例如记录使用平台服务的每个员工的来源途径、浏览器软件等。\n" + + "2.2 与个人身份有关\n" + + "当您使用平台的服务时,我们可能收集和汇总或要求您提供有关个人身份的信息,例如:\n" + + "(1) 个人身份证明(包括身份证图片和身份证号、手机号、邮箱等);\n" + + "(2) 个人补充信息(姓名、生日、籍贯、性别、兴趣爱好、学历、个人联系电话、住址、工作信息、婚姻状况、健康状况、;\n" + + "(3) 网络身份标识信息(包括系统账号、IP地址、电子邮箱地址及与前述有关的密码、口令、口令保护答案、个人数字证书等);\n" + + "(4) 个人健康信息(包括:姓名、性别、出生日期、身高体重、就诊卡、所在城市,所患病症、患病时长、体检报告、住院记录、诊治情况、检验报告、体检报告、用药记录、以往病史、过敏信息、家族史、患病史等,和历史咨询记录。\n" + + "(5) 相机、相册(设备的相机功能,以拍摄照片或录制视频);\n" + + "(6) 麦克风(通话、发送录音文件);\n" + + "(7) 悬浮窗(在其他程序页面仍能保持应用内通话);\n" + + "(8) 日历(访问用户的日历,以便将预约信息添加到日历中);\n" + + "(9) 存储(访问设备存储器中的文件、照片和视频);\n" + + "(10) 个人上网记录和日志信息(包括网站浏览记录、软件使用记录、点击记录、操作日志等);\n" + + "(11) 设备信息(包括设备型号、设备MAC地址、操作系统类型、设备设置);\n" + + "(12) 软件列表唯一设备识别码(如IMEI/android ID/IDFA/OPENUDID/GUID、SIM卡IMSI信息等在内的描述个人常用设备基本情况的信息);\n" + + "(13) 拨打电话(唤起手机拨号界面并自动填充电话)\n" + + "(14) 个人位置信息(包括精准定位信息、经纬度等);\n" + + "(15) 其他平台基于为您提供服务需要而收集或汇总的您的信息。\n" + + "三、我们如何收集和使用您的个人信息\n" + + "1. 您直接提供的信息:我们可能会收集您在蚁熊健康注册账号、申请或使用我们的服务时填写,通过现场交谈、电话、视频或其他联系方式与我们联系时所提供的信息,以及您在使用我们服务过程中产生的与您的交易和活动有关的信息。\n" + + "(1) 帮助您成为我们的一员\n" + + "您需要向平台提供真实姓名、邮箱、有效身份证件(包括但不限于身份证)的号码,以便于我们进行实名认证。您可以修改和补充您的昵称、性别、生日、职级、职称、学历、亲属、紧急联系人、工作信息(单位部门)、婚姻状况、健康类型、兴趣爱好以及您的实名认证等一系列相关信息相关信息,这些信息均属于您的“账号信息”。您补充的账户信息将有助于我们为您提供与您信息更匹配的相关业务服务(急救协助、医院体检、健康知识推送等)。如果您不提供这些信息,可能会影响您对平台部分核心业务功能的正常使用,如咨询专家等,但不会影响您进行基本的浏览、搜索。如果您不提供这些信息,将会影响您使用平台的部分功能,如咨询专家,但不会影响您使用平台服务的基本浏览、搜索功能。在您主动注销账号时,我们将根据相关法律法规的要求尽快使其匿名或删除您的个人信息。\n" + + "(2) 咨询专家\n" + + "为便于您能够咨询专家,您需提供真实姓名、手机号、身份证号码、性别、出生日期、身高体重等信息。为更好地向您提供咨询服务解决您的问题,更加精准、快速地向您推荐医生,我们可能需要您在健康咨询时提供个人健康信息,例如:病症、患病时长、检验报告、体检报告、医院就诊信息、诊治情况、用药记录、以往病史、过敏信息、家族史、患病史等。如您不提供上述信息,将会影响您使用部分健康咨询等功能,但不影响您使用平台产品或服务的基本浏览、搜索功能。应急救援\n" + + "(1) 您实名成为蚁熊健康的用户后,若您或您的朋友发生了意外事件,你可以通过查看系统内的相关医疗资源,并向平台发起帮助请求。在此过程中,我们可能会通过您的基本信息和聊天功能获取您的手机号、您的紧急联系人姓名和联系 电话,位置、姓名、性别、年龄、健康状况、事故详情介绍的图文、音视频沟通的信息。搜索\n" + + "(3) 搜索\n" + + "为了让您快速地找到您所需要的专家、知识文章、软件功能、医院等,我们可能会收集您使用我们的产品记录为您提供这些信息展示的最优方式。我们也会为了不断改进和优化上述的功能来使用您的上述个人信息。\n" + + "您也可以通过搜索来精准地找到您所需要的专家、医院、系统功能。我们会保留您的搜索内容以方便您重复输入或为您展示与您搜索内容相关联的产品或服务。\n" + + "(4) 应急救援\n" + + "您实名成为蚁熊健康的用户后,若您或您的朋友发生了意外事件,你可以通过查看系统内的相关医疗资源,并向平台发起帮助请求。在此过程中,我们可能会通过您的基本信息和聊天功能获取您的手机号、您的紧急联系人姓名和联系 电话,位置、姓名、性别、年龄、健康状况、事故详情介绍的图文、音视频沟通的信息。\n" + + "(5) 大病就医(挂号)\n" + + "为了帮您预约医院的专家,我们需要您在预约时提供个人基本信息:姓名、性别、年龄、预约医院、挂号类型、预约时间等基本信息;你可补充病况、就诊卡号、预约科室、医师来进一步享受更为准确的服务。\n" + + "(6) 体检预约、体检报告查看、体检指标分析\n" + + "为帮助您可以在APP预约体检服务,查看体检报告,并对您的相关指标进行分析。我们需要获取您的姓名、性别、年龄、健康状态、 工作信息(部门单位)。\n" + + "2. 我们在您使用服务过程中收集的信息\n" + + "为向您提供更契合您需求的页面展示和搜索结果、了解服务适配性、识别账号异常状态,我们会收集关于您使用的服务以及使用方式的信息并将这些信息进行关联,这些信息包括:\n" + + "设备信息:我们会根据您在软件安装及使用中授予的具体权限,接收并记录您所使用的设备相关信息(例如设备型号、操作系统版本、设备设置、唯一设备标识符等软硬件特征信息)、设备所在位置相关信息(例如IP 地址、GPS位置以及能够提供相关信息的Wi-Fi 接入点、蓝牙和基站等传感器信息)。\n" + + "日志信息:当您使用我们的网站或用户端提供的服务时,我们会自动收集您对我们服务的详细使用情况,作为有关网络日志保存。例如您的搜索查询内容、IP地址、浏览器的类型、电信运营商、使用的语言、访问日期和时间及您访问的网页记录等。\n" + + "请注意,单独的设备信息、日志信息等是无法识别特定自然人身份的信息。如果我们将这类非个人信息与其他信息结合用于识别特定自然人身份,或者将其与个人信息结合使用,则在结合使用期间,这类非个人信息将被视为个人信息,除取得您授权或法律法规另有规定外,我们会将该类个人信息做匿名化、去标识化处理。\n" + + "为展示您的健康信息,我们会收集您在使用我们服务过程中产生的健康咨询详情(包括但不限于图片、文字、视频、语音)、预约挂号记录、咨询记录、个人健康信息、检查检验、医生诊断结果等用于向您展示及便于您对信息进行管理。\n" + + "当您与我们联系时,我们可能会保存您的通信/通话记录和内容或您留下的联系方式等信息,以便与您联系或帮助您解决问题,或记录相关问题的处理方案及结果。\n" + + "3. 我们通过间接获得方式收集到的您的个人信息\n" + + "我们可能从第三方获取您授权共享的账户信息(头像、昵称、联系方式),并在您同意声明和政策后将您的第三方账户与您的账户绑定,使您可以通过第三方账户直接登录并使用平台服务。我们会将依据与第三方的约定、对个人信息来源的合法性进行确认后,在符合相关法律和法规规定的前提下,使用您的这些个人信息。\n" + + "如您拒绝提供上述信息或拒绝授权,可能无法使用我们的相应服务,或者无法展示相关信息,但不影响使用平台的健康咨询等核心服务。\n" + + "为您提供安全保障\n" + + "请注意,为向您提供更好的安全保障,您可以向我们提供姓名、身份证、就诊卡、邮箱等身份信息完成实名认证。如您拒绝提供上述信息,可能无法预约或咨询特定专家、继续可能存在风险的操作等,但不会影响您使用浏览、搜索等服务。\n" + + "为提高您使用我们提供服务的安全性,更好地预防钓鱼网站、欺诈、网络漏洞、计算机病毒、网络攻击、网络侵入等安全风险,更准确地识别违反法律法规或平台相关协议规则的情况,我们可能使用或整合您的账户信息、交易信息、设备信息、有关网络日志以及我们取得您授权或依据法律共享的信息,来进行身份验证、检测及防范安全事件,并依法采取必要的记录、审计、分析、处置措施。\n" + + "4. 其他用途\n" + + "我们将信息用于本声明和政策未载明的其他用途,或者将基于特定目的收集而来的信息用于其他目的时,会事先征求您的同意。\n" + + "5. 征得授权同意的例外\n" + + "根据相关法律法规规定,以下情形中收集您的个人信息无需征得您的授权同意:\n" + + "1、与国家安全、国防安全有关的;\n" + + "2、与公共安全、公共卫生、重大公共利益有关的;\n" + + "3、与犯罪侦查、起诉、审判和判决执行等有关的;\n" + + "4、出于维护个人信息主体或其他个人的生命、财产等重大合法权益但又很难得到您本人同意的;\n" + + "5、所收集的个人信息是您自行向社会公众公开的;\n" + + "6、从合法公开披露的信息中收集个人信息的,如合法的新闻报道、政府信息公开等渠道;\n" + + "7、根据您的要求签订合同所必需的;\n" + + "8、用于维护所提供的产品或服务的安全稳定运行所必需的,例如发现、处置产品或服务的故障;\n" + + "9、为合法的新闻报道所必需的;\n" + + "10、学术研究机构基于公共利益开展统计或学术研究所必要,且对外提供学术研究或描述的结果时,对结果中所包含的个人信息进行去标识化处理的;\n" + + "11、法律法规规定的其他情形。\n" + + "如我们停止平台的产品或服务,我们将及时停止继续收集您个人信息的活动,对所持有的个人信息进行删除或匿名化处理。\n" + + "6. 设备权限调用:在向您提供服务的过程中,为了实现特定的产品功能,我们会向您的设备系统申请调用以下设备权限,申请前我们会征询您的同意,您可以选择“允许”或者“禁止”权限申请。申请成功后,您可以随时进入手机“设置-权限管理”中关闭相应权限,不过权限关闭后有关产品功能可能无法正常使用,请您理解:\n" + + "(1) 位置\n" + + "您需要授权我们使用位置权限,以便于我们基于位置向您展示、推送急救资源,显示医院位置等信息。您在首次打开移动平台和使用相关业务时会看到弹窗提醒,询问您是否授权。\n" + + "(2) 通讯录\n" + + "在视话咨询时为保护医生和员工双方个人信息安全,我们提供中转电话服务。您需要授权我们使用通讯录权限,以便于我们对此电话进行标识。您在使用相应功能时会看到弹窗提醒,询问您是否授权。如您拒绝授权,可能无法正常在视话咨询中使用电话进行沟通。\n" + + "(3) 相机、相册\n" + + "您需要授权我们使用相机权限,以便于使用我们的核心业务功能,如在咨询中发送图片或视频通话。您在使用相应功能时会看到弹窗提醒,询问您是否授权。如您拒绝授权,可能无法正常在咨询中进行视频通话。\n" + + "(4) 通知栏\n" + + "您需要授权我们使用通知权限,以便于使用所有基于此权限实现的功能,如咨询状态、体检报告等各类消息提醒。您在首次打开移动平台时会看到弹窗提醒,询问您是否授权。如您拒绝授权,可能无法正常获取各类消息提醒。\n" + + "(5) 存储\n" + + "您需要授权我们使用存储权限,以便于在急救和咨询时候使用发送文件、图片、照片等功能,同时我们的移动平台可以写入、存储员工信息和日志等。您在首次打开移动平台和使用相应功能时会看到弹窗提醒,询问您是否授权。如您拒绝授权,可能无法正常使用使用移动平台。\n" + + "(6) 麦克风\n" + + "您需要授权我们使用麦克风权限,以便于使用我们的核心业务功能,如在咨询咨询中发送语音消息或视频通话。您在使用相应功能时会看到弹窗提醒,询问您是否授权。如您拒绝授权,可能无法正常在咨询中进行视频通话。\n" + + "(7) 悬浮窗\n" + + "您需要授权我们使用悬浮窗权限,当您在咨询/应急业务时正在进行语音/音视频通话时候您可切换APP继续使用手机其他功能。您在使用相应功能时会看到弹窗提醒,询问您是否授权。如您拒绝授权,可能无法正常在咨询中进行视频通话。\n" + + "设备权限 使用目的\n" + + "存储 聊天过程中发送和接收相关文件\n" + + "相机 应急请求和咨询专家业务聊天过程中发送图片\n" + + "相册 应急请求和咨询专家业务聊天过程中发送图片\n" + + "位置 用于向用户提供地图上的资源数据,聊天发送位置\n" + + "麦克风(音频) 与专家音视频交流、聊天语音输入,拍摄视频\n" + + "悬浮窗 在其他程序页面仍能保持应用内通话\n" + + "短信 获取验证码修改密码\n" + + "通知栏 对您在系统内使用的业务(如预约体检、专家咨询),及时进行通知\n" + + "拨打电话 在查看地图资源发起急救时候,跳转手机拨打电话\n" + + "日历 找专家进行咨询、预约专家,大病就医挂号医院,预约去医院体检的日期需访问日历\n" + + "请您注意,您开启以上权限即代表您授权我们可以收集和使用这些个人信息来实现上述的功能,您关闭权限即代表您取消了这些授权,则我们将不再继续收集和使用您的这些个人信息,也无法为您提供上述与这些授权所对应的功能。您关闭权限的决定不会影响此前基于您的授权所进行的个人信息的处理。除此以外,我们在相关业务功能中可能还需要您开启设备的其他访问权限,详细权限和使用目的如下:\n" + + "(1)android.permission.INTERNET(访问网络权限):实现应用程序联网\n" + + "(2)android.permission.ACCESS_WIFI_STATE(获取WiFi状态权限):监控网络变化,提示用户当前网络环境\n" + + "(3)android.permission.ACCESS_NETWORK_STATE(获取网络状态权限):监控网络变化,提示用户当前网络环境\n" + + "(4)android.permission.VIBRATE(使用振动权限):允许手机振动\n" + + "(5)android.permission.WAKE_LOCK(唤醒锁定权限):允许程序在手机屏幕关闭后后台进程仍然运行,保持屏幕唤醒\n" + + "(6)android.permission.RESTART_PACKAGES(结束系统任务权限):重新启动应用\n" + + "(7)android.permission.MODIFY_AUDIO_SETTINGS(修改声音设置权限):修改全局音频设置,例如调节音量和用于输出的扬声器\n" + + "(8)android.permission.BLUETOOTH(使用蓝牙权限):小程序蓝牙功能模块使用\n" + + "(9)(android.permission.BLUETOOTH_ADMIN)(蓝牙管理权限):小程序蓝牙功能模块使用\n" + + "(10)android.permission.SYSTEM_ALERT_WINDOW(悬浮窗权限):观看直播、短视频悬浮窗播放\n" + + "(11) android.permission.ACCESS_BACKGROUND_LOCATION(支持后台访问位置权限):保持持续定位能力\n" + + "(12)android.permission.WRITE SYSTEM(读写系统设置权限):允许应用读写系统设置项\n" + + "(13)android.permission.GET_TASKS(获取任务信息权限):允许应用获取当前或最近运行的应用\n" + + "(14)android.permission.CHANGE_WIFI_STATE(改变WiFi状态权限):允许应用改变WiFi状态\n" + + "(15)android.permission.CHANGE_NETWORK_STATE(改变网络连接状态):允许应用改变网络连接状态\n" + + "四、我们如何使用 Cookie 和同类技术\n" + + "1. 4.1 Cookie\n" + + "为确保网站正常运转、为您获得更轻松的访问体验、向您推荐您可能感兴趣的内容,我们会在您的计算机或移动设备上存储名为 Cookie 的小数据文件。Cookie 通常包含标识符、站点名称以及一些号码和字符。借助于 Cookie,网站能够记住您的选择,提供个性化增强服务等。\n" + + "您可根据自己的偏好管理或删除Cookie。有关详情,请参见 AboutCookies.org。您可以清除计算机上保存的所有 Cookie,大部分网络浏览器都设有阻止 Cookie 的功能。但如果您这么做,则需要在每一次访问平台时更改员工设置。如需详细了解如何更改浏览器设置,请访问您使用的浏览器的相关设置页面。\n" + + "2. 4.2 网站信标和像素标签\n" + + "除 Cookie 外,我们还会在网站上使用网站信标和像素标签等其他同类技术。例如,我们向您发送的电子邮件可能含有链接至我们网站内容的地址链接,如果您点击该链接,我们则会跟踪此次点击,帮助我们了解您的服务偏好以便于我们主动改善服务体验。网站信标通常是一种嵌入到网站或电子邮件中的透明图像。借助于电子邮件中的像素标签,我们能够获知电子邮件是否被打开。\n" + + "五、我们如何共享、转让、公开披露您的个人信息\n" + + "1. 共享\n" + + "我们不会与平台服务提供者以外的任何公司、组织和个人分享您的个人信息,但以下情况除外:\n" + + "1、在获取明确同意的情况下共享:获得您的明确同意后,我们会与其他方共享您的个人信息。\n" + + "2、我们可能会根据法律法规规定,或按政府主管部门的强制性要求,对外共享您的个人信息。\n" + + "3、与授权合作机构共享:仅为实现本声明和政策中声明的目的,我们的某些服务将由授权合作机构提供。我们可能会与合作机构共享您的某些个人信息,以提供更好的服务和员工体验。我们仅会出于合法、正当、必要、特定、明确的目的共享您的个人信息,并且只会共享提供服务所必要的个人信息。我们的合作机构无权将共享的个人信息用于任何其他用途。\n" + + "目前,我们的授权合作机构包括以下类型:\n" + + "(1)分析服务类的授权合作机构。除非得到您的许可,否则我们不会将您的个人身份信息(指可以识别您身份的信息,例如姓名或电子邮箱,通过这些信息可以联系到您或识别您的身份)与提供分析服务的合作机构分享。我们会向这些合作机构提供有关其服务覆盖面和有效性的信息,而不会提供您的个人身份信息,或者我们将这些信息进行汇总,以便它不会识别您。\n" + + "(2)服务提供方和其他合作机构。我们将信息发送给支持我们业务的服务提供方和其他合作机构,这些支持包括提供技术基础设施服务、分析我们服务的使用方式、衡量服务的有效性、提供员工服务、支付便利或进行学术研究和调查。\n" + + "对我们与之共享个人信息的机构,我们会与其签署严格的保密协定,要求他们按照我们的说明、声明和政策以及其他任何相关的保密和安全措施来处理个人信息。\n" + + "2. .转让\n" + + "除以下情形外,我们不会将您的个人信息转让给任何公司、组织或个人:\n" + + "(1)事先获得您的明确同意的;\n" + + "(2)根据法律法规规定,或者政府主管部门、司法机关的强制要求必须对外转让的;\n" + + "(3)涉及公司合并、分立、解散、资产或业务转让、破产清算或类似的交易时,若涉及到您的个人信息转让,我们会要求新持有您个人信息的公司、组织或个人继续受本政策的约束,否则我们将要求该等公司、组织或个人重新取得您的授权同意。\n" + + "3. 公开披露\n" + + "除以下情形外,我们不会公开披露您的个人信息:\n" + + "(1)事先获得您的明确同意的;\n" + + "(2)根据法律法规规定,或者政府主管部门、司法机关的强制要求必须公开披露的。在符合法律法规的前提下,当我们收到上述披露信息的请求时,我们会要求必须出具与之相应的法律文件,如传票或调查函。我们坚信,对于要求我们提供的信息,应该在法律允许的范围内尽可能保持透明。我们对所有的请求都将进行慎重的审查,以确保其具备合法依据,且仅限于执法部门因特定调查目的且有合法权利获取的数据。\n" + + "4. 共享、转让、公开披露个人信息授权同意的例外\n" + + "根据相关法律法规的规定,在以下情形中,我们可以在不征得您的授权同意的情况下共享、转让、公开披露您的个人信息:\n" + + "A.与国家安全、国防安全有关的;\n" + + "B.与公共安全、公共卫生、重大公共利益有关的;C.与犯罪侦查、起诉、审判和判决执行等有关的;\n" + + "D.出于维护您或其他个人的生命、财产等重大合法权益但又很难得到本人同意的;\n" + + "E.您自行向社会公众公开的个人信息;\n" + + "F.从合法公开披露的信息中收集到的个人信息的,如合法的新闻报道、政府信息公开等渠道。\n" + + "G.法律法规规定的其他情形。\n" + + "根据法律规定,共享、转让经去标识化处理的个人信息,且确保数据接收方无法复原并重新识别个人信息主体的,不属于个人信息的对外共享、转让及公开披露行为,对此类数据的保存及处理将无需另行向您通知并征得您的同意。\n" + + "六、员工业务数据和公开信息\n" + + "不同于您的个人信息,对于员工业务数据和公开信息,平台将按如下方式处理:\n" + + "1. 员工业务数据\n" + + "1、您通过平台提供的服务,加工、存储、上传、下载、分发以及通过其他方式处理的数据,均为您的员工业务数据。平台作为服务提供者,只会严格执行您的指示处理您的业务数据,除按与您协商一致或执行明确的法律法规要求外,不对您的业务数据进行任何非授权的使用或披露。\n" + + "2、您应对您的员工业务数据来源及内容负责,平台提示您谨慎判断数据来源及内容的合法性。因您的员工业务数据内容违反法律法规、部门规章或国家政策而造成的全部结果及责任均由您自行承担。\n" + + "3、根据您与平台协商一致,平台在您选定的数据中心存储员工业务数据。我们恪守对员工的安全承诺,根据适用的法律保护员工存储在平台数据中心的数据。\n" + + "2. 公开信息\n" + + "1、公开信息是指您公开分享的任何信息,任何人都可以在使用和未使用平台服务期间查看或访问这些信息。例如您在社区、论坛发布的信息。\n" + + "2、为使用平台的服务,可能存在您必须公开分享的信息。\n" + + "七、我们如何保护您的个人信息\n" + + "1.我们已使用符合业界标准的安全防护措施保护您提供的个人信息,防止您的个人信息遭到未经授权访问、使用、修改、公开披露、损坏或丢失。我们会采取一切合理可行的措施,保护您的个人信息,比如:\n" + + "(1)我们设立了网络安全和个人信息保护机构,专门负责网络安全和个人信息保护事务;\n" + + "(2)我们的网络服务采取了传输层安全协议等加密技术,通过https等方式提供浏览服务,确保用户数据在传输过程中的安全;\n" + + "(3)我们采取MD5、SHA256等加密技术对您的个人信息进行加密存储,增强个人信息在使用中的安全性;\n" + + "(4)我们采用严格的数据访问权限控制和多重身份认证技术保护个人信息,避免数据被违规使用;\n" + + "(5)我们采用代码安全检查、数据访问日志分析技术进行个人信息安全审计;\n" + + "(6)我们建立了客户信息保护管理规定、客户信息分级分类管理规定、日常操作规程等一系列管理制度来规范个人信息的存储和使用;\n" + + "(7)我们定期举办信息安全和个人信息保护培训课程,加强员工对于个人信息保护重要性的认识;\n" + + "(8)我们与所有可能接触个人信息的员工签订了保密协议,对关键岗位人员进行背景审查,并建立了严格的访问权限控制、权限审批流程和监控、审计机制;\n" + + "(9)我们与所有可能接触用户个人信息的合作伙伴均签署了严格的保密协议或数据保护专用条款,并要求可能接触到您个人信息的所有人员履行相应的保密和数据保护义务。如果第三方合作伙伴未履行保密和数据保护义务,可能会被我们追究法律责任并被我们终止合作;\n" + + "2.我们已经通过了国家信息安全等级保护测评和备案,最高备案等级为二级。\n" + + "3.我们会采取一切合理可行的措施,确保未收集无关的个人信息。我们只会在达成本政策所述目的所需的期限内保留您的个人信息,除非需要延长保留期或者受到法律允许。\n" + + "4.互联网并非绝对安全的环境,而且电子邮件、即时通讯、社交软件等与其他用户的交流方式无法确定是否完全加密,我们强烈建议您不用通过此类方式发送个人信息。若确需使用,在使用此类工具时请使用复杂密码,并注意保护您的个人信息安全。我们将尽力保障您个人信息的安全性。如果我们的物理、技术、或管理防护设施遭到破坏,导致信息被非授权访问、公开披露、篡改、或毁坏,导致您的合法权益受损,我们将全力配合保护您的权益,并依法承担我们应承担的赔偿责任。\n" + + "5.在不幸发生个人信息安全事件后,我们将按照法律法规的要求及时向您告知安全事件的基本情况和可能的影响、我们已采取或将采取的处置措施、您可自主防范和降低风险的建议、对您的补救措施等。我们将及时将事件相关情况以邮件、信函、电话、推送通知等方式告知您,难以逐一告知时,我们会采取合理、有效的方式发布公告。同时,我们还将按照监管部门要求,主动上报个人信息安全事件的处置情况。\n" + + "八、您如何管理您的个人信息(您的权力)\n" + + "您可以通过以下方式访问及管理您的个人信息:\n" + + "8.1 访问您的个人信息\n" + + "您的账号信息:您可在“我的”中查询您的账户、姓名、性别、手机、身份证号、工作信息、健康类型、学历、工号、工种、住址,紧急联系人的姓名、电话等。\n" + + "您和您亲属的健康信息:您可在“咨询人管理”中查询您和您亲属手机号码、患者姓名、性别、出生日期、与患者的关系、身高体重、所在城市;健康信息:病症、患病时长、体检报告、住院记录、诊治情况、用药记录、以往病史、过敏信息、家族史、患病史等健康信息。\n" + + "您的订单、工单信息:您可在“我的-我的咨询”、“我的-我的应急工单”、“我的-大病就医工单”、“健康体检-体检预约”等各个业务的对应入口查看、评价订单和工单信息。\n" + + "您的体检报告:你可在“健康体检-体检报告”和“健康档案-健康现状”、“健康档案-体检数据分析”查看个人的体检报告详情和重点指标的分析。\n" + + "对于您在使用我们的产品或服务过程中向我们提供或产生的其他信息,只要我们不需要过多投入,我们会向您提供。您可以通过拨打我们的客服电话提出访问申请,我们将在30天内回复您的访问请求。\n" + + "对于您在使用我们服务过程中产生的其他个人信息,我们将根据本条“8.9 响应您的上述请求”中的相关安排向您提供。\n" + + "8.2 更正或补充您的个人信息\n" + + "当您发现我们处理的您的个人信息有误或者您需要更正该等信息时,您可以通过内设置的自动更正功能、电子邮件或者拨打客服电话等方式进行修改或更正。您如果需要更正其他个人信息,可通过联系人工客服向我们提出更正申请。\n" + + "可自主更正的信息:\n" + + "账号信息:您可在“我的”中更新您的头像,紧急联系人的姓名、电话等。\n" + + "您和您亲属的健康信息:您可在“咨询人管理”中更正您和您亲属手机号码、患者姓名、性别、出生日期、与患者的关系、身高体重、所在城市;健康信息:病症、患病时长、体检报告、住院记录、诊治情况、用药记录、以往病史、过敏信息、家族史、患病史等健康信息。\n" + + "8.3 删除您的个人信息\n" + + "您在我们的产品与/或服务页面中可以直接清除或删除的信息,包括浏览信息、紧急联系人信息、咨询人信息。\n" + + "在以下情形中,您可以向我们提出删除个人信息的请求:\n" + + "(1)如果我们处理个人信息的行为违反了法律法规的强制性规定;\n" + + "(2)如果我们收集、使用您的个人信息,却未征得您的同意(依法无需征得同意的情况除外);\n" + + "(3)如果我们处理个人信息的行为违反了与您的约定;\n" + + "(4)如果您不再使用我们的产品或服务,或您注销了账号;\n" + + "(5)如果我们不再为您提供产品或服务。\n" + + "收到您的删除请求后,我们会根据您及相关法律法规的要求进行后续删除处理并向您反馈结果。若我们决定响应您的删除请求,我们还将同时通知从我们获得您的个人信息的实体,要求其及时删除,除非法律法规另有规定,或这些实体获得您的独立授权。\n" + + "当您从我们的服务中删除信息后,我们可能不会立即备份系统中删除相应的信息,但会在备份更新时删除这些信息。\n" + + "8.4 改变您授权同意的范围\n" + + "您可以通过删除信息、关闭设备功能、在平台中进行隐私设置等方式改变您授权我们继续收集个人信息的范围或撤回您的授权。\n" + + "请您理解,每个业务功能需要一些基本的个人信息才能得以完成(见本隐私权政策“我们如何收集和使用您的信息”)。当您收回同意后,我们将不再处理相应的个人信息。但您收回同意的决定,不会影响此前基于您的授权而开展的个人信息处理。\n" + + "8.5 个人信息主体注销账户\n" + + "在符合平台单项服务的服务协议约定条件及国家相关法律法规规定的情况下,您的该项平台服务帐号可能被注销或删除。当帐号注销或被删除后,与该帐号相关的、该单项服务项下的全部服务资料和数据将依照单项服务的服务协议约定删除或匿名化处理。\n" + + "8.6 约束信息系统自动决策\n" + + "在某些业务功能中,我们可能仅依据信息系统、算法等在内的非人工自动决策机制做出决定。如果这些决定显著影响您的合法权益,您有权要求我们做出解释,我们也将在不侵害平台保密或其他员工权益、社会公共利益的前提下提供申诉方法。\n" + + "8.7约束信息系统自动决策\n" + + "在某些业务功能中,我们可能仅依据信息系统、算法在内的非人工自动决策机制作出决定。如果这些决定显著影响您的合法权益,您有权要求我们作出解释,我们也将提供适当的救济方式。\n" + + "8.8举报和投诉\n" + + "如果您发现您的个人信息可能被泄露,或者我们的工作人员或合作伙伴在处理您的个人信息时有任何违法违规行为,您可以通过拨打客服热线或者发送电子邮件的方式向我们进行举报和投诉。\n" + + "8.9 响应您的上述请求\n" + + "为保障安全,您可能需要提供书面请求,或以其他方式证明您的身份。我们可能会先要求您验证自己的身份,然后再处理您的请求。我们将在15个工作日内做出答复。\n" + + "对于那些无端重复、需要过多技术手段(例如,需要开发新系统或从根本上改变现行惯例)、给他人合法权益带来风险或者非常不切实际的请求,我们可能会予以拒绝。\n" + + "在以下情形中,按照法律法规要求,我们将无法响应您的请求:\n" + + "(1) 与国家安全、国防安全有关的;\n" + + "(2) 与公共安全、公共卫生、重大公共利益有关的;\n" + + "(3) 与犯罪侦查、起诉、审判和执行判决等有关的;\n" + + "(4) 有充分证据表明个人信息主体存在主观恶意或滥用权利的;\n" + + "(5) 响应您的请求将导致您或其他个人、组织的合法权益受到严重损害的;\n" + + "(6) 涉及商业秘密的。\n" + + "九、我们如何处理未成年人的个人信息\n" + + "1.蚁熊健康非常重视对未成年人个人信息的保护。若您是18周岁以下的未成年人,在使用我们的产品与/或服务前,应事先取得您监护人的同意。蚁熊健康根据国家相关法律法规的规定保护未成年人的个人信息。\n" + + "2.我们不会主动直接向未成年人收集其个人信息。对于经监护人同意而收集未成年人个人信息的情况,我们只会在受到法律允许、监护人同意或者保护未成年人所必要的情况下使用、共享、转让或披露此信息。\n" + + "3.如果有事实证明未成年人在未取得监护人同意的情况下注册使用了我们的产品与/或服务,我们会与相关监护人协商,并设法尽快删除相关个人信息。\n" + + "十、本声明和政策如何更新\n" + + "我们的隐私政策可能变更。未经您明确同意,我们不会削减您按照声明和政策所应享有的权利。 我们会在本页面上发布对本声明和政策所做的任何变更。\n" + + "对于重大变更,我们还会提供更为显著的通知(包括我们会通过网站公示的方式进行通知甚至向您提供弹窗提示)。\n" + + "本声明和隐私所指的重大变更包括但不限于:\n" + + "1、 我们的服务模式发生重大变化。如处理个人信息的目的、处理的个人信息类型、个人信息的使用方式等;\n" + + "2、 我们在所有权结构、组织架构等方面发生重大变化。如业务调整等引起的所有者变更等;\n" + + "3、 个人信息共享或公开披露的主要对象发生变化;\n" + + "4、 您参与个人信息处理方面的权利及其行使方式发生重大变化;\n" + + "5、 我们负责处理个人信息安全的责任部门、联络方式等发生变化时;\n" + + "6、 个人信息安全影响评估报告表明存在高风险时。\n" + + "7、 我们还会将本声明和隐私的旧版本存档,供您查阅。\n" + + "十一、如何联系我们\n" + + "1.如果您对本政策有任何疑问、意见或建议,可通过以下方式与我们联系:\n" + + "(1)拨打客服热线电话029-86581752\n" + + "(2)发送电子邮件至123456789@qq.com\n" + + "(3)邮寄地址:陕西省西安市未央区未央路151号,收件人:陈天宇\n" + + "我们的客服部门将会同个人信息保护部门30天内进行回复,并协助解决您的问题。\n" + + "2.如果您对我们的回复不满意,特别是我们的个人信息处理行为损害了您的合法权益,您还可以通过以下外部途径寻求解决方式:向网信、工商、公安等监管部门进行投诉或举报。" + @Parcelize + enum class ConsultType(val type: String): Parcelable { + IMAGE_TEXT_CONSULT("1"), + AUDIO_VIDEO_CONSULT("2") + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/IMInputActionSettingUtils.kt b/app/src/main/java/com/xjjk/healthyclients/utils/IMInputActionSettingUtils.kt new file mode 100644 index 0000000..ab8f2b1 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/IMInputActionSettingUtils.kt @@ -0,0 +1,67 @@ +package com.xjjk.healthyclients.utils + +import com.xjjk.healthyclients.retrofit.UrlConfig +import com.tencent.qcloud.tuikit.tuichat.classicui.setting.InputActionSetting + +object IMInputActionSettingUtils { + /** + * 应急就医IM功能配置 + */ + fun createEmergencySetting(){ + var inputActionSetting = InputActionSetting.createInstance() + inputActionSetting.CurrentResourceHost = UrlConfig.IMAGE_BASE_URL + inputActionSetting.isDisableAudioCall = false + inputActionSetting.isDisableVideoCall = false + inputActionSetting.isDisableArchives = true + inputActionSetting.disableFinishName = true + inputActionSetting.disableEvaluate = false + inputActionSetting.isDisableMedicalExaminationReport = true + inputActionSetting.isDisableSendMessage = false + inputActionSetting.isDisableFinishSession = false + } + /** + * 图文咨询IM功能配置 + */ + fun createImageTextConsultSetting(isSelf: Boolean = false, disableSendMessage: Boolean = false, disableEvaluate: Boolean = false){ + var inputActionSetting = InputActionSetting.createInstance() + inputActionSetting.CurrentResourceHost = UrlConfig.IMAGE_BASE_URL + inputActionSetting.isDisableAudioCall = true + inputActionSetting.isDisableVideoCall = true + inputActionSetting.isDisableArchives = false + inputActionSetting.disableFinishName = false + inputActionSetting.disableEvaluate = disableEvaluate + inputActionSetting.isDisableMedicalExaminationReport = !isSelf + inputActionSetting.isDisableSendMessage = disableSendMessage + inputActionSetting.isDisableFinishSession = false + } + /** + * 小助手IM功能配置 + */ + fun createAssistantSetting(){ + var inputActionSetting = InputActionSetting.createInstance() + 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.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 + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/LimitInputTextWatcher.java b/app/src/main/java/com/xjjk/healthyclients/utils/LimitInputTextWatcher.java new file mode 100644 index 0000000..c874c4c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/LimitInputTextWatcher.java @@ -0,0 +1,60 @@ +package com.xjjk.healthyclients.utils; + +import android.text.Editable; +import android.text.TextWatcher; +import android.widget.EditText; + +import com.xjjk.healthyclients.superfuntion.StringExtKt; + +import java.util.logging.Handler; + +public class LimitInputTextWatcher implements TextWatcher { + + private EditText et = null; + + private String regex; + // 默认的筛选条件(正则:只能输入中文) + private String DEFAULT_REGEX = "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,16}$"; + + //下面只可输入 数字、大小写字母和汉字.特殊字符不行. + //private String DEFAULT_REGEX = "[^a-zA-Z0-9\u4E00-\u9FA5]"; + + // 构造方法 + public LimitInputTextWatcher(EditText et) { + this.et = et; + this.regex = DEFAULT_REGEX; + } + + //构造方法 + public LimitInputTextWatcher(EditText et, String regex) { + this.et = et; + this.regex = regex; + } + + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) { + String str = editable.toString(); +// String inputStr = clearLimitStr(regex, str); + System.out.println("当前线程"+Thread.currentThread().getName()); + String inputStr = StringExtKt.formatToPassWord(str); + et.removeTextChangedListener(this); + // et.setText方法可能会引起键盘变化,所以用editable.replace来显示内容 + editable.replace(0, editable.length(), inputStr.trim()); + et.addTextChangedListener(this); + } + + // 清除不符合条件的内容 + private String clearLimitStr(String regex, String str) { + return str.replaceAll(regex, ""); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/LocationManager.kt b/app/src/main/java/com/xjjk/healthyclients/utils/LocationManager.kt new file mode 100644 index 0000000..4a92c28 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/LocationManager.kt @@ -0,0 +1,140 @@ +package com.xjjk.healthyclients.utils + + +import android.content.Context +import com.amap.api.location.AMapLocationClient +import com.amap.api.location.AMapLocationClientOption +import com.amap.api.location.AMapLocationListener +import com.orhanobut.logger.Logger +import java.io.File +import java.io.FileWriter +import java.io.IOException +import java.text.SimpleDateFormat +import java.util.Date + +class LocationManager( + context: Context?, + private val offlineSavePath: String?, + locationCallBack: LocationCallBack? +) { + //声明AMapLocationClient类对象 + private var mLocationClient: AMapLocationClient? = null + private var DATE_FORMAT = SimpleDateFormat("yyyyMMdd") + private var todayName: String? = null + var isSaveOfflineLocation: Boolean = false + + companion object { + private val TAG = LocationManager::class.java.simpleName + } + + //回调信息对象 + class LocationBean { + var time: Long? = null + var latitude: Double? = null + var longitude: Double? = null + var address: String? = null + var locationDetail: String? = null + } + + //回调 + interface LocationCallBack { + fun onLocationInfo(locationBean: LocationBean?) + } + + //声明定位回调监听器 + private var mLocationListener = AMapLocationListener { aMapLocation -> + if (aMapLocation != null) { + if (aMapLocation.errorCode == 0) { + val gpsAccuracyStatus = aMapLocation.gpsAccuracyStatus //0差 1好 -1未知 + val locationType = + aMapLocation.locationType //0失败 1gps 2前次定位 4:缓存 5:wifi 6:基站 8:离线 9:缓存 + val accuracy = aMapLocation.accuracy //精度 + val gpsSatellites = aMapLocation.satellites //搜星数 + val trustedLevel = aMapLocation.trustedLevel //定位可信度 1好 2正常 3低 4差 + val speed = aMapLocation.speed //速度 + val locationDetail = + "卫星信号强度:$gpsAccuracyStatus 定位类型:$locationType 精度:$accuracy gps搜星数:$gpsSatellites 可信度:$trustedLevel 速度:$speed" + //去掉离线缓存 +// if (locationType == AMapLocation.LOCATION_TYPE_FIX_CACHE || locationType == AMapLocation.LOCATION_TYPE_LAST_LOCATION_CACHE) { +// return@AMapLocationListener +// } + //通过回调接口返回回去 +// var bean = LocationBean() +// bean.time = aMapLocation.time +// bean.latitude = aMapLocation.latitude +// bean.longitude = aMapLocation.longitude +// bean.address = aMapLocation.address +// bean.locationDetail = locationDetail +// locationCallBack!!.onLocationInfo(bean) + println("定位${aMapLocation.latitude}--${aMapLocation.longitude}") + ConstantUtils.mCurrentLat=aMapLocation.latitude + ConstantUtils.mCurrentLon=aMapLocation.longitude + //保存经纬度到本地文件(长链接没有连接时) + saveOfflineLocation(aMapLocation.latitude, aMapLocation.longitude) + } else { + //定位失败时,可通过ErrCode(错误码)信息来确定失败的原因,errInfo是错误信息,详见错误码表。 + Logger.e( + TAG, "location Error, ErrCode:" + + aMapLocation.errorCode + + ", errInfo:" + + aMapLocation.errorInfo + ) + } + } + } + + //isSaveOfflineLocation=true保存经纬度到本地,false不保存 + fun isSaveOfflineLocation(isSaveOfflineLocation: Boolean) { + this.isSaveOfflineLocation = isSaveOfflineLocation + } + + //本地保存经纬度 + private fun saveOfflineLocation(lat: Double, lon: Double) { + if (offlineSavePath!!.isBlank() || !isSaveOfflineLocation) return + val todayPath: String = offlineSavePath + todayName + val locFile = File(todayPath) + try { + if (!locFile.exists()) locFile.createNewFile() + val time = System.currentTimeMillis() / 1000 + val strData = "$time,$lat,$lon;" + // 打开一个写文件器,构造函数中的第二个参数true表示以追加形式写文件 + val writer = FileWriter(todayPath, true) + writer.write(strData) + writer.close() + } catch (e: IOException) { + e.printStackTrace() + } + } + + fun startLocation() { + mLocationClient!!.startLocation()//启动定位 + } + + fun stopLocation() { + mLocationClient!!.stopLocation() //停止定位后,本地定位服务并不会被销毁 + } + + + init { + //获取当天时间用于本地保存的文件名 + val format = DATE_FORMAT.format(Date()) + todayName = File.separator + "$format.txt" + + if (mLocationClient != null) { + } else { + //初始化定位 + mLocationClient = AMapLocationClient(context) + //声明AMapLocationClientOption对象 + val locationOption = AMapLocationClientOption() + locationOption.setOnceLocation(true) + locationOption.locationMode = + AMapLocationClientOption.AMapLocationMode.Hight_Accuracy + locationOption.interval = (10 * 1000).toLong() + locationOption.isSensorEnable = true + //给定位客户端对象设置定位参数 + mLocationClient!!.setLocationOption(locationOption) + //设置定位回调监听 + mLocationClient!!.setLocationListener(mLocationListener) + } + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/MapUtils.java b/app/src/main/java/com/xjjk/healthyclients/utils/MapUtils.java new file mode 100644 index 0000000..9099cf2 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/MapUtils.java @@ -0,0 +1,198 @@ +package com.xjjk.healthyclients.utils; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; + +import androidx.annotation.DrawableRes; + +import com.amap.api.maps.AMap; +import com.amap.api.maps.CameraUpdateFactory; +import com.amap.api.maps.model.LatLng; +import com.amap.api.maps.model.LatLngBounds; +import com.google.gson.Gson; +import com.xjjk.healthyclients.R; +import com.xjjk.healthyclients.bean.AEDResultBean; +import com.xjjk.healthyclients.bean.emergency.LocationResourceBean; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; + +public class MapUtils { + + /** + * 设置显示在规定宽高中的地图经纬度范围。 + * 参数: + * bounds - 地图显示经纬度范围。 + * width - 限制区域的宽度,单位像素。 + * height - 限制区域的高度,单位像素。 + * padding - 经纬度范围与限制区域的边缘间隙,单位像素。 + * + */ + public static void setMapZoonlo(AMap map, int padding, LatLngBounds.Builder builder){ + LatLngBounds bounds = builder.build(); + map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding)); + + } + public static void setMapZoonlo(AMap map, int padding, ArrayList list){ + LatLngBounds.Builder builder = LatLngBounds.builder(); + if (list==null||list.size()==0) { + return; + } + for (int i = 0; i < list.size(); i++) { + builder.include(new LatLng(list.get(i).getLatitude(),list.get(i).getLongitude())); + } + LatLngBounds bounds = builder.build(); + map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding)); + + } + + public static ArrayList isInstalled(Context context) { + ArrayList strings = new ArrayList<>(); + PackageManager manager = context.getPackageManager(); + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { + Intent intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER); + List list = manager.queryIntentActivities(intent, PackageManager.MATCH_ALL); + for (int i = 0,count=list.size(); i installedPackages = manager.getInstalledPackages(0); + if (installedPackages != null) { + for (PackageInfo info : installedPackages) { + if (info.packageName.equals("com.baidu.BaiduMap")){ + strings.add("百度地图"); + }else if (info.packageName.equals("com.autonavi.minimap")){ + strings.add("高德地图"); + } + + } + } + } + System.out.println("获取到的安装信息"+new Gson().toJson(strings)); + return strings; + } + + public static LatLng gaoDeToLatLng(double gd_lon, double gd_lat) { + return new LatLng(gd_lon,gd_lat); + } + + public static LatLng gaoDeToBaidu(double gd_lon, double gd_lat) { +// double[] bd_lat_lon = new double[2]; +// double PI = 3.14159265358979324 * 3000.0 / 180.0; +// double x = gd_lon, y = gd_lat; +// double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * PI); +// double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * PI); +// bd_lat_lon[0] = z * Math.cos(theta) + 0.0065; +// bd_lat_lon[1] = z * Math.sin(theta) + 0.006; + double x = gd_lon, y = gd_lat; + double x_pi = 3.14159265358979324 * 3000.0 / 180.0; + double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi); + double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi); + double tempLon = z * Math.cos(theta) + 0.0065; + double tempLat = z * Math.sin(theta) + 0.006; + return new LatLng(tempLon,tempLat); + } + + public static @DrawableRes int getMarkerIcon(String type){ + switch (type){ + case "1": { + return R.drawable.ic_oil_hospital; + } + case "2": { + return R.drawable.ic_cooperative_hospital; + } + case "3": { + return R.drawable.ic_medical_point; + } + case "4": { + return R.drawable.ic_ade; + } + case "5": { + return R.drawable.ic_ambulance; + } + case "6": { + return R.drawable.ic_first_aider; + } + default:{ + return R.drawable.ic_oil_hospital; + } + } + } + public static @DrawableRes int getMarkerIcon(int type){ + switch (type){ + case 1: { + return R.drawable.ic_ade; + } + case 2: { + return R.drawable.ic_medical_point; + } + case 3: { + return R.drawable.ic_ambulance; + } + case 4: { + return R.drawable.ic_cooperative_hospital; + } + case 5: { + return R.drawable.ic_first_aider; + } + default:{ + return R.drawable.ic_oil_hospital; + } + } + } + + public static LatLngBounds getLatLngBounds(LatLng centerpoint, List pointList) { + LatLngBounds.Builder b = LatLngBounds.builder(); + if (centerpoint != null){ + for (int i = 0; i < pointList.size(); i++) { + LatLng p = new LatLng( + pointList.get(i).getLatitude(), + pointList.get(i).getLongitude() + ); + LatLng p1 = new LatLng((centerpoint.latitude * 2) - p.latitude, (centerpoint.longitude * 2) - p.longitude); + b.include(p); + b.include(p1); + } + } + return b.build(); + } + + public static LatLng getCenterPoint(ArrayList arr) { + int total = arr.size(); + double X = 0, Y = 0, Z = 0; + for (int i = 0; i < arr.size(); i++) { + double lat, lon, x, y, z; + lon = Double.parseDouble(arr.get(i).split(",")[0]) * Math.PI / 180; + lat = Double.parseDouble(arr.get(i).split(",")[1]) * Math.PI / 180; + x = Math.cos(lat) * Math.cos(lon); + y = Math.cos(lat) * Math.sin(lon); + z = Math.sin(lat); + X += x; + Y += y; + Z += z; + } + + X = X / total; + Y = Y / total; + Z = Z / total; + double Lon = Math.atan2(Y, X); + double Hyp = Math.sqrt(X * X + Y * Y); + double Lat = Math.atan2(Z, Hyp); + Lon=Math.abs(Lon); + LatLng latLng=new LatLng(34.190432,108.873027); + DecimalFormat decimalFormat = new DecimalFormat("#0.#####"); + String strLat = decimalFormat.format(Lat * 180 / Math.PI); + String strLon = decimalFormat.format(Lon * 180 / Math.PI); + latLng= new LatLng(Double.parseDouble(strLat), Double.parseDouble(strLon)); + return latLng; + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/NineGridViewImageLoader.kt b/app/src/main/java/com/xjjk/healthyclients/utils/NineGridViewImageLoader.kt new file mode 100644 index 0000000..d6b7e61 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/NineGridViewImageLoader.kt @@ -0,0 +1,24 @@ +package com.xjjk.healthyclients.utils + +import android.content.Context +import android.graphics.Bitmap +import android.widget.ImageView +import com.lzy.ninegrid.NineGridView +import com.xjjk.healthyclients.superfuntion.load + +/** + * @author nanfeifei + * @time 2023/5/15 10:27 + * @description + */ +class NineGridViewImageLoader: NineGridView.ImageLoader { + override fun onDisplayImage(context: Context?, imageView: ImageView?, url: String?) { + if (url != null) { + imageView?.load(url, true) + } + } + + override fun getCacheImage(url: String?): Bitmap? { + return null + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/ProxyChecker.java b/app/src/main/java/com/xjjk/healthyclients/utils/ProxyChecker.java new file mode 100644 index 0000000..db3c572 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/ProxyChecker.java @@ -0,0 +1,29 @@ +package com.xjjk.healthyclients.utils; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.LinkProperties; +import android.net.Network; +import android.net.NetworkCapabilities; +import android.net.NetworkInfo; +import android.net.ProxyInfo; +import android.text.TextUtils; + +import com.orhanobut.logger.Logger; + +import java.net.InetSocketAddress; +import java.net.Proxy; + +public class ProxyChecker { + public static boolean hasProxy(Context context) { + String proxyAddress = System.getProperty("http.proxyHost"); + int proxyPort = 0; + String portStr = System.getProperty("http.proxyPort"); + if (!TextUtils.isEmpty(portStr)) { + proxyPort = Integer.parseInt(portStr); + } + Logger.e("ProxyUtil", "地址:" + proxyAddress + " 端口:" + proxyPort); + boolean wifiProxy = !TextUtils.isEmpty(proxyAddress) && proxyPort != 0; + return wifiProxy; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/RSAUtils.java b/app/src/main/java/com/xjjk/healthyclients/utils/RSAUtils.java new file mode 100644 index 0000000..d94da47 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/RSAUtils.java @@ -0,0 +1,92 @@ +package com.xjjk.healthyclients.utils; + +import javax.crypto.Cipher; +import java.security.*; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +public class RSAUtils { + //公钥加密 + public static String encrypt(String content, PublicKey publicKey) { + try{ + Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");//java默认"RSA"="RSA/ECB/PKCS1Padding" + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + byte[] output = cipher.doFinal(content.getBytes()); + BASE64Encoder encoder = new BASE64Encoder(); + return encoder.encode(output); + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + //公钥加密 + public static byte[] encrypt(byte[] content, PublicKey publicKey) { + try{ + Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");//java默认"RSA"="RSA/ECB/PKCS1Padding" + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + return cipher.doFinal(content); + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + //私钥解密 + public static byte[] decrypt(byte[] content, PrivateKey privateKey) { + try { + Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + return cipher.doFinal(content); + } catch (Exception e){ + e.printStackTrace(); + return null; + } + } + //私钥解密 + public static String decrypt(String content, PrivateKey privateKey) { + try { + Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + byte [] b = cipher.doFinal(content.getBytes()); + BASE64Encoder encoder = new BASE64Encoder(); + return encoder.encode(b); + } catch (Exception e){ + e.printStackTrace(); + return null; + } + } + + /** + * String转公钥PublicKey + * @param key + * @return + * @throws Exception + */ + public static PublicKey getPublicKey(String key) throws Exception { + byte[] keyBytes; + keyBytes = (new BASE64Decoder()).decodeBuffer(key); + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PublicKey publicKey = keyFactory.generatePublic(keySpec); + return publicKey; + } + + /** + * String转私钥PrivateKey + * @param key + * @return + * @throws Exception + */ + public static PrivateKey getPrivateKey(String key) throws Exception { + byte[] keyBytes; + keyBytes = (new BASE64Decoder()).decodeBuffer(key); + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privateKey = keyFactory.generatePrivate(keySpec); + return privateKey; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/SystemFuntion.kt b/app/src/main/java/com/xjjk/healthyclients/utils/SystemFuntion.kt new file mode 100644 index 0000000..7c43aaa --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/SystemFuntion.kt @@ -0,0 +1,114 @@ +package com.xjjk.healthyclients.utils + +import android.content.Context +import android.content.Intent +import android.net.Uri +import android.widget.Toast +import com.sw.healthyclients.view.CustomToast +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.view.WindowDialogView + +object SystemFuntion { + fun goNavigation(mLat: Double, mLon: Double, context: Context, name: String? = "目的地") { + if (MapUtils.isInstalled(context).isNullOrEmpty()) { + CustomToast.makeText(context,"未找到可用并支持的地图程序", Toast.LENGTH_SHORT).show() + return + } + 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=" + name + "&dev=0&t=0" + ) + ) + context?.startActivity(intent) + } + } + } + + override fun onClose() { + } + }, MapUtils.isInstalled(context)) + } + + fun callPhone(list: ArrayList, context: Context) { + WindowDialogView.WindowDialogView(context, object : + WindowDialogView.windowDialogListener { + override fun onSelectText(position: Int, phone: String?) { + try { + var intent = Intent(Intent.ACTION_DIAL, Uri.parse("tel: ${phone}")) + context.startActivity(intent) + } catch (e: Exception) { + } + } + + override fun onClose() { + } + }, list) + } + fun callPhone(list: ArrayList, context: Context,method: (id:String?) -> Unit) { + WindowDialogView.WindowDialogView(context, object : + WindowDialogView.windowDialogListener { + override fun onSelectText(position: Int, phone: String?) { + method(phone) + } + + override fun onClose() { + } + }, list) + } + + fun infoShow(list: ArrayList, context: Context) { + WindowDialogView.WindowDialogView(context, object : + WindowDialogView.windowDialogListener { + override fun onSelectText(position: Int, phone: String?) { + + } + + override fun onClose() { + } + }, list) + } + + fun openPdfInBrowser(pdfUrl: String, context: Context) { + val browserIntent = Intent(Intent.ACTION_VIEW) + + // 设置Intent的数据和类型 + browserIntent.data = Uri.parse(pdfUrl) +// browserIntent.type = "application/pdf" + + // 启动Intent + context.startActivity(browserIntent) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/SystemUtils.java b/app/src/main/java/com/xjjk/healthyclients/utils/SystemUtils.java new file mode 100644 index 0000000..1f98545 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/SystemUtils.java @@ -0,0 +1,66 @@ +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(); + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/TUIUtils.kt b/app/src/main/java/com/xjjk/healthyclients/utils/TUIUtils.kt new file mode 100644 index 0000000..24e536e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/TUIUtils.kt @@ -0,0 +1,123 @@ +package com.xjjk.healthyclients.utils + +import android.content.Context +import android.content.pm.PackageManager +import android.os.Build +import android.os.Bundle +import android.text.TextUtils +import android.util.Log +import androidx.annotation.RequiresApi +import com.xjjk.healthyclients.MyApplication +import com.xjjk.healthyclients.MyApplication.Companion.appContext +import com.tencent.imsdk.BuildConfig +import com.tencent.imsdk.v2.V2TIMConversation +import com.tencent.qcloud.tuicore.TUIConstants +import com.tencent.qcloud.tuicore.TUICore +import com.tencent.qcloud.tuicore.interfaces.TUILoginConfig +import com.tencent.qcloud.tuicore.util.TUIBuild +import com.tencent.qcloud.tuikit.tuichat.bean.WorkBean +import com.tencent.qcloud.tuikit.tuichat.minimalistui.page.TUIC2CChatMinimalistActivity +import com.tencent.qcloud.tuikit.tuichat.minimalistui.page.TUIGroupChatMinimalistActivity +import com.tencent.qcloud.tuikit.tuicontact.bean.GroupMemberInfo +import java.util.Locale + +object TUIUtils { + val TAG = TUIUtils::class.java.simpleName + const val WORK_TYPE_EMERGENCY = 1 + const val WORK_TYPE_IMAGE_TEXT_CONSULT = 2 + const val WORK_TYPE_ASSISTANT = 3 + @JvmStatic + fun startActivity(activityName: String?, param: Bundle?) { + TUICore.startActivity(activityName, param) + } + + fun startChat( + chatId: String?, + chatName: String?, + chatType: Int, + initiateVideoCall: Boolean?, + userIds: ArrayList?, + autoSendMessage: String?, + consultantId: String?, + workBean: WorkBean? = null + ) { + val bundle = Bundle() + bundle.putString(TUIConstants.TUIChat.CHAT_ID, chatId) + if (!TextUtils.isEmpty(chatId)) { + bundle.putString(TUIConstants.TUIChat.CHAT_NAME, chatName) + bundle.putString(TUIConstants.TUIGroup.GROUP_NAME, chatName) + } + bundle.putInt(TUIConstants.TUIChat.CHAT_TYPE, chatType) + if (!TextUtils.isEmpty(autoSendMessage)) { + bundle.putString(TUIConstants.TUIChat.AUTO_SEND_MESSAGE, autoSendMessage) + } + bundle.putString(TUIConstants.TUIChat.CONSULTANT_ID, consultantId) + bundle.putSerializable(TUIConstants.TUIChat.WORK_BEAN, workBean) + if (appContext.tuikit_demo_style == 0) { + if (chatType == V2TIMConversation.V2TIM_C2C) { + TUICore.startActivity(TUIConstants.TUIChat.C2C_CHAT_ACTIVITY_NAME, bundle) + } else if (chatType == V2TIMConversation.V2TIM_GROUP) { + bundle.putBoolean(TUIConstants.TUIChat.INITIATE_VIDEO_CALL, initiateVideoCall!!) + bundle.putString(TUIConstants.TUIGroup.GROUP_ID, chatName) + bundle.putStringArrayList(TUIConstants.TUICalling.PARAM_NAME_USERIDS, userIds) + TUICore.startActivity(TUIConstants.TUIChat.GROUP_CHAT_ACTIVITY_NAME, bundle) + } + } else { + if (chatType == V2TIMConversation.V2TIM_C2C) { + TUICore.startActivity(TUIC2CChatMinimalistActivity::class.java.simpleName, bundle) + } else if (chatType == V2TIMConversation.V2TIM_GROUP) { + TUICore.startActivity(TUIGroupChatMinimalistActivity::class.java.simpleName, bundle) + } + } + } + + fun createGroup(chatId: String?, chatName: String?, chatType: Int) { + val bundle = Bundle() + bundle.putString(TUIConstants.TUIChat.CHAT_ID, chatId) + bundle.putString(TUIConstants.TUIChat.CHAT_NAME, chatName) + bundle.putInt(TUIConstants.TUIChat.CHAT_TYPE, chatType) + bundle.putString(TUIConstants.TUIGroup.GROUP_NAME, chatName) + val mMembers = ArrayList() + // GroupMemberInfo memberInfo = new GroupMemberInfo(); +// memberInfo.setAccount("e9ca23d68d884d4ebb19d07889727dae"); +// memberInfo.setNickName("Admin"); +// mMembers.add(memberInfo); + val memberInfo2 = GroupMemberInfo() + memberInfo2.account = "001ba0c3a045462aa525d335a277407b" + memberInfo2.nickName = "飞飞" + mMembers.add(memberInfo2) + bundle.putInt(TUIConstants.TUIGroup.JOIN_TYPE_INDEX, 2) + bundle.putSerializable(TUIConstants.TUIGroup.GROUP_MEMBER_ID_LIST, mMembers) + TUICore.startActivity("CreateGroupActivity", bundle) + } + + @RequiresApi(api = Build.VERSION_CODES.N) + fun isZh(context: Context): Boolean { + val locale: Locale + locale = if (TUIBuild.getVersionInt() < Build.VERSION_CODES.N) { + context.resources.configuration.locale + } else { + context.resources.configuration.locales[0] + } + val language = locale.language + return if (language.endsWith("zh")) true else false + } + + fun getCurrentVersionCode(context: Context): Int { + try { + return context.packageManager.getPackageInfo(context.packageName, 0).versionCode + } catch (ignored: PackageManager.NameNotFoundException) { + Log.e(TAG, "getCurrentVersionCode exception= $ignored") + } + return 0 + } + + val loginConfig: TUILoginConfig + get() { + val config = TUILoginConfig() + if (BuildConfig.DEBUG) { + config.logLevel = TUILoginConfig.TUI_LOG_DEBUG + } + return config + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/UrlH5RouteUtils.kt b/app/src/main/java/com/xjjk/healthyclients/utils/UrlH5RouteUtils.kt new file mode 100644 index 0000000..9284bba --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/UrlH5RouteUtils.kt @@ -0,0 +1,190 @@ +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 + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CheckUpdateAppVersion.kt b/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CheckUpdateAppVersion.kt new file mode 100644 index 0000000..d5e2b6e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CheckUpdateAppVersion.kt @@ -0,0 +1,34 @@ +package com.xjjk.healthyclients.utils.updateplugin + +import com.xjjk.healthyclients.data.repository.CommonRepository +import com.xjjk.healthyclients.superfuntion.toJson +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import org.lzh.framework.updatepluginlib.base.CheckWorker +import org.lzh.framework.updatepluginlib.model.CheckEntity + +class CheckUpdateAppVersion: CheckWorker() { + val appId = "1692477229349167106" + override fun useAsync(): Boolean { + return true + } + override fun check(entity: CheckEntity?): String { + return super.check(entity) + } + + override fun asyncCheck(entity: CheckEntity?) { + CoroutineScope(Dispatchers.Unconfined).launch { + try { + var apiResponse = CommonRepository.getAppUpdateInfo() + if(apiResponse.success){ + onResponse(apiResponse.result.toJson()) + }else{ + onError(Exception(apiResponse.message)) + } + } catch (e: Exception) { + onError(e) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CustomDownloadNotifier.java b/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CustomDownloadNotifier.java new file mode 100644 index 0000000..d5d6a3d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CustomDownloadNotifier.java @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2017 Haoge + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.xjjk.healthyclients.utils.updateplugin; + +import android.app.Activity; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.ProgressDialog; +import android.content.Context; +import android.view.Gravity; +import android.view.Window; + +import androidx.annotation.NonNull; +import androidx.core.app.NotificationCompat; + +import com.sw.healthyclients.view.LoadingProgressDialog; +import com.xjjk.healthyclients.view.TextViewDialog; + +import org.lzh.framework.updatepluginlib.base.DownloadCallback; +import org.lzh.framework.updatepluginlib.base.DownloadNotifier; +import org.lzh.framework.updatepluginlib.model.Update; +import org.lzh.framework.updatepluginlib.util.ActivityManager; +import org.lzh.framework.updatepluginlib.util.SafeDialogHandle; + +import java.io.File; + +/** + * 默认使用的在检查到有更新时的通知创建器:创建一个弹窗提示用户当前有新版本需要更新。 + * + * @author haoge + * @see CustomDownloadNotifier + */ +public class CustomDownloadNotifier extends DownloadNotifier { + + NotificationManager manager; + NotificationCompat.Builder builder; + int id; + int preProgress; + String channelID="downloadNotice"; + String channelName="文件下载"; + + @Override + public DownloadCallback create(Update update, Activity activity) { + LoadingProgressDialog dialog = new LoadingProgressDialog(activity,ProgressDialog.STYLE_SPINNER, "资源准备中..."); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setCanceledOnTouchOutside(false); + dialog.setCancelable(false); + dialog.setMessage("资源准备中..."); + SafeDialogHandle.safeShowDialog(dialog); + + String channelId=createNotificationChannel(activity,channelID,channelName,NotificationManager.IMPORTANCE_HIGH); + this.manager = (NotificationManager) activity.getSystemService(Context.NOTIFICATION_SERVICE); + builder = new NotificationCompat.Builder(activity,channelId); + builder.setProgress(100, 0, false) + .setSmallIcon(activity.getApplicationInfo().icon) + .setAutoCancel(false) + .setContentTitle("文件下载") + .setContentText("文件下载进度:0%") + .build(); + id = 1; + builder.setContentText("文件下载进度:"+0+"%"); + builder.setProgress(100,0,false); + manager.notify(id,builder.build()); + + return new DownloadCallback() { + @Override + public void onDownloadStart() { + } + + @Override + public void onDownloadComplete(File file) { + SafeDialogHandle.safeDismissDialog(dialog); +// manager.cancel(id); + builder.setContentText("文件下载进度:"+100+"%"); + builder.setProgress(100,100,false); + manager.notify(id,builder.build()); + } + + @Override + public void onDownloadProgress(long current, long total) { + int percent = (int) (current * 1.0f / total * 100); + dialog.setMessageProgress("下载中("+percent+"%)"); + builder.setContentText("文件下载进度:"+percent+"%"); + builder.setProgress(100,percent,false); + manager.notify(id,builder.build()); + } + + @Override + public void onDownloadError(Throwable t) { + SafeDialogHandle.safeDismissDialog(dialog); + createRestartDialog(); + } + }; + } + + private void createRestartDialog() { + String updateContent = "是否重新下载?"; + TextViewDialog textViewDialog = new TextViewDialog(ActivityManager.get().topActivity()); + textViewDialog.setDialogTitle("下载失败",18f); + textViewDialog.setContent(updateContent,14f); + textViewDialog.setContentStyle(Gravity.LEFT); + textViewDialog.setBtnText("确定",18f); + textViewDialog.setDialogCancelable(false); + if (!update.isForced()) { + textViewDialog.setCancelBtnText("退出",18f); + } + textViewDialog.setOnAffirmClickListener(new TextViewDialog.OnAffirmClickListener() { + @Override + public void onAffirmClick(@NonNull TextViewDialog viewDialog) { + restartDownload(); + } + + @Override + public void onCancelClick(@NonNull TextViewDialog viewDialog) { + if (update.isForced()) { + ActivityManager.get().exit(); + } else { + viewDialog.dismiss(); + } + } + }); + if (!textViewDialog.isShowing()) { + textViewDialog.show(); + } + } + + private String createNotificationChannel(Context context,String channelID, String channelNAME, int level) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + NotificationChannel channel = new NotificationChannel(channelID, channelNAME, level); + manager.createNotificationChannel(channel); + return channelID; + } else { + return null; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CustomInstallNotifier.java b/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CustomInstallNotifier.java new file mode 100644 index 0000000..35ee046 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CustomInstallNotifier.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2017 Haoge + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.xjjk.healthyclients.utils.updateplugin; + +import android.app.Activity; +import android.app.Dialog; +import android.view.Gravity; + +import androidx.annotation.NonNull; + +import com.xjjk.healthyclients.view.TextViewDialog; + +import org.lzh.framework.updatepluginlib.base.CheckNotifier; +import org.lzh.framework.updatepluginlib.base.InstallNotifier; +import org.lzh.framework.updatepluginlib.util.SafeDialogHandle; + +/** + * 默认使用的在检查到有更新时的通知创建器:创建一个弹窗提示用户当前有新版本需要更新。 + * + * @author haoge + * @see CheckNotifier + */ +public class CustomInstallNotifier extends InstallNotifier { + @Override + public Dialog create(Activity activity) { + String updateContent = "版本号: " + update.getVersionName()+" 安装资源已就绪"; + + TextViewDialog textViewDialog = new TextViewDialog(activity); + textViewDialog.setDialogTitle("新版本安装",18f); + textViewDialog.setContent(updateContent,14f); + textViewDialog.setContentStyle(Gravity.LEFT); + textViewDialog.setBtnText("立即安装",18f); + textViewDialog.setDialogCancelable(false); + if (!update.isForced()) { + textViewDialog.setCancelBtnText("取消",18f); + } + textViewDialog.setOnAffirmClickListener(new TextViewDialog.OnAffirmClickListener() { + @Override + public void onAffirmClick(@NonNull TextViewDialog viewDialog) { + sendToInstall(); + SafeDialogHandle.safeDismissDialog((Dialog) viewDialog); + } + + @Override + public void onCancelClick(@NonNull TextViewDialog viewDialog) { + sendCheckIgnore(); + SafeDialogHandle.safeDismissDialog((Dialog) viewDialog); + } + }); + return textViewDialog; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CustomUpdateNotifier.java b/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CustomUpdateNotifier.java new file mode 100644 index 0000000..0dad5de --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/utils/updateplugin/CustomUpdateNotifier.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2017 Haoge + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.xjjk.healthyclients.utils.updateplugin; + +import android.app.Activity; +import android.app.Dialog; +import android.view.Gravity; + +import androidx.annotation.NonNull; + +import com.xjjk.healthyclients.view.TextViewDialog; + +import org.lzh.framework.updatepluginlib.base.CheckNotifier; +import org.lzh.framework.updatepluginlib.util.SafeDialogHandle; + +/** + * 默认使用的在检查到有更新时的通知创建器:创建一个弹窗提示用户当前有新版本需要更新。 + * + * @author haoge + * @see CheckNotifier + */ +public class CustomUpdateNotifier extends CheckNotifier { + @Override + public Dialog create(Activity activity) { + String updateContent = "版本号: " + update.getVersionName() + "\n\n" + + update.getUpdateContent(); + + TextViewDialog textViewDialog = new TextViewDialog(activity); + textViewDialog.setDialogTitle("发现新版本",18f); + textViewDialog.setContent(updateContent,14f); + textViewDialog.setContentStyle(Gravity.LEFT); + textViewDialog.setBtnText("立即更新",18f); + textViewDialog.setDialogCancelable(false); + if (!update.isForced()) { + textViewDialog.setCancelBtnText("取消",18f); + } + textViewDialog.setOnAffirmClickListener(new TextViewDialog.OnAffirmClickListener() { + @Override + public void onAffirmClick(@NonNull TextViewDialog viewDialog) { + sendDownloadRequest(); + SafeDialogHandle.safeDismissDialog((Dialog) viewDialog); + } + + @Override + public void onCancelClick(@NonNull TextViewDialog viewDialog) { + sendUserCancel(); + SafeDialogHandle.safeDismissDialog((Dialog) viewDialog); + } + }); + return textViewDialog; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/view/AppointmentInformationView.kt b/app/src/main/java/com/xjjk/healthyclients/view/AppointmentInformationView.kt new file mode 100644 index 0000000..4033035 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/AppointmentInformationView.kt @@ -0,0 +1,342 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.graphics.Paint +import android.graphics.Typeface +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.ImageButton +import android.widget.LinearLayout +import androidx.core.view.ViewCompat +import androidx.databinding.DataBindingUtil +import androidx.recyclerview.widget.LinearLayoutManager +import com.xjjk.healthyclients.bean.guidance.AppraiseBean +import com.sw.healthyclients.bean.guidance.CallTimeBean +import com.sw.healthyclients.bean.guidance.ConsultRecordBean +import com.sw.healthyclients.bean.guidance.HealthInfoBean +import com.sw.healthyclients.utils.DateUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.BR +import com.xjjk.healthyclients.bean.guidance.AppointmentInformationBean +import com.xjjk.healthyclients.bean.guidance.ArchivesBean +import com.xjjk.healthyclients.bean.guidance.ConsultantBean +import com.xjjk.healthyclients.bean.user.PhysicalHistoryInfoBean +import com.xjjk.healthyclients.databinding.ViewAppointmentInformationBinding +import com.xjjk.healthyclients.ui.activity.guidance.adapter.HealthInfoAdapter +import com.xjjk.healthyclients.utils.CommonUtils + +/** + * 预约详情预约信息 + * @author nanfeifei + */ +class AppointmentInformationView : LinearLayout { + lateinit var mBinding: ViewAppointmentInformationBinding + val mAdapter by lazy { HealthInfoAdapter() } + + @JvmOverloads + constructor( + context: Context?, attrs: AttributeSet? = null, + defStyleAttr: Int = 0 + ) : super(context, attrs, defStyleAttr) { + if (isInEditMode) { + LayoutInflater.from(context).inflate(R.layout.view_appointment_information, this, true) + } else { + mBinding = DataBindingUtil.inflate( + LayoutInflater.from(context), + R.layout.view_appointment_information, + this, + true + ) + val boldTypeface = Typeface.defaultFromStyle(Typeface.BOLD) + mBinding.stvPhysicalExaminationReport.leftTextView.typeface = boldTypeface + mBinding.stvArchives.leftTextView.typeface = boldTypeface + val linearLayoutManager = LinearLayoutManager(context) + mBinding.rvHealthInfo.layoutManager = linearLayoutManager + ViewCompat.setNestedScrollingEnabled(mBinding.rvHealthInfo, true) + } + } + + enum class AppointmentStatus(val status: Int) { + WAIT_CONFIRM(1), + WAIT_START(2), + IN_CONSULTATION(3), //(咨询中)已开始 + WAIT_APPRAISE(4), + FINISH(5), + REFUSE(6), + CANCEL(7) + } + + fun setData( + appointmentInfoBean: AppointmentInformationBean, + appointmentStatus: AppointmentStatus = AppointmentStatus.WAIT_CONFIRM + ) { + mBinding.setVariable(BR.appointmentInformationBean, appointmentInfoBean) + showAppointmentTime(appointmentInfoBean.conSession) + setConsultantInfo(appointmentInfoBean.conFamilyMembersDO) + setArchivesBean(appointmentInfoBean.conMedicalRecordsListDO) + setHealthInfo(appointmentInfoBean.answer) + var callTimeList = appointmentInfoBean.imList + showCallRecord(callTimeList) + var statusStr: String = appointmentInfoBean.conSession?.contentStatus ?: "" + when (statusStr) { + AppointmentStatus.WAIT_CONFIRM.status.toString() -> { + showStepView(currentStep = 0) + mBinding.ivStatusTag.visibility = View.INVISIBLE + showConsultStartTime(GONE, appointmentInfoBean.conSession) + } + + AppointmentStatus.WAIT_START.status.toString() -> { + showStepView(currentStep = 1) + mBinding.ivStatusTag.visibility = View.VISIBLE + mBinding.ivStatusTag.setImageResource(R.drawable.icon_appointment_success) + showConsultStartTime(VISIBLE, appointmentInfoBean.conSession) + mBinding.stvStartTime.setLeftString(context.getString(R.string.appointment_information_predict_start_time)) + mBinding.tvStartTimeTips.visibility = VISIBLE + } + + AppointmentStatus.IN_CONSULTATION.status.toString() -> { + showStepView(currentStep = 2) + mBinding.ivStatusTag.visibility = View.INVISIBLE + showConsultStartTime(VISIBLE, appointmentInfoBean.conSession) + mBinding.stvStartTime.setLeftString(context.getString(R.string.appointment_information_start_time)) + mBinding.tvStartTimeTips.visibility = GONE + } + + AppointmentStatus.WAIT_APPRAISE.status.toString() -> { + showStepView(currentStep = 3) + mBinding.ivStatusTag.visibility = View.INVISIBLE + showConsultStartTime(VISIBLE, appointmentInfoBean.conSession) + } + + AppointmentStatus.FINISH.status.toString() -> { + showStepView(currentStep = 4) + mBinding.ivStatusTag.visibility = View.INVISIBLE + showConsultStartTime(VISIBLE, appointmentInfoBean.conSession) + setAppraiseInfo(appointmentInfoBean.conEvaluateDO) + } + + AppointmentStatus.REFUSE.status.toString() -> { + showStepView(currentStep = 0) + mBinding.ivStatusTag.visibility = View.INVISIBLE + showConsultStartTime(VISIBLE, appointmentInfoBean.conSession) + showRefuseInfo(VISIBLE, appointmentInfoBean.conSession) + } + + AppointmentStatus.CANCEL.status.toString() -> { + showStepView(true, 1) + mBinding.ivStatusTag.visibility = View.VISIBLE + mBinding.ivStatusTag.setImageResource(R.drawable.icon_appointment_cancel) + showConsultStartTime(VISIBLE, appointmentInfoBean.conSession) + mBinding.stvStartTime.rightTextView.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG + } + } + } + + private fun showStepView(containCancel: Boolean = false, currentStep: Int = 0) { + var titles = arrayOf( + context.getString(R.string.appointment_information_status_wait_confirm), + if (containCancel) context.getString(R.string.appointment_information_status_cancel) else context.getString( + R.string.appointment_information_status_wait_start + ), + context.getString(R.string.appointment_information_status_in_consultation), + context.getString(R.string.appointment_information_status_wait_appraise), + context.getString(R.string.appointment_information_status_finish) + ) + mBinding.stepView.setTitles(titles) + mBinding.stepView.setCurrentStep(currentStep) + } + + private fun showAppointmentTime(consultRecordBean: ConsultRecordBean? = null) { + consultRecordBean?.let { + mBinding.stvAppointmentType.setRightString( + CommonUtils.getConsultTypeText( + consultRecordBean.contentType + ) + ) + var dateStr = DateUtil.dateToStrShortChinese(consultRecordBean.sessionDateLong) + mBinding.stvAppointmentTime.setRightString( + dateStr + " " + DateUtil.getWeekStrChinese(consultRecordBean.week) + + " " + CommonUtils.getAmPmText(consultRecordBean.amPm) + ) + } + } + + private fun showConsultStartTime( + visibility: Int, + consultRecordBean: ConsultRecordBean? = null + ) { + mBinding.stvStartTime.visibility = visibility + mBinding.lineStartTime.visibility = visibility + consultRecordBean?.let { + if(consultRecordBean.doctorStartTimeLong == null){ + mBinding.stvStartTime.visibility = GONE + mBinding.lineStartTime.visibility = GONE + return + } + var dateDayStr = DateUtil.dateToStrShortChinese(consultRecordBean.doctorStartTimeLong) + var startTime = DateUtil.dateToStrHour(consultRecordBean.doctorStartTimeLong) + var endTime = DateUtil.dateToStrHour(consultRecordBean.doctorEndTimeLong) + mBinding.stvStartTime.setRightString( + context.getString( + R.string.appointment_information_start_time_value, + dateDayStr, + startTime, + endTime + ) + ) + } + } + + private fun showRefuseInfo(visibility: Int, consultRecordBean: ConsultRecordBean? = null) { + mBinding.stvRefuseCause.visibility = visibility + mBinding.rlRefuseRemark.visibility = visibility + if (visibility == VISIBLE) { + mBinding.stvAppointmentTime.rightTextView.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG + } else { + mBinding.stvAppointmentTime.rightTextView.paint.flags = Paint.ANTI_ALIAS_FLAG + } + consultRecordBean?.let { + mBinding.stvRefuseCause.setRightString(consultRecordBean.reasonType) + mBinding.tvRefuseRemark.text = consultRecordBean.rejectReason + } + } + + /** + * 设置咨询人信息 + */ + private fun setConsultantInfo(consultantBean: ConsultantBean?) { + mBinding.llConsultLay.visibility = if (consultantBean == null) GONE else VISIBLE + consultantBean?.let { + mBinding.apply { + stvAppointmentPeopleInfo.setLeftString( + context.getString( + R.string.consult_information_consult_people_name, + consultantBean.name + ) + ) + stvAppointmentPeopleInfo.setCenterString( + context.getString( + R.string.consult_information_consult_people_gender, + CommonUtils.getGenderText(consultantBean.gender) + ) + ) + stvAppointmentPeopleInfo.setRightString( + context.getString( + R.string.consult_information_consult_people_age, + consultantBean.age + ) + ) + } + } + } + private fun showCallRecord(callTimeList: MutableList? = null) { + mBinding.tvCallRecordTitle.visibility = if (callTimeList.isNullOrEmpty()) GONE else VISIBLE + mBinding.tvCallRecord.visibility = if (callTimeList.isNullOrEmpty()) GONE else VISIBLE + mBinding.lineCallRecord.visibility = if (callTimeList.isNullOrEmpty()) GONE else VISIBLE + if (callTimeList.isNullOrEmpty()) { + return + } + var callRecordStr = "" + var callTimeBean: CallTimeBean + for (index in callTimeList.indices) { + callTimeBean = callTimeList[index] + var startDateTime = DateUtil.getLongDateStr(callTimeBean.startTimLong) + when(callTimeBean.type){ + "1" -> { + var dateDayStr = callTimeBean.startTimLong?.let { DateUtil.getShortDateStr(it) } ?:"" + var startTime = DateUtil.dateToStrHour(callTimeBean.startTimLong) + var endTime = DateUtil.dateToStrHour(callTimeBean.endTimeLong) + callRecordStr += context.getString( + R.string.appointment_information_doctor_appointed_time, + dateDayStr, + startTime, + endTime + ) + } + "2" -> { + var timeDiff = DateUtil.dateDiff(callTimeBean.startTimLong, callTimeBean.endTimeLong) + callRecordStr += context.getString( + R.string.appointment_information_call_duration, + startDateTime, + timeDiff + ) + } + } + if (index < callTimeList.size - 1) { + callRecordStr += "\n" + } + } + mBinding.tvCallRecord.text = callRecordStr + } + private fun setArchivesBean(archivesBean: ArchivesBean?) { + archivesBean?.let { + mBinding.apply { + stvArchives.setRightString(if(archivesBean.updateTime.isNullOrEmpty()) "" else + context.getString( + R.string.appointment_information_appointment_people_create_time, + archivesBean.updateTime + ) + ) + tvArchivesExplain.text = context.getString(R.string.appointment_information_appointment_people_archives_explain, archivesBean.medicalDescribe) + } + } + } + + private fun setHealthInfo(list: MutableList?) { + var isEmpty = list.isNullOrEmpty() + mBinding.tvHealthInfoTitle.visibility = if(isEmpty) GONE else VISIBLE + mBinding.rvHealthInfo.visibility = if(isEmpty) GONE else VISIBLE + mBinding.lineHealthInfo.visibility = if(isEmpty) GONE else VISIBLE + if (isEmpty) { + return + } + mAdapter.setNewInstance(list) + if (mBinding.rvHealthInfo.adapter == null) { + mBinding.rvHealthInfo.adapter = mAdapter + } + } + + fun setPhysicalExaminationReport(physicalExaminationReportBean: PhysicalHistoryInfoBean?) { + if (physicalExaminationReportBean == null) { + mBinding.stvPhysicalExaminationReport.visibility = View.GONE + mBinding.stvPhysicalExaminationReportInfo.visibility = View.GONE + mBinding.linePhysicalExaminationReport.visibility = View.GONE + } + physicalExaminationReportBean?.let { + mBinding.stvPhysicalExaminationReport.visibility = View.VISIBLE + mBinding.stvPhysicalExaminationReportInfo.visibility = View.VISIBLE + mBinding.linePhysicalExaminationReport.visibility = View.VISIBLE + mBinding.stvPhysicalExaminationReport.setRightString( + context.getString( + R.string.appointment_information_physical_examination_report_upload_time, + physicalExaminationReportBean.peQueueDate + ) + ) + mBinding.stvPhysicalExaminationReportInfo.setLeftString( + context.getString( + R.string.appointment_information_physical_examination_report_intro, + physicalExaminationReportBean.year, + physicalExaminationReportBean.hospitalName + ) + ) + } + } + + private fun setAppraiseInfo(appraiseBean: AppraiseBean?) { + appraiseBean?.let { + mBinding.flAppraiseLay.visibility = VISIBLE + mBinding.layAppraise.apply { + tvName.text = appraiseBean.userName + tvContent.text = appraiseBean.context + if (!appraiseBean.score.isNullOrEmpty()) { + ratingBar.rating = appraiseBean.score.toFloat() + } + } + } + } + + fun getFollowView(): ImageButton { + return mBinding.btnFollow + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/AppraiseDialog.kt b/app/src/main/java/com/xjjk/healthyclients/view/AppraiseDialog.kt new file mode 100644 index 0000000..dca5279 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/AppraiseDialog.kt @@ -0,0 +1,118 @@ +package com.xjjk.healthyclients.view + +import android.app.AlertDialog +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Build +import android.os.Bundle +import android.view.Gravity +import android.view.LayoutInflater +import android.view.View +import android.view.WindowManager +import android.widget.LinearLayout +import android.widget.RatingBar +import android.widget.Toast +import androidx.databinding.DataBindingUtil +import com.sw.healthyclients.view.CustomToast +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.DialogAppraiseBinding + +class AppraiseDialog constructor( + context: Context +) : AlertDialog(context) { + lateinit var mOnSubmitClickListener: OnSubmitClickListener + 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( + LayoutInflater.from(context), + R.layout.dialog_appraise, null, false + ) + setContentView(binding.root) + window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))//设置dialog背景透明 + window?.setGravity(Gravity.BOTTOM) + window?.setLayout( + context.resources.displayMetrics.widthPixels, + LinearLayout.LayoutParams.WRAP_CONTENT + );//设置对话框大小 + window?.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) + binding.btnSubmit.setOnClickListener { + if (getRating()==0F) { + 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() + } + + } + + fun setOnSubmitClickListener(onSubmitClickListener: OnSubmitClickListener): AppraiseDialog { + this.mOnSubmitClickListener = onSubmitClickListener + return this + } + + interface OnSubmitClickListener { + fun onSubmitClick(viewDialog: AppraiseDialog) + fun onCancelClick(viewDialog: AppraiseDialog){} + } + + fun setDialogTitle(title: String, titleSize: Float = 18f): AppraiseDialog { + binding.tvTitle.visibility = View.VISIBLE + binding.tvTitle.text = title + binding.tvTitle.textSize = titleSize + return this + } + + fun setContentHint(text: String, textSize: Float = 13f): AppraiseDialog { + binding.etAppraise.hint = text + binding.etAppraise.textSize = textSize + return this + } + + fun setBtnText(text: String, btnTextSize: Float = 18f): AppraiseDialog { + binding.btnSubmit.text = text + binding.btnSubmit.textSize = btnTextSize + return this + } + + fun setDialogCancelable(flag: Boolean): AppraiseDialog { + setCancelable(flag) + return this + } + + fun getAppraiseContext(): String { + return binding.etAppraise.text.trim().toString() + } + + fun getRatingBar(): RatingBar { + return binding.ratingBar + } + fun getRating(): Float { + return getRatingBar().rating + } + /** + * 获取匿名状态 + */ + fun getAnonymityStatus(): Boolean { + return binding.cbAnonymity.isChecked + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/BaseHealthyInformationView.kt b/app/src/main/java/com/xjjk/healthyclients/view/BaseHealthyInformationView.kt new file mode 100644 index 0000000..6a1ea18 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/BaseHealthyInformationView.kt @@ -0,0 +1,37 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.util.AttributeSet +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.sw.healthyclients.bean.guidance.HealthInfoBean +import com.sw.healthyclients.utils.ScreenUtil.dp2px +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.ui.activity.guidance.adapter.HealthInfoAdapter + +/** + * 基本健康信息 + * @author nanfeifei + */ +class BaseHealthyInformationView: RecyclerView { + val mAdapter by lazy { HealthInfoAdapter() } + @JvmOverloads + constructor(context: Context, attrs : AttributeSet? = null, + defStyleAttr: Int = 0): super(context, attrs,defStyleAttr){ + } + init { + val linearLayoutManager = LinearLayoutManager(context) + this.layoutManager = linearLayoutManager + this.background = context.getDrawable(R.drawable.rectangle_round_corner10_white) + this.elevation = dp2px(3f).toFloat() + } + fun setData(list: MutableList?){ + if (list.isNullOrEmpty()) { + return + } + mAdapter.setList(list) + if (this.adapter == null) { + this.adapter = mAdapter + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomCvdMainDiseaseWarningView.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomCvdMainDiseaseWarningView.kt new file mode 100644 index 0000000..dad52e3 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomCvdMainDiseaseWarningView.kt @@ -0,0 +1,181 @@ +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() + 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() + map["heartType"] = mType + mContext?.startWebActivity(UrlConfig.getKnowledgeDetailUrl(UrlH5RouteUtils.HEART_ATTACK,map)) + } + mBinding.viewEditAnswer.setOnClickListener { + //修改问卷 + var map = mutableMapOf() + map["heartType"] = mType + mContext?.startWebActivity(UrlConfig.getKnowledgeDetailUrl(UrlH5RouteUtils.HEART_ATTACK,map)) + } + + mBinding.viewRlOne.setOnClickListener { + var map = mutableMapOf() + 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() + 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) { + + } + } + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomEmergencyHeadview.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomEmergencyHeadview.kt new file mode 100644 index 0000000..6ee6675 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomEmergencyHeadview.kt @@ -0,0 +1,79 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.RelativeLayout +import androidx.databinding.DataBindingUtil +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.CustomEmergencyHeadViewAdapter +import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter +import com.xjjk.healthyclients.bean.emergency.EmergencyDictBean +import com.xjjk.healthyclients.databinding.CustomEmergencyHeadViewBinding + +class CustomEmergencyHeadView : RelativeLayout { + + var mContext: Context? = null + var mList = arrayListOf() + var mCustomEmergencyHeadViewAdapter: CustomEmergencyHeadViewAdapter? = null + var mMethod: ((bean: EmergencyDictBean) -> Unit)? = null + var mBinding: CustomEmergencyHeadViewBinding + + constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs, 0) { + mContext = context + mBinding = DataBindingUtil.inflate( + LayoutInflater.from(context), + R.layout.custom_emergency_head_view, this,true + ) + var manager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) + mBinding.customEmergencyHeadViewRv.layoutManager = manager + mCustomEmergencyHeadViewAdapter = CustomEmergencyHeadViewAdapter( + context, + R.layout.item_custom_emergency_head_view, + mList + ) {} + mBinding.customEmergencyHeadViewRv.adapter = mCustomEmergencyHeadViewAdapter + + mCustomEmergencyHeadViewAdapter?.setOnItemClickListener(object : + MultiItemTypeAdapter.OnItemClickListener { + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + mMethod?.let { it(mList[position]) } + for (index in 0 until mList.size) { + mList[index].isCheck = index == position + } + mCustomEmergencyHeadViewAdapter?.datas = mList + mCustomEmergencyHeadViewAdapter?.notifyDataSetChanged() + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + + } + + fun setHeadData( + list: MutableList, + method: (bean: EmergencyDictBean) -> Unit + ) { + mMethod = method + if (list.isNotEmpty()) { + mList.clear() + mList.addAll(list) + if (mList.size > 0) { + mList[0].isCheck = true + } + mCustomEmergencyHeadViewAdapter?.datas = mList + mCustomEmergencyHeadViewAdapter?.notifyDataSetChanged() + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomEmergencyRelativeLayout.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomEmergencyRelativeLayout.kt new file mode 100644 index 0000000..7ebacdc --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomEmergencyRelativeLayout.kt @@ -0,0 +1,30 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.RelativeLayout +import androidx.databinding.DataBindingUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.CustomEmergencyRelativelayoutBinding + + +class CustomEmergencyRelativeLayout : RelativeLayout { + + var mContext:Context?=null + var mBinding: CustomEmergencyRelativelayoutBinding + @JvmOverloads + constructor(context: Context?,attrs : AttributeSet? = null, + defStyleAttr: Int = 0): super(context, attrs,defStyleAttr){ + mContext=context + mBinding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.custom_emergency_relativelayout,this,true) + } + fun setStyleInfo(title:String,content:String){ + mBinding.apply { + name.text=title + value.text=content + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomFilterSearchView.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomFilterSearchView.kt new file mode 100644 index 0000000..a0ae023 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomFilterSearchView.kt @@ -0,0 +1,596 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.RelativeLayout +import androidx.databinding.DataBindingUtil +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter +import com.xjjk.healthyclients.bean.guidance.DepartListBean +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.databinding.CustomFilterSearchViewBinding +import com.xjjk.healthyclients.ui.activity.guidance.adapter.CustomFilterAdapter +import com.xjjk.healthyclients.ui.activity.guidance.adapter.FilterSearchDepartment2Adapter +import com.xjjk.healthyclients.ui.activity.guidance.adapter.SeekDoctorDepartment3Adapter +import com.xjjk.healthyclients.ui.activity.guidance.adapter.SeekDoctorSick3Adapter + +/** + * 切换医院时,科室和疾病的筛选条件,切换科室时,清空疾病的筛选条件 + */ +class CustomFilterSearchView : RelativeLayout { + + var mContext:Context?=null + var mBinding: CustomFilterSearchViewBinding + var mCustomFilterAdapter: CustomFilterAdapter?=null + var mHospitalList= arrayListOf() + var mDepartList= arrayListOf() + var mSickList= arrayListOf() + private var mSeekDoctorDepartmentAdapter2: FilterSearchDepartment2Adapter?=null + private var mSeekDoctorSick3Adapter: SeekDoctorSick3Adapter?=null + private var mSeekDoctorDepartmentAdapter3: SeekDoctorDepartment3Adapter?=null + private var mDepartmentListLeft=arrayListOf() //左侧列表 + private var mSickListLeft=arrayListOf() //左侧列表 + private var mDepartmentListRight=arrayListOf() //科室右侧列表 + private var mSickListRight=arrayListOf() //疾病右侧列表 + private var mSickAndDepartIndex=0 + + var mType=0 + var mType2=1 //1 好评 2 热度 3回复 + var bean= + selectDictListByNHDSRequestBean() + + var mClickListener:((type:Int,id:String) -> Unit?)? =null + + var mMethod: ((selectDictListByNHDSRequestBean) -> Unit?)? =null + constructor(context: Context?,attrs : AttributeSet?): super(context, attrs,0){ + mContext=context + mBinding = DataBindingUtil.inflate( + LayoutInflater.from(context), + R.layout.custom_filter_search_view, this,true) + initView() + } + + private fun initView() { + mType2=1 + bean.tfSort=mType.toString() + mMethod?.let { it(bean) } + refreshState() + mCustomFilterAdapter= CustomFilterAdapter(mContext, + R.layout.item_custom_filter,mType,mHospitalList){} + var manager=LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false) + mBinding.customFilterSelectRv.layoutManager=manager + mBinding.customFilterSelectRv.adapter=mCustomFilterAdapter + mBinding.customFilterSelectRvRoot.setOnClickListener { } + //科室 + mSeekDoctorDepartmentAdapter2= FilterSearchDepartment2Adapter(mContext!!, + R.layout.item_recycle_seek_doctor_department_child2,mDepartmentListLeft) + val linearLayoutManager = LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false) + mBinding.seekDoctorDepartmentListLeft.layoutManager = linearLayoutManager + mBinding.seekDoctorDepartmentListLeft.adapter = mSeekDoctorDepartmentAdapter2 + + mSeekDoctorSick3Adapter= SeekDoctorSick3Adapter(mContext!!, + R.layout.item_recycle_seek_doctor_department_child3,mSickListRight) + val linearLayoutManager2 = LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false) + mBinding.seekDoctorDepartmentListRight.layoutManager = linearLayoutManager2 + mBinding.seekDoctorDepartmentListRight.adapter = mSeekDoctorSick3Adapter + + mSeekDoctorDepartmentAdapter3= SeekDoctorDepartment3Adapter(mContext!!, + R.layout.item_recycle_seek_doctor_department_child3,mDepartmentListRight) + val linearLayoutManager3 = LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false) + mBinding.seekDoctorDepartmentListRight.layoutManager = linearLayoutManager3 + mBinding.seekDoctorDepartmentListRight.adapter = mSeekDoctorDepartmentAdapter3 + + + //筛选头点击 + mBinding.customFilterSelectHospital.setOnClickListener { + if (mType==0) { + if (mBinding.customFilterSelectRvRoot.visibility==View.VISIBLE){ + mBinding.customFilterSelectRvRoot.visibility=View.GONE +// val drawableLeft = resources.getDrawable(R.drawable.common_filter_arrow_down) +// mBinding.customFilterSelectHospital.setCompoundDrawablesWithIntrinsicBounds(null, +// null, drawableLeft, null) +// mBinding.customFilterSelectHospital.setCompoundDrawablePadding(4) + setfilterTitleIcon(0,1) + }else{ + mBinding.customFilterSelectRvRoot.visibility=View.VISIBLE + mBinding.customFilterSelectRv.visibility=View.VISIBLE + mBinding.customFilterSelectDepart.visibility=View.GONE +// val drawableLeft = resources.getDrawable(R.drawable.common_filter_arrow_up) +// mBinding.customFilterSelectHospital.setCompoundDrawablesWithIntrinsicBounds(null, +// null, drawableLeft, null) +// mBinding.customFilterSelectHospital.setCompoundDrawablePadding(4) + setfilterTitleIcon(0,0) + } + }else{ +// if (mBinding.customFilterSelectRvRoot.visibility==View.GONE){ + mBinding.customFilterSelectRvRoot.visibility=View.VISIBLE + mBinding.customFilterSelectRv.visibility=View.VISIBLE + mBinding.customFilterSelectDepart.visibility=View.GONE +// } + setfilterTitleIcon(0,0) + } + mType=0 + mCustomFilterAdapter?.setDataType(0) + mCustomFilterAdapter?.setmDatas(mHospitalList) + mCustomFilterAdapter?.notifyDataSetChanged() + } + mBinding.customFilterSelectDepartment.setOnClickListener { + if(mDepartmentListLeft.size==0){ + return@setOnClickListener + } + if (mType==1) { + if (mBinding.customFilterSelectRvRoot.visibility==View.VISIBLE){ + mBinding.customFilterSelectRvRoot.visibility=View.GONE +// val drawableLeft = resources.getDrawable(R.drawable.common_filter_arrow_down) +// mBinding.customFilterSelectDepartment.setCompoundDrawablesWithIntrinsicBounds(null, +// null, drawableLeft, null) +// mBinding.customFilterSelectDepartment.setCompoundDrawablePadding(4) + setfilterTitleIcon(1,1) + }else{ + mBinding.customFilterSelectRvRoot.visibility=View.VISIBLE + mBinding.customFilterSelectRv.visibility=View.GONE + mBinding.customFilterSelectDepart.visibility=View.VISIBLE +// val drawableLeft = resources.getDrawable(R.drawable.common_filter_arrow_up) +// mBinding.customFilterSelectDepartment.setCompoundDrawablesWithIntrinsicBounds(null, +// null, drawableLeft, null) +// mBinding.customFilterSelectDepartment.setCompoundDrawablePadding(4) + setfilterTitleIcon(1,0) + } + }else{ +// if (mBinding.customFilterSelectRvRoot.visibility==View.GONE){ + mBinding.customFilterSelectRvRoot.visibility=View.VISIBLE + mBinding.customFilterSelectRv.visibility=View.GONE + mBinding.customFilterSelectDepart.visibility=View.VISIBLE +// val drawableLeft = resources.getDrawable(R.drawable.common_filter_arrow_up) +// mBinding.customFilterSelectDepartment.setCompoundDrawablesWithIntrinsicBounds(null, +// null, drawableLeft, null) +// mBinding.customFilterSelectDepartment.setCompoundDrawablePadding(4) + setfilterTitleIcon(1,0) +// } + } + mBinding.customFilterSelectRv.visibility=View.GONE + + mType=1 + mCustomFilterAdapter?.setDataType(1) + mSeekDoctorDepartmentAdapter2?.setmDatas(mDepartmentListLeft) + mSeekDoctorDepartmentAdapter3?.setmDatas(mDepartmentListRight) + mBinding.seekDoctorDepartmentListRight.adapter = mSeekDoctorDepartmentAdapter3 + if (mDepartmentListRight.size==0) { + if(mDepartmentListLeft.size>0){ + mClickListener?.let { + if(mSickAndDepartIndex0&&mSickAndDepartIndex { + var name=mHospitalList[position].hospitalName + mBinding.customFilterSelectHospital.text=name + if (name=="全部医院") { + bean.hospitalId="" + bean.isSelectHospital=true + }else{ + bean.hospitalId=mHospitalList[position].hospitalId + bean.isSelectHospital=false + } + mMethod?.let { it(bean) } + } + 1 -> { + mBinding.customFilterSelectDepartment.text=mDepartList[position].departmentName + bean.departmentId=mDepartList[position].departmentid + mMethod?.let { it(bean) } + } + 2 -> { + mBinding.customFilterSelectSick.text=mSickList[position].sicksName + bean.sickId=mSickList[position].sickId + mMethod?.let { it(bean) } + } + } + mBinding.customFilterSelectRvRoot.visibility=View.GONE + setfilterTitleIcon(0,1) + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + mSeekDoctorDepartmentAdapter3?.setOnItemClickListener(object : + MultiItemTypeAdapter.OnItemClickListener { + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + var id=mDepartmentListLeft[mSickAndDepartIndex].id + if (position==0&&id=="1") { + bean.departmentId="" + mBinding.customFilterSelectDepartment.text=mDepartmentListLeft[mSickAndDepartIndex].departmentName + }else{ + var name=mDepartmentListRight[position].departmentName + if (name.contains("全部")){ + name=mDepartmentListLeft[mSickAndDepartIndex].departmentName + } + mBinding.customFilterSelectDepartment.text=name + bean.departmentId=mDepartmentListRight[position].id + } + + mMethod?.let { it(bean) } + mBinding.customFilterSelectRvRoot.visibility=View.GONE + setfilterTitleIcon(1,1) + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + mSeekDoctorSick3Adapter?.setOnItemClickListener(object : + MultiItemTypeAdapter.OnItemClickListener { + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + var id=mSickListLeft[mSickAndDepartIndex].id + if (position==0&&id=="0") { + bean.sickId="" + mBinding.customFilterSelectSick.text=mSickListLeft[mSickAndDepartIndex].departmentName + }else{ + bean.sickId=mSickListRight[position].id + mBinding.customFilterSelectSick.text=mSickListRight[position].sicksName + } + + mMethod?.let { it(bean) } + mBinding.customFilterSelectRvRoot.visibility=View.GONE + setfilterTitleIcon(2,1) + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + mSeekDoctorDepartmentAdapter2?.setOnItemClickListener(object : + MultiItemTypeAdapter.OnItemClickListener { + override fun onItemClick(view: View?, holder: RecyclerView.ViewHolder?, position: Int) { + mSickAndDepartIndex=position + when(mType){ + 1 -> { + //科室 +// mBinding.customFilterSelectDepartment.text=mDepartList[position].departmentName +// bean.departmentId=mDepartList[position].departmentid +// mMethod?.let { it(bean) } + for (index in 0 until mDepartmentListLeft.size){ + if (index==position) { + mDepartmentListLeft[index].isSelect=true + }else{ + mDepartmentListLeft[index].isSelect=false + } + } + mSeekDoctorDepartmentAdapter2?.notifyDataSetChanged() + mClickListener?.let{ + it(0,mDepartmentListLeft[position].id) + } + } + 2 -> { + //疾病 +// mBinding.customFilterSelectSick.text=mSickList[position].sicksName +// bean.sickId=mSickList[position].sickId +// mMethod?.let { it(bean) } + for (index in 0 until mSickListLeft.size){ + if (index==position) { + mSickListLeft[index].isSelect=true + }else{ + mSickListLeft[index].isSelect=false + } + } + mSeekDoctorDepartmentAdapter2?.notifyDataSetChanged() + mClickListener?.let{ + it(1,mSickListLeft[position].id) + } + } + } +// mBinding.customFilterSelectRvRoot.visibility=View.GONE + } + + override fun onItemLongClick( + view: View?, + holder: RecyclerView.ViewHolder?, + position: Int + ): Boolean { + return false + } + }) + } + + /** + * type 0 医院 1科室 2疾病 + * type2 0 上 1下 + */ + fun setfilterTitleIcon(type:Int,tyep2:Int){ + val down = resources.getDrawable(R.drawable.common_filter_arrow_down) + val up = resources.getDrawable(R.drawable.common_filter_arrow_up) + when(type){ + 0 -> { + if(tyep2==0){ + mBinding.customFilterSelectHospital.setCompoundDrawablesWithIntrinsicBounds(null, + null, up, null) + }else{ + mBinding.customFilterSelectHospital.setCompoundDrawablesWithIntrinsicBounds(null, + null, down, null) + } + mContext?.let{ + if (mBinding.customFilterSelectHospital.text.toString()!="全部医院") { + mBinding.customFilterSelectHospital.setTextColor(it.resources.getColor(R.color.text_green_BD)) + }else{ + mBinding.customFilterSelectHospital.setTextColor(it.resources.getColor(R.color.text_black_33)) + } + } + + mBinding.customFilterSelectHospital.setCompoundDrawablePadding(4) + mBinding.customFilterSelectDepartment.setCompoundDrawablesWithIntrinsicBounds(null, + null, down, null) + mBinding.customFilterSelectDepartment.setCompoundDrawablePadding(4) + mBinding.customFilterSelectSick.setCompoundDrawablesWithIntrinsicBounds(null, + null, down, null) + mBinding.customFilterSelectSick.setCompoundDrawablePadding(4) + + } + 1 -> { + if(tyep2==0){ + mBinding.customFilterSelectDepartment.setCompoundDrawablesWithIntrinsicBounds(null, + null, up, null) + }else{ + mBinding.customFilterSelectDepartment.setCompoundDrawablesWithIntrinsicBounds(null, + null, down, null) + } + mContext?.let{ + if (mBinding.customFilterSelectDepartment.text.toString()!="全部科室") { + mBinding.customFilterSelectDepartment.setTextColor(it.resources.getColor(R.color.text_green_BD)) + }else{ + mBinding.customFilterSelectDepartment.setTextColor(it.resources.getColor(R.color.text_black_33)) + } + } + mBinding.customFilterSelectDepartment.setCompoundDrawablePadding(4) + + mBinding.customFilterSelectHospital.setCompoundDrawablePadding(4) + mBinding.customFilterSelectHospital.setCompoundDrawablesWithIntrinsicBounds(null, + null, down, null) + + mBinding.customFilterSelectSick.setCompoundDrawablesWithIntrinsicBounds(null, + null, down, null) + mBinding.customFilterSelectSick.setCompoundDrawablePadding(4) + } + 2 -> { + if(tyep2==0){ + mBinding.customFilterSelectSick.setCompoundDrawablesWithIntrinsicBounds(null, + null, up, null) + }else{ + mBinding.customFilterSelectSick.setCompoundDrawablesWithIntrinsicBounds(null, + null, down, null) + } + mContext?.let{ + if (mBinding.customFilterSelectSick.text.toString()!="全部疾病") { + mBinding.customFilterSelectSick.setTextColor(it.resources.getColor(R.color.text_green_BD)) + }else{ + mBinding.customFilterSelectSick.setTextColor(it.resources.getColor(R.color.text_black_33)) + } + } + mBinding.customFilterSelectSick.setCompoundDrawablePadding(4) + + mBinding.customFilterSelectHospital.setCompoundDrawablePadding(4) + mBinding.customFilterSelectHospital.setCompoundDrawablesWithIntrinsicBounds(null, + null, down, null) + + + mBinding.customFilterSelectDepartment.setCompoundDrawablesWithIntrinsicBounds(null, + null, down, null) + mBinding.customFilterSelectDepartment.setCompoundDrawablePadding(4) + + } + } + } + + fun setLeftData(list:ArrayList){ + mDepartmentListLeft.clear() + mDepartmentListLeft.addAll(list) + } + + fun setSickLeftData(list:ArrayList){ + mSickListLeft.clear() + mSickListLeft.addAll(list) + } + + fun setSickRightData(list:ArrayList){ + mSickListRight.clear() + mSickListRight.addAll(list) + mSeekDoctorSick3Adapter?.notifyDataSetChanged() + } + + fun setDepartRightData(list:ArrayList){ + mDepartmentListRight.clear() + mDepartmentListRight.addAll(list) + mSeekDoctorDepartmentAdapter3?.notifyDataSetChanged() + } + + fun setHospitalData(list:ArrayList){ + mHospitalList.clear() + mHospitalList.addAll(list) + } + + fun setDepartData(list:ArrayList){ + mDepartList.clear() + mDepartList.addAll(list) + } + + fun setSickData(list:ArrayList){ + mSickList.clear() + mSickList.addAll(list) + } + + fun hideHospitalFilter(){ + mBinding.customFilterSelectHospital.visibility=View.GONE + } + + fun refreshState(){ + when (mType2) { + 1 -> { + mContext?.let{ + mBinding.customFilterSelectMark.setTextColor(it.resources.getColor(R.color.text_green_BD)) + mBinding.customFilterSelectHot.setTextColor(it.resources.getColor(R.color.text_black_33)) + mBinding.customFilterSelectReply.setTextColor(it.resources.getColor(R.color.text_black_33)) + } + } + 2 -> { + mContext?.let{ + mBinding.customFilterSelectMark.setTextColor(it.resources.getColor(R.color.text_black_33)) + mBinding.customFilterSelectHot.setTextColor(it.resources.getColor(R.color.text_green_BD)) + mBinding.customFilterSelectReply.setTextColor(it.resources.getColor(R.color.text_black_33)) + } + } + 3 -> { + mContext?.let{ + mBinding.customFilterSelectMark.setTextColor(it.resources.getColor(R.color.text_black_33)) + mBinding.customFilterSelectHot.setTextColor(it.resources.getColor(R.color.text_black_33)) + mBinding.customFilterSelectReply.setTextColor(it.resources.getColor(R.color.text_green_BD)) + } + } + else -> {} + } + } + + fun setFilterListener( method: (bean: selectDictListByNHDSRequestBean) -> Unit){ + mMethod=method + } + fun setDoubleListListener( method: ((type:Int,id:String) -> Unit?)){ + mClickListener=method + } + + fun setDataBean(beans: selectDictListByNHDSRequestBean){ + bean=beans + } + + fun setDepartText(text:String,id:String=""){ + mBinding.customFilterSelectDepartment.text=text + mContext?.let { + mBinding.customFilterSelectDepartment.setTextColor(it.resources.getColor(R.color.text_green_BD)) + } + } + fun setDepartResettingText(text:String){ + mBinding.customFilterSelectDepartment.text=text + mContext?.let { + mBinding.customFilterSelectDepartment.setTextColor(it.resources.getColor(R.color.text_black_33)) + } + } + + fun setSickResettingText(text:String){ + mBinding.customFilterSelectSick.text=text + mContext?.let { + mBinding.customFilterSelectSick.setTextColor(it.resources.getColor(R.color.text_black_33)) + } + } + + fun setSickText(text:String,id:String){ + mBinding.customFilterSelectSick.text=text + mContext?.let { + mBinding.customFilterSelectSick.setTextColor(it.resources.getColor(R.color.text_green_BD)) + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomImageView.java b/app/src/main/java/com/xjjk/healthyclients/view/CustomImageView.java new file mode 100644 index 0000000..2df2b96 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomImageView.java @@ -0,0 +1,53 @@ +package com.xjjk.healthyclients.view; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Path; +import android.graphics.RectF; +import android.util.AttributeSet; +import android.util.TypedValue; + +import androidx.annotation.Nullable; + +public class CustomImageView extends androidx.appcompat.widget.AppCompatImageView { + private Context mContext; + public CustomImageView(Context context) { + super(context, null); + mContext=context; + + } + + /*圆角的半径,依次为左上角xy半径,右上角,右下角,左下角*/ + private float[] rids; + + public CustomImageView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs, 0); + mContext=context; + + } + + public CustomImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + mContext=context; + } + + @Override + protected void onDraw(Canvas canvas) { + + float rid = dp2px(mContext, 8f); + //创建圆角数组 + rids = new float[]{rid, rid, rid, rid, rid, rid, rid, rid}; + Path path = new Path(); + int w = this.getWidth(); + int h = this.getHeight(); + path.addRoundRect(new RectF(0, 0, w, h), rids, Path.Direction.CW); + canvas.clipPath(path); + super.onDraw(canvas); + } + + public int dp2px(Context context, float dpVal) { + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + dpVal, context.getResources().getDisplayMetrics()); + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomPasswordView.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomPasswordView.kt new file mode 100644 index 0000000..5217032 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomPasswordView.kt @@ -0,0 +1,51 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.text.method.HideReturnsTransformationMethod +import android.text.method.PasswordTransformationMethod +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.RelativeLayout +import androidx.databinding.DataBindingUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.CustomPasswordViewBinding + +class CustomPasswordView : RelativeLayout { + + var mContext:Context?=null + lateinit var mBinding: CustomPasswordViewBinding + constructor(context: Context?,attrs : AttributeSet?): super(context, attrs,0){ + mContext=context +// if(isInEditMode){ +// LayoutInflater.from(context).inflate(R.layout.custom_password_view, this, true) +// }else{ + mBinding = DataBindingUtil.inflate( + LayoutInflater.from(context), + R.layout.custom_password_view, this,true) +// } + mBinding.loginEtUserPassword.setTransformationMethod(PasswordTransformationMethod.getInstance()) + mBinding.loginIvEye.setOnClickListener { + mBinding?.let { + var selection= it.loginEtUserPassword.selectionEnd + if (it.loginEtUserPassword.transformationMethod== PasswordTransformationMethod.getInstance()){ + it.loginEtUserPassword.setTransformationMethod( + HideReturnsTransformationMethod.getInstance()) + it.loginIvEye.setImageResource(R.mipmap.ic_password_show) + }else{ + it.loginEtUserPassword.setTransformationMethod(PasswordTransformationMethod.getInstance()) + it.loginIvEye.setImageResource(R.mipmap.ic_password_hind) + } + it.loginEtUserPassword.setSelection(selection) + } + } + } + fun getInputContext():String{ + return mBinding.loginEtUserPassword.text.toString().trim() + } + fun setInputContext(password: String){ + mBinding.loginEtUserPassword.setText(password) + } + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomScrollView.java b/app/src/main/java/com/xjjk/healthyclients/view/CustomScrollView.java new file mode 100644 index 0000000..eb9138e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomScrollView.java @@ -0,0 +1,61 @@ +package com.xjjk.healthyclients.view; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.ViewConfiguration; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.widget.NestedScrollView; + +public class CustomScrollView extends NestedScrollView { + + public CustomScrollView(@NonNull Context context) { + super(context); + } + + private float maxSlideDis;//向上滑动的最大滑动距离,没有超过这个距离时,拦截并处理掉向上滑动的事件 + //在activity或fragment中,根据布局参数进行设置 + + private float mDownY; + private float mSlop; + + public CustomScrollView(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + mSlop = ViewConfiguration.get(context).getScaledTouchSlop(); + } + + public void setMaxSlideDis(float maxSlideDis) { + this.maxSlideDis = maxSlideDis; + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + switch (ev.getAction()) { + case MotionEvent.ACTION_DOWN: + mDownY = ev.getRawY(); + break; + +// case MotionEvent.ACTION_MOVE: +// float dis = ev.getRawY() - mDownY; +// if (dis < 0 && Math.abs(dis) >= mSlop) { +// //当触摸事件是向上滑动并且滑动距离超过屏幕的最小滑动单位时 +// return needScrollParent(); +// } +// return true; +// break; + } + return super.onInterceptTouchEvent(ev); + } + + //scroller 是否已经滑动到了最高点 + public boolean needScrollParent() { + return getScrollY() < maxSlideDis; + } + + public CustomScrollView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + +} diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomSearchView.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomSearchView.kt new file mode 100644 index 0000000..8b2a428 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomSearchView.kt @@ -0,0 +1,97 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.text.Editable +import android.text.TextUtils +import android.text.TextWatcher +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.view.inputmethod.EditorInfo +import android.widget.EditText +import android.widget.RelativeLayout +import androidx.databinding.DataBindingUtil +import com.sw.healthyclients.utils.KeyboardUtil.hideSoftInput +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.CustomSearchViewBinding + +class CustomSearchView : RelativeLayout { + + var mContext:Context?=null + lateinit var mBinding: CustomSearchViewBinding + constructor(context: Context?,attrs : AttributeSet?): super(context, attrs,0){ + mContext=context + if(isInEditMode){ + LayoutInflater.from(context).inflate(R.layout.custom_search_view, this, true) + }else{ + mBinding = DataBindingUtil.inflate( + LayoutInflater.from(context), + R.layout.custom_search_view, this,true) + } + + } + fun initView(hint:String){ + mBinding.customSearchEt.hint="$hint" + } + fun initEtContext(value:String?){ + mBinding.customSearchEt.setText(value) + } + + fun setPerformClick(){ + mBinding.customSearchTv.performClick() + } + + fun setOnCustomClickListener(method: (searchContent: String) -> Unit): String { + mBinding.customSearchTv.setOnClickListener { + hideSoftInput(context, mBinding.customSearchEt) + var value = mBinding.customSearchEt.text.trim().toString() + method(value) + } + //输入内容为空时回调 + mBinding.customSearchEt.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged( + s: CharSequence?, + start: Int, + count: Int, + after: Int + ) { + } + + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + if (TextUtils.isEmpty(s)) { +// method("") + mBinding.customSearchTv.performClick() + } + } + + override fun afterTextChanged(s: Editable?) { + + } + + }) + mBinding.customSearchEt.setOnEditorActionListener { v, actionId, event -> + if (actionId == EditorInfo.IME_ACTION_SEARCH) { + //点击搜索的时候隐藏软键盘 + hideSoftInput(context, v as EditText) + var value = mBinding.customSearchEt.text.trim().toString() + method(value) + } + false + } + return mBinding.customSearchEt.text.trim().toString() + } + + fun setFocusListener(method: (hasFocus:Boolean) -> Unit){ + mBinding.customSearchEt.setOnFocusChangeListener(object: OnFocusChangeListener{ + override fun onFocusChange(v: View?, hasFocus: Boolean) { + method(hasFocus) + } + }) + } + + fun getInoputText():String{ + return mBinding.customSearchEt.text.toString().trim() + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomUserInfoImageText.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomUserInfoImageText.kt new file mode 100644 index 0000000..4d2ec1e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomUserInfoImageText.kt @@ -0,0 +1,103 @@ +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 androidx.databinding.DataBindingUtil +import com.bumptech.glide.request.RequestOptions +import com.sw.healthyclients.data.local.DataStoreManager +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.CustomUserInfoImageTextBinding +import com.xjjk.healthyclients.superfuntion.load + + +class CustomUserInfoImageText : RelativeLayout { + + var mContext:Context?=null + var mBinding: CustomUserInfoImageTextBinding + @JvmOverloads + constructor(context: Context?,attrs : AttributeSet? = null, + defStyleAttr: Int = 0): super(context, attrs,defStyleAttr){ + mContext=context + mBinding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.custom_user_info_image_text,this,true) + } + fun setInfo(str1:String,str2:String,isShow:Boolean=true){ + mBinding?.apply { + var Params=customUserInfoRoot.layoutParams + Params.height=dpToPx(mContext,45f) + customUserInfoRoot.layoutParams=Params + customUserInfoName.setText(str1) + customUserInfoValue.setText(str2) + customUserInfoHeaderRoot.visibility=View.GONE + if (isShow) { + customUserInfoLine.visibility=View.VISIBLE + }else{ + customUserInfoLine.visibility=View.GONE + } + } + } + + fun setInfoEvent(str1:String, str2:String, isShow:Boolean=true, method: (() -> Unit)?){ + mBinding?.apply { + var Params=customUserInfoRoot.layoutParams + Params.height=dpToPx(mContext,45f) + customUserInfoRoot.layoutParams=Params + customUserInfoName.setText(str1) + customUserInfoValue.setText(str2) + customUserInfoValue.setTextColor(Color.parseColor("#3390FF")) + customUserInfoValue.setOnClickListener { + if (method != null) { + method() + } + } + customUserInfoHeaderRoot.visibility=View.GONE + if (isShow) { + customUserInfoLine.visibility=View.VISIBLE + }else{ + customUserInfoLine.visibility=View.GONE + } + } + } + + fun setheaderInfo(str1:String,url:String,isShow: Boolean=false,method: () -> Unit){ + mBinding?.apply { + var Params=customUserInfoRoot.layoutParams + Params.height=dpToPx(mContext,60f) + customUserInfoRoot.layoutParams=Params + customUserInfoName.setText(str1) + customUserInfoHeaderRoot.visibility=View.VISIBLE + var bean= DataStoreManager.getUserInfo() + var defaultImg= R.drawable.ic_mulher + if (bean.sex=="1") { + defaultImg= R.drawable.ic_mulher + }else{ + defaultImg= R.drawable.ic_masculino + } + var options = RequestOptions() + .placeholder(defaultImg)//图片加载出来前,显示的图片 + .fallback(defaultImg) //url为空的时候,显示的图片 + .error(defaultImg);//图片加载失败后,显示的图片 + mContext?.let { + customUserInfoHeader.load(url,defaultResId=defaultImg) + } + customUserInfoRoot.setOnClickListener { + method() + } + if (isShow){ + ivHeaderRight.visibility=View.VISIBLE + }else{ + ivHeaderRight.visibility=View.GONE + } + } + } + + private fun dpToPx(context: Context?, dp: Float): Int { + val displayMetrics = context?.resources?.displayMetrics + return (dp * displayMetrics?.density!! + 0.5f).toInt() + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomUserInfoMenu.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomUserInfoMenu.kt new file mode 100644 index 0000000..03c2dd7 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomUserInfoMenu.kt @@ -0,0 +1,66 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.RelativeLayout +import androidx.databinding.DataBindingUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.CustomUserInfoMenuBinding + +/** + * 我的底部功能菜单 + */ +class CustomUserInfoMenu : RelativeLayout { + + var mContext:Context?=null + var mBinding: CustomUserInfoMenuBinding + constructor(context: Context?,attrs : AttributeSet?): super(context, attrs,0){ + mContext=context + mBinding = DataBindingUtil.inflate( + LayoutInflater.from(context), + R.layout.custom_user_info_menu, this,true) + } + + fun setOrderStateInfo(name:String,id:Int,state:Int){ + mBinding.apply { + if (id==0) { + customUserInfoMenuIcon.visibility=View.GONE + }else{ + customUserInfoMenuIcon.visibility=View.VISIBLE + } + customUserInfoMenuIcon.setImageResource(id) + customUserInfoMenuName.setText(name) + customUserInfoMenuLine.visibility=state + } + + } + + fun setOrderStateInfo(name:String,id:Int,state:Int,showRightIV:Boolean,version:String){ + mBinding.apply { + if (id==0) { + customUserInfoMenuIcon.visibility=View.GONE + }else{ + customUserInfoMenuIcon.visibility=View.VISIBLE + } + if (showRightIV) { + customUserInfoIvRight.visibility=View.VISIBLE + }else{ + customUserInfoIvRight.visibility=View.GONE + } + if (version.isNotEmpty()) { + customUserInfoTvRight.visibility=View.VISIBLE + customUserInfoTvRight.text=version + }else{ + customUserInfoTvRight.visibility=View.GONE + } + customUserInfoMenuIcon.setImageResource(id) + customUserInfoMenuName.setText(name) + customUserInfoMenuLine.visibility=state + } + + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomUserInfoOrder.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomUserInfoOrder.kt new file mode 100644 index 0000000..60d34d4 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomUserInfoOrder.kt @@ -0,0 +1,45 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.RelativeLayout +import androidx.databinding.DataBindingUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.CustomUserInfoOrderBinding + +class CustomUserInfoOrder : RelativeLayout { + + var mContext:Context?=null + var mBinding: CustomUserInfoOrderBinding + constructor(context: Context?,attrs : AttributeSet?): super(context, attrs,0){ + mContext=context + mBinding = DataBindingUtil.inflate( + LayoutInflater.from(context), + R.layout.custom_user_info_order, this,true) + } + + fun setOrderStateInfo(name:String,id:Int){ + mBinding.apply { + customUserInfoStateIcon.setImageResource(id) + customUserInfoStateName.setText(name) + } + } + + fun setsetOrderStateNumber(number:Int){ + mBinding.apply { + if(number>0){ + customUserInfoStateNumber.visibility=View.VISIBLE + customUserInfoStateNumber.setText("${number}") + }else{ + customUserInfoStateNumber.visibility=View.INVISIBLE +// customUserInfoStateNumber.setText(number) + } +// customUserInfoStateNumber.visibility=View.VISIBLE +// customUserInfoStateNumber.setText(number) + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/CustomguidanceImageText.kt b/app/src/main/java/com/xjjk/healthyclients/view/CustomguidanceImageText.kt new file mode 100644 index 0000000..6de71e3 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/CustomguidanceImageText.kt @@ -0,0 +1,41 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.content.res.ColorStateList +import android.graphics.Color +import android.graphics.drawable.GradientDrawable +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.RelativeLayout +import androidx.databinding.DataBindingUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.CustomGuidanceImageTextBinding + + +class CustomguidanceImageText : RelativeLayout { + + var mContext:Context?=null + var mBinding: CustomGuidanceImageTextBinding + @JvmOverloads + constructor(context: Context?,attrs : AttributeSet? = null, + defStyleAttr: Int = 0): super(context, attrs,defStyleAttr){ + mContext=context + mBinding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.custom_guidance_image_text,this,true) + } + fun setStyleInfo(name:String,resource:Int,hint:String,color:Int){ + mBinding.apply { + customGuidanceTypeName.text=name + customGuidanceTypeIcon.setImageResource(resource) + customGuidanceTypeHint.text=hint + customGuidanceTypeRootBg.backgroundTintList = ColorStateList.valueOf(color) + } + } + fun setRemind(){ + mBinding?.apply { + customGuidanceTypeRemind.visibility=View.VISIBLE + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/DoctorBaseInfoView.kt b/app/src/main/java/com/xjjk/healthyclients/view/DoctorBaseInfoView.kt new file mode 100644 index 0000000..43a2d1e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/DoctorBaseInfoView.kt @@ -0,0 +1,60 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.text.TextUtils +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.ImageButton +import android.widget.LinearLayout +import android.widget.TextView +import android.widget.ToggleButton +import androidx.databinding.DataBindingUtil +import androidx.room.util.StringUtil +import com.sw.healthyclients.bean.guidance.DoctorBean +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.BR +import com.xjjk.healthyclients.databinding.ViewDoctorBaseInfoBinding + + +class DoctorBaseInfoView: LinearLayout { + lateinit var mBinding: ViewDoctorBaseInfoBinding + @JvmOverloads + constructor(context: Context?, attrs : AttributeSet? = null, + defStyleAttr: Int = 0): super(context, attrs,defStyleAttr){ + if(isInEditMode){ + LayoutInflater.from(context).inflate(R.layout.view_doctor_base_info, this, true) + }else{ + mBinding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.view_doctor_base_info,this,true) + } + } + enum class PageStatus(val status: Int) { + APPOINTMENT_CONSULT(1), + DOCTOR_HOME_PAGE(2) + } + fun setData(doctorBean: DoctorBean?, status: PageStatus){ + if(doctorBean == null){ + return + } + when(status){ + PageStatus.APPOINTMENT_CONSULT -> { + mBinding.clFeedbackLay.visibility = GONE + } + PageStatus.DOCTOR_HOME_PAGE -> { + mBinding.clFeedbackLay.visibility = VISIBLE + } + } + mBinding.setVariable(BR.doctorBean, doctorBean) +// mBinding.btnFollow.background = context.getDrawable(if("1" == doctorBean.tfFollow) R.drawable.bg_follow_selected else R.drawable.bg_follow_unselected) + doctorBean.goodAtSicknessName?.let { + it.forEach {diseaseBean -> + var textView: TextView = LayoutInflater.from(context).inflate(R.layout.item_flow_tag, mBinding.flowLay, false) as TextView + textView.text = diseaseBean.name + mBinding.flowLay.addView(textView) + } + } + + } + fun getFollowView(): ImageButton { + return mBinding.btnFollow + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/DoubleScaleImageView.java b/app/src/main/java/com/xjjk/healthyclients/view/DoubleScaleImageView.java new file mode 100644 index 0000000..6423d16 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/DoubleScaleImageView.java @@ -0,0 +1,463 @@ +package com.xjjk.healthyclients.view; + +import android.content.Context; +import android.graphics.Matrix; +import android.graphics.PointF; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; +import android.widget.ImageView; + +import androidx.annotation.Nullable; + +import com.orhanobut.logger.Logger; + +public class DoubleScaleImageView extends ImageView implements View.OnTouchListener { + + + + public class ZoomMode{ + + + public final static int Ordinary=0; + public final static int ZoomIn=1; + public final static int TowFingerZoom = 2; + } + + + + private Matrix matrix; + //imageView的大小 + private PointF viewSize; + //图片的大小 + private PointF imageSize; + //缩放后图片的大小 + private PointF scaleSize = new PointF(); + //最初的宽高的缩放比例 + private PointF originScale = new PointF(); + //imageview中bitmap的xy实时坐标 + private PointF bitmapOriginPoint = new PointF(); + //点击的点 + private PointF clickPoint = new PointF(); + //设置的双击检查时间限制 + private long doubleClickTimeSpan = 250; + //上次点击的时间 + private long lastClickTime = 0; + //双击放大的倍数 + private int doubleClickZoom = 2; + //当前缩放的模式 + private int zoomInMode = ZoomMode.Ordinary; + //临时坐标比例数据 + private PointF tempPoint = new PointF(); + //最大缩放比例 + private float maxScrole = 4; + //两点之间的距离 + private float doublePointDistance = 0; + //双指缩放时候的中心点 + private PointF doublePointCenter = new PointF(); + //两指缩放的比例 + private float doubleFingerScrole = 0; + //上次触碰的手指数量 + private int lastFingerNum = 0; + + + public DoubleScaleImageView(Context context) { + + + super(context); + init(); + } + + public DoubleScaleImageView(Context context, @Nullable AttributeSet attrs) { + + + super(context, attrs); + init(); + } + + public DoubleScaleImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + + + super(context, attrs, defStyleAttr); + init(); + } + + private void init(){ + + + setOnTouchListener(this); + setScaleType(ScaleType.MATRIX); + matrix = new Matrix(); + } + + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + + + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + int width = MeasureSpec.getSize(widthMeasureSpec); + int height = MeasureSpec.getSize(heightMeasureSpec); + viewSize = new PointF(width,height); + + Drawable drawable = getDrawable(); + if (drawable != null){ + + + imageSize = new PointF(drawable.getMinimumWidth(),drawable.getMinimumHeight()); + showCenter(); + } + } + + /** + * 设置图片居中等比显示 + */ + private void showCenter(){ + + + float scalex = viewSize.x/imageSize.x; + float scaley = viewSize.y/imageSize.y; + + float scale = scalex= originScale.x * maxScrole + || scaleSize.y/imageSize.y >= originScale.y * maxScrole) + && getDoubleFingerDistance(event) - doublePointDistance > 0){ + + + break; + } + //这里设置当双指缩放的的距离变化量大于50,并且当前不是在双指缩放状态下,就计算中心点,等一些操作 + if (Math.abs(getDoubleFingerDistance(event) - doublePointDistance) > 50 + && zoomInMode != ZoomMode.TowFingerZoom){ + + + //计算两个手指之间的中心点,当作放大的中心点 + doublePointCenter.set((event.getX(0) + event.getX(1))/2, + (event.getY(0) + event.getY(1))/2); + //将双指的中心点就假设为点击的点 + clickPoint.set(doublePointCenter); + //下面就和双击放大基本一样 + getBitmapOffset(); + //分别记录被点击的点到图片左上角x,y轴的距离与图片x,y轴边长的比例, + //方便在进行缩放后,算出这个点对应的坐标点 + tempPoint.set((clickPoint.x - bitmapOriginPoint.x)/scaleSize.x, + (clickPoint.y - bitmapOriginPoint.y)/scaleSize.y); + //设置进入双指缩放状态 + zoomInMode = ZoomMode.TowFingerZoom; + } + //如果已经进入双指缩放状态,就直接计算缩放的比例,并进行位移 + if (zoomInMode == ZoomMode.TowFingerZoom){ + + + //用当前的缩放比例与此时双指间距离的缩放比例相乘,就得到对应的图片应该缩放的比例 + float scrole = + doubleFingerScrole*getDoubleFingerDistance(event)/doublePointDistance; + //这里也是和双击放大时一样的 + scaleImage(new PointF(scrole,scrole)); + getBitmapOffset(); + translationImage( + new PointF( + clickPoint.x - (bitmapOriginPoint.x + tempPoint.x*scaleSize.x), + clickPoint.y - (bitmapOriginPoint.y + tempPoint.y*scaleSize.y)) + ); + } + } + break; + case MotionEvent.ACTION_UP: + //手指松开时触发事件 + Logger.e("kzg","***********************ACTION_UP"); + lastFingerNum = 0; + break; + } + return true; + } + + + + public void scaleImage(PointF scaleXY){ + + + matrix.setScale(scaleXY.x,scaleXY.y); + scaleSize.set(scaleXY.x * imageSize.x,scaleXY.y * imageSize.y); + setImageMatrix(matrix); + } + + /** + * 对图片进行x和y轴方向的平移 + * @param pointF + */ + public void translationImage(PointF pointF){ + + + matrix.postTranslate(pointF.x,pointF.y); + setImageMatrix(matrix); + } + + + /** + * 防止移动图片超过边界,计算边界情况 + * @param moveX + * @param moveY + * @return + */ + public float[] moveBorderDistance(float moveX,float moveY){ + + + //计算bitmap的左上角坐标 + getBitmapOffset(); + //计算bitmap的右下角坐标 + float bitmapRightBottomX = bitmapOriginPoint.x + scaleSize.x; + float bitmapRightBottomY = bitmapOriginPoint.y + scaleSize.y; + + if (moveY > 0){ + + + //向下滑 + if (bitmapOriginPoint.y + moveY > 0){ + + + if (bitmapOriginPoint.y < 0){ + + + moveY = -bitmapOriginPoint.y; + }else { + + + moveY = 0; + } + } + }else if (moveY < 0){ + + + //向上滑 + if (bitmapRightBottomY + moveY < viewSize.y){ + + + if (bitmapRightBottomY > viewSize.y){ + + + moveY = -(bitmapRightBottomY - viewSize.y); + }else { + + + moveY = 0; + } + } + } + + if (moveX > 0){ + + + //向右滑 + if (bitmapOriginPoint.x + moveX > 0){ + + + if (bitmapOriginPoint.x < 0){ + + + moveX = -bitmapOriginPoint.x; + }else { + + + moveX = 0; + } + } + }else if (moveX < 0){ + + + //向左滑 + if (bitmapRightBottomX + moveX < viewSize.x){ + + + if (bitmapRightBottomX > viewSize.x){ + + + moveX = -(bitmapRightBottomX - viewSize.x); + }else { + + + moveX = 0; + } + } + } + return new float[]{ + + moveX,moveY}; + } + + /** + * 获取view中bitmap的坐标点 + */ + public void getBitmapOffset(){ + + + float[] value = new float[9]; + float[] offset = new float[2]; + Matrix imageMatrix = getImageMatrix(); + imageMatrix.getValues(value); + offset[0] = value[2]; + offset[1] = value[5]; + bitmapOriginPoint.set(offset[0],offset[1]); + } + + + /** + * 计算零个手指间的距离 + * @param event + * @return + */ + public static float getDoubleFingerDistance(MotionEvent event){ + + + float x = event.getX(0) - event.getX(1); + float y = event.getY(0) - event.getY(1); + return (float)Math.sqrt(x * x + y * y) ; + } +} diff --git a/app/src/main/java/com/xjjk/healthyclients/view/FlowLayout.kt b/app/src/main/java/com/xjjk/healthyclients/view/FlowLayout.kt new file mode 100644 index 0000000..4d7566a --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/FlowLayout.kt @@ -0,0 +1,421 @@ +package com.xjjk.healthyclients.view + +import android.annotation.SuppressLint +import android.content.Context +import android.util.AttributeSet +import android.view.Gravity +import android.view.View +import android.view.ViewGroup +import com.xjjk.healthyclients.R +import kotlin.math.max +import kotlin.math.min + +/** + * 流式布局 + * + * @author nanfeifei 2018/5/4 + */ +class FlowLayout(context: Context, attrs: AttributeSet?) : ViewGroup(context, attrs) { + + /** 水平间距 */ + private var mChildHorizontalSpacing = 0 + + /** 垂直间距 */ + private var mChildVerticalSpacing = 0 + + /** 对齐方式,目前支持 [Gravity.CENTER_HORIZONTAL], [Gravity.LEFT] 和 [Gravity.RIGHT] */ + private var mGravity: Int = 0 + + private var mMaxMode = LINES + private var mMaximum = Integer.MAX_VALUE + + companion object { + private const val LINES = 0 + private const val NUMBER = 1 + } + + /** 每一行的item数目,下标表示行下标,在onMeasured的时候计算得出,供onLayout去使用 */ + private lateinit var mItemNumberInEachLine: IntArray + + /** 每一行的item的宽度和(包括item直接的间距),下标表示行下标 */ + private lateinit var mWidthSumInEachLine: IntArray + + /** onMeasure过程中实际参与measure的子View个数 */ + private var measuredChildCount: Int = 0 + + init { + val typeArray = context.obtainStyledAttributes(attrs, R.styleable.FlowLayout) + mChildHorizontalSpacing = + typeArray.getDimensionPixelSize(R.styleable.FlowLayout_childHorizontalSpacing, 0) + mChildVerticalSpacing = + typeArray.getDimensionPixelSize(R.styleable.FlowLayout_childVerticalSpacing, 0) + mGravity = typeArray.getInteger(R.styleable.FlowLayout_android_gravity, Gravity.START) + val maxLines = typeArray.getInt(R.styleable.FlowLayout_android_maxLines, -1) + if (maxLines >= 0) { + setMaxLines(maxLines) + } + val maxNumber = typeArray.getInt(R.styleable.FlowLayout_maxNumber, -1) + if (maxNumber >= 0) { + setMaxNumber(maxNumber) + } + typeArray.recycle() + } + + @SuppressLint("DrawAllocation", "SwitchIntDef") + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + val widthSpecMode = MeasureSpec.getMode(widthMeasureSpec) + val widthSpecSize = MeasureSpec.getSize(widthMeasureSpec) + val heightSpecMode = MeasureSpec.getMode(heightMeasureSpec) + val heightSpecSize = MeasureSpec.getSize(heightMeasureSpec) + var maxLineHeight = 0 + var resultWidth: Int + val resultHeight: Int + val count = childCount + mItemNumberInEachLine = IntArray(count) + mWidthSumInEachLine = IntArray(count) + var lineIndex = 0 + + // 若FlowLayout指定了MATCH_PARENT或固定宽度,则需要使子View换行 + if (widthSpecMode == MeasureSpec.EXACTLY) { + resultWidth = widthSpecSize + measuredChildCount = 0 + // 下一个子View的position + var childPositionX = paddingLeft + var childPositionY = paddingTop + // 子View的Right最大可达到的x坐标 + val childMaxRight = widthSpecSize - paddingRight + + for (i in 0 until count) { + if (mMaxMode == NUMBER && measuredChildCount >= mMaximum) { + // 超出最多数量,则不再继续 + break + } else if (mMaxMode == LINES && lineIndex >= mMaximum) { + // 超出最多行数,则不再继续 + break + } + + val child = getChildAt(i) + if (child.visibility == View.GONE) { + continue + } + + val childLayoutParams = child.layoutParams + val childWidthMeasureSpec = getChildMeasureSpec( + widthMeasureSpec, + paddingLeft + paddingRight, + childLayoutParams.width + ) + val childHeightMeasureSpec = getChildMeasureSpec( + heightMeasureSpec, + paddingTop + paddingBottom, + childLayoutParams.height + ) + child.measure(childWidthMeasureSpec, childHeightMeasureSpec) + + val childWidth = child.measuredWidth + maxLineHeight = max(maxLineHeight, child.measuredHeight) + // 需要换行 + if (childPositionX + childWidth > childMaxRight) { + // 如果换行后超出最大行数,则不再继续 + if (mMaxMode == LINES) { + if (lineIndex + 1 >= mMaximum) { + break + } + } + // 后面每次加item都会加上一个space,这样的话每行都会为最后一个item多加一次space,所以在这里减一次 + mWidthSumInEachLine[lineIndex] -= mChildHorizontalSpacing + lineIndex++ // 换行 + childPositionX = paddingLeft // 下一行第一个item的x + childPositionY += maxLineHeight + mChildVerticalSpacing // 下一行第一个item的y + } + mItemNumberInEachLine[lineIndex]++ + mWidthSumInEachLine[lineIndex] += childWidth + mChildHorizontalSpacing + childPositionX += childWidth + mChildHorizontalSpacing + measuredChildCount++ + } + // 如果最后一个item不是刚好在行末(即lineCount最后没有+1,也就是mWidthSumInEachLine[lineCount]非0),则要减去最后一个item的space + if (mWidthSumInEachLine.isNotEmpty() && mWidthSumInEachLine[lineIndex] > 0) { + mWidthSumInEachLine[lineIndex] -= mChildHorizontalSpacing + } + resultHeight = when (heightSpecMode) { + MeasureSpec.UNSPECIFIED -> childPositionY + maxLineHeight + paddingBottom + MeasureSpec.AT_MOST -> min( + childPositionY + maxLineHeight + paddingBottom, + heightSpecSize + ) + else -> heightSpecSize + } + } else { + // 不计算换行,直接一行铺开 + resultWidth = paddingLeft + paddingRight + measuredChildCount = 0 + + for (i in 0 until count) { + if (mMaxMode == NUMBER) { + // 超出最多数量,则不再继续 + if (measuredChildCount > mMaximum) { + break + } + } else if (mMaxMode == LINES) { + // 超出最大行数,则不再继续 + if (1 > mMaximum) { + break + } + } + val child = getChildAt(i) + if (child.visibility == View.GONE) { + continue + } + val childLayoutParams = child.layoutParams + val childWidthMeasureSpec = getChildMeasureSpec( + widthMeasureSpec, + paddingLeft + paddingRight, + childLayoutParams.width + ) + val childHeightMeasureSpec = getChildMeasureSpec( + heightMeasureSpec, + paddingTop + paddingBottom, + childLayoutParams.height + ) + child.measure(childWidthMeasureSpec, childHeightMeasureSpec) + resultWidth += child.measuredWidth + maxLineHeight = max(maxLineHeight, child.measuredHeight) + measuredChildCount++ + } + if (measuredChildCount > 0) { + resultWidth += mChildHorizontalSpacing * (measuredChildCount - 1) + } + resultHeight = maxLineHeight + paddingTop + paddingBottom + if (mItemNumberInEachLine.isNotEmpty()) { + mItemNumberInEachLine[lineIndex] = count + } + if (mWidthSumInEachLine.isNotEmpty()) { + mWidthSumInEachLine[0] = resultWidth + } + } + setMeasuredDimension(resultWidth, resultHeight) + } + + override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) { + val width = right - left + // 按照不同gravity使用不同的布局,默认是left + when (mGravity and Gravity.HORIZONTAL_GRAVITY_MASK) { + Gravity.START -> layoutWithGravityLeft(width) + Gravity.END -> layoutWithGravityRight(width) + Gravity.CENTER_HORIZONTAL -> layoutWithGravityCenterHorizontal(width) + else -> layoutWithGravityLeft(width) + } + } + + /** + * 将子View靠左布局 + */ + private fun layoutWithGravityLeft(parentWidth: Int) { + val childMaxRight = parentWidth - paddingRight + var childPositionX = paddingLeft + var childPositionY = paddingTop + var lineHeight = 0 + val childCount = childCount + val childCountToLayout = min(childCount, measuredChildCount) + for (i in 0 until childCountToLayout) { + val child = getChildAt(i) + if (child.visibility == View.GONE) { + continue + } + val childWidth = child.measuredWidth + val childHeight = child.measuredHeight + lineHeight = max(lineHeight, childHeight) + if (childPositionX + childWidth > childMaxRight) { + childPositionX = paddingLeft + childPositionY += lineHeight + mChildVerticalSpacing + lineHeight = 0 + } + child.layout( + childPositionX, + childPositionY, + childPositionX + childWidth, + childPositionY + childHeight + ) + childPositionX += childWidth + mChildHorizontalSpacing + } + + // 如果布局的子View少于childCount,则表示有一些子View不需要布局 + if (measuredChildCount < childCount) { + for (i in measuredChildCount until childCount) { + val child = getChildAt(i) + if (child.visibility == View.GONE) { + continue + } + child.layout(0, 0, 0, 0) + } + } + } + + /** + * 将子View居中布局 + */ + private fun layoutWithGravityCenterHorizontal(parentWidth: Int) { + var nextChildIndex = 0 + var nextChildPositionX: Int + var nextChildPositionY = paddingTop + var lineHeight = 0 + + // 遍历每一行 + for (i in mItemNumberInEachLine.indices) { + // 如果这一行已经没item了,则退出循环 + if (mItemNumberInEachLine[i] == 0) { + break + } + + if (nextChildIndex > measuredChildCount - 1) { + break + } + + // 遍历该行内的元素,布局每个元素 + nextChildPositionX = + (parentWidth - paddingLeft - paddingRight - mWidthSumInEachLine[i]) / 2 + paddingLeft // 子 View 的最小 x 值 + for (j in nextChildIndex until nextChildIndex + mItemNumberInEachLine[i]) { + val childView = getChildAt(j) + if (childView.visibility == View.GONE) { + continue + } + val childWidth = childView.measuredWidth + val childHeight = childView.measuredHeight + childView.layout( + nextChildPositionX, + nextChildPositionY, + nextChildPositionX + childWidth, + nextChildPositionY + childHeight + ) + lineHeight = max(lineHeight, childHeight) + nextChildPositionX += childWidth + mChildHorizontalSpacing + } + + // 一行结束了,整理一下,准备下一行 + nextChildPositionY += lineHeight + mChildVerticalSpacing + nextChildIndex += mItemNumberInEachLine[i] + lineHeight = 0 + } + + val childCount = childCount + if (measuredChildCount < childCount) { + for (i in measuredChildCount until childCount) { + val childView = getChildAt(i) + if (childView.visibility == View.GONE) { + continue + } + childView.layout(0, 0, 0, 0) + } + } + } + + /** + * 将子View靠右布局 + */ + private fun layoutWithGravityRight(parentWidth: Int) { + var nextChildIndex = 0 + var nextChildPositionX: Int + var nextChildPositionY = paddingTop + var lineHeight = 0 + + // 遍历每一行 + for (i in mItemNumberInEachLine.indices) { + // 如果这一行已经没item了,则退出循环 + if (mItemNumberInEachLine[i] == 0) { + break + } + + if (nextChildIndex > measuredChildCount - 1) { + break + } + + // 遍历该行内的元素,布局每个元素 + nextChildPositionX = + parentWidth - paddingRight - mWidthSumInEachLine[i] // 初始值为子 View 的最小 x 值 + for (j in nextChildIndex until nextChildIndex + mItemNumberInEachLine[i]) { + val childView = getChildAt(j) + if (childView.visibility == View.GONE) { + continue + } + val childWidth = childView.measuredWidth + val childHeight = childView.measuredHeight + childView.layout( + nextChildPositionX, + nextChildPositionY, + nextChildPositionX + childWidth, + nextChildPositionY + childHeight + ) + lineHeight = max(lineHeight, childHeight) + nextChildPositionX += childWidth + mChildHorizontalSpacing + } + + // 一行结束了,整理一下,准备下一行 + nextChildPositionY += lineHeight + mChildVerticalSpacing + nextChildIndex += mItemNumberInEachLine[i] + lineHeight = 0 + } + + val childCount = childCount + if (measuredChildCount < childCount) { + for (i in measuredChildCount until childCount) { + val childView = getChildAt(i) + if (childView.visibility == View.GONE) { + continue + } + childView.layout(0, 0, 0, 0) + } + } + } + + /** + * 设置子 View 的对齐方式,目前支持 [Gravity.CENTER_HORIZONTAL], [Gravity.LEFT] 和 [Gravity.RIGHT] + */ + fun setGravity(gravity: Int) { + if (mGravity != gravity) { + mGravity = gravity + requestLayout() + } + } + + fun getGravity(): Int { + return mGravity + } + + /** + * 获取最多可显示的行数 + * + * @return 没有限制时返回-1 + */ + fun getMaxLines(): Int { + return if (mMaxMode == LINES) mMaximum else -1 + } + + /** + * 设置最多可显示的行数 + * + * @param maxLines 最多可显示的行数 + */ + fun setMaxLines(maxLines: Int) { + mMaximum = maxLines + mMaxMode = LINES + requestLayout() + } + + /** + * 获取最多可显示的子View个数 + */ + fun getMaxNumber(): Int { + return if (mMaxMode == NUMBER) mMaximum else -1 + } + + /** + * 设置最多可显示的子View个数 + * + * @param maxNumber 最多可显示的子View个数 + */ + fun setMaxNumber(maxNumber: Int) { + mMaximum = maxNumber + mMaxMode = NUMBER + requestLayout() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/PrivacyDialog.kt b/app/src/main/java/com/xjjk/healthyclients/view/PrivacyDialog.kt new file mode 100644 index 0000000..0a5e63d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/PrivacyDialog.kt @@ -0,0 +1,86 @@ +package com.xjjk.healthyclients.view + +import android.app.AlertDialog +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Build +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import androidx.databinding.DataBindingUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.DialogPrivacyTextViewBinding + +open class PrivacyDialog constructor(context: Context +) : AlertDialog(context) { + lateinit var mOnAffirmClickListener: OnAffirmClickListener + protected lateinit var binding: DialogPrivacyTextViewBinding + 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(LayoutInflater.from(context), + R.layout.dialog_privacy_text_view, null, false) + setContentView(binding.root) + window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))//设置dialog背景透明 + window?.setLayout(context.resources.displayMetrics.widthPixels * 21/25, context.resources.displayMetrics.heightPixels * 21/25);//设置对话框大小 + binding.btnAffirm.setOnClickListener{ + mOnAffirmClickListener?.onAffirmClick(this@PrivacyDialog) + this.cancel() + } + binding.btnCancel.setOnClickListener{ + mOnAffirmClickListener?.onCancelClick(this@PrivacyDialog) + this.cancel() + } + + } + + fun setOnAffirmClickListener(onAffirmClickListener: OnAffirmClickListener): PrivacyDialog{ + this.mOnAffirmClickListener = onAffirmClickListener + return this + } + interface OnAffirmClickListener{ + fun onAffirmClick(viewDialog: PrivacyDialog) + fun onCancelClick(viewDialog: PrivacyDialog) + } + fun setDialogTitle(title: String, titleSize: Float = 18f): PrivacyDialog{ + binding.tvTitle.visibility = View.VISIBLE + binding.tvTitle.text = title + binding.tvTitle.textSize = titleSize + return this + } + fun setContent(text: String, textSize: Float = 13f): PrivacyDialog{ + binding.tvText.visibility = View.VISIBLE + binding.tvText.text = text + binding.tvText.textSize = textSize + return this + } + fun setContentStyle(gravity : Int): PrivacyDialog{ + binding.tvText.gravity=gravity + return this + } + fun setBtnText(text: String, btnTextSize: Float = 18f): PrivacyDialog{ + binding.btnAffirm.text = text + binding.btnAffirm.textSize = btnTextSize + return this + } + fun setCancelBtnText(text: String, btnTextSize: Float = 18f): PrivacyDialog{ + binding.btnCancel.visibility = View.VISIBLE + binding.line2.visibility = View.VISIBLE + binding.btnCancel.text = text + binding.btnCancel.textSize = btnTextSize + return this + } + + fun setDialogCancelable(flag:Boolean):PrivacyDialog{ + setCancelable(flag) + return this + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/SingleChoiceQuestionView.kt b/app/src/main/java/com/xjjk/healthyclients/view/SingleChoiceQuestionView.kt new file mode 100644 index 0000000..f0aba39 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/SingleChoiceQuestionView.kt @@ -0,0 +1,85 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.LinearLayout +import android.widget.RadioButton +import android.widget.RadioGroup +import androidx.databinding.DataBindingUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.bean.CommonSettingMenuBean +import com.xjjk.healthyclients.databinding.ViewChoiceQuestionBinding + + +class SingleChoiceQuestionView : LinearLayout { + lateinit var mBinding: ViewChoiceQuestionBinding + private val choseAnswer = arrayOf( + "A", "B", "C", + "D", "E", "F", + "G", "H", "I", + "J", "K", "L" + ) + lateinit var answerList: MutableList + private var defaultAnswer: Int = -1 + @JvmOverloads + constructor( + context: Context?, attrs: AttributeSet? = null, + defStyleAttr: Int = 0 + ) : super(context, attrs, defStyleAttr) { + if (isInEditMode) { + LayoutInflater.from(context).inflate(R.layout.view_choice_question, this, true) + } else { + mBinding = DataBindingUtil.inflate( + LayoutInflater.from(context), + R.layout.view_choice_question, + this, + true + ) + + } + } + + fun setTitle(text: CharSequence) { + mBinding.tvProblemTitle.text = text + } + fun setDefaultValue(value: String?){ + if (value.isNullOrEmpty()){ + return + } + this.defaultAnswer = value.toInt() + if(this::answerList.isInitialized){ + mBinding.rgProblemAnswer.check(value.toInt()) + } + } + fun setData(commonSettingMenuList: MutableList) { + var radioButton: RadioButton + commonSettingMenuList.forEachIndexed { index, commonSettingMenuBean -> + radioButton = LayoutInflater.from(context).inflate(R.layout.item_radiogroup_choice_question, mBinding.rgProblemAnswer, false) as RadioButton + radioButton.id = commonSettingMenuBean.value.toInt() + radioButton.text = choseAnswer[index] + " " + commonSettingMenuBean.text + mBinding.rgProblemAnswer.addView(radioButton) + } + this.answerList = commonSettingMenuList + if(defaultAnswer > 0){ + mBinding.rgProblemAnswer.check(defaultAnswer) + } + } + fun getCheckDataValue(): String?{ + if(!this::answerList.isInitialized){ + return null + } + if(answerList.isNullOrEmpty()){ + return null + } + return mBinding.rgProblemAnswer.checkedRadioButtonId.toString() + } + fun getRadioGroup(): RadioGroup{ + return mBinding.rgProblemAnswer + } + fun disableRadioGroup(disable: Boolean) { + for (i in 0 until getRadioGroup().childCount) { + getRadioGroup().getChildAt(i).isEnabled = !disable + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/SpaceItemDecoration.kt b/app/src/main/java/com/xjjk/healthyclients/view/SpaceItemDecoration.kt new file mode 100644 index 0000000..99d311e --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/SpaceItemDecoration.kt @@ -0,0 +1,118 @@ +package com.buddy.kredit.android.view + +import android.R +import android.annotation.SuppressLint +import android.content.Context +import android.graphics.Canvas +import android.graphics.Rect +import android.graphics.drawable.Drawable +import android.view.View +import androidx.annotation.DrawableRes +import androidx.annotation.FloatRange +import androidx.core.content.ContextCompat +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.OrientationHelper +import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.RecyclerView.ItemDecoration +import androidx.recyclerview.widget.StaggeredGridLayoutManager +import kotlin.math.roundToInt + +class SpaceItemDecoration : ItemDecoration { + private var mDivider: Drawable? = null + private var mSectionOffsetV = 0 + private var mSectionOffsetH = 0 + private var mDrawOver = true + private var withOffset = false + + constructor(context: Context) { + val styledAttributes = context.obtainStyledAttributes(ATTRS) + mDivider = styledAttributes.getDrawable(0) + styledAttributes.recycle() + } + + @JvmOverloads + constructor( + context: Context, @DrawableRes resId: Int, + @FloatRange(from = 0.0) sectionOffset: Float = 0f + ) : this(context, resId, sectionOffset, 0f) { + } + + @SuppressLint("ResourceType") + constructor( + context: Context, @DrawableRes resId: Int, + @FloatRange(from = 0.0) sectionOffsetV: Float, @FloatRange(from = 0.0) sectionOffsetH: Float + ) { + if (resId > 0) mDivider = ContextCompat.getDrawable(context, resId) + mSectionOffsetV = (context.resources.displayMetrics.density * sectionOffsetV).toInt() + mSectionOffsetH = (context.resources.displayMetrics.density * sectionOffsetH).toInt() + } + + fun withDrawOver(drawOver: Boolean): SpaceItemDecoration { + mDrawOver = drawOver + return this + } + + override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { + if (mDivider != null && !mDrawOver) { + draw(c, parent) + } + } + + override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { + if (mDivider != null && mDrawOver) { + draw(c, parent) + } + } + + private fun draw(c: Canvas, parent: RecyclerView) { + val left = parent.paddingLeft + val right = parent.width - parent.paddingRight + val childCount = parent.childCount + for (i in 0 until childCount -1) { + val child = parent.getChildAt(i) + val params = child.layoutParams as RecyclerView.LayoutParams + val top = child.bottom + params.bottomMargin + + child.translationY.roundToInt() + val bottom = + top + if (mDivider!!.intrinsicHeight <= 0) 1 else mDivider!!.intrinsicHeight + mDivider!!.setBounds(left, top, right, bottom) + mDivider!!.draw(c) + } + } + + fun withOffset(withOffset: Boolean): SpaceItemDecoration { + this.withOffset = withOffset + return this + } + + /** + * + */ + override fun getItemOffsets( + outRect: Rect, + view: View, + recyclerView: RecyclerView, + state: RecyclerView.State + ) { + if (getOrientation(recyclerView.layoutManager) == RecyclerView.VERTICAL) { + outRect[mSectionOffsetH, 0, mSectionOffsetH] = mSectionOffsetV + } else { + outRect[0, 0, mSectionOffsetV] = 0 + } + } + + companion object { + private val ATTRS = intArrayOf( + R.attr.listDivider + ) + + fun getOrientation(layoutManager: RecyclerView.LayoutManager?): Int { + if (layoutManager is LinearLayoutManager) { + return layoutManager.orientation + } else if (layoutManager is StaggeredGridLayoutManager) { + return layoutManager.orientation + } + return OrientationHelper.HORIZONTAL + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/StepView.kt b/app/src/main/java/com/xjjk/healthyclients/view/StepView.kt new file mode 100644 index 0000000..23ad65d --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/StepView.kt @@ -0,0 +1,227 @@ +package com.xjjk.healthyclients.view + +import android.content.Context +import android.content.res.Resources +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.Paint +import android.graphics.Path +import android.util.AttributeSet +import android.util.TypedValue +import android.view.View + + +/** + * @author nanfeifei + * @time 2023/6/26 10:14 + * @description 流程进度视图,咨询(预约单)使用 + */ +class StepView @JvmOverloads constructor( + context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 +) : View(context, attrs, defStyleAttr) { + private val minHorizontalSpace = dp2px(18f) //左右两侧保留的最小距离 + + private val circleRadius = dp2px(12f) //圆半径 + + private val circleMultiple = 1.584f //当前进度圆与正常圆的比例 + + private val lineWidth = dp2px(1.5f) + + private var mWidth = 0 + private var paddingLeft = 0 + private var paddingRight = 0 + private var paddingBottom = 0 + private var paddingTop = 0 + private var linePadding = dp2px(8f) + private var circlePaint: Paint //画圆画笔 + + private var textPaint: Paint //文字画笔 + + private var linePaint: Paint //进度线画笔 + + private var stepNum = 0 + private var currentStep = 0 //当前步骤(从0开始) + + var path = Path() //线的路径 + private var lineLeft: Float = 0f //左起点 + private var lineRight: Float = 0f //右终点 + var mY: Float = 0f //进度线和进度圆的Y坐标 + + private val lineDoneColor = Color.parseColor("#FFFFFF") + private val lineDefaultColor = Color.parseColor("#FFFFFF") + private val circleSelectBgColor = Color.parseColor("#66FFFFFF") + private val circleSelectColor = Color.parseColor("#FFFFFF") + private val circleDefaultColor = Color.parseColor("#CCFFFFFF") + private val textSelectColor = Color.parseColor("#FFFFFF") + private val textDefaultColor = Color.parseColor("#CCFFFFFF") + private val circleTextColor = Color.parseColor("#21BEBD") + private lateinit var titles: Array + + init { + //初始化进度圆画笔 + circlePaint = Paint() + circlePaint.color = circleDefaultColor + circlePaint.isAntiAlias = true + circlePaint.style = Paint.Style.FILL + + //初始化文字画笔 + textPaint = Paint() + textPaint.color = textDefaultColor + textPaint.isAntiAlias = true + textPaint.textSize = sp2px(13f).toFloat() + textPaint.textAlign = Paint.Align.CENTER + + //初始化进度线画笔 + linePaint = Paint() + linePaint.color = lineDefaultColor + linePaint.isAntiAlias = true + linePaint.style = Paint.Style.STROKE + linePaint.strokeWidth = lineWidth + + mY = circleMultiple * circleRadius + paddingTop + } + + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + val widthSize = MeasureSpec.getSize(widthMeasureSpec) + val heightSize = MeasureSpec.getSize(heightMeasureSpec) + + //左右两边要保留一定距离,否则显示不完全 + paddingLeft = getPaddingLeft().coerceAtLeast(minHorizontalSpace.toInt()) + paddingRight = getPaddingRight().coerceAtLeast(minHorizontalSpace.toInt()) + paddingBottom = getPaddingBottom() + paddingTop = getPaddingTop() + + mWidth = widthSize + //对整体View的高度控制,保证可以完整显示 + val mHeight = heightSize.toFloat().coerceAtLeast(2 * circleMultiple * circleRadius + 120) + .toInt() + paddingTop + paddingBottom + var newHeightMeasureSpec = MeasureSpec.makeMeasureSpec(mHeight, MeasureSpec.EXACTLY) + super.onMeasure(widthMeasureSpec, newHeightMeasureSpec) + } + + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + if (!this::titles.isInitialized || titles == null || titles.size === 0) { + return + } + //①圆之间的距离,用做计算后续线,圆,文字的位置 + val space = + (mWidth - stepNum * circleRadius * 2 - paddingLeft - paddingRight) / (stepNum - 1) + + //②画进度线 + for (i in 0 until stepNum -1) { //五个进度的话只需要画四条线 + linePaint.color = if (i <= currentStep) lineDoneColor else lineDefaultColor + lineLeft = + ((i + 1) * 2 * circleRadius + i * space + paddingLeft + linePadding).toFloat() + lineRight = + ((i + 1) * 2 * circleRadius + (i + 1) * space + paddingLeft - linePadding).toFloat() + if (i == currentStep){ + lineLeft += (circleMultiple - 1) * circleRadius + } + if (i == currentStep -1){ + lineRight -= (circleMultiple - 1) * circleRadius + } + path.moveTo(lineLeft, mY) + path.lineTo(lineRight, mY) + if(i == currentStep){ // 当前项的下一项的线为带折角的 + path.lineTo(lineRight - dp2px(6f), mY - dp2px(6f)) + } + canvas.drawPath(path, linePaint) + } + //③画进度圆 + var x: Float //圆心横坐标 + + for (i in 0 until stepNum) { + circlePaint.color = if (i == currentStep) circleSelectColor else circleDefaultColor + x = ((i * 2 + 1) * circleRadius + i * space).toFloat() + paddingLeft + canvas.drawCircle( + x, + mY, + circleRadius.toFloat(), + circlePaint + ) + if (i == currentStep) { + circlePaint.color = circleSelectBgColor + canvas.drawCircle( + x, + mY, + (if (i == currentStep) circleRadius * circleMultiple else circleRadius).toFloat(), + circlePaint + ) + } + } + + //④进度圆内的文字 + for (i in 0 until stepNum) { + textPaint.color = + if (i == currentStep) circleTextColor else circleTextColor //目前设计图当前进度颜色和其他进度颜色一样,所以返回的一样,这么写只是方便后续人员知道怎么改 + canvas.drawText( + if (titles[i].contains("取消")) "x" else (i + 1).toString(), + ((i * 2 + 1) * circleRadius + i * space + paddingLeft).toFloat(), mY + 13, textPaint + ) + } + + //⑤具体进度文案 + val textY = mY + circleMultiple * circleRadius + 80 + for (i in 0 until stepNum) { + textPaint.color = if (i <= currentStep) textSelectColor else textDefaultColor + canvas.drawText( + titles[i], + ((i * 2 + 1) * circleRadius + i * space + paddingLeft).toFloat(), textY, textPaint + ) + } + } + + //设置进度标题数组 + fun setTitles(titles: Array) { + this.titles = titles + stepNum = titles.size + postInvalidate() + } + + //获取总进度数 + fun getStepNum(): Int { + return stepNum + } + + //设置当前进度 + fun setCurrentStep(currentStep: Int) { + this.currentStep = currentStep + postInvalidate() + } + + //获取当前进度 + fun getCurrentStep(): Int { + return currentStep + } + + /** + * dp转px,也可以使用resources.getDimension(R.dimen.xxx).toInt() + * + * @param dpVal 要转换的dp值 + * + * @return dp转换为px后的值 + */ + fun dp2px(dpVal: Float): Float { + return TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, + dpVal, + Resources.getSystem().displayMetrics + ) + } + + /** + * sp转px + * + * @param spVal 要转换的sp值 + * + * @return sp转换为px后的值 + */ + fun sp2px(spVal: Float): Int { + return TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_SP, + spVal, + Resources.getSystem().displayMetrics + ).toInt() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/TextViewDialog.kt b/app/src/main/java/com/xjjk/healthyclients/view/TextViewDialog.kt new file mode 100644 index 0000000..5aa7d3c --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/TextViewDialog.kt @@ -0,0 +1,87 @@ +package com.xjjk.healthyclients.view + +import android.app.AlertDialog +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Build +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.widget.LinearLayout +import androidx.databinding.DataBindingUtil +import com.xjjk.healthyclients.R +import com.xjjk.healthyclients.databinding.DialogTextViewBinding + +open class TextViewDialog constructor(context: Context +) : AlertDialog(context) { + lateinit var mOnAffirmClickListener: OnAffirmClickListener + protected lateinit var binding: DialogTextViewBinding + 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(LayoutInflater.from(context), + R.layout.dialog_text_view, null, false) + setContentView(binding.root) + window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))//设置dialog背景透明 + window?.setLayout(context.resources.displayMetrics.widthPixels * 21/25, LinearLayout.LayoutParams.WRAP_CONTENT);//设置对话框大小 + binding.btnAffirm.setOnClickListener{ + mOnAffirmClickListener?.onAffirmClick(this@TextViewDialog) + this.cancel() + } + binding.btnCancel.setOnClickListener{ + mOnAffirmClickListener?.onCancelClick(this@TextViewDialog) + this.cancel() + } + + } + + fun setOnAffirmClickListener(onAffirmClickListener: OnAffirmClickListener): TextViewDialog{ + this.mOnAffirmClickListener = onAffirmClickListener + return this + } + interface OnAffirmClickListener{ + fun onAffirmClick(viewDialog: TextViewDialog) + fun onCancelClick(viewDialog: TextViewDialog) + } + fun setDialogTitle(title: String, titleSize: Float = 18f): TextViewDialog{ + binding.tvTitle.visibility = View.VISIBLE + binding.tvTitle.text = title + binding.tvTitle.textSize = titleSize + return this + } + fun setContent(text: String, textSize: Float = 13f): TextViewDialog{ + binding.tvText.visibility = View.VISIBLE + binding.tvText.text = text + binding.tvText.textSize = textSize + return this + } + fun setContentStyle(gravity : Int): TextViewDialog{ + binding.tvText.gravity=gravity + return this + } + fun setBtnText(text: String, btnTextSize: Float = 18f): TextViewDialog{ + binding.btnAffirm.text = text + binding.btnAffirm.textSize = btnTextSize + return this + } + fun setCancelBtnText(text: String, btnTextSize: Float = 18f): TextViewDialog{ + binding.btnCancel.visibility = View.VISIBLE + binding.line2.visibility = View.VISIBLE + binding.btnCancel.text = text + binding.btnCancel.textSize = btnTextSize + return this + } + + fun setDialogCancelable(flag:Boolean):TextViewDialog{ + setCancelable(flag) + return this + } +} \ No newline at end of file diff --git a/app/src/main/java/com/xjjk/healthyclients/view/WindowDialogView.java b/app/src/main/java/com/xjjk/healthyclients/view/WindowDialogView.java new file mode 100644 index 0000000..6fcf716 --- /dev/null +++ b/app/src/main/java/com/xjjk/healthyclients/view/WindowDialogView.java @@ -0,0 +1,71 @@ +package com.xjjk.healthyclients.view; + +import android.app.Dialog; +import android.content.Context; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.xjjk.healthyclients.R; +import com.xjjk.healthyclients.adapter.common.MultiItemTypeAdapter; +import com.xjjk.healthyclients.adapter.common.WindowDialogAdapter; + +import java.util.ArrayList; + +public class WindowDialogView { + + private static RecyclerView windwo_dialog_rv; + private static ArrayList mList=new ArrayList<>(); + + public static void WindowDialogView(Context context, windowDialogListener listener,ArrayList list) { + //1、使用Dialog、设置style + final Dialog dialog = new Dialog(context, R.style.DialogTheme); + //2、设置布局 + View view = View.inflate(context, R.layout.window_dialog_layout, null); + dialog.setContentView(view); + + Window window = dialog.getWindow(); + //设置弹出位置 + window.setGravity(Gravity.CENTER_VERTICAL); + //设置弹出动画 + window.setWindowAnimations(R.style.main_menu_animStyle); + //设置对话框大小 + window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + dialog.show(); + + //设置弹出位置 + window.setGravity(Gravity.BOTTOM); + + windwo_dialog_rv = dialog.findViewById(R.id.windwo_dialog_rv); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false); + windwo_dialog_rv.setLayoutManager(linearLayoutManager); + list.add("取消"); + WindowDialogAdapter windowDialogAdapter = new WindowDialogAdapter(context, R.layout.item_window_dialog, list); + windwo_dialog_rv.setAdapter(windowDialogAdapter); + windowDialogAdapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() { + @Override + public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) { + if (list.get(position).equals("取消")) { + listener.onClose(); + }else{ + listener.onSelectText(position,list.get(position)); + } + dialog.dismiss(); + } + + @Override + public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) { + return false; + } + }); + } + + public interface windowDialogListener { + void onSelectText(int position,String str); + void onClose(); + } +} diff --git a/app/src/main/res/anim/dialog_in_anim.xml b/app/src/main/res/anim/dialog_in_anim.xml new file mode 100644 index 0000000..b8e91e2 --- /dev/null +++ b/app/src/main/res/anim/dialog_in_anim.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/dialog_out_anim.xml b/app/src/main/res/anim/dialog_out_anim.xml new file mode 100644 index 0000000..2f5179e --- /dev/null +++ b/app/src/main/res/anim/dialog_out_anim.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_child_tab_etiological_result.xml b/app/src/main/res/color/color_child_tab_etiological_result.xml new file mode 100644 index 0000000..8b5accf --- /dev/null +++ b/app/src/main/res/color/color_child_tab_etiological_result.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_child_tab_layout_text.xml b/app/src/main/res/color/color_child_tab_layout_text.xml new file mode 100644 index 0000000..600934c --- /dev/null +++ b/app/src/main/res/color/color_child_tab_layout_text.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_child_tab_layout_text_home.xml b/app/src/main/res/color/color_child_tab_layout_text_home.xml new file mode 100644 index 0000000..eab7fdb --- /dev/null +++ b/app/src/main/res/color/color_child_tab_layout_text_home.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_child_tab_record_physique.xml b/app/src/main/res/color/color_child_tab_record_physique.xml new file mode 100644 index 0000000..abaf6a7 --- /dev/null +++ b/app/src/main/res/color/color_child_tab_record_physique.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_child_tab_text_item10.xml b/app/src/main/res/color/color_child_tab_text_item10.xml new file mode 100644 index 0000000..2ad3f9a --- /dev/null +++ b/app/src/main/res/color/color_child_tab_text_item10.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_child_tab_text_item12.xml b/app/src/main/res/color/color_child_tab_text_item12.xml new file mode 100644 index 0000000..d82d26f --- /dev/null +++ b/app/src/main/res/color/color_child_tab_text_item12.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_theme_or_black_33.xml b/app/src/main/res/color/color_theme_or_black_33.xml new file mode 100644 index 0000000..c030247 --- /dev/null +++ b/app/src/main/res/color/color_theme_or_black_33.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_theme_or_black_66.xml b/app/src/main/res/color/color_theme_or_black_66.xml new file mode 100644 index 0000000..10b8f16 --- /dev/null +++ b/app/src/main/res/color/color_theme_or_black_66.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xxhdpi/back.webp b/app/src/main/res/drawable-xxhdpi/back.webp new file mode 100644 index 0000000..2610356 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/back.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/bg_follow_selected.png b/app/src/main/res/drawable-xxhdpi/bg_follow_selected.png new file mode 100644 index 0000000..b69467d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/bg_follow_selected.png differ diff --git a/app/src/main/res/drawable-xxhdpi/bg_follow_unselected.png b/app/src/main/res/drawable-xxhdpi/bg_follow_unselected.png new file mode 100644 index 0000000..d61a953 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/bg_follow_unselected.png differ diff --git a/app/src/main/res/drawable-xxhdpi/bg_green_to_light_green.webp b/app/src/main/res/drawable-xxhdpi/bg_green_to_light_green.webp new file mode 100644 index 0000000..a8a8c23 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/bg_green_to_light_green.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/bg_operate_time.9.png b/app/src/main/res/drawable-xxhdpi/bg_operate_time.9.png new file mode 100644 index 0000000..50e9dab Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/bg_operate_time.9.png differ diff --git a/app/src/main/res/drawable-xxhdpi/bg_unfollow_white.webp b/app/src/main/res/drawable-xxhdpi/bg_unfollow_white.webp new file mode 100644 index 0000000..e6b2be0 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/bg_unfollow_white.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/common_filter_arrow_down.png b/app/src/main/res/drawable-xxhdpi/common_filter_arrow_down.png new file mode 100644 index 0000000..837dc50 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/common_filter_arrow_down.png differ diff --git a/app/src/main/res/drawable-xxhdpi/common_filter_arrow_up.png b/app/src/main/res/drawable-xxhdpi/common_filter_arrow_up.png new file mode 100644 index 0000000..2bfbcdf Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/common_filter_arrow_up.png differ diff --git a/app/src/main/res/drawable-xxhdpi/fragment_guidance_left.png b/app/src/main/res/drawable-xxhdpi/fragment_guidance_left.png new file mode 100644 index 0000000..1e12f7e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/fragment_guidance_left.png differ diff --git a/app/src/main/res/drawable-xxhdpi/fragment_guidance_right.png b/app/src/main/res/drawable-xxhdpi/fragment_guidance_right.png new file mode 100644 index 0000000..5afd6e4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/fragment_guidance_right.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_account_setting.png b/app/src/main/res/drawable-xxhdpi/ic_account_setting.png new file mode 100644 index 0000000..c15f624 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_account_setting.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_ade.webp b/app/src/main/res/drawable-xxhdpi/ic_ade.webp new file mode 100644 index 0000000..7836c72 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_ade.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_ambulance.webp b/app/src/main/res/drawable-xxhdpi/ic_ambulance.webp new file mode 100644 index 0000000..7816f09 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_ambulance.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_care.png b/app/src/main/res/drawable-xxhdpi/ic_care.png new file mode 100644 index 0000000..cb1eeb5 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_care.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_close.png b/app/src/main/res/drawable-xxhdpi/ic_close.png new file mode 100644 index 0000000..7798e3e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_close.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_cooperative_hospital.webp b/app/src/main/res/drawable-xxhdpi/ic_cooperative_hospital.webp new file mode 100644 index 0000000..7e19e73 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_cooperative_hospital.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_cvd_default.png b/app/src/main/res/drawable-xxhdpi/ic_cvd_default.png new file mode 100644 index 0000000..41dd944 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_cvd_default.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_cvd_edit.png b/app/src/main/res/drawable-xxhdpi/ic_cvd_edit.png new file mode 100644 index 0000000..d3afea6 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_cvd_edit.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_cvd_no_data.png b/app/src/main/res/drawable-xxhdpi/ic_cvd_no_data.png new file mode 100644 index 0000000..51f0726 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_cvd_no_data.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_default_archives_image.webp b/app/src/main/res/drawable-xxhdpi/ic_default_archives_image.webp new file mode 100644 index 0000000..055919a Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_default_archives_image.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_delete.webp b/app/src/main/res/drawable-xxhdpi/ic_delete.webp new file mode 100644 index 0000000..773a41c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_delete.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_doctor_head.png b/app/src/main/res/drawable-xxhdpi/ic_doctor_head.png new file mode 100644 index 0000000..ec3edf5 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_doctor_head.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_first_aider.webp b/app/src/main/res/drawable-xxhdpi/ic_first_aider.webp new file mode 100644 index 0000000..ab9ad54 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_first_aider.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_guidance_afoot.png b/app/src/main/res/drawable-xxhdpi/ic_guidance_afoot.png new file mode 100644 index 0000000..cc9b7f9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_guidance_afoot.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_guidance_finish.png b/app/src/main/res/drawable-xxhdpi/ic_guidance_finish.png new file mode 100644 index 0000000..d68ad77 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_guidance_finish.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_head_bg.png b/app/src/main/res/drawable-xxhdpi/ic_head_bg.png new file mode 100644 index 0000000..ba03f4c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_head_bg.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_im_image_default.png b/app/src/main/res/drawable-xxhdpi/ic_im_image_default.png new file mode 100644 index 0000000..eb3e822 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_im_image_default.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_local.png b/app/src/main/res/drawable-xxhdpi/ic_local.png new file mode 100644 index 0000000..3863ca7 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_local.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_marital_state_no_select.png b/app/src/main/res/drawable-xxhdpi/ic_marital_state_no_select.png new file mode 100644 index 0000000..6a821f4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_marital_state_no_select.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_marital_state_select.png b/app/src/main/res/drawable-xxhdpi/ic_marital_state_select.png new file mode 100644 index 0000000..8d03df7 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_marital_state_select.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_masculino.png b/app/src/main/res/drawable-xxhdpi/ic_masculino.png new file mode 100644 index 0000000..68bb06f Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_masculino.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_medical_point.webp b/app/src/main/res/drawable-xxhdpi/ic_medical_point.webp new file mode 100644 index 0000000..79669be Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_medical_point.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_message_empty.png b/app/src/main/res/drawable-xxhdpi/ic_message_empty.png new file mode 100644 index 0000000..4d228ae Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_message_empty.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_mulher.png b/app/src/main/res/drawable-xxhdpi/ic_mulher.png new file mode 100644 index 0000000..a316e7c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_mulher.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_my_location.png b/app/src/main/res/drawable-xxhdpi/ic_my_location.png new file mode 100644 index 0000000..537a124 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_my_location.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_my_location_red.webp b/app/src/main/res/drawable-xxhdpi/ic_my_location_red.webp new file mode 100644 index 0000000..04a2805 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_my_location_red.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_oil_hospital.webp b/app/src/main/res/drawable-xxhdpi/ic_oil_hospital.webp new file mode 100644 index 0000000..8343ae4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_oil_hospital.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_order_success.png b/app/src/main/res/drawable-xxhdpi/ic_order_success.png new file mode 100644 index 0000000..6b0bb10 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_order_success.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_red_star.png b/app/src/main/res/drawable-xxhdpi/ic_red_star.png new file mode 100644 index 0000000..15e5834 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_red_star.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_selected.webp b/app/src/main/res/drawable-xxhdpi/ic_selected.webp new file mode 100644 index 0000000..b5c7e70 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_selected.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_star.webp b/app/src/main/res/drawable-xxhdpi/ic_star.webp new file mode 100644 index 0000000..aa8b576 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_star.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_type_image.png b/app/src/main/res/drawable-xxhdpi/ic_type_image.png new file mode 100644 index 0000000..835f719 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_type_image.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_type_video.png b/app/src/main/res/drawable-xxhdpi/ic_type_video.png new file mode 100644 index 0000000..6aa6287 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_type_video.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_unselected.webp b/app/src/main/res/drawable-xxhdpi/ic_unselected.webp new file mode 100644 index 0000000..1e02441 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_unselected.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_user_app_setting.png b/app/src/main/res/drawable-xxhdpi/ic_user_app_setting.png new file mode 100644 index 0000000..b7304ef Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_user_app_setting.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_user_info_setting.png b/app/src/main/res/drawable-xxhdpi/ic_user_info_setting.png new file mode 100644 index 0000000..ed1ed4c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_user_info_setting.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_user_menu_more.png b/app/src/main/res/drawable-xxhdpi/ic_user_menu_more.png new file mode 100644 index 0000000..c692a3d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_user_menu_more.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_user_order_afoot.png b/app/src/main/res/drawable-xxhdpi/ic_user_order_afoot.png new file mode 100644 index 0000000..36f5915 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_user_order_afoot.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_user_order_history.png b/app/src/main/res/drawable-xxhdpi/ic_user_order_history.png new file mode 100644 index 0000000..8e8a444 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_user_order_history.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_user_order_rated.png b/app/src/main/res/drawable-xxhdpi/ic_user_order_rated.png new file mode 100644 index 0000000..9c26b83 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_user_order_rated.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_user_order_wait_rate.png b/app/src/main/res/drawable-xxhdpi/ic_user_order_wait_rate.png new file mode 100644 index 0000000..f72ab5a Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_user_order_wait_rate.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_user_personnel_manager.png b/app/src/main/res/drawable-xxhdpi/ic_user_personnel_manager.png new file mode 100644 index 0000000..660c79e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_user_personnel_manager.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_user_sos.png b/app/src/main/res/drawable-xxhdpi/ic_user_sos.png new file mode 100644 index 0000000..4acbd8d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_user_sos.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_appointment_cancel.webp b/app/src/main/res/drawable-xxhdpi/icon_appointment_cancel.webp new file mode 100644 index 0000000..a27f7ec Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_appointment_cancel.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_appointment_success.webp b/app/src/main/res/drawable-xxhdpi/icon_appointment_success.webp new file mode 100644 index 0000000..42458ab Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_appointment_success.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_back.png b/app/src/main/res/drawable-xxhdpi/icon_back.png new file mode 100644 index 0000000..d6f38b4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_back.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_cardiovascular.png b/app/src/main/res/drawable-xxhdpi/icon_cardiovascular.png new file mode 100644 index 0000000..245c1d4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_cardiovascular.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_consult_info.webp b/app/src/main/res/drawable-xxhdpi/icon_consult_info.webp new file mode 100644 index 0000000..d7d74ac Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_consult_info.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_consultant_manager_edit.webp b/app/src/main/res/drawable-xxhdpi/icon_consultant_manager_edit.webp new file mode 100644 index 0000000..e3e2829 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_consultant_manager_edit.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_cvd_heart_rate.png b/app/src/main/res/drawable-xxhdpi/icon_cvd_heart_rate.png new file mode 100644 index 0000000..34a1dba Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_cvd_heart_rate.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_cvd_pressure.png b/app/src/main/res/drawable-xxhdpi/icon_cvd_pressure.png new file mode 100644 index 0000000..bb6ce63 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_cvd_pressure.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_cvd_right_arrow.png b/app/src/main/res/drawable-xxhdpi/icon_cvd_right_arrow.png new file mode 100644 index 0000000..1e79d28 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_cvd_right_arrow.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_cvd_sleep.png b/app/src/main/res/drawable-xxhdpi/icon_cvd_sleep.png new file mode 100644 index 0000000..4768e8f Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_cvd_sleep.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_cvd_spo.png b/app/src/main/res/drawable-xxhdpi/icon_cvd_spo.png new file mode 100644 index 0000000..9d105d6 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_cvd_spo.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_cvd_step.png b/app/src/main/res/drawable-xxhdpi/icon_cvd_step.png new file mode 100644 index 0000000..6fa2f58 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_cvd_step.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_cvd_temperature.png b/app/src/main/res/drawable-xxhdpi/icon_cvd_temperature.png new file mode 100644 index 0000000..7e69440 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_cvd_temperature.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_doctor_homepage_image.png b/app/src/main/res/drawable-xxhdpi/icon_doctor_homepage_image.png new file mode 100644 index 0000000..ad64f59 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_doctor_homepage_image.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_doctor_homepage_phone.png b/app/src/main/res/drawable-xxhdpi/icon_doctor_homepage_phone.png new file mode 100644 index 0000000..791b81d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_doctor_homepage_phone.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_doctor_homepage_video.png b/app/src/main/res/drawable-xxhdpi/icon_doctor_homepage_video.png new file mode 100644 index 0000000..d0eee17 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_doctor_homepage_video.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_follow.png b/app/src/main/res/drawable-xxhdpi/icon_follow.png new file mode 100644 index 0000000..c6eab8e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_follow.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_image_add.webp b/app/src/main/res/drawable-xxhdpi/icon_image_add.webp new file mode 100644 index 0000000..616d8ca Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_image_add.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_man.webp b/app/src/main/res/drawable-xxhdpi/icon_man.webp new file mode 100644 index 0000000..8ba9ab8 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_man.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_next_day.png b/app/src/main/res/drawable-xxhdpi/icon_next_day.png new file mode 100644 index 0000000..907daa9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_next_day.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_previous_day.png b/app/src/main/res/drawable-xxhdpi/icon_previous_day.png new file mode 100644 index 0000000..1a70396 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_previous_day.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_rating_bar_check.png b/app/src/main/res/drawable-xxhdpi/icon_rating_bar_check.png new file mode 100644 index 0000000..c48721e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_rating_bar_check.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_rating_bar_cut.png b/app/src/main/res/drawable-xxhdpi/icon_rating_bar_cut.png new file mode 100644 index 0000000..0f3abe9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_rating_bar_cut.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_rating_bar_uncheck.png b/app/src/main/res/drawable-xxhdpi/icon_rating_bar_uncheck.png new file mode 100644 index 0000000..0b51b2b Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_rating_bar_uncheck.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_reply.png b/app/src/main/res/drawable-xxhdpi/icon_reply.png new file mode 100644 index 0000000..2204938 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_reply.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_serve.png b/app/src/main/res/drawable-xxhdpi/icon_serve.png new file mode 100644 index 0000000..9efabdf Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_serve.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_small_next_white.png b/app/src/main/res/drawable-xxhdpi/icon_small_next_white.png new file mode 100644 index 0000000..d65fd1c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_small_next_white.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_woman.webp b/app/src/main/res/drawable-xxhdpi/icon_woman.webp new file mode 100644 index 0000000..cfdd4b4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_woman.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/image_default_empty.webp b/app/src/main/res/drawable-xxhdpi/image_default_empty.webp new file mode 100644 index 0000000..6ec8570 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/image_default_empty.webp differ diff --git a/app/src/main/res/drawable-xxhdpi/img_cvd_sleep.png b/app/src/main/res/drawable-xxhdpi/img_cvd_sleep.png new file mode 100644 index 0000000..eeee461 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/img_cvd_sleep.png differ diff --git a/app/src/main/res/drawable-xxhdpi/img_cvd_step.png b/app/src/main/res/drawable-xxhdpi/img_cvd_step.png new file mode 100644 index 0000000..1814cee Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/img_cvd_step.png differ diff --git a/app/src/main/res/drawable-xxhdpi/main_home_tab_emergency_normal.jpg b/app/src/main/res/drawable-xxhdpi/main_home_tab_emergency_normal.jpg new file mode 100644 index 0000000..1d5bf7b Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/main_home_tab_emergency_normal.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/main_home_tab_emergency_selected.jpg b/app/src/main/res/drawable-xxhdpi/main_home_tab_emergency_selected.jpg new file mode 100644 index 0000000..bad3f73 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/main_home_tab_emergency_selected.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/main_home_tab_index_normal.jpg b/app/src/main/res/drawable-xxhdpi/main_home_tab_index_normal.jpg new file mode 100644 index 0000000..f631ea5 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/main_home_tab_index_normal.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/main_home_tab_index_selected.jpg b/app/src/main/res/drawable-xxhdpi/main_home_tab_index_selected.jpg new file mode 100644 index 0000000..a55aaed Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/main_home_tab_index_selected.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/main_home_tab_monitor_normal.jpg b/app/src/main/res/drawable-xxhdpi/main_home_tab_monitor_normal.jpg new file mode 100644 index 0000000..9773071 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/main_home_tab_monitor_normal.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/main_home_tab_monitor_selected.jpg b/app/src/main/res/drawable-xxhdpi/main_home_tab_monitor_selected.jpg new file mode 100644 index 0000000..4d29730 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/main_home_tab_monitor_selected.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/main_home_tab_my_normal.jpg b/app/src/main/res/drawable-xxhdpi/main_home_tab_my_normal.jpg new file mode 100644 index 0000000..5aafd3b Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/main_home_tab_my_normal.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/main_home_tab_my_selected.jpg b/app/src/main/res/drawable-xxhdpi/main_home_tab_my_selected.jpg new file mode 100644 index 0000000..0b8fb38 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/main_home_tab_my_selected.jpg differ diff --git a/app/src/main/res/drawable/bg_10_grey_background_shap_radius10.xml b/app/src/main/res/drawable/bg_10_grey_background_shap_radius10.xml new file mode 100644 index 0000000..08bf9d3 --- /dev/null +++ b/app/src/main/res/drawable/bg_10_grey_background_shap_radius10.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_60_blue_background_shap_radius4.xml b/app/src/main/res/drawable/bg_60_blue_background_shap_radius4.xml new file mode 100644 index 0000000..d0c11a2 --- /dev/null +++ b/app/src/main/res/drawable/bg_60_blue_background_shap_radius4.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_action_grey_radius5.xml b/app/src/main/res/drawable/bg_action_grey_radius5.xml new file mode 100644 index 0000000..06d3521 --- /dev/null +++ b/app/src/main/res/drawable/bg_action_grey_radius5.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_appointment_time_item.xml b/app/src/main/res/drawable/bg_appointment_time_item.xml new file mode 100644 index 0000000..fdfa1ff --- /dev/null +++ b/app/src/main/res/drawable/bg_appointment_time_item.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_black_to_white.xml b/app/src/main/res/drawable/bg_black_to_white.xml new file mode 100644 index 0000000..bc32e62 --- /dev/null +++ b/app/src/main/res/drawable/bg_black_to_white.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_blue_background_shap.xml b/app/src/main/res/drawable/bg_blue_background_shap.xml new file mode 100644 index 0000000..4aac120 --- /dev/null +++ b/app/src/main/res/drawable/bg_blue_background_shap.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_blue_background_shap_radius4.xml b/app/src/main/res/drawable/bg_blue_background_shap_radius4.xml new file mode 100644 index 0000000..d75d442 --- /dev/null +++ b/app/src/main/res/drawable/bg_blue_background_shap_radius4.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_bottom_radius_card.xml b/app/src/main/res/drawable/bg_bottom_radius_card.xml new file mode 100644 index 0000000..392d380 --- /dev/null +++ b/app/src/main/res/drawable/bg_bottom_radius_card.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_card.xml b/app/src/main/res/drawable/bg_card.xml new file mode 100644 index 0000000..8af8bb4 --- /dev/null +++ b/app/src/main/res/drawable/bg_card.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_child_tab_layout_item.xml b/app/src/main/res/drawable/bg_child_tab_layout_item.xml new file mode 100644 index 0000000..6508d03 --- /dev/null +++ b/app/src/main/res/drawable/bg_child_tab_layout_item.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_child_tab_layout_item2.xml b/app/src/main/res/drawable/bg_child_tab_layout_item2.xml new file mode 100644 index 0000000..65985c7 --- /dev/null +++ b/app/src/main/res/drawable/bg_child_tab_layout_item2.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_child_tab_layout_item_home.xml b/app/src/main/res/drawable/bg_child_tab_layout_item_home.xml new file mode 100644 index 0000000..3528d06 --- /dev/null +++ b/app/src/main/res/drawable/bg_child_tab_layout_item_home.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_cvd_main_blue.xml b/app/src/main/res/drawable/bg_cvd_main_blue.xml new file mode 100644 index 0000000..5f0cf06 --- /dev/null +++ b/app/src/main/res/drawable/bg_cvd_main_blue.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_cvd_main_red.xml b/app/src/main/res/drawable/bg_cvd_main_red.xml new file mode 100644 index 0000000..ae3bd56 --- /dev/null +++ b/app/src/main/res/drawable/bg_cvd_main_red.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_cvd_main_yellow.xml b/app/src/main/res/drawable/bg_cvd_main_yellow.xml new file mode 100644 index 0000000..db16c70 --- /dev/null +++ b/app/src/main/res/drawable/bg_cvd_main_yellow.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_cvd_threshold_text.xml b/app/src/main/res/drawable/bg_cvd_threshold_text.xml new file mode 100644 index 0000000..4513ab1 --- /dev/null +++ b/app/src/main/res/drawable/bg_cvd_threshold_text.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_cvd_warning_history.xml b/app/src/main/res/drawable/bg_cvd_warning_history.xml new file mode 100644 index 0000000..521035f --- /dev/null +++ b/app/src/main/res/drawable/bg_cvd_warning_history.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_cvd_warning_text.xml b/app/src/main/res/drawable/bg_cvd_warning_text.xml new file mode 100644 index 0000000..f9878bf --- /dev/null +++ b/app/src/main/res/drawable/bg_cvd_warning_text.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_follow_selector.xml b/app/src/main/res/drawable/bg_follow_selector.xml new file mode 100644 index 0000000..c4b48af --- /dev/null +++ b/app/src/main/res/drawable/bg_follow_selector.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/drawable/bg_follow_selector_white.xml b/app/src/main/res/drawable/bg_follow_selector_white.xml new file mode 100644 index 0000000..2a3d3b8 --- /dev/null +++ b/app/src/main/res/drawable/bg_follow_selector_white.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/app/src/main/res/drawable/bg_food_date_background.xml b/app/src/main/res/drawable/bg_food_date_background.xml new file mode 100644 index 0000000..17e7dd5 --- /dev/null +++ b/app/src/main/res/drawable/bg_food_date_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_food_white_background.xml b/app/src/main/res/drawable/bg_food_white_background.xml new file mode 100644 index 0000000..bac7229 --- /dev/null +++ b/app/src/main/res/drawable/bg_food_white_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_frame.xml b/app/src/main/res/drawable/bg_frame.xml new file mode 100644 index 0000000..7f9ad4a --- /dev/null +++ b/app/src/main/res/drawable/bg_frame.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_frame_blue.xml b/app/src/main/res/drawable/bg_frame_blue.xml new file mode 100644 index 0000000..c779586 --- /dev/null +++ b/app/src/main/res/drawable/bg_frame_blue.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_frame_blue_radius17.xml b/app/src/main/res/drawable/bg_frame_blue_radius17.xml new file mode 100644 index 0000000..19bea7c --- /dev/null +++ b/app/src/main/res/drawable/bg_frame_blue_radius17.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_frame_line2.xml b/app/src/main/res/drawable/bg_frame_line2.xml new file mode 100644 index 0000000..eece7f5 --- /dev/null +++ b/app/src/main/res/drawable/bg_frame_line2.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_grey.xml b/app/src/main/res/drawable/bg_grey.xml new file mode 100644 index 0000000..09393cd --- /dev/null +++ b/app/src/main/res/drawable/bg_grey.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_grey_background_shap.xml b/app/src/main/res/drawable/bg_grey_background_shap.xml new file mode 100644 index 0000000..3cead11 --- /dev/null +++ b/app/src/main/res/drawable/bg_grey_background_shap.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_grey_background_shap_radius23.xml b/app/src/main/res/drawable/bg_grey_background_shap_radius23.xml new file mode 100644 index 0000000..2dacbb0 --- /dev/null +++ b/app/src/main/res/drawable/bg_grey_background_shap_radius23.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_login_green_to_white.xml b/app/src/main/res/drawable/bg_login_green_to_white.xml new file mode 100644 index 0000000..065a10f --- /dev/null +++ b/app/src/main/res/drawable/bg_login_green_to_white.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_question_radiobutton.xml b/app/src/main/res/drawable/bg_question_radiobutton.xml new file mode 100644 index 0000000..d957217 --- /dev/null +++ b/app/src/main/res/drawable/bg_question_radiobutton.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_red_button.xml b/app/src/main/res/drawable/bg_red_button.xml new file mode 100644 index 0000000..d384280 --- /dev/null +++ b/app/src/main/res/drawable/bg_red_button.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_red_round.xml b/app/src/main/res/drawable/bg_red_round.xml new file mode 100644 index 0000000..f9f9129 --- /dev/null +++ b/app/src/main/res/drawable/bg_red_round.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_search_shap_radius23.xml b/app/src/main/res/drawable/bg_search_shap_radius23.xml new file mode 100644 index 0000000..cb2dd53 --- /dev/null +++ b/app/src/main/res/drawable/bg_search_shap_radius23.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_stop_service.xml b/app/src/main/res/drawable/bg_stop_service.xml new file mode 100644 index 0000000..766e698 --- /dev/null +++ b/app/src/main/res/drawable/bg_stop_service.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_white_background_shap.xml b/app/src/main/res/drawable/bg_white_background_shap.xml new file mode 100644 index 0000000..683f50d --- /dev/null +++ b/app/src/main/res/drawable/bg_white_background_shap.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_white_background_shap_radius12.xml b/app/src/main/res/drawable/bg_white_background_shap_radius12.xml new file mode 100644 index 0000000..bf13608 --- /dev/null +++ b/app/src/main/res/drawable/bg_white_background_shap_radius12.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_white_background_shap_radius14.xml b/app/src/main/res/drawable/bg_white_background_shap_radius14.xml new file mode 100644 index 0000000..389b2c2 --- /dev/null +++ b/app/src/main/res/drawable/bg_white_background_shap_radius14.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_white_bottom_right_angle_background_shap.xml b/app/src/main/res/drawable/bg_white_bottom_right_angle_background_shap.xml new file mode 100644 index 0000000..6d4b693 --- /dev/null +++ b/app/src/main/res/drawable/bg_white_bottom_right_angle_background_shap.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_white_bottom_right_angle_background_shap20.xml b/app/src/main/res/drawable/bg_white_bottom_right_angle_background_shap20.xml new file mode 100644 index 0000000..aeb3304 --- /dev/null +++ b/app/src/main/res/drawable/bg_white_bottom_right_angle_background_shap20.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_white_line.xml b/app/src/main/res/drawable/bg_white_line.xml new file mode 100644 index 0000000..8e23cf7 --- /dev/null +++ b/app/src/main/res/drawable/bg_white_line.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bottom_tab_red_point_bg.xml b/app/src/main/res/drawable/bottom_tab_red_point_bg.xml new file mode 100644 index 0000000..04d28a6 --- /dev/null +++ b/app/src/main/res/drawable/bottom_tab_red_point_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/chat_im_bg.xml b/app/src/main/res/drawable/chat_im_bg.xml new file mode 100644 index 0000000..f550886 --- /dev/null +++ b/app/src/main/res/drawable/chat_im_bg.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/check_theme_style.xml b/app/src/main/res/drawable/check_theme_style.xml new file mode 100644 index 0000000..a4ca0f6 --- /dev/null +++ b/app/src/main/res/drawable/check_theme_style.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/decoration_item_gray.xml b/app/src/main/res/drawable/decoration_item_gray.xml new file mode 100644 index 0000000..0f4d4d1 --- /dev/null +++ b/app/src/main/res/drawable/decoration_item_gray.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/demo_overseas_main_tab_contact_normal_bg.png b/app/src/main/res/drawable/demo_overseas_main_tab_contact_normal_bg.png new file mode 100644 index 0000000..5b1029a Binary files /dev/null and b/app/src/main/res/drawable/demo_overseas_main_tab_contact_normal_bg.png differ diff --git a/app/src/main/res/drawable/demo_overseas_main_tab_contact_selected_bg.png b/app/src/main/res/drawable/demo_overseas_main_tab_contact_selected_bg.png new file mode 100644 index 0000000..621d0ee Binary files /dev/null and b/app/src/main/res/drawable/demo_overseas_main_tab_contact_selected_bg.png differ diff --git a/app/src/main/res/drawable/demo_overseas_main_tab_conversation_normal.png b/app/src/main/res/drawable/demo_overseas_main_tab_conversation_normal.png new file mode 100644 index 0000000..94277f6 Binary files /dev/null and b/app/src/main/res/drawable/demo_overseas_main_tab_conversation_normal.png differ diff --git a/app/src/main/res/drawable/demo_overseas_main_tab_conversation_selected.png b/app/src/main/res/drawable/demo_overseas_main_tab_conversation_selected.png new file mode 100644 index 0000000..179d6a0 Binary files /dev/null and b/app/src/main/res/drawable/demo_overseas_main_tab_conversation_selected.png differ diff --git a/app/src/main/res/drawable/demo_overseas_main_tab_settings_normal_bg.png b/app/src/main/res/drawable/demo_overseas_main_tab_settings_normal_bg.png new file mode 100644 index 0000000..6efc7ee Binary files /dev/null and b/app/src/main/res/drawable/demo_overseas_main_tab_settings_normal_bg.png differ diff --git a/app/src/main/res/drawable/demo_overseas_main_tab_settings_selected_bg.png b/app/src/main/res/drawable/demo_overseas_main_tab_settings_selected_bg.png new file mode 100644 index 0000000..a43e608 Binary files /dev/null and b/app/src/main/res/drawable/demo_overseas_main_tab_settings_selected_bg.png differ diff --git a/app/src/main/res/drawable/ic_department_default.png b/app/src/main/res/drawable/ic_department_default.png new file mode 100644 index 0000000..d700e6d Binary files /dev/null and b/app/src/main/res/drawable/ic_department_default.png differ diff --git a/app/src/main/res/drawable/ic_emergency_120.9.png b/app/src/main/res/drawable/ic_emergency_120.9.png new file mode 100644 index 0000000..c472ce4 Binary files /dev/null and b/app/src/main/res/drawable/ic_emergency_120.9.png differ diff --git a/app/src/main/res/drawable/ic_emergency_seek_doctor.9.png b/app/src/main/res/drawable/ic_emergency_seek_doctor.9.png new file mode 100644 index 0000000..a39fd87 Binary files /dev/null and b/app/src/main/res/drawable/ic_emergency_seek_doctor.9.png differ diff --git a/app/src/main/res/drawable/ic_fragment_emergency_navigation.9.png b/app/src/main/res/drawable/ic_fragment_emergency_navigation.9.png new file mode 100644 index 0000000..c43f0cf Binary files /dev/null and b/app/src/main/res/drawable/ic_fragment_emergency_navigation.9.png differ diff --git a/app/src/main/res/drawable/ic_fragment_emergency_phone.9.png b/app/src/main/res/drawable/ic_fragment_emergency_phone.9.png new file mode 100644 index 0000000..29f8512 Binary files /dev/null and b/app/src/main/res/drawable/ic_fragment_emergency_phone.9.png differ diff --git a/app/src/main/res/drawable/ic_guidance_head_bg.png b/app/src/main/res/drawable/ic_guidance_head_bg.png new file mode 100644 index 0000000..3b8fea3 Binary files /dev/null and b/app/src/main/res/drawable/ic_guidance_head_bg.png differ diff --git a/app/src/main/res/drawable/ic_guidance_title.png b/app/src/main/res/drawable/ic_guidance_title.png new file mode 100644 index 0000000..712d18c Binary files /dev/null and b/app/src/main/res/drawable/ic_guidance_title.png differ diff --git a/app/src/main/res/drawable/ic_hospital_default.png b/app/src/main/res/drawable/ic_hospital_default.png new file mode 100644 index 0000000..5bd0b65 Binary files /dev/null and b/app/src/main/res/drawable/ic_hospital_default.png differ diff --git a/app/src/main/res/drawable/ic_hot.png b/app/src/main/res/drawable/ic_hot.png new file mode 100644 index 0000000..08893cd Binary files /dev/null and b/app/src/main/res/drawable/ic_hot.png differ diff --git a/app/src/main/res/drawable/ic_icon.png b/app/src/main/res/drawable/ic_icon.png new file mode 100644 index 0000000..fc1d996 Binary files /dev/null and b/app/src/main/res/drawable/ic_icon.png differ diff --git a/app/src/main/res/drawable/ic_login_bg.png b/app/src/main/res/drawable/ic_login_bg.png new file mode 100644 index 0000000..80e2c4a Binary files /dev/null and b/app/src/main/res/drawable/ic_login_bg.png differ diff --git a/app/src/main/res/drawable/ic_login_green_select.png b/app/src/main/res/drawable/ic_login_green_select.png new file mode 100644 index 0000000..836b81c Binary files /dev/null and b/app/src/main/res/drawable/ic_login_green_select.png differ diff --git a/app/src/main/res/drawable/ic_login_name.png b/app/src/main/res/drawable/ic_login_name.png new file mode 100644 index 0000000..67e9ed9 Binary files /dev/null and b/app/src/main/res/drawable/ic_login_name.png differ diff --git a/app/src/main/res/drawable/ic_login_no_select.png b/app/src/main/res/drawable/ic_login_no_select.png new file mode 100644 index 0000000..6a821f4 Binary files /dev/null and b/app/src/main/res/drawable/ic_login_no_select.png differ diff --git a/app/src/main/res/drawable/icon_follow_selector.xml b/app/src/main/res/drawable/icon_follow_selector.xml new file mode 100644 index 0000000..d0cc96e --- /dev/null +++ b/app/src/main/res/drawable/icon_follow_selector.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/intervene_ic_default2.png b/app/src/main/res/drawable/intervene_ic_default2.png new file mode 100644 index 0000000..2e679b7 Binary files /dev/null and b/app/src/main/res/drawable/intervene_ic_default2.png differ diff --git a/app/src/main/res/drawable/radio_button_style.xml b/app/src/main/res/drawable/radio_button_style.xml new file mode 100644 index 0000000..d9e907a --- /dev/null +++ b/app/src/main/res/drawable/radio_button_style.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_green_left_stroke_dark_green.xml b/app/src/main/res/drawable/rectangle_green_left_stroke_dark_green.xml new file mode 100644 index 0000000..efe5895 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_green_left_stroke_dark_green.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_green_left_stroke_dark_green_transparent.xml b/app/src/main/res/drawable/rectangle_green_left_stroke_dark_green_transparent.xml new file mode 100644 index 0000000..8302537 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_green_left_stroke_dark_green_transparent.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_grey_left_stroke_dark_grey.xml b/app/src/main/res/drawable/rectangle_grey_left_stroke_dark_grey.xml new file mode 100644 index 0000000..45dfa94 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_grey_left_stroke_dark_grey.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_bottom_corner10_white.xml b/app/src/main/res/drawable/rectangle_round_bottom_corner10_white.xml new file mode 100644 index 0000000..0bd2885 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_bottom_corner10_white.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_corner10_dark_gray.xml b/app/src/main/res/drawable/rectangle_round_corner10_dark_gray.xml new file mode 100644 index 0000000..12b4590 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_corner10_dark_gray.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_corner10_gray.xml b/app/src/main/res/drawable/rectangle_round_corner10_gray.xml new file mode 100644 index 0000000..770377e --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_corner10_gray.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_corner10_gray_stroke_transparent.xml b/app/src/main/res/drawable/rectangle_round_corner10_gray_stroke_transparent.xml new file mode 100644 index 0000000..6cedea1 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_corner10_gray_stroke_transparent.xml @@ -0,0 +1,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_corner10_theme.xml b/app/src/main/res/drawable/rectangle_round_corner10_theme.xml new file mode 100644 index 0000000..e1bb02a --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_corner10_theme.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_corner10_white.xml b/app/src/main/res/drawable/rectangle_round_corner10_white.xml new file mode 100644 index 0000000..9da1a53 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_corner10_white.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_corner20_gray_stroke_transparent.xml b/app/src/main/res/drawable/rectangle_round_corner20_gray_stroke_transparent.xml new file mode 100644 index 0000000..19ae9f7 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_corner20_gray_stroke_transparent.xml @@ -0,0 +1,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_corner20_theme_stroke_white.xml b/app/src/main/res/drawable/rectangle_round_corner20_theme_stroke_white.xml new file mode 100644 index 0000000..730b619 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_corner20_theme_stroke_white.xml @@ -0,0 +1,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_corner5_gray_stroke_transparent.xml b/app/src/main/res/drawable/rectangle_round_corner5_gray_stroke_transparent.xml new file mode 100644 index 0000000..a49472b --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_corner5_gray_stroke_transparent.xml @@ -0,0 +1,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_corner5_white.xml b/app/src/main/res/drawable/rectangle_round_corner5_white.xml new file mode 100644 index 0000000..eace958 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_corner5_white.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_top_corner8_white.xml b/app/src/main/res/drawable/rectangle_round_top_corner8_white.xml new file mode 100644 index 0000000..f5e6de1 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_top_corner8_white.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_round_top_left_corner8_white.xml b/app/src/main/res/drawable/rectangle_round_top_left_corner8_white.xml new file mode 100644 index 0000000..3e059fe --- /dev/null +++ b/app/src/main/res/drawable/rectangle_round_top_left_corner8_white.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_size0_transparent_color.xml b/app/src/main/res/drawable/rectangle_size0_transparent_color.xml new file mode 100644 index 0000000..e62ffe7 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_size0_transparent_color.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rectangle_top_round_corner20_white.xml b/app/src/main/res/drawable/rectangle_top_round_corner20_white.xml new file mode 100644 index 0000000..d17db0f --- /dev/null +++ b/app/src/main/res/drawable/rectangle_top_round_corner20_white.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/red_oval.xml b/app/src/main/res/drawable/red_oval.xml new file mode 100644 index 0000000..bd7ac31 --- /dev/null +++ b/app/src/main/res/drawable/red_oval.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/app/src/main/res/drawable/shape_tab_indicator.xml b/app/src/main/res/drawable/shape_tab_indicator.xml new file mode 100644 index 0000000..d208b9b --- /dev/null +++ b/app/src/main/res/drawable/shape_tab_indicator.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_appointment_cancel.xml b/app/src/main/res/layout/activity_appointment_cancel.xml new file mode 100644 index 0000000..1e8759a --- /dev/null +++ b/app/src/main/res/layout/activity_appointment_cancel.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_appointment_detail.xml b/app/src/main/res/layout/activity_appointment_detail.xml new file mode 100644 index 0000000..86d67e5 --- /dev/null +++ b/app/src/main/res/layout/activity_appointment_detail.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + +