Files
zkxw/web-admin/src/api/qc-work-order.ts
T
2026-07-07 11:10:48 +08:00

382 lines
9.7 KiB
TypeScript

import request from '@/utils/http'
import type { QcInspectionBatch } from '@/utils/qc-inspection-batch'
import type { QcWorkOrderTabKey } from '@/utils/qc-work-order-tabs'
type PageList<T> = {
list: T[]
total: number
page: number
pageSize: number
totalPages: number
}
export type SampleReceptionCheckResult = {
itemCode: string
itemName: string
checked: boolean
checkItemId?: string
}
export type QcProtocolPaymentDetailSummary = {
installmentNo?: number | null
installmentLabel?: string
installmentDueDate?: string
dueAmount?: number | null
transferAmount?: number | null
payStatus?: string
payStatusLabel?: string
}
export type QcProtocolSiblingSample = {
sampleCode: string
labStorageCode?: string
sampleTypeName?: string
}
export type QcProtocolPaymentSummary = {
payMode?: string
payModeLabel?: string
contractAmount?: number | null
receivedAmount?: number | null
pendingAmount?: number | null
statusHint?: string
overallPayStatus?: string
overallPayStatusLabel?: string
overallPayStatusTagType?: string
installmentCount?: number | null
paymentDetails?: QcProtocolPaymentDetailSummary[]
}
export type QcBasicExperimentFeeSummary = {
saleAmount?: number | null
paymentAmount?: number | null
transferAmount?: number | null
payStatus?: string
payStatusLabel?: string
}
export type QcWorkOrderReceptionDetail = {
protocolNo?: string
sampleCode?: string
sampleTypeName?: string
sourceType?: string
sourceTypeLabel?: string
receptionTime?: string
handlerName?: string
receiveTemperature?: string
volumeMl?: number
netWeightG?: number
acceptConclusion?: string
acceptConclusionLabel?: string
labStorageCode?: string
remark?: string
etaTime?: string
transportType?: string
expressCompanyName?: string
waybillNo?: string
carrierName?: string
carrierPhone?: string
checkResults?: SampleReceptionCheckResult[]
receiveAttachments?: string
receiveAttachmentFiles?: Array<{
id?: string
fileUrl?: string
fileName?: string
fileType?: string
fileSize?: number
fileSizeDisplay?: string
}>
}
export type QcWorkOrder = {
id: string
workOrderNo: string
workOrderType?: string
receptionId: string
protocolSampleId: string
collectionProtocolId: string
protocolNo: string
sampleCode: string
labStorageCode?: string
receptionSource?: string
receptionSourceLabel?: string
qcBizType?: string
qcBizTypeLabel?: string
cellProductId?: string
cellProductCode?: string
cellProductName?: string
cellProductTypeName?: string
cellProductPassage?: string
cellProductSpecName?: string
sampleTypeName?: string
isSpecial?: boolean
specialRemark?: string
receptionTime?: string
handlerName?: string
workOrderStatus: string
hasLab: boolean
hasThirdParty: boolean
configuredTime?: string
configuredBy?: string
configuredByName?: string
thirdPartyFeeTotal?: number
remark?: string
createTime?: string
updateTime?: string
bizType?: string
bizTypeLabel?: string
applicationNo?: string
applicationName?: string
projectTitle?: string
customerName?: string
channelName?: string
/** 出库工单:患者/用户姓名 */
patientName?: string
/** 入库工单(细胞存储/科研捐赠):母亲姓名 */
motherName?: string
/** 入库工单(细胞存储/科研捐赠):新生儿姓名 */
newbornName?: string
/** 出库工单:当前为第几次输注计划 */
sortNo?: number | null
/** 出库工单:输注计划总次数 */
totalCourseCount?: number | null
infusionTime?: string
/** 出库工单:输注计划细胞类型(列表 enrich,无产品明细时兜底) */
cellType?: string
/** 出库工单:输注计划规格(列表 enrich,无产品明细时兜底) */
specText?: string
/** 计划质检:输注计划关联细胞产品明细(列表 enrich) */
products?: OutboundQcDetailProduct[]
triggerSource?: string
triggerSourceLabel?: string
productionWorkOrderId?: string
productionWorkOrderNo?: string
productionTaskId?: string
productionStepOutputId?: string
protocolStatus?: string
protocolStatusLabel?: string
paymentSummary?: QcProtocolPaymentSummary | null
feeSummary?: QcBasicExperimentFeeSummary | null
/** 列表 enrich:未完成工单卡片角标数字(待配置=1,已配置=未完成任务数) */
unfinishedBadgeCount?: number
/** 列表 enrich:同协议下全部样本(标题栏「同协议样本」展示) */
protocolSiblingSamples?: QcProtocolSiblingSample[]
}
export type QcWorkOrderDetail = QcWorkOrder & {
reception?: QcWorkOrderReceptionDetail
labItems?: Array<{ id: string; labTestItemId: string; itemCode: string; itemName: string }>
thirdPartyItems?: Array<{
id: string
thirdPartyItemId: string
companyId: string
companyName: string
itemCode: string
itemName: string
feeAmount: number
}>
tasks?: Array<{
id: string
taskNo: string
taskType: string
itemCode?: string
itemName?: string
companyId?: string
companyName?: string
feeAmount?: number
taskStatus: string
conclusion?: string
conclusionLabel?: string
remark?: string
completedTime?: string
sourceLineId?: string
assigneeUserIds?: string[]
assigneeUserNames?: string
attachmentFiles?: Array<{ id?: string; fileUrl?: string; fileName?: string }>
}>
inspectionBatches?: QcInspectionBatch[]
}
export type QcWorkOrderTabUnfinishedCounts = Record<QcWorkOrderTabKey, number>
export function formatQcWorkOrderTabBadgeCount(count: number): string {
return count > 99 ? '99+' : String(count)
}
export function fetchQcWorkOrderTabUnfinishedCounts() {
return request.get<QcWorkOrderTabUnfinishedCounts>({
url: '/web/admin/qc-work-orders/tab-unfinished-counts'
})
}
export function fetchMineQcWorkOrderTabUnfinishedCounts() {
return request.get<QcWorkOrderTabUnfinishedCounts>({
url: '/web/admin/qc-work-orders/mine-tab-unfinished-counts'
})
}
export function fetchQcWorkOrdersBySample(params: { sampleCode: string; receptionSource: string }) {
return request.get<{ list: QcWorkOrder[] }>({
url: '/web/admin/qc-work-orders/by-sample',
params
})
}
export function fetchQcWorkOrderList(params?: {
page?: number
pageSize?: number
keyword?: string
workOrderStatus?: string
workOrderType?: string
bizType?: string
receptionSource?: string
createTimeStart?: string
createTimeEnd?: string
infusionTimeStart?: string
infusionTimeEnd?: string
triggerSource?: string
sampleTypeId?: string
}) {
return request.get<PageList<QcWorkOrder>>({
url: '/web/admin/qc-work-orders',
params
})
}
export function fetchQcWorkOrderDetail(id: string) {
return request.get<QcWorkOrderDetail>({
url: `/web/admin/qc-work-orders/${id}`
})
}
export function fetchConfigureQcWorkOrder(
id: string,
data: {
batches?: Array<{
id?: string
batchName?: string
assigneeUserIds: string[]
hasLab: boolean
hasThirdParty: boolean
labItemIds: string[]
thirdPartyItemIds: string[]
}>
hasLab?: boolean
hasThirdParty?: boolean
labItemIds?: string[]
thirdPartyItemIds?: string[]
labItemAssignees?: Record<string, string[]>
thirdPartyItemAssignees?: Record<string, string[]>
}
) {
return request.post<QcWorkOrder>({
url: `/web/admin/qc-work-orders/${id}/configure`,
data
})
}
export function fetchCreateQcWorkOrder(data: {
workOrderType?: string
protocolNo?: string
sampleCode?: string
receptionSource?: string
qcBizType?: string
cellProductId?: string
remark?: string
}) {
return request.post<QcWorkOrder>({
url: '/web/admin/qc-work-orders',
data
})
}
export function fetchUpdateQcWorkOrder(
id: string,
data: { cellProductId?: string; workOrderStatus?: string; remark?: string }
) {
return request.put<QcWorkOrder>({
url: `/web/admin/qc-work-orders/${id}`,
data
})
}
export function fetchDeleteQcWorkOrder(id: string) {
return request.del({ url: `/web/admin/qc-work-orders/${id}` })
}
export type OutboundQcDetailApplication = {
applicationNo?: string
applicationName?: string
applicationStatus?: string
channelName?: string
bizType?: string
bizTypeLabel?: string
projectTitle?: string
customerName?: string
customerContact?: string
customerPhone?: string
}
export type OutboundQcDetailPatient = {
patientName?: string
sex?: string
age?: string
phoneNo?: string
idCardNo?: string
emergencyContact?: string
emergencyPhone?: string
clinicalDiagnosis?: string
diagnosisAttachments?: string
}
export type OutboundQcDetailInfusionPlan = {
cellType?: string
specText?: string
totalCourseCount?: number
courseInterval?: string
infusionRoute?: string
infusionStartDate?: string
}
export type OutboundQcDetailInfusionSchedule = {
infusionTime?: string
infusionLocation?: string
infusionMethod?: string
cellType?: string
specText?: string
scheduleStatus?: string
infusionStatus?: string
qcStatus?: string
cancelReason?: string
amount?: number
}
export type OutboundQcDetailProduct = {
projectCode?: string
projectName?: string
cellTypeName?: string
specText?: string
agreementPrice?: number
actualPrice?: number
quantity?: number
productStatus?: string
}
export type OutboundQcDetail = {
workOrder: QcWorkOrderDetail
feeSummary?: QcBasicExperimentFeeSummary | null
application?: OutboundQcDetailApplication
patient?: OutboundQcDetailPatient
infusionPlan?: OutboundQcDetailInfusionPlan
infusionSchedule?: OutboundQcDetailInfusionSchedule
products?: OutboundQcDetailProduct[]
tasks?: QcWorkOrderDetail['tasks']
inspectionBatches?: QcInspectionBatch[]
}
export function fetchOutboundQcDetail(id: string) {
return request.get<OutboundQcDetail>({
url: `/web/admin/qc-work-orders/${id}/outbound-detail`
})
}