|
@@ -8,34 +8,34 @@ import {
|
|
} from '@/states/patient/register/SelectionTypeSlice';
|
|
} from '@/states/patient/register/SelectionTypeSlice';
|
|
import { setCurrentBodyPart } from '../../bodyPartSlice';
|
|
import { setCurrentBodyPart } from '../../bodyPartSlice';
|
|
import { fetchProcedures, Procedure } from '@/API/patient/procedureActions';
|
|
import { fetchProcedures, Procedure } from '@/API/patient/procedureActions';
|
|
-import { fetchViews } from '@/API/patient/viewActions';
|
|
|
|
-export type { Procedure };
|
|
|
|
|
|
+import { fetchViews, View } from '@/API/patient/viewActions';
|
|
|
|
+export type { Procedure, View };
|
|
|
|
|
|
// 体位类型
|
|
// 体位类型
|
|
-export interface View {
|
|
|
|
- internal_id: string;
|
|
|
|
- view_id: string;
|
|
|
|
- view_name: string;
|
|
|
|
- view_name_local: string;
|
|
|
|
- view_other_name: string;
|
|
|
|
- view_description: string;
|
|
|
|
- view_position: string;
|
|
|
|
- application: string;
|
|
|
|
- anatomic_region: string;
|
|
|
|
- patient_type: string;
|
|
|
|
- body_part_id: string;
|
|
|
|
- view_icon_name: string;
|
|
|
|
- view_big_icon_name: string;
|
|
|
|
- view_coach_name: string;
|
|
|
|
- modality: string;
|
|
|
|
- // config_object: any;
|
|
|
|
- tech_template: string;
|
|
|
|
- img_proc_template: string;
|
|
|
|
- sort: number;
|
|
|
|
- is_enabled: boolean;
|
|
|
|
- product: string;
|
|
|
|
- is_pre_install: boolean;
|
|
|
|
-}
|
|
|
|
|
|
+// export interface View {
|
|
|
|
+// internal_id: string;
|
|
|
|
+// view_id: string;
|
|
|
|
+// view_name: string;
|
|
|
|
+// view_name_local: string;
|
|
|
|
+// view_other_name: string;
|
|
|
|
+// view_description: string;
|
|
|
|
+// view_position: string;
|
|
|
|
+// application: string;
|
|
|
|
+// anatomic_region: string;
|
|
|
|
+// patient_type: string;
|
|
|
|
+// body_part_id: string;
|
|
|
|
+// view_icon_name: string;
|
|
|
|
+// view_big_icon_name: string;
|
|
|
|
+// view_coach_name: string;
|
|
|
|
+// modality: string;
|
|
|
|
+// // config_object: any;
|
|
|
|
+// tech_template: string;
|
|
|
|
+// img_proc_template: string;
|
|
|
|
+// sort: number;
|
|
|
|
+// is_enabled: boolean;
|
|
|
|
+// product: string;
|
|
|
|
+// is_pre_install: boolean;
|
|
|
|
+// }
|
|
|
|
|
|
// 协议类型
|
|
// 协议类型
|
|
// export interface Procedure {
|
|
// export interface Procedure {
|
|
@@ -76,54 +76,7 @@ interface ViewSelectionState {
|
|
|
|
|
|
const initialState: ViewSelectionState = {
|
|
const initialState: ViewSelectionState = {
|
|
selectedViews: [],
|
|
selectedViews: [],
|
|
- availableViews: [
|
|
|
|
- {
|
|
|
|
- internal_id: '1',
|
|
|
|
- view_id: 'AP',
|
|
|
|
- view_name: 'Anteroposterior',
|
|
|
|
- view_name_local: '前后位',
|
|
|
|
- view_other_name: 'AP View',
|
|
|
|
- view_description: '前后体位描述',
|
|
|
|
- view_position: 'Standing',
|
|
|
|
- application: 'General',
|
|
|
|
- anatomic_region: 'Chest',
|
|
|
|
- patient_type: 'Adult',
|
|
|
|
- body_part_id: 'CHEST',
|
|
|
|
- view_icon_name: 'ap_icon.png',
|
|
|
|
- view_big_icon_name: 'ap_big_icon.png',
|
|
|
|
- view_coach_name: 'ap_coach.png',
|
|
|
|
- modality: 'X-Ray',
|
|
|
|
- tech_template: 'default',
|
|
|
|
- img_proc_template: 'default',
|
|
|
|
- sort: 1,
|
|
|
|
- is_enabled: true,
|
|
|
|
- product: 'Standard',
|
|
|
|
- is_pre_install: true,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- internal_id: '2',
|
|
|
|
- view_id: 'LAT',
|
|
|
|
- view_name: 'Lateral',
|
|
|
|
- view_name_local: '侧位',
|
|
|
|
- view_other_name: 'LAT View',
|
|
|
|
- view_description: '侧体位描述',
|
|
|
|
- view_position: 'Standing',
|
|
|
|
- application: 'General',
|
|
|
|
- anatomic_region: 'Chest',
|
|
|
|
- patient_type: 'Adult',
|
|
|
|
- body_part_id: 'CHEST',
|
|
|
|
- view_icon_name: 'lat_icon.png',
|
|
|
|
- view_big_icon_name: 'lat_big_icon.png',
|
|
|
|
- view_coach_name: 'lat_coach.png',
|
|
|
|
- modality: 'X-Ray',
|
|
|
|
- tech_template: 'default',
|
|
|
|
- img_proc_template: 'default',
|
|
|
|
- sort: 2,
|
|
|
|
- is_enabled: true,
|
|
|
|
- product: 'Standard',
|
|
|
|
- is_pre_install: true,
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
|
|
+ availableViews: [],
|
|
protocols: [],
|
|
protocols: [],
|
|
currentBodyPart: null,
|
|
currentBodyPart: null,
|
|
currentPatientType: null,
|
|
currentPatientType: null,
|
|
@@ -134,6 +87,7 @@ export interface FilterCondition {
|
|
selection: string;
|
|
selection: string;
|
|
patientType: string | null;
|
|
patientType: string | null;
|
|
bodyPart: string | null;
|
|
bodyPart: string | null;
|
|
|
|
+ procedureId?: string | null;
|
|
}
|
|
}
|
|
|
|
|
|
export const fetchViewsOrProtocols = createAsyncThunk(
|
|
export const fetchViewsOrProtocols = createAsyncThunk(
|
|
@@ -155,7 +109,7 @@ export const fetchViewsOrProtocols = createAsyncThunk(
|
|
filter.patientType,
|
|
filter.patientType,
|
|
filter.bodyPart,
|
|
filter.bodyPart,
|
|
true,
|
|
true,
|
|
- null
|
|
|
|
|
|
+ filter.procedureId
|
|
);
|
|
);
|
|
return response.data.view_list;
|
|
return response.data.view_list;
|
|
}
|
|
}
|
|
@@ -165,6 +119,18 @@ export const fetchViewsOrProtocols = createAsyncThunk(
|
|
}
|
|
}
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+export const fetchViewsByProcedureId = createAsyncThunk(
|
|
|
|
+ 'data/fetchViewsByProcedureId',
|
|
|
|
+ async (procedureId: string, { rejectWithValue }) => {
|
|
|
|
+ try {
|
|
|
|
+ const response = await fetchViews(null, null, true, procedureId);
|
|
|
|
+ return response.data.view_list;
|
|
|
|
+ } catch (error) {
|
|
|
|
+ return rejectWithValue(error.message);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+);
|
|
|
|
+
|
|
const viewSelectionSlice = createSlice({
|
|
const viewSelectionSlice = createSlice({
|
|
name: 'viewSelection',
|
|
name: 'viewSelection',
|
|
initialState,
|
|
initialState,
|
|
@@ -235,6 +201,22 @@ const viewSelectionSlice = createSlice({
|
|
// eslint-disable-next-line
|
|
// eslint-disable-next-line
|
|
.addCase(fetchViewsOrProtocols.rejected, (state, action) => {
|
|
.addCase(fetchViewsOrProtocols.rejected, (state, action) => {
|
|
console.log(`查询view或者protocals: rejected`);
|
|
console.log(`查询view或者protocals: rejected`);
|
|
|
|
+ })
|
|
|
|
+ // eslint-disable-next-line
|
|
|
|
+ .addCase(fetchViewsByProcedureId.pending, (state) => {
|
|
|
|
+ console.log('Fetching views by procedure ID: pending');
|
|
|
|
+ })
|
|
|
|
+ .addCase(fetchViewsByProcedureId.fulfilled, (state, action) => {
|
|
|
|
+ state.selectedViews = [...state.selectedViews, ...action.payload];
|
|
|
|
+ console.log(
|
|
|
|
+ `Fetching views by procedure ID: fulfilled ${JSON.stringify(state.availableViews)}`
|
|
|
|
+ );
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ .addCase(fetchViewsByProcedureId.rejected, (state, action) => {
|
|
|
|
+ console.log(
|
|
|
|
+ `Fetching views by procedure ID: rejected ${action.error.message}`
|
|
|
|
+ );
|
|
});
|
|
});
|
|
},
|
|
},
|
|
});
|
|
});
|