|
|
@@ -15,6 +15,7 @@ import com.tencent.qcloud.tuikit.tuichat.bean.message.PatientStartConsultationBe
|
|
|
import com.yingyang.home.R
|
|
|
import com.yingyang.home.databinding.ActivityHomeBinding
|
|
|
import com.yingyangfly.baselib.bean.MessageBean
|
|
|
+import com.yingyangfly.baselib.bean.PurchaseConsultationEvent
|
|
|
import com.yingyangfly.baselib.bean.Record
|
|
|
import com.yingyangfly.baselib.db.VoicePlayerBean
|
|
|
import com.yingyangfly.baselib.dialog.TipsDialog
|
|
|
@@ -36,6 +37,8 @@ import com.yingyangfly.home.component.ShowProfessionalEvaluationViewComponent
|
|
|
import com.yingyangfly.home.dialog.DownLoadAppFragment
|
|
|
import com.yingyangfly.home.utils.AnimUtil
|
|
|
import gorden.rxbus2.RxBus
|
|
|
+import gorden.rxbus2.Subscribe
|
|
|
+import gorden.rxbus2.ThreadMode
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -708,7 +711,6 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(),
|
|
|
messageBean
|
|
|
)
|
|
|
}, 800)
|
|
|
- sendPatientMessage(messageBean)
|
|
|
} else {
|
|
|
addAMessageData(messageBean)
|
|
|
}
|
|
|
@@ -870,39 +872,37 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(),
|
|
|
/**
|
|
|
* 发送患者问诊消息
|
|
|
*/
|
|
|
- private fun sendPatientMessage(messageBean: MessageBean) {
|
|
|
- runOnUiThread {
|
|
|
- val description = if (TextUtils.isEmpty(User.getPatientInfo())) {
|
|
|
- ""
|
|
|
- } else {
|
|
|
- User.getPatientInfo()
|
|
|
- }
|
|
|
- val patientStartConsultationBean = PatientStartConsultationBean()
|
|
|
- patientStartConsultationBean.businessID = "patient"
|
|
|
- val data = GsonUtil.GsonString(patientStartConsultationBean)
|
|
|
- val v2TIMMessage = V2TIMManager.getMessageManager()
|
|
|
- .createCustomMessage(
|
|
|
- data.toByteArray(),
|
|
|
- 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", "患者信息发送成功")
|
|
|
- }
|
|
|
+ @Subscribe(code = RxBusCodes.purchaseConsultationEvent, threadMode = ThreadMode.MAIN)
|
|
|
+ fun sendPatientMessage(event: PurchaseConsultationEvent) {
|
|
|
+ if (event != null) {
|
|
|
+ runOnUiThread {
|
|
|
+ val patientStartConsultationBean = PatientStartConsultationBean()
|
|
|
+ patientStartConsultationBean.businessID = "patient"
|
|
|
+ val data = GsonUtil.GsonString(patientStartConsultationBean)
|
|
|
+ val v2TIMMessage = V2TIMManager.getMessageManager()
|
|
|
+ .createCustomMessage(
|
|
|
+ data.toByteArray(),
|
|
|
+ event.patientInfo,
|
|
|
+ data.toByteArray()
|
|
|
+ )
|
|
|
+ Log.e("wpp", "患者信息自定义消息" + GsonUtil.GsonString(v2TIMMessage))
|
|
|
+ V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, event.doctorId, "",
|
|
|
+ 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 onError(p0: Int, p1: String?) {
|
|
|
+ Log.e("wpp", "患者信息发送失败,错误码:$p0 错误信息:$p1")
|
|
|
+ }
|
|
|
|
|
|
- override fun onProgress(p0: Int) {
|
|
|
- Log.e("wpp", "患者信息发送中$p0")
|
|
|
- }
|
|
|
+ override fun onProgress(p0: Int) {
|
|
|
+ Log.e("wpp", "患者信息发送中$p0")
|
|
|
+ }
|
|
|
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|