|
@@ -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×=78
|
|
|
+ * 进入 encodeURIComponent('/mzEmrEditorV2?patientId=489108-4×=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>
|