Sfoglia il codice sorgente

电子病历优化

xiaochan 1 anno fa
parent
commit
84ccc5a000

+ 3 - 1
src/api/zhu-yuan-yi-sheng/jian-yan-jian-cha-shen-qing.js

@@ -1,4 +1,5 @@
 import request from "@/utils/request";
+import requestV2 from "@/utils/request-v2";
 
 let url = '/jianYanJianChaShenQing/'
 
@@ -182,8 +183,9 @@ export function getJyItem(code) {
 }
 
 export function getAncillaryInformation(patNo, times) {
-    return request({
+    return requestV2({
         url: url + 'getAncillaryInformation',
+        showLoading: false,
         method: 'get',
         params: {patNo, times}
     })

+ 0 - 85
src/components/zhu-yuan-yi-sheng/emr/EmrEditorTool.vue

@@ -1,85 +0,0 @@
-<template>
-  <div class="emr_editor_tool">
-    <el-select v-model="emrStyle.fontFamily"
-               ref="fontFamilyRef"
-               @change="styleFunc('fontFamily',emrStyle.fontFamily)"
-               style="width: 150px;">
-      <el-option v-for="item in availableFonts" :value="item.font" :label="item.text"/>
-    </el-select>
-
-    <el-select v-model="emrStyle.fontSize">
-
-    </el-select>
-
-  </div>
-</template>
-
-<script setup name='EmrEditorTool' lang="ts">
-import {availableFonts} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
-import {defineProps, ref} from 'vue'
-
-const props = defineProps({
-  editor: {
-    type: Object
-  },
-  getEdit: {
-    type: Function
-  }
-})
-
-let emrStyle = $ref({
-  // 字体样式
-  fontFamily: '"Microsoft YaHei"',
-  // 字体大小
-  fontSize: '10.5pt',
-  // 字体加粗
-  fontWeight: 'normal',
-  // 斜体
-  fontStyle: 'normal',
-  // 设置字体下划线、删除线
-  underline: 'none'
-})
-
-const fontFamilyRef = ref(null)
-
-const blur = () => {
-  fontFamilyRef.value.blur()
-}
-
-const styleFunc = (name, value) => {
-  emrStyle[name] = value
-  console.log(props.getEdit())
-  props.getEdit().execute(name, {value: value})
-  // props.editor.execute(name, {value: value})
-}
-
-const styleFuncNormal = (name, style) => {
-  let value = emrStyle[name]
-  styleFunc(name, value === 'normal' ? style : 'normal')
-}
-
-const updateStyleValue = (context) => {
-  emrStyle.fontSize = context.fontSize
-  emrStyle.fontFamily = context.fontFamily
-  emrStyle.fontStyle = context.italic ? 'oblique' : 'normal'
-  emrStyle.fontWeight = context.bold ? 'bold' : 'normal'
-}
-
-const emrContextUpdate = (value) => {
-  blur()
-  updateStyleValue(value)
-}
-
-defineExpose({
-  emrContextUpdate
-})
-
-</script>
-
-<style scoped lang="scss">
-.emr_editor_tool {
-  width: 100%;
-  height: 30px;
-  background-color: #f0f0f0
-}
-</style>

+ 0 - 2
src/components/zhu-yuan-yi-sheng/emr/EmrSnippet.vue

@@ -64,7 +64,6 @@ const defaultProps = {
   label: 'name',
 }
 
-
 const editorEvents = {
   'ready': (event) => {
     currentEmr.value.callMethod('setDocument', selectedData, true, true)
@@ -99,7 +98,6 @@ const fragmentPreview = (event, data, node) => {
       currentEmr.value = new EMRInteractive(patientData, editorEvents);
       emrRef.value.parentElement.emr = currentEmr.value
     });
-
   }
 }
 

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

@@ -188,14 +188,11 @@
                showIframe === 3 ||
                showIframe === 5">
             <div style="position: relative">
-
               <emr-popup ref="popupRef"
                          @fill-data="popupFunc.fillData"/>
-
               <emr-web-socket :pat-info="props.huanZheXinXi"
                               :current-editor-user="currentEditorUser"
                               ref="emrSocket"/>
-
               <div class="creator_prompt">
                 <div>
                   创建:{{ createName }}
@@ -218,9 +215,11 @@
                 </div>
 
               </div>
-              <iframe ref="emrRef"
-                      :height="iframeHeight() "
-                      :src="caseHistoryUrl"/>
+              <div class="编辑器挂载点">
+                <iframe ref="emrRef"
+                        :height="iframeHeight() "
+                        :src="caseHistoryUrl"/>
+              </div>
             </div>
           </div>
 
@@ -499,7 +498,6 @@ const emrEvent = {
       }
     }
   },
-
   'contentchange': (e, op) => {
     if (op.batch.type === 'persist') return
     if (!readonlyPattern()) {
@@ -511,16 +509,13 @@ const emrEvent = {
       }
     }
   },
-
   'contextUpdate': (evt, contextMap, component, context) => {
     styleBarRef.value.setEmrStyleV2(context)
     try {
       console.log('当前数据元', component.getAttribute('element').name);
     } catch {
-
     }
   },
