index.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from 'react';
  2. import { useAppDispatch, useAppSelector } from '@/states/store';
  3. import { ReportHeader } from './components/ReportHeader';
  4. import { ReportMain } from './components/ReportMain';
  5. import { ReportFooter } from './components/ReportFooter';
  6. import PdfPreviewModal from '@/states/patient/DiagnosticReport/PdfPreviewModal';
  7. import { updateField } from '@/states/patient/DiagnosticReport/baseInfoSlice';
  8. const DiagnosticReport: React.FC = () => {
  9. const dispatch = useAppDispatch();
  10. const currentWork = useAppSelector((state) => state.diagnosticReport.currentWork);
  11. const reportData = {}; // Define reportData here or fetch it from state or props
  12. // 初始化报告数据
  13. React.useEffect(() => {
  14. if (currentWork) {
  15. // 初始化 baseInfo slice
  16. dispatch(updateField({ key: 'studyId', value: currentWork.StudyID }));
  17. dispatch(updateField({ key: 'patientName', value: currentWork.PatientName || currentWork.DisplayPatientName }));
  18. dispatch(updateField({ key: 'patientNo', value: currentWork.PatientID }));
  19. dispatch(updateField({ key: 'examTime', value: currentWork.StudyStartDatetime || '' }));
  20. dispatch(updateField({ key: 'examDesc', value: currentWork.StudyDescription }));
  21. dispatch(updateField({ key: 'age', value: currentWork.PatientAge }));
  22. dispatch(updateField({ key: 'gender', value: currentWork.PatientSex === 'M' ? '男' : '女' }));
  23. // 暂时注释掉没有的字段,后续根据实际需要添加
  24. // dispatch(updateField({ key: 'department', value: currentWork.department || '' }));
  25. // dispatch(updateField({ key: 'examPosition', value: currentWork.body_part || '' }));
  26. // 初始化动物信息(如果适用)
  27. if (currentWork.owner_name) {
  28. // 这里可以添加动物信息的初始化
  29. }
  30. }
  31. }, [currentWork, dispatch]);
  32. return (
  33. <div className="flex flex-col h-full">
  34. <ReportHeader />
  35. <ReportMain className="flex-1 overflow-scroll" />
  36. <ReportFooter reportData={reportData} />
  37. <PdfPreviewModal></PdfPreviewModal>
  38. </div>
  39. );
  40. };
  41. export default DiagnosticReport;