Prechádzať zdrojové kódy

1.修改测评内容Ui

王鹏鹏 2 rokov pred
rodič
commit
65777e63a9

+ 5 - 0
evaluation/src/main/AndroidManifest.xml

@@ -46,6 +46,11 @@
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
+        <activity
+            android:name=".detail.EvaluationResultActivity"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:screenOrientation="landscape"
+            android:windowSoftInputMode="adjustResize|adjustPan" />
     </application>
 
 </manifest>

+ 27 - 0
evaluation/src/main/java/com/yingyangfly/evaluation/adapter/EvaluationResultAdapter.kt

@@ -0,0 +1,27 @@
+package com.yingyangfly.evaluation.adapter
+
+import com.yingyangfly.baselib.adapter.BaseDataBindingAdapter
+import com.yingyangfly.baselib.ext.setOnSingleClickListener
+import com.yingyangfly.evaluation.R
+import com.yingyangfly.evaluation.databinding.ItemEvaluationResultBinding
+import com.yingyangfly.evaluation.entity.EvaluationResultBean
+
+/**
+ * 测评结果adapter
+ */
+class EvaluationResultAdapter(override val layoutId: Int = R.layout.item_evaluation_result) :
+    BaseDataBindingAdapter<EvaluationResultBean, ItemEvaluationResultBinding>() {
+
+    var onClickListener: ((bean: String) -> Unit)? = null
+
+    override fun onBindViewHolder(
+        binding: ItemEvaluationResultBinding,
+        item: EvaluationResultBean,
+        position: Int
+    ) {
+        binding.data = item
+        binding.tvViewDetails.setOnSingleClickListener {
+            onClickListener?.invoke("")
+        }
+    }
+}

+ 0 - 1
evaluation/src/main/java/com/yingyangfly/evaluation/adapter/QuestionListAdapter.kt

@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
 import com.yingyangfly.baselib.adapter.BaseDataBindingAdapter
 import com.yingyangfly.baselib.db.QuestionOptionBean
 import com.yingyangfly.baselib.ext.setOnSingleClickListener
-import com.yingyangfly.baselib.ext.setTextColorResource
 import com.yingyangfly.evaluation.R
 import com.yingyangfly.evaluation.databinding.ItemQuestionListBinding
 

+ 103 - 0
evaluation/src/main/java/com/yingyangfly/evaluation/detail/EvaluationResultActivity.kt

@@ -0,0 +1,103 @@
+package com.yingyangfly.evaluation.detail
+
+import android.annotation.SuppressLint
+import android.os.Bundle
+import android.view.MotionEvent
+import android.view.View
+import com.alibaba.android.arouter.facade.annotation.Route
+import com.yingyangfly.baselib.ext.getEndAnimation
+import com.yingyangfly.baselib.ext.getScaleAnimation
+import com.yingyangfly.baselib.ext.toast
+import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
+import com.yingyangfly.baselib.router.RouterUrlCommon
+import com.yingyangfly.baselib.utils.JumpUtil
+import com.yingyangfly.evaluation.R
+import com.yingyangfly.evaluation.adapter.EvaluationResultAdapter
+import com.yingyangfly.evaluation.databinding.ActivityEvaluationResultBinding
+import com.yingyangfly.evaluation.entity.EvaluationResultBean
+
+/**
+ * 测评结果
+ */
+@Route(path = RouterUrlCommon.evaluationResult)
+class EvaluationResultActivity :
+    BaseMVVMActivity<ActivityEvaluationResultBinding, EvaluationResultViewModel>(),
+    View.OnTouchListener {
+
+    private var reviewTaskId = ""
+    private var results = mutableListOf<EvaluationResultBean>()
+    private val adapter by lazy { EvaluationResultAdapter() }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        reviewTaskId = intent.getStringExtra("url") ?: ""
+        super.onCreate(savedInstanceState)
+    }
+
+    override fun initViews() {
+        binding {
+            rvResult.adapter = adapter
+            adapter.setData(results)
+            adapter.onClickListener = {
+                JumpUtil.jumpActivityWithUrl(
+                    RouterUrlCommon.reviewResultDetail, reviewTaskId, mContext
+                )
+            }
+        }
+    }
+
+    @SuppressLint("ClickableViewAccessibility")
+    override fun initListener() {
+        binding {
+            layoutHead.setOnTouchListener(this@EvaluationResultActivity)
+        }
+    }
+
+    override fun initData() {
+
+    }
+
+    override fun onResume() {
+        super.onResume()
+        getReviewTaskList()
+    }
+
+    /**
+     * 获取测评历史
+     */
+    private fun getReviewTaskList() {
+        viewModel.findReviewResult(reviewTaskId, fail = {
+            it.toast()
+        }, success = {
+            results.clear()
+            if (it != null) {
+                results.add(it)
+            }
+            adapter.setData(results)
+        })
+    }
+
+    @SuppressLint("ClickableViewAccessibility")
+    override fun onTouch(v: View, event: MotionEvent): Boolean {
+        when (event.action) {
+            MotionEvent.ACTION_DOWN -> {
+                if (v.id == R.id.layoutHead) {
+                    v.startAnimation(getScaleAnimation())
+                }
+            }
+
+            MotionEvent.ACTION_UP -> {
+                v.startAnimation(getEndAnimation())
+                if (v.id == R.id.layoutHead) {
+                    finish()
+                }
+            }
+
+            MotionEvent.ACTION_CANCEL -> {
+                if (v.id == R.id.layoutHead) {
+                    v.startAnimation(getEndAnimation())
+                }
+            }
+        }
+        return true
+    }
+}