-
   'ready': (event) => {
     setEditor()
     popupFunc.setShortcutKey()
@@ -1386,7 +1381,7 @@ const paginationSymbol = () => {
   editor.execute('insertContents', {value: [{type: 'pagebreak'}]})
 }
 
-const styleBarRef = ref(null)
+const styleBarRef = ref()
 
 /**
  * 解析 iframe 上面的参数保证一致

+ 7 - 6
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/EmrRecycleBin.vue

@@ -92,16 +92,17 @@ const opened = async () => {
   iframe.src = '/emr/runtime/#/editor'
   iframe.height = '100%'
   iframe.width = '100%'
-
   emrRef.value.appendChild(iframe)
 
-  iframe.onload = () => {
-    edit = iframe.contentWindow['getEditor']()
-    edit.on('ready', () => {
+  emrRef.value['emr'] = {
+    setEditor: (e, r) => {
+      edit = e
       preparing.value = false
-    })
+    },
+    getAppContext: () => {
+      return {}
+    }
   }
-
 }
 
 onMounted(() => {

+ 64 - 0
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init-v2.ts

@@ -0,0 +1,64 @@
+interface Options {
+    appContext?: any,
+    event?: {
+        [key: string]: (...val: any[]) => void,
+    },
+    onMounted?: () => void,
+}
+
+export class emrInit {
+    iframe: HTMLIFrameElement = document.createElement('iframe')
+    editor: any = null
+    runtime: any = null
+    isLoad = true
+    options: Options = null
+    onMounted = null
+
+    constructor(div: HTMLDivElement, options?: Options) {
+        if (options && options.onMounted) {
+            this.onMounted = options.onMounted
+        }
+        if (div['emr']) {
+            throw new Error('该div已挂载请选择其他div')
+        }
+        this.options = options
+        this.iframe.style.width = '100%'
+        this.iframe.style.height = '100%'
+        this.iframe.src = '/emr/runtime/#/editor'
+        this.iframe.style.border = '0'
+        div.appendChild(this.iframe)
+        this.init(div)
+    }
+
+    init(div: HTMLDivElement) {
+        div['emr'] = {
+            tempThis: this,
+            setEditor(e: any, r: any) {
+
+                this.tempThis.editor = e
+                this.tempThis.runtime = r
+                this.tempThis.isLoad = false
+
+                this.tempThis.onMounted && this.tempThis.onMounted()
+
+                if (this.tempThis.options && this.tempThis.options.event) {
+                    for (let key in this.tempThis.options.event) {
+                        e.on(key, this.tempThis.options.event[key])
+                    }
+                }
+
+            },
+            getAppContext() {
+                if (this.tempThis.options && this.tempThis.options.appContext) {
+                    return this.tempThis.options.appContext
+                }
+                return {}
+            }
+        }
+    }
+
+    public setUrl(url: string) {
+        this.iframe.src = url
+    }
+
+}

+ 4 - 2
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init.js

@@ -63,8 +63,10 @@ export function EMRInteractive(data, editorEvent) {
             }, input: {
                 user: store.state.user.info.code, name: store.state.user.info.name
             }, login: {
-                token: store.state.user.info.token, user: {
-                    id: store.state.user.info.code, name: store.state.user.info.name,
+                token: store.state.user.info.token,
+                user: {
+                    id: store.state.user.info.code,
+                    name: store.state.user.info.name,
                 }
             }, data
         }

+ 16 - 4
src/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng.ts

@@ -30,7 +30,22 @@ export interface PatInfo {
 }
 
 // 患者信息
-export const huanZheXinXi = ref<PatInfo>({zkWardName: "", zkWard: "", consultPhysician: "", deptDirector: "", referPhysician: "", groupInfoBl: "", groupInfoFeeStand: "", groupInfoName: "", groupInfoWeight: "", setGroupInfoProfit: "", ledgerSn: 0, admissTimes: 0, inpatientNo: null, admissDate: ''})
+export const huanZheXinXi = ref<PatInfo>({
+    zkWardName: "",
+    zkWard: "",
+    consultPhysician: "",
+    deptDirector: "",
+    referPhysician: "",
+    groupInfoBl: "",
+    groupInfoFeeStand: "",
+    groupInfoName: "",
+    groupInfoWeight: "",
+    setGroupInfoProfit: "",
+    ledgerSn: 0,
+    admissTimes: 0,
+    inpatientNo: null,
+    admissDate: ''
+})
 // 是否点击了修改整个模板
 export const muBanMing = ref({})
 // 错误信息
@@ -697,8 +712,6 @@ export const clickOnThePatient = async (patNo: string) => {
     } else {
         await jsQueryYzData();
     }
-
-
     queryParam.value.frequCode = frequCodeEnum.all;
     queryParam.value.zhuangTai = 0;
     queryParam.value.displayRange = 2;
@@ -714,7 +727,6 @@ export const clickOnThePatient = async (patNo: string) => {
     }
 }
 
-
 const switchPatients = (): boolean => {
     let str = ''
     if (stringNotBlank(yiZhuData.value.actOrderNo) && yiZhuData.value.statusFlag === '1') {

+ 14 - 11
src/views/settings/Test.vue

@@ -1,20 +1,23 @@
 <template>
-
+  <div style="height: 100% ; width: 100%" ref="divRef">
+  </div>
 </template>
 
 <script setup lang="ts">
+import {onMounted, ref} from "vue";
+import {emrInit} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init-v2";
 
-const a = {
-  a: 1
-}
-
-function has(key) {
-
-  return new Promise()
-
-}
+const divRef = ref<HTMLDivElement>(null)
 
 
-has()
+onMounted(async () => {
+  const a = new emrInit(divRef.value, {
+    event: {
+      'ready': (val) => {
+        console.log(val)
+      }
+    }
+  })
+})
 
 </script>