This commit is contained in:
Your Name
2026-11-26 15:46:20 +08:00
parent db6d327e91
commit be79e09c83
170 changed files with 21159 additions and 13217 deletions
+102 -17
View File
@@ -2,14 +2,19 @@
<el-dialog
:model-value="true"
:title="reviewer ? '审核签署身份' : '医生电子签署身份'"
:width="frameUrl ? 'min(760px, 94vw)' : 'min(520px, 94vw)'"
width="min(760px, 94vw)"
top="5vh"
append-to-body
:close-on-click-modal="false"
:before-close="dismiss"
>
<p class="doctor-esign__message" role="status">{{ guidance }}</p>
<dl v-if="state?.enabled && state.status === 'ready'" class="doctor-esign__expiry">
<p v-if="statusNotice" class="doctor-esign__message" role="status">{{ statusNotice }}</p>
<dl v-if="state && (certificateLabel || grantActive)" class="doctor-esign__expiry">
<template v-if="certificateLabel">
<dt>签署证书状态</dt>
<dd>{{ certificateLabel }}</dd>
</template>
<template v-if="state.cert_expires_at">
<dt>签署证书有效期至</dt>
<dd>{{ formatExpiry(state.cert_expires_at) }}</dd>
@@ -22,6 +27,17 @@
</template>
</dl>
<p v-if="error" class="doctor-esign__error" role="alert">{{ error }}</p>
<label v-if="needsSignerName" class="doctor-esign__field">
证件姓名
<el-input
v-model="signerName"
:disabled="!!pending"
autocomplete="off"
:spellcheck="false"
required
placeholder="请输入与本人有效证件一致的姓名"
/>
</label>
<label v-if="needsMobile" class="doctor-esign__field">
本人手机号码
<el-input
@@ -67,11 +83,18 @@
{{ state?.quicksign_authorizing ? '确认快捷签授权' : '确认绑定签署身份' }}
</el-button>
<el-button
v-if="canResume && !state?.quicksign_authorizing"
v-if="canRestartWithSignerName"
:disabled="!!pending"
@click="enterSignerName"
>修改证件姓名</el-button>
<el-button
v-if="canResume && !state?.quicksign_authorizing && !canRestartWithSignerName"
:disabled="!!pending"
@click="enterMobile"
>重新输入手机号</el-button>
<el-button :disabled="!!pending" @click="refresh">检查状态</el-button>
<el-button :disabled="!!pending" @click="checkStatus">
{{ checkingIdentity ? '检查认证状态' : '重新校验证书' }}
</el-button>
<el-button v-if="frameUrl" link @click="authenticationUnavailable">验证页面不可用</el-button>
<el-button @click="dismiss">关闭</el-button>
</div>
@@ -112,21 +135,42 @@ const state = ref<ReturnType<typeof validateStatus> | null>(null)
const pending = ref<DoctorRequest | null>(null)
const frameUrl = ref('')
const mobile = ref('')
const signerName = ref('')
const identityNumber = ref('')
const editingMobile = ref(false)
const error = ref('')
const statusNotice = ref('')
const now = ref(Date.now() + props.serverTimeOffsetMs)
const authUrl = computed(() => state.value?.auth_url ?? '')
const authenticating = computed(() => state.value?.enabled === true && state.value.status === 'authenticating')
const canResume = computed(() => authenticating.value && !!authUrl.value && !frameUrl.value && !editingMobile.value)
const canEditSignerName = computed(() => props.reviewer === true && state.value?.enabled === true
&& state.value.can_edit_signer_name === true && !state.value.quicksign_authorizing)
const canRestartWithSignerName = computed(() => canEditSignerName.value && authenticating.value && !editingMobile.value)
const needsSignerName = computed(() => canEditSignerName.value
&& (state.value?.status === 'unbound' || state.value?.status === 'needs_mobile'
|| (authenticating.value && editingMobile.value)))
const canComplete = computed(() => state.value?.enabled === true && state.value.status === 'binding_required')
const checkingIdentity = computed(() => authenticating.value || canComplete.value)
const needsIdentityNumber = computed(() => canComplete.value && !state.value?.quicksign_authorizing
&& state.value?.identity_details_required === true)
const needsMobile = computed(() => state.value?.enabled === true
&& (enrollmentStatuses.includes(state.value.status) || editingMobile.value))
const certificateState = computed(() => {
const current = state.value
if (!current?.enabled) return ''
if (current.status === 'unbound') return 'unbound'
if (current.certificate_state === 'unconfirmed') return 'unconfirmed'
if (current.status === 'renewal_required' || current.certificate_state === 'renewal_required') return 'renewal_required'
if (current.status !== 'ready' && current.status !== 'needs_mobile') return ''
return current.cert_expires_at * 1000 > now.value ? 'valid' : 'renewal_required'
})
const certificateLabel = computed(() => ({
'': '', unbound: '未绑定', valid: '有效', renewal_required: '需要续期', unconfirmed: '暂无法确认'
})[certificateState.value])
const quickReady = computed(() => state.value?.enabled === true && state.value.status === 'ready'
&& state.value.quicksign_enabled === true)
&& certificateState.value === 'valid' && state.value.quicksign_enabled === true)
const grantActive = computed(() => quickReady.value && !!state.value && !state.value.quicksign_unavailable_reason
&& (state.value.quicksign_remaining_times ?? 0) > 0 && state.value.quicksign_expires_at * 1000 > now.value)
const canAuthorizeQuick = computed(() => quickReady.value && !grantActive.value)
@@ -137,15 +181,19 @@ const startLabel = computed(() => {
})
const guidance = computed(() => {
const current = state.value
if (!current) return pending.value === 'status' ? '正在查询医生签署身份…' : ''
if (pending.value === 'status' && !checkingIdentity.value) return '正在向 e签宝校验证书…'
if (!current) return ''
if (!current.enabled) return '当前环境未启用医生电子签署身份。'
if (needsSignerName.value) return '请填写与本人有效证件一致的姓名和本人手机号码,完成人脸认证。'
switch (current.status) {
case 'unbound':
return '首次电子签署前,请验证本人身份并绑定签署证书。'
case 'needs_mobile':
return '请使用本人手机号码完成签署身份验证。'
case 'renewal_required':
return '签署证书需要续期,请使用本人手机号码完成人脸认证。'
return certificateState.value === 'unconfirmed'
? '暂无法确认证书状态,可重新校验,或使用本人手机号码发起续期认证。'
: '签署证书需要续期,请使用本人手机号码完成人脸认证。'
case 'authenticating':
if (editingMobile.value) return '请使用本人手机号码完成人脸认证。'
if (current.authUrlUnavailable) return '验证链接不可用,请检查状态后重试。'
@@ -159,9 +207,11 @@ const guidance = computed(() => {
if (needsIdentityNumber.value) return '人脸认证已通过。首次绑定证书需要补充与本次认证一致的身份证号码。'
return '人脸认证已通过,请确认完成本人的签署身份认证。'
case 'ready': {
if (certificateState.value !== 'valid') return '请重新校验签署证书后继续。'
if (!quickReady.value) return '医生签署身份已就绪。'
if (grantActive.value) return props.reviewer ? '快捷签授权有效。每张处方由审核人本人确认签名。'
: '快捷签授权有效。每张处方仍需开方医生本人确认签名。'
if (grantActive.value) return props.reviewer
? '快捷签授权有效。每张处方由药师本人确认签名。'
: '快捷签授权有效。请回到处方中,由开方医生本人确认签名。'
const reason = current.quicksign_unavailable_reason
if (reason === 'expired' || (current.quicksign_expires_at > 0 && current.quicksign_expires_at * 1000 <= now.value)) {
return '快捷签授权已过期,请重新授权。'
@@ -190,11 +240,14 @@ function validTime(value: number) {
function validateStatus(result: PrescriptionEsignDoctorStatus) {
const {
enabled, status, cert_expires_at,
enabled, status, cert_expires_at, certificate_state,
can_edit_signer_name = false,
identity_details_required = false, quicksign_enabled = false, quicksign_authorizing = false,
quicksign_expires_at = 0, quicksign_remaining_times = 0, quicksign_unavailable_reason = ''
} = result
if (!statuses.includes(status) || typeof enabled !== 'boolean'
|| typeof can_edit_signer_name !== 'boolean'
|| (certificate_state !== undefined && !['valid', 'renewal_required', 'unconfirmed'].includes(certificate_state))
|| typeof quicksign_enabled !== 'boolean' || typeof quicksign_authorizing !== 'boolean'
|| !validTime(cert_expires_at) || !validTime(quicksign_expires_at)
|| typeof identity_details_required !== 'boolean'
@@ -207,7 +260,7 @@ function validateStatus(result: PrescriptionEsignDoctorStatus) {
const providerUrl = enabled && status === 'authenticating' ? result.auth_url : undefined
const auth_url = safeEsignAuthUrl(providerUrl)
return {
enabled, status, cert_expires_at, identity_details_required, quicksign_enabled, quicksign_authorizing,
enabled, status, cert_expires_at, certificate_state, can_edit_signer_name, identity_details_required, quicksign_enabled, quicksign_authorizing,
quicksign_expires_at, quicksign_remaining_times, quicksign_unavailable_reason, auth_url,
authUrlUnavailable: Boolean(providerUrl && !auth_url)
}
@@ -215,6 +268,7 @@ function validateStatus(result: PrescriptionEsignDoctorStatus) {
function clearInputs() {
mobile.value = ''
signerName.value = ''
identityNumber.value = ''
}
@@ -239,6 +293,7 @@ function clearStatus() {
state.value = null
editingMobile.value = false
error.value = ''
statusNotice.value = ''
}
function dismiss() {
@@ -257,8 +312,9 @@ function accept(result: ReturnType<typeof validateStatus>) {
editingMobile.value = false
state.value = result
if (!authenticating.value || (frameUrl.value && frameUrl.value !== authUrl.value)) stopAuthentication()
if (grantActive.value) {
const expiresIn = result.quicksign_expires_at * 1000 - now.value
if (certificateState.value === 'valid') {
const expiry = grantActive.value ? Math.min(result.cert_expires_at, result.quicksign_expires_at) : result.cert_expires_at
const expiresIn = expiry * 1000 - now.value
if (expiresIn <= 2147483647) {
grantExpiryTimer = setTimeout(() => { now.value = Date.now() + props.serverTimeOffsetMs }, expiresIn)
}
@@ -292,6 +348,13 @@ function enterMobile() {
error.value = ''
}
function enterSignerName() {
if (!canAct() || pending.value || !canRestartWithSignerName.value) return
stopAuthentication()
editingMobile.value = true
error.value = ''
}
async function submit(
kind: DoctorRequest,
request: () => Promise<PrescriptionEsignDoctorStatus>
@@ -301,6 +364,7 @@ async function submit(
clearInputs()
clearTimeout(pollTimer)
error.value = ''
statusNotice.value = ''
pending.value = kind
try {
const result = validateStatus(await request())
@@ -309,7 +373,7 @@ async function submit(
} catch {
if (current !== generation || !canAct()) return
clearStatus()
error.value = '医生签署身份状态待确认,请检查状态后继续。'
error.value = kind === 'status' ? '签署身份状态待确认,请重新校验证书或检查认证状态。' : '签署身份操作结果待确认,请检查状态后继续。'
return
} finally {
if (current === generation) pending.value = null
@@ -329,18 +393,35 @@ async function refresh() {
}
}
async function checkStatus() {
if (!canAct() || pending.value) return
const checkingFlow = checkingIdentity.value
await refresh()
if (!canAct() || !state.value?.enabled || error.value) return
if (checkingFlow) statusNotice.value = '认证状态已更新。'
else if (certificateState.value === 'valid') statusNotice.value = '证书校验通过。'
}
async function start() {
if (!canAct() || pending.value) return
if (canAuthorizeQuick.value) {
await submit('start', () => prescriptionEsignDoctorStart({}))
} else if (needsMobile.value) {
const number = mobile.value.trim()
clearInputs()
const name = needsSignerName.value ? signerName.value.trim() : undefined
if (!/^1[3-9]\d{9}$/.test(number)) {
if (name === undefined) clearInputs()
error.value = '请输入有效的大陆手机号码。'
return
}
await submit('start', () => prescriptionEsignDoctorStart({ mobile: number }))
if (name !== undefined && !/^[\p{Script=Han}A-Za-z][\p{Script=Han}A-Za-z·()\-]{1,49}$/u.test(name)) {
error.value = '证件姓名须为 2 至 50 个字符,以汉字或英文字母开头,可包含间隔号(·)、半角括号和连字符。'
return
}
await submit('start', () => prescriptionEsignDoctorStart({
mobile: number,
...(name !== undefined ? { signer_name: name } : {})
}))
}
}
@@ -361,7 +442,10 @@ async function complete() {
function onVisibilityChange() {
if (document.visibilityState === 'visible') void refresh()
else clearStatus()
else {
clearStatus()
statusNotice.value = '身份验证已暂停,返回此页后会重新检查。'
}
}
onMounted(() => {
@@ -393,6 +477,7 @@ onBeforeUnmount(() => {
.doctor-esign__expiry dt { color: var(--el-text-color-secondary); }
.doctor-esign__expiry dd { margin: 0; }
.doctor-esign__field { display: grid; gap: 6px; max-width: 350px; }
.doctor-esign__field + .doctor-esign__field { margin-top: 12px; }
.doctor-esign__frame {
display: block;
width: 100%;
+230 -28
View File
@@ -1,17 +1,27 @@
<template>
<section v-show="showControls || signingTime || reviewState?.required" class="esign-panel" aria-label="处方电子签署" v-loading="busy">
<section v-show="showControls || signingTime || showSteps || showSigningLog" class="esign-panel" aria-label="处方电子签署" :aria-busy="busy">
<div class="esign-panel__heading">
<strong>医师电子签署</strong>
<el-tag v-if="confirmed && state?.environment === 'sandbox' && state.status !== 'legacy'" type="warning" size="small">
<strong>{{ reviewRequired ? '处方电子签署' : '医师电子签署' }}</strong>
<el-tag v-if="state?.environment === 'sandbox' && state.status !== 'legacy'" type="warning" size="small">
沙箱测试
</el-tag>
</div>
<el-steps v-if="(confirmed || busy) && state?.required && state.status !== 'voided' && (!audit || state.can_sign || state.can_retry_verify)" :active="activeStep" finish-status="success" simple>
<el-step title="处方草稿已保存" />
<el-step :title="verificationMethod === 'quick' ? '核对快捷签授权' : verificationMethod === 'sms' ? '校验短信验证码' : '验证医生身份'" />
<el-step title="签名并完成" />
</el-steps>
<div v-if="showSteps" class="esign-panel__progress">
<el-steps
:active="activeStep"
:class="{ 'esign-panel__steps--review': reviewRequired }"
finish-status="success"
simple
>
<el-step title="处方草稿已保存" />
<el-step v-if="tracksUpload" title="上传处方" />
<el-step v-else :title="verificationMethod === 'quick' ? '核对快捷签授权' : verificationMethod === 'sms' ? '校验短信验证码' : '验证医生身份'" />
<el-step :title="reviewRequired || tracksUpload ? '医师签署' : '签名并完成'" />
<el-step v-if="reviewRequired" title="药师签署" />
</el-steps>
</div>
<p v-if="message" class="esign-panel__message" aria-live="polite">{{ message }}</p>
<p v-if="statusNotice" class="esign-panel__message" role="status">{{ statusNotice }}</p>
<div v-if="signingTime" class="esign-panel__message" aria-live="polite">
<div v-if="signingTime.issuedTime">开具时间:{{ signingTime.issuedTime }}(北京时间)</div>
<div v-if="signingTime.signatureTime">
@@ -21,11 +31,26 @@
<div>签署时间待核实</div>
<div v-if="signingTime.verifiedTime">系统验签完成时间:{{ signingTime.verifiedTime }}(北京时间)</div>
</template>
<div v-if="!audit && state?.review_signature_time">
审核签署时间:{{ formatSigningTime(state.review_signature_time) }}(北京时间 · 可信时间戳)
<span v-if="state.review_signer_name"> · {{ state.review_signer_name }}</span>
</div>
</div>
<p v-if="reviewSigning" class="esign-panel__message esign-panel__review-signature" aria-live="polite">
药师签署时间:<span class="esign-panel__timestamp">{{ reviewSigning.time }}</span>(北京时间 · 可信时间戳)
<span v-if="reviewSigning.name"> · {{ reviewSigning.name }}</span>
</p>
<details v-if="showSigningLog" :key="prescriptionId" class="esign-panel__log">
<summary>签署日志</summary>
<ol v-if="signingLog.length" class="esign-panel__log-list">
<li v-for="(entry, index) in signingLog" :key="`${entry.event}-${entry.time}-${index}`">
<strong>{{ entry.label }}</strong>
<span v-if="entry.actor_name"> · {{ entry.actor_name }}</span>
<div class="esign-panel__log-meta">
<time :datetime="new Date(entry.time * 1000).toISOString()">{{ entry.timeText }}</time>
(北京时间 · {{ entry.sourceLabel }})
</div>
<div v-if="entry.message" class="esign-panel__log-meta">{{ entry.message }}</div>
</li>
</ol>
<p v-else class="esign-panel__message">暂无签署日志。</p>
</details>
<p v-if="error" class="esign-panel__error" role="alert">{{ error }}</p>
<label v-if="identityDetailsRequired" class="esign-panel__identity">
本次验证使用的身份证号
@@ -52,19 +77,31 @@
/>
</label>
<div v-if="showControls && prescriptionId > 0" class="esign-panel__actions">
<el-button type="primary" size="small" :disabled="busy || dialogVisible || (action.run === sendSms && smsSendCoolingDown)" @click="action.run">
<el-button type="primary" size="small" :disabled="busy || dialogVisible || (action.run === sendSms && smsSendCoolingDown)" @click="runAction">
{{ action.label }}
</el-button>
<el-button v-if="smsCodeEntry" size="small" :disabled="busy || smsSendCoolingDown" @click="sendSms">
{{ smsSendCoolingDown ? '请稍后重新发送' : '重新发送验证码' }}
</el-button>
<el-button v-if="readiness" size="small" :disabled="busy" @click="closeAuthentication">取消</el-button>
<el-button v-if="readiness || smsCodeEntry" size="small" :disabled="busy" @click="closeAuthentication">退出签署</el-button>
<el-button
v-if="canOpenCertificate"
size="small"
:disabled="busy || dialogVisible"
@click="doctorIdentityOpen = true"
>签署身份与证书</el-button>
</div>
<EsignDoctorDialog
v-if="doctorIdentityOpen"
:server-time-offset-ms="userStore.serverTimeOffsetMs"
@close="closeDoctorIdentity"
/>
<EsignReviewPanel
v-if="audit && confirmed && state"
v-if="audit && state"
:prescription-id="prescriptionId"
:order-id="reviewOrderId"
:doctor-signed="state.status === 'signed'"
:doctor-status-confirmed="confirmed"
@change="updateReview"
/>
<el-dialog
@@ -89,7 +126,7 @@
/>
<template #footer>
<el-button link @click="authenticationUnavailable">验证页面不可用</el-button>
<el-button @click="closeAuthentication">关闭</el-button>
<el-button @click="closeAuthentication">退出签署</el-button>
</template>
</el-dialog>
</section>
@@ -104,6 +141,7 @@ import {
prescriptionEsignStart,
prescriptionEsignStatus,
prescriptionEsignVerifyWillingness,
prescriptionSubmitForReview,
type PrescriptionEsignIdentityStatus,
type PrescriptionEsignReviewStatus,
type PrescriptionEsignStatus
@@ -119,12 +157,15 @@ import {
validateEsignStatus
} from '@/utils/prescription-esign'
import EsignReviewPanel from '@/components/EsignReviewPanel.vue'
import EsignDoctorDialog from '@/components/EsignDoctorDialog.vue'
import useUserStore from '@/stores/modules/user'
const props = defineProps<{ prescriptionId: number; initialState?: PrescriptionEsignStatus; audit?: boolean; reviewOrderId?: number }>()
const emit = defineEmits<{
(e: 'status-change', state: PrescriptionEsignStatus): void
(e: 'review-change', state: PrescriptionEsignReviewStatus | null): void
}>()
const userStore = useUserStore()
const reviewState = ref<PrescriptionEsignReviewStatus | null>(null)
function updateReview(result: PrescriptionEsignReviewStatus | null) {
@@ -141,12 +182,52 @@ function initialStatus(): PrescriptionEsignStatus | null {
}
const state = ref<PrescriptionEsignStatus | null>(initialStatus())
const work = ref<'status' | 'start' | 'identity' | 'send-sms' | 'verify-sms' | 'sign' | 'verify' | 'download' | null>(null)
const work = ref<'status' | 'upload' | 'start' | 'identity' | 'send-sms' | 'verify-sms' | 'sign' | 'verify' | 'download' | null>(null)
const busy = computed(() => work.value !== null)
const confirmed = ref(false)
const awaitingUpload = computed(() => state.value?.awaiting_upload === true)
const tracksUpload = computed(() => awaitingUpload.value || Number(state.value?.review_submitted_at) > 0)
const showControls = computed(() => !props.audit || !confirmed.value || !canApprovePrescriptionEsign(state.value))
const signingTime = computed(() => prescriptionEsignTiming(state.value))
const logSourceLabels = { tsa: '可信时间戳', system: '系统记录', local: '签名记录时间' }
const signingLog = computed(() => {
const entries = state.value?.signing_log
if (!Array.isArray(entries)) return []
return entries.flatMap((entry) => {
if (!entry || typeof entry.event !== 'string' || !entry.event.trim()
|| typeof entry.label !== 'string' || !entry.label.trim()
|| !['tsa', 'system', 'local'].includes(entry.source)) return []
const timeText = formatSigningTime(entry.time)
return timeText ? [{ ...entry, timeText, sourceLabel: logSourceLabels[entry.source] }] : []
}).sort((a, b) => a.time - b.time)
})
const showSigningLog = computed(() => signingLog.value.length > 0
|| (!props.audit && (state.value?.required === true || Boolean(signingTime.value))))
const reviewSigning = computed(() => {
const current = state.value
if (current?.status !== 'signed' && current?.status !== 'voided') return null
const time = formatSigningTime(current.review_signature_time)
if (time) return { time, name: current.review_signer_name }
const review = reviewState.value
if (review?.state !== 'signed') return null
const auditTime = formatSigningTime(review.signature_time)
return auditTime ? { time: auditTime, name: review.signer_name } : null
})
const reviewRequired = computed(() => state.value?.review_required === true || reviewState.value?.required === true
|| Boolean(reviewSigning.value))
const showSteps = computed(() => {
const current = state.value
if (!current) return false
if (reviewRequired.value) return current.status !== 'voided' || Boolean(reviewSigning.value)
return (confirmed.value || busy.value) && current.required && current.status !== 'voided'
&& (!props.audit || current.can_sign || current.can_retry_verify === true)
})
const error = ref('')
const statusNotice = ref('')
const doctorIdentityOpen = ref(false)
const dialogVisible = ref(false)
const readiness = ref<'ready' | 'details' | null>(null)
const restartRequired = ref(false)
@@ -162,7 +243,7 @@ const verificationMethod = computed(() => state.value?.verification_method)
const accountSetupMessage = computed(() => {
const current = state.value
if (!current?.can_sign || !verificationMethod.value) return ''
const settings = '请返回页面右上角账号菜单,在「医生电子签署身份」中处理。完成后回到处方查询签署状态。'
const settings = '请打开「签署身份与证书」处理后继续。'
if (current.doctor_identity_required && !(verificationMethod.value === 'sms' && smsProfileReady.value)) {
return `${current.message || '请先完成医生签署身份认证。'} ${settings}`
}
@@ -177,21 +258,25 @@ const smsCodeEntry = computed(() => confirmed.value && smsCodeState.value === 'e
const identityResumable = computed(() => !verificationMethod.value && canCheckEsignIdentity(state.value)
&& (state.value?.can_resume_identity === true || Boolean(authUrl.value)))
const activeStep = computed(() => {
if (state.value?.status === 'signed') return 3
if (awaitingUpload.value) return 1
if (reviewSigning.value) return 4
if (state.value?.status === 'signed' && state.value.can_download) return 3
if (tracksUpload.value) return 2
if (readiness.value || work.value === 'sign' || work.value === 'verify'
|| state.value?.status === 'signing' || state.value?.status === 'uncertain') return 2
return 1
})
const message = computed(() => {
if (props.prescriptionId <= 0) return '缺少关联处方,无法核对签署状态。'
if (props.audit && work.value === 'status') return '正在查询签署状态…'
if (work.value === 'identity' && verificationMethod.value === 'quick') return '正在核对快捷签授权…'
if (work.value === 'identity' && verificationMethod.value === 'sms') return '正在查询短信验证状态…'
if (work.value === 'status') return '正在查询签署状态…'
if (work.value === 'upload') return '正在上传处方…'
if (work.value === 'identity' && !readiness.value && verificationMethod.value === 'quick') return '正在核对快捷签授权…'
if (work.value === 'identity' && !readiness.value && verificationMethod.value === 'sms') return '正在查询短信验证状态…'
if (work.value === 'send-sms') return '正在向医生绑定的手机号发送验证码…'
if (work.value === 'verify-sms') return '正在校验短信验证码…'
if (work.value === 'sign') return '正在签署处方…'
if (work.value === 'verify') return '正在校验已签文件…'
if (!confirmed.value || error.value) return ''
if (error.value || (!confirmed.value && !state.value)) return ''
if (readiness.value) {
if (verificationMethod.value === 'quick') return '快捷签授权已核对。请核对处方内容后确认签名。'
if (verificationMethod.value === 'sms') return '短信验证码已通过。请核对处方内容后确认签名。'
@@ -199,8 +284,18 @@ const message = computed(() => {
}
const current = state.value
if (!current) return ''
if (awaitingUpload.value) {
if (current.can_submit_for_review !== true) return current.message || '请开方医生先上传处方。'
if (current.status === 'signed' && current.can_download) return '医师已签署,请上传处方后进入审核。'
return current.required ? '请先上传处方,再由开方医生本人签署。' : '请上传处方,提交药师审核。'
}
if (current.status === 'legacy' && !current.enabled) return current.message || '此处方使用手写签名。'
if (current.status === 'signed') return current.can_download ? '处方已签署。' : '处方已签署,原件暂不可用。'
if (current.status === 'signed') {
if (reviewRequired.value && !reviewSigning.value) {
return current.can_download ? '医师已签署,等待药师审核签署。' : '医师已签署,原件暂不可用,请查询签署状态。'
}
return current.can_download ? '处方已签署。' : '处方已签署,原件暂不可用。'
}
if (current.required && ['pending', 'authenticating', 'failed'].includes(current.status)) {
if (accountSetupMessage.value) return accountSetupMessage.value
if (canUseMethod(current, 'quick')) {
@@ -224,6 +319,11 @@ const message = computed(() => {
})
const action = computed(() => {
if (!confirmed.value) return { label: '查询签署状态', run: refresh }
if (awaitingUpload.value) {
return !props.audit && state.value?.can_submit_for_review === true
? { label: '上传处方', run: upload }
: { label: '查询签署状态', run: refresh }
}
if (state.value?.can_download && (state.value.status === 'signed' || state.value.status === 'voided')) {
return { label: '下载已签 PDF', run: download }
}
@@ -246,6 +346,8 @@ const action = computed(() => {
}
return { label: '查询签署状态', run: refresh }
})
const canOpenCertificate = computed(() => confirmed.value
&& (canUseMethod(state.value, 'quick') || canUseMethod(state.value, 'sms')))
const pollInterval = 5000
const authenticationTimeout = 10 * 60 * 1000
@@ -268,6 +370,7 @@ function isCurrent(current: number, id: number) {
function canUseMethod(result: PrescriptionEsignStatus | null, method: VerificationMethod): boolean {
return result?.verification_method === method && result.enabled && result.required && result.can_sign
&& result.awaiting_upload !== true
&& ['pending', 'authenticating', 'failed'].includes(result.status)
}
@@ -300,7 +403,17 @@ function cancelWork() {
}
function closeAuthentication() {
if (dialogVisible.value || readiness.value) cancelWork()
if (dialogVisible.value || readiness.value || smsCodeEntry.value) {
cancelWork()
confirmed.value = false
error.value = ''
statusNotice.value = '已退出本次签署,可查询状态后继续。'
}
}
function closeDoctorIdentity() {
doctorIdentityOpen.value = false
void refresh()
}
function stopVerification(message: string) {
@@ -574,8 +687,9 @@ async function refresh() {
work.value = 'status'
confirmed.value = false
error.value = ''
statusNotice.value = ''
try {
const result = validateEsignStatus(await prescriptionEsignStatus({ id }))
const result = validateEsignStatus(await requestIdentity((signal) => prescriptionEsignStatus({ id }, signal)))
if (!isCurrent(current, id)) return
accept(result)
// A previous SMS failure can retain the setup flag after the doctor fixes the profile.
@@ -602,6 +716,45 @@ async function refresh() {
}
}
async function runAction() {
const run = action.value.run
const current = operation
await run()
if (run === refresh && operation === current + 1 && confirmed.value && !error.value && isCurrent(operation, props.prescriptionId)) {
statusNotice.value = '签署状态已更新。'
}
}
async function upload() {
const before = state.value
if (!canAct() || !confirmed.value || props.audit || !awaitingUpload.value || before?.can_submit_for_review !== true) return
const id = props.prescriptionId
const current = ++operation
work.value = 'upload'
error.value = ''
statusNotice.value = ''
try {
const result = await prescriptionSubmitForReview({ id })
if (!isCurrent(current, id)) return
if (!Number.isSafeInteger(result?.review_submitted_at) || result.review_submitted_at <= 0) {
throw new Error('无法核对上传结果')
}
accept({
...before,
review_submitted_at: result.review_submitted_at,
awaiting_upload: false,
can_submit_for_review: false
})
} catch {
if (isCurrent(current, id)) error.value = '暂未确认处方上传,请重试。'
return
} finally {
if (isCurrent(current, id)) work.value = null
}
await refresh()
if (isCurrent(current + 1, id)) statusNotice.value = '处方已上传。'
}
async function download() {
if (!canAct() || !confirmed.value || !state.value?.can_download
|| (state.value.status !== 'signed' && state.value.status !== 'voided')) return
@@ -610,7 +763,7 @@ async function download() {
work.value = 'download'
error.value = ''
try {
const result = validateEsignStatus(await prescriptionEsignStatus({ id }))
const result = validateEsignStatus(await requestIdentity((signal) => prescriptionEsignStatus({ id }, signal)))
if (!isCurrent(current, id)) return
accept(result)
if (result.can_download && (result.status === 'signed' || result.status === 'voided')) {
@@ -627,7 +780,12 @@ async function download() {
function onVisibilityChange() {
if (document.visibilityState === 'visible') return
if (dialogVisible.value || readiness.value) {
confirmed.value = false
statusNotice.value = '签署验证已暂停,可查询状态后继续。'
}
if (work.value === 'sign') error.value = '签署结果待确认,请查询签署状态。'
if (work.value === 'upload') error.value = '上传结果待确认,请查询处方状态。'
if (work.value === 'verify') error.value = '校验结果待确认,请查询签署状态。'
if (work.value === 'send-sms') error.value = '短信发送状态待确认,请查询签署状态。'
if (work.value === 'verify-sms') error.value = '短信校验结果待确认,请查询签署状态。'
@@ -639,11 +797,16 @@ function resetStatus() {
restartRequired.value = false
confirmed.value = false
error.value = ''
statusNotice.value = ''
doctorIdentityOpen.value = false
state.value = initialStatus()
void refresh()
}
watch(() => props.prescriptionId, resetStatus, { immediate: true })
watch(() => props.prescriptionId, () => {
reviewState.value = null
resetStatus()
}, { immediate: true })
watch(() => props.initialState, (value) => {
// An emitted state echoed by the parent preserves this interaction.
if (toRaw(value) !== toRaw(state.value)) resetStatus()
@@ -675,11 +838,40 @@ onBeforeUnmount(() => {
}
.esign-panel :deep(.el-steps) { margin: 10px 0; padding: 10px 12px; }
.esign-panel :deep(.el-step.is-simple .el-step__title) { font-size: 13px; line-height: 1.4; word-break: normal; }
.esign-panel__progress { container-type: inline-size; }
.esign-panel__steps--review {
display: grid;
grid-template-columns: 1fr;
gap: 8px 12px;
}
.esign-panel__steps--review :deep(.el-step.is-simple:last-of-type) { max-width: none !important; }
.esign-panel__steps--review :deep(.el-step.is-simple .el-step__title) { max-width: none; white-space: nowrap; }
.esign-panel__steps--review :deep(.el-step.is-simple .el-step__arrow) { display: none; }
.esign-panel__review-signature { overflow-wrap: anywhere; }
.esign-panel__timestamp { white-space: nowrap; }
.esign-panel__actions { margin-top: 10px; }
.esign-panel__actions .el-button + .el-button { margin-left: 0; }
.esign-panel__message, .esign-panel__error { margin: 8px 0; font-size: 13px; }
.esign-panel__message { color: var(--el-text-color-secondary); }
.esign-panel__error { color: var(--el-color-danger); }
.esign-panel__log {
margin: 10px 0;
font-size: 13px;
}
.esign-panel__log summary {
width: fit-content;
color: var(--el-color-primary);
cursor: pointer;
font-weight: 500;
}
.esign-panel__log-list {
margin: 8px 0 0;
padding-inline-start: 24px;
list-style: decimal;
overflow-wrap: anywhere;
}
.esign-panel__log-list li + li { margin-top: 8px; }
.esign-panel__log-meta { color: var(--el-text-color-secondary); }
.esign-panel__identity { display: grid; gap: 6px; max-width: 320px; margin: 10px 0; font-size: 13px; }
.esign-panel__frame {
display: block;
@@ -690,5 +882,15 @@ onBeforeUnmount(() => {
border-radius: 4px;
background: white;
}
@container (min-width: 280px) {
.esign-panel__steps--review { grid-template-columns: repeat(2, minmax(max-content, 1fr)); }
}
@container (min-width: 480px) {
.esign-panel__steps--review { grid-template-columns: repeat(4, minmax(max-content, 1fr)); gap: 0; }
.esign-panel__steps--review :deep(.el-step.is-simple:not(:last-of-type) .el-step__arrow) {
display: flex;
min-width: 18px;
}
}
@media print { .esign-panel { display: none; } }
</style>
+24 -34
View File
@@ -1,17 +1,16 @@
<template>
<div v-if="state?.required || error" class="esign-review" v-loading="busy" aria-label="处方审核电子签署">
<div v-if="state?.required || error || busy" class="esign-review" :aria-busy="busy" aria-label="处方审核电子签署">
<strong>审核电子签署</strong>
<p v-if="state?.actor_name">当前审核人 {{ state.actor_name }}</p>
<p v-if="state?.state === 'signed'">
{{ state.signer_name }} · {{ formatSigningTime(state.signature_time) }}(北京时间 · 可信时间戳)
</p>
<p v-if="state?.message" aria-live="polite">{{ state.message }}</p>
<p v-if="busy && !state" role="status">正在查询药师签署状态…</p>
<p v-if="statusNotice" role="status">{{ statusNotice }}</p>
<p v-if="error" class="text-danger" role="alert">{{ error }}</p>
<div class="esign-review__actions">
<el-button v-if="state?.can_confirm" type="primary" size="small" :disabled="busy" @click="confirm(false)">
<el-button v-if="state?.can_confirm" type="primary" size="small" :disabled="busy || !doctorStatusConfirmed" @click="confirm(false)">
确认签名
</el-button>
<el-button v-if="state?.can_retry_verify" type="primary" size="small" :disabled="busy" @click="confirm(true)">
<el-button v-if="state?.can_retry_verify" type="primary" size="small" :disabled="busy || !doctorStatusConfirmed" @click="confirm(true)">
重试验签
</el-button>
<el-button v-if="state?.required && doctorSigned" size="small" :disabled="busy" @click="download">
@@ -25,10 +24,7 @@
>
审核签署身份
</el-button>
<el-button v-if="state?.required && !state.can_approve" size="small" :disabled="busy" @click="switchReviewer">
切换审核账号
</el-button>
<el-button v-if="error || state?.state !== 'signed'" size="small" :disabled="busy" @click="refresh">
<el-button v-if="error || state?.state !== 'signed'" size="small" :disabled="busy" @click="checkStatus">
刷新签署状态
</el-button>
</div>
@@ -43,7 +39,6 @@
<script setup lang="ts">
import { onBeforeUnmount, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import {
prescriptionEsignReviewConfirm,
@@ -52,18 +47,16 @@ import {
} from '@/api/tcm'
import EsignDoctorDialog from '@/components/EsignDoctorDialog.vue'
import useUserStore from '@/stores/modules/user'
import feedback from '@/utils/feedback'
import { downloadOriginalEsignPdf, formatSigningTime } from '@/utils/prescription-esign'
import { downloadOriginalEsignPdf } from '@/utils/prescription-esign'
const props = defineProps<{ prescriptionId: number; orderId?: number; doctorSigned: boolean }>()
const props = defineProps<{ prescriptionId: number; orderId?: number; doctorSigned: boolean; doctorStatusConfirmed: boolean }>()
const emit = defineEmits<{ (e: 'change', value: PrescriptionEsignReviewStatus | null): void }>()
const state = ref<PrescriptionEsignReviewStatus | null>(null)
const identityOpen = ref(false)
const busy = ref(false)
const error = ref('')
const statusNotice = ref('')
const userStore = useUserStore()
const route = useRoute()
const router = useRouter()
let generation = 0
let statusRequest: AbortController | undefined
@@ -80,7 +73,7 @@ function accept(result: PrescriptionEsignReviewStatus) {
throw new Error('登录账号或审核状态已变化,请刷新页面')
}
state.value = result
emit('change', result)
emit('change', props.doctorStatusConfirmed ? result : null)
}
function target() {
@@ -93,6 +86,7 @@ async function refresh() {
statusRequest = new AbortController()
busy.value = true
error.value = ''
statusNotice.value = ''
emit('change', null)
try {
const result = await prescriptionEsignReviewStatus(target(), statusRequest.signal)
@@ -106,7 +100,7 @@ async function refresh() {
async function confirm(verifyOnly: boolean) {
const actorId = state.value?.actor_id
if (busy.value || !actorId || !(verifyOnly ? state.value?.can_retry_verify : state.value?.can_confirm)) return
if (busy.value || !props.doctorStatusConfirmed || !actorId || !(verifyOnly ? state.value?.can_retry_verify : state.value?.can_confirm)) return
const ticket = ++generation
busy.value = true
error.value = ''
@@ -125,19 +119,10 @@ async function confirm(verifyOnly: boolean) {
}
}
async function switchReviewer() {
try {
await feedback.confirm('当前账号将退出。请所选审核人本人登录。')
if (busy.value) return
busy.value = true
const returnTo = router.resolve({
path: route.path,
query: props.orderId ? { review_order: props.orderId } : { review_prescription: props.prescriptionId }
}).fullPath
await userStore.logout(returnTo)
} catch {
busy.value = false
}
async function checkStatus() {
const current = generation
await refresh()
if (generation === current + 1 && state.value && !error.value) statusNotice.value = '药师签署状态已更新。'
}
async function download() {
@@ -158,11 +143,16 @@ async function download() {
function closeIdentity() {
identityOpen.value = false
void refresh()
void checkStatus()
}
watch(() => [props.prescriptionId, props.orderId, props.doctorSigned, userStore.userInfo.id],
() => { if (props.prescriptionId > 0) void refresh() }, { immediate: true })
watch(() => [props.prescriptionId, props.orderId, userStore.userInfo.id], () => {
identityOpen.value = false
state.value = null
if (props.prescriptionId > 0) void refresh()
}, { immediate: true })
watch(() => props.doctorSigned, () => { if (props.prescriptionId > 0) void refresh() })
watch(() => props.doctorStatusConfirmed, (confirmed) => emit('change', confirmed && !busy.value && !error.value ? state.value : null))
onBeforeUnmount(() => {
generation++
statusRequest?.abort()
@@ -0,0 +1,115 @@
<template>
<div v-if="prescriptionId !== null" class="prescription-audit-layout">
<section class="prescription-audit-preview" aria-label="处方单" :aria-busy="loading">
<PrescriptionSlip v-if="detail" :data="detail" compact />
<el-skeleton v-else-if="loading" :rows="8" animated />
<div v-if="error" class="prescription-audit-preview__error" role="status">
<span>{{ error }}</span>
<el-button v-if="prescriptionId > 0" size="small" @click="retry++">重试加载处方</el-button>
</div>
</section>
<section class="prescription-audit-controls" aria-label="签署和审核">
<slot />
</section>
</div>
<slot v-else />
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { prescriptionDetail } from '@/api/tcm'
import PrescriptionSlip from '@/components/prescription-slip/index.vue'
const props = defineProps<{
prescriptionId: number | null
doctorSignedAt?: number
pharmacistSignedAt?: number
}>()
const detail = ref<Record<string, any> | null>(null)
const retry = ref(0)
const loading = ref(false)
const error = ref('')
watch([
() => props.prescriptionId,
() => props.doctorSignedAt,
() => props.pharmacistSignedAt,
retry
], async ([id, doctorAt, pharmacistAt, attempt], previous, onCleanup) => {
if (id !== previous?.[0]) detail.value = null
loading.value = false
error.value = ''
if (id === null) return
if (!Number.isSafeInteger(id) || id <= 0) {
error.value = '当前订单未关联处方'
return
}
const current = detail.value?.esign
if (detail.value && attempt === previous?.[3]
&& (!doctorAt || doctorAt === (current?.signature_time || current?.signed_at))
&& (!pharmacistAt || pharmacistAt === current?.review_signature_time)) return
const controller = new AbortController()
onCleanup(() => controller.abort())
loading.value = true
try {
const response = await prescriptionDetail({ id }, controller.signal)
const result = response?.data ?? response
if (controller.signal.aborted) return
if (Number(result?.id) !== id) throw new Error('处方编号不匹配')
detail.value = result
} catch {
if (!controller.signal.aborted) error.value = '无法加载处方单,请重试。'
} finally {
if (!controller.signal.aborted) loading.value = false
}
}, { immediate: true })
</script>
<style scoped>
.prescription-audit-layout {
display: grid;
grid-template-columns: minmax(0, 1.42fr) minmax(320px, 1fr);
gap: 18px;
align-items: start;
}
.prescription-audit-preview,
.prescription-audit-controls {
min-width: 0;
max-height: min(68vh, 780px);
overflow: auto;
scrollbar-gutter: stable;
}
.prescription-audit-preview {
padding: 10px;
border: 1px solid var(--el-border-color-light);
border-radius: 8px;
background: var(--el-fill-color-light);
}
.prescription-audit-controls { padding-right: 3px; }
.prescription-audit-preview__error {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
padding: 10px;
color: var(--el-text-color-regular);
}
@media (max-width: 840px) {
.prescription-audit-layout {
grid-template-columns: minmax(0, 1fr);
gap: 12px;
max-height: 70vh;
overflow-y: auto;
}
.prescription-audit-preview { max-height: min(50vh, 560px); }
.prescription-audit-controls { max-height: none; overflow: visible; }
}
</style>
+118 -16
View File
@@ -1,5 +1,5 @@
<template>
<div ref="paperRef" class="rx-paper">
<div ref="paperRef" class="rx-paper" :class="{ 'rx-paper--compact': compact }">
<div class="rx-title">{{ isInternal ? '药房联' : slipTitle }}</div>
<div class="rx-notice">
<span class="rx-notice-text">
@@ -154,21 +154,34 @@
</div>
<div class="rx-bottom">
<div class="rx-bot-row rx-bot-row-1" :class="{ 'rx-bot-row-1--user': !isInternal }">
<div
class="rx-bot-row rx-bot-row-1"
:class="{ 'rx-bot-row-1--user': !isInternal, 'rx-bot-row-1--reviewed': reviewerName }"
>
<div class="rx-bot-cell rx-bot-doctor">
<div class="rx-bot-label rx-bot-label--doctor">医师</div>
<div class="rx-bot-label rx-bot-label--inline">医师</div>
<div class="rx-bot-doctor-body">
<img
v-if="data?.doctor_signature"
:src="data.doctor_signature"
alt="医师签名"
v-if="doctorSignature"
:src="doctorSignature"
:alt="doctorName"
class="rx-bot-sign-img"
@error="onDoctorSignatureError"
/>
<span v-if="!data?.doctor_signature" class="rx-bot-doctor-name">
{{ data?.doctor_name || '—' }}
</span>
<span v-else class="rx-bot-doctor-name">{{ doctorName }}</span>
</div>
</div>
<div v-if="reviewerName" class="rx-bot-cell rx-bot-reviewer">
<span class="rx-bot-label rx-bot-label--inline">药师审核</span>
<img
v-if="reviewerSignature"
:src="reviewerSignature"
:alt="reviewerName"
class="rx-bot-sign-img"
@error="onReviewerSignatureError"
/>
<span v-else class="rx-bot-reviewer-name">{{ reviewerName }}</span>
</div>
<div v-if="isInternal" class="rx-bot-cell rx-bot-meta">
<span class="rx-bot-meta-key">类型:</span>
<span class="rx-bot-meta-val">{{ typeText }}</span>
@@ -192,6 +205,7 @@
<script lang="ts" setup>
import { computed, ref } from 'vue'
import type { PrescriptionEsignStatus } from '@/api/tcm'
import {
getAuxHerbs,
getMainHerbs,
@@ -226,6 +240,7 @@ const props = withDefaults(
auxLibraryName?: string
/** 抬头(处方联) */
title?: string
compact?: boolean
}>(),
{
variant: 'internal',
@@ -237,6 +252,45 @@ const props = withDefaults(
const paperRef = ref<HTMLElement | null>(null)
const isInternal = computed(() => props.variant !== 'user')
const slipTitle = computed(() => props.title || '成都双流甄养堂互联网医院 处方笺')
const verifiedDoctor = computed(() => {
const signing: PrescriptionEsignStatus | undefined = props.data?.esign
if (signing?.status === 'signed' || (signing?.status === 'voided' && signing.can_download)) return signing
return null
})
const doctorName = computed(() => {
const signer = verifiedDoctor.value?.doctor_signer_name
return (typeof signer === 'string' && signer.trim()) || props.data?.doctor_name || '—'
})
const failedDoctorSignature = ref('')
const doctorSignature = computed(() => {
const signature = props.data?.doctor_signature
if (verifiedDoctor.value && !isVerifiedSignaturePng(signature)) return ''
if (!verifiedDoctor.value && props.data?.esign?.required) return ''
return typeof signature === 'string' && signature !== failedDoctorSignature.value ? signature : ''
})
const reviewerName = computed(() => {
const signing = props.data?.esign
if (!signing || !['signed', 'voided'].includes(signing.status)
|| !Number.isInteger(signing.review_signature_time) || signing.review_signature_time <= 0) return ''
return typeof signing.review_signer_name === 'string' ? signing.review_signer_name.trim() : ''
})
const failedReviewerSignature = ref('')
const reviewerSignature = computed(() => {
const signature = props.data?.esign?.review_signature
return reviewerName.value && isVerifiedSignaturePng(signature) && signature !== failedReviewerSignature.value ? signature : ''
})
function isVerifiedSignaturePng(signature: unknown): signature is string {
return typeof signature === 'string' && /^data:image\/png;base64,iVBORw0KGgo[A-Za-z0-9+/]+={0,2}$/.test(signature)
}
function onDoctorSignatureError(event: Event) {
if (event.currentTarget instanceof HTMLImageElement) failedDoctorSignature.value = event.currentTarget.getAttribute('src') ?? ''
}
function onReviewerSignatureError(event: Event) {
if (event.currentTarget instanceof HTMLImageElement) failedReviewerSignature.value = event.currentTarget.src
}
const dateText = computed(() => rxDateText(props.data))
const prescriptionSnText = computed(() => rxPrescriptionSnText(props.data))
@@ -612,6 +666,14 @@ defineExpose({
grid-template-columns: 1.6fr 0.6fr;
}
.rx-bot-row-1--reviewed {
grid-template-columns: minmax(164px, 1.15fr) minmax(188px, 1.3fr) 1.4fr 0.75fr 0.85fr;
}
.rx-bot-row-1--user.rx-bot-row-1--reviewed {
grid-template-columns: minmax(164px, 1.6fr) minmax(188px, 1.6fr) 0.6fr;
}
.rx-hospital-row {
display: flex;
flex-direction: column;
@@ -662,7 +724,7 @@ defineExpose({
margin-bottom: 4px;
}
.rx-bot-label--doctor {
.rx-bot-label--inline {
flex-shrink: 0;
margin-bottom: 0;
margin-right: 6px;
@@ -670,6 +732,14 @@ defineExpose({
align-self: center;
}
.rx-bot-reviewer-name {
min-width: 0;
font-size: 13px;
font-weight: 500;
line-height: 1.4;
overflow-wrap: anywhere;
}
.rx-bot-doctor {
flex-direction: row;
align-items: center;
@@ -692,13 +762,13 @@ defineExpose({
line-height: 1.2;
white-space: nowrap;
}
}
.rx-bot-sign-img {
flex-shrink: 0;
max-height: 40px;
max-width: 110px;
object-fit: contain;
}
.rx-bot-sign-img {
flex-shrink: 0;
max-height: 24px;
max-width: 72px;
object-fit: contain;
}
.rx-bot-meta {
@@ -721,6 +791,38 @@ defineExpose({
line-height: 2.5;
}
}
.rx-paper.rx-paper--compact {
width: 100%;
min-height: 0;
padding: clamp(10px, 2.4vw, 24px);
container-type: inline-size;
.rx-title { font-size: 22px; margin: 6px 0 18px; }
.rx-notice { padding: 10px; }
.rx-notice .rx-notice-meta { flex-wrap: wrap; overflow: visible; gap: 2px 14px; }
.rx-notice .rx-notice-meta .rx-meta-item { border: 0; padding: 0; margin: 0; }
.rx-info-cell { padding: 9px; min-width: 0; overflow-wrap: anywhere; }
.rx-herb-name { white-space: normal; overflow-wrap: anywhere; }
.rx-herb-cell { line-height: 1.65; }
.rx-text { overflow-wrap: anywhere; }
.rx-bot-row-1 { display: flex; flex-wrap: wrap; min-height: 0; }
.rx-bot-row-1 > .rx-bot-cell { flex: 1 0 auto; max-width: 100%; border: 0; flex-wrap: wrap; }
.rx-bot-doctor .rx-bot-doctor-name { white-space: normal; overflow-wrap: anywhere; }
}
@container (max-width: 465px) {
.rx-paper--compact .rx-info-row:not(.rx-info-row-full) {
grid-template-columns: repeat(2, minmax(0, 1fr));
.rx-info-cell:nth-child(even) { border-right: none; }
.rx-info-cell:nth-child(n + 3) { border-top: 1px solid #c8c8c8; }
}
.rx-paper--compact .rx-rp-cols-head,
.rx-paper--compact .rx-herbs { grid-template-columns: minmax(0, 1fr); }
.rx-paper--compact .rx-rp-col-head + .rx-rp-col-head { display: none; }
}
</style>
<!-- 全局打印样式:body * 选择器不能放进 scoped -->
@@ -514,7 +514,7 @@
{{ esignError }} <el-button link type="primary" @click="loadEsignConfig">重试</el-button>
</el-alert>
<el-alert v-else-if="esignEnabled" type="info" :closable="false" class="mb-3"
:title="esignConfig?.environment === 'sandbox' ? '沙箱测试。保存草稿后,由开方医生本人确认签署。' : '保存草稿后,由开方医生本人确认签署。'" />
:title="esignConfig?.environment === 'sandbox' ? '沙箱测试。保存草稿后,先上传处方,再由开方医生本人签署。' : '保存草稿后,先上传处方,再由开方医生本人签署。'" />
<el-form-item v-else-if="esignReady" label="医师签名" prop="doctor_signature" required>
<div class="signature-pad-wrap">
<canvas
@@ -553,7 +553,7 @@
v-else-if="Number(savedPrescription.audit_status) === 0"
type="warning"
size="small"
>待审核</el-tag>
>{{ pendingPrescriptionReviewLabel(savedPrescription) }}</el-tag>
<el-tag v-else-if="Number(savedPrescription.audit_status) === 2" type="danger" size="small">已驳回</el-tag>
<div class="flex-1" />
</div>
@@ -877,7 +877,7 @@ import { getDictData } from '@/api/app'
import PrescriptionSlip from '@/components/prescription-slip/index.vue'
import EsignPrescriptionPanel from '@/components/EsignPrescriptionPanel.vue'
import { usePrescriptionEsignConfig } from '@/hooks/usePrescriptionEsignConfig'
import { downloadPrescriptionPdfIfRequired, requiresOriginalEsignPdf } from '@/utils/prescription-esign'
import { downloadPrescriptionPdfIfRequired, pendingPrescriptionReviewLabel, requiresOriginalEsignPdf } from '@/utils/prescription-esign'
import type { PrescriptionEsignStatus } from '@/api/tcm'
import html2canvas from 'html2canvas'
import { jsPDF } from 'jspdf'