|
@@ -1,5 +1,5 @@
|
|
|
import React from 'react';
|
|
|
-import { Row, Col, Select, Segmented } from 'antd';
|
|
|
+import { Row, Col, Segmented, Select } from 'antd';
|
|
|
import { useSelector, useDispatch } from 'react-redux';
|
|
|
import { AppDispatch } from '@/states/store';
|
|
|
import { setCurrentPatientType } from '@/states/patientTypeSlice';
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
} from '@/states/patient/register/SelectionTypeSlice';
|
|
|
import { RootState } from '@/states/store';
|
|
|
import { PatientType } from '@/API/patientType';
|
|
|
-import { BodyPart } from '@/API/bodyPart';
|
|
|
-import { setCurrentBodyPart } from '@/states/bodyPartSlice';
|
|
|
+// import { BodyPart } from '@/API/bodyPart';
|
|
|
+// import { setCurrentBodyPart } from '@/states/bodyPartSlice';
|
|
|
import { fetchViewsOrProtocols } from '@/states/patient/viewSelection';
|
|
|
|
|
|
interface Props {
|
|
@@ -25,15 +25,15 @@ interface Props {
|
|
|
}
|
|
|
|
|
|
const RegisterAvailableFilterBar: React.FC<Props> = ({
|
|
|
+ // enabled,
|
|
|
setPatientType,
|
|
|
- enabled,
|
|
|
- setEnabled,
|
|
|
+ // setEnabled='',
|
|
|
}) => {
|
|
|
const dispatch = useDispatch<AppDispatch>();
|
|
|
const selected = useSelector((state: RootState) => state.selection.selected);
|
|
|
- const bodyParts = useSelector(
|
|
|
- (state: RootState) => state.bodyPart.byPatientType
|
|
|
- ); // [{ label, value }]
|
|
|
+ // const bodyParts = useSelector(
|
|
|
+ // (state: RootState) => state.bodyPart.byPatientType
|
|
|
+ // ); // [{ label, value }]
|
|
|
const currentPatientType = useSelector(
|
|
|
(state: RootState) => state.patientType.current
|
|
|
);
|
|
@@ -43,11 +43,11 @@ const RegisterAvailableFilterBar: React.FC<Props> = ({
|
|
|
const patientTypes = useSelector(
|
|
|
(state: RootState) => state.patientType.items
|
|
|
); // [{ label, value }]
|
|
|
- const enabledOptions = [
|
|
|
- { label: '全部', value: undefined },
|
|
|
- { label: '启用', value: 'enabled' },
|
|
|
- { label: '停用', value: 'disabled' },
|
|
|
- ];
|
|
|
+ // const enabledOptions = [
|
|
|
+ // { label: '全部', value: undefined },
|
|
|
+ // { label: '启用', value: 'enabled' },
|
|
|
+ // { label: '停用', value: 'disabled' },
|
|
|
+ // ];
|
|
|
|
|
|
return (
|
|
|
<div style={{ padding: 16, borderBottom: '1px solid #f0f0f0' }}>
|
|
@@ -76,53 +76,54 @@ const RegisterAvailableFilterBar: React.FC<Props> = ({
|
|
|
<Select
|
|
|
allowClear
|
|
|
style={{ width: '100%' }}
|
|
|
- placeholder="身体部位"
|
|
|
- options={bodyParts.map((item: BodyPart) => ({
|
|
|
- label: item.body_part_name,
|
|
|
- value: item.body_part_id,
|
|
|
+ placeholder="患者类型"
|
|
|
+ options={patientTypes.map((item: PatientType) => ({
|
|
|
+ label: item.patient_type_name,
|
|
|
+ value: item.patient_type_id,
|
|
|
}))}
|
|
|
- value={currentBodyPart?.body_part_id}
|
|
|
+ value={currentPatientType?.patient_type_id}
|
|
|
onChange={(val) => {
|
|
|
- const selectedBodyPart =
|
|
|
- bodyParts.find((item) => item.body_part_id == val) || null;
|
|
|
- dispatch(setCurrentBodyPart(selectedBodyPart));
|
|
|
+ setPatientType(val);
|
|
|
+ const selectedPatientType = patientTypes.find(
|
|
|
+ (item) => item.patient_type_id === val
|
|
|
+ );
|
|
|
+ dispatch(setCurrentPatientType(selectedPatientType || null));
|
|
|
dispatch(
|
|
|
fetchViewsOrProtocols({
|
|
|
selection: selected,
|
|
|
- patientType: currentPatientType?.patient_type_id ?? null,
|
|
|
- bodyPart: selectedBodyPart?.body_part_id ?? null,
|
|
|
+ patientType: selectedPatientType?.patient_type_id ?? null,
|
|
|
+ bodyPart: currentBodyPart?.body_part_id ?? null,
|
|
|
})
|
|
|
);
|
|
|
}}
|
|
|
- disabled={!currentPatientType}
|
|
|
/>
|
|
|
</Col>
|
|
|
- <Col xs={24} sm={12} md={6} lg={6} xl={6}>
|
|
|
+ {/* <Col xs={24} sm={12} md={6} lg={6} xl={6}>
|
|
|
<Select
|
|
|
allowClear
|
|
|
style={{ width: '100%' }}
|
|
|
- placeholder="患者类型"
|
|
|
- options={patientTypes.map((item: PatientType) => ({
|
|
|
- label: item.patient_type_name,
|
|
|
- value: item.patient_type_id,
|
|
|
+ placeholder="身体部位"
|
|
|
+ options={bodyParts.map((item: BodyPart) => ({
|
|
|
+ label: item.body_part_name,
|
|
|
+ value: item.body_part_id,
|
|
|
}))}
|
|
|
- value={currentPatientType?.patient_type_id}
|
|
|
+ value={currentBodyPart?.body_part_id}
|
|
|
onChange={(val) => {
|
|
|
- setPatientType(val);
|
|
|
- const selectedPatientType = patientTypes.find(
|
|
|
- (item) => item.patient_type_id === val
|
|
|
- );
|
|
|
- dispatch(setCurrentPatientType(selectedPatientType || null));
|
|
|
+ const selectedBodyPart =
|
|
|
+ bodyParts.find((item) => item.body_part_id == val) || null;
|
|
|
+ dispatch(setCurrentBodyPart(selectedBodyPart));
|
|
|
dispatch(
|
|
|
fetchViewsOrProtocols({
|
|
|
selection: selected,
|
|
|
- patientType: selectedPatientType?.patient_type_id ?? null,
|
|
|
- bodyPart: currentBodyPart?.body_part_id ?? null,
|
|
|
+ patientType: currentPatientType?.patient_type_id ?? null,
|
|
|
+ bodyPart: selectedBodyPart?.body_part_id ?? null,
|
|
|
})
|
|
|
);
|
|
|
}}
|
|
|
+ disabled={!currentPatientType}
|
|
|
/>
|
|
|
</Col>
|
|
|
+
|
|
|
<Col xs={24} sm={12} md={6} lg={6} xl={6}>
|
|
|
<Select
|
|
|
allowClear
|
|
@@ -132,7 +133,7 @@ const RegisterAvailableFilterBar: React.FC<Props> = ({
|
|
|
value={enabled}
|
|
|
onChange={setEnabled}
|
|
|
/>
|
|
|
- </Col>
|
|
|
+ </Col> */}
|
|
|
</Row>
|
|
|
</div>
|
|
|
);
|