From 37d42263a81374c2919b9ea617c3444adcc3d10d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Wed, 4 Feb 2026 08:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E6=8E=A5=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/store/prescription.ts | 68 +-- .../business/chat/api/transferPrescription.ts | 36 ++ .../business/chat/components/ChatArea.vue | 8 +- .../chat/components/MessageBubble.vue | 44 +- .../business/chat/components/MessageInput.vue | 69 ++- .../business/chat/components/MessageList.vue | 4 + .../chat/components/PrescriptionModal.vue | 167 +++--- .../business/store/settings/api/index.ts | 8 + .../views/business/store/settings/index.vue | 75 +++ .../views/doctor/doctor-reception/index.vue | 89 +++- .../components/PatientInfoPanel.vue | 55 +- .../online-consultation-clinic/index.vue | 7 + .../components/PatientInfoPanel.vue | 55 +- .../components/PatientList.vue | 20 + .../components/TransferPrescriptionCard.vue | 481 +++++++++++++++++ .../TransferPrescriptionMessageCard.vue | 442 ++++++++++++++++ .../TransferPrescriptionViewDrawer.vue | 490 ++++++++++++++++++ .../doctor/online-consultation/index.vue | 11 + .../src/views/system/store/api/index.ts | 8 + .../src/views/system/store/config/form.ts | 16 + .../src/views/system/store/config/table.ts | 7 + .../web-antd/src/views/system/store/index.vue | 57 +- 22 files changed, 2120 insertions(+), 97 deletions(-) create mode 100644 apps/web-antd/src/views/business/chat/api/transferPrescription.ts create mode 100644 apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionCard.vue create mode 100644 apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue create mode 100644 apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionViewDrawer.vue diff --git a/apps/web-antd/src/store/prescription.ts b/apps/web-antd/src/store/prescription.ts index d1f82a02..07a3d730 100644 --- a/apps/web-antd/src/store/prescription.ts +++ b/apps/web-antd/src/store/prescription.ts @@ -794,7 +794,7 @@ export const usePrescriptionStore = defineStore('prescription', () => { return false; } try { - await addWestPrescription({ + const response = await addWestPrescription({ patient: activePatient.value, drugs: currentDrugs.value, diagnosis: diagnosis.value, @@ -821,36 +821,44 @@ export const usePrescriptionStore = defineStore('prescription', () => { // 诊所选择参数(使用传入的参数) send_mode: customSendMode, custom_store_id: customSendMode === 1 ? customStoreId : null, - }).then((res) => { - message.success('处方已发送'); - sendMessage({ - roomId: chatStore.currentFriend.room_id, - senderId: userStore.currentUser.doctor_id, - receiverId: chatStore.currentFriend.id, - type: 'prescription', - content: JSON.stringify(res), - }); - chatStore.addMessage( - { - id: Date.now().toString(), - room_id: chatStore.currentFriend.room_id, - sender_user_id: `doctor-${userStore.currentUser.doctor_id}`, - receiver_user_id: chatStore.currentFriend.id, - message_type: 4, - message_content: JSON.stringify(res), - messageTypeName: 'prescription', - created_at: Date.now(), - created_at_text: new Date().toLocaleTimeString().slice(0, 5), - timestamp: Date.now(), - isSent: true, - read: true, - duration: 0, - }, - userStore.currentUser.doctor_id, - ); - resetForm(); }); - return true; + + const res = await response; + message.success('处方已发送'); + sendMessage({ + roomId: chatStore.currentFriend.room_id, + senderId: userStore.currentUser.doctor_id, + receiverId: chatStore.currentFriend.id, + type: 'prescription', + content: JSON.stringify(res), + }); + chatStore.addMessage( + { + id: Date.now().toString(), + room_id: chatStore.currentFriend.room_id, + sender_user_id: `doctor-${userStore.currentUser.doctor_id}`, + receiver_user_id: chatStore.currentFriend.id, + message_type: 4, + message_content: JSON.stringify(res), + messageTypeName: 'prescription', + created_at: Date.now(), + created_at_text: new Date().toLocaleTimeString().slice(0, 5), + timestamp: Date.now(), + isSent: true, + read: true, + duration: 0, + }, + userStore.currentUser.doctor_id, + ); + resetForm(); + + // 返回包含转诊信息的响应数据 + return { + success: true, + result: res?.result || res?.data || res, + need_transfer: res?.result?.need_transfer || res?.data?.need_transfer || res?.need_transfer, + transfer_prescription_id: res?.result?.transfer_prescription_id || res?.data?.transfer_prescription_id || res?.transfer_prescription_id, + }; } catch (error) { console.error('发送处方失败:', error); message.error('发送处方失败'); diff --git a/apps/web-antd/src/views/business/chat/api/transferPrescription.ts b/apps/web-antd/src/views/business/chat/api/transferPrescription.ts new file mode 100644 index 00000000..c25b9463 --- /dev/null +++ b/apps/web-antd/src/views/business/chat/api/transferPrescription.ts @@ -0,0 +1,36 @@ +import { requestClient } from '#/api/request'; + +const prefix = 'transfer-prescription/'; + +/** + * 获取转诊详情 + * @param id 转诊ID + */ +export async function getTransferPrescriptionDetailApi(id: number) { + return requestClient.get(`${prefix}detail`, { params: { id } }); +} + +/** + * 根据挂号ID获取转诊信息 + * @param registerId 挂号ID + */ +export async function getTransferPrescriptionByRegisterApi(registerId: number) { + return requestClient.get(`${prefix}get-by-register`, { params: { register_id: registerId } }); +} + +/** + * 确认转诊 + * @param id 转诊ID + */ +export async function confirmTransferPrescriptionApi(id: number) { + return requestClient.post(`${prefix}confirm`, { id }); +} + +/** + * 一键导入处方到在线问诊 + * @param id 转诊ID + * @param registerId 挂号ID + */ +export async function importTransferPrescriptionApi(id: number, registerId: number) { + return requestClient.post(`${prefix}import`, { id, register_id: registerId }); +} diff --git a/apps/web-antd/src/views/business/chat/components/ChatArea.vue b/apps/web-antd/src/views/business/chat/components/ChatArea.vue index 4a48f7e1..fbe70681 100644 --- a/apps/web-antd/src/views/business/chat/components/ChatArea.vue +++ b/apps/web-antd/src/views/business/chat/components/ChatArea.vue @@ -14,6 +14,7 @@ const emit = defineEmits([ // ... existing emits 'openPrescription', 'end-consultation-success', + 'transfer-import-success', ]); // 开方功能触发函数 @@ -35,12 +36,17 @@ const handleEndConsultationSuccess = () => { - + diff --git a/apps/web-antd/src/views/business/chat/components/MessageBubble.vue b/apps/web-antd/src/views/business/chat/components/MessageBubble.vue index 6e517c5a..e8b002c4 100644 --- a/apps/web-antd/src/views/business/chat/components/MessageBubble.vue +++ b/apps/web-antd/src/views/business/chat/components/MessageBubble.vue @@ -12,8 +12,8 @@ import { sendMessage } from '#/views/business/chat/utils/request'; // 辅助函数:按需解析消息内容 const getParsedContent = (messageType, messageContent) => { - // 对于需要 JSON 解析的消息类型:4, 9, 10, 11, 12, 13 - if ([4, 9, 10, 11, 12, 13].includes(messageType)) { + // 对于需要 JSON 解析的消息类型:4, 9, 10, 11, 12, 13, 14 + if ([4, 9, 10, 11, 12, 13, 14].includes(messageType)) { try { return JSON.parse(messageContent); } catch (e) { @@ -41,6 +41,7 @@ const getMessageTypeName = (messageType) => { 11: 'patient-experience', 12: 'product-card', 13: 'end-consultation', + 14: 'transfer-prescription', }; return types[messageType] || 'unknown'; }; @@ -56,6 +57,8 @@ import AudioMessage from './AudioMessage.vue'; import PatientExperienceCard from '#/views/doctor/online-consultation/components/PatientExperienceCard.vue'; import ProductCard from '#/views/doctor/online-consultation/components/ProductCard.vue'; import EndConsultationCard from '#/views/doctor/online-consultation/components/EndConsultationCard.vue'; +import TransferPrescriptionMessageCard from '#/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue'; +import TransferPrescriptionViewDrawer from '#/views/doctor/online-consultation/components/TransferPrescriptionViewDrawer.vue'; const props = defineProps({ message: { @@ -71,12 +74,16 @@ const props = defineProps({ required: true, }, }); -const emit = defineEmits(['show-user-profile']); +const emit = defineEmits(['show-user-profile', 'open-prescription', 'transfer-import-success']); const chatUserStore = chatUseUserStore(); const userStore = useUserStore(); const chatStore = useChatStore(); const themeStore = useThemeStore(); +// 转接方查看抽屉相关 +const showTransferDrawer = ref(false); +const transferRegisterId = ref(null); + const [RefusalOfTreatmentModals, RefusalOfTreatmentModalApi] = useVbenModal({ connectedComponent: RefusalOfTreatmentModal, }); @@ -199,6 +206,21 @@ const acceptRegister = async (registerId, orderNo) => { } }; +// 查看转接方详情 +const handleViewTransferDetail = (transferData) => { + transferRegisterId.value = chatStore.currentFriend?.register_id; + showTransferDrawer.value = true; +}; + +// 处理转接方导入成功 +const handleTransferImportSuccess = (prescriptionData) => { + // 触发打开处方模态框事件 + const registerId = transferRegisterId.value || chatStore.currentFriend?.register_id; + if (registerId) { + emit('open-prescription', registerId); + } +}; + // 拒诊操作 const rejectRegister = async (registerId, orderNo) => { if (registerOperating.value) return; @@ -821,6 +843,15 @@ if (props.message.message_type === 10) { :content="parsedContent" /> + + +
diff --git a/apps/web-antd/src/views/business/chat/components/MessageInput.vue b/apps/web-antd/src/views/business/chat/components/MessageInput.vue index 7bc84ef2..77b7caae 100644 --- a/apps/web-antd/src/views/business/chat/components/MessageInput.vue +++ b/apps/web-antd/src/views/business/chat/components/MessageInput.vue @@ -12,6 +12,8 @@ import { useThemeStore } from '../stores/theme.ts'; import { useUserStore } from '../stores/user.ts'; import { sendMessage } from '../utils/request.ts'; import { usePrescriptionStore } from '#/store/prescription'; +import { getTransferPrescriptionByRegisterApi } from '#/views/business/chat/api/transferPrescription'; +import TransferPrescriptionViewDrawer from '#/views/doctor/online-consultation/components/TransferPrescriptionViewDrawer.vue'; // 根据路由判断是在线复诊-药店还是在线复诊-诊所 const route = useRoute(); @@ -58,6 +60,8 @@ const prescriptionStore = usePrescriptionStore(); const messageText = ref(''); const messageInputRef = ref(null); const showEmojiPicker = ref(false); +const showTransferDrawer = ref(false); +const transferRegisterId = ref(null); // 使用文件上传组合式函数 const { @@ -325,7 +329,8 @@ onUnmounted(() => { const emit = defineEmits([ 'sendMessage', 'openPrescription', // 添加开方事件 - 'end-consultation-success' // 结束接诊成功事件 + 'end-consultation-success', // 结束接诊成功事件 + 'transfer-import-success' // 转接方导入成功事件 ]); // 开方功能触发函数 @@ -453,6 +458,37 @@ const handleEndConsultation = () => { }); }; +// 打开转接方查看抽屉 +const handleOpenTransferView = async () => { + const registerId = chatStore.currentFriend?.register_id; + if (!registerId) { + message.warning('患者信息不完整,无法查看转接方'); + return; + } + + // 检查是否有转接方 + try { + const res = await getTransferPrescriptionByRegisterApi(registerId); + const data = res?.result || res?.data || res; + if (data && data.id) { + transferRegisterId.value = registerId; + showTransferDrawer.value = true; + } else { + message.warning('该患者没有转接方信息'); + } + } catch (error) { + console.error('检查转接方信息失败:', error); + message.error('检查转接方信息失败,请重试'); + } +}; + +// 处理转接方导入成功 +const handleTransferImportSuccess = (prescriptionData) => { + // 触发打开处方模态框的事件 + emit('transfer-import-success', prescriptionData); + emit('openPrescription', transferRegisterId.value || chatStore.currentFriend?.register_id); +}; + @@ -654,6 +706,21 @@ const handleEndConsultation = () => { color: #ff4d4f; } +.transfer-view-btn { + color: #f97316; + font-weight: 500; +} + +.transfer-view-btn:hover { + background-color: #fff7ed; + color: #f97316; +} + +.dark .transfer-view-btn:hover { + background-color: rgba(249, 115, 22, 0.2); + color: #f97316; +} + .function-buttons { display: flex; gap: 12px; diff --git a/apps/web-antd/src/views/business/chat/components/MessageList.vue b/apps/web-antd/src/views/business/chat/components/MessageList.vue index 9cdb2b06..7521f6e7 100644 --- a/apps/web-antd/src/views/business/chat/components/MessageList.vue +++ b/apps/web-antd/src/views/business/chat/components/MessageList.vue @@ -11,6 +11,8 @@ import MessageBubble from './MessageBubble.vue'; const userStore = useUserStore(); const chatStore = useChatStore(); +const emit = defineEmits(['open-prescription', 'transfer-import-success']); + const messagesContainer = ref(null); const loadingMessages = ref(false); const loadingOlderMessages = ref(false); // 加载历史消息状态 @@ -163,6 +165,8 @@ onMounted(() => { :is-sent="msg.isSent" :message="msg" :sender-info="getSenderInfo(msg)" + @open-prescription="(registerId) => emit('open-prescription', registerId)" + @transfer-import-success="(data) => emit('transfer-import-success', data)" /> diff --git a/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue b/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue index 03fac35f..be2ce65d 100644 --- a/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue +++ b/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue @@ -227,12 +227,38 @@ const executeSendPrescription = async ( sendMode: number, customStoreId: number | null, ) => { - const success = await prescriptionStore.sendPrescription( + const result = await prescriptionStore.sendPrescription( doctorSecondSignValue, sendMode, customStoreId, ); + + // 检查返回结果,可能是boolean或包含转诊信息的对象 + const success = typeof result === 'boolean' ? result : result?.success !== false; + const prescriptionResult = typeof result === 'object' ? result : null; + if (success) { + // 检查是否需要转诊(西医诊所开中药处方) + if (prescriptionResult?.need_transfer || prescriptionResult?.result?.need_transfer) { + const transferId = prescriptionResult?.transfer_prescription_id || prescriptionResult?.result?.transfer_prescription_id; + if (transferId) { + // 显示转诊确认提示 + AntModal.info({ + title: '转诊提示', + content: '该处方已触发转诊流程,转诊消息已发送给委托诊所的在线问诊医生。', + okText: '确定', + onOk: () => { + if (modalData.value?.onPrescriptionSent) { + modalData.value.onPrescriptionSent(); + } + submittingType.value = false; + modalApi.close(); + }, + }); + return; + } + } + if (modalData.value?.onPrescriptionSent) { modalData.value.onPrescriptionSent(); } @@ -1356,65 +1382,90 @@ const cancelSaveCommonPrescription = () => {
-
- 用量: - - - - - 天 / {{ prescriptionStore.dosage }} 剂 +
+ 用量: +
+ + + +
+ 天 / {{ prescriptionStore.dosage }} 剂
-
- 频次: - - - - - 次/天 +
+ 频次: +
+ + + +
+ 次/天
diff --git a/apps/web-antd/src/views/business/store/settings/api/index.ts b/apps/web-antd/src/views/business/store/settings/api/index.ts index fb1b87af..9b6beb2e 100644 --- a/apps/web-antd/src/views/business/store/settings/api/index.ts +++ b/apps/web-antd/src/views/business/store/settings/api/index.ts @@ -58,6 +58,14 @@ export async function updateNavSortApi(ids: number[]) { return requestClient.post(`${prefix}update-nav-sort`, { ids }); } +/** + * 更新诊所类型 + * @param data 包含clinic_type的对象,clinic_type: 1=西医诊所, 2=中医诊所 + */ +export async function updateClinicTypeApi(data: { clinic_type: number }) { + return requestClient.post(`${prefix}update-clinic-type`, data); +} + /* ----------------------------推广员--------------------------------- */ diff --git a/apps/web-antd/src/views/business/store/settings/index.vue b/apps/web-antd/src/views/business/store/settings/index.vue index 72c9db4a..3418fa75 100644 --- a/apps/web-antd/src/views/business/store/settings/index.vue +++ b/apps/web-antd/src/views/business/store/settings/index.vue @@ -12,6 +12,7 @@ import { ImagePreviewGroup, InputNumber, message, + Modal, notification, Popconfirm, RadioButton, @@ -27,6 +28,7 @@ import { getStoreInfoApi, saveZSalePercentApi, updateNavSortApi, + updateClinicTypeApi, } from '#/views/business/store/settings/api'; import UploadModal from './components/uploadModal.vue'; @@ -41,6 +43,7 @@ interface TabBarItem { interface StoreInfo { name: string; type: number; // 0=诊所, 1=药店 + clinic_type?: number; // 1=西医诊所, 2=中医诊所 star?: any; title: { name: string }; contact: string; @@ -295,6 +298,44 @@ const openPreview = (index: number) => { previewCurrent.value = index; previewVisible.value = true; }; + +/** + * 切换诊所类型 + */ +const handleSwitchClinicType = () => { + if (!data.value) return; + + const currentType = data.value.clinic_type || 2; // 默认为中医诊所 + const newType = currentType === 1 ? 2 : 1; + const currentTypeText = currentType === 1 ? '西医诊所' : '中医诊所'; + const newTypeText = newType === 1 ? '西医诊所' : '中医诊所'; + + Modal.confirm({ + title: '确认切换诊所类型', + content: `确定要将诊所类型从【${currentTypeText}】切换为【${newTypeText}】吗?`, + okText: '确定', + cancelText: '取消', + onOk: async () => { + try { + await updateClinicTypeApi({ clinic_type: newType }); + notification.success({ + message: '切换成功', + description: `诊所类型已切换为【${newTypeText}】`, + duration: 2, + }); + // 刷新诊所信息 + getMyInfo(); + } catch (error) { + console.error('切换诊所类型失败:', error); + notification.error({ + message: '切换失败', + description: '请稍后重试', + duration: 2, + }); + } + } + }); +}; 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 c2e46f43..990725c2 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 @@ -5,8 +5,12 @@ import { getPatientDetail, reception } from '../api/index.ts'; import { message } from 'ant-design-vue'; import { sendMessage } from '#/views/business/chat/utils/request'; import { useUserStore } from '#/views/business/chat/stores/user'; +import { getTransferPrescriptionByRegisterApi } from '#/views/business/chat/api/transferPrescription'; +import TransferPrescriptionCard from './TransferPrescriptionCard.vue'; +import { usePrescriptionStore } from '#/store/prescription'; const userStore = useUserStore(); +const prescriptionStore = usePrescriptionStore(); const props = defineProps({ patient: { @@ -19,11 +23,13 @@ const props = defineProps({ } }); -const emit = defineEmits(['reception-success', 'enter-chat']); +const emit = defineEmits(['reception-success', 'enter-chat', 'transfer-import-success']); const patientDetail = ref(null); const loading = ref(false); const receptionLoading = ref(false); +const transferPrescription = ref(null); +const loadingTransfer = ref(false); // 获取患者详情 const fetchPatientDetail = async () => { @@ -49,6 +55,13 @@ const fetchPatientDetail = async () => { // 确保正确解析返回数据 const data = res?.result || res?.data || res || null; patientDetail.value = data; + + // 检查是否有转诊挂号 + if (data?.register_order?.is_from_transfer === 1 && registerId) { + await fetchTransferPrescription(registerId); + } else { + transferPrescription.value = null; + } } catch (error) { console.error('获取患者详情失败:', error); message.error('获取患者详情失败,请重试'); @@ -58,6 +71,33 @@ const fetchPatientDetail = async () => { } }; +// 获取转诊信息 +const fetchTransferPrescription = async (registerId) => { + if (!registerId) return; + + loadingTransfer.value = true; + try { + const res = await getTransferPrescriptionByRegisterApi(registerId); + const data = res?.result || res?.data || res; + if (data && data.id) { + transferPrescription.value = data; + } else { + transferPrescription.value = null; + } + } catch (error) { + console.error('获取转诊信息失败:', error); + transferPrescription.value = null; + } finally { + loadingTransfer.value = false; + } +}; + +// 处理转诊导入成功 +const handleTransferImportSuccess = (prescriptionData) => { + // 触发打开处方模态框的事件 + emit('transfer-import-success', prescriptionData); +}; + // 接诊 const handleReception = async () => { if (!props.patient) { @@ -173,6 +213,15 @@ watch( + +
+ +
+

就诊记录

@@ -265,6 +314,10 @@ watch( padding-bottom: 8px; } +.transfer-section { + margin-top: 24px; +} + .register-info-section { margin-top: 24px; } diff --git a/apps/web-antd/src/views/doctor/online-consultation/components/PatientList.vue b/apps/web-antd/src/views/doctor/online-consultation/components/PatientList.vue index 376e8255..7f818248 100644 --- a/apps/web-antd/src/views/doctor/online-consultation/components/PatientList.vue +++ b/apps/web-antd/src/views/doctor/online-consultation/components/PatientList.vue @@ -177,6 +177,9 @@ defineExpose({ {{ getStatusText(patient.status) }} + + 转诊 + {{ getRegisterTypeText(patient.register_type) }} @@ -294,6 +297,23 @@ defineExpose({ border-color: rgba(24, 144, 255, 0.3); } +.transfer-tag { + display: inline-block; + padding: 2px 8px; + border-radius: 4px; + font-size: 12px; + font-weight: 500; + background: #fff7ed; + color: #ea580c; + border: 1px solid #fed7aa; +} + +.dark .transfer-tag { + background: rgba(234, 88, 12, 0.2); + color: #fb923c; + border-color: rgba(234, 88, 12, 0.3); +} + .status { display: inline-block; padding: 2px 8px; 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 new file mode 100644 index 00000000..978f78ed --- /dev/null +++ b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionCard.vue @@ -0,0 +1,481 @@ + + + + + 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 new file mode 100644 index 00000000..a0d14fe6 --- /dev/null +++ b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue @@ -0,0 +1,442 @@ + + + + + diff --git a/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionViewDrawer.vue b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionViewDrawer.vue new file mode 100644 index 00000000..4d17909e --- /dev/null +++ b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionViewDrawer.vue @@ -0,0 +1,490 @@ + + + + + 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 5141c3f5..fbe0a1b8 100644 --- a/apps/web-antd/src/views/doctor/online-consultation/index.vue +++ b/apps/web-antd/src/views/doctor/online-consultation/index.vue @@ -272,6 +272,15 @@ const handleEndConsultationSuccess = () => { patientListRef.value?.fetchPatientList(); }; +// 处理转诊导入成功 +const handleTransferImportSuccess = (prescriptionData) => { + // 打开处方模态框 + const targetRegisterId = registerId.value || prescriptionData?.register_id; + if (targetRegisterId) { + openPrescriptionModule(targetRegisterId); + } +}; + // 将患者购买的药品加入处方单 const handleAddPatientProductsToPrescription = async () => { // 检查处方store是否已初始化 @@ -374,6 +383,7 @@ const handleAddPatientProductsToPrescription = async () => { :doctor-id="userStore.currentUser?.doctor_id" @reception-success="handleReceptionSuccess" @enter-chat="handleEnterChat" + @transfer-import-success="handleTransferImportSuccess" class="patient-info-panel" /> @@ -385,6 +395,7 @@ const handleAddPatientProductsToPrescription = async () => { v-if="chatStore.currentFriend" @open-prescription="openPrescriptionModule" @end-consultation-success="handleEndConsultationSuccess" + @transfer-import-success="handleTransferImportSuccess" />
diff --git a/apps/web-antd/src/views/system/store/api/index.ts b/apps/web-antd/src/views/system/store/api/index.ts index 928cfee9..2fba957b 100644 --- a/apps/web-antd/src/views/system/store/api/index.ts +++ b/apps/web-antd/src/views/system/store/api/index.ts @@ -149,3 +149,11 @@ export async function batchSyncDrugPriceApi(ids: number[]) { ids, }); } + +/** + * 更新诊所类型 + * @param data 包含id和clinic_type的对象,clinic_type: 1=西医诊所, 2=中医诊所 + */ +export async function updateClinicTypeApi(data: { id: number; clinic_type: number }) { + return requestClient.post(`${prefix}update-clinic-type`, data); +} diff --git a/apps/web-antd/src/views/system/store/config/form.ts b/apps/web-antd/src/views/system/store/config/form.ts index e2c73e44..838ddaef 100644 --- a/apps/web-antd/src/views/system/store/config/form.ts +++ b/apps/web-antd/src/views/system/store/config/form.ts @@ -106,6 +106,22 @@ export const modalFormProps: VbenFormProps = { label: '是否包邮', rules: 'required', }, + { + // 诊所类型(单选) + component: 'RadioGroup', + formItemClass: 'col-span-6', + componentProps: { + options: [ + { label: '西医诊所', value: 1 }, + { label: '中医诊所', value: 2 }, + ], + placeholder: '诊所类型', + }, + fieldName: 'clinic_type', + label: '诊所类型', + rules: 'required', + defaultValue: 2, // 默认中医诊所 + }, { // 是否订阅价格波动(单选,新增和编辑时都显示) component: 'RadioGroup', diff --git a/apps/web-antd/src/views/system/store/config/table.ts b/apps/web-antd/src/views/system/store/config/table.ts index 9809a8d9..b1383c5b 100644 --- a/apps/web-antd/src/views/system/store/config/table.ts +++ b/apps/web-antd/src/views/system/store/config/table.ts @@ -25,6 +25,13 @@ export const gridOptions: VxeGridProps = { { type: 'checkbox', width: 60 }, { field: 'id', align: 'left', title: 'ID', width: 100 }, { field: 'name', align: 'left', title: '诊所名称' }, + { + field: 'clinic_type', + align: 'left', + title: '诊所类型', + width: 120, + slots: { default: 'clinic_type' }, + }, { field: 'online_consultation_config', align: 'left', diff --git a/apps/web-antd/src/views/system/store/index.vue b/apps/web-antd/src/views/system/store/index.vue index 8f296a13..d20f6591 100644 --- a/apps/web-antd/src/views/system/store/index.vue +++ b/apps/web-antd/src/views/system/store/index.vue @@ -7,7 +7,7 @@ import { Page, useVbenModal } from '@vben/common-ui'; import { useUserStore } from '@vben/stores'; import { useClipboard } from '@vueuse/core'; -import { Button, Image, message, Switch, Tag } from 'ant-design-vue'; +import { Button, Image, message, Modal, Switch, Tag } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { Icon } from '#/components/icon'; @@ -19,6 +19,7 @@ import { deleteStore, openPcWindowsApiByStore, openQrCodeApi, + updateClinicTypeApi, updateStoreShippingFree, updateStoreSubscribeStatus, } from './api'; @@ -189,6 +190,36 @@ const batchSyncDrugPrice = () => { message.error('批量同步失败!'); }); }; + +/** + * 切换诊所类型 + */ +const handleSwitchClinicType = (row: any) => { + if (!row) return; + + const currentType = row.clinic_type || 2; // 默认为中医诊所 + const newType = currentType === 1 ? 2 : 1; + const currentTypeText = currentType === 1 ? '西医诊所' : '中医诊所'; + const newTypeText = newType === 1 ? '西医诊所' : '中医诊所'; + const clinicName = row.name || '该诊所'; + + Modal.confirm({ + title: '确认切换诊所类型', + content: `确定要将【${clinicName}】的诊所类型从【${currentTypeText}】切换为【${newTypeText}】吗?`, + okText: '确定', + cancelText: '取消', + onOk: async () => { + try { + await updateClinicTypeApi({ id: row.id, clinic_type: newType }); + message.success(`诊所类型已切换为【${newTypeText}】`); + gridApi.query(); + } catch (error) { + console.error('切换诊所类型失败:', error); + message.error('切换失败,请稍后重试'); + } + } + }); +}; +