转诊方优化
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled

This commit is contained in:
李琦
2026-02-07 23:22:34 +08:00
parent 2bbd943b39
commit 8e81929bf1
2 changed files with 32 additions and 8 deletions

View File

@@ -367,8 +367,13 @@ export const usePrescriptionStore = defineStore('prescription', () => {
const res = await getRegisterStoreInfoFn(Number(currentRegisterId.value));
registerStoreInfo.value = res;
// 默认选择挂号诊所
if (res && res.store_id) {
// 如果是转诊挂号自动使用承接方诊所ID转接方开处方时
if (res && res.is_from_transfer === 1 && res.delegate_store_id) {
// 转接方开处方时自动设置store_id为承接方诊所ID
selectedStoreId.value = res.delegate_store_id;
sendMode.value = 1; // 使用自定义模式但使用承接方诊所ID
} else if (res && res.store_id) {
// 非转诊挂号,默认选择挂号诊所
selectedStoreId.value = res.store_id;
// 如果挂号诊所与医生当前诊所不同,设置为自定义模式
if (res.can_change) {
@@ -414,8 +419,13 @@ export const usePrescriptionStore = defineStore('prescription', () => {
return currentStoreName.value;
});
// 是否可以更改诊所(使用后端返回的 can_change 字段
// 是否可以更改诊所(转诊挂号时不允许更改使用承接方诊所ID
const canChangeStore = computed(() => {
// 如果是转诊挂号不允许更改诊所自动使用承接方诊所ID
if (registerStoreInfo.value?.is_from_transfer === 1) {
return false;
}
// 非转诊挂号,使用后端返回的 can_change 字段
return registerStoreInfo.value?.can_change === true;
});
@@ -794,6 +804,16 @@ export const usePrescriptionStore = defineStore('prescription', () => {
return false;
}
try {
// 如果是转诊挂号自动使用承接方诊所ID转接方开处方时
let finalSendMode = customSendMode;
let finalStoreId = customStoreId;
if (registerStoreInfo.value?.is_from_transfer === 1 && registerStoreInfo.value?.delegate_store_id) {
// 转接方开处方时自动使用承接方诊所ID不需要在模态框选择
finalSendMode = 1;
finalStoreId = registerStoreInfo.value.delegate_store_id;
}
const response = await addWestPrescription({
patient: activePatient.value,
drugs: currentDrugs.value,
@@ -818,9 +838,9 @@ export const usePrescriptionStore = defineStore('prescription', () => {
diseases_id: diseasesSelected.value,
method_id: methodSelected.value,
syndrome_id: syndromeSelected.value,
// 诊所选择参数(使用传入的参数
send_mode: customSendMode,
custom_store_id: customSendMode === 1 ? customStoreId : null,
// 诊所选择参数(转诊挂号时自动使用承接方诊所ID
send_mode: finalSendMode,
custom_store_id: finalSendMode === 1 ? finalStoreId : null,
});
const res = await response;

View File

@@ -213,10 +213,14 @@ const handleSendPrescription = async (doctorSecondSignValue = 0) => {
await prescriptionStore.fetchRegisterStoreInfo();
const canChange = prescriptionStore.canChangeStore;
const storeInfo = prescriptionStore.registerStoreInfo;
if (canChange) {
// 如果是转诊挂号自动使用承接方诊所ID不需要弹出诊所选择弹窗
if (storeInfo?.is_from_transfer === 1 && storeInfo?.delegate_store_id) {
// 转接方开处方时自动使用承接方诊所ID
await executeSendPrescription(doctorSecondSignValue, 1, storeInfo.delegate_store_id);
} else if (canChange) {
// 弹出诊所确认弹窗 - 直接从 registerStoreInfo 获取诊所信息
const storeInfo = prescriptionStore.registerStoreInfo;
storeConfirmModalApi.setData({
registerStoreName: storeInfo?.store_name || '挂号诊所',
registerStoreId: storeInfo?.store_id,