-
-
+
{{ item.disease.name }}
+
+
+
-
搜索结果
-
+
+
+
-
-
-
-
已添加
+
{{ item.name }}
+
+
+
+
+ 暂无相关诊断
+
+
+
+
@@ -259,80 +296,208 @@ async function removeFromMyDiagnosis(item) {
diff --git a/apps/web-antd/src/views/doctor/doctor-reception/components/DoctorOrderModal.vue b/apps/web-antd/src/views/doctor/doctor-reception/components/DoctorOrderModal.vue
index 1edb5388..416edf6d 100644
--- a/apps/web-antd/src/views/doctor/doctor-reception/components/DoctorOrderModal.vue
+++ b/apps/web-antd/src/views/doctor/doctor-reception/components/DoctorOrderModal.vue
@@ -1,11 +1,10 @@
+
+
+
+
+
+
+
+
+
diff --git a/apps/web-antd/src/views/doctor/online-consultation/components/PatientExperienceCard.vue b/apps/web-antd/src/views/doctor/online-consultation/components/PatientExperienceCard.vue
index 2b385fb8..084c1a2c 100644
--- a/apps/web-antd/src/views/doctor/online-consultation/components/PatientExperienceCard.vue
+++ b/apps/web-antd/src/views/doctor/online-consultation/components/PatientExperienceCard.vue
@@ -2,7 +2,7 @@
import { computed, ref } from 'vue';
import { Button, message } from 'ant-design-vue';
import { usePrescriptionStore } from '#/store/prescription';
-import { getProductListDoctorReception } from '#/views/doctor/doctor-reception/api';
+import { getDrugsByRegisterId } from '../api/index.ts';
const props = defineProps({
content: {
@@ -40,58 +40,47 @@ const hasUsedDrugText = computed(() => {
// 添加药品到处方单
const handleAddToPrescription = async () => {
- if (!experienceData.value.drug_name) {
- message.warning('该就诊经历中没有药品信息');
- return;
- }
-
// 检查处方store是否已初始化
if (!prescriptionStore.currentRegisterId) {
message.warning('请先接诊患者');
return;
}
+ // 获取门店ID
+ let storeId = prescriptionStore.myStoreId;
+ if (!storeId || storeId === 0) {
+ if (prescriptionStore.myStoreList && prescriptionStore.myStoreList.length > 0) {
+ storeId = prescriptionStore.myStoreList[0].id;
+ } else {
+ message.warning('请先选择诊所');
+ return;
+ }
+ }
+
addingDrug.value = true;
try {
- // 通过药品名称搜索药品
- // 如果myStoreId为0,尝试使用myStoreList的第一个
- let storeId = prescriptionStore.myStoreId;
- if (!storeId || storeId === 0) {
- if (prescriptionStore.myStoreList && prescriptionStore.myStoreList.length > 0) {
- storeId = prescriptionStore.myStoreList[0].id;
- } else {
- message.warning('请先选择诊所');
- return;
+ // 根据 register_id 获取药品信息
+ const res = await getDrugsByRegisterId(prescriptionStore.currentRegisterId, storeId);
+ const drugList = res?.result || res?.data || res || [];
+
+ if (!drugList || drugList.length === 0) {
+ message.warning('未找到药品信息');
+ return;
+ }
+
+ // 遍历药品列表,添加到处方单
+ let addedCount = 0;
+ for (const drugData of drugList) {
+ const success = prescriptionStore.addProducts(drugData);
+ if (success) {
+ addedCount++;
}
}
- const res = await getProductListDoctorReception({
- store_id: storeId,
- type: 2, // 中成(西)药
- name: experienceData.value.drug_name,
- });
-
- if (!res || res.length === 0) {
- message.warning(`未找到药品:${experienceData.value.drug_name}`);
- return;
- }
-
- // 使用第一个匹配的药品
- const drugData = res[0];
-
- // 检查药品是否已在处方中
- const existItem = prescriptionStore.currentDrugs.find(
- (item) => item.index_id === drugData.id,
- );
- if (existItem) {
- message.warning('该药品已在处方中');
- return;
- }
-
- // 添加药品到处方单
- const success = prescriptionStore.addProducts(drugData);
- if (success) {
- message.success(`已将${drugData.drug.drug_name}添加到处方单`);
+ if (addedCount > 0) {
+ message.success(`已成功添加 ${addedCount} 个药品到处方单`);
+ } else {
+ message.warning('所有药品已在处方中');
}
} catch (error) {
console.error('添加药品失败:', error);
@@ -315,7 +304,7 @@ const handleAddToPrescription = async () => {
.drug-name {
color: #d97706;
font-weight: 600;
- background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
+ //background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
padding: 4px 12px;
border-radius: 6px;
display: inline-block;
diff --git a/apps/web-antd/src/views/doctor/online-consultation/components/PatientInfoPanel.vue b/apps/web-antd/src/views/doctor/online-consultation/components/PatientInfoPanel.vue
index 1737896e..c2e46f43 100644
--- a/apps/web-antd/src/views/doctor/online-consultation/components/PatientInfoPanel.vue
+++ b/apps/web-antd/src/views/doctor/online-consultation/components/PatientInfoPanel.vue
@@ -43,7 +43,7 @@ const fetchPatientDetail = async () => {
registerId = id;
}
}
-
+
// 支持只有 register_id 没有 room_id 的情况
const res = await getPatientDetail(props.patient.room_id || '', registerId);
// 确保正确解析返回数据
@@ -73,7 +73,7 @@ const handleReception = async () => {
try {
// 传递挂号ID
const res = await reception(props.patient.register_id);
-
+
// res 已经是 data.result 的内容,无需判断 code(请求封装会自动判断,失败会抛出异常)
message.success('接诊成功');
const receptionResult = {
@@ -131,7 +131,8 @@ watch(
加载中...
-
+
@@ -148,7 +149,7 @@ watch(
进入聊天
-
+
{
return statusMap[status] || '未知';
};
+// 获取挂号类型文本
+const getRegisterTypeText = (registerType) => {
+ const typeMap = {
+ 2: '诊所复诊',
+ 3: '药店复诊',
+ };
+ return typeMap[registerType] || '';
+};
+
// 获取状态样式类
const getStatusClass = (status) => {
const classMap = {
@@ -164,9 +173,14 @@ defineExpose({
{{ patient.user_patient?.mobile || patient.user?.mobile || '' }}
订单号:{{ patient.order_no }}
@@ -257,6 +271,29 @@ defineExpose({
margin-top: 4px;
}
+.meta-left {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.register-type-tag {
+ display: inline-block;
+ padding: 2px 8px;
+ border-radius: 4px;
+ font-size: 12px;
+ font-weight: 500;
+ background: #e6f7ff;
+ color: #1890ff;
+ border: 1px solid #91d5ff;
+}
+
+.dark .register-type-tag {
+ background: rgba(24, 144, 255, 0.2);
+ color: #69c0ff;
+ border-color: rgba(24, 144, 255, 0.3);
+}
+
.status {
display: inline-block;
padding: 2px 8px;
diff --git a/apps/web-antd/src/views/doctor/online-consultation/components/PatientOrderListModal.vue b/apps/web-antd/src/views/doctor/online-consultation/components/PatientOrderListModal.vue
new file mode 100644
index 00000000..86058aad
--- /dev/null
+++ b/apps/web-antd/src/views/doctor/online-consultation/components/PatientOrderListModal.vue
@@ -0,0 +1,400 @@
+
+
+
+
+
+
+
+
+ {{ getPrescriptionTypeText(row.prescription_type) }}
+
+
+
+
+
+ ¥{{ Number(row.items_price || 0).toFixed(2) }}
+
+
+
+
+ ¥{{ Number(row.total_pay_price || 0).toFixed(2) }}
+
+
+
+
+ ¥{{ Number(row.trans_expenses || 0).toFixed(2) }}
+
+
+
+
+
+ {{ row.is_pay === 1 ? '已支付' : '未支付' }}
+
+
+
+
+
+ 共 {{ row.products?.length || 0 }} 个商品
+
+
+
+
+
+
+
+
+
+
+
+
+ 商品编号:
+ X00{{ index + 1 }}
+
+
+
+
+ 商品名称:
+ {{ product.drug_name }}
+
+
+ 商品规格:
+ {{ product.specification || '暂无' }}
+
+
+ 商品数量:
+ {{ product.number }}
+
+
+ 商品厂家:
+ {{ product.source_name || '暂无' }}
+
+
+
商品价格:
+
+ ¥{{ Number(product.price || 0).toFixed(4) }}
+
+
¥{{ Number(product.price || 0).toFixed(4) }}
+
+
+
+
+ (最低调整金额: ¥{{ Number(product.min_adjust_price || 0).toFixed(2) }})
+
+
+
+ 备注:
+ 中药不可调整
+
+
+
+
+
+
+
+
药品明细:
+
+ -
+ 【{{ product.drug_id }}】 {{ product.drug_name }} (* {{ product.number }})
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/web-antd/src/views/doctor/online-consultation/components/PriceAdjustModal.vue b/apps/web-antd/src/views/doctor/online-consultation/components/PriceAdjustModal.vue
new file mode 100644
index 00000000..e5e25246
--- /dev/null
+++ b/apps/web-antd/src/views/doctor/online-consultation/components/PriceAdjustModal.vue
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+ {{ formData.drugName }}
+
+
+ ¥{{ formData.currentPrice ? Number(formData.currentPrice).toFixed(4) : '0.0000' }}
+
+
+
+ ¥{{ Number(formData.minAdjustPrice).toFixed(2) }}
+
+ 未设置
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/web-antd/src/views/doctor/online-consultation/index.vue b/apps/web-antd/src/views/doctor/online-consultation/index.vue
index 9c4f2a3c..5141c3f5 100644
--- a/apps/web-antd/src/views/doctor/online-consultation/index.vue
+++ b/apps/web-antd/src/views/doctor/online-consultation/index.vue
@@ -12,8 +12,8 @@ import { useUserStore } from '#/views/business/chat/stores/user';
import { usePrescriptionStore } from '#/store/prescription';
import PatientList from './components/PatientList.vue';
import PatientInfoPanel from './components/PatientInfoPanel.vue';
-import { endConsultation } from './api/index.ts';
-import { getProductListDoctorReception } from '#/views/doctor/doctor-reception/api';
+import OrderListFloatButton from './components/OrderListFloatButton.vue';
+import { endConsultation, getDrugsByRegisterId } from './api/index.ts';
const route = useRoute();
const router = useRouter();
@@ -280,16 +280,6 @@ const handleAddPatientProductsToPrescription = async () => {
return;
}
- // 从聊天记录中筛选出所有 message_type=11 的消息(患者就诊经历)
- const productMessages = chatStore.messages.filter(
- (msg) => msg.message_type === 11
- );
-
- if (productMessages.length === 0) {
- message.warning('当前聊天没有可添加的药品');
- return;
- }
-
// 获取诊所ID
let storeId = prescriptionStore.myStoreId;
if (!storeId || storeId === 0) {
@@ -301,69 +291,25 @@ const handleAddPatientProductsToPrescription = async () => {
}
}
- let addedCount = 0;
- let skippedCount = 0;
- const errors = [];
-
try {
- // 遍历每条商品消息,添加到处方单
- for (const msg of productMessages) {
- try {
- // 解析消息内容
- let productData;
- try {
- productData = typeof msg.message_content === 'string'
- ? JSON.parse(msg.message_content)
- : msg.message_content;
- } catch (e) {
- console.error('解析就诊经历消息失败:', e);
- continue;
- }
+ // 根据 register_id 获取药品信息
+ const res = await getDrugsByRegisterId(prescriptionStore.currentRegisterId, storeId);
+ const drugList = res?.result || res?.data || res || [];
- // 获取药品名称(从就诊经历中提取 drug_name)
- const drugName = productData.drug_name;
- if (!drugName) {
- skippedCount++;
- continue;
- }
+ if (!drugList || drugList.length === 0) {
+ message.warning('未找到药品信息');
+ return;
+ }
- // 通过药品名称搜索药品
- const res = await getProductListDoctorReception({
- store_id: storeId,
- type: 2, // 中成(西)药
- name: drugName,
- });
-
- if (!res || res.length === 0) {
- errors.push(`未找到药品:${drugName}`);
- skippedCount++;
- continue;
- }
-
- // 使用第一个匹配的药品
- const drugData = res[0];
-
- // 检查药品是否已在处方中
- const existItem = prescriptionStore.currentDrugs.find(
- (item) => item.index_id === drugData.id,
- );
- if (existItem) {
- skippedCount++;
- continue;
- }
-
- // 添加药品到处方单
- const success = prescriptionStore.addProducts(drugData);
- if (success) {
- addedCount++;
- }
- } catch (error) {
- console.error('添加药品失败:', error);
- errors.push(`添加药品失败:${error.message || '未知错误'}`);
+ // 遍历药品列表,添加到处方单
+ let addedCount = 0;
+ for (const drugData of drugList) {
+ const success = prescriptionStore.addProducts(drugData);
+ if (success) {
+ addedCount++;
}
}
- // 显示结果消息
if (addedCount > 0) {
message.success(`已成功添加 ${addedCount} 个药品到处方单`);
// 打开处方模态框
@@ -372,89 +318,11 @@ const handleAddPatientProductsToPrescription = async () => {
onPrescriptionSent: handlePrescriptionSent,
});
prescriptionModalApi.open();
- } else if (skippedCount > 0) {
- // 如果所有药品都无法添加,尝试添加最新的那个
- // 按时间排序,取最新的药品(created_at 或 timestamp 最大的)
- const sortedMessages = [...productMessages].sort((a, b) => {
- const timeA = a.created_at ? new Date(a.created_at).getTime() : (a.timestamp || 0);
- const timeB = b.created_at ? new Date(b.created_at).getTime() : (b.timestamp || 0);
- return timeB - timeA; // 降序排列,最新的在前
- });
-
- if (sortedMessages.length > 0) {
- const latestMessage = sortedMessages[0];
- try {
- // 解析最新消息的内容
- let productData;
- try {
- productData = typeof latestMessage.message_content === 'string'
- ? JSON.parse(latestMessage.message_content)
- : latestMessage.message_content;
- } catch (e) {
- console.error('解析商品消息失败:', e);
- message.warning('当前聊天没有可添加的药品');
- return;
- }
-
- // 获取药品名称
- const drugName = productData.drug_name || productData.name;
- if (!drugName) {
- message.warning('当前聊天没有可添加的药品');
- return;
- }
-
- // 通过药品名称搜索药品
- const res = await getProductListDoctorReception({
- store_id: storeId,
- type: 2, // 中成(西)药
- name: drugName,
- });
-
- if (!res || res.length === 0) {
- message.warning('当前聊天没有可添加的药品');
- return;
- }
-
- // 使用第一个匹配的药品
- const drugData = res[0];
-
- // 检查药品是否已在处方中
- const existItem = prescriptionStore.currentDrugs.find(
- (item) => item.index_id === drugData.id,
- );
- if (existItem) {
- message.warning('当前聊天没有可添加的药品');
- return;
- }
-
- // 添加药品到处方单
- const success = prescriptionStore.addProducts(drugData);
- if (success) {
- message.success(`已成功添加 ${drugData.drug.drug_name} 到处方单`);
- // 打开处方模态框
- prescriptionModalApi.setData({
- registerId: prescriptionStore.currentRegisterId,
- onPrescriptionSent: handlePrescriptionSent,
- });
- prescriptionModalApi.open();
- } else {
- message.warning('当前聊天没有可添加的药品');
- }
- } catch (error) {
- console.error('添加最新药品失败:', error);
- message.warning('当前聊天没有可添加的药品');
- }
- } else {
- message.warning('当前聊天没有可添加的药品');
- }
- }
-
- // 如果有错误,显示错误信息
- if (errors.length > 0) {
- console.warn('添加药品时的错误:', errors);
+ } else {
+ message.warning('所有药品已在处方中');
}
} catch (error) {
- console.error('批量添加药品失败:', error);
+ console.error('添加药品失败:', error);
message.error('添加药品失败,请重试');
}
};
@@ -476,6 +344,9 @@ const handleAddPatientProductsToPrescription = async () => {
+
+
+