Jelajahi Sumber

门诊电子病历跳板

xiaochan 1 bulan lalu
induk
melakukan
0ab1815a35

+ 2 - 2
src/views/mz-emr/emr-v2/comp/right/MzCaSign.vue

@@ -86,8 +86,8 @@ function handleChange() {
         content: name,
         id: item.id,
         signType: null,
-        idCard: isDev ? "430922200002078519" : null,
-        signName: isDev ? "肖蟾" : "",
+        idCard: null,
+        signName: "",
         signTypeName: "",
         emrSignOpinion: {
           id: "",

+ 7 - 18
src/views/mz-emr/emr-v2/index.tsx

@@ -216,7 +216,6 @@ export const useMzEmrStore = () => {
     urlParams: {} as {
       times: number;
       patientId: string;
-      userIdCode: string;
     },
     isSave: false,
     // 是否准备好了
@@ -464,32 +463,22 @@ export const useMzEmrStore = () => {
     }
 
     await useUserStore().getUserInfo;
-    const userInfo = useUserStore().userInfo;
     const url = XEUtils.parseUrl(window.location.href);
 
     store.urlParams = JSON.parse(window.atob(url.searchQuery.params));
 
-    if (userInfo.code !== store.urlParams.userIdCode) {
-      const url = XEUtils.parseUrl(window.location.href);
-      xcMessage.error("账号不一致请重新登录");
-      localStorage.clear();
-      // @ts-ignore
-      await router.push(`/login?redirect=${url?.path}`);
-      return;
-    } else {
-      queryMzPatientInfo(store.urlParams).then(res => {
-        store.patientInfo = res;
-        store.prepare = true;
-
-        useQueryEmr.query();
-      });
-    }
+    queryMzPatientInfo(store.urlParams).then(res => {
+      store.patientInfo = res;
+      store.prepare = true;
+
+      useQueryEmr.query();
+    });
   });
 
   return {
     store,
     mutation,
-    userInfo,
+    userInfo: useUserStore().userInfo,
     emrMutation,
     emrEventFun,
   };

+ 81 - 63
src/views/system/JumpRedirect.vue

@@ -1,125 +1,143 @@
 <script setup lang="ts">
-import {onMounted, ref} from "vue";
-import router from '@/router'
-import {simpleLogin} from '@/api/login'
-import XEUtils from 'xe-utils'
-import {stringIsBlank} from '@/utils/blank-utils'
-import {useUserStore} from "@/pinia/user-store";
+import { onMounted, ref } from "vue";
+import router from "@/router";
+import { simpleLogin } from "@/api/login";
+import XEUtils from "xe-utils";
+import { stringIsBlank } from "@/utils/blank-utils";
+import { useUserStore } from "@/pinia/user-store";
 
-const userStore = useUserStore()
+const userStore = useUserStore();
 
 interface Info {
-  url: string
-  code: string
+  url: string;
+  code: string;
 }
 
 let parseUrl: {
-  searchQuery: any,
-  pathname: string
-}
+  searchQuery: any;
+  pathname: string;
+};
 
 const openAddress = {
-  '/medTecMod/yiJiFeiYongLuRu': () => {
-    routerPush(`${info.url}`)
+  "/medTecMod/yiJiFeiYongLuRu": () => {
+    routerPush(`${info.url}`);
   },
-  '/myEmrEditor': () => {
-    const param = parseUrl.searchQuery
+  "/myEmrEditor": () => {
+    const param = parseUrl.searchQuery;
     const data = {
       patNo: param.patNo,
       times: XEUtils.toNumber(param.times),
       state: XEUtils.toNumber(param.state),
-    }
+    };
     if (stringIsBlank(data.patNo)) {
-      setMsg('住院号不能为空')
+      setMsg("住院号不能为空");
     }
     if (stringIsBlank(data.times)) {
-      setMsg('住院次数不能为空')
+      setMsg("住院次数不能为空");
     }
     if (stringIsBlank(data.state)) {
-      setMsg('状态不能为空')
+      setMsg("状态不能为空");
     }
-    routerPush(`/myEmrEditor/${window.btoa(JSON.stringify(data))}`)
+    routerPush(`/myEmrEditor/${window.btoa(JSON.stringify(data))}`);
   },
-  '/mzEmr': () => {
-    const param = parseUrl.searchQuery
+  "/mzEmr": () => {
+    const param = parseUrl.searchQuery;
     const data = {
       patientId: param.patientId,
-      times: param.times
-    }
-    routerPush(`/mzEmr/${window.btoa(JSON.stringify(data))}`)
+      times: param.times,
+    };
+    routerPush(`/mzEmr/${window.btoa(JSON.stringify(data))}`);
   },
-  '/surgeryManagement': () => {
-    routerPush('/shouShuGuanLi/shouShuAnPai')
+  "/surgeryManagement": () => {
+    routerPush("/shouShuGuanLi/shouShuAnPai");
   },
-  '/inspectionResult': () => {
-    const param = parseUrl.searchQuery
+  "/inspectionResult": () => {
+    const param = parseUrl.searchQuery;
     if (param && param.patNo && param.start && param.end) {
-      routerPush(`/inspectionReportV2/${param.patNo}/${param.start}/${param.end}`)
+      routerPush(
+        `/inspectionReportV2/${param.patNo}/${param.start}/${param.end}`
+      );
     } else {
-      routerPush('/inspectionReportV2')
+      routerPush("/inspectionReportV2");
     }
   },
-}
+  "/mzEmrEditorV2": () => {
+    const param = parseUrl.searchQuery;
+    const data = {
+      patientId: param.patientId,
+      times: XEUtils.toNumber(param.times),
+    };
+    if (stringIsBlank(data.patientId)) {
+      setMsg("门诊号不能为空");
+    }
+    if (stringIsBlank(data.times)) {
+      setMsg("住院次数不能为空");
+    }
+    routerPush(`/mzEmrEditorV2?params=${window.btoa(JSON.stringify(data))}`);
+  },
+};
 
 async function routerPush(val: string) {
-  await router.push(val)
+  await router.push(val);
   location.reload();
 }
 
 let info: Info = {
-  url: '',
-  code: '',
-}
+  url: "",
+  code: "",
+};
 
-const errorMsg = ref('')
+const errorMsg = ref("");
 
 async function loginFunc() {
   try {
-    const userInfo = await simpleLogin(info.code)
-    localStorage.clear()
-    userStore.setUserInfo(userInfo)
+    const userInfo = await simpleLogin(info.code);
+    localStorage.clear();
+    userStore.setUserInfo(userInfo);
   } catch (e) {
-    console.error(e)
-    setMsg(e)
+    console.error(e);
+    setMsg(e);
   }
-
 }
 
 function setMsg(value: string) {
-  errorMsg.value = value
-  throw new Error(value)
+  errorMsg.value = value;
+  throw new Error(value);
 }
 
+/**
+ * 使用方法:
+ * 如访问 门诊电子病历的话,必须要 url /mzEmrEditorV2?patientId=489108-4&times=78
+ * 进入 encodeURIComponent('/mzEmrEditorV2?patientId=489108-4&times=78') 编码转化
+ * code 本院人员的唯一编码
+ * /jumpRedirect?url=%2FmzEmrEditorV2%3FpatientId%3D489108-4%26times%3D78&code=02896
+ */
 onMounted(async () => {
-  info = router.currentRoute.value.query as Info
+  info = router.currentRoute.value.query as Info;
 
   if (stringIsBlank(info.url)) {
-    setMsg('地址不能为空')
+    setMsg("地址不能为空");
   }
 
   if (stringIsBlank(info.code)) {
-    setMsg('用户编码不能为空')
+    setMsg("用户编码不能为空");
   }
 
-  parseUrl = XEUtils.parseUrl(info.url)
+  parseUrl = XEUtils.parseUrl(info.url);
 
   try {
-    const func = openAddress[parseUrl.pathname]
-    if (typeof func === 'undefined') {
-      setMsg('页面未开放')
+    const func = openAddress[parseUrl.pathname];
+    if (typeof func === "undefined") {
+      setMsg("页面未开放");
     }
-    if (info.code !== userStore.userInfo.code) {
-      await loginFunc()
+    if (info.code !== localStorage.code) {
+      await loginFunc();
     }
-    func()
-  } catch {
-  }
-})
+    func();
+  } catch {}
+});
 </script>
 
 <template>
-  <el-result
-      icon="error"
-      title="错误"
-      :sub-title="errorMsg"/>
+  <el-result icon="error" title="错误" :sub-title="errorMsg" />
 </template>