fix(sign): 补齐模板查询院区参数
This commit is contained in:
@@ -91,7 +91,7 @@ medical-sign/
|
|||||||
## 签署接口契约
|
## 签署接口契约
|
||||||
|
|
||||||
- 模板版本的 `formFields` 保存文书字段定义,`signatureFields` 单独保存患者签名在 PDF 中的页码、坐标、宽高和坐标系;编辑器中的坐标单位为 PDF point。发布模板前必须配置 `signature` 字段的位置。
|
- 模板版本的 `formFields` 保存文书字段定义,`signatureFields` 单独保存患者签名在 PDF 中的页码、坐标、宽高和坐标系;编辑器中的坐标单位为 PDF point。发布模板前必须配置 `signature` 字段的位置。
|
||||||
- `GET /api/v1/templates/available-versions` 返回 `formFields` 和 `needConfirm`。创建任务时将人工填写值放入 `staffAnswers`,并传入 `signerType`、`signerName`、`signerRelation`;患者、性别、年龄、就诊号和电话等已知字段仍由后端快照覆盖。
|
- `GET /api/v1/templates/available-versions` 必须传入当前选择的 `campusId`,并返回 `formFields` 和 `needConfirm`。创建任务时将人工填写值放入 `staffAnswers`,并传入 `signerType`、`signerName`、`signerRelation`;患者、性别、年龄、就诊号和电话等已知字段仍由后端快照覆盖。
|
||||||
- H5 先调用 `POST /api/v1/sign-deliveries/token/consume`,再用返回的 `taskId`、`deliveryId`、`uploadToken` 调用 `POST /api/v1/sign-deliveries/token/context`。上传使用 `POST /api/v1/sign-deliveries/{taskId}/signature` multipart,包含 `file`、`metadata` 和 `signer` JSON 部分,并复用 `Idempotency-Key` 安全重试。
|
- H5 先调用 `POST /api/v1/sign-deliveries/token/consume`,再用返回的 `taskId`、`deliveryId`、`uploadToken` 调用 `POST /api/v1/sign-deliveries/token/context`。上传使用 `POST /api/v1/sign-deliveries/{taskId}/signature` multipart,包含 `file`、`metadata` 和 `signer` JSON 部分,并复用 `Idempotency-Key` 安全重试。
|
||||||
- 患者签署后,任务可能处于 `GENERATING`、`WAITING_CONFIRM` 或 `SIGNED`。刷新结果页时 H5 使用只读 context 查询恢复服务端状态,不能将这些状态退回为可重复签署。
|
- 患者签署后,任务可能处于 `GENERATING`、`WAITING_CONFIRM` 或 `SIGNED`。刷新结果页时 H5 使用只读 context 查询恢复服务端状态,不能将这些状态退回为可重复签署。
|
||||||
|
|
||||||
|
|||||||
@@ -1146,12 +1146,10 @@ export async function getPatientProfile(keyword: string): Promise<PatientProfile
|
|||||||
return Promise.resolve(patient ? clonePatient(patient) : null)
|
return Promise.resolve(patient ? clonePatient(patient) : null)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getSigningTemplates(
|
export async function getSigningTemplates(query: {
|
||||||
query: {
|
campusId: string
|
||||||
campusId?: string
|
departmentId?: string
|
||||||
departmentId?: string
|
}): Promise<SigningTemplate[]> {
|
||||||
} = {},
|
|
||||||
): Promise<SigningTemplate[]> {
|
|
||||||
if (!useMockData) {
|
if (!useMockData) {
|
||||||
const response = await request.get<
|
const response = await request.get<
|
||||||
ApiResponseOf<
|
ApiResponseOf<
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ const {
|
|||||||
visits,
|
visits,
|
||||||
} = useSigningTaskForm({
|
} = useSigningTaskForm({
|
||||||
campus: computed(() => appStore.selectedCampus),
|
campus: computed(() => appStore.selectedCampus),
|
||||||
|
campusId: computed(() => appStore.selectedCampusId),
|
||||||
initialTemplate,
|
initialTemplate,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -165,6 +166,14 @@ watch(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await appStore.loadCampuses()
|
||||||
|
if (!appStore.selectedCampusId) {
|
||||||
|
ElMessage.error(
|
||||||
|
appStore.campusLoadFailed ? '院区加载失败,无法加载文书模板' : '当前没有可用院区',
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resetForm()
|
resetForm()
|
||||||
await loadTemplates()
|
await loadTemplates()
|
||||||
await nextTick()
|
await nextTick()
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import type {
|
|||||||
|
|
||||||
export interface UseSigningTaskFormOptions {
|
export interface UseSigningTaskFormOptions {
|
||||||
campus: MaybeRefOrGetter<WorkbenchCampus>
|
campus: MaybeRefOrGetter<WorkbenchCampus>
|
||||||
|
campusId: MaybeRefOrGetter<string>
|
||||||
initialTemplate?: MaybeRefOrGetter<SigningTemplate | null | undefined>
|
initialTemplate?: MaybeRefOrGetter<SigningTemplate | null | undefined>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +86,7 @@ export function useSigningTaskForm(options: UseSigningTaskFormOptions) {
|
|||||||
/** 左列选中的科室与分类(原型 ntDeptSel / ntCatSel) */
|
/** 左列选中的科室与分类(原型 ntDeptSel / ntCatSel) */
|
||||||
const selectedDepartment = ref('')
|
const selectedDepartment = ref('')
|
||||||
const selectedCategory = ref('')
|
const selectedCategory = ref('')
|
||||||
|
let loadedTemplateCampusId = ''
|
||||||
|
|
||||||
const errors = reactive({
|
const errors = reactive({
|
||||||
patient: '',
|
patient: '',
|
||||||
@@ -382,11 +384,26 @@ export function useSigningTaskForm(options: UseSigningTaskFormOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadTemplates() {
|
async function loadTemplates() {
|
||||||
if (!templates.value.length) {
|
const campusId = toValue(options.campusId)
|
||||||
|
if (!campusId) {
|
||||||
|
templates.value = []
|
||||||
|
loadedTemplateCampusId = ''
|
||||||
|
ElMessage.error('请先选择院区,再加载文书模板')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loadedTemplateCampusId !== campusId) {
|
||||||
|
if (loadedTemplateCampusId) {
|
||||||
|
selectedTemplateId.value = ''
|
||||||
|
selectedDepartment.value = ''
|
||||||
|
selectedCategory.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
loadingTemplates.value = true
|
loadingTemplates.value = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
templates.value = await getSigningTemplates()
|
templates.value = await getSigningTemplates({ campusId })
|
||||||
|
loadedTemplateCampusId = campusId
|
||||||
} catch {
|
} catch {
|
||||||
ElMessage.error('文档模板加载失败,请稍后重试')
|
ElMessage.error('文档模板加载失败,请稍后重试')
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -234,8 +234,14 @@ function syncFilterFromRoute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadTemplates() {
|
async function loadTemplates() {
|
||||||
|
const campusId = appStore.selectedCampusId
|
||||||
|
if (!campusId) {
|
||||||
|
templates.value = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
templates.value = await getSigningTemplates()
|
templates.value = await getSigningTemplates({ campusId })
|
||||||
} catch {
|
} catch {
|
||||||
ElMessage.error('文档模板加载失败,请稍后重试')
|
ElMessage.error('文档模板加载失败,请稍后重试')
|
||||||
}
|
}
|
||||||
@@ -1088,9 +1094,12 @@ watch(
|
|||||||
|
|
||||||
/** 切换全局院区:列表跟着换(院区不再是筛选条里的一个下拉,见 syncFilterFromRoute) */
|
/** 切换全局院区:列表跟着换(院区不再是筛选条里的一个下拉,见 syncFilterFromRoute) */
|
||||||
watch(
|
watch(
|
||||||
() => appStore.selectedCampus,
|
() => appStore.selectedCampusId,
|
||||||
() => {
|
(campusId, previousCampusId) => {
|
||||||
page.value = 1
|
page.value = 1
|
||||||
|
if (campusId && previousCampusId) {
|
||||||
|
void loadTemplates()
|
||||||
|
}
|
||||||
void loadTasks()
|
void loadTasks()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user