From 3e8f5d89e44c5f467b94d49f40b0ee3d307c89c3 Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期一, 15 九月 2025 14:27:16 +0800
Subject: [PATCH] ID1766-暂存

---
 src/api/inventory/itemDict.ts                                              |   15 +++
 src/api/user/index.ts                                                      |   17 +++
 src/api/dict/index.ts                                                      |   14 ++
 src/store/type/bedsideAuxiliaryScreen.type.ts                              |    6 +
 src/api/inventory/types/itemDict.type.ts                                   |    6 +
 src/api/commom.type.ts                                                     |    6 +
 src/api/dict/types/index.type.ts                                           |    9 +
 src/utils/axios.ts                                                         |   14 +-
 src/views/mobile/bedsideAuxiliaryScreen/components/StartDialysis/index.vue |  203 ++++++++++++++++++++++++++++++++++++++--
 9 files changed, 272 insertions(+), 18 deletions(-)

diff --git a/src/api/commom.type.ts b/src/api/commom.type.ts
new file mode 100644
index 0000000..431408a
--- /dev/null
+++ b/src/api/commom.type.ts
@@ -0,0 +1,6 @@
+export interface ListParams {
+    page: number;
+    size: number;
+    wherecondition: string;
+    ordercondition: string;
+}
\ No newline at end of file
diff --git a/src/api/dict/index.ts b/src/api/dict/index.ts
new file mode 100644
index 0000000..8a531a6
--- /dev/null
+++ b/src/api/dict/index.ts
@@ -0,0 +1,14 @@
+import request from "@/utils/axios";
+import type { DictTypeParams } from './types/index.type';
+
+
+export function getDictTypeApi(params: DictTypeParams) {
+  return request({
+      url: '/dict/base/info/listDictValuesByType',
+      method: 'post',
+      headers: {
+          'Content-Type': 'application/x-www-form-urlencoded'
+      },
+      params,
+  })
+}
\ No newline at end of file
diff --git a/src/api/dict/types/index.type.ts b/src/api/dict/types/index.type.ts
new file mode 100644
index 0000000..0451bb5
--- /dev/null
+++ b/src/api/dict/types/index.type.ts
@@ -0,0 +1,9 @@
+export enum DictType {
+    穿刺方式 = 'in_med_cc_method',
+    穿刺针类型 = 'in_med_cc_zhen_type',
+    穿刺方向 = 'in_med_cc_ccfx'
+}
+
+export interface DictTypeParams {
+    dictType: DictType;
+}
diff --git a/src/api/inventory/itemDict.ts b/src/api/inventory/itemDict.ts
new file mode 100644
index 0000000..3a95a1e
--- /dev/null
+++ b/src/api/inventory/itemDict.ts
@@ -0,0 +1,15 @@
+import request from "@/utils/axios";
+import type { InventoryItemListParams } from './types/itemDict.type';
+
+/**
+ * 获取库存字典api
+ * @param params 
+ * @returns 
+ */
+export function getInventoryItemListApi(params: InventoryItemListParams) {
+    return request({
+      url: '/inventory/item/detail/info/list',
+      method: 'post',
+      params
+    })
+}
\ No newline at end of file
diff --git a/src/api/inventory/types/itemDict.type.ts b/src/api/inventory/types/itemDict.type.ts
new file mode 100644
index 0000000..b6bd9e4
--- /dev/null
+++ b/src/api/inventory/types/itemDict.type.ts
@@ -0,0 +1,6 @@
+import { ListParams } from '@/api/commom.type';
+
+
+export interface InventoryItemListParams extends ListParams {
+    isPure: number;
+}
\ No newline at end of file
diff --git a/src/api/user/index.ts b/src/api/user/index.ts
new file mode 100644
index 0000000..4f9fa00
--- /dev/null
+++ b/src/api/user/index.ts
@@ -0,0 +1,17 @@
+import request from "@/utils/axios";
+
+/**
+ * 根据角色获取用户列表api
+ * @param params 
+ * @returns 
+ */
+export function getUsersByRoleCodeApi(params: string) {
+  return request({
+    url: "/user/info/getUsersByRoleCode",
+    method: "post",
+    headers: {
+      "Content-Type": "application/x-www-form-urlencoded",
+    },
+    data: params,
+  });
+}
diff --git a/src/store/type/bedsideAuxiliaryScreen.type.ts b/src/store/type/bedsideAuxiliaryScreen.type.ts
index 744f6b4..522aada 100644
--- a/src/store/type/bedsideAuxiliaryScreen.type.ts
+++ b/src/store/type/bedsideAuxiliaryScreen.type.ts
@@ -250,6 +250,7 @@
   sphygmomanometer: Sphygmomanometer;
   customConfiguration: Customconfiguration;
   患者出生日期: string;
