From 86c5b7431d069be8091f5f81d8bb7f43dfea5707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Wed, 4 Feb 2026 14:16:05 +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 --- .../src/components/modal/InfoModal.vue | 70 +++++++++++++ .../chat/components/PrescriptionModal.vue | 47 ++++++++- .../doctor/doctor-reception/api/index.ts | 7 ++ .../views/doctor/doctor-reception/index.vue | 99 ++++++++++++++----- 4 files changed, 196 insertions(+), 27 deletions(-) create mode 100644 apps/web-antd/src/components/modal/InfoModal.vue diff --git a/apps/web-antd/src/components/modal/InfoModal.vue b/apps/web-antd/src/components/modal/InfoModal.vue new file mode 100644 index 00000000..705766c1 --- /dev/null +++ b/apps/web-antd/src/components/modal/InfoModal.vue @@ -0,0 +1,70 @@ + + + + + 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 be2ce65d..8d73c052 100644 --- a/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue +++ b/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue @@ -51,6 +51,8 @@ import SimpleProductModal from '#/views/doctor/doctor-reception/components/Simpl // 常用方选择弹窗组件 import CommonPrescriptionModal from '#/views/doctor/doctor-reception/components/CommonPrescriptionModal.vue'; import StoreConfirmModal from './StoreConfirmModal.vue'; +// 信息提示模态框 +import InfoModal from '#/components/modal/InfoModal.vue'; // 药品搜索选择组件 import { DrugSearchSelect } from '#/components/drug-search-select'; @@ -156,6 +158,11 @@ const [PrescriptionDetailModal, PrescriptionDetailModalApi] = useVbenModal({ connectedComponent: PrescriptionDetail, }); +// 信息提示模态框 +const [InfoModalComponent, infoModalApi] = useVbenModal({ + connectedComponent: InfoModal, +}); + // 诊所确认弹窗 const [StoreConfirmModalComponent, storeConfirmModalApi] = useVbenModal({ connectedComponent: StoreConfirmModal, @@ -290,8 +297,45 @@ const searchOption = (inputValue: string) => { prescriptionStore.getDrugList(inputValue); }; -const tabChange = (id: number) => { +const tabChange = async (id: number) => { prescriptionStore.changeCategory(id); + + // 如果切换到中药(id === 1),检测当前诊所是否为西医诊所 + if (id === 1) { + await checkAndShowTransferTip(); + } +}; + +/** + * 检测并显示转诊提示 + * @description 当切换到中药处方时,如果当前诊所为西医诊所,显示转诊提示 + */ +const checkAndShowTransferTip = async () => { + try { + // 重新获取挂号诊所信息,确保包含最新的诊所类型和委托诊所信息 + await prescriptionStore.fetchRegisterStoreInfo(); + + const storeInfo = prescriptionStore.registerStoreInfo; + if (!storeInfo) { + return; + } + + // 检测是否为西医诊所(current_store_clinic_type === 1) + if (storeInfo.current_store_clinic_type === 1 && storeInfo.delegate_store) { + const delegateStore = storeInfo.delegate_store; + const doctorName = delegateStore.doctor?.name || '委托医生'; + const storeName = delegateStore.name || '委托诊所'; + + infoModalApi + .setState({ title: '转诊提示', width: 500 }) + .setData({ + content: `检测到当前诊所为西医诊所,本次处方开具后自动转接到【${storeName}】的【${doctorName}】的在线复诊中`, + }) + .open(); + } + } catch (error) { + console.error('获取诊所信息失败:', error); + } }; const togglePatientInfo = () => { @@ -1569,6 +1613,7 @@ const cancelSaveCommonPrescription = () => { + diff --git a/apps/web-antd/src/views/doctor/doctor-reception/api/index.ts b/apps/web-antd/src/views/doctor/doctor-reception/api/index.ts index 5f19a1bd..1ba7e099 100644 --- a/apps/web-antd/src/views/doctor/doctor-reception/api/index.ts +++ b/apps/web-antd/src/views/doctor/doctor-reception/api/index.ts @@ -72,6 +72,13 @@ export async function getMyStoreListApi() { return requestClient.get(`${prefix}get-my-store-list`); } +/** + * 获取当前诊所类型和委托诊所信息 + */ +export async function getCurrentStoreTypeApi() { + return requestClient.get(`${prefix}get-current-store-type`); +} + /** * 接诊 */ diff --git a/apps/web-antd/src/views/doctor/doctor-reception/index.vue b/apps/web-antd/src/views/doctor/doctor-reception/index.vue index faa456c2..e03e4dbc 100644 --- a/apps/web-antd/src/views/doctor/doctor-reception/index.vue +++ b/apps/web-antd/src/views/doctor/doctor-reception/index.vue @@ -40,6 +40,7 @@ import { endOfDiagnosisApi, getDrugUseList, getMyStoreListApi, + getCurrentStoreTypeApi, getPatientItem, getPatientList, getProcessRuleList, @@ -59,6 +60,8 @@ import RefusalOfTreatmentModal import CommonPrescriptionModal from './components/CommonPrescriptionModal.vue'; // 确认模态框组件 import ConfirmModal from './components/ConfirmModal.vue'; +// 信息提示模态框组件 +import InfoModal from '#/components/modal/InfoModal.vue'; // 药品搜索选择组件 import { DrugSearchSelect } from '#/components/drug-search-select'; // 保存常用方API @@ -351,7 +354,7 @@ const selectPatient = (patient: Patient, isUpdateTabType = true) => { } } activePatient.value = patient.user_patient; - + // 恢复之前保存的 activeCategory const savedCategory = localStorage.getItem(`activeCategory${patient.user_patient?.id}`); if (savedCategory) { @@ -367,7 +370,7 @@ const selectPatient = (patient: Patient, isUpdateTabType = true) => { } // 否则保持默认值 } - + getPatientItem(patient.id).then((value) => { patientInfo.value = value; userPatientHealthInquiry.value = value.user_patient_health_inquiry; @@ -575,11 +578,11 @@ const sendPrescription = () => { doctor_second_sign: doctorSecondSign.value, }).then((res) => { message.success('处方已发送'); - + // 检查是否需要转诊 const needTransfer = res?.result?.need_transfer || res?.data?.need_transfer || res?.need_transfer; const transferPrescriptionId = res?.result?.transfer_prescription_id || res?.data?.transfer_prescription_id || res?.transfer_prescription_id; - + if (needTransfer && transferPrescriptionId) { // 如果需要转诊,获取转诊信息 fetchTransferPrescription(transferPrescriptionId); @@ -588,7 +591,7 @@ const sendPrescription = () => { // 不需要转诊,清空转诊信息 transferPrescription.value = null; } - + // 清空当前数据 currentDrugs.value = []; diagnosis.value = ''; @@ -600,7 +603,7 @@ const sendPrescription = () => { tabType.value = 1; newDrugInfo.value = {}; updateLocalStorage(); - + // 刷新患者信息 if (selectPatientId.value) { getPatientItem(selectPatientId.value).then((value) => { @@ -710,6 +713,11 @@ const [ConfirmModalComponent, confirmModalApi] = useVbenModal({ connectedComponent: ConfirmModal, }); +// ==================== 信息提示模态框 ==================== +const [InfoModalComponent, infoModalApi] = useVbenModal({ + connectedComponent: InfoModal, +}); + /** * 打开常用方选择弹窗 * @description 打开常用方弹窗,选择后自动填充药品到处方中 @@ -789,7 +797,7 @@ async function handleSelectCommonPrescription(data: any, type: number) { dosage.value = prescription.dosage ?? 7; dayDosage.value = prescription.day_dosage ?? 2; packageMethodId.value = prescription.package_method_id ?? 2; - + // 如果是委托调剂,写入完整加工规则配置 - 只有有效值才写入(大于0),级联加载 if (prescription.process_rule_id && prescription.process_rule_id > 0) { processRuleId.value = prescription.process_rule_id; @@ -973,6 +981,7 @@ function splitString(str: string) { * 1. 先保存当前Tab的药品数据 * 2. 更新activeCategory * 3. 加载新Tab对应的药品数据 + * 4. 如果切换到中药且当前诊所为西医诊所,显示转诊提示 */ function tabChange(id) { // 先保存当前Tab的药品数据 @@ -980,15 +989,52 @@ function tabChange(id) { getStorageKey(activePatient.value?.id, activeCategory.value), JSON.stringify(currentDrugs.value), ); - + // 更新Tab类型 localStorage.setItem(`activeCategory${activePatient.value?.id}`, id); activeCategory.value = id; - + // 加载新Tab对应的药品数据 currentDrugs.value = JSON.parse( localStorage.getItem(getStorageKey(activePatient.value?.id, id)) || '[]', ); + + // 如果切换到中药(id === 1),检测当前诊所是否为西医诊所 + if (id === 1) { + checkAndShowTransferTip(); + } +} + +/** + * 检测并显示转诊提示 + * @description 当切换到中药处方时,如果当前诊所为西医诊所,显示转诊提示 + */ +async function checkAndShowTransferTip() { + try { + // 调用新接口获取当前诊所类型和委托诊所信息 + const storeInfo = await getCurrentStoreTypeApi(); + // const storeInfo = res; + + if (!storeInfo) { + return; + } + console.log(storeInfo, 'aaaaaaaaaaaaaaaaa') + + // 检测是否为西医诊所(clinic_type === 1) + if (storeInfo.clinic_type === 1 && storeInfo.delegate_store) { + const delegateStore = storeInfo.delegate_store; + const doctorName = delegateStore.doctor?.name || '委托医生'; + const storeName = delegateStore.name || '委托诊所'; + + infoModalApi.setState({ title: '转诊提示', width: 500 }); + infoModalApi.setData({ + content: `检测到当前诊所为西医诊所,本次处方开具后自动转接到【${storeName}】的【${doctorName}】的在线复诊中`, + }); + infoModalApi.open(); + } + } catch (error) { + console.error('获取诊所信息失败:', error); + } } /** @@ -1477,7 +1523,7 @@ const newDrugInfo = ref({}); */ const fetchTransferPrescription = async (transferPrescriptionId: number) => { if (!transferPrescriptionId) return; - + loadingTransfer.value = true; try { // 通过转诊处方ID获取转诊信息 @@ -1556,6 +1602,7 @@ watch(