+ 29 - 0
evaluation/src/main/java/com/yingyangfly/evaluation/detail/EvaluationResultViewModel.kt

@@ -0,0 +1,29 @@
+package com.yingyangfly.evaluation.detail
+
+import com.yingyangfly.baselib.mvvm.BaseViewModel
+import com.yingyangfly.baselib.net.XUtils
+import com.yingyangfly.baselib.utils.GsonUtil
+import com.yingyangfly.evaluation.entity.EvaluationResultBean
+import com.yingyangfly.evaluation.entity.FindReviewResultBean
+import com.yingyangfly.evaluation.net.EVALUATION_API
+
+class EvaluationResultViewModel : BaseViewModel() {
+
+    /**
+     * 获取报告
+     */
+    fun findReviewResult(
+        id: String,
+        fail: ((msg: String) -> Unit)? = null,
+        success: ((success: EvaluationResultBean?) -> Unit)? = null,
+    ) = launchFlow(true) {
+        val requestBean = FindReviewResultBean().apply {
+            reviewTaskId = id
+        }
+        val body = XUtils.createJson(GsonUtil.GsonString(requestBean))
+        EVALUATION_API.findReviewResult(body)
+    }.runUI(
+        success,
+        fail
+    )
+}

+ 12 - 0
evaluation/src/main/java/com/yingyangfly/evaluation/entity/EvaluationResultBean.kt

@@ -0,0 +1,12 @@
+package com.yingyangfly.evaluation.entity
+
+/**
+ * 测评结果
+ */
+data class EvaluationResultBean(
+    val createTime: String,
+    val referenceValue: String,
+    val result: String,
+    val reviewContent: String,
+    val reviewScore: String
+)

+ 0 - 1
evaluation/src/main/java/com/yingyangfly/evaluation/hospital/HospitalActivity.kt

@@ -26,7 +26,6 @@ import com.yingyangfly.baselib.utils.User
 import com.yingyangfly.evaluation.R
 import com.yingyangfly.evaluation.databinding.ActivityHospitalBinding
 import com.youth.banner.indicator.RectangleIndicator
-import java.lang.reflect.Method
 
 
 /**

+ 6 - 0
evaluation/src/main/java/com/yingyangfly/evaluation/net/EvaluationApiService.kt

@@ -99,4 +99,10 @@ interface EvaluationApiService {
     suspend fun getVoiceUrl(
         @Query("voiceMsg") voiceMsg: String
     ): BaseResp<String>
+
+    /**
+     * 获取报告
+     */
+    @POST("app/review/findReviewResult")
+    suspend fun findReviewResult(@Body requestBody: RequestBody): BaseResp<EvaluationResultBean>
 }

