提交
This commit is contained in:
1 parent
1ca2668112
commit
5b3edb1700
278 files changed
+53761
-36931
No files matched your search
@@ -0,0 +1,141 @@
|
||||
export type SampleReceptionSourceType = 'cell_storage' | 'research_donation'
|
||||
|
||||
export const SAMPLE_TYPE_PERINATAL_HSC = '围产期造血干细胞'
|
||||
export const SAMPLE_TYPE_UC_MSC = '脐带间充质干细胞'
|
||||
|
||||
export type ProductionReceptionFieldKey =
|
||||
| 'originalBloodWeightG'
|
||||
| 'hesVolumeMl'
|
||||
| 'bloodType'
|
||||
| 'infectiousFourTestResult'
|
||||
| 'enrichedBloodWeightG'
|
||||
| 'cryopreservationVolumeMl'
|
||||
| 'inoculationAmount'
|
||||
| 'cryopreservationTime'
|
||||
| 'storageTotalTubes'
|
||||
| 'availableCellCount1e7'
|
||||
| 'originalBloodVolumeMl'
|
||||
| 'nucleatedCellCount1e8'
|
||||
|
||||
export type ProductionReceptionFieldDef = {
|
||||
key: ProductionReceptionFieldKey
|
||||
label: string
|
||||
kind: 'number' | 'text' | 'datetime' | 'select' | 'integer'
|
||||
selectOptions?: Array<{ label: string; value: string }>
|
||||
}
|
||||
|
||||
const INFECTIOUS_OPTIONS = [
|
||||
{ label: '正常', value: 'zc' },
|
||||
{ label: '不正常', value: 'bzc' }
|
||||
]
|
||||
|
||||
const FIELD_DEFS: Record<ProductionReceptionFieldKey, ProductionReceptionFieldDef> = {
|
||||
originalBloodWeightG: { key: 'originalBloodWeightG', label: '原血重量/g', kind: 'number' },
|
||||
hesVolumeMl: { key: 'hesVolumeMl', label: 'HES用量/ml', kind: 'number' },
|
||||
bloodType: { key: 'bloodType', label: '血型', kind: 'text' },
|
||||
infectiousFourTestResult: {
|
||||
key: 'infectiousFourTestResult',
|
||||
label: '传染四项检测(检测卡)',
|
||||
kind: 'select',
|
||||
selectOptions: INFECTIOUS_OPTIONS
|
||||
},
|
||||
enrichedBloodWeightG: { key: 'enrichedBloodWeightG', label: '富集后血量/g', kind: 'number' },
|
||||
cryopreservationVolumeMl: {
|
||||
key: 'cryopreservationVolumeMl',
|
||||
label: '冻存液用量/ml',
|
||||
kind: 'number'
|
||||
},
|
||||
inoculationAmount: { key: 'inoculationAmount', label: '接种量', kind: 'number' },
|
||||
cryopreservationTime: { key: 'cryopreservationTime', label: '冻存时间', kind: 'datetime' },
|
||||
storageTotalTubes: { key: 'storageTotalTubes', label: '储存总量(管)', kind: 'integer' },
|
||||
availableCellCount1e7: {
|
||||
key: 'availableCellCount1e7',
|
||||
label: '可提供细胞数量/*10E7',
|
||||
kind: 'number'
|
||||
},
|
||||
originalBloodVolumeMl: { key: 'originalBloodVolumeMl', label: '原血体积/ml', kind: 'number' },
|
||||
nucleatedCellCount1e8: {
|
||||
key: 'nucleatedCellCount1e8',
|
||||
label: '有核细胞数/10E8',
|
||||
kind: 'number'
|
||||
}
|
||||
}
|
||||
|
||||
const PROFILE_KEYS: Record<string, ProductionReceptionFieldKey[]> = {
|
||||
'cell_storage|围产期造血干细胞': [
|
||||
'originalBloodWeightG',
|
||||
'hesVolumeMl',
|
||||
'bloodType',
|
||||
'infectiousFourTestResult',
|
||||
'enrichedBloodWeightG',
|
||||
'cryopreservationVolumeMl'
|
||||
],
|
||||
'cell_storage|脐带间充质干细胞': [
|
||||
'inoculationAmount',
|
||||
'cryopreservationTime',
|
||||
'storageTotalTubes',
|
||||
'availableCellCount1e7'
|
||||
],
|
||||
'research_donation|脐带间充质干细胞': ['inoculationAmount', 'cryopreservationTime'],
|
||||
'research_donation|围产期造血干细胞': ['originalBloodVolumeMl', 'nucleatedCellCount1e8']
|
||||
}
|
||||
|
||||
export function resolveProductionReceptionFields(
|
||||
sourceType: string,
|
||||
sampleTypeName: string
|
||||
): ProductionReceptionFieldDef[] {
|
||||
const key = `${sourceType === 'research_donation' ? 'research_donation' : 'cell_storage'}|${String(sampleTypeName || '').trim()}`
|
||||
const keys = PROFILE_KEYS[key] || []
|
||||
return keys.map((k) => FIELD_DEFS[k])
|
||||
}
|
||||
|
||||
export function infectiousFourTestLabel(value: string) {
|
||||
return INFECTIOUS_OPTIONS.find((o) => o.value === value)?.label || value || '—'
|
||||
}
|
||||
|
||||
export type ProductionReceptionRecord = {
|
||||
id?: string
|
||||
receptionId?: string
|
||||
handlerUserId?: string
|
||||
handlerName?: string
|
||||
processTime?: string
|
||||
originalBloodWeightG?: number
|
||||
hesVolumeMl?: number
|
||||
bloodType?: string
|
||||
infectiousFourTestResult?: string
|
||||
infectiousFourTestResultLabel?: string
|
||||
enrichedBloodWeightG?: number
|
||||
cryopreservationVolumeMl?: number
|
||||
inoculationAmount?: number
|
||||
cryopreservationTime?: string
|
||||
storageTotalTubes?: number
|
||||
availableCellCount1e7?: number
|
||||
originalBloodVolumeMl?: number
|
||||
nucleatedCellCount1e8?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export type QcReceptionRecord = {
|
||||
receptionTime?: string
|
||||
handlerName?: string
|
||||
receiveTemperature?: string
|
||||
acceptConclusion?: string
|
||||
acceptConclusionLabel?: string
|
||||
labStorageCode?: string
|
||||
checkResults?: Array<{ itemName?: string; checked?: boolean }>
|
||||
remark?: string
|
||||
receiveAttachmentFiles?: Array<Record<string, unknown>>
|
||||
}
|
||||
|
||||
export function formatProductionFieldValue(
|
||||
def: ProductionReceptionFieldDef,
|
||||
record: ProductionReceptionRecord | null | undefined
|
||||
) {
|
||||
if (!record) return '—'
|
||||
const raw = record[def.key as keyof ProductionReceptionRecord]
|
||||
if (raw === null || raw === undefined || raw === '') return '—'
|
||||
if (def.key === 'infectiousFourTestResult') {
|
||||
return infectiousFourTestLabel(String(raw))
|
||||
}
|
||||
return String(raw)
|
||||
}
|
||||
Reference in new issue
Block a user