|
@@ -13,6 +13,7 @@ import { PlusOutlined } from '@ant-design/icons';
|
|
|
import ImageViewer from './ImageViewer';
|
|
|
import { getViewIconUrl } from '../../../API/bodyPosition';
|
|
|
import { changeBodyPosition } from '@/API/exam/changeBodyPosition';
|
|
|
+import { fetchViewDetail } from '@/API/patient/viewActions';
|
|
|
|
|
|
interface BodyPositionListProps {
|
|
|
layout: 'horizontal' | 'vertical';
|
|
@@ -64,29 +65,40 @@ const BodyPositionList: React.FC<BodyPositionListProps> = ({ layout }) => {
|
|
|
};
|
|
|
|
|
|
useEffect(() => {
|
|
|
- alert(
|
|
|
- `${works.length} works found == ${works[0].Views.length} views in the first work`
|
|
|
- );
|
|
|
- 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,
|
|
|
- work: work,
|
|
|
- }))
|
|
|
- );
|
|
|
- dispatch(setBodyPositions(bodyPositions));
|
|
|
- //选中第一个
|
|
|
- if (bodyPositions.length > 0) {
|
|
|
- dispatch(setSelectedBodyPosition(bodyPositions[0]));
|
|
|
- }
|
|
|
+ const fetchBodyPositions = async () => {
|
|
|
+ alert(
|
|
|
+ `${works.length} works found == ${works[0].Views.length} views in the first work`
|
|
|
+ );
|
|
|
+ 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_id: 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,
|
|
|
+ };
|
|
|
+ })
|
|
|
+ )
|
|
|
+ );
|
|
|
+ dispatch(setBodyPositions(bodyPositions));
|
|
|
+ //选中第一个
|
|
|
+ if (bodyPositions.length > 0) {
|
|
|
+ dispatch(setSelectedBodyPosition(bodyPositions[0]));
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ fetchBodyPositions();
|
|
|
}, [works, dispatch]);
|
|
|
|
|
|
return (
|