+ 6 - 0
evaluation/src/main/manifest/AndroidManifest.xml

@@ -47,6 +47,12 @@
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
 
+        <activity
+            android:name="com.yingyangfly.evaluation.detail.EvaluationResultActivity"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:screenOrientation="landscape"
+            android:windowSoftInputMode="adjustResize|adjustPan" />
+
     </application>
 
 </manifest>

+ 209 - 0
evaluation/src/main/res/layout/activity_evaluation_result.xml

@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:ignore="ResourceName">
+
+    <data>
+
+        <import type="com.yingyangfly.baselib.utils.User" />
+    </data>
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        style="@style/layout_properties_specify_width_geight"
+        android:background="@mipmap/icon_uniform_background">
+
+        <LinearLayout
+            android:id="@+id/layoutHead"
+            style="@style/back_layout"
+            tools:ignore="MissingConstraints">
+
+            <androidx.appcompat.widget.AppCompatImageView style="@style/back_image" />
+
+            <androidx.appcompat.widget.AppCompatTextView style="@style/back_text" />
+        </LinearLayout>
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tvTitle"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/divider_32px"
+            android:text="@string/evaluation_result"
+            android:textColor="@android:color/white"
+            android:textSize="@dimen/divider_34px"
+            android:textStyle="bold"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <com.google.android.material.card.MaterialCardView
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_marginStart="@dimen/divider_22px"
+            android:layout_marginTop="@dimen/divider_29px"
+            android:layout_marginEnd="@dimen/divider_22px"
+            android:layout_marginBottom="@dimen/divider_18px"
+            android:theme="@style/Theme.MaterialComponents.NoActionBar"
+            app:cardBackgroundColor="@android:color/white"
+            app:cardCornerRadius="@dimen/divider_28px"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/tvTitle">
+
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
+
+                <androidx.appcompat.widget.AppCompatTextView
+                    android:id="@+id/tvName"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="@dimen/divider_38px"
+                    android:layout_marginTop="@dimen/divider_33px"
+                    android:text='@{"姓名:"+User.INSTANCE.name}'
+                    android:textColor="@color/color_FF333333"
+                    android:textSize="@dimen/divider_24px"
+                    android:textStyle="bold"
+                    app:layout_constraintEnd_toStartOf="@+id/tvSex"
+                    app:layout_constraintHorizontal_chainStyle="spread"
+                    app:layout_constraintHorizontal_weight="1"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+                <androidx.appcompat.widget.AppCompatTextView
+                    android:id="@+id/tvSex"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="@dimen/divider_33px"
+                    android:text='@{"性别:"+User.INSTANCE.userSex}'
+                    android:textColor="@color/color_FF333333"
+                    android:textSize="@dimen/divider_24px"
+                    android:textStyle="bold"
+                    app:layout_constraintEnd_toStartOf="@+id/tvAge"
+                    app:layout_constraintHorizontal_chainStyle="spread"
+                    app:layout_constraintHorizontal_weight="1"
+                    app:layout_constraintStart_toEndOf="@+id/tvName"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+                <androidx.appcompat.widget.AppCompatTextView
+                    android:id="@+id/tvAge"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="@dimen/divider_33px"
+                    android:text='@{"年龄:"+User.INSTANCE.userAge}'
+                    android:textColor="@color/color_FF333333"
+                    android:textSize="@dimen/divider_24px"
+                    android:textStyle="bold"
+                    app:layout_constraintEnd_toStartOf="@+id/tvNumber"
+                    app:layout_constraintHorizontal_chainStyle="spread"
+                    app:layout_constraintHorizontal_weight="1"
+                    app:layout_constraintStart_toEndOf="@+id/tvSex"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+                <androidx.appcompat.widget.AppCompatTextView
+                    android:id="@+id/tvNumber"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="@dimen/divider_33px"
+                    android:layout_marginEnd="@dimen/divider_37px"
+                    android:text='@{"编号:"+User.INSTANCE.userId}'
+                    android:textColor="@color/color_FF333333"
+                    android:textSize="@dimen/divider_24px"
+                    android:textStyle="bold"
+                    android:visibility="gone"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintHorizontal_chainStyle="spread"
+                    app:layout_constraintHorizontal_weight="1"
+                    app:layout_constraintStart_toEndOf="@+id/tvAge"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+                <LinearLayout
+                    android:id="@+id/tvTitleTag"
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/divider_71px"
+                    android:layout_marginStart="@dimen/divider_34px"
+                    android:layout_marginTop="@dimen/divider_23px"
+                    android:layout_marginEnd="@dimen/divider_37px"
+                    android:background="@drawable/bg_top_results"
+                    android:orientation="horizontal"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toBottomOf="@+id/tvName">
+
+                    <androidx.appcompat.widget.AppCompatTextView
+                        android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:text="@string/assessment_content"
+                        android:textColor="@android:color/white"
+                        android:textSize="@dimen/divider_24px"
+                        android:textStyle="bold" />
+
+                    <androidx.appcompat.widget.AppCompatTextView
+                        android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:text="@string/score"
+                        android:textColor="@android:color/white"
+                        android:textSize="@dimen/divider_24px"
+                        android:textStyle="bold" />
+
+                    <androidx.appcompat.widget.AppCompatTextView
+                        android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:text="@string/reference_value"
+                        android:textColor="@android:color/white"
+                        android:textSize="@dimen/divider_24px"
+                        android:textStyle="bold" />
+
+                    <androidx.appcompat.widget.AppCompatTextView
+                        android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:text="@string/result"
+                        android:textColor="@android:color/white"
+                        android:textSize="@dimen/divider_24px"
+                        android:textStyle="bold" />
+
+                    <androidx.appcompat.widget.AppCompatTextView
+                        android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:text="@string/view_details"
+                        android:textColor="@android:color/white"
+                        android:textSize="@dimen/divider_24px"
+                        android:textStyle="bold" />
+
+                </LinearLayout>
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:layout_marginStart="@dimen/divider_34px"
+                    android:layout_marginEnd="@dimen/divider_37px"
+                    android:layout_marginBottom="@dimen/divider_36px"
+                    android:background="@drawable/bg_results_content"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toBottomOf="@+id/tvTitleTag">
+
+                    <androidx.recyclerview.widget.RecyclerView
+                        android:id="@+id/rvResult"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
+                </LinearLayout>
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
+        </com.google.android.material.card.MaterialCardView>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+</layout>

