Commit 94c76795 by 刘鹏

前置信息页消息集成完毕,发送70、71类型消息未进行

Merge branch '4.2.60_lp_test' into 4.2.60

# Conflicts:
#	m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
#	m-im/src/main/res/values/colors.xml
parents 6233367b af53ee64
......@@ -88,8 +88,9 @@ dependencies {
implementation 'com.netease.nimlib:basesdk:7.2.0'
implementation 'com.netease.nimlib:avchat:7.2.0'
implementation 'com.netease.nimlib:nrtc:7.2.0'
api rootProject.ext.dependencies["ydl-user-router"]
implementation rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
if (rootProject.ext.dev_mode){
//开发时使用
api project(':ydl-webview')
......
......@@ -8,18 +8,22 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.BROADCAST_STICKY"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<permission
android:name="${APPLICATIONID}.permission.RECEIVE_MSG"
......@@ -57,13 +61,17 @@
<activity
android:name=".ui.activity.SystemMsgDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
/>
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".ui.activity.OtherMsgDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
/>
android:theme="@style/platform_NoTitleTheme" />
<!--前置信息手机页面-->
<activity
android:name=".ui.activity.CmsExamQuestionPaperActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<!-- 云信 集成配置 -->
<!-- 声明云信后台服务 -->
......
{
"questionPaper":{
"id":"601128023407726592",
"createTime":"2021-06-12T08:29:14.000+0000",
"updateTime":"2021-06-23T12:43:07.000+0000",
"isDeleted":0,
"category":"pre_diagnosis",
"name":"用户首次进入灵犀系统前置信息收集",
"cateId":53210621000798,
"cateName":"信息收集卡",
"questionNum":4,
"status":0,
"remark":"用户首次进入灵犀系统前置信息收集",
"questionChains":{
"601128318581870592":{
"id":"601128318581870592",
"createTime":null,
"updateTime":null,
"isDeleted":null,
"questionPaperId":"601128023407726592",
"questionId":"601128318581870592",
"head":true,
"options":{
"601128318544121856":"601128931717812224",
"601128318544121857":"601128931717812224",
"601128318544121858":"601129312090853376",
"601128318544121859":"601128931717812224"
}
},
"601128931717812224":{
"id":"601128931717812224",
"createTime":null,
"updateTime":null,
"isDeleted":null,
"questionPaperId":"601128023407726592",
"questionId":"601128931717812224",
"head":false,
"options":{
"601128931680063488":"601129312090853376",
"601128931680063489":"601129312090853376",
"601128931680063490":"601129312090853376",
"601128931680063491":"601129312090853376"
}
},
"601129312090853376":{
"id":"601129312090853376",
"createTime":null,
"updateTime":null,
"isDeleted":null,
"questionPaperId":"601128023407726592",
"questionId":"601129312090853376",
"head":false,
"options":{
"601129312040521728":"605178179136524288",
"601129312040521729":"605178179136524288",
"601129312040521730":"605178179136524288"
}
},
"605178179136524288":{
"id":"605178179136524288",
"createTime":null,
"updateTime":null,
"isDeleted":null,
"questionPaperId":"601128023407726592",
"questionId":"605178179136524288",
"head":false,
"options":null
}
},
"questions":{
"601128318581870592":{
"id":"601128318581870592",
"createTime":"2021-06-12T08:30:25.000+0000",
"updateTime":"2021-06-12T08:30:25.000+0000",
"isDeleted":0,
"questionPaperId":"601128023407726592",
"category":"pre_diagnosis",
"order":"1.0",
"name":"服药历",
"type":"radio",
"remarks":[
"请问你有服药史么?"
],
"options":[
{
"id":"601128318544121856",
"name":"1~3 个月",
"relates":[
{
"id":null,
"category":"症状",
"name":"幻觉",
"score":null
}
]
},
{
"id":"601128318544121857",
"name":"4~6 个月",
"relates":[
{
"id":null,
"category":"症状",
"name":"幻觉",
"score":null
}
]
},
{
"id":"601128318544121858",
"name":"7~9 个月",
"relates":[
{
"id":null,
"category":"症状",
"name":"幻觉",
"score":null
}
]
},
{
"id":"601128318544121859",
"name":"10~12 个月",
"relates":[
{
"id":null,
"category":"症状",
"name":"幻觉",
"score":null
}
]
}
]
},
"601128931717812224":{
"id":"601128931717812224",
"createTime":"2021-06-12T08:32:51.000+0000",
"updateTime":"2021-06-12T08:32:51.000+0000",
"isDeleted":0,
"questionPaperId":"601128023407726592",
"category":"pre_diagnosis",
"order":"2.0",
"name":"晚上睡觉会醒几次",
"type":"radio",
"remarks":[
"晚上睡觉会醒几次?"
],
"options":[
{
"id":"601128931680063488",
"name":"1~3 次",
"relates":[
{
"id":null,
"category":"症状",
"name":"思绪混乱",
"score":null
}
]
},
{
"id":"601128931680063489",
"name":"4~6 次",
"relates":[
{
"id":null,
"category":"症状",
"name":"思绪混乱",
"score":null
}
]
},
{
"id":"601128931680063490",
"name":"7~9 次",
"relates":[
{
"id":null,
"category":"症状",
"name":"思绪混乱",
"score":null
}
]
},
{
"id":"601128931680063491",
"name":"10~12 次",
"relates":[
{
"id":null,
"category":"症状",
"name":"思绪混乱",
"score":null
}
]
}
]
},
"601129312090853376":{
"id":"601129312090853376",
"createTime":"2021-06-12T08:34:22.000+0000",
"updateTime":"2021-06-12T08:34:22.000+0000",
"isDeleted":0,
"questionPaperId":"601128023407726592",
"category":"pre_diagnosis",
"order":"3.0",
"name":"有逃离的想法么?",
"type":"check",
"remarks":[
"有逃离的想法么?"
],
"options":[
{
"id":"601129312040521728",
"name":"有",
"relates":[
{
"id":null,
"category":"症状",
"name":"妄想症",
"score":null
}
]
},
{
"id":"601129312040521729",
"name":"无",
"relates":[
{
"id":null,
"category":"症状",
"name":"妄想症",
"score":null
}
]
},
{
"id":"601129312040521730",
"name":"其他",
"relates":null
}
]
},
"605178179136524288":{
"id":"605178179136524288",
"createTime":"2021-06-23T12:43:07.000+0000",
"updateTime":"2021-06-23T12:43:07.000+0000",
"isDeleted":0,
"questionPaperId":"601128023407726592",
"category":"pre_diagnosis",
"order":"1.624452187016E12",
"name":"问题1",
"type":"radio",
"remarks":null,
"options":[
{
"id":"605178178335412224",
"name":"选项1",
"relates":[
{
"id":53210524000648,
"category":"类目",
"name":"1类目2",
"score":null
}
]
},
{
"id":"605178178335412225",
"name":"选项2",
"relates":[
{
"id":53210528000703,
"category":"MOT节点标签",
"name":"匹配推荐",
"score":null
}
]
}
]
}
}
},
"questions":[
{
"question":"这是问题1",
"example":"这是描述1"
},
{
"question":"这是问题2",
"example":"这是描述2"
},
{
"question":"这是问题3",
"example":"这是描述3"
}
]
}
\ No newline at end of file
......@@ -2,10 +2,10 @@ package com.yidianling.im.helper
import android.annotation.SuppressLint
import android.content.Context
import androidx.core.content.ContextCompat
import androidx.appcompat.app.AppCompatActivity
import android.text.TextUtils
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.data.http.BaseAPIResponse
......@@ -35,6 +35,7 @@ import com.yidianling.im.http.ImRetrofitApi.Companion.getImRetrofitApi
import com.yidianling.im.router.ImIn
import com.yidianling.im.router.ImIn.isLogin
import com.yidianling.im.session.SessionHelper
import com.yidianling.im.ui.activity.CmsExamQuestionPaperActivity
import com.yidianling.im.ui.page.fragment.bean.ChatItemBean
import com.yidianling.uikit.business.session.fragment.YDLMessageFragment
import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper
......@@ -55,10 +56,11 @@ import java.net.URLEncoder
*/
object IMChatUtil {
private var loadingDialog: LoadingDialogFragment? = null
private const val USER_TYPE_EXPERT=2//专家
private const val USER_TYPE_ASSISTANT=3//助理
private const val USER_TYPE_USER=1//用户
lateinit var doctorId:String
private const val USER_TYPE_EXPERT = 2//专家
private const val USER_TYPE_ASSISTANT = 3//助理
private const val USER_TYPE_USER = 1//用户
lateinit var doctorId: String
/**
* 接口数据请求完成回调
*/
......@@ -85,7 +87,50 @@ object IMChatUtil {
* @param context
* @param chatItemBean
*/
@SuppressLint("CheckResult")
fun startChat(context: AppCompatActivity?, chatItemBean: ChatItemBean) {
if (context == null || (!isLogin(context, true))) {
return
}
if (loadingDialog == null) {
loadingDialog = newInstance(null)
}
if (context.supportFragmentManager != null && !context.isDestroyed) {
loadingDialog?.show(context.supportFragmentManager, null)
}
getImJavaApi().getUserType(chatItemBean.toUid.toString())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null) {
if (res.data!!.collectEvent &&TextUtils.equals(res.data!!.userType, USER_TYPE_ASSISTANT.toString()) && res.data!!.collectEvent) {
//和助理私聊需要打开信息采集弹窗
prepareAssistantChatData(
context,
chatItemBean.toUid.toString(),
object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) { //新前置信息收集入口
CmsExamQuestionPaperActivity.start(
context, chatItemBean.toUid.toString(), expertInfo,
0
)
}
})
} else {
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
}
} else {
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
......@@ -95,6 +140,23 @@ object IMChatUtil {
)
}
}, { throwable: Throwable? ->
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
})
}
/**
* 非私聊列表进入,前置数据请求
*
......@@ -147,12 +209,24 @@ object IMChatUtil {
}) { t: Throwable? ->
handleError(context, t!!)
}
} else if (TextUtils.equals(res.data!!.userType, USER_TYPE_ASSISTANT.toString()) && res.data!!.collectEvent) {//助理
prepareAssistantChatData(context, toUid, object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) { //新前置信息收集入口
CmsExamQuestionPaperActivity.start(
context,
toUid,
expertInfo,
isFromQingShu
)
}
})
} else {
prepareAssistantChatData(context, toUid, object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
})
}
} else {
if (loadingDialog != null && loadingDialog!!.isVisible) {
......@@ -165,8 +239,7 @@ object IMChatUtil {
loadingDialog?.dismissAllowingStateLoss()
}
handleError(context, throwable!!)
}
)
})
}
......@@ -197,7 +270,8 @@ object IMChatUtil {
isFromQingShu: Int,
context: AppCompatActivity
) {
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.YUNXIN, "startChatSession 开启聊天会话")
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.YUNXIN, "startChatSession 开启聊天会话")
val p2PCustomActionHandlerImpl = P2PCustomActionHandlerImpl(toUid, expertInfo)
p2PCustomActionHandlerImpl.isFromQingShu = isFromQingShu
SessionHelper.startP2PSession(
......@@ -209,6 +283,18 @@ object IMChatUtil {
)
}
/**
* 信息收集前置页调用方法
* */
open fun startChatSessionByCms(
toUid: String,
expertInfo: IMExpertBuild,
isFromQingShu: Int,
context: AppCompatActivity
) {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
//====================准备私聊数据====================
/**
* 初始化聊天数据
......@@ -489,7 +575,7 @@ object IMChatUtil {
val showExpertList = !(promptRule == 1 || promptRule == 3)
if (actionHandler.userType == USER_TYPE_EXPERT && status == 2) { //当该专家离线时
sendRecommendExpertListMessage(1, showExpertList, toUid, actionHandler)
} else if (actionHandler.userType == USER_TYPE_EXPERT&& status >= 3) { //当该专家忙碌时
} else if (actionHandler.userType == USER_TYPE_EXPERT && status >= 3) { //当该专家忙碌时
sendRecommendExpertListMessage(2, showExpertList, toUid, actionHandler)
}
}
......
package com.yidianling.im.ui.activity
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Handler
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.MotionEvent
import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.fastjson.JSON
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.im.R
import com.yidianling.im.api.bean.IMExpertBuild
import com.yidianling.im.helper.IMChatUtil
import com.yidianling.im.router.ImIn
import com.yidianling.listener.SoftKeyBoardListener
import com.yidianling.uikit.business.session.view.question.QuestionAdapter
import com.yidianling.uikit.business.session.view.question.QuestionMultiItem
import com.yidianling.uikit.business.session.view.question.QuestionOneCheckListener
import com.yidianling.uikit.custom.http.ServiceImpl.Companion.instance
import com.yidianling.uikit.custom.http.response.question.*
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.im_view_question_infomation.*
import kotlinx.android.synthetic.main.im_view_question_infomation.view.*
import java.util.*
import kotlin.collections.ArrayList
/**
* 新前置信息收集
* */
class CmsExamQuestionPaperActivity : BaseActivity() {
private var dialog: CommonDialog? = null
/**界面数据流adapter*/
private lateinit var mQuestionAdapter: QuestionAdapter
/** 界面消息数据*/
private var mData = ArrayList<QuestionMultiItem>()
/** item 展示其他的时 的选项数据数据*/
private var otherOptionsList = ArrayList<OptionsBean>()
/** item 展示其他时 的选项问题 */
private var otherQuestionsBean: QuestionsBean? = null
/**用于云信聊天界面添加数据使用*/
private var mType70RequestList = ArrayList<AnswerQuestionType70RequestBean>();
/**题库*/
private var mQuestionBean: QuestionsInfoBean? = null
/***/
private var problemContent = ""
/**答题id*/
private var answerQuestionId = ""
/**最后一题答案*/
private var lastAnswer = ""
private var noMore = false
companion object {
private lateinit var expertInfo: IMExpertBuild
private lateinit var toUid: String
private var isFromQingShu: Int = 0
@JvmStatic
fun start(context: Context, toUid: String, expertInfo: IMExpertBuild, isFromQingShu: Int) {
val starter = Intent(context, CmsExamQuestionPaperActivity::class.java)
this.expertInfo = expertInfo
this.toUid = toUid
this.isFromQingShu = isFromQingShu
context.startActivity(starter)
}
}
override fun layoutResId(): Int {
return R.layout.im_view_question_infomation
}
override fun initDataAndEvent() {
// if (isJumpToIm()) {
// //如果今天打过题,跳转到聊天界面
// skipToIm()
// return
// }
//初始化
initRecycle()
//设置view事件
addVIewListener()
//-------------请求数据----------------
preExamQuestionPaper()
}
private fun initRecycle() {
val linearLayoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
recycle.layoutManager = linearLayoutManager
mQuestionAdapter = QuestionAdapter(mData)
recycle.adapter = mQuestionAdapter
mQuestionAdapter.setOneCheckListener(object : QuestionOneCheckListener {
override fun itemClick(list: List<OptionsBean>, question: QuestionsBean) {
answerItemClick(list, question, "")
}
override fun showOtherEdit(list: List<OptionsBean>, question: QuestionsBean) {
otherOptionsList.clear()
otherOptionsList.addAll(list)
otherQuestionsBean = question
//显示输入框
cl_input.visibility = LinearLayout.VISIBLE
tv_problem.visibility = LinearLayout.VISIBLE
hsv_problem_tips.visibility = LinearLayout.GONE
var problem = "已选:"
list.forEach {
problem += "# " + it.name
}
tv_problem.text = problem
et_input_problem.hint = "请输入其他事件......"
// 打开软件盘
showInputMethod(et_input_problem)
// 滚动到底部
Handler().postDelayed({
recycle.scrollToPosition(mData.size - 1)
}, 500L)
}
override fun hideOtherEdit() {
//隐藏其他软键盘
et_input_problem.setText("")
cl_input.visibility = LinearLayout.GONE
hideInputMethod(et_input_problem)
}
})
mQuestionAdapter.setOnItemChildClickListener { adapter, view, position ->
if (view.id == R.id.tv_notes) {
//如何描述点击事件 ,展开后滑动到列表底部
mQuestionAdapter.data[position].type5Open = true
mQuestionAdapter.notifyDataSetChanged()
recycle.smoothScrollToPosition(mQuestionAdapter.data.size)
}
}
recycle.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (newState == RecyclerView.SCROLL_STATE_DRAGGING && mData.size > 0) {
//监听滑动 如果是
for ((index, item) in mData.withIndex()) {
if (item.viewType == 5 && item.type5Open) {
mQuestionAdapter.data[index].type5Open = false
mQuestionAdapter.notifyItemChanged(index)
}
}
}
}
})
}
/**添加view事件*/
private fun addVIewListener() {
tv_skip.setOnClickListener {
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
showSkipDialog()
}
tv_finish.setOnClickListener {
}
tv_send.setOnClickListener {
if (noMore) {
//最后一题 点击发送
lastAnswer = et_input_problem.text.toString()
tv_finish.visibility = View.VISIBLE
} else {
//答题过程中点击 其他的弹窗
otherQuestionsBean?.let { it1 ->
answerItemClick(
otherOptionsList,
it1, et_input_problem.text.toString()
)
}
}
et_input_problem.setText("")
hideInputMethod(et_input_problem)
//隐藏输入框
cl_input.visibility = LinearLayout.GONE
}
tv_cur_problem.setOnClickListener {
problemContent = et_input_problem.text.toString()
et_input_problem.setText("$problemContent${tv_cur_problem.text}:\n")
et_input_problem.setSelection(et_input_problem.text.toString().length - 1)
recycle.smoothScrollToPosition(mData.size - 1)
}
tv_duration.setOnClickListener {
problemContent = et_input_problem.text.toString()
et_input_problem.setText("$problemContent\n${tv_duration.text}:\n")
et_input_problem.setSelection(et_input_problem.text.toString().length - 1)
recycle.smoothScrollToPosition(mData.size - 1)
}
tv_problem_impact.setOnClickListener {
problemContent = et_input_problem.text.toString()
et_input_problem.setText("$problemContent\n${tv_problem_impact.text}:\n")
et_input_problem.setSelection(et_input_problem.text.toString().length - 1)
recycle.smoothScrollToPosition(mData.size - 1)
}
et_input_problem.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(p0: Editable?) {
// 动态监听输入行数大于等于4行,滚动列表到底部
if (et_input_problem.lineCount >= 3 && recycle.canScrollVertically(1)) {
recycle.smoothScrollToPosition(mData.size - 1)
}
}
override fun beforeTextChanged(p0: CharSequence, p1: Int, p2: Int, p3: Int) {
}
override fun onTextChanged(char: CharSequence, p1: Int, p2: Int, p3: Int) {
if (char.isNotEmpty()) {
if (char.contains("\n")) {
val s = char.toString().replace("\n", "")
if (TextUtils.isEmpty(s)) {
tv_send.visibility = LinearLayout.GONE
et_input_problem.setText("")
} else {
tv_send.visibility = LinearLayout.VISIBLE
}
} else {
tv_send.visibility = LinearLayout.VISIBLE
}
} else {
tv_send.visibility = LinearLayout.GONE
}
}
})
// 监听键盘状态
SoftKeyBoardListener.setListener(mContext,
object : SoftKeyBoardListener.OnSoftKeyBoardChangeListener {
override fun keyBoardShow(height: Int) {
recycle.scrollToPosition(mData.size - 1)
}
override fun keyBoardHide(height: Int) {
}
})
recycle.setOnTouchListener { _: View?, event: MotionEvent ->
when (event.action) {
MotionEvent.ACTION_DOWN -> {
// 手势按下空白处的时候检测软件盘是否弹出
if (isShouldHideInput(et_input_problem, event)) {
hideInputMethod(et_input_problem)
}
true
}
MotionEvent.ACTION_CANCEL, MotionEvent.ACTION_UP -> {
false
}
else -> {
false
}
}
}
}
/**
* 回答问题
* @param otherInput 点击替他输入内容
* */
private fun answerItemClick(
list: List<OptionsBean>,
question: QuestionsBean,
otherInput: String
) {
//发送回答问题信息
sendAnswerText(list, otherInput)
//回答问题
anserQuestion(question, list, otherInput)
//获取下一题
getNextQuestion(question, list)
//清除其他选项的数据
otherOptionsList.clear()
otherQuestionsBean = null
}
/**
* 获取下一题
* @param question 回答的问题
* @param list 回答选择的选项
* */
private fun getNextQuestion(
question: QuestionsBean,
list: List<OptionsBean>
) {
//寻找下一题
val questionMultiItem2 = QuestionMultiItem()
// 使用问题questionId 去questionChains取到选项配置
val options = mQuestionBean!!.questionPaper.questionChains[question.id]?.options
// 通过选择第一个选项的id 从配置里找到下一题id
val nextQuestionId = options?.get(list[0].id)
//使用下一题nextQuestionId 取到题
val questionsBean = mQuestionBean!!.questionPaper.questions[nextQuestionId]
if (questionsBean != null) {
//还有下一题
questionMultiItem2.questionsBean = questionsBean
if ("radio" == questionsBean.type) {
questionMultiItem2.viewType = 3
} else {
questionMultiItem2.viewType = 4
questionMultiItem2.type4CanClick = true
}
mData.add(questionMultiItem2)
} else {
//没有下一题了,展示描述题
val questionMultiItem5 = QuestionMultiItem()
questionMultiItem5.type5Bean = mQuestionBean!!.questions[1]
questionMultiItem5.viewType = 5
mData.add(questionMultiItem5)
//最后一提,
noMore = true
//显示输入框
cl_input.visibility = LinearLayout.VISIBLE
tv_problem.visibility = LinearLayout.GONE
hsv_problem_tips.visibility = LinearLayout.VISIBLE
et_input_problem.hint = "请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod(et_input_problem)
// 滚动到底部
Handler().postDelayed({
recycle.scrollToPosition(mData.size - 1)
}, 500L)
}
mQuestionAdapter.notifyDataSetChanged()
recycle.scrollToPosition(mData.size - 1)
}
/**
* 创建回答问题 并刷新多选状态为不可选
* @param otherInput 点击其他输入文字
* */
private fun sendAnswerText(list: List<OptionsBean>, otherInput: String) {
var answerStr = ""
list.forEach {
if (answerStr.isNotEmpty()) {
answerStr = if ("其他" == it.name) {
"$answerStr、$otherInput"
} else {
answerStr + "、" + it.name
}
} else {
answerStr += if ("其他" == it.name) {
otherInput
} else {
it.name
}
}
}
val questionMultiItem = QuestionMultiItem()
questionMultiItem.type2Text = answerStr
questionMultiItem.viewType = 2
mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged()
//刷新已回答问题,将多选设置成不可再选
mData.forEachIndexed { index, _ ->
mData[index].type4CanClick = false
}
}
/**
* 回答单选问题
* @param question 问题
* @param list 选中回答的选项list
* @param otherInput 其他输入的内容
* */
@SuppressLint("CheckResult")
private fun anserQuestion(
question: QuestionsBean,
list: List<OptionsBean>,
otherInput: String
) {
val answerQuestionRequestBean = AnswerQuestionRequestBean()
answerQuestionRequestBean.examId = answerQuestionId
answerQuestionRequestBean.questionId = question.id
answerQuestionRequestBean.questionPaperId = question.questionPaperId
answerQuestionRequestBean.uid = ImIn.getUserInfo()?.uid
var answersBeanList = ArrayList<AnswersBean>()
for (optionsBean in list) {
var answersBean = AnswersBean()
answersBean.name = optionsBean.name
answersBean.optionId = optionsBean.id
answersBean.relates = optionsBean.relates
if ("其他" == optionsBean.name && otherInput.isNotEmpty()) {
answersBean.other = otherInput
}
answersBeanList.add(answersBean)
}
answerQuestionRequestBean.answers = answersBeanList
val type70RequestBean = AnswerQuestionType70RequestBean()
type70RequestBean.data = answerQuestionRequestBean
//添加回答数据到
mType70RequestList.add(type70RequestBean)
instance.answerQuestion(answerQuestionId, JSON.toJSONString(answerQuestionRequestBean))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe()
//滑动到底部
recycle.scrollToPosition(mData.size - 1)
}
/**
* 获取试题
* */
@SuppressLint("CheckResult")
fun preExamQuestionPaper() {
instance.preExamQuestionPaper()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
if (resp.data != null) {
mQuestionBean = resp.data
//设置数据,清空list数据
mData.clear()
//取到问候语
getFirstQuestion(resp.data)
//取出第二条消息
setSecondQuestion()
createExams()
} else {
//无答题数据,跳转到聊天界面
IMChatUtil.startChatSessionByCms(
toUid, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
}
}, {
//接口请求报错,跳转到聊天页面
IMChatUtil.startChatSessionByCms(
toUid, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
})
}
@SuppressLint("CheckResult")
private fun createExams() {
val createExamsRequestBean =
CreateExamsRequestBean()
createExamsRequestBean.name = mQuestionBean?.questionPaper?.name
createExamsRequestBean.questionPaperId = mQuestionBean?.questionPaper?.id
createExamsRequestBean.type = "first_entry_lingxi"
createExamsRequestBean.uid = ImIn.getUserInfo()?.uid
instance.createEexams(JSON.toJSONString(createExamsRequestBean))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
if (resp.data != null) {
answerQuestionId = resp.data
} else {
//未获取到答题id跳转到聊天页面
skipToIm()
}
}, {
//获取到答题id错误,跳转到聊天页面
skipToIm()
})
}
/***取到问候语*/
private fun getFirstQuestion(questionInfo: QuestionsInfoBean) {
val questionMultiItem = QuestionMultiItem()
questionMultiItem.type1Text = questionInfo.questions[0].question
questionMultiItem.viewType = 1
mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged()
}
/***问候语之后第一道题*/
private fun setSecondQuestion() {
val questionMultiItem2 = QuestionMultiItem()
mQuestionBean!!.questionPaper.questionChains.forEach { (k, v) ->
if (v.head) {
// 代表第一题 ,使用questionId 去questions取到对应的提
val questionsBean = mQuestionBean!!.questionPaper.questions[v.questionId]
questionMultiItem2.questionsBean = questionsBean
if ("radio" == questionsBean?.type) {
questionMultiItem2.viewType = 3
} else {
questionMultiItem2.viewType = 4
questionMultiItem2.type4CanClick = true
}
mData.add(questionMultiItem2)
mQuestionAdapter.notifyDataSetChanged()
return@forEach
}
}
}
/***
* 判断今天是否展示过
* */
private fun isJumpToIm(): Boolean {
val time =
Calendar.getInstance()[Calendar.YEAR].toString() + "-" + Calendar.getInstance()[Calendar.MONTH] + Calendar.getInstance()[Calendar.DAY_OF_MONTH]
return TextUtils.equals(
time,
SharedPreferencesEditor.getString("skip_time_" + ImIn.getUserInfo()?.uid)
)
}
/**
* 跳过填写dialog
* */
private fun showSkipDialog() {
if (dialog == null) {
dialog = CommonDialog.create(mContext)
.setLeftOnclick("下次吧") {
skipToIm()
}
.setRightClick("继续填写") {
dialog!!.dismiss()
}
.setMessage("这个过程可以帮助您更快地改变当前的现状,确定要跳过吗?")
.setTitle_color(R.color.im_color_242424)
.setCancelAble(true)
}
if (!dialog!!.isShowing) {
dialog!!.show()
}
}
/**
* 跳过,直接取IM界面
* */
private fun skipToIm() {
IMChatUtil.startChatSessionByCms(
toUid, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
finish()
}
// 隐藏键盘布局
private fun hideInputMethod(et: EditText) {
val imm = mContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(et.windowToken, 0)
et.clearFocus()
}
// 显示键盘布局
private fun showInputMethod(editTextMessage: EditText) {
editTextMessage.requestFocus()
val imm = mContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(editTextMessage, 0)
}
/**
* 判断软键盘是否需要隐藏
* @param v
* @param event
* @return
*/
private fun isShouldHideInput(v: View?, event: MotionEvent): Boolean {
if (v != null && v is EditText) {
val leftTop = intArrayOf(0, 0)
//获取输入框当前的location位置
v.getLocationInWindow(leftTop)
val left = leftTop[0]
val top = leftTop[1]
val bottom = top + v.getHeight()
val right = left + v.getWidth()
return !(event.x > left && event.x < right && event.y > top && event.y < bottom)
}
return false
}
}
\ No newline at end of file
......@@ -4,10 +4,10 @@ import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import android.view.View
import android.view.WindowManager
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.netease.nimlib.sdk.NIMClient
......@@ -51,7 +51,7 @@ import java.util.concurrent.TimeUnit
@Route(path = "/im/im")
class NewMultiMessageFragment : BaseFragment() {
private lateinit var mContext:Context
private lateinit var mContext: Context
private var defaultTranslateX: Float? = null
private var mFragmentsList: ArrayList<Fragment> = ArrayList(3)
private var chatSettingPopupWindow: ChatSettingPopupWindow? = null //右上角弹框
......@@ -83,12 +83,18 @@ class NewMultiMessageFragment : BaseFragment() {
getMsgData()
NIMClient.getService(MsgService::class.java).setChattingAccount(MsgService.MSG_CHATTING_ACCOUNT_NONE, SessionTypeEnum.None)
NIMClient.getService(MsgService::class.java).setChattingAccount(
MsgService.MSG_CHATTING_ACCOUNT_NONE,
SessionTypeEnum.None
)
}
override fun onPause() {
super.onPause()
NIMClient.getService(MsgService::class.java).setChattingAccount(MsgService.MSG_CHATTING_ACCOUNT_NONE, SessionTypeEnum.None)
NIMClient.getService(MsgService::class.java).setChattingAccount(
MsgService.MSG_CHATTING_ACCOUNT_NONE,
SessionTypeEnum.None
)
}
override fun onDestroy() {
......@@ -168,7 +174,8 @@ class NewMultiMessageFragment : BaseFragment() {
*/
fun requestTopUnReadNumber() {
if (ImIn.getUserInfo()?.uid != "0") {
var dis = ImHttpImpl.getInstance().getUnreadMessage(UnreadParam("${ImIn.getUserInfo()?.uid}"))
var dis =
ImHttpImpl.getInstance().getUnreadMessage(UnreadParam("${ImIn.getUserInfo()?.uid}"))
.compose<UnreadMessageBean>(RxUtils.resultJavaData())
.compose(RxUtils.applySchedulers(this))
.subscribe({ it ->
......@@ -206,7 +213,8 @@ class NewMultiMessageFragment : BaseFragment() {
if (bean.interactiveNum > 0) {
interactListUnreadNum = bean.interactiveNum
interact_top_unread_num.visibility = View.VISIBLE
interact_top_unread_num.text = if (bean.interactiveNum > 99) "99+" else "${bean.interactiveNum}"
interact_top_unread_num.text =
if (bean.interactiveNum > 99) "99+" else "${bean.interactiveNum}"
} else {
interact_top_unread_num.visibility = View.GONE
interactListUnreadNum = 0
......@@ -221,7 +229,8 @@ class NewMultiMessageFragment : BaseFragment() {
noticeListUnreadNum = 0
}
MsgReceiveHelper.isHasUnread = chatListUnreadNum > 0 || interactListUnreadNum > 0 || noticeListUnreadNum > 0
MsgReceiveHelper.isHasUnread =
chatListUnreadNum > 0 || interactListUnreadNum > 0 || noticeListUnreadNum > 0
// 同步底部导航栏的角标数量
EventBus.getDefault().post(
UpdateBottomBarUnreadNumEvent(
......@@ -238,9 +247,13 @@ class NewMultiMessageFragment : BaseFragment() {
if (!ImIn.isLogin()) {
ToastUtil.toastShort("请登录后再试")
} else {
chatSettingPopupWindow = ChatSettingPopupWindow(mContext, object : ChatSettingPopupWindow.OnChatSettingClickListener {
chatSettingPopupWindow = ChatSettingPopupWindow(
mContext,
object : ChatSettingPopupWindow.OnChatSettingClickListener {
override fun onAllReadClick() {
messageChatSettingtDialog = MessageChatSettingDialog(mContext, object : MessageChatSettingDialog.OnMessageChatSettingDialog {
messageChatSettingtDialog = MessageChatSettingDialog(
mContext,
object : MessageChatSettingDialog.OnMessageChatSettingDialog {
override fun onSure() {
markAllMessageRead()
messageChatSettingtDialog?.dismiss()
......@@ -265,10 +278,17 @@ class NewMultiMessageFragment : BaseFragment() {
setWindowBg(1f)
}
})
chatSettingPopupWindow?.contentView!!.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); //这句代码必须要才能获得正确的popupwindow的宽度
chatSettingPopupWindow?.contentView!!.measure(
View.MeasureSpec.UNSPECIFIED,
View.MeasureSpec.UNSPECIFIED
); //这句代码必须要才能获得正确的popupwindow的宽度
val popupWindowWidth = chatSettingPopupWindow?.contentView!!.measuredWidth
setWindowBg(0.4f)
chatSettingPopupWindow?.showAsDropDown(ll_more, -(popupWindowWidth - ll_more.measuredWidth + 20), 0)
chatSettingPopupWindow?.showAsDropDown(
ll_more,
-(popupWindowWidth - ll_more.measuredWidth + 20),
0
)
}
}
}
......@@ -277,7 +297,12 @@ class NewMultiMessageFragment : BaseFragment() {
* 全部已读(私聊是单独处理的)
*/
fun markAllMessageRead() {
var dis = ImHttpImpl.getInstance().clearMessage(ClearMessageParam("${ImIn.getUserInfo()?.uid}", "1"))
var dis = ImHttpImpl.getInstance().clearMessage(
ClearMessageParam(
"${ImIn.getUserInfo()?.uid}",
"1"
)
)
.compose(RxUtils.applySchedulers(this))
.subscribe({ it ->
if (it.data) {
......@@ -300,13 +325,13 @@ class NewMultiMessageFragment : BaseFragment() {
ll_kefu.setOnClickListener {
if (ImIn.isLogin()) {
SessionHelper.startP2PSession(context, -1, ImConstants.KEFUXIAOYI, null,
P2PCustomActionHandlerImpl(ImConstants.KEFUXIAOYI, "客服小壹", ImConstants.KEFUXIAOYI))
P2PCustomActionHandlerImpl(ImConstants.KEFUXIAOYI, "客服小壹", ImConstants.KEFUXIAOYI)
)
} else {
ToastUtil.toastShort("请登录后再试")
}
}
}
/**
* 设置页面背景色
*/
......@@ -368,7 +393,12 @@ class NewMultiMessageFragment : BaseFragment() {
*/
private fun setLeftMargin(index: Int) {
val currentTranslateX = custom_indicator.translationX
var anim = ObjectAnimator.ofFloat(custom_indicator, "translationX", currentTranslateX, defaultTranslateX!! + index * chat_btn.width)
var anim = ObjectAnimator.ofFloat(
custom_indicator,
"translationX",
currentTranslateX,
defaultTranslateX!! + index * chat_btn.width
)
anim.duration = 300
anim.start()
}
......
package com.yidianling.listener;
import android.app.Activity;
import android.graphics.Rect;
import android.view.View;
/**
* Created by Ykai on 2020/9/11.
*
* 键盘打开关闭监听类
*/
public class SoftKeyBoardListener {
private View rootView; //activity的根视图
int rootViewVisibleHeight; //纪录根视图的显示高度
private OnSoftKeyBoardChangeListener onSoftKeyBoardChangeListener;
public SoftKeyBoardListener(Activity activity) {
//获取activity的根视图
rootView = activity.getWindow().getDecorView();
//监听视图树中全局布局发生改变或者视图树中的某个视图的可视状态发生改变
rootView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
//获取当前根视图在屏幕上显示的大小
Rect r = new Rect();
rootView.getWindowVisibleDisplayFrame(r);
int visibleHeight = r.height();
System.out.println("" + visibleHeight);
if (rootViewVisibleHeight == 0) {
rootViewVisibleHeight = visibleHeight;
return;
}
//根视图显示高度没有变化,可以看作软键盘显示/隐藏状态没有改变
if (rootViewVisibleHeight == visibleHeight) {
return;
}
//根视图显示高度变小超过200,可以看作软键盘显示了
if (rootViewVisibleHeight - visibleHeight > 200) {
if (onSoftKeyBoardChangeListener != null) {
onSoftKeyBoardChangeListener.keyBoardShow(rootViewVisibleHeight - visibleHeight);
}
rootViewVisibleHeight = visibleHeight;
return;
}
//根视图显示高度变大超过200,可以看作软键盘隐藏了
if (visibleHeight - rootViewVisibleHeight > 200) {
if (onSoftKeyBoardChangeListener != null) {
onSoftKeyBoardChangeListener.keyBoardHide(visibleHeight - rootViewVisibleHeight);
}
rootViewVisibleHeight = visibleHeight;
}
});
}
private void setOnSoftKeyBoardChangeListener(OnSoftKeyBoardChangeListener onSoftKeyBoardChangeListener) {
this.onSoftKeyBoardChangeListener = onSoftKeyBoardChangeListener;
}
public interface OnSoftKeyBoardChangeListener {
void keyBoardShow(int height);
void keyBoardHide(int height);
}
public static void setListener(Activity activity, OnSoftKeyBoardChangeListener onSoftKeyBoardChangeListener) {
SoftKeyBoardListener softKeyBoardListener = new SoftKeyBoardListener(activity);
softKeyBoardListener.setOnSoftKeyBoardChangeListener(onSoftKeyBoardChangeListener);
}
}
......@@ -88,7 +88,6 @@ import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper;
import com.yidianling.uikit.business.session.module.input.InputPanel;
import com.yidianling.uikit.business.session.module.list.MessageListPanelEx;
import com.yidianling.uikit.business.session.view.ChatPrivateTips;
import com.yidianling.uikit.business.session.view.CollectInfoPopupWindow;
import com.yidianling.uikit.business.session.view.CommonQuestionView;
import com.yidianling.uikit.business.session.view.ImCommentBannerView;
import com.yidianling.uikit.business.session.view.ImRedStarGradeView;
......@@ -97,7 +96,6 @@ import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
import com.yidianling.uikit.custom.http.ServiceImpl;
import com.yidianling.uikit.custom.http.response.CommonQuestionBean;
import com.yidianling.uikit.custom.http.response.NewUserMesBean;
import com.yidianling.uikit.custom.http.response.SubmitUserInfoBean;
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean;
import com.yidianling.uikit.custom.widget.ConfideOrderInfoView;
import com.yidianling.uikit.custom.widget.ExpertInfoDialog;
......@@ -169,7 +167,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private int timeCount = 0;
protected AitManager aitManager;
private CollectInfoPopupWindow collectInfoPopupWindow;
private CircleImageView small_head_img; //小头像
private TextView help_num_tv; //帮助人数
......@@ -315,7 +312,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private void initView() {
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) {
/* rl_common_question_enter.setOnClickListener(v -> {
//助理
/*rl_common_question_enter.setOnClickListener(v -> {
rl_common_question_enter.setOnClickListener(v -> {
if (commonQuestionBeanList != null && commonQuestionBeanList.size() > 0) {
openOrCloseCommonQuestionLayout(true);
} else {
......@@ -329,54 +328,18 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
try {
YdlBuryPointUtil.sendPv("common_question_pager");
} catch (Exception e) {
e.printStackTrace();
}
getCommonQuestionListData();
}
ChatStatusCacheHelper.clearDataByKey("chatEvent");
}
if (ChatStatusCacheHelper.getStatusCache("collectEvent")) {
String time = Calendar.getInstance().get(Calendar.YEAR) + "-" + Calendar.getInstance().get(Calendar.MONTH) + Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()))) {
collectInfoPopupWindow = new CollectInfoPopupWindow(getActivity(), new CollectInfoPopupWindow.OnSendMsgListener() {
@Override
public void sendMsg(@NotNull String content, @NotNull List<UserQuestInfoBean> result) {
if (TextUtils.isEmpty(content)) {//点击跳过后当天不再显示此弹窗
SharedPreferencesEditor.putString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()
, time);
} else {
IMMessage textMessage = MessageBuilder.createTextMessage(sessionId, sessionType, content);
if (sendMessage(textMessage)) {
openOrCloseCommonQuestionLayout(false);
}
submitUserCollect(result);
}
}
@Override
public void finishPage() {
getActivity().finish();
}
});
getUserInfoCollect();
if (!getActivity().isFinishing()) {
try {
YdlBuryPointUtil.sendPv("user_collect_pager");
} catch (Exception e) {
}
collectInfoPopupWindow.show(top_expert_info_cl);
}
}
ChatStatusCacheHelper.clearDataByKey("collectEvent");
}
}
//有未完成订单或者有未评价订单时,显示订单布局
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
if (ActionHandlerStorage.getL(sessionId).getInfo().hasAvailableListenOrder == 2 || ActionHandlerStorage.getL(sessionId).getInfo().listenOrderCommentStatus == 1) {
//2专家 1用户
ConfideOrderInfoView confideOrderInfoView = new ConfideOrderInfoView(getContext(), sessionId);
confideOrderInfoView.setData(ActionHandlerStorage.getL(sessionId).getInfo());
rl_contain.addView(confideOrderInfoView);
......@@ -1553,46 +1516,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
});
}
@SuppressLint("CheckResult")
private void getUserInfoCollect() {
ServiceImpl.Companion.getInstance().userCollectList()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
if (resp.data != null && resp.data.size() > 0) {
ServiceImpl.Companion.getInstance().getNewUserMes(new NewUserMesBean(""))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(hasCollectedInResp -> {
if (hasCollectedInResp.data != null && hasCollectedInResp.data.size() > 0) {
collectInfoPopupWindow.setData(resp.data, hasCollectedInResp.data);
} else {
collectInfoPopupWindow.setData(resp.data, null);
}
}, throwable -> {
collectInfoPopupWindow.setData(resp.data, null);
});
} else {
collectInfoPopupWindow.dismiss();
}
}, throwable -> {
collectInfoPopupWindow.dismiss();
});
}
@SuppressLint("CheckResult")
private void submitUserCollect(List<UserQuestInfoBean> result) {
SubmitUserInfoBean submitUserInfoBean = new SubmitUserInfoBean();
submitUserInfoBean.userInfoList = result;
ServiceImpl.Companion.getInstance().submitUserCollect(JSON.toJSONString(submitUserInfoBean))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
}, throwable -> {
});
}
private void showCheckAgeDialog() {
CommonDialog.create(getActivity())
.setLeftOnclick("返回", v -> {
......
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import com.yidianling.common.tools.ToastUtil
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/10
*/
class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListener) :
PopupWindow(mContext) {
private var collectUserInformationView: CollectUserInformationView
private var isFromBack = true
init {
height = ViewGroup.LayoutParams.MATCH_PARENT
width = ViewGroup.LayoutParams.MATCH_PARENT
setBackgroundDrawable(BitmapDrawable())
collectUserInformationView = CollectUserInformationView(mContext, {
listener.sendMsg("", ArrayList())
isFromBack = false
dismiss()
}, {
dismiss()
listener.finishPage()
}, { _content, _list ->
listener.sendMsg(_content, _list)
isFromBack = false
dismiss()
})
collectUserInformationView.isFocusableInTouchMode = true
collectUserInformationView.setOnKeyListener { v, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_BACK) {
showSkipDialog()
true
}
false
}
contentView = collectUserInformationView
isFocusable = true
isTouchable = true
isOutsideTouchable = false
}
fun setData(list: List<UserQuestInfoBean>, hasCompleteInfoList: List<UserQuestInfoBean>?) {
if (list.isEmpty()) {
ToastUtil.toastShort("数据异常,请稍后重试")
return
}
collectUserInformationView.setData(list, hasCompleteInfoList)
}
override fun dismiss() {
if (isFromBack) {
showSkipDialog()
isFromBack = false
} else {
super.dismiss()
}
}
private fun showSkipDialog() {
collectUserInformationView.showSkipDialog()
}
fun show(v: View) {
v.post { showAtLocation(v, Gravity.BOTTOM, 0, 0) }
}
interface OnSendMsgListener {
fun sendMsg(content: String, result: List<UserQuestInfoBean>)
fun finishPage()
}
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view.question;
import android.graphics.Color;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ydl.ydl_image.module.GlideApp;
import com.yidianling.avchatkit.AVChatKit;
import com.yidianling.im.R;
import com.yidianling.im.router.ImIn;
import com.yidianling.uikit.custom.http.response.question.OptionsBean;
import java.util.ArrayList;
import java.util.List;
/**
* @author liupeng
*/
public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem, BaseViewHolder> {
/**
* 文字最大数量,大于6个展示单列,小于六个展示双列
*/
private int mTextMaxSize = 6;
private QuestionOneCheckListener mOneCheckListener;
public QuestionAdapter(List<QuestionMultiItem> data) {
super(data);
//左----文字
addItemType(1, R.layout.item_left_text_layout);
//右----文字
addItemType(2, R.layout.item_right_text_layout);
//左----单选
addItemType(3, R.layout.item_left_one_check_layout);
//左----多选
addItemType(4, R.layout.item_left_more_check_layout);
//左----描述题
addItemType(5, R.layout.item_left_describe_layout);
}
@Override
protected void convert(BaseViewHolder helper, QuestionMultiItem item) {
switch (helper.getItemViewType()) {
case 1:
//左文字
helper.setText(R.id.tv_left_text, item.type1Text);
break;
case 2:
//右侧文字
helper.setText(R.id.tv_right_text, item.type2Text);
ImageView iv_header = helper.getView(R.id.iv_header);
String header = ImIn.INSTANCE.getUserInfo().getHead();
if (header != null) {
GlideApp.with(mContext)
.load(header)
.dontAnimate()
.placeholder(R.drawable.platform_head_place_hold_pic)
.error(R.drawable.platform_head_place_hold_pic)
.into(iv_header);
}
break;
case 3:
//单选
convertType3(helper, item);
break;
case 4:
//多选
convertType4(helper, item);
break;
case 5:
helper.setText(R.id.multiple_choice_title, item.type5Bean.question);
helper.setText(R.id.example, item.type5Bean.example);
SpannableString spannableString = new SpannableString(mContext.getResources().getString(R.string.question_notes));
spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#1DA1F2")), 28, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
helper.setText(R.id.tv_notes, spannableString);
View type5_line = helper.getView(R.id.type5_line);
TextView example = helper.getView(R.id.example);
if (example.getVisibility() == View.GONE) {
type5_line.setVisibility(View.VISIBLE);
example.setVisibility(View.VISIBLE);
} else {
type5_line.setVisibility(View.GONE);
example.setVisibility(View.GONE);
}
if (item.type5Open) {
type5_line.setVisibility(View.VISIBLE);
example.setVisibility(View.VISIBLE);
} else {
type5_line.setVisibility(View.GONE);
example.setVisibility(View.GONE);
}
helper.addOnClickListener(R.id.tv_notes);
break;
default:
break;
}
}
/**
* 多选
*/
private void convertType4(BaseViewHolder helper, QuestionMultiItem item) {
RecyclerView moreRecycle = helper.getView(R.id.tv_more_list);
TextView tv_more_define = helper.getView(R.id.tv_more_define);
TextView moreTitle = helper.getView(R.id.more_title);
moreTitle.setText(item.questionsBean.name);
int moreMaxSize = 0;
for (OptionsBean option : item.questionsBean.options) {
int length = option.name.length();
if (length > mTextMaxSize) {
moreMaxSize = length;
break;
} else if (moreMaxSize < length) {
moreMaxSize = option.name.length();
}
}
GridLayoutManager moreLayoutManager = new GridLayoutManager(AVChatKit.getContext(), moreMaxSize > mTextMaxSize ? 1 : 2);
moreRecycle.setLayoutManager(moreLayoutManager);
QuestionOneCheckAdapter moreCheckAdapter = new QuestionOneCheckAdapter(item.questionsBean.options);
moreRecycle.setAdapter(moreCheckAdapter);
if (getCheckOptionsBeans(moreCheckAdapter).size() > 0) {
tv_more_define.setBackground(ContextCompat.getDrawable(mContext, item.type4CanClick ? R.drawable.im_background_18dp_1da1f2 : R.drawable.im_background_18dp_ebebeb));
tv_more_define.setEnabled(item.type4CanClick);
tv_more_define.setText("确定(" + getCheckOptionsBeans(moreCheckAdapter).size() + ")");
} else {
tv_more_define.setBackground(ContextCompat.getDrawable(mContext, R.drawable.im_background_18dp_ebebeb));
tv_more_define.setEnabled(false);
tv_more_define.setText("确定");
}
moreCheckAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
if (item.type4CanClick) {
OptionsBean optionsBean = moreCheckAdapter.getData().get(position);
boolean check = optionsBean.check;
if (check) {
moreCheckAdapter.getData().get(position).check = false;
} else {
moreCheckAdapter.getData().get(position).check = true;
}
moreCheckAdapter.notifyDataSetChanged();
if (getCheckOptionsBeans(moreCheckAdapter).size() > 0) {
tv_more_define.setBackground(ContextCompat.getDrawable(mContext, R.drawable.im_background_18dp_1da1f2));
tv_more_define.setEnabled(true);
tv_more_define.setText("确定(" + getCheckOptionsBeans(moreCheckAdapter).size() + ")");
} else {
tv_more_define.setBackground(ContextCompat.getDrawable(mContext, R.drawable.im_background_18dp_ebebeb));
tv_more_define.setEnabled(false);
tv_more_define.setText("确定");
}
if ("其他".equals(optionsBean.name)) {
if (moreCheckAdapter.getData().get(position).check) {
//选中
mOneCheckListener.showOtherEdit(getCheckOptionsBeans(moreCheckAdapter), item.questionsBean);
} else {
//取消选中
mOneCheckListener.hideOtherEdit();
}
return;
}
if (getHaveCheck(moreCheckAdapter)) {
mOneCheckListener.showOtherEdit(getCheckOptionsBeans(moreCheckAdapter), item.questionsBean);
}
}
}
});
tv_more_define.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (item.type4CanClick) {
mOneCheckListener.itemClick(getCheckOptionsBeans(moreCheckAdapter), item.questionsBean);
}
}
});
}
//单选
private void convertType3(BaseViewHolder helper, QuestionMultiItem item) {
RecyclerView OneRecycle = helper.getView(R.id.tv_one_list);
TextView oneTitle = helper.getView(R.id.multiple_choice_title);
oneTitle.setText(item.questionsBean.name);
int oneMaxSize = 0;
for (OptionsBean option : item.questionsBean.options) {
int length = option.name.length();
if (length > mTextMaxSize) {
oneMaxSize = length;
break;
} else if (oneMaxSize < length) {
oneMaxSize = option.name.length();
}
}
GridLayoutManager gridLayoutManager = new GridLayoutManager(AVChatKit.getContext(), oneMaxSize > mTextMaxSize ? 1 : 2);
OneRecycle.setLayoutManager(gridLayoutManager);
QuestionOneCheckAdapter oneCheckAdapter = new QuestionOneCheckAdapter(item.questionsBean.options);
OneRecycle.setAdapter(oneCheckAdapter);
oneCheckAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
List<OptionsBean> data = oneCheckAdapter.getData();
for (OptionsBean datum : data) {
if (datum.check) {
//如果已有选项被选择,择不触发后续事件
return;
}
}
oneCheckAdapter.getData().get(position).check = true;
if ("其他".equals(data.get(position).name)) {
//如果选项是其他,发送其他数据 展示其他输入框
mOneCheckListener.showOtherEdit(getCheckOptionsBeans(oneCheckAdapter), item.questionsBean);
} else {
oneCheckAdapter.notifyDataSetChanged();
List<OptionsBean> list = new ArrayList();
list.add(data.get(position));
mOneCheckListener.itemClick(list, item.questionsBean);
}
}
});
}
/**
* 获取选中选项
*/
private List<OptionsBean> getCheckOptionsBeans(QuestionOneCheckAdapter checkAdapter) {
List<OptionsBean> data = checkAdapter.getData();
List<OptionsBean> checkList = new ArrayList();
for (OptionsBean datum : data) {
if (datum.check) {
checkList.add(datum);
}
}
return checkList;
}
/**
* 获取单选按钮其他是否选中
*/
private boolean getHaveCheck(QuestionOneCheckAdapter checkAdapter) {
List<OptionsBean> data = checkAdapter.getData();
for (OptionsBean datum : data) {
if (datum.check && "其他".equals(datum.name)) {
return true;
}
}
return false;
}
public void setOneCheckListener(QuestionOneCheckListener listener) {
this.mOneCheckListener = listener;
}
}
package com.yidianling.uikit.business.session.view.question;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.yidianling.uikit.custom.http.response.question.QuestionsBean;
import com.yidianling.uikit.custom.http.response.question.QuestionsBeanExample;
/**
* @author liupeng
*/
public class QuestionMultiItem implements MultiItemEntity {
public int viewType;
public String type1Text;
public String type2Text;
/***type 3 单选 type 4 多选 */
public QuestionsBean questionsBean;
public boolean type4CanClick;
/**
* type5
*/
public QuestionsBeanExample type5Bean;
/***type5 展开or 收起*/
public boolean type5Open = true;
@Override
public int getItemType() {
return viewType;
}
}
package com.yidianling.uikit.business.session.view.question;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yidianling.im.R;
import com.yidianling.uikit.custom.http.response.question.OptionsBean;
import java.util.List;
public class QuestionOneCheckAdapter extends BaseQuickAdapter<OptionsBean, BaseViewHolder> {
public QuestionOneCheckAdapter(@Nullable List<OptionsBean> data) {
super(R.layout.left_one_check_layout_item,data);
}
@Override
protected void convert(BaseViewHolder helper, OptionsBean item) {
TextView tv_which_question= helper.getView(R.id.tv_which_question);
tv_which_question.setText(item.name);
if (item.check){
tv_which_question.setBackground(ContextCompat.getDrawable(mContext, R.drawable.im_background_18dp_1da1f2));
tv_which_question.setTextColor(ContextCompat.getColor(mContext, R.color.white));
}else {
tv_which_question.setBackground(ContextCompat.getDrawable(mContext, R.drawable.im_background_18dp_e8f5fe));
tv_which_question.setTextColor(ContextCompat.getColor(mContext, R.color.platform_color_1DA1F2));
}
}
}
package com.yidianling.uikit.business.session.view.question
import com.yidianling.uikit.custom.http.response.question.OptionsBean
import com.yidianling.uikit.custom.http.response.question.QuestionsBean
interface QuestionOneCheckListener {
/**
* 单选点击 多选确定按钮点击获取item信息
*/
fun itemClick(bean: List<OptionsBean>, question: QuestionsBean)
/**
* 展示其他
*/
fun showOtherEdit(list: List<OptionsBean>, question: QuestionsBean)
/**
* 隐藏其他
*/
fun hideOtherEdit()
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.uikit.custom.http.response.*
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*
......@@ -67,7 +68,10 @@ interface ServiceApi {
//关注
@GET("consult/expert-page/toggle-follow")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun focus(@Query("doctorId") doctorId: String, @Query("status") status: String): Observable<BaseAPIResponse<Any>>
fun focus(
@Query("doctorId") doctorId: String,
@Query("status") status: String
): Observable<BaseAPIResponse<Any>>
//服务列表
@GET("consult/expert-page/nproducts")
......@@ -83,7 +87,32 @@ interface ServiceApi {
//获取代运营关联的专家的信息
@GET("chat/get-source-doctor")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
//注意:这个接口返回的还有很多字段,但是暂时不需要,就先取这两个字段
fun getSourceDoctor(
@Query("scene") scene: Int,
@Query("userUid") userUid: String,
@Query("assistantUid") assistantUid: String
): Observable<BaseAPIResponse<SourceDoctorInfoBean>>
//新版前置信息收集 客户端灵犀信息收集卡题库
@GET("cms/exam/api/v1/exams/lingxi/pre-exam-question-paper")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
//注意:这个接口返回的还有很多字段,但是暂时不需要,就先取这两个字段
fun getSourceDoctor(@Query("scene") scene: Int,@Query("userUid") userUid: String,@Query("assistantUid") assistantUid: String): Observable<BaseAPIResponse<SourceDoctorInfoBean>>
fun preExamQuestionPaper(): Observable<BaseAPIResponse<QuestionsInfoBean>>
//创建答题信息
@POST("cms/exam/api/v1/exams")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun createEexams(@Body body: RequestBody): Observable<BaseAPIResponse<String>>
//答题
@POST("cms/exam/api/v1/exams/{id}/lingxi/answer-question")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun answerQuestion(
@Path("id") id: String,
@Body body: RequestBody
): Observable<BaseAPIResponse<String>>
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.uikit.custom.http.response.*
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody
......@@ -65,6 +66,13 @@ class ServiceImpl private constructor() {
}
/**
* 信息采集的问题新版
*/
fun preExamQuestionPaper(): Observable<BaseAPIResponse<QuestionsInfoBean>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).preExamQuestionPaper()
}
/**
* 获取新用户收集的信息
*/
fun getNewUserMes(bean: NewUserMesBean): Observable<BaseAPIResponse<List<UserQuestInfoBean>>> {
......@@ -117,10 +125,36 @@ class ServiceImpl private constructor() {
/**
* 获取代运营关联的专家的信息
* 客户端灵犀信息收集卡题库
*/
fun getSourceDoctor(userUid: String, assistantUid: String): Observable<BaseAPIResponse<SourceDoctorInfoBean>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getSourceDoctor(1, userUid, assistantUid)
fun getSourceDoctor(
userUid: String,
assistantUid: String
): Observable<BaseAPIResponse<SourceDoctorInfoBean>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java)
.getSourceDoctor(1, userUid, assistantUid)
}
/**
* 创建答题信息
*/
fun createEexams(params: String): Observable<BaseAPIResponse<String>> {
val body = RequestBody.create(
MediaType.parse("application/json; charset=utf-8"),
params
) as RequestBody
return YDLHttpUtils.obtainApi(ServiceApi::class.java).createEexams(body)
}
/**
* 回答问题
*/
fun answerQuestion(id: String, params: String): Observable<BaseAPIResponse<String>> {
val body = RequestBody.create(
MediaType.parse("application/json; charset=utf-8"),
params
) as RequestBody
return YDLHttpUtils.obtainApi(ServiceApi::class.java).answerQuestion(id, body)
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.http.response.question;
import java.util.List;
/**
* 回答问题bean
*
* @author liupeng
*/
public class AnswerQuestionRequestBean {
/**
* questionPaperId : 601128023407726592
* type : adviser_pre_diagnosis
* name : 灵犀用户首次问诊信息收集卡
* dataId : 13131313
* uid : 1313
*/
public String examId;
public String questionPaperId;
public String uid;
public String questionId;
public List<AnswersBean> answers;
}
package com.yidianling.uikit.custom.http.response.question;
/**
* @author liupeng
* <p>
* 测试前置-回答消息(区分其他类型与主诉类型)
* 用户APP -》灵犀
* type 70
* <p>
* 地址 https://note.youdao.com/ynoteshare1/index.html?id=ac018cb5b65b7d5fc5e961410b14621a&type=note
*/
public class AnswerQuestionType70RequestBean {
public String type = "70";
public AnswerQuestionRequestBean data;
}
package com.yidianling.uikit.custom.http.response.question;
import java.util.List;
/**
* @author liupeng
*/
public class AnswersBean {
public String optionId;
public String name;
public String other;
public List<RelatesBean> relates;
}
package com.yidianling.uikit.custom.http.response.question;
public class CreateExamsRequestBean {
/**
* questionPaperId : 601128023407726592
* type : adviser_pre_diagnosis
* name : 灵犀用户首次问诊信息收集卡
* dataId : 13131313
* uid : 1313
*/
public String questionPaperId;
public String type;
public String name;
public String uid;
}
package com.yidianling.uikit.custom.http.response.question;
import java.util.List;
public class OptionsBean {
/**
* id : 601128318544121856
* name : 1~3 个月
* relates : [{"category":"症状","name":"幻觉"}]
*/
public String id;
public String name;
public List<RelatesBean> relates;
public boolean check;
}
package com.yidianling.uikit.custom.http.response.question;
import java.util.Map;
public class QuestionChainsBean {
/**
* id : 601145789934211072
* create_time : 2021-06-12 17:39:50
* update_time : 2021-06-12 17:41:31
* question_paper_id : 601128023407726592
* question_id : 601128318581870592
* head : true
* options : {"601128318544121856":"601128931717812224"}
*/
public String id;
public String createTime;
public String updateTime;
public String isDeleted;
public String questionPaperId;
public String questionId;
public boolean head;
public Map<String, String> options;
}
package com.yidianling.uikit.custom.http.response.question;
import java.util.Map;
public class QuestionPaperBean {
public String id;
public String createTime;
public String updateTime;
public int isDeleted;
public String category;
public String name;
public String cateId;
public String cateName;
public int questionNum;
public int status;
public String remark;
public Map<String, QuestionChainsBean> questionChains;
public Map<String, QuestionsBean> questions;
}
package com.yidianling.uikit.custom.http.response.question;
import java.io.Serializable;
import java.util.List;
public class QuestionsBean implements Serializable {
/**
* id : 601128318581870592
* create_time : 2021-06-12 16:30:25
* update_time : 2021-06-12 16:30:25
* is_deleted : 0
* question_paper_id : 601128023407726592
* category : pre_diagnosis
* order : 1
* name : 服药历
* type : radio
* remarks : ["请问你有服药史么?"]
* options : [{"id":"601128318544121856","name":"1~3 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121857","name":"4~6 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121858","name":"7~9 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121859","name":"10~12 个月","relates":[{"category":"症状","name":"幻觉"}]}]
*/
public String id;
public String createTime;
public String updateTime;
public int isDeleted;
public String questionPaperId;
public String category;
public String order;
public String name;
/***类型:
* radio(单选)
* /check(复选)
* /true_or_false(判断)
* /fill(填空)
* */
public String type;
public List<String> remarks;
public List<OptionsBean> options;
}
package com.yidianling.uikit.custom.http.response.question;
public class QuestionsBeanExample {
public String question;
public String example;
}
package com.yidianling.uikit.custom.http.response.question;
import java.util.List;
/**
* 题库信息
*
* @author liupeng
*/
public class QuestionsInfoBean {
/**
* id : 601128023407726592
* create_time : 2021-06-12 16:29:14
* update_time : 2021-06-12 16:34:22
* is_deleted : 0
* category : pre_diagnosis
* name : 灵犀用户首次进入问诊信息收集
* cate_id : 1313
* cate_name : 信息收集卡
* question_num : 3
* status : 0
* remark : 用户首次进入灵犀系统问诊信息收集
* question_chains : {"601128318581870592":{"id":"601145789934211072","create_time":"2021-06-12 17:39:50","update_time":"2021-06-12 17:41:31","question_paper_id":"601128023407726592","question_id":"601128318581870592","head":true,"options":{"601128318544121856":"601128931717812224"}}}
* questions : {"601128318581870592":{"id":"601128318581870592","create_time":"2021-06-12 16:30:25","update_time":"2021-06-12 16:30:25","is_deleted":0,"question_paper_id":"601128023407726592","category":"pre_diagnosis","order":1,"name":"服药历","type":"radio","remarks":["请问你有服药史么?"],"options":[{"id":"601128318544121856","name":"1~3 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121857","name":"4~6 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121858","name":"7~9 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121859","name":"10~12 个月","relates":[{"category":"症状","name":"幻觉"}]}]},"601128931717812224":{"id":"601128931717812224","create_time":"2021-06-12 16:32:51","update_time":"2021-06-12 16:32:51","is_deleted":0,"question_paper_id":"601128023407726592","category":"pre_diagnosis","order":2,"name":"晚上睡觉会醒几次","type":"radio","remarks":["晚上睡觉会醒几次?"],"options":[{"id":"601128931680063488","name":"1~3 次","relates":[{"category":"症状","name":"思绪混乱"}]},{"id":"601128931680063489","name":"4~6 次","relates":[{"category":"症状","name":"思绪混乱"}]},{"id":"601128931680063490","name":"7~9 次","relates":[{"category":"症状","name":"思绪混乱"}]},{"id":"601128931680063491","name":"10~12 次","relates":[{"category":"症状","name":"思绪混乱"}]}]},"601129312090853376":{"id":"601129312090853376","create_time":"2021-06-12 16:34:22","update_time":"2021-06-12 16:34:22","is_deleted":0,"question_paper_id":"601128023407726592","category":"pre_diagnosis","order":3,"name":"有逃离的想法么?","type":"radio","remarks":["有逃离的想法么?"],"options":[{"id":"601129312040521728","name":"有","relates":[{"category":"症状","name":"妄想症"}]},{"id":"601129312040521729","name":"无","relates":[{"category":"症状","name":"妄想症"}]},{"id":"601129312040521730","name":"其他"}]}}
*/
public QuestionPaperBean questionPaper;
public List<QuestionsBeanExample> questions;
}
package com.yidianling.uikit.custom.http.response.question;
/**
* @author liupeng
*/
public class RelatesBean {
/**
* category : 症状
* name : 幻觉
*/
public String id;
public String category;
public String name;
public String score;
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/platform_color_1DA1F2" />
<corners android:radius="4dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_f8f8f8" />
<corners android:radius="4dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/platform_color_1DA1F2" />
<corners
android:bottomLeftRadius="@dimen/platform_dp_8"
android:bottomRightRadius="@dimen/platform_dp_8"
android:topLeftRadius="@dimen/platform_dp_8"
android:topRightRadius="0dp" />
<padding
android:bottom="9dp"
android:left="22dp"
android:right="22dp"
android:top="9dp" />
</shape>
<?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">
<ImageView
android:id="@+id/iv_header"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerVertical="true"
android:src="@drawable/im_ico_default_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:background="@drawable/im_custom_message_round_white_6dp_bg"
android:orientation="vertical"
android:padding="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/iv_header"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/multiple_choice_title"
android:layout_width="239dp"
android:layout_height="wrap_content"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="请问是发生了什么事情导致的呢?(多选)?" />
<TextView
android:id="@+id/tv_notes"
android:layout_width="239dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/question_notes"
android:textColor="@color/color_grey_999999"
android:textSize="14sp" />
<View
android:id="@+id/type5_line"
android:layout_width="239dp"
android:layout_height="@dimen/platform_dp_05"
android:layout_marginTop="8dp"
android:background="@color/im_color_EBEBEB"
android:visibility="gone" />
<TextView
android:id="@+id/example"
android:layout_width="239dp"
android:layout_height="wrap_content"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/platform_dp_14"
android:visibility="gone"
tools:text="例:大学毕业后不知道该找什么工作,去年七月当过一次超市导购员,每天都要给顾客推荐这推荐那,感觉这不是我了,一想到上班后每天过着自己都排斥的日子我就越不敢继续找工作,就好像工作剥夺了我什么东西是的。" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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">
<ImageView
android:id="@+id/iv_header"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerVertical="true"
android:src="@drawable/im_ico_default_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:background="@drawable/im_custom_message_round_white_6dp_bg"
android:orientation="vertical"
android:padding="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/iv_header"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/more_title"
android:layout_width="263dp"
android:layout_height="wrap_content"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="请问是发生了什么事情导致的呢?(多选)?"></TextView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/tv_more_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintStart_toStartOf="@id/multiple_choice_title"
app:layout_constraintTop_toBottomOf="@id/multiple_choice_title"
tools:itemCount="6"
tools:listitem="@layout/left_one_check_layout_item"
tools:spanCount="2" />
<TextView
android:id="@+id/tv_more_define"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:textColor="@color/white"
android:layout_marginTop="8dp"
android:background="@drawable/im_background_18dp_ebebeb"
android:gravity="center"
android:paddingTop="@dimen/platform_dp_8"
android:paddingBottom="@dimen/platform_dp_8"
android:text="确定"
android:textSize="@dimen/im_text_size_15">
</TextView>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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">
<ImageView
android:id="@+id/iv_header"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerVertical="true"
android:src="@drawable/im_ico_default_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:background="@drawable/im_custom_message_round_white_6dp_bg"
android:orientation="vertical"
android:padding="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/iv_header"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/multiple_choice_title"
android:layout_width="239dp"
android:layout_height="wrap_content"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="请问是发生了什么事情导致的呢?(多选)?" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/tv_one_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxWidth="270dp"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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:paddingLeft="12dp"
android:paddingTop="12dp"
android:paddingBottom="12dp">
<ImageView
android:id="@+id/iv_header"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerVertical="true"
android:src="@drawable/im_ico_default_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_left_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:background="@drawable/im_custom_message_round_white_6dp_bg"
android:maxWidth="270dp"
android:padding="12dp"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/iv_header"
app:layout_constraintTop_toTopOf="parent"
tools:text="你好,为了更好的帮助您我们需要了解些基本信息,我们将会严格保护你的隐私安全,请放心。" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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:paddingTop="12dp"
android:paddingRight="12dp"
android:paddingBottom="12dp">
<androidx.cardview.widget.CardView
android:id="@+id/cv_header"
android:layout_width="36dp"
android:layout_height="36dp"
android:elevation="0dp"
app:cardCornerRadius="18dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_header"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerVertical="true"
android:src="@drawable/platform_head_place_hold_pic" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_right_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:background="@drawable/im_question_message_round_1da1f2_8dp_bg"
android:maxWidth="270dp"
android:textColor="@color/white"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/cv_header"
app:layout_constraintTop_toTopOf="parent"
tools:text="你好,为了更好的帮助您我们需要了解些基本信息,我们将会严格保护你的隐私安全,请放心。" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_which_question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_16"
android:layout_marginRight="@dimen/platform_dp_9"
android:background="@drawable/im_background_18dp_e8f5fe"
android:gravity="center"
android:paddingTop="@dimen/platform_dp_8"
android:paddingBottom="@dimen/platform_dp_8"
android:text="婚姻家庭婚姻混"
android:textColor="@color/platform_color_1DA1F2">
</TextView>
\ No newline at end of file
......@@ -59,5 +59,8 @@
<color name="im_color_grey_d0d0d0">#d0d0d0</color>
<color name="color_9f9f9f">#9f9f9f</color>
<color name="color_666666">#666666</color>
<color name="color_242424">#242424</color>
<color name="color_bfbfbf">#bfbfbf</color>
<color name="color_f8f8f8">#f8f8f8</color>
<color name="color_c2e7ff">#c2e7ff</color>
</resources>
......@@ -245,5 +245,6 @@
<string name="im_chat_private_title">私聊须知</string>
<string name="im_chat_pivate_content">如系统检测到涉黄、涉爆、涉政等信息,可能会封号处理并追究法律责任!</string>
<string name="im_video_play">视频播放</string>
<string name="question_notes">注:描述中请包涵问题持续时间、问题发生原因、当前的问题。如何描述?</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@color/white">
<ImageView
android:id="@+id/iv_close"
android:layout_width="26dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_marginRight="6dp"
android:layout_toLeftOf="@+id/tv_title"
android:src="@drawable/im_ico_default_avatar" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:text="咨询前评估"
android:textColor="@color/im_color_242424"
android:textSize="17sp" />
<TextView
android:id="@+id/tv_skip"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="跳过"
android:textColor="@color/im_color_grey_999999"
android:textSize="14sp" />
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MissingConstraints">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/color_f8f8f8"
android:paddingBottom="12dp"
app:layout_constraintBottom_toTopOf="@id/cl_input"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_weight="1" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
tools:visibility="visible">
<TextView
android:id="@+id/tv_problem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_f8f8f8"
android:paddingStart="12dp"
android:paddingBottom="13dp"
android:textColor="@color/color_242424"
android:textSize="14sp"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="已选:"
tools:visibility="visible" />
<EditText
android:id="@+id/et_input_problem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="top"
android:hint="请简单描述遇到的问题......"
android:maxHeight="200dp"
android:padding="12dp"
android:textColor="@color/color_242424"
android:textColorHint="@color/color_bfbfbf"
android:textSize="17sp"
app:layout_constraintTop_toBottomOf="@id/tv_problem" />
<HorizontalScrollView
android:id="@+id/hsv_problem_tips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="69dp"
android:layout_marginBottom="14dp"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/et_input_problem">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_cur_problem"
android:layout_width="wrap_content"
android:layout_height="28dp"
android:background="@drawable/bg_shape_f8f8f8_r4"
android:drawableStart="@mipmap/ic_input_add"
android:drawablePadding="5dp"
android:gravity="center"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="当前问题"
android:textColor="@color/color_242424"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_duration"
android:layout_width="wrap_content"
android:layout_height="28dp"
android:layout_marginStart="12dp"
android:background="@drawable/bg_shape_f8f8f8_r4"
android:drawableStart="@mipmap/ic_input_add"
android:drawablePadding="5dp"
android:gravity="center"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="持续时间"
android:textColor="@color/color_242424"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_problem_impact"
android:layout_width="wrap_content"
android:layout_height="28dp"
android:layout_marginStart="12dp"
android:background="@drawable/bg_shape_f8f8f8_r4"
android:drawableStart="@mipmap/ic_input_add"
android:drawablePadding="5dp"
android:gravity="center"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="问题影响"
android:textColor="@color/color_242424"
android:textSize="14sp" />
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:layout_width="86dp"
android:layout_height="36dp"
android:layout_marginBottom="8dp"
android:background="#80ffffff"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<TextView
android:id="@+id/tv_send"
android:layout_width="54dp"
android:layout_height="28dp"
android:background="@drawable/bg_shape_1da1f2_r4"
android:gravity="center"
android:text="发送"
android:textColor="@color/white"
android:textSize="15sp"
android:visibility="gone" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- 开始-->
<TextView
android:id="@+id/tv_finish"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="14dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="14dp"
android:background="@drawable/im_background_collect_info_bottom_start"
android:gravity="center"
android:text="去沟通"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
tools:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment