feat(web-admin): 按采集大表导出预签约、自存、科研和客服表
市场人员需要把四张列表按采集大表对应工作表导出为 Excel 文本。补预签约列表的地区、医院、样本类型和转账时间,并沿用现有工具栏导出。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
faef6adf94
commit
a214a35f4f
9 files changed
+1118
-5
No files matched your search
@@ -0,0 +1,186 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import {
|
||||
CELL_STORAGE_HEADERS,
|
||||
CUSTOMER_SERVICE_HEADERS,
|
||||
PRESIGN_HEADERS,
|
||||
RESEARCH_HEADERS,
|
||||
buildCellStorageLedgerRows,
|
||||
buildCustomerServiceLedgerRows,
|
||||
buildPresignLedgerRows,
|
||||
buildResearchLedgerRows,
|
||||
formatLedgerDateTime
|
||||
} from './collection-ledger-export'
|
||||
import type { ProtocolAuditFlatRow } from './protocol-audit-flatten'
|
||||
|
||||
describe('formatLedgerDateTime', () => {
|
||||
it('uses Chinese text and keeps seconds', () => {
|
||||
assert.equal(formatLedgerDateTime('2026-04-02 16:49:42'), '2026年4月2日16时49分42秒')
|
||||
assert.equal(formatLedgerDateTime('20250907'), '2025年9月7日')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildPresignLedgerRows', () => {
|
||||
it('maps order fields into the presign sheet columns', () => {
|
||||
const [row] = buildPresignLedgerRows([
|
||||
{
|
||||
orderDate: '20260402',
|
||||
protocolNo: 'ZKZX1',
|
||||
motherName: '杨育蕾',
|
||||
sampleTypeNames: ['围产期造血干细胞'],
|
||||
regionName: '亳州区域',
|
||||
hospitalName: '涡阳县人民医院',
|
||||
payMode: 'dj',
|
||||
sampleCollectTime: '2026-04-02 16:49:42',
|
||||
contractAmount: 22880,
|
||||
confirmedDepositAmount: 1000,
|
||||
transferTimes: ['2026-04-02 16:49:42'],
|
||||
expectedDeliveryDate: '20260930',
|
||||
salesUserName: '张慧茹',
|
||||
regionManagerUserName: '张颖',
|
||||
remark: '已存'
|
||||
}
|
||||
])
|
||||
assert.equal(row.length, PRESIGN_HEADERS.length)
|
||||
assert.deepEqual(row.slice(0, 6), ['1', '2026', '4', '2', 'ZKZX1', '杨育蕾'])
|
||||
assert.equal(row[9], '趸交')
|
||||
assert.equal(row[12], '1000元')
|
||||
assert.equal(row[13], '2026年4月2日16时49分42秒')
|
||||
assert.equal(row[18], '')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildCellStorageLedgerRows', () => {
|
||||
it('places installment amounts and keeps template header width', () => {
|
||||
const flat = {
|
||||
protocolId: 'p1',
|
||||
protocol: {
|
||||
protocolStatus: 'sxz',
|
||||
remark: '分期备注',
|
||||
voidType: '',
|
||||
voidDesc: ''
|
||||
},
|
||||
sampleIndex: 0,
|
||||
isCoStored: false,
|
||||
sampleCollectTime: '2025-09-15 08:51:00',
|
||||
motherName: '郭梦朵',
|
||||
protocolNo: 'ZKZX34000849',
|
||||
sampleTypeName: '围产期造血干细胞',
|
||||
regionName: '亳州区域',
|
||||
hospitalName: '涡阳县人民医院',
|
||||
labStorageCode: 'B0000004',
|
||||
salesUserName: '马丽',
|
||||
regionManagerUserName: '张颖',
|
||||
transportType: 'kdys',
|
||||
paymentSummary: {
|
||||
payMode: 'fq',
|
||||
contractAmount: 22880,
|
||||
receivedAmount: 6480,
|
||||
pendingAmount: 16400,
|
||||
firstPayTransferTime: '2025-09-15 11:13:01',
|
||||
paymentDetails: [
|
||||
{
|
||||
installmentNo: 1,
|
||||
dueAmount: 6480,
|
||||
transferAmount: 6480,
|
||||
installmentDueDate: '20250915',
|
||||
transferTime: '2025-09-15 11:13:01'
|
||||
},
|
||||
{
|
||||
installmentNo: 2,
|
||||
dueAmount: 16400,
|
||||
transferAmount: 0,
|
||||
installmentDueDate: '20251215',
|
||||
transferTime: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
} as unknown as ProtocolAuditFlatRow
|
||||
const [row] = buildCellStorageLedgerRows([flat])
|
||||
assert.equal(row.length, CELL_STORAGE_HEADERS.length)
|
||||
assert.equal(CELL_STORAGE_HEADERS[13], '涡阳县人民医院')
|
||||
assert.equal(row[5], 'B0000004')
|
||||
assert.equal(row[6], '生效中')
|
||||
assert.equal(row[11], '否')
|
||||
assert.equal(row[13], '涡阳县人民医院')
|
||||
assert.equal(row[14], '分期')
|
||||
assert.equal(row[16], '22880')
|
||||
assert.equal(row[17], '6480')
|
||||
assert.equal(row[22], '2025年9月15日11时13分01秒')
|
||||
assert.equal(row[24], '16400')
|
||||
assert.equal(row[25], '16400')
|
||||
assert.equal(row[26], '2025年12月15日')
|
||||
assert.equal(row[50], '马丽')
|
||||
assert.equal(row[52], '快递运输')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildResearchLedgerRows', () => {
|
||||
it('maps donation fields and consent flag', () => {
|
||||
const flat = {
|
||||
protocol: {
|
||||
donationStatus: 'yzf',
|
||||
voidType: 'sysfq',
|
||||
voidDesc: '母血乙肝阳性',
|
||||
monthlyVerifyNo: '202508001'
|
||||
},
|
||||
sampleIndex: 0,
|
||||
sampleCollectTime: '2025-08-29 12:27:00',
|
||||
motherName: '曹陆双',
|
||||
sampleTypeName: '围产期造血干细胞',
|
||||
regionName: '亳州',
|
||||
hospitalName: '涡阳县人民医院',
|
||||
labStorageCode: 'A0000001',
|
||||
salesUserName: '杨莉莉',
|
||||
regionManagerUserName: '张颖',
|
||||
transportType: '',
|
||||
newbornDeliveryTime: '2025-08-29 12:26:00',
|
||||
newbornSex: '0',
|
||||
newbornWeightGram: 3000,
|
||||
deliveryMode: 'sc',
|
||||
birthOrder: 1,
|
||||
maternalBloodCollectTime: '2025-08-29 13:30:00',
|
||||
consentFormUrls: 'http://example/consent',
|
||||
remark: ''
|
||||
} as unknown as ProtocolAuditFlatRow
|
||||
const [row] = buildResearchLedgerRows([flat])
|
||||
assert.equal(row.length, RESEARCH_HEADERS.length)
|
||||
assert.equal(row[1], '2025年')
|
||||
assert.equal(row[4], '202508001')
|
||||
assert.equal(row[6], '已作废(实验室废弃)')
|
||||
assert.equal(row[7], '母血乙肝阳性')
|
||||
assert.equal(row[18], '女')
|
||||
assert.equal(row[19], '3000g')
|
||||
assert.equal(row[20], '顺产')
|
||||
assert.equal(row[23], '1')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildCustomerServiceLedgerRows', () => {
|
||||
it('keeps identity numbers as text columns', () => {
|
||||
const [row] = buildCustomerServiceLedgerRows([
|
||||
{
|
||||
labStorageCode: 'B0000002',
|
||||
protocolStatus: 'sxz',
|
||||
smsSendDate: '20250908',
|
||||
smsSendStatus: '已发',
|
||||
protocolNo: 'ZKZX34000852',
|
||||
motherName: '高居巧',
|
||||
motherPhone: '17860507206',
|
||||
motherIdCard: '370911199712254424',
|
||||
protocolAttachmentPresent: true,
|
||||
insuranceDocPresent: false,
|
||||
informedConsentPresent: true,
|
||||
healthSurveyPresent: true,
|
||||
payModeLabel: '趸交'
|
||||
}
|
||||
])
|
||||
assert.equal(row.length, CUSTOMER_SERVICE_HEADERS.length)
|
||||
assert.equal(row[0], 'B0000002')
|
||||
assert.equal(row[2], '1')
|
||||
assert.equal(row[5], 'ZKZX34000852')
|
||||
assert.equal(row[8], '370911199712254424')
|
||||
assert.equal(row[29], '1')
|
||||
assert.equal(row[30], '0')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user