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 4dd4ac71..c940f0c8 100644 --- a/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue +++ b/apps/web-antd/src/views/business/chat/components/PrescriptionModal.vue @@ -1,5 +1,5 @@ + + + + + 患者:{{ detail.patient_name }} {{ detail.patient_mobile }} + 诊断:{{ detail.clinical_diagnose || '-' }} + 医嘱:{{ detail.doctor_order || '-' }} + + + + diff --git a/apps/web-antd/src/views/business/salesperson-transfer-prescription/index.vue b/apps/web-antd/src/views/business/salesperson-transfer-prescription/index.vue new file mode 100644 index 00000000..5a99474a --- /dev/null +++ b/apps/web-antd/src/views/business/salesperson-transfer-prescription/index.vue @@ -0,0 +1,82 @@ + + + + + + + + + + + diff --git a/apps/web-antd/src/views/doctor/doctor-reception/components/SalespersonTransferDrawer.vue b/apps/web-antd/src/views/doctor/doctor-reception/components/SalespersonTransferDrawer.vue new file mode 100644 index 00000000..135e8e35 --- /dev/null +++ b/apps/web-antd/src/views/doctor/doctor-reception/components/SalespersonTransferDrawer.vue @@ -0,0 +1,109 @@ + + + + + + + + + + + + {{ matchTypeLabel(item.match_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 18184b29..65f9bfbc 100644 --- a/apps/web-antd/src/views/doctor/doctor-reception/index.vue +++ b/apps/web-antd/src/views/doctor/doctor-reception/index.vue @@ -73,7 +73,9 @@ import { } from '#/views/doctor/settings/api'; // 转诊相关 import TransferPrescriptionCard from '#/views/doctor/online-consultation/components/TransferPrescriptionCard.vue'; +import SalespersonTransferDrawer from '#/views/doctor/doctor-reception/components/SalespersonTransferDrawer.vue'; import { getTransferPrescriptionByRegisterApi } from '#/views/business/chat/api/transferPrescription'; +import { getSalespersonTransferByRegisterApi } from '#/views/business/salesperson-transfer-prescription/api'; import { calcItemMarginPercent, calcTotalMarginPercent, @@ -135,6 +137,23 @@ const userStore = useUserStore(); const myStoreId = ref(userStore.userInfo.store_id); /** 当前取价门店是否允许查看毛利率(0/1) */ const seeRate = ref(0); +/** 开方是否可选医保(0=仅自费) */ +const allowInsuranceCategory = ref(0); +/** 推广员传方导入关联ID */ +const salespersonTransferPrescriptionId = ref(0); +const salespersonTransferDrawerOpen = ref(false); +const hasSalespersonTransfer = ref(false); + +/** 当前接诊挂号 ID(模板中不可直接使用 localStorage) */ +const doctorReceptionRegisterId = computed(() => { + if (typeof window === 'undefined' || !window.localStorage) { + return 0; + } + return Number.parseInt( + window.localStorage.getItem('doctorReception-id') || '0', + 10, + ); +}); async function fetchStoreSeeRate() { try { @@ -150,11 +169,58 @@ async function fetchStoreSeeRate() { } const res = await getCurrentStoreTypeApi(params); seeRate.value = Number(res?.see_rate ?? 0); + allowInsuranceCategory.value = Number(res?.allow_insurance_category ?? 0); + if (allowInsuranceCategory.value !== 1) { + category.value = 1; + } } catch (error) { console.error('获取毛利率权限失败:', error); } } +async function checkSalespersonTransfer() { + const registerId = Number.parseInt( + localStorage.getItem('doctorReception-id') || '0', + 10, + ); + if (!registerId || activeCategory.value !== 1) { + hasSalespersonTransfer.value = false; + return; + } + try { + const res = await getSalespersonTransferByRegisterApi(registerId); + hasSalespersonTransfer.value = Array.isArray(res) && res.length > 0; + } catch { + hasSalespersonTransfer.value = false; + } +} + +function handleSalespersonTransferImport(payload: { + transferId: number; + clinical_diagnose: string; + doctor_order: string; + drugList: any[]; +}) { + salespersonTransferPrescriptionId.value = payload.transferId; + diagnosis.value = payload.clinical_diagnose || ''; + medicalAdvice.value = payload.doctor_order || ''; + activeCategory.value = 1; + tabType.value = 2; + currentDrugs.value = payload.drugList.map((drug: any) => ({ + index_id: drug.index_id ?? drug.drug_id ?? drug.id, + id: drug.drug_id || drug.id, + drug_id: drug.drug_id || drug.id, + drug_name: drug.drug_name || drug.name, + name: drug.drug_name || drug.name, + number: drug.number || 1, + way_id: drug.way_id || 0, + price: drug.price ?? 0, + buy_price: drug.buy_price, + })); + updateLocalStorage(); + message.success('传方已导入,请确认后发送处方'); +} + watch(myStoreId, () => { fetchStoreSeeRate(); }); @@ -411,7 +477,7 @@ const selectPatient = (patient: Patient, isUpdateTabType = true) => { } } activePatient.value = patient.user_patient; - + // 恢复之前保存的 activeCategory const savedCategory = localStorage.getItem(`activeCategory${patient.user_patient?.id}`); if (savedCategory) { @@ -431,8 +497,9 @@ const selectPatient = (patient: Patient, isUpdateTabType = true) => { // 如果恢复的处方类型是中药,检测并显示转诊提示 if (activeCategory.value === 1) { checkAndShowTransferTip(); + checkSalespersonTransfer(); } - + getPatientItem(patient.id).then((value) => { patientInfo.value = value; userPatientHealthInquiry.value = value.user_patient_health_inquiry; @@ -638,13 +705,14 @@ const sendPrescription = () => { day_dosage: dayDosage.value, // 是否二次签名 doctor_second_sign: doctorSecondSign.value, + salesperson_transfer_prescription_id: salespersonTransferPrescriptionId.value || undefined, }).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); @@ -653,7 +721,7 @@ const sendPrescription = () => { // 不需要转诊,清空转诊信息 transferPrescription.value = null; } - + // 清空当前数据 currentDrugs.value = []; diagnosis.value = ''; @@ -663,9 +731,11 @@ const sendPrescription = () => { dosage.value = 7; dayDosage.value = 2; tabType.value = 1; + salespersonTransferPrescriptionId.value = 0; newDrugInfo.value = {}; updateLocalStorage(); - + checkSalespersonTransfer(); + // 刷新患者信息 if (selectPatientId.value) { getPatientItem(selectPatientId.value).then((value) => { @@ -842,7 +912,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; @@ -1039,11 +1109,14 @@ function tabChange(id) { getStorageKey(activePatient.value?.id, activeCategory.value), JSON.stringify(currentDrugs.value), ); - + // 更新Tab类型 localStorage.setItem(`activeCategory${activePatient.value?.id}`, id); activeCategory.value = id; - + if (id === 1) { + checkSalespersonTransfer(); + } + // 加载新Tab对应的药品数据 currentDrugs.value = JSON.parse( localStorage.getItem(getStorageKey(activePatient.value?.id, id)) || '[]', @@ -1873,7 +1946,7 @@ const newDrugInfo = ref({}); */ const fetchTransferPrescription = async (transferPrescriptionId: number) => { if (!transferPrescriptionId) return; - + loadingTransfer.value = true; try { // 通过转诊处方ID获取转诊信息 @@ -2171,13 +2244,13 @@ watch( item.created_at }} - {{ - item.prescription_type === 1 ? '中药处方' : - item.prescription_type === 2 ? '西药处方' : - item.prescription_type === 3 ? '保健食品' : - item.prescription_type === 5 ? '产品服务包' : - item.prescription_type === 6 ? '非药品' : - item.prescription_type === 7 ? '医疗器械' : + {{ + item.prescription_type === 1 ? '中药处方' : + item.prescription_type === 2 ? '西药处方' : + item.prescription_type === 3 ? '保健食品' : + item.prescription_type === 5 ? '产品服务包' : + item.prescription_type === 6 ? '非药品' : + item.prescription_type === 7 ? '医疗器械' : '未知类型' }} / {{ item.category === 1 ? '自费' : '医保' }} @@ -2207,12 +2280,12 @@ watch( - + @@ -2266,7 +2339,16 @@ watch( 保存常用方 + + 查看传方 + @@ -2274,6 +2356,11 @@ watch( 医保 + 总计:¥{{ totalCost.toFixed(2) }} - 发送处方 - 发送处方 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 c725e168..fbc4c8d2 100644 --- a/apps/web-antd/src/views/system/store/api/index.ts +++ b/apps/web-antd/src/views/system/store/api/index.ts @@ -166,6 +166,14 @@ export async function updateClinicTypeApi(data: { id: number; clinic_type: numbe return requestClient.post(`${prefix}update-clinic-type`, data); } +export async function updateAllowInsuranceCategoryApi(data: { id: number }) { + return requestClient.post(`${prefix}update-allow-insurance-category`, data); +} + +export async function toggleSalespersonSeePriceApi(data: { store_id: number }) { + return requestClient.post('salesperson-store-config/toggle-see-price', data); +} + /** * 单独更新 ERP ID 或 MES ID(列表快捷编辑) */ 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 6587512b..a14f0ec2 100644 --- a/apps/web-antd/src/views/system/store/config/table.ts +++ b/apps/web-antd/src/views/system/store/config/table.ts @@ -61,6 +61,20 @@ export const gridOptions: VxeGridProps = { slots: { default: 'see_rate' }, width: 120, }, + { + field: 'allow_insurance_category', + align: 'left', + title: '医保可选', + slots: { default: 'allow_insurance_category' }, + width: 110, + }, + { + field: 'salesperson_see_price', + align: 'left', + title: '推广员可见价格', + slots: { default: 'salesperson_see_price' }, + width: 130, + }, { field: 'qr_code', 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 4adcfb3f..cd733dcf 100644 --- a/apps/web-antd/src/views/system/store/index.vue +++ b/apps/web-antd/src/views/system/store/index.vue @@ -20,7 +20,9 @@ import { deleteStore, openPcWindowsApiByStore, openQrCodeApi, + updateAllowInsuranceCategoryApi, updateClinicTypeApi, + toggleSalespersonSeePriceApi, updateStoreShippingFree, updateStoreSeeRateStatus, updateStoreSubscribeStatus, @@ -215,6 +217,20 @@ const updateSeeRate = (id: number) => { }); }; +const updateAllowInsurance = (id: number) => { + updateAllowInsuranceCategoryApi({ id }).then(() => { + message.success('修改成功!'); + gridApi.query(); + }); +}; + +const updateSalespersonSeePrice = (storeId: number) => { + toggleSalespersonSeePriceApi({ store_id: storeId }).then(() => { + message.success('修改成功!'); + gridApi.query(); + }); +}; + /** * 批量同步总仓库药品 */ @@ -440,6 +456,24 @@ const handleSwitchClinicType = (row: any) => { {{ Number(row.see_rate) === 1 ? '可查看' : '不可查看' }} + + + {{ Number(row.allow_insurance_category) === 1 ? '可选医保' : '仅自费' }} + + + + + {{ Number(row.salesperson_see_price) === 1 ? '可见' : '不可见' }} + + 早:{{ row.start_time }}