浏览代码

1.修改IM聊天页面UI

王鹏鹏 2 年之前
父节点
当前提交
614ad640e8

+ 1 - 0
.idea/misc.xml

@@ -306,6 +306,7 @@
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_layout.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_menu_face_item_layout.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_menu_recent_face_item_layout.xml" value="0.23697916666666666" />
+        <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_patient_info.xml" value="0.6909090909090909" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_pop_menu_item_layout.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_pop_menu_layout.xml" value="0.264" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_reply_quote_merge_layout.xml" value="0.23697916666666666" />

+ 2 - 0
tuichat/src/main/java/com/tencent/qcloud/tuikit/tuichat/TUIChatService.java

@@ -22,6 +22,7 @@ import com.tencent.qcloud.tuikit.timcommon.bean.MessageReceiptInfo;
 import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
 import com.tencent.qcloud.tuikit.timcommon.component.face.FaceManager;
 import com.tencent.qcloud.tuikit.tuichat.bean.CustomEndConsultationBean;
+import com.tencent.qcloud.tuikit.tuichat.bean.CustomPatientInfoBean;
 import com.tencent.qcloud.tuikit.tuichat.bean.CustomStartConsultationBean;
 import com.tencent.qcloud.tuikit.tuichat.bean.message.CustomEvaluationMessageBean;
 import com.tencent.qcloud.tuikit.tuichat.bean.message.CustomLinkMessageBean;
@@ -541,6 +542,7 @@ public class TUIChatService extends ServiceInitializer implements ITUIChatServic
         addCustomMessageType(TUIChatConstants.BUSINESS_ID_CUSTOM_TYPING, MessageTypingBean.class);
         addCustomMessageType(TUIChatConstants.BUSINESS_ID_CUSTOM_END_CONSULTATION, CustomEndConsultationBean.class);
         addCustomMessageType(TUIChatConstants.BUSINESS_ID_CUSTOM_START_CONSULTATION, CustomStartConsultationBean.class);
+        addCustomMessageType(TUIChatConstants.BUSINESS_ID_CUSTOM_PATIENT_CONSULTATION, CustomPatientInfoBean.class);
     }
 
     /**

+ 56 - 0
tuichat/src/main/java/com/tencent/qcloud/tuikit/tuichat/bean/CustomPatientInfoBean.java

@@ -0,0 +1,56 @@
+package com.tencent.qcloud.tuikit.tuichat.bean;
+
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.google.gson.Gson;
+import com.tencent.imsdk.v2.V2TIMMessage;
+import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
+import com.tencent.qcloud.tuikit.tuichat.R;
+import com.tencent.qcloud.tuikit.tuichat.TUIChatService;
+import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog;
+
+/**
+ * 结束问诊消息
+ *
+ * @author 王鹏鹏
+ */
+public class CustomPatientInfoBean extends TUIMessageBean {
+
+    private PatientInfoBean patientInfoBean;
+
+    @Override
+    public String onGetDisplayString() {
+        return getText();
+    }
+
+    @Override
+    public void onProcessMessage(V2TIMMessage v2TIMMessage) {
+        String description = v2TIMMessage.getCustomElem().getDescription();
+        Log.e("wpp", description);
+        if (!TextUtils.isEmpty(description)) {
+            try {
+                patientInfoBean = new Gson().fromJson(description, PatientInfoBean.class);
+            } catch (Exception e) {
+                TUIChatLog.e("EndConsultationBean", "exception e = " + e);
+            }
+        }
+        if (patientInfoBean != null) {
+            setExtra("患者信息");
+        } else {
+            String text = TUIChatService.getAppContext().getString(R.string.no_support_msg);
+            setExtra(text);
+        }
+    }
+
+    public String getText() {
+        if (patientInfoBean != null) {
+            return "患者信息";
+        }
+        return getExtra();
+    }
+
+    public PatientInfoBean getPatientInfoBean() {
+        return patientInfoBean;
+    }
+}

+ 7 - 1
tuichat/src/main/java/com/tencent/qcloud/tuikit/tuichat/bean/PatientInfoBean.java

@@ -1,7 +1,10 @@
 package com.tencent.qcloud.tuikit.tuichat.bean;
 
