Browse Source

优化电子病历解析

xiaochan 1 year ago
parent
commit
30154e5b45

+ 0 - 64
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/OrderProgress.vue

@@ -1,64 +0,0 @@
-<template>
-  <div class="order__progress" v-show="isShow()">
-    <div>
-      X
-    </div>
-    <div class="steps__mian">
-      <el-steps direction="vertical" :active="active">
-        <el-step v-for="(item,index) in stepList"
-                 :title="item"
-                 :description="descriptionFunc(index)"/>
-      </el-steps>
-    </div>
-  </div>
-</template>
-
-<script setup name='OrderProgress'>
-let stepList = ['录入医嘱', '确认医嘱', '执行医嘱', '停止医嘱']
-const descriptionList = ref([])
-const active = ref(1)
-
-const isShow = () => {
-  return false
-}
-
-const descriptionFunc = (index) => {
-  return descriptionList.value[index]
-}
-const fillOrder = (val) => {
-  descriptionList.value = []
-  active.value = parseInt(val.statusFlag)
-  if (val.statusFlag === '4') {
-    active.value = 3
-  } else if (val.statusFlag === '5') {
-    active.value = 4
-  }
-
-  descriptionList.value.push(val.enterOperName + '\n' + val.enterTime)
-  if (val.confirmTime) {
-    descriptionList.value.push(val.signerName + ' ' + val.confirmTime)
-  }
-}
-
-defineExpose({
-  fillOrder
-})
-
-</script>
-
-<style scoped lang="scss">
-.order__progress {
-  width: 190px;
-  height: 100%;
-  top: 0;
-  right: 0;
-  position: fixed;
-
-  background-color: white;
-  z-index: 999;
-
-  .steps__mian {
-    height: calc(100% - 40%);
-  }
-}
-</style>

+ 28 - 35
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/RationalDrugUseWindow.vue

@@ -1,19 +1,19 @@
 <template>
-  <xc-dialog-v2 v-model="dialog" title="合理用药提示"
-                :manual-shutdown="true">
+  <el-dialog v-model="dialog" title="合理用药提示"
+             :close-on-press-escape="false"
+             :close-on-click-modal="false">
     <div style="width: 100%;height: 500px">
-      <iframe :src="rationalUse.ShowUrl"/>
+      <iframe :src="rationalUse.ShowUrl" width="100%" height="100%"/>
     </div>
     <template #footer>
       <el-button type="danger" @click="dialog = false">close</el-button>
       <el-button type="primary" @click="continueToSubmit">继续提交</el-button>
     </template>
-  </xc-dialog-v2>
+  </el-dialog>
 </template>
 
-<script setup name='RationalDrugUseWindow'>
+<script setup>
 import {auditingInterface, rationalUseOfMedicine} from "@/api/heliyongyao/rational-use";
-import XcDialogV2 from "@/components/xiao-chan/dialog/XcDialogV2.vue";
 import {xcMessage} from "@/utils/xiaochan-element-plus";
 
 const emit = defineEmits(['submit'])
