| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- import type { OutboundQcDetail } from '@/api/qc-work-order'
- import type { ViewField, ViewSection } from '@/components/business/system-view-dialog/index.vue'
- import { maskIdCard } from '@/utils/mask-sensitive'
- import {
- applicationStatusLabel,
- applicationStatusTagType,
- infusionMethodLabel,
- infusionStatusLabel,
- infusionStatusTagType,
- qcStatusLabel,
- qcStatusTagType,
- scheduleStatusLabel,
- scheduleStatusTagType,
- sexLabel
- } from '@/utils/status-tag-registry'
- export type OutboundViewContextVariant = 'pilot_service' | 'clinical_application'
- const SECTION_TITLES: Record<
- OutboundViewContextVariant,
- { application: string; schedule: string }
- > = {
- pilot_service: {
- application: '中试服务申请单信息',
- schedule: '本次输注计划信息'
- },
- clinical_application: {
- application: '临床应用申请信息',
- schedule: '临床应用输注计划信息'
- }
- }
- /** 出库工单/质检:申请单 / 患者 / 输注方案 / 输注计划 / 产品明细(码值转中文标签) */
- export function buildOutboundPilotContextSections(
- detail: OutboundQcDetail,
- variant: OutboundViewContextVariant = 'pilot_service'
- ): ViewSection[] {
- const app = detail.application
- const patient = detail.patient
- const plan = detail.infusionPlan
- const schedule = detail.infusionSchedule
- const products = detail.products || []
- const titles = SECTION_TITLES[variant]
- const result: ViewSection[] = []
- if (app) {
- result.push({
- title: titles.application,
- fields: [
- { label: '申请单号', value: app.applicationNo || '—' },
- { label: '申请单名称', value: app.applicationName || '—' },
- {
- label: '申请单状态',
- value: applicationStatusLabel(app.applicationStatus || ''),
- tagType: applicationStatusTagType(app.applicationStatus || '') as ViewField['tagType']
- },
- { label: '渠道名称', value: app.channelName || '—' }
- ]
- })
- }
- if (patient) {
- result.push({
- title: '患者信息',
- fields: [
- { label: '患者姓名', value: patient.patientName || '—' },
- { label: '性别', value: sexLabel(String(patient.sex ?? '')) || '—' },
- { label: '年龄', value: patient.age || '—' },
- { label: '联系电话', value: patient.phoneNo || '—' },
- {
- label: '身份证号',
- value: patient.idCardNo ? maskIdCard(patient.idCardNo) : '—'
- },
- { label: '紧急联系人', value: patient.emergencyContact || '—' },
- { label: '紧急联系电话', value: patient.emergencyPhone || '—' },
- { label: '临床诊断', value: patient.clinicalDiagnosis || '—', span: true }
- ],
- slotTitle: '诊断附件',
- slotTitleStyle: 'field',
- slot: 'diagnosis-attachments'
- })
- }
- if (plan) {
- result.push({
- title: '输注方案信息',
- fields: [
- {
- label: '总疗程数',
- value: plan.totalCourseCount != null ? String(plan.totalCourseCount) : '—'
- },
- { label: '疗程间隔', value: plan.courseInterval || '—' },
- { label: '输注开始日期', value: plan.infusionStartDate || '—' }
- ]
- })
- }
- if (schedule) {
- const scheduleFields: ViewField[] = [
- { label: '输注时间', value: schedule.infusionTime || '—' },
- { label: '输注地点', value: schedule.infusionLocation || '—' },
- { label: '输注方式', value: infusionMethodLabel(schedule.infusionMethod || '') },
- {
- label: '计划状态',
- value: scheduleStatusLabel(schedule.scheduleStatus || ''),
- tagType: scheduleStatusTagType(schedule.scheduleStatus || '') as ViewField['tagType']
- },
- {
- label: '输注状态',
- value: infusionStatusLabel(schedule.infusionStatus || ''),
- tagType: infusionStatusTagType(schedule.infusionStatus || '') as ViewField['tagType']
- },
- {
- label: '质检状态',
- value: qcStatusLabel(schedule.qcStatus || ''),
- tagType: qcStatusTagType(schedule.qcStatus || '') as ViewField['tagType']
- }
- ]
- if (schedule.cancelReason) {
- scheduleFields.push({ label: '取消原因', value: schedule.cancelReason, span: true })
- }
- result.push({ title: titles.schedule, fields: scheduleFields })
- }
- if (products.length) {
- result.push({
- title: '产品明细',
- fields: [],
- slot: 'product-table'
- })
- }
- return result
- }
- export function isOutboundPilotServiceQcTask(d?: {
- qcBizType?: string
- receptionSource?: string
- } | null): boolean {
- return d?.qcBizType === 'outbound' && d?.receptionSource === 'pilot_service'
- }
|