diff --git a/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionCard.vue b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionCard.vue
index a90612f6..fc1a4fd3 100644
--- a/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionCard.vue
+++ b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionCard.vue
@@ -226,6 +226,28 @@ const handleImportToPrescription = async () => {
};
const emit = defineEmits(['import-success']);
+
+// 获取答案的样式类:是=绿色,否=红色,其他=黄色
+const getAnswerClass = (answer) => {
+ if (answer === '是') {
+ return 'answer-yes';
+ } else if (answer === '否') {
+ return 'answer-no';
+ } else {
+ return 'answer-other';
+ }
+};
+
+// 获取答案的图标
+const getAnswerIcon = (answer) => {
+ if (answer === '是') {
+ return 'fas fa-check-circle';
+ } else if (answer === '否') {
+ return 'fas fa-times-circle';
+ } else {
+ return 'fas fa-question-circle';
+ }
+};
@@ -309,8 +331,8 @@ const emit = defineEmits(['import-success']);
{{ index + 1 }}.
{{ qa.question }}
-
@@ -575,6 +597,15 @@ const emit = defineEmits(['import-success']);
color: #dc2626;
}
+.answer-other {
+ background: #fef3c7;
+ color: #d97706;
+}
+
+.answer-other i {
+ color: #d97706;
+}
+
.dark .questions-section {
background: #1e293b;
border-color: #334155;
diff --git a/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue
index b4e75cc4..f4842a64 100644
--- a/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue
+++ b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue
@@ -109,6 +109,28 @@ const handleViewDetail = () => {
emit('view-detail', transferInfo.value);
};
+// 获取答案的样式类:是=绿色,否=红色,其他=黄色
+const getAnswerClass = (answer) => {
+ if (answer === '是') {
+ return 'answer-yes';
+ } else if (answer === '否') {
+ return 'answer-no';
+ } else {
+ return 'answer-other';
+ }
+};
+
+// 获取答案的图标
+const getAnswerIcon = (answer) => {
+ if (answer === '是') {
+ return 'fas fa-check-circle';
+ } else if (answer === '否') {
+ return 'fas fa-times-circle';
+ } else {
+ return 'fas fa-question-circle';
+ }
+};
+
// 将转接方药品数据转换成addProducts需要的格式
const convertDrugDataForImport = (drug) => {
// addProducts期望的数据结构:
@@ -291,8 +313,8 @@ const handleImportToPrescription = async () => {
{{ index + 1 }}.
{{ qa.question }}
-
@@ -542,6 +564,15 @@ const handleImportToPrescription = async () => {
color: #dc2626;
}
+.answer-other {
+ background: #fef3c7;
+ color: #d97706;
+}
+
+.answer-other i {
+ color: #d97706;
+}
+
.dark .questions-section {
background: #1e293b;
border-color: #334155;
diff --git a/apps/web-antd/src/views/system/transfer-question/components/modal.vue b/apps/web-antd/src/views/system/transfer-question/components/modal.vue
index 36537baa..2eaa8439 100644
--- a/apps/web-antd/src/views/system/transfer-question/components/modal.vue
+++ b/apps/web-antd/src/views/system/transfer-question/components/modal.vue
@@ -24,6 +24,25 @@ const [Modal, modalApi] = useVbenModal({
formApi.validate().then(async (e: any) => {
if (e.valid) {
const values = await formApi.getValues();
+
+ // 处理answers字段:将换行分隔的字符串转换为数组
+ if (values.answers) {
+ if (typeof values.answers === 'string') {
+ // 按换行符分割,过滤空行,去除首尾空格
+ values.answers = values.answers
+ .split('\n')
+ .map((item: string) => item.trim())
+ .filter((item: string) => item.length > 0);
+ }
+ // 如果转换后为空数组,设置默认值
+ if (!Array.isArray(values.answers) || values.answers.length === 0) {
+ values.answers = ['是', '否'];
+ }
+ } else {
+ // 如果没有提供,设置默认值
+ values.answers = ['是', '否'];
+ }
+
modalApi.setState({ loading: true, confirmLoading: true });
const submitApi = isUpdate.value ? updateTransferQuestion : createTransferQuestion;
submitApi(values)
@@ -45,6 +64,26 @@ const [Modal, modalApi] = useVbenModal({
const { values, update } = modalApi.getData>();
if (values) {
isUpdate.value = update;
+
+ // 处理answers字段:如果是数组或JSON字符串,转换为换行分隔的字符串
+ if (values.answers) {
+ if (Array.isArray(values.answers)) {
+ values.answers = values.answers.join('\n');
+ } else if (typeof values.answers === 'string' && values.answers.trim().startsWith('[')) {
+ try {
+ const parsed = JSON.parse(values.answers);
+ if (Array.isArray(parsed)) {
+ values.answers = parsed.join('\n');
+ }
+ } catch (e) {
+ // 解析失败,保持原值
+ }
+ }
+ } else {
+ // 如果没有值,设置默认值
+ values.answers = '是\n否';
+ }
+
formApi.setValues(values);
}
}
diff --git a/apps/web-antd/src/views/system/transfer-question/config/form.ts b/apps/web-antd/src/views/system/transfer-question/config/form.ts
index 4e9221db..e6c560ac 100644
--- a/apps/web-antd/src/views/system/transfer-question/config/form.ts
+++ b/apps/web-antd/src/views/system/transfer-question/config/form.ts
@@ -10,6 +10,7 @@ export const modalFormProps: VbenFormProps = {
},
},
layout: 'horizontal',
+ showDefaultActions: false,
schema: [
{
component: 'VbenInput',
@@ -21,7 +22,7 @@ export const modalFormProps: VbenFormProps = {
},
},
{
- component: 'VbenTextarea',
+ component: 'Textarea',
componentProps: {
placeholder: '请输入问题内容',
rows: 3,
@@ -30,6 +31,40 @@ export const modalFormProps: VbenFormProps = {
label: '问题内容',
rules: 'required',
},
+ {
+ component: 'Select',
+ componentProps: {
+ placeholder: '请选择问题类型',
+ options: [
+ {
+ label: '转接方问题',
+ value: 1,
+ },
+ {
+ label: '在线复诊问题',
+ value: 2,
+ },
+ {
+ label: '购药在线复诊问题',
+ value: 3,
+ },
+ ],
+ },
+ defaultValue: 1,
+ fieldName: 'type',
+ label: '问题类型',
+ rules: 'required',
+ },
+ {
+ component: 'Textarea',
+ componentProps: {
+ placeholder: '请输入答案选项,每行一个(默认:是、否)',
+ rows: 4,
+ },
+ fieldName: 'answers',
+ label: '答案选项',
+ defaultValue: '否\n是',
+ },
{
component: 'InputNumber',
componentProps: {
diff --git a/apps/web-antd/src/views/system/transfer-question/config/table.ts b/apps/web-antd/src/views/system/transfer-question/config/table.ts
index 1ba0e79b..9954923f 100644
--- a/apps/web-antd/src/views/system/transfer-question/config/table.ts
+++ b/apps/web-antd/src/views/system/transfer-question/config/table.ts
@@ -5,8 +5,10 @@ import { getTransferQuestionList } from '../api';
interface RowType {
id: number;
question: string;
+ answers: string | string[];
sort: number;
status: number;
+ type: number;
created_at: string;
updated_at: string;
}
@@ -26,6 +28,12 @@ export const gridOptions: VxeGridProps = {
{ type: 'checkbox', width: 60 },
{ field: 'id', align: 'left', title: 'ID', width: 100 },
{ field: 'question', align: 'left', title: '问题内容', minWidth: 300 },
+ {
+ field: 'type',
+ title: '问题类型',
+ width: 150,
+ slots: { default: 'type' },
+ },
{ field: 'sort', title: '排序', width: 100 },
{
field: 'status',
diff --git a/apps/web-antd/src/views/system/transfer-question/index.vue b/apps/web-antd/src/views/system/transfer-question/index.vue
index ee653e24..7e956b86 100644
--- a/apps/web-antd/src/views/system/transfer-question/index.vue
+++ b/apps/web-antd/src/views/system/transfer-question/index.vue
@@ -116,6 +116,11 @@ const deleteApi = (row: any) => {
{{ row.status === 1 ? '启用' : '禁用' }}
+
+
+ {{ row.type === 1 ? '转接方问题' : row.type === 2 ? '在线复诊问题' : '购药在线复诊问题' }}
+
+