|
@@ -1,8 +1,6 @@
|
|
import React from 'react';
|
|
import React from 'react';
|
|
import { useSelector, useDispatch } from 'react-redux';
|
|
import { useSelector, useDispatch } from 'react-redux';
|
|
-import { useEffect } from 'react';
|
|
|
|
import {
|
|
import {
|
|
- setBodyPositions,
|
|
|
|
setSelectedBodyPosition,
|
|
setSelectedBodyPosition,
|
|
ExtendedBodyPosition,
|
|
ExtendedBodyPosition,
|
|
} from '../../../states/exam/bodyPositionListSlice';
|
|
} from '../../../states/exam/bodyPositionListSlice';
|
|
@@ -13,7 +11,6 @@ import AppendViewIcon from '@/assets/imgs/append-view.svg';
|
|
import ImageViewer from './ImageViewer';
|
|
import ImageViewer from './ImageViewer';
|
|
import { getExposedImageUrl, getViewIconUrl } from '../../../API/bodyPosition';
|
|
import { getExposedImageUrl, getViewIconUrl } from '../../../API/bodyPosition';
|
|
import { changeBodyPosition } from '@/API/exam/changeBodyPosition';
|
|
import { changeBodyPosition } from '@/API/exam/changeBodyPosition';
|
|
-import { fetchViewDetail } from '@/API/patient/viewActions';
|
|
|
|
|
|
|
|
interface BodyPositionListProps {
|
|
interface BodyPositionListProps {
|
|
layout: 'horizontal' | 'vertical';
|
|
layout: 'horizontal' | 'vertical';
|
|
@@ -60,7 +57,6 @@ const BodyPositionList: React.FC<BodyPositionListProps> = ({
|
|
// const selectedBodyPosition = useSelector(
|
|
// const selectedBodyPosition = useSelector(
|
|
// (state: RootState) => state.bodyPositionList.selectedBodyPosition
|
|
// (state: RootState) => state.bodyPositionList.selectedBodyPosition
|
|
// );
|
|
// );
|
|
- const works = useSelector((state: RootState) => state.examWorksCache.works);
|
|
|
|
|
|
|
|
const addBodyPositionClick = () => {
|
|
const addBodyPositionClick = () => {
|
|
// dispatch(addBodyPosition({
|
|
// dispatch(addBodyPosition({
|
|
@@ -70,47 +66,6 @@ const BodyPositionList: React.FC<BodyPositionListProps> = ({
|
|
// }));
|
|
// }));
|
|
};
|
|
};
|
|
|
|
|
|
- useEffect(() => {
|
|
|
|
- const fetchBodyPositions = async () => {
|
|
|
|
- // alert(
|
|
|
|
- // `${works.length} works found == ${works[0].Views.length} views in the first work`
|
|
|
|
- // );
|
|
|
|
- console.log(`体位信息:${JSON.stringify(works)}`);
|
|
|
|
- const bodyPositions: ExtendedBodyPosition[] = await Promise.all(
|
|
|
|
- works.flatMap((work) =>
|
|
|
|
- work.Views.map(async (view) => {
|
|
|
|
- const viewDetail = await fetchViewDetail(view.view_id);
|
|
|
|
- return {
|
|
|
|
- ...viewDetail,
|
|
|
|
- // sop_instance_uid: view.sop_instance_uid,
|
|
|
|
- collimator_length:
|
|
|
|
- viewDetail.config_object.DX.CollimatorSizeLength || 0,
|
|
|
|
- collimator_width:
|
|
|
|
- viewDetail.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: viewDetail.view_icon_name,
|
|
|
|
- work: work,
|
|
|
|
- study_instance_uid: work.StudyInstanceUID,
|
|
|
|
- sop_instance_uid: view.PrimarySopUID,
|
|
|
|
- dview: view,
|
|
|
|
- };
|
|
|
|
- })
|
|
|
|
- )
|
|
|
|
- );
|
|
|
|
- dispatch(setBodyPositions(bodyPositions));
|
|
|
|
- //选中第一个
|
|
|
|
- if (bodyPositions.length > 0) {
|
|
|
|
- dispatch(setSelectedBodyPosition(bodyPositions[0]));
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- if (!!bodyPositions && bodyPositions.length > 0) return; // 如果已经有体位信息,则不再重新获取
|
|
|
|
- fetchBodyPositions();
|
|
|
|
- }, [works, dispatch]);
|
|
|
|
-
|
|
|
|
return (
|
|
return (
|
|
// 父级是flex,这里是grid,grid的高度需要设置为0,并且flex-grow,这样才能不撑开grid
|
|
// 父级是flex,这里是grid,grid的高度需要设置为0,并且flex-grow,这样才能不撑开grid
|
|
<div className={`${layout} grid grid-rows-[1fr_auto] h-0 flex-grow`}>
|
|
<div className={`${layout} grid grid-rows-[1fr_auto] h-0 flex-grow`}>
|