浏览代码

新增结束就诊的按钮,以及退出电子病历了就关闭socket连接

xiaochan 3 周之前
父节点
当前提交
417535368a
共有 3 个文件被更改,包括 29 次插入0 次删除
  1. 8 0
      src/api/mz-emr/mz-emr.ts
  2. 12 0
      src/views/mz-emr/emr-v2/comp/MzEmrFun.vue
  3. 9 0
      src/views/mz-emr/emr-v2/index.tsx

+ 8 - 0
src/api/mz-emr/mz-emr.ts

@@ -107,3 +107,11 @@ export function print(documentId) {
     params: { documentId },
   });
 }
+
+export function endOfVisit(patientNo, times) {
+  return requestV2({
+    url: "/mzEmr/endOfVisit",
+    method: "get",
+    params: { patientNo, times },
+  });
+}

+ 12 - 0
src/views/mz-emr/emr-v2/comp/MzEmrFun.vue

@@ -1,6 +1,7 @@
 <script setup lang="ts">
 import { useMzEmrStoreKey, UseMzEmrStoreType } from "@/views/mz-emr/emr-v2";
 import { ElMessageBox } from "element-plus";
+import { endOfVisit, print } from "@/api/mz-emr/mz-emr";
 
 const { store, userInfo, emrMutation, mutation } = inject(
   useMzEmrStoreKey
@@ -14,6 +15,7 @@ async function handlePrint(name: string) {
       type: "warning",
     }
   );
+  await print(emrMutation.getId());
   emrMutation.print(name);
 }
 
@@ -53,6 +55,16 @@ const funs = [
       },
     ],
   },
+  {
+    name: "结束就诊",
+    fun: () => {
+      ElMessageBox.confirm("是否结束就诊。", "提示", {
+        type: "warning",
+      }).then(() => {
+        endOfVisit(store.patientInfo.patientId, store.patientInfo.times);
+      });
+    },
+  },
 ];
 </script>
 

+ 9 - 0
src/views/mz-emr/emr-v2/index.tsx

@@ -24,6 +24,7 @@ import { useEmrCaSignUtils } from "@/views/mz-emr/emr-v2/useEmrCaSign";
 import { isDev } from "@/utils/public";
 import { useDialog } from "@/components/cy/CyDialog/index";
 import env from "@/utils/setting";
+import { onDeactivated, onBeforeMount } from "vue";
 
 interface PatientInfo {
   patientId: string;
@@ -462,6 +463,14 @@ export const useMzEmrStore = () => {
       );
     }
 
+    onDeactivated(() => {
+      editSocket.socket.close();
+    });
+
+    onBeforeMount(() => {
+      editSocket.socket.close();
+    });
+
     await useUserStore().getUserInfo;
     const url = XEUtils.parseUrl(window.location.href);