更新
This commit is contained in:
@@ -1707,6 +1707,8 @@ type AuxUsageForm = {
|
||||
bags_per_dose: number
|
||||
times_per_day: number
|
||||
usage_days: number
|
||||
/** 从处方库导入辅方时写入的模板名称,供药房联展示 */
|
||||
prescription_name?: string
|
||||
}
|
||||
|
||||
function defaultAuxUsage(prescriptionType = '浓缩水丸'): AuxUsageForm {
|
||||
@@ -1753,7 +1755,8 @@ function normalizeAuxUsageForm(raw: unknown, prescriptionType: string): AuxUsage
|
||||
need_decoction: o.need_decoction === 1 || o.need_decoction === true,
|
||||
bags_per_dose: o.bags_per_dose != null ? Number(o.bags_per_dose) || 1 : base.bags_per_dose,
|
||||
times_per_day: o.times_per_day != null ? Number(o.times_per_day) || 3 : base.times_per_day,
|
||||
usage_days: o.usage_days != null ? Number(o.usage_days) || 7 : base.usage_days
|
||||
usage_days: o.usage_days != null ? Number(o.usage_days) || 7 : base.usage_days,
|
||||
prescription_name: String(o.prescription_name ?? '').trim()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3448,6 +3451,10 @@ const handleImportLibrary = (row: any) => {
|
||||
} else {
|
||||
editForm.herbs.push(...imported)
|
||||
}
|
||||
if (formulaType === '辅方') {
|
||||
editForm.aux_usage.prescription_name = String(row.prescription_name ?? '').trim()
|
||||
}
|
||||
|
||||
const modeHint = libraryImportMode.value === 'append' ? '(已追加)' : ''
|
||||
if (findDuplicateHerbNamesLocal().length) {
|
||||
feedback.msgWarning(
|
||||
|
||||
@@ -293,7 +293,7 @@
|
||||
:fetch-fun="prescriptionOrderExport"
|
||||
:params="prescriptionOrderExportParams"
|
||||
:page-size="pager.size"
|
||||
export-hint="导出范围与上方筛选一致(履约状态、创建时间及其他条件均会生效)。含「自媒体渠道(挂号渠道来源)」:优先取该单关联处方登记的挂号;无则诊单下同患者挂号取 id 最大的一条(与前台挂号选择的记录一致);业绩侧栏带渠道筛选导出时与同页列表高亮挂号同源。"
|
||||
export-hint="导出范围与上方筛选一致(履约状态、创建时间及其他条件均会生效)。含「自媒体渠道(挂号渠道来源)」:优先取该单关联处方登记的挂号;无则诊单下同患者挂号取 id 最大的一条(与前台挂号选择的记录一致);业绩侧栏带渠道筛选导出时与同页列表高亮挂号同源。「服务套餐」按字典 server_order 解析展示;「签收日期」与详情/业绩看板提成口径一致:以快递主表 sign_time 为主,无效时回退至签收类轨迹时间或已签收状态下的最新轨迹时间。"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -2449,7 +2449,9 @@
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="slipAuxHerbs.length">
|
||||
<div class="rx-herb-section-label rx-herb-section-label--aux">辅方</div>
|
||||
<div class="rx-herb-section-label rx-herb-section-label--aux">
|
||||
辅方<span v-if="slipAuxLibraryName" class="rx-herb-library-name">({{ slipAuxLibraryName }})</span>
|
||||
</div>
|
||||
<div
|
||||
v-for="(h, i) in slipAuxHerbs"
|
||||
:key="'aux-' + i"
|
||||
@@ -2461,10 +2463,28 @@
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-for="(h, i) in slipHerbsList" :key="i" class="rx-herb-cell">
|
||||
<span class="rx-herb-name">{{ h.name }}</span>
|
||||
<span class="rx-herb-total">{{ h.dosage }}克</span>
|
||||
</div>
|
||||
<template v-if="slipMainHerbs.length">
|
||||
<div class="rx-herb-section-label">主方</div>
|
||||
<div
|
||||
v-for="(h, i) in slipMainHerbs"
|
||||
:key="'user-main-' + i"
|
||||
class="rx-herb-cell"
|
||||
>
|
||||
<span class="rx-herb-name">{{ h.name }}</span>
|
||||
<span class="rx-herb-total">{{ h.dosage }}克</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="slipAuxHerbs.length">
|
||||
<div class="rx-herb-section-label rx-herb-section-label--aux">辅方</div>
|
||||
<div
|
||||
v-for="(h, i) in slipAuxHerbs"
|
||||
:key="'user-aux-' + i"
|
||||
class="rx-herb-cell"
|
||||
>
|
||||
<span class="rx-herb-name">{{ h.name }}</span>
|
||||
<span class="rx-herb-total">{{ h.dosage }}克</span>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2714,6 +2734,7 @@ import {
|
||||
prescriptionOrderSubmitGancaoRecipel,
|
||||
prescriptionOrderPreviewGancaoRecipel,
|
||||
prescriptionDetail,
|
||||
prescriptionLibraryLists,
|
||||
getDoctors,
|
||||
getAssistants
|
||||
} from '@/api/tcm'
|
||||
@@ -5480,6 +5501,8 @@ const SLIP_ADDRESS_LINE = '地址:四川省成都市双流区黄甲街道黄
|
||||
const prescriptionViewVisible = ref(false)
|
||||
const prescriptionViewLoading = ref(false)
|
||||
const prescriptionViewData = ref<any>(null)
|
||||
/** 药房联辅方标题:处方库中该辅方模板的 prescription_name(导入或药材匹配解析) */
|
||||
const slipAuxLibraryName = ref('')
|
||||
const prescriptionTabType = ref('internal')
|
||||
const prescriptionSlipPrintRef = ref<HTMLElement | null>(null)
|
||||
const prescriptionSlipExporting = ref(false)
|
||||
@@ -5883,6 +5906,60 @@ function openPrescriptionViewFromEdit() {
|
||||
openPrescriptionView(editForm)
|
||||
}
|
||||
|
||||
function herbSetMatchKey(herbs: Array<{ name?: unknown; dosage?: unknown }>): string {
|
||||
return herbs
|
||||
.map((h) => `${String(h.name ?? '').trim()}:${Number(h.dosage) || 0}`)
|
||||
.sort()
|
||||
.join('|')
|
||||
}
|
||||
|
||||
function herbsMatchPrescriptionLibrary(
|
||||
prescriptionHerbs: Array<{ name?: unknown; dosage?: unknown }>,
|
||||
libraryHerbs: Array<{ name?: unknown; dosage?: unknown }>
|
||||
): boolean {
|
||||
if (!prescriptionHerbs.length || !libraryHerbs.length) return false
|
||||
if (prescriptionHerbs.length !== libraryHerbs.length) return false
|
||||
return herbSetMatchKey(prescriptionHerbs) === herbSetMatchKey(libraryHerbs)
|
||||
}
|
||||
|
||||
function readAuxLibraryNameFromUsage(raw: unknown): string {
|
||||
if (!raw || typeof raw !== 'object') return ''
|
||||
const o = raw as Record<string, unknown>
|
||||
return String(o.prescription_name ?? o.library_name ?? '').trim()
|
||||
}
|
||||
|
||||
/** 解析药房联辅方对应的处方库名称:优先 aux_usage 内持久化字段,否则按开方医师处方库辅方模板药材精确匹配 */
|
||||
async function resolveSlipAuxLibraryName(data: Record<string, unknown>): Promise<string> {
|
||||
const fromUsage = readAuxLibraryNameFromUsage(data.aux_usage)
|
||||
if (fromUsage) return fromUsage
|
||||
|
||||
const herbs = Array.isArray(data.herbs) ? data.herbs : []
|
||||
const auxHerbs = herbs.filter((h) => normalizeSlipFormulaType((h as any)?.formula_type) === '辅方')
|
||||
if (!auxHerbs.length) return ''
|
||||
|
||||
const doctorId = Number(data.creator_id) > 0 ? Number(data.creator_id) : 0
|
||||
if (!doctorId) return ''
|
||||
|
||||
try {
|
||||
const res: any = await prescriptionLibraryLists({
|
||||
page_no: 1,
|
||||
page_size: 200,
|
||||
formula_type: '辅方',
|
||||
prescribing_creator_id: doctorId
|
||||
})
|
||||
const lists = Array.isArray(res?.lists) ? res.lists : []
|
||||
for (const row of lists) {
|
||||
const libHerbs = Array.isArray(row?.herbs) ? row.herbs : []
|
||||
if (herbsMatchPrescriptionLibrary(auxHerbs, libHerbs)) {
|
||||
return String(row?.prescription_name ?? '').trim()
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
/* 静默:无匹配时仅展示「辅方」 */
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
async function openPrescriptionView(row: any) {
|
||||
if (!row.prescription_id) {
|
||||
feedback.msgWarning('该订单未关联处方')
|
||||
@@ -5892,6 +5969,7 @@ async function openPrescriptionView(row: any) {
|
||||
prescriptionViewVisible.value = true
|
||||
prescriptionViewLoading.value = true
|
||||
prescriptionViewData.value = null
|
||||
slipAuxLibraryName.value = ''
|
||||
prescriptionTabType.value = 'internal'
|
||||
|
||||
try {
|
||||
@@ -5926,12 +6004,15 @@ async function openPrescriptionView(row: any) {
|
||||
merged.appointment_id = Number(linkedAp.id)
|
||||
}
|
||||
prescriptionViewData.value = merged
|
||||
slipAuxLibraryName.value = await resolveSlipAuxLibraryName(merged)
|
||||
} else {
|
||||
prescriptionViewData.value = null
|
||||
slipAuxLibraryName.value = ''
|
||||
}
|
||||
} catch (e: any) {
|
||||
feedback.msgError(e?.message || '加载处方详情失败')
|
||||
prescriptionViewVisible.value = false
|
||||
slipAuxLibraryName.value = ''
|
||||
} finally {
|
||||
prescriptionViewLoading.value = false
|
||||
}
|
||||
@@ -6585,6 +6666,11 @@ async function downloadPrescriptionSlipPdf() {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.rx-herb-library-name {
|
||||
font-weight: 500;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.rx-herb-cell {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 64px;
|
||||
|
||||
Reference in New Issue
Block a user