import React, { useEffect, useState } from 'react'; import { Row, Col, Input, Select, Form } from 'antd'; import { RootState, useAppSelector, useAppDispatch } from '@/states/store'; import { FormattedMessage } from 'react-intl'; import { useDiagnosticData } from '@/hooks/useDiagnosticData'; import { updateReportField } from '@/states/patient/DiagnosticReport/slice'; import { PlusOutlined } from '@ant-design/icons'; import { DepartmentModal } from './DepartmentModal'; import { getDepartment } from '@/API/report/ReportActions'; import { setDepartments } from '@/states/patient/DiagnosticReport/departmentSlice'; import { getOption } from '@/API/system/options'; import { setOptionSex } from '@/states/system/optionSlice'; export const AnimalBaseInfo: React.FC = () => { const dispatch = useAppDispatch(); const [departmentOpen, setDepartmentOpen] = useState(false); // 报告信息 const [name, setName] = useDiagnosticData('headers.name'); const [sex, setSex] = useDiagnosticData('headers.sex'); const [age, setAge] = useDiagnosticData('headers.age'); const [ownerName, setOwnerName] = useDiagnosticData('headers.owner_name'); const [requestingDepartment, setRequestingDepartment] = useDiagnosticData( 'headers.requesting_department' ); const [inspectionNumber, setInspectionNumber] = useDiagnosticData( 'headers.inspection_number' ); const [inspectionMethod, setInspectionMethod] = useDiagnosticData( 'headers.inspection_method' ); const [radiologist, setRadiologist] = useDiagnosticData('radiologist'); const [reviewPhysician, setReviewPhysician] = useDiagnosticData('review_physician'); const reportInfo = useAppSelector((state) => state.diagnosticReport?.report); const selectedIds = useAppSelector( (s: RootState) => s.workSelection.selectedIds ); const productName = useAppSelector((s: RootState) => s.product.productName); const departments = useAppSelector( (state: RootState) => state.department.departments ); const optionSex = useAppSelector((state: RootState) => state.options.sex); console.log(`【诊断报告】:选中的study id :${selectedIds[0]}`); const getDepartmentData = async () => { const res = await getDepartment({}); if (res.code === '0x000000') { dispatch(setDepartments(res?.data?.departments || [])); } }; const getSexOption = async () => { const res = await getOption({ group: 'patient', flag: 'sex' }); if (res.code === '0x000000') { dispatch(setOptionSex(res?.data?.option || [])); } }; useEffect(() => { getDepartmentData(); getSexOption(); }, []); return ( <>