|
@@ -2,9 +2,11 @@ import React, { useState } from 'react';
|
|
|
import HumanBody from '@/components/HumanBody';
|
|
|
import AnimalBody from '@/components/AnimalBody';
|
|
|
import RegisterAvailableFilterBar from './RegisterAvailableFilterBar';
|
|
|
-import { useSelector } from 'react-redux';
|
|
|
-import { RootState } from '@/states/store';
|
|
|
+import { useDispatch, useSelector } from 'react-redux';
|
|
|
+import { AppDispatch, RootState } from '@/states/store';
|
|
|
import { Flex, message } from 'antd';
|
|
|
+import { setCurrentBodyPart } from '@/states/bodyPartSlice';
|
|
|
+import { fetchViewsOrProtocols } from '@/states/patient/viewSelection';
|
|
|
|
|
|
const BodyPositionFilter: React.FC = () => {
|
|
|
const selected = useSelector(
|
|
@@ -16,6 +18,17 @@ const BodyPositionFilter: React.FC = () => {
|
|
|
const productName = useSelector(
|
|
|
(state: RootState) => state.product.productName
|
|
|
);
|
|
|
+ const bodyPartsState = useSelector(
|
|
|
+ (state: RootState) => state.bodyPart.byPatientType
|
|
|
+ );
|
|
|
+ const dispatch = useDispatch<AppDispatch>();
|
|
|
+ //选择的是体位还是协议
|
|
|
+ const selectedViewOrProtocol = useSelector(
|
|
|
+ (state: RootState) => state.selection.selected
|
|
|
+ );
|
|
|
+ const currentPatientType = useSelector(
|
|
|
+ (state: RootState) => state.patientType.current
|
|
|
+ );
|
|
|
return (
|
|
|
<Flex vertical style={{ height: '100%' }} className="w-full">
|
|
|
{/* 过滤区域 */}
|
|
@@ -47,6 +60,22 @@ const BodyPositionFilter: React.FC = () => {
|
|
|
<AnimalBody
|
|
|
onPathClick={(area) => {
|
|
|
message.info(area);
|
|
|
+ // setActivePart(part);
|
|
|
+ // 映射表。界面上身体部位与服务定义的身体部位有个映射
|
|
|
+ const selectedBodyPartId = area;
|
|
|
+ const selectedBodyPart =
|
|
|
+ bodyPartsState.find(
|
|
|
+ (item) => item.body_part_id == selectedBodyPartId
|
|
|
+ ) || null;
|
|
|
+ dispatch(setCurrentBodyPart(selectedBodyPart));
|
|
|
+ // message.info(`得到对应的身体部位的ID:${selectedBodyPartId}`);
|
|
|
+ dispatch(
|
|
|
+ fetchViewsOrProtocols({
|
|
|
+ selection: selectedViewOrProtocol,
|
|
|
+ patientType: currentPatientType?.patient_type_id ?? null,
|
|
|
+ bodyPart: selectedBodyPartId ?? null,
|
|
|
+ })
|
|
|
+ );
|
|
|
}}
|
|
|
selectedId={null}
|
|
|
/>
|