|
|
@@ -1,21 +1,16 @@
|
|
|
-import React, { useState } 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';
|
|
|
+import React, { useEffect, useState } from 'react';
|
|
|
+import { Row, Col, Input, Select, Form } from 'antd';
|
|
|
import { useDiagnosticData } from '@/hooks/useDiagnosticData';
|
|
|
-
|
|
|
-const { Option } = Select;
|
|
|
-
|
|
|
+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');
|
|
|
@@ -27,69 +22,42 @@ export const BaseInfo: React.FC = () => {
|
|
|
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={name} onChange={(e) => setName(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}
|
|
|
@@ -105,32 +73,36 @@ export const BaseInfo: React.FC = () => {
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
</Col> */}
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="患者编号">
|
|
|
- <Input
|
|
|
- value={medical_record_number}
|
|
|
- onChange={(e) => setMedicalrecordnumber(e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="性别">
|
|
|
- <Select value={sex} onChange={(v) => setSex(v)}>
|
|
|
- <Option value="男">男</Option>
|
|
|
- <Option value="女">女</Option>
|
|
|
- </Select>
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <Form.Item label="年龄">
|
|
|
- <Input
|
|
|
- addonAfter="Y"
|
|
|
- value={age}
|
|
|
- onChange={(e) => setAge(e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- {/* <Col span={6}>
|
|
|
+ <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">
|
|
|
@@ -149,79 +121,82 @@ export const BaseInfo: React.FC = () => {
|
|
|
</Row>
|
|
|
</Form.Item>
|
|
|
</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)}
|
|
|
+ <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 span={6}>
|
|
|
- <Form.Item label="申请科室">
|
|
|
- <Input
|
|
|
- value={requesting_department}
|
|
|
- onChange={(e) => setRequestingDepartment(e.target.value)}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- {/* <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>
|
|
|
- </Row>
|
|
|
- </Form.Item> */}
|
|
|
- </Col>
|
|
|
+ </Col>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- <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>
|
|
|
+ <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)}
|
|
|
+ />
|
|
|
+ </>
|
|
|
);
|
|
|
};
|