import React from 'react'; import { useAppDispatch, useAppSelector } from '@/states/store'; import { ReportHeader } from './components/ReportHeader'; import { ReportMain } from './components/ReportMain'; import { ReportFooter } from './components/ReportFooter'; import PdfPreviewModal from '@/states/patient/DiagnosticReport/PdfPreviewModal'; import { updateField } from '@/states/patient/DiagnosticReport/baseInfoSlice'; const DiagnosticReport: React.FC = () => { const dispatch = useAppDispatch(); const currentWork = useAppSelector((state) => state.diagnosticReport.currentWork); const reportData = {}; // Define reportData here or fetch it from state or props // 初始化报告数据 React.useEffect(() => { if (currentWork) { // 初始化 baseInfo slice dispatch(updateField({ key: 'studyId', value: currentWork.StudyID })); dispatch(updateField({ key: 'patientName', value: currentWork.PatientName || currentWork.DisplayPatientName })); dispatch(updateField({ key: 'patientNo', value: currentWork.PatientID })); dispatch(updateField({ key: 'examTime', value: currentWork.StudyStartDatetime || '' })); dispatch(updateField({ key: 'examDesc', value: currentWork.StudyDescription })); dispatch(updateField({ key: 'age', value: currentWork.PatientAge })); dispatch(updateField({ key: 'gender', value: currentWork.PatientSex === 'M' ? '男' : '女' })); // 暂时注释掉没有的字段,后续根据实际需要添加 // dispatch(updateField({ key: 'department', value: currentWork.department || '' })); // dispatch(updateField({ key: 'examPosition', value: currentWork.body_part || '' })); // 初始化动物信息(如果适用) if (currentWork.owner_name) { // 这里可以添加动物信息的初始化 } } }, [currentWork, dispatch]); return (