1. 特色方模块

This commit is contained in:
李琦
2026-07-03 07:57:26 +08:00
parent 03973e8718
commit f18916f9d5
23 changed files with 1408 additions and 186 deletions

View File

@@ -35,6 +35,55 @@
<text class="register-mode-hint__text">{{ registerModeHint }}</text>
</view>
<view
v-if="!isSalespersonTransferMode && hasSpecialPrescriptionRecord"
class="special-rx-card mx-32 m-t-12"
>
<view class="special-rx-card__inner flex-row flex-ali-center">
<u-image
v-if="specialPrescriptionRecord.special_prescription && specialPrescriptionRecord.special_prescription.cover_image"
width="96rpx"
height="96rpx"
border-radius="12"
:src="specialPrescriptionRecord.special_prescription.cover_image"
/>
<view class="flex-1 m-l-16">
<view class="fs-28 font-bold text-gray">
{{ (specialPrescriptionRecord.special_prescription && specialPrescriptionRecord.special_prescription.name) || '特色方' }}
</view>
<view class="fs-24 color-sub m-t-8">
剂量{{ specialPrescriptionRecord.dose_count }}
</view>
<view class="m-t-8">
<u-tag
v-if="Number(specialPrescriptionRecord.status) === 0"
text="待导入"
type="warning"
size="mini"
/>
<u-tag
v-else-if="Number(specialPrescriptionRecord.status) === 1"
text="已应用"
type="success"
size="mini"
/>
<u-tag v-else text="已完成" type="info" size="mini" />
</view>
</view>
</view>
<view class="special-rx-card__action m-t-16">
<u-button
size="default"
type="primary"
:loading="applyingSpecialPrescription"
:custom-style="{ backgroundColor: '#6ACDBB', color: '#fff', border: 'none', width: '100%' }"
@click="handleApplySpecialPrescription"
>
导入
</u-button>
</view>
</view>
<view v-if="!isSalespersonTransferMode && allowInsuranceCategory" class="mx-32 m-t-12 flex flex-ali-center">
<u-button size="mini" :type="feeCategory === 1 ? 'success' : 'default'" @click="feeCategory = 1">自费</u-button>
<u-button size="mini" class="m-l-16" :type="feeCategory === 2 ? 'success' : 'default'" @click="feeCategory = 2">医保</u-button>
@@ -539,6 +588,7 @@ import {
getProductListDoctorReception,
getPatientInfoByPatientId,
getPatientItem,
applySpecialPrescriptionApi,
getProcessRuleList,
getCommonPrescriptionListApi,
saveWestCommonPrescriptionApi,
@@ -571,6 +621,10 @@ import {
getClinicSalespersonSeePriceConfig,
getClinicSalespersonProcessRuleList,
} from '@/api/clinicSalesperson.js';
import {
pickSpecialPrescriptionRecord,
applySpecialPrescriptionPayload,
} from './utils/specialPrescription.js';
const PENDING_RX_FROM_CHAT = 'xk_pending_rx_from_chat';
const SALESPERSON_TRANSFER_STORAGE_KEY = 'salesperson_transfer';
@@ -676,6 +730,9 @@ export default {
sendMode: 0,
selectedStoreId: null,
registerOrderType: null,
specialPrescriptionRecord: null,
applyingSpecialPrescription: false,
pendingImportSpecial: false,
/** 在线复诊中药术语表HTTP 拉取,内存缓存) */
traditionalTcmData: null,
@@ -803,6 +860,9 @@ export default {
if (this.registerOrderType === null || this.registerOrderType === undefined || this.registerOrderType === '') return '';
return this.isOnlineRevisit ? '当前:在线复诊开方(提交后将向患者发送处方消息)' : '当前:线下开方';
},
hasSpecialPrescriptionRecord() {
return !!this.specialPrescriptionRecord;
},
navbarTitle() {
if (this.isSalespersonTransferMode) {
return '传方';
@@ -905,6 +965,7 @@ export default {
}
this.patientId = options.patient_id || '';
this.pendingReusePrescriptionId = options.reuse_prescription_id ? String(options.reuse_prescription_id) : '';
this.pendingImportSpecial = String(options.import_special) === '1';
this.isCommonPrescription = String(options.save_common) === '1';
if (!this.isCommonPrescription) {
uni.removeStorageSync('add');
@@ -969,6 +1030,10 @@ export default {
await this.maybeApplyReusePrescription();
if (this.activeCategory === 1) await this.checkAndShowTransferTip();
this.applyPendingExperienceDrugFromChat();
if (this.pendingImportSpecial && this.hasSpecialPrescriptionRecord) {
await this.handleApplySpecialPrescription();
this.pendingImportSpecial = false;
}
}
// #ifdef MP-WEIXIN
this.$nextTick(() => {
@@ -1099,6 +1164,7 @@ export default {
async loadRegisterOrderType() {
if (!this.registerId) {
this.registerOrderType = null;
this.specialPrescriptionRecord = null;
return;
}
try {
@@ -1109,9 +1175,11 @@ export default {
} else {
this.registerOrderType = null;
}
this.specialPrescriptionRecord = pickSpecialPrescriptionRecord(data);
} catch (e) {
console.warn(e);
this.registerOrderType = null;
this.specialPrescriptionRecord = null;
}
},
async loadBasicConfigData() {
@@ -1386,6 +1454,22 @@ export default {
this.saveToLocalStorage();
},
handleOpenCommonPrescriptionModal() { this.showCommonPrescriptionModal = true; },
async handleApplySpecialPrescription() {
if (!this.registerId || this.applyingSpecialPrescription) return;
this.applyingSpecialPrescription = true;
try {
const res = await applySpecialPrescriptionApi({ register_id: this.registerId });
const data = res.result || res.data || res;
applySpecialPrescriptionPayload(this, data);
await this.loadRegisterOrderType();
this.$toast(`已导入特色方:${data.special_prescription_name || ''}`);
} catch (error) {
console.error('导入特色方失败:', error);
this.$toast('导入特色方失败,请稍后重试');
} finally {
this.applyingSpecialPrescription = false;
}
},
async handleSelectCommonPrescription(item) {
try {
const payload = item && item.apply_payload;
@@ -2541,6 +2625,18 @@ export default {
color: #008771;
line-height: 1.5;
}
.special-rx-card {
padding: 20rpx 24rpx;
background: #fffaf5;
border-radius: 12rpx;
border: 1rpx solid #ffe0c2;
}
.special-rx-card__inner {
width: 100%;
}
.special-rx-card__action {
width: 100%;
}
.bottom {
position: fixed;
bottom: 0;