|
@@ -0,0 +1,160 @@
|
|
|
|
+import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
|
|
+
|
|
|
|
+// 体位类型
|
|
|
|
+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 {
|
|
|
|
+ ProcedureID: string;
|
|
|
|
+ ProcedureCode: string;
|
|
|
|
+ ProcedureName: string;
|
|
|
|
+ ProcedureOtherName: string;
|
|
|
|
+ ProcedureDescription: string;
|
|
|
|
+ PatientType: string;
|
|
|
|
+ ProcedureGroupID: string;
|
|
|
|
+ ProcedureType: string;
|
|
|
|
+ FastSearch: boolean;
|
|
|
|
+ Enable: boolean;
|
|
|
|
+ Order: number;
|
|
|
|
+ UserGroupID: string;
|
|
|
|
+ ProcedureCategory: string;
|
|
|
|
+ Modality: string;
|
|
|
|
+ IsImplanted: boolean;
|
|
|
|
+ MagFactor: number;
|
|
|
|
+ // ProcedureViews: View[];
|
|
|
|
+ // ProcedureViewRelations: any[];
|
|
|
|
+ ClinicProtocol: boolean;
|
|
|
|
+ IsFactoryDefault: boolean;
|
|
|
|
+ MinBMI: number;
|
|
|
|
+ MaxBMI: number;
|
|
|
|
+ AutoDecompression: boolean;
|
|
|
|
+ ConfigObjectValue: string;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+interface ViewSelectionState {
|
|
|
|
+ selectedViews: View[]; // 已选择体位列表
|
|
|
|
+ availableViews: View[]; // 待选择体位列表
|
|
|
|
+ protocols: Procedure[]; // 协议列表(只会出现在待选择列表)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//type SelectionType = 'protocol' | 'view';
|
|
|
|
+
|
|
|
|
+interface ViewSelectionState {
|
|
|
|
+ selectedViews: View[]; // 已选择体位列表
|
|
|
|
+ availableViews: View[]; // 待选择体位列表
|
|
|
|
+ protocols: Procedure[]; // 协议列表(只会出现在待选择列表)
|
|
|
|
+ //selectionType: SelectionType; // 可选择值为 'protocol' | 'view'
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const initialState: ViewSelectionState = {
|
|
|
|
+ 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,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ protocols: [],
|
|
|
|
+ //selectionType: 'protocol',
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const viewSelectionSlice = createSlice({
|
|
|
|
+ name: 'viewSelection',
|
|
|
|
+ initialState,
|
|
|
|
+ reducers: {
|
|
|
|
+ // 添加体位到已选择体位列表
|
|
|
|
+ addSelectedView(state, action: PayloadAction<View>) {
|
|
|
|
+ state.selectedViews.push(action.payload);
|
|
|
|
+ },
|
|
|
|
+ // 添加协议中的所有体位到已选择体位列表
|
|
|
|
+ // eslint-disable-next-line
|
|
|
|
+ addProtocolViews(state, action: PayloadAction<Procedure>) {
|
|
|
|
+ // 假设协议中包含 ProcedureViews 属性,存储体位数组
|
|
|
|
+ // todo 这里涉及到基于协议查询其名下的体位,然后再添加
|
|
|
|
+ // if (Array.isArray(action.payload.ProcedureViews)) {
|
|
|
|
+ // state.selectedViews.push(...action.payload.ProcedureViews);
|
|
|
|
+ // }
|
|
|
|
+ },
|
|
|
|
+ // 可根据需要添加其它 reducer,例如设置 availableViews、Procedures 等
|
|
|
|
+ setAvailableViews(state, action: PayloadAction<View[]>) {
|
|
|
|
+ state.availableViews = action.payload;
|
|
|
|
+ },
|
|
|
|
+ setProtocols(state, action: PayloadAction<Procedure[]>) {
|
|
|
|
+ state.protocols = action.payload;
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+export const {
|
|
|
|
+ addSelectedView,
|
|
|
|
+ addProtocolViews,
|
|
|
|
+ setAvailableViews,
|
|
|
|
+ setProtocols,
|
|
|
|
+} = viewSelectionSlice.actions;
|
|
|
|
+
|
|
|
|
+export default viewSelectionSlice.reducer;
|