|
|
@@ -10,10 +10,8 @@ import androidx.recyclerview.widget.GridLayoutManager
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
|
import com.bumptech.glide.Glide
|
|
|
-import com.tencent.imsdk.v2.V2TIMAdvancedMsgListener
|
|
|
-import com.tencent.imsdk.v2.V2TIMCallback
|
|
|
-import com.tencent.imsdk.v2.V2TIMManager
|
|
|
-import com.tencent.imsdk.v2.V2TIMMessage
|
|
|
+import com.tencent.imsdk.v2.*
|
|
|
+import com.tencent.qcloud.tuikit.tuichat.bean.message.PatientStartConsultationBean
|
|
|
import com.yingyang.home.R
|
|
|
import com.yingyang.home.databinding.ActivityHomeBinding
|
|
|
import com.yingyangfly.baselib.bean.MessageBean
|
|
|
@@ -37,6 +35,7 @@ import com.yingyangfly.home.component.ShowPlayPorpoiseViewComponent
|
|
|
import com.yingyangfly.home.component.ShowProfessionalEvaluationViewComponent
|
|
|
import com.yingyangfly.home.dialog.DownLoadAppFragment
|
|
|
import com.yingyangfly.home.utils.AnimUtil
|
|
|
+import gorden.rxbus2.RxBus
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -675,7 +674,7 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(),
|
|
|
val messageBean = GsonUtil.GsonToBean(data, MessageBean::class.java)
|
|
|
Log.e(
|
|
|
"wpp1",
|
|
|
- "messageBean-----------------------> " + messageBean
|
|
|
+ "messageBean-----------------------> $messageBean"
|
|
|
)
|
|
|
if (messageBean != null) {
|
|
|
messageBean.sender = if (TextUtils.isEmpty(msg.sender)) {
|
|
|
@@ -689,7 +688,7 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(),
|
|
|
}
|
|
|
Log.e(
|
|
|
"wpp9",
|
|
|
- "messageBean.timestamp-----------------------> " + messageBean
|
|
|
+ "messageBean.timestamp-----------------------> $messageBean"
|
|
|
)
|
|
|
when (messageBean.businessID) {
|
|
|
"A" -> {
|
|
|
@@ -718,14 +717,16 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(),
|
|
|
}
|
|
|
"end" -> {
|
|
|
//结束问诊清空IM聊天历史
|
|
|
+ LiveEventBusUtil.send(
|
|
|
+ RxBusCodes.SuccessfulPurchase,
|
|
|
+ messageBean.data
|
|
|
+ )
|
|
|
clearC2CHistoryMessage(msg.sender)
|
|
|
}
|
|
|
"start" -> {
|
|
|
//医生接诊
|
|
|
- LiveEventBusUtil.send(
|
|
|
- RxBusCodes.SuccessfulPurchase,
|
|
|
- messageBean
|
|
|
- )
|
|
|
+ RxBus.get().send(RxBusCodes.doctorReception)
|
|
|
+ sendPatientMessage(messageBean)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -865,4 +866,38 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(),
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发送患者问诊消息
|
|
|
+ */
|
|
|
+ private fun sendPatientMessage(messageBean: MessageBean) {
|
|
|
+ runOnUiThread {
|
|
|
+ val patientStartConsultationBean = PatientStartConsultationBean()
|
|
|
+ patientStartConsultationBean.businessID = "patient"
|
|
|
+ val data = GsonUtil.GsonString(patientStartConsultationBean)
|
|
|
+ val v2TIMMessage = V2TIMManager.getMessageManager()
|
|
|
+ .createCustomMessage(
|
|
|
+ data.toByteArray(),
|
|
|
+ messageBean.description,
|
|
|
+ data.toByteArray()
|
|
|
+ )
|
|
|
+ Log.e("wpp", "患者信息自定义消息" + GsonUtil.GsonString(v2TIMMessage))
|
|
|
+ V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, messageBean.sender, "",
|
|
|
+ V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, null, object :
|
|
|
+ V2TIMSendCallback<V2TIMMessage> {
|
|
|
+ override fun onSuccess(p0: V2TIMMessage?) {
|
|
|
+ Log.e("wpp", "患者信息发送成功")
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onError(p0: Int, p1: String?) {
|
|
|
+ Log.e("wpp", "患者信息发送失败,错误码:$p0 错误信息:$p1")
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onProgress(p0: Int) {
|
|
|
+ Log.e("wpp", "患者信息发送中$p0")
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|