+  客户编号: string;
 }
 
 export const defaultSphygmomanometer = () :Sphygmomanometer => {
@@ -518,6 +519,7 @@
     // @ts-ignore
     pageType, // 当前要展示的页面
     treatmentStatus: EMedStatus.NOT_CHECKED_IN, // 透析状态
+    客户编号: "",
     consumablesCollection: defaultconsumablesCollection(), // 未排班时需要的数据
     notSignedIn: defalutNotSignedIn(), // 未签到时需要的数据
     signedIn: defaultSignedIn(), // 已签到时需要的数据
@@ -548,6 +550,7 @@
   // 默认床号(设备号)
   result.devicdeNo = seeMsg.IOT信息?.床号;
   result.deviceCode = seeMsg.IOT信息?.设备唯一编号;
+
 
   // 自定义配置项
   result.customConfiguration = seeMsg.自定义配置项 ?? defaultCustomconfiguration();
@@ -585,6 +588,9 @@
       result.patFormNumber = seeMsg.透析状态?.患者门诊住院号;
       result.患者出生日期 = seeMsg.透析状态?.患者出生日期 || "";
 
+      result.客户编号 = seeMsg.透析状态?.clientCode;
+
+
       // 未签到页面需要显示的
       if (treatmentStatus === EMedStatus.NOT_CHECKED_IN) {
         result.pageType = EPageType.NOT_SIGNED_IN;
diff --git a/src/utils/axios.ts b/src/utils/axios.ts
index 9c6a2b4..6dcc26f 100644
--- a/src/utils/axios.ts
+++ b/src/utils/axios.ts
@@ -63,7 +63,7 @@
     // 防止同一接口短时间内重复请求
     if (config.url) {
       if (reqList.includes(config.url)) {
-        return Promise.reject(new axios.Cancel(`重复请求:${config.url}`))
+        // return Promise.reject(new axios.Cancel(`重复请求:${config.url}`))
       } else {
         reqList.push(config.url)
       }
@@ -78,7 +78,7 @@
 instance.interceptors.response.use(
   (res: AxiosResponse) => {
 
-    setTimeout(() => allowRequest(res.config.url), 1000)
+    // setTimeout(() => allowRequest(res.config.url), 1000)
     if (String(res.status).charAt(0) !== '2') {
       return Promise.reject({
         code: res.status,
@@ -100,13 +100,13 @@
     const anyErr = err as any
     const configUrl = anyErr?.config?.url
     // 失败后 1s 允许再次请求
-    setTimeout(() => allowRequest(configUrl), 1000)
+    // setTimeout(() => allowRequest(configUrl), 1000)
 
     // 先判断是否是取消请求
-    if (axios.isCancel(err as any)) {
-      console.warn('请求被取消:', (err as any)?.message)
-      return Promise.reject(err)
-    }
+    // if (axios.isCancel(err as any)) {
+    //   console.warn('请求被取消:', (err as any)?.message)
+    //   return Promise.reject(err)
+    // }
 
     // 判断是否为 axios 的错误类型(有 response)
     if (axios.isAxiosError(err)) {
diff --git a/src/views/mobile/bedsideAuxiliaryScreen/components/StartDialysis/index.vue b/src/views/mobile/bedsideAuxiliaryScreen/components/StartDialysis/index.vue
index 89b7705..15492bf 100644
--- a/src/views/mobile/bedsideAuxiliaryScreen/components/StartDialysis/index.vue
+++ b/src/views/mobile/bedsideAuxiliaryScreen/components/StartDialysis/index.vue
@@ -39,40 +39,221 @@
 </template>
 
 <script lang="ts">
-import { reactive, toRefs } from "vue";
+import { computed, reactive, toRefs } from "vue";
 import closeImg from "@/img/close.png";
-import { addDefaultRowApi } from '@/api/patient_hemo_med_start/index';
-import type { StartRecord } from '@/api/patient_hemo_med_start/types/index.type';
+import { addDefaultRowApi } from "@/api/patient_hemo_med_start/index";
+import type { StartRecord } from "@/api/patient_hemo_med_start/types/index.type";
+import { useBedsideAuxiliaryScreenStore } from "@/store/bedsideAuxiliaryScreen";
+import { getInventoryItemListApi } from "@/api/inventory/itemDict";
+import { getUsersByRoleCodeApi } from "@/api/user/index";
+import { getDictTypeApi } from "@/api/dict/index";
+import { DictType } from "@/api/dict/types/index.type";
 
-interface FormData extends Omit<StartRecord, 'startCcType' | 'startCcASideDirection'> {
+interface FormData
+  extends Omit<StartRecord, "startCcType" | "startCcASideDirection"> {
   /** 穿刺方式 */
   startCcType: string[];
   /** 穿刺方向 */
   startCcASideDirection: string[];
 }
 
-
 interface State {
   loading: boolean;
   show: boolean;
   formData: FormData | {};
+  doneUseNsyOptions: any[];
+  doneUseHlbOptions: any[];
+  disposablePipelineOptions: any[];
+  hemofiltrationTubeOptions: any[];
+  nurseOptions: any[];
+  punctureMethodOptions: any[];
+  typePunctureNeedleOptions: any[];
+  punctureDirectionOptions: any[];
+  punctureNeedleOptions: any[];
 }
 export default {
   name: "StartDialysis",
   setup() {
+    const bedsideAuxiliaryScreenStore = useBedsideAuxiliaryScreenStore();
+
     const state = reactive<State>({
       loading: false,
       show: false,
-      formData: {}
+      formData: {},
+      doneUseNsyOptions: [], // 透析浓缩液列表
+      doneUseHlbOptions: [], // 透析护理包列表
+      disposablePipelineOptions: [], // 一次性使用管路列表
+      hemofiltrationTubeOptions: [], // 血滤管列表
+      nurseOptions: [], // 护士列表
+      punctureMethodOptions: [], // 穿刺方式列表
+      typePunctureNeedleOptions: [], // 穿刺针类型列表
+      punctureDirectionOptions: [], // 穿刺方向列表
+      punctureNeedleOptions: [], // 穿刺针列表
     });
 
-    const openDialog = () => {
+    const recordCode = computed(() => {
+      return bedsideAuxiliaryScreenStore.deviceData.signedIn.透析单编号;
+    });
+
+    const clientCode = computed(() => {
+      return bedsideAuxiliaryScreenStore.deviceData.客户编号;
+    });
+
+    const openDialog = async () => {
       state.show = true;
+      state.loading = true;
+      try {
+        const promiseFuns = [];
+        if (state.doneUseNsyOptions.length <= 0) {
+          promiseFuns.push(getDoneUseNsys());
+        }
+        if (state.doneUseHlbOptions.length <= 0) {
+          promiseFuns.push(getdoneUseHlbs());
+        }
+        if (state.disposablePipelineOptions.length <= 0) {
+          promiseFuns.push(getDisposablePipelines());
+        }
+        if (state.hemofiltrationTubeOptions.length <= 0) {
+          promiseFuns.push(getHemofiltrationTubes());
+        }
+        if (state.punctureNeedleOptions.length <= 0) {
+          promiseFuns.push(getPunctureNeedles());
+        }
+        if (state.nurseOptions.length <= 0) {
+          promiseFuns.push(getNurses());
+        }
+        if (state.punctureMethodOptions.length <= 0) {
+          promiseFuns.push(getPunctureMethods());
+        }
+        if (state.typePunctureNeedleOptions.length <= 0) {
+          promiseFuns.push(getTypePunctureNeedles());
+        }
+        if (state.punctureDirectionOptions.length <= 0) {
+          promiseFuns.push(getPunctureDirectionOptions());
+        }
+        await Promise.all(promiseFuns);
+      } catch (error) {
+        console.error("开始透析初始化失败", error);
+        state.show = false;
+      } finally {
+        state.loading = false;
+      }
     };
 
-    const getStartData = async () => {
-        const { data } = await addDefaultRowApi(`recordCode=`)
-        
+    /**
+     * 获取开始透析默认数据
+     */
+    // const getStartData = async () => {
+    //   const { data } = await addDefaultRowApi(`recordCode=${recordCode}`);
+    // };
+
+    /**
+     * 获取透析浓缩液字典数据
+     */
+    const getDoneUseNsys = async () => {
+      const params = {
+        page: 0,
+        size: 0,
+        wherecondition: `inventory_type_code='IT2112291619002680' and is_show = 1 and client_code='${clientCode.value}'`,
+        ordercondition: "item_is_use desc, item_sort_order asc",
+        isPure: 0,
+      };
+      const { data } = await getInventoryItemListApi(params);
+      state.doneUseNsyOptions = data.list;
+    };
+
+    /**
+     * 获取透析护理包字典数据
+     */
+    const getdoneUseHlbs = async () => {
+      const params = {
+        page: 0,
+        size: 0,
+        wherecondition: `inventory_type_code='IT2112291619003161' and is_show = 1 and client_code='${clientCode.value}'`,
+        ordercondition: "item_is_use desc, item_sort_order asc",
+        isPure: 0,
+      };
+      const { data } = await getInventoryItemListApi(params);
+      state.doneUseHlbOptions = data.list;
+    };
+
+    /**
+     * 获取一次性使用管路字典数据
+     */
+    const getDisposablePipelines = async () => {
+      const params = {
+        page: 0,
+        size: 0,
+        wherecondition: `inventory_type_code='IT2112291619006054' and is_show = 1 and client_code='${clientCode.value}'`,
+        ordercondition: "item_is_use desc, item_sort_order asc",
+        isPure: 0,
+      };
+      const { data } = await getInventoryItemListApi(params);
+      state.disposablePipelineOptions = data.list;
+    };
+
+    /**
+     * 获取血滤管字典数据
+     */
+    const getHemofiltrationTubes = async () => {
+      const params = {
+        page: 1,
+        size: 10,
+        wherecondition: `inventory_type_code='IT9024215920713quQV' and is_show = 1 and client_code='${clientCode.value}'`,
+        ordercondition: "item_is_use desc, item_sort_order asc",
+        isPure: 0,
+      };
+      const { data } = await getInventoryItemListApi(params);
+      state.hemofiltrationTubeOptions = data.list;
+    };
+
+    /**
+     * 获取穿刺针字典数据
+     */
+    const getPunctureNeedles = async () => {
+      const params = {
+        page: 1,
+        size: 10,
+        wherecondition: `inventory_type_code='IT3561011130526051' and is_show = 1 and client_code='${clientCode.value}'`,
+        ordercondition: "item_is_use desc, item_sort_order asc",
+        isPure: 0,
+      };
+      const { data } = await getInventoryItemListApi(params);
+      state.punctureNeedleOptions = data.list;
+    };
+
+    /**
+     * 获取护士数据
+     */
+    const getNurses = async () => {
+      const { data } = await getUsersByRoleCodeApi(
+        `clientCode=${clientCode.value}&roleClass=nurse`
+      );
+      state.nurseOptions = data;
+    };
+
+    /**
+     * 获取穿刺方式字典数据
+     */
+    const getPunctureMethods = async () => {
+      const { data } = await getDictTypeApi({ dictType: DictType.穿刺方式 });
+      state.punctureMethodOptions = data;
+    };
+
+    /**
+     * 获取穿刺针类型字典数据
+     */
+    const getTypePunctureNeedles = async () => {
+      const { data } = await getDictTypeApi({ dictType: DictType.穿刺针类型 });
+      state.typePunctureNeedleOptions = data;
+    };
+
+    /**
+     * 获取穿刺针方向字典数据
+     */
+    const getPunctureDirectionOptions = async () => {
+      const { data } = await getDictTypeApi({ dictType: DictType.穿刺方向 });
+      state.punctureDirectionOptions = data;
     };
 
     const handleCancel = () => {
@@ -147,7 +328,7 @@
     }
   }
   .start-dialysis-content {
-        padding: 0 12px 0px 12px;
+    padding: 0 12px 0px 12px;
     margin-bottom: 4px;
     border-bottom: 1px solid #d8d8d8;
   }

--
Gitblit v1.8.0