提交
This commit is contained in:
1 parent
f90726927e
commit
6eea13370c
103 files changed
+38401
-32231
No files matched your search
@@ -0,0 +1,26 @@
|
||||
export type ProtocolSourceAttachmentMeta = {
|
||||
label: string
|
||||
files: Array<Record<string, unknown>>
|
||||
}
|
||||
|
||||
function normalizeAttachmentFiles(raw: unknown): Array<Record<string, unknown>> {
|
||||
if (!Array.isArray(raw)) return []
|
||||
return raw.filter((item) => item && typeof item === 'object') as Array<Record<string, unknown>>
|
||||
}
|
||||
|
||||
/** 按来源返回协议级附件标签与文件列表(细胞存储=孕妇健康调查表,科研捐赠=传染病检测报告) */
|
||||
export function getSourceProtocolAttachment(
|
||||
row: Record<string, unknown>
|
||||
): ProtocolSourceAttachmentMeta {
|
||||
const source = String(row.sourceType || 'cell_storage').trim()
|
||||
if (source === 'research_donation') {
|
||||
return {
|
||||
label: '传染病检测报告',
|
||||
files: normalizeAttachmentFiles(row.infectiousDiseaseReportAttachmentFiles)
|
||||
}
|
||||
}
|
||||
return {
|
||||
label: '孕妇健康调查表',
|
||||
files: normalizeAttachmentFiles(row.healthSurveyAttachmentFiles)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user