Explorar o código

1.修改游戏结束总分计算逻辑

王鹏鹏 %!s(int64=2) %!d(string=hai) anos
pai
achega
18da1ffe04

+ 10 - 0
healthconsultation/src/main/java/com/yingyang/healthconsultation/entity/PatientInfoBean.kt

@@ -0,0 +1,10 @@
+package com.yingyang.healthconsultation.entity
+
+data class PatientInfoBean(
+    var appUserAge: String,
+    val appUserName: String,
+    val appUserSex: String,
+    var isConsultation: String,
+    val remark: String,
+    val sickTime: String
+)

+ 23 - 5
healthconsultation/src/main/java/com/yingyang/healthconsultation/payment/PaymentActivity.kt

@@ -10,6 +10,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
 import com.yingyang.healthconsultation.R
 import com.yingyang.healthconsultation.databinding.ActivityPaymentBinding
 import com.yingyang.healthconsultation.dialog.PaymentQrCodeDialog
+import com.yingyang.healthconsultation.entity.PatientInfoBean
 import com.yingyang.healthconsultation.entity.PurchaseConsultationBean
 import com.yingyang.healthconsultation.utils.CommonUtils
 import com.yingyangfly.baselib.bean.PurchaseConsultationEvent
@@ -20,8 +21,10 @@ import com.yingyangfly.baselib.ext.show
 import com.yingyangfly.baselib.ext.toast
 import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
 import com.yingyangfly.baselib.router.RouterUrlCommon
+import com.yingyangfly.baselib.utils.GsonUtil
 import com.yingyangfly.baselib.utils.LiveEventBusUtil
 import com.yingyangfly.baselib.utils.RxBusCodes
+import com.yingyangfly.baselib.utils.User
 import gorden.rxbus2.RxBus
 
 /**
@@ -198,11 +201,26 @@ class PaymentActivity : BaseMVVMActivity<ActivityPaymentBinding, PaymentViewMode
 
     override fun onDestroy() {
         if (paySuccess) {
-            RxBus.get()
-                .send(
-                    RxBusCodes.purchaseConsultationEvent,
-                    PurchaseConsultationEvent(id, patientInfo)
-                )
+            if (TextUtils.isEmpty(patientInfo).not()) {
+                val patientInfoBean = GsonUtil.GsonToBean(patientInfo, PatientInfoBean::class.java)
+                val userAge = if (TextUtils.isEmpty(User.getUserAge()).not()) {
+                    User.getUserAge().replace("岁", "")
+                } else {
+                    ""
+                }
+                patientInfoBean.appUserAge = userAge
+                val consultation = if (TextUtils.equals("1", patientInfoBean.isConsultation)) {
+                    "否"
+                } else {
+                    "是"
+                }
+                patientInfoBean.isConsultation = consultation
+                RxBus.get()
+                    .send(
+                        RxBusCodes.purchaseConsultationEvent,
+                        PurchaseConsultationEvent(id, GsonUtil.GsonString(patientInfoBean))
+                    )
+            }
         }
         super.onDestroy()
     }