+ 71 - 0
evaluation/src/main/res/layout/item_evaluation_result.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:ignore="ResourceName">
+
+    <data>
+
+        <variable
+            name="data"
+            type="com.yingyangfly.evaluation.entity.EvaluationResultBean" />
+    </data>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/divider_98px"
+        android:background="@drawable/bg_evaluation_result"
+        android:orientation="horizontal">
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:text="@{data.reviewContent}"
+            android:textColor="@color/color_FF4A76FF"
+            android:textSize="@dimen/divider_24px"
+            android:textStyle="bold" />
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:text="@{data.reviewScore}"
+            android:textColor="@color/color_FF4A76FF"
+            android:textSize="@dimen/divider_24px"
+            android:textStyle="bold" />
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:text="@{data.referenceValue}"
+            android:textColor="@color/color_FF4A76FF"
+            android:textSize="@dimen/divider_24px"
+            android:textStyle="bold" />
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:text="@{data.result}"
+            android:textColor="@color/color_FF4A76FF"
+            android:textSize="@dimen/divider_24px"
+            android:textStyle="bold" />
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tvViewDetails"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:text="@string/report_details"
+            android:textColor="@color/color_FF333333"
+            android:textSize="@dimen/divider_24px"
+            android:textStyle="bold" />
+
+    </LinearLayout>
+</layout>