更新
This commit is contained in:
@@ -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