Procházet zdrojové kódy

优化电子病历的加载

xiaochan před 9 měsíci
rodič
revize
d1f186a106

+ 78 - 66
src/api/base-data/report-center.ts

@@ -1,98 +1,110 @@
 import request from "../../utils/database/magic-api-request";
-import {SaveFile, SaveFolder} from "./type/magic-api";
+import { SaveFile, SaveFolder } from "./type/magic-api";
 import XEUtils from "xe-utils";
+import { AxiosRequestConfig } from "axios";
 
 export function folderSave(data: SaveFolder) {
-    return request<string>({
-        url: '/magicReportCenter/folderSave',
-        method: 'POST',
-        data: data
-    })
+  return request<string>({
+    url: "/magicReportCenter/folderSave",
+    method: "POST",
+    data: data,
+  });
 }
 
 export function fileSave(data: SaveFile) {
-    return request<string>({
-        url: '/magicReportCenter/fileSave',
-        method: 'POST',
-        data: data
-    })
+  return request<string>({
+    url: "/magicReportCenter/fileSave",
+    method: "POST",
+    data: data,
+  });
 }
 
-
 export async function getReportCenterTree() {
-    const res = await request({
-        url: '/magicReportCenter/getReportCenterTree',
-        method: 'POST'
-    })
-    XEUtils.arrayEach(res, (item) => {
-        // @ts-ignore
-        item.pageJsonObject = JSON.parse(item.pageJson)
-    })
-    return XEUtils.toArrayTree(res)
+  const res = await request({
+    url: "/magicReportCenter/getReportCenterTree",
+    method: "POST",
+  });
+  XEUtils.arrayEach(res, item => {
+    // @ts-ignore
+    item.pageJsonObject = JSON.parse(item.pageJson);
+  });
+  return XEUtils.toArrayTree(res);
 }
 
-
 export function deleteById(id: string) {
-    return request({
-        url: '/magicReportCenter/deleteById',
-        method: 'get',
-        params: {id}
-    })
+  return request({
+    url: "/magicReportCenter/deleteById",
+    method: "get",
+    params: { id },
+  });
 }
 