@@ -22,50 +22,43 @@ const dialog = ref(false)
 const rationalUse = ref({})
 
 const check = async (patNo, times) => {
-  try {
-    rationalUse.value = await rationalUseOfMedicine(patNo, times);
-    console.log(rationalUse.value);
-    if (rationalUse.value.result_lv > 0) {
-      dialog.value = true
-      return false
-    }
-  } catch (e) {
-    return true
+  rationalUse.value = await rationalUseOfMedicine(patNo, times).catch(() => {
+    return true;
+  });
+  if (rationalUse.value.result_lv > 0) {
+    dialog.value = true
+    return false
   }
   return true
 }
 
 
 const continueToSubmit = async () => {
-  try {
-    let temp = await auditingInterface(rationalUse.value.getResultUrl)
-    if ((temp.success && temp.resultcode === 0) || temp.resultcode === -1) {
-      // 审核通过
-      xcMessage.success(temp.sh_msg ? temp.sh_msg : '审核通过。');
-      emit('submit')
-      dialog.value = false
-    } else if (temp.success && temp.resultcode === 1) {
-      // 审核不通过
-      xcMessage.error(temp.sh_msg);
-    } else if (temp.resultcode === 0 && !temp.success) {
-      // 待审核中
-      xcMessage.error('请点击继续保存后,等待审核完成,点击继续提交。');
-    }
-  } catch (e) {
+  const temp = await auditingInterface(rationalUse.value.getResultUrl)
+      .catch(() => {
+        emit('submit')
+        dialog.value = false
+      })
+  if ((temp.success && temp.resultcode === 0) || temp.resultcode === -1) {
+    // 审核通过
+    xcMessage.success(temp.sh_msg ? temp.sh_msg : '审核通过。');
     emit('submit')
     dialog.value = false
+  } else if (temp.success && temp.resultcode === 1) {
+    // 审核不通过
+    xcMessage.error(temp.sh_msg);
+  } else if (temp.resultcode === 0 && !temp.success) {
+    // 待审核中
+    xcMessage.error('请点击继续保存后,等待审核完成,点击继续提交。');
   }
+
 }
 
 defineExpose({
   check
 })
-
 </script>
 
 <style scoped lang="scss">
-iframe {
-  width: 100%;
-  height: 100%;
-}
+
 </style>

+ 2 - 2
src/views/data-base/src/data-base-axios.ts → src/utils/database/magic-api-request.ts

@@ -1,6 +1,6 @@
 import axios, {AxiosRequestConfig} from "axios";
-import {userInfoStore} from "../../../utils/store-public";
-import {xcMessage} from "../../../utils/xiaochan-element-plus";
+import {userInfoStore} from "../store-public";
+import {xcMessage} from "../xiaochan-element-plus";
 
 const service = axios.create({
     // @ts-ignore

+ 63 - 2
src/utils/emr/emr-init-v2.ts

@@ -1,5 +1,7 @@
 import {EditType, Runtime} from './edit'
 import {UnwrapRef} from 'vue'
+import {BizException, ExceptionEnum} from "../BizException";
+import {ElMessageBox} from "element-plus";
 
 type AppContext =
     | any
@@ -15,13 +17,50 @@ interface Options {
     tabletMode?: boolean
 }
 
+function changeRatio() {
+    let ratio = 0;
+    const screen = window.screen;
+    const ua = navigator.userAgent.toLowerCase();
+
+    if (window.devicePixelRatio !== undefined) {
+        ratio = window.devicePixelRatio;
+    } else if (~ua.indexOf('msie')) {
+        // @ts-ignore
+        if (screen.deviceXDPI && screen.logicalXDPI) {
+            // @ts-ignore
+            ratio = screen.deviceXDPI / screen.logicalXDPI;
+        }
+
+    } else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
+        ratio = window.outerWidth / window.innerWidth;
+    }
+
+    if (ratio) {
+        ratio = Math.round(ratio * 100);
+    }
+    return ratio;
+}
+
+const pageIsZoom = () => {
+    const rate = changeRatio();
+    if (rate !== 100) {
+        ElMessageBox.alert("当前页面不是100%显示,请按键盘ctrl+0恢复100%显示标准,如果页面是100%缩放请检查系统缩放(可自行百度),设置=》屏幕缩放(选择100%),以防页面显示错乱,以及续打对不准!", '提示', {
+            type: "warning"
+        }).then(() => {
+        }).catch(() => {
+        })
+    }
+}
+
+
 export interface UseEmrInitReturn {
     editor?: EditType
     runtime?: Runtime
     iframe?: HTMLIFrameElement
     delElementByName?: (name: string) => void
     loadDocument?: (loadParams: LoadParams) => Promise<any>
-    loadAndSetDocument?: (loadParams: LoadParams) => Promise<any>
+    loadAndSetDocument?: (loadParams: LoadParams) => Promise<any>,
+    print?: (value?: 'html' | 'server') => void
 }
 
 export interface LoadParams {
@@ -116,6 +155,27 @@ export function useEmrInit(
             })
         }
 
+        async function print(value: 'html' | 'server' = 'html') {
+            const documentId = editor.documentData._id
+            if (documentId == null) {
+                BizException(ExceptionEnum.MESSAGE_ERROR, "请先保存病历。");
+            }
+            const document = await loadDocument({documentId}).catch(e => {
+                BizException(ExceptionEnum.MESSAGE_ERROR, "网络错误无法保存。");
+            })
+
+            if (value === 'html') {
+                pageIsZoom()
+            }
+            editor.execute("print", {
+                value: {
+                    showPreview: true,
+                    document,
+                    mode: value === 'server' ? 'backend' : ''
+                }
+            })
+        }
+
         // @ts-ignore
         div['emr'] = {
             setEditor: (e: EditType, r: any): void => {
@@ -140,7 +200,8 @@ export function useEmrInit(
                     iframe,
                     delElementByName: (name: string) => delElementByName(name, editor),
                     loadDocument,
-                    loadAndSetDocument
+                    loadAndSetDocument,
+                    print
                 })
             },
             getAppContext: (): any => {

+ 2 - 2
src/views/data-base/DataBase.vue

@@ -12,7 +12,8 @@ import DataBaseDialog from "@/views/data-base/components/DataBaseDialog.vue";
 const iframe = ref<HTMLIFrameElement>()
 // @ts-ignore
 const src = import.meta.env.VITE_DATA_BASE + '/magic/web/index.html'
-
+// const src = 'http://192.168.56.1:8991'
+// const src = 'http://172.16.32.160:9205/magic/web/index.html'
 const func = {
   'user': user
 }
@@ -46,7 +47,6 @@ onMounted(async () => {
     iframe.value.contentWindow.postMessage(JSON.stringify(data), '*')
   }
 })
-
 </script>
 
 <template>

+ 1 - 1
src/views/data-base/src/data-base-api.ts

@@ -1,4 +1,4 @@
-import request from "./data-base-axios";
+import request from "../../../utils/database/magic-api-request";
 import {SystemTokenType} from "./daba-base-type";
 
 export function getResourceWeb() {

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

@@ -799,7 +799,7 @@ const clickSaveData = async () => {
   if (stringNotBlank(editor.documentData._id)) {
     const documentSocket = emrMitt.emit('getDocumentSocket')
     if (documentSocket === null) {
-      await ElMessageBox.alert('未连接上服务器,无法保存', '提示', {
+      await ElMessageBox.alert('未连接上服务器,无法保存,请刷新页面,或重新打开病历。', '提示', {
         type: 'warning'
       })
       return
@@ -937,30 +937,14 @@ const objectValuesCannotBeNull = (object) => {
 
 // 前端打印
 const frontEndPrinting = async () => {
-  pageIsZoom()
   waitForLoadingToComplete()
-  if (getId() == null) {
-    xcMessage.warning('请先保存病历。')
-    return
-  }
-  const document = await hisSaveEmr.loadDocument({documentId: getId()})
-  editor.execute("print", {
-    value: {
-      showPreview: true,
-      document
-    }
-  })
+  editMain.print()
 }
 
 // 服务打印
 const servicePrint = () => {
   waitForLoadingToComplete()
-  editor.execute("print", {
-    value: {
-      showPreview: true,
-      mode: 'backend'
-    }
-  })
+  editMain.print('server')
 }
 
 /**
@@ -1216,6 +1200,18 @@ const courseSegmentLocking = async () => {
     return
   }
   let courseTitles = [];
+
+  function editorGetData(value, dataSource, code) {
+    if (value === null) return ''
+    if (value[dataSource] === null) return ''
+    if (value[dataSource].value === null) return ''
+    try {
+      return value[dataSource]?.value[0][code]
+    } catch {
+      return ''
+    }
+  }
+
   循环病程返回数据元((value, node) => {
     let fragment = node.getAttribute('fragment')
     let pushData = {
@@ -1225,21 +1221,19 @@ const courseSegmentLocking = async () => {
       emrDocumentId: getId(),
       emrCategoryCode: categoryCode.value,
       jump: true,
-      createName: value['编辑者']?.value[0].name,
+      createName: editorGetData(value, '编辑者', 'name'), //value['编辑者']?.value[0].name,
       createDate: value['查房时间']?.value,
-      createId: value['编辑者']?.value[0].code || fragment.createId,
+      createId: editorGetData(value, '编辑者', 'code') || fragment.createId, // value['编辑者']?.value[0].code || fragment.createId,
       type: 'category',
       trueCreationTime: '',
     }
-    if (typeof pushData.createId === 'undefined' || !pushData.createId) {
-      console.log(value, fragment)
-    }
+
     if (fragment != null) {
       pushData.trueCreationTime = fragment?.creationTime
     }
     courseTitles.push(pushData);
     if (emrConfig.value.editor) {
-      let editorCode = value['编辑者']?.value[0]?.code;
+      let editorCode = pushData.createId
       // 如果这个为空的话,就让她删了重新写,只能删除不能写
       if (stringIsBlank(editorCode)) {
         node.view.setReadonly(true);
@@ -1897,52 +1891,13 @@ const 循环病程返回数据元 = (callback) => {
   }
 }
 
-const pageIsZoom = () => {
-  let rate = changeRatio();
-  if (rate !== 100) {
-    ElMessageBox.alert("当前页面不是100%显示,请按键盘ctrl+0恢复100%显示标准,如果页面是100%缩放请检查系统缩放(可自行百度),设置=》屏幕缩放(选择100%),以防页面显示错乱,以及续打对不准!", '提示', {
-      type: "warning"
-    }).then(() => {
-    }).catch(() => {
-    })
-    return true
-  }
-  return false
-}
-
-function changeRatio() {
-  let ratio = 0;
-  const screen = window.screen;
-  const ua = navigator.userAgent.toLowerCase();
-
-  if (window.devicePixelRatio !== undefined) {
-    ratio = window.devicePixelRatio;
-  } else if (~ua.indexOf('msie')) {
-    // @ts-ignore
-    if (screen.deviceXDPI && screen.logicalXDPI) {
-      // @ts-ignore
-      ratio = screen.deviceXDPI / screen.logicalXDPI;
-    }
-
-  } else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
-    ratio = window.outerWidth / window.innerWidth;
-  }
-
-  if (ratio) {
-    ratio = Math.round(ratio * 100);
-  }
-  return ratio;
-}
-
 /**
  * 加载页面大纲
  */
 async function getOutline() {
   try {
     outlineData.value = editor.getOutline()
-    console.log(outlineData.value)
   } catch (e) {
-
   }
 }
 

+ 3 - 12
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/YiZhuLuRu.vue

@@ -37,7 +37,6 @@
                    :pat-no="huanZheXinXi.inpatientNo"
                    @close="allergen.dialog = false"/>
 
-    <order-progress ref="orderProgressRef"/>
     <!--  合理用药窗口  -->
     <rational-drug-use-window ref="reasonableRef" @submit="confirmOrder"/>
     <fee-table/>
@@ -76,7 +75,6 @@ import HuoQuMuBan from '@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/HuoQuMuBan.v
 import {xcMessage} from "@/utils/xiaochan-element-plus";
 import YaoPingXiangQing from "@/components/zhu-yuan-yi-sheng/he-li-yong-yao/YaoPingXiangQing.vue";
 import AllergenEntry from "@/components/zhu-yuan-yi-sheng/AllergenEntry.vue";
-import OrderProgress from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/OrderProgress.vue";
 import RationalDrugUseWindow from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/RationalDrugUseWindow.vue";
 import YzTableV2 from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/table/YzTableV2.vue";
 import FeeTable from "@/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/components/FeeTable.vue";
@@ -94,8 +92,6 @@ let allergen = ref({
   }
 })
 
-// 医嘱进度
-const orderProgressRef = ref(null)
 
 // 医嘱编辑
 const yzEditorRef = ref(null)
@@ -106,14 +102,10 @@ const reasonableRef = ref(null)
  * 确认医嘱 , 已经做过无患者的判断了
  */
 const confirmOrdersClick = async () => {
-  if (isDev) {
+  // 如果没有问题就可以直接确认医嘱了。
+  let temp = await reasonableRef.value.check(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes);
+  if (temp) {
     await confirmOrder()
-  } else {
-    // 如果没有问题就可以直接确认医嘱了。
-    let temp = await reasonableRef.value.check(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes);
-    if (temp) {
-      await confirmOrder()
-    }
   }
 }
 
@@ -128,7 +120,6 @@ const confirmOrder = async () => {
 }
 
 const rowClick = (val: YzType) => {
-  orderProgressRef.value.fillOrder(val)
   if (associateOrders.value.actOrderNo) {
     let index = associateOrders.value.associatedGroup.indexOf(val.actOrderNo)
     if (associateOrders.value.actOrderNo === val.actOrderNo) {