feat: 病历模块优化、AI辅助问诊

This commit is contained in:
李琦
2026-08-06 10:07:49 +08:00
parent b2ad3088be
commit 87a0c02fb0
2 changed files with 224 additions and 107 deletions

View File

@@ -127,9 +127,9 @@
<u-button size="mini" class="m-l-16" :type="feeCategory === 2 ? 'success' : 'default'" @click="feeCategory = 2">医保</u-button>
</view>
<view v-if="isRxMainVisible && !isSalespersonTransferMode && activeCategory === 1 && hasSalespersonTransfer" class="mx-32 m-t-12 rx-flex-fixed">
<u-button size="mini" type="primary" plain @click="openSalespersonTransfer">查看传方</u-button>
</view>
<!-- <view v-if="isRxMainVisible && !isSalespersonTransferMode && activeCategory === 1 && hasSalespersonTransfer" class="mx-32 m-t-12 rx-flex-fixed">-->
<!-- <u-button size="mini" type="primary" plain @click="openSalespersonTransfer">查看传方</u-button>-->
<!-- </view>-->
<!-- 诊断病历 Tab 必须卸载微信 v-show 藏不住 fixed/flex 固定块 -->
<view v-if="isRxMainVisible && !isSalespersonTransferMode" class="top white p-32 flex-col m-t-16 radius-12 mx-32 rx-flex-fixed">
@@ -552,9 +552,8 @@
>另存常用方</view>
</view>
<view class="flex-row flex-ali-center">
<!-- AI 胶囊与病历AI写病历同款功能暂不可用时仍保留入口样式 -->
<view
v-if="!isSpecialPrescriptionCartLocked && !isSalespersonTransferMode && !isCommonPrescription"
v-if="!isSpecialPrescriptionCartLocked && !isSalespersonTransferMode && !isCommonPrescription && canUseAiPrescription"
class="rx-ai-btn"
@click="handleOpenAiPrescriptionDrawer"
>
@@ -578,8 +577,9 @@
</view>
<!--
病历常挂载保草稿 / 探测 VIP
处方 Tabfixed 离屏探测绝不参与 page-flex 占高
病历常挂载保草稿
是否有 VIP 由门店 permissions 判断 VIP 不请求病历接口不展示 Tab
处方 Tabfixed 离屏绝不参与 page-flex 占高
病历 Tabflex:1 吃满剩余高度
-->
<view
@@ -596,15 +596,15 @@
:medical-advice="medicalAdvice"
:diagnosis-readonly="isOnlineRevisit"
:active="isMrMainVisible"
:can-use-medical-record="canUseMedicalRecord"
:patient-name="(patientInfo && patientInfo.name) || ''"
:patient-sex="(patientInfo && patientInfo.sex) || 0"
:patient-age="(patientInfo && patientInfo.age) || 0"
:can-use-ai-medical-record="canUseAiMedicalRecord"
@update:diagnosis="onMrDiagnosisUpdate"
@update:medicalAdvice="onMrAdviceUpdate"
@open-diagnosis="handleOpenDiagnosisModal"
@open-doctor-order="handleOpenDoctorOrderModal"
@vip-ok="onMedicalRecordVipOk"
@vip-denied="onMedicalRecordVipDenied"
@overlay-change="onMedicalRecordOverlayChange"
/>
</view>
@@ -841,6 +841,8 @@ export default {
mainTab: 'rx',
/** 是否开通病历 VIP拉取病历成功后为 true */
canUseMedicalRecord: false,
/** 当前诊所 VIP permissions来自 get-current-store-type.vip */
storeVipPermissions: [],
pendingReusePrescriptionId: '',
patientInfo: null,
prescriptionCategories: [
@@ -1159,12 +1161,20 @@ export default {
if (this.isSalespersonTransferMode || this.isCommonPrescription) {
return '686rpx';
}
// 右侧 AI 胶囊 + 发送,主按钮与病历「保存病历」同量级
if (!this.isSpecialPrescriptionCartLocked) {
// 右侧 AI 胶囊 + 发送
if (!this.isSpecialPrescriptionCartLocked && this.canUseAiPrescription) {
return '240rpx';
}
return '480rpx';
},
/** 门店 VIPAI辅助出方 */
canUseAiPrescription() {
return this.hasStoreVipPermission('ai_prescription');
},
/** 门店 VIPAI写病历 */
canUseAiMedicalRecord() {
return this.hasStoreVipPermission('ai_medical_record');
},
navbarTitle() {
if (this.isSalespersonTransferMode) {
return '传方';
@@ -1710,6 +1720,30 @@ export default {
this.applyPreSendPriceDiscount(payload.priceDiscount);
this.closePreSendPriceAdjust();
},
/**
* 判断当前诊所 VIP 是否含指定权益码
*/
hasStoreVipPermission(code) {
const list = this.storeVipPermissions;
return Array.isArray(list) && list.indexOf(code) >= 0;
},
/**
* 从门店类型接口结果写入 VIP permissions
* 有 medical_record 才显示病历 Tab无则静默留在处方不打 get-medical-record 避免弹 VIP 错)
*/
applyStoreVipFromRes(res) {
const data = (res && (res.result != null ? res.result : res.data != null ? res.data : res)) || {};
const vip = data.vip || {};
const perms = vip.permissions;
this.storeVipPermissions = Array.isArray(perms) ? perms.slice() : [];
const allowMr = this.hasStoreVipPermission('medical_record');
this.canUseMedicalRecord = allowMr;
if (allowMr) {
this.restoreMainTab();
} else if (this.mainTab === 'mr') {
this.mainTab = 'rx';
}
},
async fetchStoreSeeRate() {
try {
const storeId = uni.getStorageSync('store_id');
@@ -1725,8 +1759,10 @@ export default {
}
const res = await getCurrentStoreTypeApi(params);
if (res) {
this.seeRate = Number(res.see_rate ?? 0);
this.enableOrderPricePercentAdjust = Number(res.enable_order_price_percent_adjust ?? 0);
this.applyStoreVipFromRes(res);
const data = (res.result != null ? res.result : res.data != null ? res.data : res) || res;
this.seeRate = Number(data.see_rate ?? 0);
this.enableOrderPricePercentAdjust = Number(data.enable_order_price_percent_adjust ?? 0);
await this.loadPriceAdjustConfigForStore(params.store_id || storeId);
}
} catch (error) {
@@ -1745,21 +1781,23 @@ export default {
...(storeId ? { store_id: storeId } : {})
});
if (res) {
this.registerStoreInfo = res;
this.seeRate = Number(res.see_rate ?? 0);
if (Number(res.allow_insurance_category ?? 0) !== 1) {
this.applyStoreVipFromRes(res);
const data = (res.result != null ? res.result : res.data != null ? res.data : res) || res;
this.registerStoreInfo = data;
this.seeRate = Number(data.see_rate ?? 0);
if (Number(data.allow_insurance_category ?? 0) !== 1) {
this.feeCategory = 1;
}
this.checkSalespersonTransfer();
if (res.is_from_transfer === 1 && res.delegate_store_id) {
this.selectedStoreId = res.delegate_store_id;
if (data.is_from_transfer === 1 && data.delegate_store_id) {
this.selectedStoreId = data.delegate_store_id;
this.sendMode = 1;
} else if (res.store_id) {
this.selectedStoreId = res.store_id;
this.sendMode = res.can_change ? 1 : 0;
} else if (data.store_id) {
this.selectedStoreId = data.store_id;
this.sendMode = data.can_change ? 1 : 0;
}
const priceStoreId = this.selectedStoreId || res.store_id || storeId;
this.enableOrderPricePercentAdjust = Number(res.enable_order_price_percent_adjust ?? 0);
const priceStoreId = this.selectedStoreId || data.store_id || storeId;
this.enableOrderPricePercentAdjust = Number(data.enable_order_price_percent_adjust ?? 0);
await this.loadPriceAdjustConfigForStore(priceStoreId);
}
} catch (error) {
@@ -1924,14 +1962,6 @@ export default {
onMrAdviceUpdate(v) {
this.medicalAdvice = v || '';
},
onMedicalRecordVipDenied() {
this.canUseMedicalRecord = false;
if (this.mainTab === 'mr') this.mainTab = 'rx';
},
onMedicalRecordVipOk() {
this.canUseMedicalRecord = true;
this.restoreMainTab();
},
/** 发送处方成功后同步病历(有 VIP 时) */
async syncMedicalRecordAfterSend() {
if (!this.canUseMedicalRecord) return;
@@ -2021,6 +2051,10 @@ export default {
* 打开 AI 给处方抽屉:带入完整病历(含未保存),先确认再生成
*/
handleOpenAiPrescriptionDrawer() {
if (!this.canUseAiPrescription) {
this.$toast('当前门店未开通AI辅助出方VIP功能');
return;
}
if (guardSpecialPrescriptionCartEdit(this)) return;
if (!this.registerId) {
this.$toast('挂号无效');