+import android.text.TextUtils;
+
 /**
  * 患者信息
+ *
  * @author 王鹏鹏
  */
 public class PatientInfoBean {
@@ -30,7 +33,10 @@ public class PatientInfoBean {
     }
 
     public String getAppUserAge() {
-        return appUserAge;
+        if (TextUtils.isEmpty(appUserAge)) {
+            return "";
+        }
+        return appUserAge + "岁";
     }
 
     public void setAppUserAge(String appUserAge) {

+ 3 - 0
tuichat/src/main/java/com/tencent/qcloud/tuikit/tuichat/classicui/ClassicUIService.java

@@ -19,6 +19,7 @@ import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.TUIReplyQuot
 import com.tencent.qcloud.tuikit.tuichat.R;
 import com.tencent.qcloud.tuikit.tuichat.TUIChatService;
 import com.tencent.qcloud.tuikit.tuichat.bean.CustomEndConsultationBean;
+import com.tencent.qcloud.tuikit.tuichat.bean.CustomPatientInfoBean;
 import com.tencent.qcloud.tuikit.tuichat.bean.CustomStartConsultationBean;
 import com.tencent.qcloud.tuikit.tuichat.bean.message.CallingMessageBean;
 import com.tencent.qcloud.tuikit.tuichat.bean.message.CustomEvaluationMessageBean;
@@ -68,6 +69,7 @@ import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder.Fil
 import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder.ImageMessageHolder;
 import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder.LocationMessageHolder;
 import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder.MergeMessageHolder;
+import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder.PatientInfoMessageHolder;
 import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder.QuoteMessageHolder;
 import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder.ReplyMessageHolder;
 import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder.SoundMessageHolder;
@@ -135,6 +137,7 @@ public class ClassicUIService extends ServiceInitializer implements ITUIExtensio
         addMessageType(CustomStartConsultationBean.class, StartConsultationMessageHolder.class);
         addMessageType(CustomEvaluationMessageBean.class, CustomEvaluationMessageHolder.class);
         addMessageType(CustomOrderMessageBean.class, CustomOrderMessageHolder.class);
+        addMessageType(CustomPatientInfoBean.class, PatientInfoMessageHolder.class);
         addMessageType(MessageTypingBean.class, null);
     }
 

+ 53 - 0
tuichat/src/main/java/com/tencent/qcloud/tuikit/tuichat/classicui/widget/message/viewholder/PatientInfoMessageHolder.java

@@ -0,0 +1,53 @@
+package com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder;
+
+import android.annotation.SuppressLint;
+import android.view.View;
+import android.widget.TextView;
+
+import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
+import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.MessageContentHolder;
+import com.tencent.qcloud.tuikit.tuichat.R;
+import com.tencent.qcloud.tuikit.tuichat.bean.CustomPatientInfoBean;
+import com.tencent.qcloud.tuikit.tuichat.bean.PatientInfoBean;
+
+/**
+ * 开始问诊消息
+ *
+ * @author 王鹏鹏
+ */
+public class PatientInfoMessageHolder extends MessageContentHolder {
+
+    private TextView tvPatientInfo;
+    private TextView tvDescription;
+    private TextView tvTimeIllness;
+    private TextView tvSeekMedical;
+
+    public PatientInfoMessageHolder(View itemView) {
+        super(itemView);
+        tvPatientInfo = itemView.findViewById(R.id.tvPatientInfo);
+        tvDescription = itemView.findViewById(R.id.tvDescription);
+        tvTimeIllness = itemView.findViewById(R.id.tvTimeIllness);
+        tvSeekMedical = itemView.findViewById(R.id.tvSeekMedical);
+    }
+
+    @Override
+    public int getVariableLayout() {
+        return R.layout.chat_patient_info;
+    }
+
+    @SuppressLint("SetTextI18n")
+    @Override
+    public void layoutVariableViews(TUIMessageBean msg, int position) {
+        if (msg instanceof CustomPatientInfoBean) {
+            CustomPatientInfoBean customPatientInfoBean = (CustomPatientInfoBean) msg;
+            PatientInfoBean patientInfoBean = customPatientInfoBean.getPatientInfoBean();
+            if (patientInfoBean != null) {
+                tvPatientInfo.setText(patientInfoBean.getAppUserName() + " " + patientInfoBean.getAppUserSex() + " " + patientInfoBean.getAppUserAge());
+                tvDescription.setText(patientInfoBean.getRemark());
+                tvTimeIllness.setText(patientInfoBean.getSickTime());
+                tvSeekMedical.setText(patientInfoBean.getIsConsultation());
+            }
+
+        }
+    }
+}

+ 118 - 0
tuichat/src/main/res/layout/chat_patient_info.xml

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout 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"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:paddingBottom="@dimen/divider_24px">
+
+    <TextView
+        android:id="@+id/tvTitle"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/divider_32px"
+        android:layout_marginTop="@dimen/divider_24px"
+        android:layout_marginEnd="@dimen/divider_233px"
+        android:text="图文问诊"
+        android:textColor="@color/color_FF333333"
+        android:textSize="@dimen/divider_24px"
+        android:textStyle="bold"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/tvPatientInfo"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/divider_12px"
+        android:textColor="@color/color_FF333333"
+        android:textSize="@dimen/divider_20px"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/tvTitle"
+        app:layout_constraintTop_toBottomOf="@+id/tvTitle"
+        tools:text="@string/accept_call" />
+
+    <TextView
+        android:id="@+id/tvDescriptionInfo"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/divider_12px"
+        android:layout_marginEnd="@dimen/divider_233px"
+        android:text="病情描述"
+        android:textColor="@color/color_FF333333"
+        android:textSize="@dimen/divider_20px"
+        android:textStyle="bold"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/tvTitle"
+        app:layout_constraintTop_toBottomOf="@+id/tvPatientInfo" />
+
+    <TextView
+        android:id="@+id/tvDescription"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/divider_12px"
+        android:layout_marginEnd="@dimen/divider_233px"
+        android:textColor="@color/color_FF333333"
+        android:textSize="@dimen/divider_20px"
+        android:textStyle="bold"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/tvTitle"
+        app:layout_constraintTop_toBottomOf="@+id/tvDescriptionInfo" />
+
+    <TextView
+        android:id="@+id/tvTimeIllnessInfo"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/divider_12px"
+        android:layout_marginEnd="@dimen/divider_233px"
+        android:text="患病时间"
+        android:textColor="@color/color_FF333333"
+        android:textSize="@dimen/divider_20px"
+        android:textStyle="bold"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/tvTitle"
+        app:layout_constraintTop_toBottomOf="@+id/tvDescription" />
+
+    <TextView
+        android:id="@+id/tvTimeIllness"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/divider_12px"
+        android:layout_marginEnd="@dimen/divider_233px"
+        android:textColor="@color/color_FF333333"
+        android:textSize="@dimen/divider_20px"
+        android:textStyle="bold"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/tvTitle"
+        app:layout_constraintTop_toBottomOf="@+id/tvTimeIllnessInfo" />
+
+    <TextView
+        android:id="@+id/tvSeekMedicalInfo"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/divider_12px"
+        android:layout_marginEnd="@dimen/divider_233px"
+        android:text="是否就诊过"
+        android:textColor="@color/color_FF333333"
+        android:textSize="@dimen/divider_20px"
+        android:textStyle="bold"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/tvTitle"
+        app:layout_constraintTop_toBottomOf="@+id/tvTimeIllness" />
+
+    <TextView
+        android:id="@+id/tvSeekMedical"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/divider_12px"
+        android:layout_marginEnd="@dimen/divider_233px"
+        android:textColor="@color/color_FF333333"
+        android:textSize="@dimen/divider_20px"
+        android:textStyle="bold"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/tvTitle"
+        app:layout_constraintTop_toBottomOf="@+id/tvSeekMedicalInfo" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 0
tuichat/src/main/res/values/dimens.xml

@@ -31,6 +31,7 @@
     <dimen name="divider_250px" tools:ignore="ResourceName">250px</dimen>
     <dimen name="divider_249px" tools:ignore="ResourceName">249px</dimen>
     <dimen name="divider_237px" tools:ignore="ResourceName">237px</dimen>
+    <dimen name="divider_233px" tools:ignore="ResourceName">233px</dimen>
     <dimen name="divider_230px" tools:ignore="ResourceName">230px</dimen>
     <dimen name="divider_215px" tools:ignore="ResourceName">215px</dimen>
     <dimen name="divider_202px" tools:ignore="ResourceName">202px</dimen>