转接方

This commit is contained in:
李琦
2026-02-04 14:16:05 +08:00
parent 37d42263a8
commit 86c5b7431d
4 changed files with 196 additions and 27 deletions

View File

@@ -0,0 +1,70 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { InfoCircleOutlined } from '@ant-design/icons-vue';
const content = ref('');
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: false,
confirmText: '我知道了',
onCancel() {
modalApi.close();
},
onConfirm() {
modalApi.close();
},
onOpenChange(isOpen: boolean) {
if (isOpen) {
const data = modalApi.getData<{
content: string;
}>();
console.log('data', data);
content.value = data.content || '';
}
},
});
</script>
<template>
<Modal class="w-[500px]">
<div class="info-modal-content">
<div class="info-icon">
<InfoCircleOutlined />
</div>
<div class="">{{ content }}</div>
</div>
</Modal>
</template>
<style scoped lang="less">
.info-modal-content {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 8px 0;
.info-icon {
font-size: 24px;
color: #1890ff;
flex-shrink: 0;
margin-top: 2px;
}
.info-text {
flex: 1;
line-height: 1.6;
color: rgba(0, 0, 0, 0.85);
word-break: break-word;
}
}
:deep(.dark) {
.info-text {
color: rgba(255, 255, 255, 0.85);
}
}
</style>

View File

@@ -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 = () => {
<!-- 子模态框组件 - 按照VbenAdmin的方式声明 -->
<WesternDrugModal />
<SimpleProductModalComponent />
<InfoModalComponent />
<DiagnosisModals />
<DoctorOrderModals />
<PrescriptionDetailModal />

View File

@@ -72,6 +72,13 @@ export async function getMyStoreListApi() {
return requestClient.get<any>(`${prefix}get-my-store-list`);
}
/**
* 获取当前诊所类型和委托诊所信息
*/
export async function getCurrentStoreTypeApi() {
return requestClient.get<any>(`${prefix}get-current-store-type`);
}
/**
* 接诊
*/

View File

@@ -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(
<template>
<div :class="leftShow === true? 'container-box-grid':'container-box'">
<RefusalOfTreatmentModals />
<InfoModalComponent />
<!-- 如果leftShow === true展示收起反之则显示展开-->
<div>
<Button :class="`${leftShow === true? 'w-full': 'sticky top-5 left-5'}`" type="primary" @click="leftShow = !leftShow">{{ leftShow === true ? '收起患者列表' : '展开患者列表' }}</Button>
@@ -1763,13 +1810,13 @@ watch(
item.created_at
}}</span>
<Tag class="ml-5" :color="item.category === 1? '' : '#455cda'">
{{
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 ? '自费' : '医保' }}
@@ -1788,7 +1835,7 @@ watch(
</Timeline>
</Descriptions.Item>
</Descriptions>
<!-- 转诊处方卡片 -->
<div v-if="transferPrescription" class="transfer-section mt-5">
<TransferPrescriptionCard
@@ -2488,20 +2535,20 @@ watch(
</div>
<div class="total-cost">总计:¥{{ totalCost.toFixed(2) }}</div>
<Button
<Button
v-if="activeCategory === 1"
class="mt-5 w-full"
style="display: block"
type="primary"
class="mt-5 w-full"
style="display: block"
type="primary"
@click="checkChineseMedicineConflict"
>
发送处方
</Button>
<Button
<Button
v-else
class="mt-5 w-full"
style="display: block"
type="primary"
class="mt-5 w-full"
style="display: block"
type="primary"
@click="sendPrescription"
>
发送处方