Commit 5a40b1e4 by 刘鹏

feat: 消息类型都完成

parent 08271c4a
{ {
"id": "601128023407726592", "questionPaper":{
"createTime": "2021-06-12T08:29:14.000+0000", "id":"601128023407726592",
"updateTime": "2021-06-22T09:24:34.000+0000", "createTime":"2021-06-12T08:29:14.000+0000",
"isDeleted": 0, "updateTime":"2021-06-23T12:43:07.000+0000",
"category": "pre_diagnosis", "isDeleted":0,
"name": "用户首次进入灵犀系统前置信息收集", "category":"pre_diagnosis",
"cateId": 53210621000798, "name":"用户首次进入灵犀系统前置信息收集",
"cateName": "信息收集卡", "cateId":53210621000798,
"questionNum": 3, "cateName":"信息收集卡",
"status": 0, "questionNum":4,
"remark": "用户首次进入灵犀系统前置信息收集", "status":0,
"questionChains": { "remark":"用户首次进入灵犀系统前置信息收集",
"601128318581870592": { "questionChains":{
"id": null, "601128318581870592":{
"createTime": null, "id":"601128318581870592",
"updateTime": null, "createTime":null,
"isDeleted": null, "updateTime":null,
"questionPaperId": "601128023407726592", "isDeleted":null,
"questionId": "601128318581870592", "questionPaperId":"601128023407726592",
"head": true, "questionId":"601128318581870592",
"options": { "head":true,
"601128318544121856": "601128931717812224", "options":{
"601128318544121857": "601128931717812224", "601128318544121856":"601128931717812224",
"601128318544121858": "601129312090853376", "601128318544121857":"601128931717812224",
"601128318544121859": "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
} }
}, },
"601128931717812224": { "questions":{
"id": null, "601128318581870592":{
"createTime": null, "id":"601128318581870592",
"updateTime": null, "createTime":"2021-06-12T08:30:25.000+0000",
"isDeleted": null, "updateTime":"2021-06-12T08:30:25.000+0000",
"questionPaperId": "601128023407726592", "isDeleted":0,
"questionId": "601128931717812224", "questionPaperId":"601128023407726592",
"head": false, "category":"pre_diagnosis",
"options": { "order":"1.0",
"601128931680063488": "601129312090853376", "name":"服药历",
"601128931680063489": "601129312090853376", "type":"radio",
"601128931680063490": "601129312090853376", "remarks":[
"601128931680063491": "601129312090853376" "请问你有服药史么?"
],
"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
}
]
}
]
} }
},
"601129312090853376": {
"id": null,
"createTime": null,
"updateTime": null,
"isDeleted": null,
"questionPaperId": "601128023407726592",
"questionId": "601129312090853376",
"head": false,
"options": null
} }
}, },
"questions": { "questions":[
"601128318581870592": { {
"id": "601128318581870592", "question":"这是问题1",
"createTime": "2021-06-12T08:30:25.000+0000", "example":"这是描述1"
"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", "question":"这是问题2",
"createTime": "2021-06-12T08:32:51.000+0000", "example":"这是描述2"
"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", "question":"这是问题3",
"createTime": "2021-06-12T08:34:22.000+0000", "example":"这是描述3"
"updateTime": "2021-06-12T08:34:22.000+0000",
"isDeleted": 0,
"questionPaperId": "601128023407726592",
"category": "pre_diagnosis",
"order": 3.0,
"name": "有逃离的想法么?",
"type": "radio",
"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
}
]
} }
} ]
} }
\ No newline at end of file
...@@ -69,42 +69,105 @@ class QuestionInformationView( ...@@ -69,42 +69,105 @@ class QuestionInformationView(
recycle.adapter = mQuestionAdapter recycle.adapter = mQuestionAdapter
mQuestionAdapter.setOneCheckListener(object : QuestionOneCheckListener { mQuestionAdapter.setOneCheckListener(object : QuestionOneCheckListener {
override fun itemClick(bean: OptionsBean?, questionId: String) { override fun itemClick(bean: OptionsBean?, questionId: String) {
val questionMultiItem = QuestionMultiItem() val questionMultiItem = QuestionMultiItem()
questionMultiItem.type2Text = bean?.name questionMultiItem.type2Text = bean?.name
questionMultiItem.viewType = 2 questionMultiItem.viewType = 2
mData.add(questionMultiItem) mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged() mQuestionAdapter.notifyDataSetChanged()
recycle.scrollToPosition(mData.size - 1)
val questionMultiItem2 = QuestionMultiItem() val questionMultiItem2 = QuestionMultiItem()
// 使用问题questionId 去questionChains取到选项配置 // 使用问题questionId 去questionChains取到选项配置
val options = mQuestionBean!!.questionChains[questionId]?.options val options = mQuestionBean!!.questionPaper.questionChains[questionId]?.options
//从配置里找到下一题id //从配置里找到下一题id
val nextQuestionId = options?.get(bean?.id) val nextQuestionId = options?.get(bean?.id)
//使用下一题nextQuestionId 取到题 //使用下一题nextQuestionId 取到题
val questionsBean = mQuestionBean!!.questions[nextQuestionId] val questionsBean = mQuestionBean!!.questionPaper.questions[nextQuestionId]
if (questionsBean!=null){ if (questionsBean != null) {
//还有下一题 //还有下一题
questionMultiItem2.questionsBean = questionsBean questionMultiItem2.questionsBean = questionsBean
if ("radio" == questionsBean?.type) { if ("radio" == questionsBean?.type) {
questionMultiItem2.viewType = 3 questionMultiItem2.viewType = 3
} else { } else {
questionMultiItem2.viewType = 4 questionMultiItem2.viewType = 4
questionMultiItem2.type4CanClick = true
} }
mData.add(questionMultiItem2) mData.add(questionMultiItem2)
}else{ } else {
//没有下一题了 //没有下一题了,展示描述=题
for ((index, item) in mData.withIndex()) {
mData[index].type4CanClick = false
}
val questionMultiItem5 = QuestionMultiItem()
questionMultiItem5.type5Bean = mQuestionBean!!.questions[1]
questionMultiItem5.viewType = 5
mData.add(questionMultiItem5)
// TODO: 6/24/21 展示描述弹窗
} }
mQuestionAdapter.notifyDataSetChanged() mQuestionAdapter.notifyDataSetChanged()
recycle.scrollToPosition(mData.size - 1)
} }
override fun moreDefineItemClick(list: List<OptionsBean?>?) { override fun moreDefineItemClick(list: List<OptionsBean?>?, questionId: String) {
//多选确定 //多选确定
var anwserStr = ""
list?.forEach {
if (anwserStr.isNotEmpty()) {
anwserStr = anwserStr + "、" + it?.name
} else {
anwserStr += it?.name
}
}
val bean = list?.get(0)
val questionMultiItem = QuestionMultiItem()
questionMultiItem.type2Text = anwserStr
questionMultiItem.viewType = 2
mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged()
recycle.scrollToPosition(mData.size - 1)
val questionMultiItem2 = QuestionMultiItem()
// 使用问题questionId 去questionChains取到选项配置
val options = mQuestionBean!!.questionPaper.questionChains[questionId]?.options
//从配置里找到下一题id
val nextQuestionId = options?.get(bean?.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 {
//没有下一题了,展示描述=题
for ((index, item) in mData.withIndex()) {
mData[index].type4CanClick = false
}
val questionMultiItem5 = QuestionMultiItem()
questionMultiItem5.type5Bean = mQuestionBean!!.questions[1]
questionMultiItem5.viewType = 5
mData.add(questionMultiItem5)
// TODO: 6/24/21 展示描述弹窗
}
mQuestionAdapter.notifyDataSetChanged()
recycle.scrollToPosition(mData.size - 1)
} }
override fun showOtherEdit(list: List<OptionsBean?>?) { override fun showOtherEdit(list: List<OptionsBean?>?, questionId: String) {
//弹出输入框 //弹出输入框
ToastUtil.toastShort("弹出输入框") ToastUtil.toastShort("弹出输入框")
} }
...@@ -118,28 +181,26 @@ class QuestionInformationView( ...@@ -118,28 +181,26 @@ class QuestionInformationView(
mQuestionBean = questionInfo mQuestionBean = questionInfo
mData.clear() mData.clear()
val questionMultiItem = QuestionMultiItem() val questionMultiItem = QuestionMultiItem()
questionMultiItem.type1Text = questionInfo.name questionMultiItem.type1Text = questionInfo.questions[0].question
questionMultiItem.viewType = 1 questionMultiItem.viewType = 1
mData.add(questionMultiItem) mData.add(questionMultiItem)
val questionMultiItem2 = QuestionMultiItem() val questionMultiItem2 = QuestionMultiItem()
mQuestionBean!!.questionChains.forEach { (k, v) -> mQuestionBean!!.questionPaper.questionChains.forEach { (k, v) ->
if (v.head) { if (v.head) {
// 代表第一题 ,使用questionId 去questions取到对应的提 // 代表第一题 ,使用questionId 去questions取到对应的提
val questionsBean = mQuestionBean!!.questions[v.questionId] val questionsBean = mQuestionBean!!.questionPaper.questions[v.questionId]
questionMultiItem2.questionsBean = questionsBean questionMultiItem2.questionsBean = questionsBean
if ("radio" == questionsBean?.type) { if ("radio" == questionsBean?.type) {
questionMultiItem2.viewType = 3 questionMultiItem2.viewType = 3
} else { } else {
questionMultiItem2.viewType = 4 questionMultiItem2.viewType = 4
questionMultiItem2.type4CanClick = true
} }
mData.add(questionMultiItem2) mData.add(questionMultiItem2)
return@forEach return@forEach
} }
} }
// mQuestionAdapter.notifyDataSetChanged()
} }
......
package com.yidianling.uikit.business.session.view.question; 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.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
...@@ -39,6 +44,8 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem ...@@ -39,6 +44,8 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
addItemType(3, R.layout.item_left_one_check_layout); addItemType(3, R.layout.item_left_one_check_layout);
//左----多选 //左----多选
addItemType(4, R.layout.item_left_more_check_layout); addItemType(4, R.layout.item_left_more_check_layout);
//左----描述题
addItemType(5, R.layout.item_left_describe_layout);
} }
...@@ -65,81 +72,40 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem ...@@ -65,81 +72,40 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
break; break;
case 3: case 3:
//单选 //单选
RecyclerView OneRecycle = helper.getView(R.id.tv_one_list); convertType3(helper, item);
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();
if ("其他".equals(data.get(position).name)) {
List<OptionsBean> checkList = getCheckOptionsBeans(oneCheckAdapter);
mOneCheckListener.showOtherEdit(checkList);
}else {
for (OptionsBean datum : data) {
if (datum.check) {
return;
}
}
oneCheckAdapter.getData().get(position).check = true;
oneCheckAdapter.notifyDataSetChanged();
mOneCheckListener.itemClick(data.get(position),item.questionsBean.id);
}
}
});
break; break;
case 4: case 4:
//多选 //多选
RecyclerView moreRecycle = helper.getView(R.id.tv_more_list); convertType4(helper, item);
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);
moreCheckAdapter.setOnItemClickListener(new OnItemClickListener() { break;
@Override case 5:
public void onItemClick(BaseQuickAdapter adapter, View view, int position) { helper.setText(R.id.multiple_choice_title, item.type5Bean.question);
OptionsBean optionsBean = moreCheckAdapter.getData().get(position); helper.setText(R.id.example, item.type5Bean.example);
boolean check = optionsBean.check; SpannableString spannableString = new SpannableString(mContext.getResources().getString(R.string.question_notes));
moreCheckAdapter.getData().get(position).check = !check; spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#1DA1F2")), 28, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
if ("其他".equals(optionsBean.name)) { helper.setText(R.id.tv_notes, spannableString);
List<OptionsBean> checkList = getCheckOptionsBeans(moreCheckAdapter);
mOneCheckListener.showOtherEdit(checkList); View line = helper.getView(R.id.line);
} TextView example = helper.getView(R.id.example);
}
}); if (example.getVisibility() == View.GONE) {
tv_more_define.setOnClickListener(new View.OnClickListener() { line.setVisibility(View.VISIBLE);
example.setVisibility(View.VISIBLE);
} else {
line.setVisibility(View.GONE);
example.setVisibility(View.GONE);
}
helper.setOnClickListener(R.id.tv_notes, new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
List<OptionsBean> checkList = getCheckOptionsBeans(moreCheckAdapter); if (example.getVisibility() == View.GONE) {
mOneCheckListener.moreDefineItemClick(checkList); line.setVisibility(View.VISIBLE);
example.setVisibility(View.VISIBLE);
} else {
line.setVisibility(View.GONE);
example.setVisibility(View.GONE);
}
} }
}); });
...@@ -149,6 +115,110 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem ...@@ -149,6 +115,110 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
} }
} }
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);
moreCheckAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
if (item.type4CanClick) {
OptionsBean optionsBean = moreCheckAdapter.getData().get(position);
if ("其他".equals(optionsBean.name)) {
List<OptionsBean> checkList = getCheckOptionsBeans(moreCheckAdapter);
mOneCheckListener.showOtherEdit(checkList, item.questionsBean.id);
return;
}
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("确定");
}
}
}
});
tv_more_define.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (item.type4CanClick) {
List<OptionsBean> checkList = getCheckOptionsBeans(moreCheckAdapter);
mOneCheckListener.moreDefineItemClick(checkList, item.questionsBean.id);
}
}
});
}
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();
if ("其他".equals(data.get(position).name)) {
List<OptionsBean> checkList = getCheckOptionsBeans(oneCheckAdapter);
mOneCheckListener.showOtherEdit(checkList, item.questionsBean.id);
} else {
for (OptionsBean datum : data) {
if (datum.check) {
return;
}
}
oneCheckAdapter.getData().get(position).check = true;
oneCheckAdapter.notifyDataSetChanged();
mOneCheckListener.itemClick(data.get(position), item.questionsBean.id);
}
}
});
}
private List<OptionsBean> getCheckOptionsBeans(QuestionOneCheckAdapter moreCheckAdapter) { private List<OptionsBean> getCheckOptionsBeans(QuestionOneCheckAdapter moreCheckAdapter) {
List<OptionsBean> data = moreCheckAdapter.getData(); List<OptionsBean> data = moreCheckAdapter.getData();
List<OptionsBean> checkList = new ArrayList(); List<OptionsBean> checkList = new ArrayList();
......
...@@ -2,11 +2,12 @@ package com.yidianling.uikit.business.session.view.question; ...@@ -2,11 +2,12 @@ package com.yidianling.uikit.business.session.view.question;
import com.chad.library.adapter.base.entity.MultiItemEntity; 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.QuestionsBean;
import com.yidianling.uikit.custom.http.response.question.QuestionsBeanExample;
/** /**
* Created by hzchenkang on 2017/6/21. * @author liupeng
*/ */
public class QuestionMultiItem implements MultiItemEntity { public class QuestionMultiItem implements MultiItemEntity {
public int viewType; public int viewType;
...@@ -15,6 +16,9 @@ public class QuestionMultiItem implements MultiItemEntity { ...@@ -15,6 +16,9 @@ public class QuestionMultiItem implements MultiItemEntity {
public String type2Text; public String type2Text;
/***type 3 单选 type 4 多选 */ /***type 3 单选 type 4 多选 */
public QuestionsBean questionsBean; public QuestionsBean questionsBean;
public boolean type4CanClick;
public QuestionsBeanExample type5Bean;
@Override @Override
......
...@@ -6,15 +6,15 @@ interface QuestionOneCheckListener { ...@@ -6,15 +6,15 @@ interface QuestionOneCheckListener {
/** /**
* 单选点击获取item信息 * 单选点击获取item信息
*/ */
fun itemClick(bean: OptionsBean?,questionId:String) fun itemClick(bean: OptionsBean?, questionId: String)
/** /**
* 多选确定按钮点击 * 多选确定按钮点击
*/ */
fun moreDefineItemClick(list: List<OptionsBean?>?) fun moreDefineItemClick(list: List<OptionsBean?>?, questionId: String)
/** /**
* 展示其他 * 展示其他
*/ */
fun showOtherEdit(list: List<OptionsBean?>?) fun showOtherEdit(list: List<OptionsBean?>?, questionId: String)
} }
\ No newline at end of file
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;
}
...@@ -24,7 +24,7 @@ public class QuestionsBean { ...@@ -24,7 +24,7 @@ public class QuestionsBean {
public int isDeleted; public int isDeleted;
public String questionPaperId; public String questionPaperId;
public String category; public String category;
public int order; public String order;
public String name; public String name;
/***类型: /***类型:
* radio(单选) * radio(单选)
......
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; package com.yidianling.uikit.custom.http.response.question;
import java.util.List; import java.util.List;
import java.util.Map;
public class QuestionsInfoBean { public class QuestionsInfoBean {
...@@ -21,19 +20,8 @@ public class QuestionsInfoBean { ...@@ -21,19 +20,8 @@ public class QuestionsInfoBean {
* 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"}}} * 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":"其他"}]}} * 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;
public String id;
public String createTime;
public String updateTime;
public int isDeleted;
public String category;
public String name;
public long cateId;
public String cateName;
public int questionNum;
public int status;
public String remark;
public Map<String, QuestionChainsBean> questionChains;
public Map<String, QuestionsBean> questions;
} }
<?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/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
...@@ -53,12 +53,13 @@ ...@@ -53,12 +53,13 @@
android:layout_width="110dp" android:layout_width="110dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right"
android:textColor="@color/white"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:background="@drawable/im_background_18dp_ebebeb" android:background="@drawable/im_background_18dp_ebebeb"
android:gravity="center" android:gravity="center"
android:paddingTop="@dimen/platform_dp_8" android:paddingTop="@dimen/platform_dp_8"
android:paddingBottom="@dimen/platform_dp_8" android:paddingBottom="@dimen/platform_dp_8"
android:text="确定(2)" android:text="确定"
android:textSize="@dimen/im_text_size_15"> android:textSize="@dimen/im_text_size_15">
</TextView> </TextView>
......
...@@ -245,5 +245,6 @@ ...@@ -245,5 +245,6 @@
<string name="im_chat_private_title">私聊须知</string> <string name="im_chat_private_title">私聊须知</string>
<string name="im_chat_pivate_content">如系统检测到涉黄、涉爆、涉政等信息,可能会封号处理并追究法律责任!</string> <string name="im_chat_pivate_content">如系统检测到涉黄、涉爆、涉政等信息,可能会封号处理并追究法律责任!</string>
<string name="im_video_play">视频播放</string> <string name="im_video_play">视频播放</string>
<string name="question_notes">注:描述中请包涵问题持续时间、问题发生原因、当前的问题。如何描述?</string>
</resources> </resources>
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@color/platform_color_F0F0F0"> android:background="@color/platform_color_F0F0F0"
android:paddingBottom="12dp">
</androidx.recyclerview.widget.RecyclerView> </androidx.recyclerview.widget.RecyclerView>
......
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