|
@@ -1,9 +1,13 @@
|
|
|
import React from 'react';
|
|
|
import { useSelector, useDispatch } from 'react-redux';
|
|
|
import { useEffect } from 'react';
|
|
|
-import { setBodyPositions } from '../../../states/exam/bodyPositionListSlice';
|
|
|
+import {
|
|
|
+ setBodyPositions,
|
|
|
+ ExtendedBodyPosition,
|
|
|
+} from '../../../states/exam/bodyPositionListSlice';
|
|
|
+import { setBodyPositionDetail } from '../../../states/exam/bodyPositionDetailSlice';
|
|
|
import { RootState } from '../../../states/store';
|
|
|
-import { Button } from 'antd';
|
|
|
+import { Button, message } from 'antd';
|
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
|
import ImageViewer from './ImageViewer';
|
|
|
import { getViewIconUrl } from '../../../API/bodyPosition';
|
|
@@ -14,6 +18,25 @@ interface BodyPositionListProps {
|
|
|
|
|
|
const BodyPositionList: React.FC<BodyPositionListProps> = ({ layout }) => {
|
|
|
const dispatch = useDispatch();
|
|
|
+
|
|
|
+ const handleImageClick = (bodyPosition: ExtendedBodyPosition) => {
|
|
|
+ message.info(`Clicked on ${bodyPosition.view_name}`);
|
|
|
+ dispatch(
|
|
|
+ setBodyPositionDetail({
|
|
|
+ view_name: bodyPosition.view_name,
|
|
|
+ view_description: bodyPosition.view_description,
|
|
|
+ view_icon_name: bodyPosition.view_icon_name,
|
|
|
+ patient_name: bodyPosition.patient_name,
|
|
|
+ patient_id: bodyPosition.patient_id,
|
|
|
+ registration_number: bodyPosition.registration_number,
|
|
|
+ study_description: bodyPosition.study_description,
|
|
|
+ body_position_image: bodyPosition.body_position_image,
|
|
|
+ collimator_length: bodyPosition.collimator_length,
|
|
|
+ collimator_width: bodyPosition.collimator_width,
|
|
|
+ sid: bodyPosition.sid,
|
|
|
+ })
|
|
|
+ );
|
|
|
+ };
|
|
|
const bodyPositions = useSelector(
|
|
|
(state: RootState) => state.bodyPositionList.bodyPositions
|
|
|
);
|
|
@@ -31,33 +54,20 @@ const BodyPositionList: React.FC<BodyPositionListProps> = ({ layout }) => {
|
|
|
alert(
|
|
|
`${works.length} works found == ${works[0].Views.length} views in the first work`
|
|
|
);
|
|
|
- const bodyPositions = works
|
|
|
- .flatMap((work) => work.Views)
|
|
|
- .map((view) => ({
|
|
|
- internal_id: view.internal_id,
|
|
|
- view_id: view.view_id,
|
|
|
- view_name: view.view_name,
|
|
|
- view_name_local: view.view_name_local,
|
|
|
- view_other_name: view.view_other_name,
|
|
|
- view_description: view.view_description,
|
|
|
- view_position: view.view_position,
|
|
|
- application: view.application,
|
|
|
- anatomic_region: view.anatomic_region,
|
|
|
- patient_type: view.patient_type,
|
|
|
- body_part_id: view.body_part_id,
|
|
|
- view_icon_name: view.view_icon_name,
|
|
|
- view_big_icon_name: view.view_big_icon_name,
|
|
|
- view_coach_name: view.view_coach_name,
|
|
|
- modality: view.modality,
|
|
|
- work_station_id: view.work_station_id,
|
|
|
- apr_id: view.apr_id,
|
|
|
- img_proc_id: view.img_proc_id,
|
|
|
- sort: view.sort,
|
|
|
- is_enabled: view.is_enabled,
|
|
|
- product: view.product,
|
|
|
- is_pre_install: view.is_pre_install,
|
|
|
- procedure_id: view.procedure_id,
|
|
|
- }));
|
|
|
+ const bodyPositions: ExtendedBodyPosition[] = works.flatMap((work) =>
|
|
|
+ work.Views.map((view) => ({
|
|
|
+ ...view,
|
|
|
+ // ...work,
|
|
|
+ collimator_length: view.config_object.DX.CollimatorSizeLength || 0,
|
|
|
+ collimator_width: view.config_object.DX.CollimatorSizeWidth || 0,
|
|
|
+ sid: '', //todo 这里还缺少值的来源
|
|
|
+ patient_name: work.PatientName,
|
|
|
+ patient_id: work.PatientID,
|
|
|
+ registration_number: work.AccessionNumber,
|
|
|
+ study_description: work.StudyDescription,
|
|
|
+ body_position_image: view.view_icon_name,
|
|
|
+ }))
|
|
|
+ );
|
|
|
dispatch(setBodyPositions(bodyPositions));
|
|
|
}, [works, dispatch]);
|
|
|
|
|
@@ -70,6 +80,7 @@ const BodyPositionList: React.FC<BodyPositionListProps> = ({ layout }) => {
|
|
|
key={index}
|
|
|
src={getViewIconUrl(bodyPosition.view_icon_name)}
|
|
|
className="image-viewer-item"
|
|
|
+ onClick={() => handleImageClick(bodyPosition)}
|
|
|
/>
|
|
|
))}
|
|
|
<Button
|