feat: enable patient form interactions and revision-aware signing
This commit is contained in:
@@ -6,6 +6,8 @@ import type {
|
||||
SignatureUploadInput,
|
||||
SignatureUploadResponse,
|
||||
SigningProof,
|
||||
SigningFormState,
|
||||
PatientAnswer,
|
||||
SigningContextResponse,
|
||||
TokenConsumeRequest,
|
||||
TokenConsumeResponse,
|
||||
@@ -63,3 +65,17 @@ export function uploadSigningSignature(
|
||||
)
|
||||
.then(unwrapApiResponse)
|
||||
}
|
||||
|
||||
export function saveSigningForm(
|
||||
proof: SigningProof,
|
||||
expectedRevision: number,
|
||||
answers: Record<string, PatientAnswer>,
|
||||
): Promise<SigningFormState> {
|
||||
return request
|
||||
.post<ApiResponse<SigningFormState>>('/v1/sign-deliveries/token/form', {
|
||||
...proof,
|
||||
expectedRevision,
|
||||
answers,
|
||||
})
|
||||
.then(unwrapApiResponse)
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ export interface SigningContextField {
|
||||
* 这个接口要能**重复调用**(患者刷新、返回上一步都要能重进)。
|
||||
*/
|
||||
export interface SigningContextResponse {
|
||||
form?: SigningFormState | null
|
||||
taskId: string
|
||||
deliveryId?: string | null
|
||||
channel?: SignDeliveryChannel | null
|
||||
@@ -179,7 +180,27 @@ export interface SignatureUploadInput {
|
||||
name: string
|
||||
relation: string
|
||||
consentAccepted: true
|
||||
answerRevision?: number
|
||||
observedSignedAt: string
|
||||
}
|
||||
idempotencyKey: string
|
||||
}
|
||||
|
||||
export type PatientAnswer = string | string[] | boolean
|
||||
export interface SigningFormField {
|
||||
id: string
|
||||
label: string
|
||||
kind: string
|
||||
required: boolean
|
||||
multi: boolean
|
||||
options: string[]
|
||||
editable: boolean
|
||||
}
|
||||
export interface SigningFormState {
|
||||
contentHtml: string
|
||||
fields: SigningFormField[]
|
||||
answers: Record<string, PatientAnswer>
|
||||
staffAnswers: Record<string, string>
|
||||
revision: number
|
||||
editable: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user