更新
This commit is contained in:
@@ -156,7 +156,7 @@
|
||||
<div class="rx-bottom">
|
||||
<div class="rx-bot-row rx-bot-row-1" :class="{ 'rx-bot-row-1--user': !isInternal }">
|
||||
<div class="rx-bot-cell rx-bot-doctor">
|
||||
<div class="rx-bot-doctor-line">
|
||||
<div v-if="!isBlankSlip" class="rx-bot-doctor-line">
|
||||
<div class="rx-bot-label rx-bot-label--doctor">医师</div>
|
||||
<div class="rx-bot-doctor-body">
|
||||
<img
|
||||
@@ -203,6 +203,7 @@ import { computed, ref } from 'vue'
|
||||
import {
|
||||
getAuxHerbs,
|
||||
getMainHerbs,
|
||||
isBlankPrescription,
|
||||
rxAdviceText,
|
||||
rxAppointmentFlowText,
|
||||
rxAuxUsageText,
|
||||
@@ -246,6 +247,7 @@ const props = withDefaults(
|
||||
const paperRef = ref<HTMLElement | null>(null)
|
||||
const isInternal = computed(() => props.variant !== 'user')
|
||||
const slipTitle = computed(() => props.title || '成都双流甄养堂互联网医院 处方笺')
|
||||
const isBlankSlip = computed(() => isBlankPrescription(props.data))
|
||||
const pharmacistSignature = computed(() => rxPharmacistSignature(props.data))
|
||||
|
||||
const dateText = computed(() => rxDateText(props.data))
|
||||
|
||||
@@ -8,9 +8,14 @@ export type FormulaType = '主方' | '辅方'
|
||||
export const DEFAULT_PHARMACIST_SIGNATURE =
|
||||
'https://gz-1349751149.cos.ap-guangzhou.myqcloud.com/uploads/images/20261117/202611171443119d5159658.png'
|
||||
|
||||
/** 与处方列表的「空白处方」来源标记一致;补开保存后后端会清除此标记。 */
|
||||
export function isBlankPrescription(data: Record<string, any> | null | undefined): boolean {
|
||||
return Number(data?.is_system_auto) === 1
|
||||
}
|
||||
|
||||
/** 笺面优先使用本次有效审核签名;缺省使用默认图片,仅供展示,不写回审核记录。 */
|
||||
export function rxPharmacistSignature(data: Record<string, any> | null | undefined): string {
|
||||
if (!data) return ''
|
||||
if (!data || isBlankPrescription(data)) return ''
|
||||
const signature = Number(data.prescription_audit_status) === 1
|
||||
? String(data.prescription_audit_signature || '').trim()
|
||||
: ''
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<span class="text-gray-500 text-sm font-medium w-20 shrink-0">供货方式</span>
|
||||
<span class="text-gray-500 text-sm font-medium w-20 shrink-0">发货药房</span>
|
||||
<span class="px-4 py-1.5 rounded-lg bg-primary text-white text-sm font-medium">甘草</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
@@ -2556,8 +2556,10 @@ const onTimeTypeChange = () => handleTimeTypeChange(handleQuery)
|
||||
const onCustomDateChange = () => handleCustomDateChange(handleQuery)
|
||||
|
||||
function normalizePrescriptionOrderListQuery(params: Record<string, unknown>): Record<string, unknown> {
|
||||
// 本列表及导出固定展示甘草、金额低于 2000 元的订单,重置筛选时仍保留。
|
||||
const p: Record<string, unknown> = { ...params, supply_mode: 'gancao', amount_lt: 2000 }
|
||||
// 按发货药房筛选甘草,包含未审核/未上传订单;列表与导出均保留 4000 元上限。
|
||||
const p: Record<string, unknown> = { ...params, ship_mode: 'gancao', amount_lte: 4000 }
|
||||
delete p.supply_mode
|
||||
delete p.amount_lt
|
||||
if (p.prescription_id === '' || p.prescription_id === undefined) {
|
||||
delete p.prescription_id
|
||||
} else {
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<span class="text-gray-500 text-sm font-medium w-20 shrink-0">供货方式</span>
|
||||
<span class="text-gray-500 text-sm font-medium w-20 shrink-0">发货药房</span>
|
||||
<span class="px-4 py-1.5 rounded-lg bg-primary text-white text-sm font-medium">甘草</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
@@ -3060,8 +3060,10 @@ const onCustomDateChange = () => handleCustomDateChange(handleQuery)
|
||||
|
||||
async function fetchLists(params: Record<string, unknown>) {
|
||||
const [start_time, end_time] = resolveCreateTimeRange()
|
||||
// 与桌面列表保持一致,查询、翻页和重置均保留固定展示范围。
|
||||
const p: Record<string, unknown> = { ...params, start_time, end_time, supply_mode: 'gancao', amount_lt: 2000 }
|
||||
// 按发货药房筛选,包含未审核/未上传订单;查询、翻页和重置均保留固定范围。
|
||||
const p: Record<string, unknown> = { ...params, start_time, end_time, ship_mode: 'gancao', amount_lte: 4000 }
|
||||
delete p.supply_mode
|
||||
delete p.amount_lt
|
||||
if (p.prescription_id === '' || p.prescription_id === undefined) {
|
||||
delete p.prescription_id
|
||||
} else {
|
||||
|
||||
@@ -45,6 +45,53 @@ async function renderedSlip(data, variant) {
|
||||
return renderToString(vue.createSSRApp({ render: () => vue.h(Slip, { data, variant }) }))
|
||||
}
|
||||
|
||||
test('blank prescriptions leave the signature cell empty in both preview and export variants', async () => {
|
||||
for (const is_system_auto of [1, '1']) {
|
||||
for (const doctor_signature of ['', signature]) {
|
||||
for (const prescription_audit_signature of ['', oldSignature]) {
|
||||
const data = {
|
||||
...basePrescription(), is_system_auto, doctor_signature,
|
||||
prescription_audit_status: 1, prescription_audit_signature
|
||||
}
|
||||
for (const variant of ['internal', 'user']) {
|
||||
const html = await renderedSlip(data, variant)
|
||||
assert.doesNotMatch(html, /alt="(?:医师|药师)签名"|rx-bot-doctor-line|rx-bot-pharmacist/)
|
||||
assert.equal(html.includes('开方医师'), false)
|
||||
assert.equal(html.includes(defaultSignature), false)
|
||||
assert.equal(html.includes(signature), false)
|
||||
assert.equal(html.includes(oldSignature), false)
|
||||
assert.match(html, /rx-bot-cell rx-bot-doctor/)
|
||||
assert.ok(html.includes('张某'))
|
||||
}
|
||||
assert.equal(data.doctor_signature, doctor_signature)
|
||||
assert.equal(data.prescription_audit_signature, prescription_audit_signature)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('completed manual prescriptions keep doctor signatures or names and pharmacist fallback', async () => {
|
||||
for (const is_system_auto of [0, '0']) {
|
||||
for (const doctor_signature of ['', signature]) {
|
||||
const data = {
|
||||
...basePrescription(), is_system_auto, doctor_signature,
|
||||
herbs: [{ name: '黄芪', dosage: 10, formula_type: '主方' }]
|
||||
}
|
||||
for (const variant of ['internal', 'user']) {
|
||||
const html = await renderedSlip(data, variant)
|
||||
assert.match(html, /alt="药师签名"/)
|
||||
assert.ok(html.includes(defaultSignature))
|
||||
if (doctor_signature) {
|
||||
assert.match(html, /alt="医师签名"/)
|
||||
assert.ok(html.includes(`src="${signature}"`))
|
||||
} else {
|
||||
assert.ok(html.includes('开方医师'))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function preview(page, options = {}) {
|
||||
const calls = [], errors = []
|
||||
let order = options.order ?? signedOrder()
|
||||
|
||||
@@ -307,6 +307,10 @@ test('prescription slip prefers the current signed approval and uses the default
|
||||
}
|
||||
assert.equal(rxPharmacistSignature({ ...signed, prescription_audit_signed_name: '' }), signature)
|
||||
assert.equal(rxPharmacistSignature({ doctor_name: '王医生' }), defaultSignature)
|
||||
for (const blank of [1, '1']) {
|
||||
assert.equal(rxPharmacistSignature({ ...signed, is_system_auto: blank }), '')
|
||||
assert.equal(rxPharmacistSignature({ is_system_auto: blank, doctor_name: '王医生' }), '')
|
||||
}
|
||||
assert.equal(rxPharmacistSignature(null), '')
|
||||
assert.equal(rxPharmacistSignature(undefined), '')
|
||||
component('components/prescription-slip/index.vue')
|
||||
|
||||
Reference in New Issue
Block a user