feat(患者签署): 接入签署上下文接口并补齐文书渲染与手写签名链路

This commit is contained in:
yelan
2026-09-28 10:38:22 +08:00
parent d711e03a4e
commit 28c45dc7b2
13 changed files with 1126 additions and 277 deletions
+31 -9
View File
@@ -1,4 +1,4 @@
import type { SignDeliveryChannel, SignatureUploadResponse } from '@/api/types'
import type { SignDeliveryChannel, SignatureUploadResponse, SigningContextField } from '@/api/types'
export type SignerRelation = '本人' | '父亲' | '母亲' | '其他监护人' | '其他'
@@ -10,17 +10,47 @@ export type SignFlowStatus =
export interface SignFlowState {
mode: SignFlowMode
status: SignFlowStatus
/** 后端返回的任务状态(`WAITING_SIGN` / `SIGNED` / `EXPIRED` / `VOIDED` / `FAILED`) */
taskStatus: string
patientName: string
sex: string
age: string
visitNo: string
department: string
documentTitle: string
templateVersion: string
/**
* 文书正文 HTML(含占位符)。真实模式下由 `context` 接口返回。
*
* 与 `staffAnswers` 分开:正文是模板固化的那份,医生填的内容另存一份 ——
* 合成一份就查不出「谁在什么时候填了什么」。
*/
documentContentHtml: string
contentSha256: string
/** 医生已填的结果(含医师签名图),患者端**只读**渲染 */
staffAnswers: Record<string, string>
/** 患者端可交互的字段。按约定只有主签名位(`id === 'signature'`) */
fields: SigningContextField[]
/** 有没有真的拿到正文 —— 没拿到就不该让患者签 */
documentLoaded: boolean
documentError: string
taskNo: string
taskId: string
deliveryId: string
uploadToken: string
channel: SignDeliveryChannel | ''
consentAccepted: boolean
/** 签署人:按业务口径由医生在医护端填好,患者端只展示 */
signerType: string
signerName: string
relation: SignerRelation | ''
signatureCaptured: boolean
submittedAt: string
backendStatus: string
@@ -28,11 +58,3 @@ export interface SignFlowState {
uploadResult: SignatureUploadResponse | null
errorMessage: string
}
export const relationOptions: Array<{ value: SignerRelation; label: string }> = [
{ value: '本人', label: '本人' },
{ value: '父亲', label: '父亲' },
{ value: '母亲', label: '母亲' },
{ value: '其他监护人', label: '其他监护人' },
{ value: '其他', label: '其他' },
]