-export function modifyTheFileName(data: { id: string, name: string, type: string }) {
-    return request({
-        url: '/magicReportCenter/modifyTheFileName',
-        method: 'POST',
-        data
-    })
+export function modifyTheFileName(data: {
+  id: string;
+  name: string;
+  type: string;
+}) {
+  return request({
+    url: "/magicReportCenter/modifyTheFileName",
+    method: "POST",
+    data,
+  });
 }
 
 export function saveTheFile(data: any) {
-    return request({
-        url: '/magicReportCenter/saveTheFile',
-        method: 'POST',
-        data
-    })
+  return request({
+    url: "/magicReportCenter/saveTheFile",
+    method: "POST",
+    data,
+  });
 }
 
-
 export function move(src: string, groupId: string) {
-    return request({
-        url: '/magicReportCenter/move',
-        method: 'get',
-        params: {src, groupId}
-    })
+  return request({
+    url: "/magicReportCenter/move",
+    method: "get",
+    params: { src, groupId },
+  });
 }
 
 export function getPermissionsByUserCode(userCode: string) {
-    return request<string[]>({
-        url: '/magicReportCenter/getPermissionsByUserCode',
-        method: 'get',
-        params: {userCode}
-    })
+  return request<string[]>({
+    url: "/magicReportCenter/getPermissionsByUserCode",
+    method: "get",
+    params: { userCode },
+  });
 }
 
 export function setPermissions(data: any) {
-    return request({
-        url: '/magicReportCenter/setPermissions',
-        method: 'POST',
-        data
-    })
+  return request({
+    url: "/magicReportCenter/setPermissions",
+    method: "POST",
+    data,
+  });
 }
 
-export function reportQueryCenterApi<D = any>(url: string, data: any = {}) {
-    return request<D>({
-        url: "/thyy/api" + url,
-        method: 'post',
-        data: data,
-    })
+export function reportQueryCenterApi<D = any>(
+  url: string,
+  data: any = {},
+  config: AxiosRequestConfig<D> = {}
+) {
+  return request<D>({
+    url: "/thyy/api" + url,
+    method: "post",
+    data: data,
+    ...config,
+  });
 }
 
-export function reportQueryCenterApiByGet<D = any>(url: string, params: any = {}) {
-    return request<D>({
-        url: "/thyy/api" + url,
-        method: 'get',
-        params,
-    })
+export function reportQueryCenterApiByGet<D = any>(
+  url: string,
+  params: any = {},
+  config: AxiosRequestConfig<D> = {}
+) {
+  return request<D>({
+    url: "/thyy/api" + url,
+    method: "get",
+    params,
+    ...config,
+  });
 }

+ 15 - 4
src/utils/public.ts

@@ -124,10 +124,21 @@ export const isEnglish = (str: string) => {
 
 export function isContain(element: HTMLElement) {
     let elementIsVisible: boolean
-    const rect = element.getBoundingClientRect();
-    const document = window.document;
-    elementIsVisible = rect.top <= (window.innerHeight || document.documentElement.clientHeight) && rect.left <= (window.innerWidth || document.documentElement.clientWidth) && rect.bottom >= 0 && rect.right >= 0;
-    return elementIsVisible
+    try {
+        const rect = element.getBoundingClientRect();
+        const document = window.document;
+        elementIsVisible =
+          rect.top <=
+            (window.innerHeight || document.documentElement.clientHeight) &&
+          rect.left <=
+            (window.innerWidth || document.documentElement.clientWidth) &&
+          rect.bottom >= 0 &&
+          rect.right >= 0;
+        return elementIsVisible    
+    }catch {
+        return false;
+    }
+    
 }
 
 export const SYSTEM_CONFIG = {

+ 51 - 11
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/EmrMain.vue

@@ -120,8 +120,8 @@
   <EmrSaveRules ref="emrSaveRulesRef" />
 </template>
 
-<script setup lang="ts">
-import { nextTick, onDeactivated, onMounted, provide, ref, watch } from "vue";
+<script setup lang="tsx">
+import { onDeactivated, onMounted, provide, ref, watch } from "vue";
 import {
   copyEnum,
   delEmrCopy,
@@ -136,7 +136,7 @@ import {
   showIframe,
   showIframeIsList,
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
-import { ElMessage } from "element-plus";
+import { ElMessage, ElNotification } from "element-plus";
 import { BizException, ExceptionEnum } from "@/utils/BizException";
 import { onBeforeRouteLeave } from "vue-router";
 import { getServerDateApi, getUuid } from "@/api/public-api";
@@ -1202,27 +1202,68 @@ const clickToSubmitTheMedicalRecord = async () => {
   await submitMedicalRecord(getId());
 };
 
+const 重试 = {
+  次数: 3,
+  运行中: false,
+};
+
+async function 重试查询患者信息() {
+  if (重试.运行中) return;
+  重试.运行中 = true;
+  for (let i = 0; i < 重试.次数; i++) {
+    await sleep(1000);
+    const data = await queryingBasicPatientInformation();
+    if (data) {
+      重试.运行中 = false;
+      return;
+    }
+    await sleep(1000);
+  }
+  const tempNotification = ElNotification.error({
+    title: "获取患者信息失败",
+    duration: 0,
+    message: (
+      <ElButton
+        onClick={() => {
+          tempNotification.close();
+          重试查询患者信息();
+        }}
+      >
+        重试
+      </ElButton>
+    ),
+  });
+  重试.运行中 = false;
+}
+
 /**
  * 查询患者信息
  */
-const queryingBasicPatientInformation = async () => {
-  await reportQueryCenterApiByGet<{
+const queryingBasicPatientInformation = async (): Promise<boolean> => {
+  return await reportQueryCenterApiByGet<{
     patientData: any;
     extractData: any;
     copy: boolean;
-  }>("/dataEmr/patInfo", {
-    patNo: patientInfo.value.inpatientNo,
-    times: patientInfo.value.admissTimes,
-  })
+  }>(
+    "/dataEmr/patInfo",
+    {
+      patNo: patientInfo.value.inpatientNo,
+      times: patientInfo.value.admissTimes,
+    },
+    { timeout: 2000 }
+  )
     .then(res => {
       patientData.value = res.patientData;
       emrStore.mutation.setEmrPatientData(res.patientData);
       extractData = res.extractData;
       copy = res.copy;
+      return true;
     })
     .catch(() => {
       emrStore.mutation.setEmrPatientData({});
       extractData = {};
+      重试查询患者信息();
+      return false;
     })
     .finally(() => {
       getCurrentPersonnelInformation();
@@ -1680,8 +1721,7 @@ function beforeRevisionAccept(evt, data) {
 
 onMounted(async () => {
   doctorLevelFunc();
-  await queryingBasicPatientInformation();
-  await nextTick();
+  queryingBasicPatientInformation().then(XEUtils.noop);
   initEdit();
   window.addEventListener("beforeunload", monitorPageRefresh, {
     capture: true,

+ 248 - 207
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/Home.vue

@@ -1,239 +1,274 @@
 <template>
   <div class="layout_container">
     <header style="margin: 0">
-      <EmrHeader/>
+      <EmrHeader />
       <div style="padding: 5px">
-        <EmrSelectPat v-if="emrConfig.editor"
-                      :overViewList
-        />
+        <EmrSelectPat v-if="emrConfig.editor" :overViewList />
 
-        <el-input v-model="queryPatNo"
-                  placeholder="住院号"
-                  style="width: 100px"
-                  @blur="queryPatNo = $event.target.value.trim()"/>
-        <el-divider direction="vertical"/>
+        <el-input
+          v-model="queryPatNo"
+          placeholder="住院号"
+          style="width: 100px"
+          @blur="queryPatNo = $event.target.value.trim()"
+        />
+        <el-divider direction="vertical" />
         <el-button-group>
           <el-button
-              @click="allPatientsInTheHospital"
-              :disabled="query.state === 4">
+            @click="allPatientsInTheHospital"
+            :disabled="query.state === 4"
+          >
             在院
           </el-button>
           <EmrLeaveHospitalPatient
-              :patNo="queryPatNo"
-              @rowClick="disPatients"/>
+            :patNo="queryPatNo"
+            @rowClick="disPatients"
+          />
         </el-button-group>
-        <el-divider direction="vertical"/>
+        <el-divider direction="vertical" />
         {{ patientInfo.name }}
-        性别:<span style="color:red;">{{ cptSex(patientInfo.sex) }}</span>
-        年龄:<span style="color:red;">{{ XEUtils.addUnit(patientInfo.age, '岁') }}</span>
-        住院天数:<span style="color:red;">{{ XEUtils.addUnit(patientInfo.actIptDays, '天') }}</span>
-        入院时间:<span style="color:red;">{{ patientInfo.admissDate }}</span>
-        <el-divider direction="vertical"/>
-        <el-button-group v-if="query.state === emrStateEnum.在院编辑 || query.state === emrStateEnum.在院只读 ">
+        性别:<span style="color: red">{{ cptSex(patientInfo.sex) }}</span>
+        年龄:<span style="color: red">{{
+          XEUtils.addUnit(patientInfo.age, "岁")
+        }}</span>
+        住院天数:<span style="color: red">{{
+          XEUtils.addUnit(patientInfo.actIptDays, "天")
+        }}</span>
+        入院时间:<span style="color: red">{{ patientInfo.admissDate }}</span>
+        <el-divider direction="vertical" />
+        <el-button-group
+          v-if="
+            query.state === emrStateEnum.在院编辑 ||
+            query.state === emrStateEnum.在院只读
+          "
+        >
           <el-button type="primary" @click="clickPatientNext">上一位</el-button>
-          <el-button type="primary" @click="clickPatientNext(false)">下一位</el-button>
+          <el-button type="primary" @click="clickPatientNext(false)"
+            >下一位
+          </el-button>
         </el-button-group>
       </div>
     </header>
     <div class="layout_main">
-      <emr-main
-          v-if="show"
-          ref="emrMainRef"/>
+      <emr-main v-if="show" ref="emrMainRef" />
     </div>
   </div>
 
-  <LoadingProgress :describes="describes"
-                   loading-name="病历加载中"
-                   ref="progressRef"/>
+  <LoadingProgress
+    :describes="describes"
+    loading-name="病历加载中"
+    ref="progressRef"
+  />
 </template>
 
 <script setup lang="tsx">
-import {getDisPatient, getPatientInfo} from "@/api/zhu-yuan-yi-sheng/emr-patient";
+import {
+  getDisPatient,
+  getPatientInfo,
+} from "@/api/zhu-yuan-yi-sheng/emr-patient";
 import router from "@/router";
-import {BizException, ExceptionEnum} from "@/utils/BizException";
-import {getServerDateApi} from "@/api/public-api";
-import {subtractTime} from "@/utils/date";
+import { BizException, ExceptionEnum } from "@/utils/BizException";
+import { getServerDateApi } from "@/api/public-api";
+import { subtractTime } from "@/utils/date";
 import {
   applicationData,
   canIUnlockIt,
   emrConfig,
   emrMitt,
+  emrStateEnum,
+  patientInfo,
   query,
   resolveRoute,
   unlockEnum,
-  patientInfo, emrStateEnum, useLiftingRestrictions,
+  useLiftingRestrictions,
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
-import {getMyUnlockByPatNo} from "@/api/zhu-yuan-yi-sheng/emr-control-rule";
-import {ElMessage, ElMessageBox, ElNotification} from "element-plus";
+import { getMyUnlockByPatNo } from "@/api/zhu-yuan-yi-sheng/emr-control-rule";
+import {
+  ElButton,
+  ElMessage,
+  ElMessageBox,
+  ElNotification,
+} from "element-plus";
 import LoadingProgress from "@/components/loading-progress/LoadingProgress.vue";
-import {ref, onMounted, nextTick} from 'vue'
-import {CyMessageBox} from "@/components/cy/message-box";
+import { defineAsyncComponent, nextTick, onMounted, ref } from "vue";
+import { CyMessageBox } from "@/components/cy/message-box";
 import sleep from "@/utils/sleep";
-import {isDev, windowBtoaAndAtob} from "@/utils/public";
-import {useUserStore} from "@/pinia/user-store";
+import { isDev, windowBtoaAndAtob } from "@/utils/public";
+import { useUserStore } from "@/pinia/user-store";
 import useCompRef from "@/utils/useCompRef";
-import {defineAsyncComponent} from 'vue';
-import {cptSex} from "@/utils/computed";
-import {getOverView} from "@/api/inpatient/patient";
+import { cptSex } from "@/utils/computed";
+import { getOverView } from "@/api/inpatient/patient";
 import XEUtils from "xe-utils";
-import {ElButton} from "element-plus";
 
-const EmrLeaveHospitalPatient = defineAsyncComponent(() =>
-    import('@/components/zhu-yuan-yi-sheng/emr/EmrLeaveHospitalPatient.vue'));
-const EmrSelectPat = defineAsyncComponent(() => import('@/components/zhu-yuan-yi-sheng/EmrSelectPat.vue'));
-const EmrMain = defineAsyncComponent(() =>
-    import('@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/EmrMain.vue'));
-const EmrHeader = defineAsyncComponent(() => import('./EmrHeader.vue'))
-
-const emrMainRef = useCompRef(EmrMain)
+const EmrLeaveHospitalPatient = defineAsyncComponent(
+  () => import("@/components/zhu-yuan-yi-sheng/emr/EmrLeaveHospitalPatient.vue")
+);
+const EmrSelectPat = defineAsyncComponent(
+  () => import("@/components/zhu-yuan-yi-sheng/EmrSelectPat.vue")
+);
+const EmrMain = defineAsyncComponent(
+  () =>
+    import(
+      "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/EmrMain.vue"
+    )
+);
+const EmrHeader = defineAsyncComponent(() => import("./EmrHeader.vue"));
+
+const emrMainRef = useCompRef(EmrMain);
 // 是否显示页面
-const show = ref(false)
+const show = ref(false);
 
-const queryPatNo = ref('')
+const queryPatNo = ref("");
 
 // 点击查询出院患者
 const disPatients = async () => {
   if (query.value.times === 0 || !query.value.patNo) {
-    BizException(ExceptionEnum.MESSAGE_ERROR, '请输入住院号,住院次数不能为 0 ')
+    BizException(
+      ExceptionEnum.MESSAGE_ERROR,
+      "请输入住院号,住院次数不能为 0 "
+    );
   }
-  query.value.state = 2
-  let te = JSON.stringify(query.value)
-  await router.push('/myEmrEditor/' + window.btoa(te))
-  location.reload()
-}
+  query.value.state = 2;
+  let te = JSON.stringify(query.value);
+  await router.push("/myEmrEditor/" + window.btoa(te));
+  location.reload();
+};
 
 const noPatient = () => {
   CyMessageBox({
     showInput: true,
-    cancelButtonText: '出院',
-    confirmButtonText: '在院',
+    cancelButtonText: "出院",
+    confirmButtonText: "在院",
     closeOnPressEscape: false,
     closeOnClickModal: false,
-    message: '住院号',
+    message: "住院号",
     showIcon: false,
-    beforeClose: (inputValue) => {
+    beforeClose: inputValue => {
       if (inputValue.length === 0) {
-        ElMessage.error('请输入住院号')
-        return false
+        ElMessage.error("请输入住院号");
+        return false;
       }
-      return true
-    }
-  }).then(({action, value}) => {
-    query.value.patNo = value
-    allPatientsInTheHospital()
-  }).catch(({action, value}) => {
-    if (action === 'cancel') {
-      query.value.patNo = value
-      emrMitt.emit('queryDischarge')
-    }
+      return true;
+    },
   })
+    .then(({ action, value }) => {
+      query.value.patNo = value;
+      allPatientsInTheHospital();
+    })
+    .catch(({ action, value }) => {
+      if (action === "cancel") {
+        query.value.patNo = value;
+        emrMitt.emit("queryDischarge");
+      }
+    });
   sleep(500).then(() => {
-    progressRef.value.close()
-  })
-}
+    progressRef.value.close();
+  });
+};
 
 // 解析路由数据
 const routerFunc = async () => {
-  emrMainRef.value?.closeWebSocket()
-  show.value = false
+  emrMainRef.value?.closeWebSocket();
+  show.value = false;
   if (!router.currentRoute.value.params.pat) {
-    noPatient()
-    return
+    noPatient();
+    return;
   }
   try {
-    resolveRoute(router.currentRoute.value.params.pat)
+    resolveRoute(router.currentRoute.value.params.pat);
   } catch (e) {
-    console.error(e)
-    noPatient()
-    return
+    console.error(e);
+    noPatient();
+    return;
   }
   // @ts-ignore
-  let reqUnlock = await getMyUnlockByPatNo(query.value.patNo, query.value.times).catch(e => {
+  let reqUnlock = await getMyUnlockByPatNo(
+    query.value.patNo,
+    query.value.times
+  ).catch(e => {
     return null;
-  })
+  });
   if (reqUnlock != null) {
-    reqUnlock.unlockJson = JSON.parse(reqUnlock.unlockJson)
-    applicationData.value = reqUnlock
+    reqUnlock.unlockJson = JSON.parse(reqUnlock.unlockJson);
+    applicationData.value = reqUnlock;
   } else {
     // @ts-ignore
-    applicationData.value = null
+    applicationData.value = null;
   }
   // 在院编辑病历
   if (query.value.state === 1) {
-    await getPatientInfo(query.value.patNo).then(res => {
-      patientInfo.value.$inOutFlag = 1;
-      patientInfo.value = res
-      show.value = true
-    }).catch(() => {
-      progressRef.value.close()
-    });
+    await getPatientInfo(query.value.patNo)
+      .then(res => {
+        patientInfo.value.$inOutFlag = 1;
+        patientInfo.value = res;
+        show.value = true;
+      })
+      .catch(() => {
+        progressRef.value.close();
+      });
   } else if (query.value.state === 2) {
     // 出院编辑病历,
-    await queryDisPatient()
+    await queryDisPatient();
   } else if (query.value.state === 4) {
     // 在院只读病历
     patientInfo.value = await getPatientInfo(query.value.patNo);
     patientInfo.value.$inOutFlag = 1;
-    await queryAllPatients(false)
+    await queryAllPatients(false);
   } else if (query.value.state === 5) {
     // 出院只读病历
-    await queryDisPatient()
-    emrConfig.value.editor = false
+    await queryDisPatient();
+    emrConfig.value.editor = false;
   }
-}
-
+};
 
 // 查询出院患者信息
 const queryDisPatient = async () => {
-  patientInfo.value = await getDisPatient(query.value.patNo, query.value.times)
-  patientInfo.value.$inOutFlag = 2
-  patientInfo.value.dischargeDays = subtractTime(await getServerDateApi(), patientInfo.value.disDate)
+  patientInfo.value = await getDisPatient(query.value.patNo, query.value.times);
+  patientInfo.value.$inOutFlag = 2;
+  patientInfo.value.dischargeDays = subtractTime(
+    await getServerDateApi(),
+    patientInfo.value.disDate
+  );
 
   // 如果患者的出院时间大于 7 天就只能看病历和打印病历了
   emrConfig.value.editor = (patientInfo.value!.dischargeDays as number) <= 7;
 
   // 如果超过了七天就去查看是否有申请编辑
   if (!emrConfig.value.editor) {
-    emrConfig.value.editor = canIUnlockIt(unlockEnum.出院编辑)
+    emrConfig.value.editor = canIUnlockIt(unlockEnum.出院编辑);
   }
 
   if (!emrConfig.value.editor) {
-    const message = '患者出院超7天,无法编辑病历,如需编辑请点击【解锁限制】,待审核完成后刷新页面即可。'
+    const message =
+      "患者出院超7天,无法编辑病历,如需编辑请点击【解锁限制】,待审核完成后刷新页面即可。";
     const notification = ElNotification({
       message: (
-          <div>
-            <div>
-              {message}
-            </div>
-            <div style={{textAlign: 'end'}}>
-              <ElButton
-                  text
-                  type="danger"
-                  onClick={() => notification.close()}
-              >
-                {{
-                  default: () => '关闭'
-                }}
-              </ElButton>
-              <ElButton
-                  text
-                  type="primary"
-                  onClick={() => {
-                    useLiftingRestrictions()
-                    notification.close()
-                  }}
-              >
-                {{
-                  default: () => '解锁限制'
-                }}
-              </ElButton>
-            </div>
+        <div>
+          <div>{message}</div>
+          <div style={{ textAlign: "end" }}>
+            <ElButton text type="danger" onClick={() => notification.close()}>
+              {{
+                default: () => "关闭",
+              }}
+            </ElButton>
+            <ElButton
+              text
+              type="primary"
+              onClick={() => {
+                useLiftingRestrictions();
+                notification.close();
+              }}
+            >
+              {{
+                default: () => "解锁限制",
+              }}
+            </ElButton>
           </div>
+        </div>
       ),
       duration: 1000 * 10,
-      type: 'warning',
-      position: 'bottom-right'
-    })
+      type: "warning",
+      position: "bottom-right",
+    });
   }
 
   if (isDev) {
@@ -241,121 +276,127 @@ const queryDisPatient = async () => {
   }
 
   show.value = true;
-}
+};
 
 // 点击全院患者数据
 const allPatientsInTheHospital = async () => {
   if (!queryPatNo.value) {
-    BizException(ExceptionEnum.MESSAGE_ERROR, '请输入住院号。 ')
+    BizException(ExceptionEnum.MESSAGE_ERROR, "请输入住院号。 ");
   }
-  query.value.patNo = queryPatNo.value
-  query.value.state = 1
-  const te = windowBtoaAndAtob.btoa(query.value)
-  await router.push('/myEmrEditor/' + te)
-  location.reload()
-}
-
-
-const queryAllPatients = async (flag) => {
-  query.value.times = patientInfo.value!.admissTimes as number
-  show.value = true
-  emrConfig.value.editor = flag
-}
-
-const channel = new BroadcastChannel('login-channel');
-channel.addEventListener('message', (event) => {
-  if (navigator.userAgent.indexOf("Firefox") !== -1 || navigator.userAgent.indexOf("Chrome") !== -1) {
-    emrMainRef.value!.changeClear()
+  query.value.patNo = queryPatNo.value;
+  query.value.state = 1;
+  const te = windowBtoaAndAtob.btoa(query.value);
+  await router.push("/myEmrEditor/" + te);
+  location.reload();
+};
+
+const queryAllPatients = async flag => {
+  query.value.times = patientInfo.value!.admissTimes as number;
+  show.value = true;
+  emrConfig.value.editor = flag;
+};
+
+const channel = new BroadcastChannel("login-channel");
+channel.addEventListener("message", event => {
+  if (
+    navigator.userAgent.indexOf("Firefox") !== -1 ||
+    navigator.userAgent.indexOf("Chrome") !== -1
+  ) {
+    emrMainRef.value!.changeClear();
     window.location.href = "about:blank";
     window.close();
   } else {
-    emrMainRef.value!.changeClear()
+    emrMainRef.value!.changeClear();
     window.opener = null;
     window.open("", "_self");
     window.close();
   }
-})
+});
 
 const whetherKickedOut = () => {
-  const data = localStorage.getItem("强制刷新")
+  const data = localStorage.getItem("强制刷新");
   if (data) {
-    const {userInfo, saveSuccess} = JSON.parse(data)
+    const { userInfo, saveSuccess } = JSON.parse(data);
     // @ts-ignore
-    ElMessageBox.alert(`您已经被强制踢出,操作人:【${userInfo.name}】,您的病历保存【${saveSuccess ? '成功' : '失败'}】。`, '提示', {
-      type: 'warning',
-    }).then(() => {
-    }).catch(() => {
-    })
+    ElMessageBox.alert(
+      `您已经被强制踢出,操作人:【${userInfo.name}】,您的病历保存【${saveSuccess ? "成功" : "失败"}】。`,
+      "提示",
+      {
+        type: "warning",
+      }
+    )
+      .then(() => {})
+      .catch(() => {});
 
-    localStorage.removeItem("强制刷新")
+    localStorage.removeItem("强制刷新");
   }
-}
+};
 
-const progressRef = useCompRef(LoadingProgress)
+const progressRef = useCompRef(LoadingProgress);
 const describes = [
-  '被删除的病历可在回收站恢复,(如果出院了需要先召回)',
-  '粘贴内容时,鼠标右键文本粘贴或使用(ctrl + shift + v)',
-  '如果写错了尝试使用(ctrl + z / ctrl + y)',
-  '假的进度条,长时间未加载完成,按下F5',
+  "被删除的病历可在回收站恢复,(如果出院了需要先召回)",
+  "粘贴内容时,鼠标右键文本粘贴或使用(ctrl + shift + v)",
+  "如果写错了尝试使用(ctrl + z / ctrl + y)",
+  "假的进度条,长时间未加载完成,按下F5",
   "在管理员导入病历时,此页面无法使用,可以稍后刷新(大约 5 - 10 分钟)",
-  "在患者列表中打开的患者,都是只读模式"
-]
+  "在患者列表中打开的患者,都是只读模式",
+];
 
-const overViewList = ref([])
+const overViewList = ref([]);
 
 async function clickPatientNext(upper: boolean = true) {
-
-  let index = XEUtils.findIndexOf(overViewList.value, (item) => {
-    return item.inpatientNo === patientInfo.value.inpatientNo
-  })
+  let index = XEUtils.findIndexOf(overViewList.value, item => {
+    return item.inpatientNo === patientInfo.value.inpatientNo;
+  });
 
   if (index === -1) {
-    return
+    return;
   }
   if (upper) {
     if (index === 0) {
-      index = overViewList.value.length - 1
+      index = overViewList.value.length - 1;
     } else {
-      index -= 1
+      index -= 1;
     }
   } else {
     if (index === overViewList.value.length - 1) {
-      index = 0
+      index = 0;
     } else {
-      index += 1
+      index += 1;
     }
   }
   const item = overViewList.value[index];
   const data = {
     patNo: item.inpatientNo,
     times: item.admissTimes,
-    state: query.value.state
-  }
-  const te = windowBtoaAndAtob.btoa(data)
-  await router.push('/myEmrEditor/' + te)
-  window.location.reload()
+    state: query.value.state,
+  };
+  const te = windowBtoaAndAtob.btoa(data);
+  await router.push("/myEmrEditor/" + te);
+  window.location.reload();
 }
 
-watch(() => router.currentRoute.value, () => {
-  window.location.reload()
-}, {deep: true})
+watch(
+  () => router.currentRoute.value,
+  () => {
+    window.location.reload();
+  },
+  { deep: true }
+);
 
 onMounted(async () => {
-  await useUserStore().getUserInfo
-  whetherKickedOut()
-  emrMitt.on('closeProgress', () => {
-    progressRef.value!.close()
-  })
+  await useUserStore().getUserInfo;
+  whetherKickedOut();
+  emrMitt.on("closeProgress", () => {
+    progressRef.value!.close();
+  });
   if (!isDev) {
-    progressRef.value!.start()
+    progressRef.value!.start();
   }
   await nextTick();
   await routerFunc();
-  getOverView(patientInfo.value.ward).then((res) => {
-    overViewList.value = res
-  })
-})
-
+  getOverView(patientInfo.value.ward).then(res => {
+    overViewList.value = res;
+  });
+});
 </script>
-
-