| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- 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
- const currentTheme = useAppSelector((state) => state.theme.currentTheme);
- // 初始化报告数据
- 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 (
- <div
- className="flex flex-col h-full"
- style={{ backgroundColor: currentTheme.token.colorBgContainer }}
- >
- <ReportHeader />
- <ReportMain className="flex-1 overflow-scroll" />
- <ReportFooter reportData={reportData} />
- <PdfPreviewModal></PdfPreviewModal>
- </div>
- );
- };
- export default React.memo(DiagnosticReport);
|