|
|
@@ -1,84 +1,63 @@
|
|
|
-import React from 'react';
|
|
|
-import { Row, Col, Input, Select, DatePicker, Button, Form } from 'antd';
|
|
|
-import { RootState, useAppDispatch } from '@/states/store';
|
|
|
-import {
|
|
|
- updateField,
|
|
|
- updateDropdown,
|
|
|
- BaseInfoState,
|
|
|
-} from '@/states/patient/DiagnosticReport/baseInfoSlice';
|
|
|
-import dayjs from 'dayjs';
|
|
|
-import { useSelector } from 'react-redux';
|
|
|
-import { useEffect } from 'react';
|
|
|
-import { Task } from '@/domain/work';
|
|
|
-
|
|
|
-const { Option } = Select;
|
|
|
-
|
|
|
+import React, { useEffect, useState } from 'react';
|
|
|
+import { Row, Col, Input, Select, Form } from 'antd';
|
|
|
+import { useDiagnosticData } from '@/hooks/useDiagnosticData';
|
|
|
+import Space from 'antd/lib/space';
|
|
|
+import { PlusOutlined } from '@ant-design/icons';
|
|
|
+import { DepartmentModal } from './DepartmentModal';
|
|
|
+import { getDepartment } from '@/API/report/ReportActions';
|
|
|
+import { RootState, useAppSelector, useAppDispatch } from '@/states/store';
|
|
|
+import { setDepartments } from '@/states/patient/DiagnosticReport/departmentSlice';
|
|
|
+import { getOption } from '@/API/system/options';
|
|
|
+import { setOptionSex } from '@/states/system/optionSlice';
|
|
|
export const BaseInfo: React.FC = () => {
|
|
|
- const data = useSelector((s: RootState) => s.baseInfo);
|
|
|
+ const [departmentOpen, setDepartmentOpen] = useState(false);
|
|
|
+ const [name, setName] = useDiagnosticData<string>('headers.name');
|
|
|
+ const [sex, setSex] = useDiagnosticData<string>('headers.sex');
|
|
|
+ const [age, setAge] = useDiagnosticData<string>('headers.age');
|
|
|
+ const [medical_record_number, setMedicalrecordnumber] = useDiagnosticData<string>('headers.medical_record_number');
|
|
|
+ const [hospitalization_number, setHospitalizationNumber] = useDiagnosticData<string>('headers.hospitalization_number');
|
|
|
+ const [requesting_department, setRequestingDepartment] = useDiagnosticData<string>('headers.requesting_department');
|
|
|
+ const [bed_number, setBedNumber] = useDiagnosticData<string>('headers.bed_number');
|
|
|
+ const [inspection_number, setInspectionNumber] = useDiagnosticData<string>('headers.inspection_number');
|
|
|
+ const [inspection_method, setInspectionMethod] = useDiagnosticData<string>('headers.inspection_method');
|
|
|
+ const [radiologist, setRadiologist] = useDiagnosticData<string>('radiologist');
|
|
|
+ const [reviewPhysician, setReviewPhysician] = useDiagnosticData<string>('review_physician');
|
|
|
const dispatch = useAppDispatch();
|
|
|
- const selectedIds = useSelector(
|
|
|
- (s: RootState) => s.workSelection.selectedIds
|
|
|
- );
|
|
|
- const workEntities = useSelector((s: RootState) => s.workEntities.data);
|
|
|
- console.log(`【诊断报告】:选中的study id :${selectedIds[0]}`);
|
|
|
- const selectedStudy: Task | null =
|
|
|
- selectedIds.length > 0
|
|
|
- ? (workEntities.find((t) => t.StudyID === selectedIds[0]) ?? null)
|
|
|
- : null;
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- console.log(
|
|
|
- `【诊断报告】:selectedStudy是空吗?${selectedStudy === null} ${selectedStudy}`
|
|
|
- );
|
|
|
- if (selectedStudy) {
|
|
|
- dispatch(
|
|
|
- updateField({ key: 'patientName', value: selectedStudy.PatientName })
|
|
|
- );
|
|
|
- dispatch(
|
|
|
- updateField({ key: 'englishName', value: selectedStudy.PatientName })
|
|
|
- );
|
|
|
- dispatch(
|
|
|
- updateField({ key: 'patientNo', value: selectedStudy.PatientID })
|
|
|
- );
|
|
|
- dispatch(updateField({ key: 'gender', value: selectedStudy.PatientSex }));
|
|
|
- dispatch(updateField({ key: 'age', value: selectedStudy.PatientAge }));
|
|
|
- // dispatch(updateField({ key: 'visitType', value: selectedStudy.visitType }));// 就诊类型
|
|
|
- // dispatch(updateField({ key: 'clinicNo', value: selectedStudy.clinicNo }));
|
|
|
- // dispatch(updateField({ key: 'department', value: selectedStudy.department }));//科室
|
|
|
- dispatch(
|
|
|
- updateField({
|
|
|
- key: 'examTime',
|
|
|
- value: selectedStudy.StudyStartDatetime,
|
|
|
- })
|
|
|
- );
|
|
|
- dispatch(updateField({ key: 'studyId', value: selectedStudy.StudyID }));
|
|
|
- // dispatch(updateField({ key: 'bodyPart', value: selectedStudy. }));
|
|
|
- // dispatch(updateField({ key: 'examDesc', value: selectedStudy.examDesc }));
|
|
|
- // dispatch(updateField({ key: 'examPosition', value: selectedStudy.examPosition }));
|
|
|
- // dispatch(updateField({ key: 'clinicalDiag', value: selectedStudy.clinicalDiag }));
|
|
|
+ const departments = useAppSelector((state: RootState) => state.department.departments);
|
|
|
+ const optionSex = useAppSelector((state: RootState) => state.options.sex);
|
|
|
+ const getDepartmentData = async () => {
|
|
|
+ const res = await getDepartment({});
|
|
|
+ if (res.code === '0x000000') {
|
|
|
+ dispatch(setDepartments(res?.data?.departments || []));
|
|
|
}
|
|
|
- }, [selectedIds]);
|
|
|
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
- const onChange = (key: keyof BaseInfoState, val: any) => {
|
|
|
- dispatch(updateField({ key, value: val }));
|
|
|
};
|
|
|
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
- const onDropdownChange = (key: keyof BaseInfoState, val: any) => {
|
|
|
- dispatch(updateDropdown({ key, value: val }));
|
|
|
+
|
|
|
+ const getSexOption = async () => {
|
|
|
+ const res = await getOption({ group: 'patient', flag: 'sex' });
|
|
|
+ if (res.code === '0x000000') {
|
|
|
+ dispatch(setOptionSex(res?.data?.option || []));
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ getDepartmentData();
|
|
|
+ getSexOption();
|
|
|
+ }, []);
|
|
|
+
|
|
|
return (
|
|
|
- <Form layout="vertical">
|
|
|
- <Row gutter={12}>
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="患者姓名">
|
|
|
- <Input
|
|
|
- value={data.patientName}
|
|
|
- onChange={(e) => onChange('patientName', e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
+ <>
|
|
|
+ <Form layout="vertical">
|
|
|
+ <Row gutter={12}>
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="患者姓名">
|
|
|
+ <Input
|
|
|
+ disabled
|
|
|
+ value={name}
|
|
|
+ onChange={(e) => setName(e.target.value)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ {/* <Col span={6}>
|
|
|
<Form.Item label="曾用名">
|
|
|
<Input
|
|
|
value={data.usedName}
|
|
|
@@ -93,34 +72,37 @@ export const BaseInfo: React.FC = () => {
|
|
|
onChange={(e) => onChange('englishName', e.target.value)}
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="患者编号">
|
|
|
- <Input disabled value={data.patientNo} />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
-
|
|
|
- <Col span={4}>
|
|
|
- <Form.Item label="性别">
|
|
|
- <Select
|
|
|
- value={data.gender}
|
|
|
- onChange={(v) => onDropdownChange('gender', v)}
|
|
|
- >
|
|
|
- <Option value="男">男</Option>
|
|
|
- <Option value="女">女</Option>
|
|
|
- </Select>
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={4}>
|
|
|
- <Form.Item label="年龄">
|
|
|
- <Input
|
|
|
- addonAfter="Y"
|
|
|
- value={data.age}
|
|
|
- onChange={(e) => onChange('age', e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
+ </Col> */}
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="患者编号">
|
|
|
+ <Input
|
|
|
+ disabled
|
|
|
+ value={medical_record_number}
|
|
|
+ onChange={(e) => setMedicalrecordnumber(e.target.value)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="性别">
|
|
|
+ <Select
|
|
|
+ value={sex}
|
|
|
+ disabled
|
|
|
+ fieldNames={{ label: 'text' }}
|
|
|
+ onChange={(v) => setSex(v)}
|
|
|
+ options={optionSex}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="年龄">
|
|
|
+ <Input
|
|
|
+ disabled
|
|
|
+ value={age}
|
|
|
+ onChange={(e) => setAge(e.target.value)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ {/* <Col span={6}>
|
|
|
<Form.Item label="就诊类型">
|
|
|
<Row gutter={4}>
|
|
|
<Col flex="auto">
|
|
|
@@ -138,111 +120,83 @@ export const BaseInfo: React.FC = () => {
|
|
|
</Col>
|
|
|
</Row>
|
|
|
</Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="门诊/住院号">
|
|
|
- <Input
|
|
|
- value={data.clinicNo}
|
|
|
- onChange={(e) => onChange('clinicNo', e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="科室">
|
|
|
- <Row gutter={4}>
|
|
|
- <Col flex="auto">
|
|
|
- <Select
|
|
|
- value={data.department}
|
|
|
- onChange={(v) => onDropdownChange('department', v)}
|
|
|
- >
|
|
|
- <Option value="内科">内科</Option>
|
|
|
- <Option value="外科">外科</Option>
|
|
|
- </Select>
|
|
|
- </Col>
|
|
|
- <Col>
|
|
|
- <Button>...</Button>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
-
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="检查时间">
|
|
|
- <DatePicker
|
|
|
- className="w-full"
|
|
|
- value={data.examTime ? dayjs(data.examTime) : null}
|
|
|
- onChange={(d) =>
|
|
|
- onChange('examTime', d?.format('YYYY-MM-DD') || '')
|
|
|
- }
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="身体部位">
|
|
|
- <Select
|
|
|
- value={data.bodyPart}
|
|
|
- onChange={(v) => onDropdownChange('bodyPart', v)}
|
|
|
- >
|
|
|
- <Option value="腹部">腹部</Option>
|
|
|
- <Option value="胸部">胸部</Option>
|
|
|
- <Option value="头部">头部</Option>
|
|
|
- </Select>
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="检查描述">
|
|
|
- <Input
|
|
|
- value={data.examDesc}
|
|
|
- onChange={(e) => onChange('examDesc', e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="检查部位">
|
|
|
- <Input
|
|
|
- value={data.examPosition}
|
|
|
- onChange={(e) => onChange('examPosition', e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
-
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="放射科医生">
|
|
|
- <Input
|
|
|
- value={data.radiologist}
|
|
|
- onChange={(e) => onChange('radiologist', e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
-
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="审核医师">
|
|
|
- <Input
|
|
|
- value={data.reviewPhysician}
|
|
|
- onChange={(e) => onChange('reviewPhysician', e.target.value)}
|
|
|
+ </Col> */}
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="门诊/住院号">
|
|
|
+ <Input
|
|
|
+ value={hospitalization_number}
|
|
|
+ onChange={(e) => setHospitalizationNumber(e.target.value)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="床号">
|
|
|
+ <Input
|
|
|
+ value={bed_number}
|
|
|
+ onChange={(e) => setBedNumber(e.target.value)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="检查号">
|
|
|
+ <Input
|
|
|
+ value={inspection_number}
|
|
|
+ onChange={(e) => setInspectionNumber(e.target.value)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="检查方法">
|
|
|
+ <Input
|
|
|
+ value={inspection_method}
|
|
|
+ onChange={(e) => setInspectionMethod(e.target.value)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="申请科室">
|
|
|
+ <Select
|
|
|
+ style={{ width: '90%' }}
|
|
|
+ value={requesting_department}
|
|
|
+ fieldNames={{ label: 'department', value: 'department' }}
|
|
|
+ onChange={(v) => setRequestingDepartment(`${v}`)}
|
|
|
+ options={departments}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ <PlusOutlined
|
|
|
+ style={{
|
|
|
+ position: 'absolute',
|
|
|
+ top: '40px',
|
|
|
+ right: '10px',
|
|
|
+ cursor: 'pointer',
|
|
|
+ transition: 'all 0.3s',
|
|
|
+ }}
|
|
|
+ onClick={() => setDepartmentOpen(true)}
|
|
|
/>
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
+ </Col>
|
|
|
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="临床诊断">
|
|
|
- <Row gutter={4}>
|
|
|
- <Col flex="auto">
|
|
|
- <Select
|
|
|
- value={data.clinicalDiag}
|
|
|
- onChange={(v) => onDropdownChange('clinicalDiag', v)}
|
|
|
- >
|
|
|
- <Option value="肺炎">肺炎</Option>
|
|
|
- <Option value="肝炎">肝炎</Option>
|
|
|
- </Select>
|
|
|
- </Col>
|
|
|
- <Col>
|
|
|
- <Button>...</Button>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- </Form>
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="放射科医生">
|
|
|
+ <Input
|
|
|
+ value={radiologist}
|
|
|
+ onChange={(e) => setRadiologist(e.target.value)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={6}>
|
|
|
+ <Form.Item label="审核医师">
|
|
|
+ <Input
|
|
|
+ value={reviewPhysician}
|
|
|
+ onChange={(e) => setReviewPhysician(e.target.value)}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Form>
|
|
|
+ <DepartmentModal
|
|
|
+ visible={departmentOpen}
|
|
|
+ onClose={() => setDepartmentOpen(false)}
|
|
|
+ />
|
|
|
+ </>
|
|
|
);
|
|
|
};
|