Browse Source

电子病历优化

DESKTOP-0GD05B0\Administrator 3 years ago
parent
commit
934298e4f7

+ 0 - 53
src/api/zhu-yuan-yi-sheng/emr-api.js

@@ -1,53 +0,0 @@
-import axios from "axios";
-import {getTree} from "@/utils/tree-utils";
-import {getPatientData} from "@/api/zhu-yuan-yi-sheng/emr-patient";
-
-let url = '/emr/runtime/api/v1/'
-
-const service = axios.create({
-    baseURL: url,
-    withCredentials: true,
-    timeout: 0,
-})
-
-service.interceptors.response.use(
-    (response) => {
-        if (response.status === 200) {
-            return response.data
-        } else {
-            return Promise.reject(response.message)
-        }
-    })
-
-export async function getEmrTree(patNo, times) {
-    let data = [], patientData = [], returnValue = {}
-
-    try {
-        data = await service({
-            url: 'category/tree',
-            method: 'get',
-        })
-    } catch (e) {
-    }
-
-    try {
-        patientData = await getPatientData(patNo, times);
-    } catch (e) {
-    }
-
-    returnValue = {
-        emrTree: getTree(data, "_id", "parent"),
-        patientTree: patientData
-    }
-    return returnValue
-}
-
-export async function getSnippet() {
-    let data = await service({
-        url: `snippet/list/tree`,
-        method: 'GET'
-    })
-    return getTree(data, '_id', 'parent')
-}
-
-

+ 36 - 7
src/api/zhu-yuan-yi-sheng/emr-patient.js

@@ -2,19 +2,47 @@ import request from "@/utils/request";
 
 let url = 'Emr/'
 
-export function insertEmrData(data) {
+/**
+ * 获取患者病历树状图
+ * @param patNo 住院号
+ * @param times 住院次数
+ * @returns {*} 返回数
+ */
+export function getPatientDataTree(patNo, times) {
     return request({
-        url: url + 'insertEmrData',
-        method: 'post',
-        data
+        url: url + 'getPatientDataTree',
+        method: 'get',
+        params: {patNo, times}
     })
 }
 
-export function getPatientData(patNo, times) {
+/**
+ * 获取电子病历的树状图
+ * @returns {*}
+ */
+export function getEmrTree() {
     return request({
-        url: url + 'getPatientData',
+        url: url + 'getEmrTree',
         method: 'get',
-        params: {patNo, times}
+    })
+}
+
+/**
+ * 获取病程片段
+ * @returns {*}
+ */
+export function getSnippetTree() {
+    return request({
+        url: url + 'getSnippetTree',
+        method: 'get',
+    })
+}
+
+export function insertEmrData(data) {
+    return request({
+        url: url + 'insertEmrData',
+        method: 'post',
+        data
     })
 }
 
@@ -52,3 +80,4 @@ export function submitMedicalRecord(documentId) {
 
 
 
+

+ 7 - 0
src/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru.js

@@ -101,6 +101,13 @@ export function huoQuYiZhuMuBan(code, deptCode, muBanLeiXing, currentPage, total
     })
 }
 
+export function getDoctorSOrderTemplateMaxSortNo() {
+    return request({
+        url: url + '/getDoctorSOrderTemplateMaxSortNo',
+        method: 'get',
+    })
+}
+
 export function huoQuMuBanShuJu(code) {
     return request({
         url: url + '/huoQuMuBanShuJu',

+ 5 - 0
src/components/xiao-chan/xc-table/XcTable.vue

@@ -197,6 +197,11 @@ let pageObject = $ref({
 
 let isLocalData = $ref(false)
 
+watch(() => props.localData, () => {
+  pageObject.data = props.localData
+  pageObject.total = props.localData.length
+})
+
 onMounted(() => {
   if (props.data !== null && props.localData !== null) {
     throw new Error('data 和 localData 不能同时使用')

+ 8 - 8
src/components/zhu-yuan-yi-sheng/HuanZheXinXi.vue

@@ -73,17 +73,17 @@
   </div>
 </template>
 
-<script>
-import {huanZheXinXi} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
+<script setup name="HuanZheXinXi">
 import {ref} from "vue";
 
-export default {
-  name: "HuanZheXinXi",
-  setup(props, cxt) {
-    const activeNames = ref('1')
-    return {huanZheXinXi, activeNames}
+const props = defineProps({
+  huanZheXinXi: {
+    type: Object
   }
-}
+})
+
+const activeNames = ref('1')
+
 </script>
 
 <style lang="scss" scoped>

+ 40 - 28
src/components/zhu-yuan-yi-sheng/emr/EmrSidebar.vue

@@ -1,6 +1,5 @@
 <template>
   <el-input v-model="filterText" placeholder="节点过滤" @input="filterChange" clearable/>
-
   <el-radio-group v-model="templateType" @change="typeChange">
     <el-radio-button :label="0">全院模板</el-radio-button>
     <el-radio-button :label="1">科室模板</el-radio-button>
@@ -12,6 +11,7 @@
              @node-click="handleNodeClick"
              node-key="_id"
              ref="treeRef"
+             highlight-current
              :filter-node-method="filterNode"
              default-expand-all>
       <template #default="{ node, data }">
@@ -29,21 +29,28 @@
 </template>
 
 <script setup name='EmrSidebar'>
-import {getEmrTree} from "@/api/zhu-yuan-yi-sheng/emr-api";
-import {huanZheXinXi} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
-import {getPatientData, queryWhetherThePatientHasASpecifiedMedicalRecord} from "@/api/zhu-yuan-yi-sheng/emr-patient";
+import {
+  getEmrTree,
+  getPatientDataTree,
+  queryWhetherThePatientHasASpecifiedMedicalRecord
+} from "@/api/zhu-yuan-yi-sheng/emr-patient";
 import {BizException, ExceptionEnum} from "@/utils/BizException";
 
 const props = defineProps({
   maxHeight: {
     type: Number
+  },
+  huanZheXinXi: {
+    type: Object
   }
 })
 
 const emit = defineEmits(['nodeClick', 'typeChange'])
 
-let treeData = $ref([])
-let returnData = $ref([])
+let returnData = $ref({
+  emrTree: [],
+  patientTree: []
+})
 let filterText = $ref('')
 let treeRef = $ref('')
 
@@ -56,13 +63,25 @@ const defaultProps = {
 
 let templateType = $ref(0)
 
+const treeData = computed(() => {
+  switch (templateType) {
+    case 0 :
+      return returnData.emrTree;
+    case 1:
+      return [];
+    case 2:
+      return returnData.patientTree;
+  }
+})
+
+
 const handleNodeClick = async (val, property, event) => {
   let temp = {}
   if (templateType === 0) {
     temp = {
       documentId: null,
       categoryCode: val.code,
-      categroyId: val._id,
+      categoryId: val._id,
       patientId: null,
       name: val.name
     }
@@ -70,7 +89,7 @@ const handleNodeClick = async (val, property, event) => {
     temp = {
       documentId: val.emrDocumentId,
       categoryCode: val.emrCategoryCode,
-      categroyId: null,
+      categoryId: null,
       patientId: null,
       name: val.emrName
     }
@@ -83,8 +102,8 @@ const handleNodeClick = async (val, property, event) => {
     // 根据 这个编码来限制是不是唯一一个
     if (val.labels.includes('唯一') && templateType !== 2) {
       let flag = await queryWhetherThePatientHasASpecifiedMedicalRecord({
-        patNo: huanZheXinXi.value.inpatientNo,
-        times: huanZheXinXi.value.admissTimes,
+        patNo: props.huanZheXinXi.inpatientNo,
+        times: props.huanZheXinXi.admissTimes,
         emrCategoryCode: val.code
       })
       if (flag) {
@@ -107,21 +126,12 @@ const handleNodeClick = async (val, property, event) => {
 }
 
 const typeChange = (val) => {
-  switch (val) {
-    case 0 :
-      return treeData = returnData.emrTree;
-    case 1:
-      return treeData = [];
-    case 2:
-      return treeData = returnData.patientTree;
-  }
   emit("typeChange", val)
 }
 
 const queryHistory = async (times) => {
   templateType = 2
-  returnData.patientTree = await getPatientData(huanZheXinXi.value.inpatientNo, times)
-  treeData = returnData.patientTree
+  returnData.patientTree = await getPatientDataTree(props.huanZheXinXi.inpatientNo, times)
 }
 
 const filterChange = (val) => {
@@ -181,19 +191,21 @@ const findMedicalRecordById = (id, roundTimes, list) => {
 
 
 const queryData = () => {
-  getEmrTree(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes).then((res) => {
-    if (res.patientTree?.length > 0) {
-      treeData = res.patientTree
+  getPatientDataTree(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes).then((res) => {
+    if (res?.length > 0) {
       templateType = 2
-    } else {
-      templateType = 0
-      treeData = res.emrTree
     }
-    returnData = res
-    console.log(res)
+    returnData.patientTree = res
   })
 }
 
+onMounted(() => {
+  queryData()
+  getEmrTree().then((res) => {
+    returnData.emrTree = res
+  })
+})
+
 defineExpose({
   queryHistory,
   changeTemplateType,

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

@@ -7,6 +7,7 @@
                @node-click="handleNodeClick"
                node-key="_id"
                ref="treeRef"
+               highlight-current
                :filter-node-method="filterNode"
                @node-contextmenu="fragmentPreview"
                :expand-on-click-node="false"
@@ -33,9 +34,9 @@
 
 <script setup name='EmrSnippet'>
 
-import {getSnippet} from "@/api/zhu-yuan-yi-sheng/emr-api";
 import {getWindowSize} from "@/utils/window-size";
 import {EMRInteractive} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-init";
+import {getSnippetTree} from "@/api/zhu-yuan-yi-sheng/emr-patient";
 
 
 const props = defineProps({
@@ -104,9 +105,8 @@ const setPatientData = (val) => {
 
 
 onMounted(() => {
-  getSnippet().then((res) => {
+  getSnippetTree().then((res) => {
     snippetData = res
-    // console.log(snippetData)
   })
 })
 

+ 1 - 1
src/components/zhu-yuan-yi-sheng/hui-zhen-shen-qing/TianJiaHuiZhenShenQing.vue

@@ -197,7 +197,7 @@ const huiZhenYiShengPanDuan = (val) => {
 
 //远程搜索会诊科室
 const remoteMethodHuiZhenKeShi = (val) => {
-  if (val !== '' && val.length > 1) {
+  if (val !== '' && val.length > 0) {
     queryDept(val)
         .then((res) => {
           deptList.value = res

+ 29 - 6
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/BaoCunMuBan.vue

@@ -1,5 +1,7 @@
 <template>
-  <el-dialog v-model="dialog" title="保存模板">
+  <el-dialog v-model="dialog"
+             title="保存模板"
+             @closed="emit('update:modelValue',false)">
     模板名称:
     <el-input v-model="patternName" maxlength="50" show-word-limit style="width: 220px"
               @keyup.enter="dianJiBaoCun"></el-input>
@@ -13,8 +15,8 @@
       </el-radio-group>
     </div>
     <br><br> 排序码:
-    <el-input-number v-model="sortNo" :max="999" :min="0"></el-input-number>
-    排序码越,就越靠前。
+    <el-input-number v-model="sortNo" :max="3000" :min="0"></el-input-number>
+    排序码越,就越靠前。
     <br><br>
     <el-button @click="dianJiBaoCun">保存</el-button>
     <el-button @click="qingKong">关闭</el-button>
@@ -27,13 +29,27 @@ import store from '../../../store'
 import {noNeedRule} from "@/utils/public";
 import {muBanMing} from '@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng'
 import {stringNotBlank} from "@/utils/blank-utils";
-import {doesTheTemplateExist, saveTemplate} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
+import {
+  doesTheTemplateExist,
+  getDoctorSOrderTemplateMaxSortNo,
+  saveTemplate
+} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
 import {ElMessageBox} from "element-plus";
 
+const props = defineProps({
+  list: {
+    type: Array
+  },
+  modelValue: {
+    type: Boolean
+  }
+})
+const emit = defineEmits(['update:modelValue'])
+
 const user = computed(() => {
   return store.state.user.info
 })
-const dialog = ref(false)
+const dialog = ref(true)
 const title = ref('')
 const flag = ref(1)
 const quanYuanFlag = noNeedRule(38)
@@ -46,6 +62,7 @@ const sortNo = ref(0)
 const list = ref([])
 
 const daKaiBaoCunMuBan = (val) => {
+  console.log(muBanMing.value)
   if (stringNotBlank(muBanMing.value.patternName)) {
     patternName.value = muBanMing.value.patternName
     sortNo.value = muBanMing.value.sortNo
@@ -53,7 +70,6 @@ const daKaiBaoCunMuBan = (val) => {
     patternCode.value = muBanMing.value.patternCode
   }
   list.value = val
-  dialog.value = true
 }
 
 const dianJiBaoCun = () => {
@@ -90,6 +106,13 @@ const qingKong = () => {
   muBanMing.value = {}
 }
 
+onMounted(() => {
+  getDoctorSOrderTemplateMaxSortNo().then((res) => {
+    sortNo.value = res
+  })
+  daKaiBaoCunMuBan(props.list)
+})
+
 defineExpose({daKaiBaoCunMuBan})
 </script>
 

+ 9 - 8
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/HuoQuMuBan.vue

@@ -19,13 +19,19 @@
             <el-table-column label="操作" width="180">
               <template #default="scope">
                 <el-button type="primary" icon="Edit" v-if="muBanLeiXing !== 4"
+                           link
+                           title="编辑模板"
                            @click.stop="clickToEditTemplate(scope.row)"/>
                 <el-button type="warning"
                            v-if="muBanLeiXing !== 4"
+                           title="收藏模板"
+                           link
                            @click.stop="clickToFavoriteTemplates(scope.row,scope.$index)"
                            :icon="scope.row.yiBeiShouCang ?  'StarFilled' : 'Star'"/>
                 <el-button type="danger"
                            icon="Delete"
+                           title="删除模板"
+                           link
                            @click.stop="clickDeleteTemplate(scope.row.patternCode,scope.$index)"/>
               </template>
             </el-table-column>
@@ -76,7 +82,7 @@
           </el-select>
           <xc-table ref="tableRef"
                     row-key="id"
-                    :data="{'data':muBanShuJu}"
+                    :local-data="muBanShuJu"
                     :open-paging="false"
                     :height="windowSize.h / 1.6">
             <el-table-column fixed="left" type="selection"/>
@@ -96,7 +102,6 @@
           </xc-table>
         </el-main>
       </el-container>
-      <bao-cun-mu-ban ref="baoCunMuBan"></bao-cun-mu-ban>
     </el-dialog>
   </div>
 </template>
@@ -112,10 +117,9 @@ import {
 } from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
 import {muBanMing} from '@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng'
 import {computed, ref} from 'vue'
-import {listIsBlank, stringNotBlank} from '@/utils/blank-utils'
-import {ElMessage, ElMessageBox} from 'element-plus'
+import {stringNotBlank} from '@/utils/blank-utils'
+import {ElMessageBox} from 'element-plus'
 import {clone} from '@/utils/clone'
-import BaoCunMuBan from './BaoCunMuBan.vue'
 import {getServerDateApi} from '@/api/public-api'
 import {BizException, ExceptionEnum} from "@/utils/BizException";
 import XcTable from "@/components/xiao-chan/xc-table/XcTable.vue";
@@ -145,9 +149,6 @@ const yaoPinPingLvData = ref([])
 
 const dianJiFuJiXinXi = ref('')
 
-// 修改模板
-const baoCunMuBan = ref(null)
-
 const fuJiMuBanShuJu = ref({
   currentPage: 1,
   pageSize: 20,

+ 0 - 6
src/store/modules/app.js

@@ -17,9 +17,6 @@ const state = () => ({
         closeButton: false,
     },
     theme: {},
-    yiZhuLuRu: {
-        path: '/inpatient/zhuYuanYiSheng/yiZhuLuRu',
-    },
     unreadMessageCount: 0, // 未查看的消息数量
     systemMessages: [], // 已经看过的系统通知id
 })
@@ -60,9 +57,6 @@ const mutations = {
     titleJdt(state, val) {
         state.jdt.title = val
     },
-    setYzPath(state, val) {
-        state.yiZhuLuRu.path = val
-    },
     setUnreadMessageCount(state, val) {
         state.unreadMessageCount = val
     },

+ 22 - 10
src/views/hospitalization/zhu-yuan-yi-sheng/Home.vue

@@ -2,7 +2,7 @@
   <page-layer>
 
     <template #headerBlock>
-      <huan-zhe-xin-xi v-show="basicPatientInformation"></huan-zhe-xin-xi>
+      <huan-zhe-xin-xi v-show="basicPatientInformation" :huan-zhe-xin-xi="patientInfo"></huan-zhe-xin-xi>
     </template>
 
     <template #aside="{size}">
@@ -34,6 +34,10 @@ import HuanZheXinXi from "@/components/zhu-yuan-yi-sheng/HuanZheXinXi.vue";
 import router from "@/router";
 import Overview from '@/components/medical-insurance/patient-overview/Index.vue'
 import PageLayer from "@/layout/PageLayer";
+import {
+  huanZheXinXi as patientInfo,
+  youWuXuanZheHuanZhe
+} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 
 const tableHeight = computed(() => {
   return store.state.app.windowSize.h
@@ -44,7 +48,6 @@ const basicPatientInformation = ref(true)
 
 watch(() => router.currentRoute.value.path, () => {
   let path = router.currentRoute.value.path
-  console.log(path)
   if (path === '/inpatient/zhuYuanYiSheng/dianZiBingLi') {
     xianShiLieBiao.value = false
   } else {
@@ -53,8 +56,22 @@ watch(() => router.currentRoute.value.path, () => {
 }, {immediate: true})
 
 const handleClick = (path) => {
-  store.commit('app/setYzPath', path)
-  router.push(path)
+  if (path === '/emrEditor') {
+    if (youWuXuanZheHuanZhe()) {
+      return
+    }
+    let routeData = router.resolve({
+      name: 'emrEditor',
+      query: {
+        patNo: patientInfo.value.inpatientNo,
+        times: patientInfo.value.admissTimes
+      },
+    })
+    window.open(routeData.href, '_blank');
+  } else {
+    router.push(path);
+  }
+
 }
 
 let pathList = $ref([
@@ -64,14 +81,9 @@ let pathList = $ref([
   {path: '/inpatient/zhuYuanYiSheng/jianYanShenQing', title: '检验申请'},
   {path: '/inpatient/zhuYuanYiSheng/shouShuShenQing', title: '查看手术'},
   {path: '/inpatient/zhuYuanYiSheng/caoYaoYiZhu', title: '查看草药医嘱'},
+  {path: '/emrEditor', title: '电子病历'},
 ])
 
-
-// onActivated(() => {
-//   router.push(store.state.app.yiZhuLuRu.path)
-//   basicPatientInformation.value = router.currentRoute.value.path !== '/inpatient/zhuYuanYiSheng/electronicMedicalRecord'
-// })
-
 const currentPagePosition = (val) => {
   if (router.currentRoute.value.path === val) {
     return {

+ 5 - 3
src/views/hospitalization/zhu-yuan-yi-sheng/HuiZhenShenQing.vue

@@ -34,11 +34,13 @@
                 @confirm="shanChuHuiZhenShenQingClick(scope.$index, scope.row)"
             >
               <template #reference>
-                <el-button :disabled="scope.row.statusFlag === '2'" circle icon="Delete" type="danger"></el-button>
+                <el-button :disabled="scope.row.statusFlag === '2'" title="删除" circle icon="Delete"
+                           type="danger"></el-button>
               </template>
             </el-popconfirm>
-            <el-button circle icon="View" @click="chaKanHuiZhenDan(scope.row)"></el-button>
-            <el-button circle class="iconfont icon-dayin" @click="dianJiDaYingHuiZhen(scope.row)"></el-button>
+            <el-button circle icon="View" @click="chaKanHuiZhenDan(scope.row)" title="查看"></el-button>
+            <el-button circle class="iconfont icon-dayin" @click="dianJiDaYingHuiZhen(scope.row)"
+                       title="打印"></el-button>
           </template>
         </el-table-column>
       </xc-table>

+ 0 - 4
src/views/hospitalization/zhu-yuan-yi-sheng/XinZengShuJu.vue

@@ -6,10 +6,6 @@
     </tian-jia-jian-cha-jian-yan>
     <xin-zeng-shou-shu-shen-qing v-if="name === '手术'"></xin-zeng-shou-shu-shen-qing>
     <xin-zhen-cao-yao v-if="name === '草药'"></xin-zhen-cao-yao>
-    <electronic-medical-record v-if="name==='电子病历'"
-                               @refreshPage="refreshPage"
-                               :patNo="huanZheXinXi.inpatientNo"
-                               :times="huanZheXinXi.admissTimes"/>
   </div>
 </template>
 

+ 37 - 21
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/EmrMain.vue

@@ -1,7 +1,7 @@
 <template>
   <el-container>
     <el-header>
-      <el-button icon="ArrowLeft" style="font-size: 14px" text @click="clickBack">返回</el-button>
+      <!--      <el-button icon="ArrowLeft" style="font-size: 14px" text @click="clickBack">返回</el-button>-->
       住院次数:
       <el-input-number :min="1" :max="huanZheXinXi.admissTimes" v-model="tempTimes"/>
       <el-button @click="resetData">历史记录</el-button>
@@ -25,7 +25,8 @@
     <el-container>
 
       <el-aside style="background-color: white">
-        <emr-sidebar @nodeClick="nodeClick" ref="emrSidebarRef" :max-height="maxHeight"/>
+        <emr-sidebar @nodeClick="nodeClick" ref="emrSidebarRef" :max-height="maxHeight"
+                     :huan-zhe-xin-xi="props.huanZheXinXi"/>
       </el-aside>
       <el-main v-loading="loaded">
         <el-row>
@@ -51,7 +52,6 @@
 </template>
 
 <script setup name="emr">
-import {huanZheXinXi} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 import {getEmrInpatientData} from "@/api/dictionary/emr-data-maintenance-api";
 import EmrSidebar from "@/components/zhu-yuan-yi-sheng/emr/EmrSidebar.vue";
 import {EMRInteractive} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-init";
@@ -64,6 +64,16 @@ import {onBeforeRouteLeave} from "vue-router";
 import {getUuid} from "@/api/public-api";
 import EmrAssistant from "@/components/zhu-yuan-yi-sheng/emr/EmrAssistant";
 import {submitMedicalRecord} from "@/api/zhu-yuan-yi-sheng/emr-patient";
+import {useDocumentVisibility} from "@vueuse/core";
+
+const props = defineProps({
+  huanZheXinXi: {
+    type: Object,
+  },
+  maxHeight: {
+    type: Number
+  }
+})
 
 const currentEmr = ref(null)
 const emrRef = ref(null)
@@ -81,7 +91,7 @@ let openAssistant = $ref(false)
 // 编辑器
 let editor = null
 // 患者历史记录
-let tempTimes = $ref(huanZheXinXi.value.admissTimes)
+let tempTimes = $ref(props.huanZheXinXi.admissTimes)
 // 侧边栏
 const emrSidebarRef = ref(null)
 // 片段预览
@@ -108,10 +118,10 @@ const clickSaveData = async () => {
     // 这个是 唯一 id 我是在本地生成的
     emrDocumentId: documentId ? documentId : await getUuid(),
     emrCategoryCode: categoryCode,
-    patNo: huanZheXinXi.value.inpatientNo,
-    times: huanZheXinXi.value.admissTimes,
+    patNo: props.huanZheXinXi.inpatientNo,
+    times: props.huanZheXinXi.admissTimes,
     emrName: templateName,
-    emrDataElement: JSON.stringify(editor.getDataElements('business'))
+    emrDataElement: editor.getDataElements('business')
   }
 
   objectValuesCannotBeNull(data)
@@ -242,8 +252,8 @@ const updateCaseHistoryUrl = (val) => {
   documentId = val.documentId;
   categoryCode = val.categoryCode
   templateName = val.name
-  categroyId = val.categroyId
-  caseHistoryUrl = `/emr/runtime/?documentId=${documentId}&categoryCode=${categoryCode}&categroyId=${categroyId}&patientId=${patientId}#/`
+  categroyId = val.categoryId
+  caseHistoryUrl = `/emr/runtime/?documentId=${documentId}&categoryCode=${categoryCode}&categoryId=${categroyId}&patientId=${patientId}#/`
 }
 
 /**
@@ -270,7 +280,8 @@ const clickBack = () => {
 
 const monitorPageRefresh = (event) => {
   if (isEditorChange) {
-    event.returnValue = false;
+    event.preventDefault();
+    return event.returnValue = "是否确实要退出?还有为保存的数据";
   }
 }
 
@@ -324,7 +335,7 @@ const emrEvent = {
 
 
 const setEditorModeFun = () => {
-  if (tempTimes !== huanZheXinXi.value.admissTimes) {
+  if (tempTimes !== props.huanZheXinXi.admissTimes) {
     // 如果住院次数不一致 那么就是历史记录 那就只能只读了
     currentEmr.value.callMethod('setEditorMode', 'readonly')
   } else {
@@ -417,32 +428,37 @@ const clickToSubmitTheMedicalRecord = () => {
   if (!documentId) {
     return ElMessage.error('请先打开病历')
   }
-  submitMedicalRecord(documentId).then((res) => {
-    console.log(res)
-  })
-
+  submitMedicalRecord(documentId)
 }
 
-let maxHeight = window.innerHeight
+const visibility = useDocumentVisibility()
+
+watch(() => visibility, () => {
+  if (visibility.value === 'hidden' && isEditorChange) {
+    document.title = `患者【${props.huanZheXinXi.name}】,未保存数据`
+  } else {
+    document.title = `电子病历-正在编辑【${props.huanZheXinXi.name}】`
+  }
+}, {deep: true, immediate: true})
 
 onMounted(() => {
   nextTick(async () => {
     patientData = await getEmrInpatientData({
-      patNo: huanZheXinXi.value.inpatientNo,
-      times: huanZheXinXi.value.admissTimes
+      patNo: props.huanZheXinXi.inpatientNo,
+      times: props.huanZheXinXi.admissTimes
     })
     emrSidebarRef.value.queryData()
     getCurrentPersonnelInformation(patientData)
-    patientId = huanZheXinXi.value.inpatientNo
+    patientId = props.huanZheXinXi.inpatientNo
     currentEmr.value = new EMRInteractive(patientData, emrEvent);
     emrSnippetRef.value.setPatientData(patientData)
     emrRef.value.parentElement.emr = currentEmr.value
-    window.addEventListener('beforeunload', monitorPageRefresh)
+    window.addEventListener('beforeunload', monitorPageRefresh, {capture: true})
   })
 })
 
 onDeactivated(() => {
-  window.removeEventListener('beforeunload', monitorPageRefresh)
+  window.removeEventListener('beforeunload', monitorPageRefresh, {capture: true})
 })
 
 

+ 15 - 37
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/Home.vue

@@ -1,58 +1,36 @@
 <template>
-  <emr-main v-if="show"
-            @refreshPage="refreshPage"
-            :patNo="huanZheXinXi.inpatientNo"
-            :times="huanZheXinXi.admissTimes"/>
+  <div v-if="show">
+    <div ref="divRef">
+      <br>
+      <huan-zhe-xin-xi :huan-zhe-xin-xi="patientInfo"/>
+    </div>
+    <emr-main :huan-zhe-xin-xi="patientInfo" :max-height="maxHeight"/>
+  </div>
 </template>
 
 <script setup name='Home'>
-
-import sleep from "@/utils/sleep";
 import EmrMain from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/EmrMain";
 import {getPatientInfo} from "@/api/inpatient/patient";
-import {setBaseinfo} from "@/data/inpatient";
 import router from "@/router";
-import {huanZheXinXi} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
+import HuanZheXinXi from "@/components/zhu-yuan-yi-sheng/HuanZheXinXi";
 
 let show = $ref(false)
+let patientInfo = $ref()
+const divRef = ref(null)
 
-const refreshPage = async () => {
-  show = false
-  await sleep(200)
-  show = true
-}
-
-/**
- * 查询患者信息
- * @returns {Promise<void>}
- * @param patNo 住院号
- */
-const handleClickOverview = async (patNo) => {
-  let res = await getPatientInfo(patNo)
-  setBaseinfo(res)
-}
-
-let patNo = ''
+let maxHeight = $ref()
 
 onActivated(async () => {
-
-  if (huanZheXinXi.value?.inpatientNo) {
-    show = true
-  } else if (router.currentRoute.value.query?.patNo) {
-    await handleClickOverview(router.currentRoute.value.query.patNo)
+  if (router.currentRoute.value.query?.patNo) {
+    patientInfo = await getPatientInfo(router.currentRoute.value.query.patNo)
     show = true
+    await nextTick()
+    maxHeight = window.innerHeight - divRef.value?.clientHeight
   } else {
     show = false
   }
-
-  if (patNo !== huanZheXinXi.value?.inpatientNo) {
-    await refreshPage()
-    patNo = huanZheXinXi.value?.inpatientNo
-  }
-
 })
 
-
 </script>
 
 <style scoped lang="scss">

+ 1 - 0
src/views/hospitalization/zhu-yuan-yi-sheng/shou-shu-shen-qing/ShouShuShenQing.vue

@@ -146,6 +146,7 @@ const dianJiChaKanShouShu = (row, index) => {
   huoQuShouShuShenQingDaYing(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes, row.recordId).then((res) => {
     daYing.value.data = res
     tableIndex.value = index
+    console.log(res)
     if (stringNotBlank(res.applyDate)) {
       res.applyDate = res.applyDate.split(' ')[0]
     }

+ 192 - 188
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/TianJiaYiZhu.vue

@@ -6,9 +6,11 @@
                   @openOrCloseErrorMsg="openOrCloseErrorMsg"
                   ref="baoCunXinXiRef"/>
   <!-- 这里是获取模板的 -->
-  <huo-qu-mu-ban v-if="muBanDuiHuaKuang" @close="muBanDuiHuaKuang = false"
-                 @muBanShuJu="muBanShuJu"></huo-qu-mu-ban>
-  <bao-cun-mu-ban ref="baoCunMuBanRef"></bao-cun-mu-ban>
+  <huo-qu-mu-ban v-if="muBanDuiHuaKuang"
+                 @close="muBanDuiHuaKuang = false"
+                 @muBanShuJu="muBanShuJu"/>
+  <!-- 保存模板用 -->
+  <bao-cun-mu-ban v-if="baoCunMuBanRef" v-model="baoCunMuBanRef" :list="yiZhuList"></bao-cun-mu-ban>
   <div class="prompt" v-if="tiShiBiaoTi?.length > 0">
     <div style="margin-right: 5px">
       提示信息:
@@ -22,7 +24,7 @@
   <el-button icon="ArrowLeft" style="font-size: 14px" text type="primary" @click="router.go(-1)">返回</el-button>
   <el-button type="primary" @click="muBanDuiHuaKuang = true">获取模板</el-button>
   <el-button :disabled="yiZhuList.length === 0" type="primary" @click="baoCunMuBanClick">保存模板</el-button>
-  <el-button icon="Check" type="success" @click="baoCunYiZhuClick">保存</el-button>
+  <el-button icon="Check" type="success" @click="baoCunYiZhuClick">确认医嘱</el-button>
   {{ count }}
   <el-button @click="showErrorMessage = true">打开错误信息</el-button>
   <el-divider direction="vertical"/>
@@ -863,12 +865,12 @@ const muBanShuJu = (val) => {
 }
 
 // 保存模板
-const baoCunMuBanRef = ref(null)
+const baoCunMuBanRef = ref(false)
 const baoCunMuBanClick = () => {
   if (listIsBlank(yiZhuList.value)) {
     return ElMessage.error('请先选择数据')
   }
-  baoCunMuBanRef.value.daKaiBaoCunMuBan(yiZhuList.value)
+  baoCunMuBanRef.value = true
 }
 
 
@@ -953,7 +955,7 @@ onUnmounted(() => {
 
 // 倒计时功能
 const kaiQiDaoJiShi = () => {
-  seconds.value = 600
+  seconds.value = 1600
   clearInterval(daoJiShi)
   daoJiShi = setInterval(() => {
     seconds.value--
@@ -1134,9 +1136,7 @@ const enterToJumpInput = async (val) => {
       await sleep(200)
       el.focus()
     }
-
   }
-
   // el.focus()
   // console.log(el)
 }
@@ -1171,186 +1171,190 @@ onMounted(() => {
     ]
   }
   fuZhiYiZhu.value = []
-  // yiZhuList.value = [
-  //   {
-  //     "actOrderNo": 14796,
-  //     "orderCode": "01212",
-  //     "frequCode": "ONCE",
-  //     "frequCodeName": "一次",
-  //     "drugFlag": "i",
-  //     // "supplyCode": "001",
-  //     // "supplyCodeName": "口服",
-  //     "drugQuan": 1,
-  //     "instruction": " ",
-  //     "drugSpecification": "5% 500ml /袋",
-  //     "miniUnit": "14",
-  //     "miniUnitName": "袋",
-  //     "selfBuy": "0",
-  //     "drugVolume": 500,
-  //     "drugVolUnit": "06",
-  //     "dose": 500,
-  //     "doseUnit": "06",
-  //     "doseUnitName": "ml",
-  //     "orderName": "5%葡萄糖注射液(湖南科伦)",
-  //     "discription": "70.00元 次(自费项目)",
-  //     "delFlag": "0",
-  //     "serial": "01",
-  //     "execUnit": "8010100",
-  //     "execUnitName": "七病室",
-  //     "newActOrderNo": 0,
-  //     "currentPage": 0,
-  //     "parentNo": 14798,
-  //     "pageSize": 0,
-  //     "total": 0,
-  //     "isChildren": false,
-  //     "id": "14796",
-  //     "drugFlagName": "大输液",
-  //     "actOrderNoStr": "14796",
-  //     "selfBuyName": "未知",
-  //     "startTime": "2022-10-13 10:41:11",
-  //     "orderTime": "2022-10-13 10:41:11",
-  //     "tableIndex": 0
-  //   },
-  //   {
-  //     "actOrderNo": 14798,
-  //     "orderCode": "01192",
-  //     "frequCode": "QD",
-  //     "frequCodeName": "一次/日",
-  //     "drugFlag": "i",
-  //     "supplyCode": "025",
-  //     "supplyCodeName": "接瓶续滴",
-  //     "drugQuan": 1,
-  //     "drugSpecification": "0.9% 100ml /袋",
-  //     "miniUnit": "14",
-  //     "miniUnitName": "袋",
-  //     "drugWeightUnit": " ",
-  //     "selfBuy": "0",
-  //     "drugVolume": 100,
-  //     "drugVolUnit": "06",
-  //     "dose": 100,
-  //     "doseUnit": "06",
-  //     "doseUnitName": "ml",
-  //     "orderName": "氯化钠注射液(湖南科伦)",
-  //     "discription": "400.00元 每个部位(自费项目)",
-  //     "delFlag": "0",
-  //     "serial": "01",
-  //     "execUnit": "1010100",
-  //     "execUnitName": "七病室",
-  //     "newActOrderNo": 0,
-  //     "currentPage": 0,
-  //     "pageSize": 0,
-  //     "total": 0,
-  //     "isChildren": false,
-  //     "id": "14798",
-  //     "drugFlagName": "大输液",
-  //     "actOrderNoStr": "14798",
-  //     "selfBuyName": "未知",
-  //     "startTime": "2022-10-13 10:41:11",
-  //     "orderTime": "2022-10-13 10:41:11",
-  //     "tableIndex": 1
-  //   },
-  //   {
-  //     "actOrderNo": 1111111,
-  //     "orderCode": "01192",
-  //     "frequCode": "001",
-  //     "frequCodeName": "口服",
-  //     "drugFlag": "i",
-  //     "supplyCode": "025",
-  //     "supplyCodeName": "接瓶续滴",
-  //     "drugQuan": 1,
-  //     "drugSpecification": "0.9% 100ml /袋",
-  //     "miniUnit": "14",
-  //     "miniUnitName": "袋",
-  //     "drugWeightUnit": " ",
-  //     "selfBuy": "0",
-  //     "drugVolume": 100,
-  //     "drugVolUnit": "06",
-  //     "dose": 100,
-  //     "doseUnit": "06",
-  //     "doseUnitName": "ml",
-  //     "orderName": "氯化钠注射液(湖南科伦)",
-  //     "discription": "400.00元 每个部位(自费项目)",
-  //     "delFlag": "0",
-  //     "serial": "01",
-  //     "execUnit": "1010100",
-  //     "execUnitName": "七病室",
-  //     "newActOrderNo": 0,
-  //     "currentPage": 0,
-  //     "pageSize": 0,
-  //     "total": 0,
-  //     "isChildren": false,
-  //     "id": "1111111",
-  //     "drugFlagName": "大输液",
-  //     "actOrderNoStr": "14798",
-  //     "selfBuyName": "未知",
-  //     "startTime": "2022-10-13 10:41:11",
-  //     "orderTime": "2022-10-13 10:41:11",
-  //     "tableIndex": 2
-  //   },
-  //   {
-  //     "rationalDrugUseId": null,
-  //     "id": "56547553",
-  //     "orderCode": "01361",
-  //     "nationalCode": null,
-  //     "orderName": "声阻抗检查",
-  //     "frequCode": "ONCE",
-  //     "frequCodeName": "一次",
-  //     "instruction": null,
-  //     "discription": "100.00元 次(自费项目)  |100",
-  //     "infantFlag": null,
-  //     "orderTime": "2022-10-17 14:17:24",
-  //     "startTime": "2022-10-17 14:17:24",
-  //     "endTime": null,
-  //     "physician": null,
-  //     "physicianName": null,
-  //     "drugSpecification": "诊疗项目",
-  //     "drugQuan": null,
-  //     "supplyCode": null,
-  //     "supplyCodeName": null,
-  //     "actOrderNo": null,
-  //     "drugFlag": "o",
-  //     "enterOper": null,
-  //     "enterTime": null,
-  //     "miniUnit": null,
-  //     "miniUnitName": null,
-  //     "drugWeight": null,
-  //     "drugWeightUnit": null,
-  //     "drugWeightUnitName": null,
-  //     "statusFlag": null,
-  //     "selfBuy": null,
-  //     "dose": 1,
-  //     "doseUnit": null,
-  //     "doseUnitName": null,
-  //     "drugOcc": null,
-  //     "drugVolume": null,
-  //     "drugVolUnit": null,
-  //     "parentNo": null,
-  //     "packSize": 1,
-  //     "packUnit": null,
-  //     "paySelf": null,
-  //     "serial": "00",
-  //     "groupNo": "00",
-  //     "doctorFlag": null,
-  //     "execUnit": "1120000",
-  //     "execUnitName": "麻醉科",
-  //     "regFlag": null,
-  //     "ybSelfFlag": null,
-  //     "emergencyFlag": null,
-  //     "kfFlag": null,
-  //     "kjywFlag": 0,
-  //     "stockAmount": 0,
-  //     "yyfs": null,
-  //     "ssqk": null,
-  //     "yysj": null,
-  //     "ypLevel": null,
-  //     "delFlag": null,
-  //     "modifier": null,
-  //     "zkWardCode": null,
-  //     "zkDeptCode": null,
-  //     "tableIndex": 3
-  //   }
-  // ]
+
 })
+
+const testData = () => {
+  yiZhuList.value = [
+    {
+      "actOrderNo": 14796,
+      "orderCode": "01212",
+      "frequCode": "ONCE",
+      "frequCodeName": "一次",
+      "drugFlag": "i",
+      // "supplyCode": "001",
+      // "supplyCodeName": "口服",
+      "drugQuan": 1,
+      "instruction": " ",
+      "drugSpecification": "5% 500ml /袋",
+      "miniUnit": "14",
+      "miniUnitName": "袋",
+      "selfBuy": "0",
+      "drugVolume": 500,
+      "drugVolUnit": "06",
+      "dose": 500,
+      "doseUnit": "06",
+      "doseUnitName": "ml",
+      "orderName": "5%葡萄糖注射液(湖南科伦)",
+      "discription": "70.00元 次(自费项目)",
+      "delFlag": "0",
+      "serial": "01",
+      "execUnit": "8010100",
+      "execUnitName": "七病室",
+      "newActOrderNo": 0,
+      "currentPage": 0,
+      "parentNo": 14798,
+      "pageSize": 0,
+      "total": 0,
+      "isChildren": false,
+      "id": "14796",
+      "drugFlagName": "大输液",
+      "actOrderNoStr": "14796",
+      "selfBuyName": "未知",
+      "startTime": "2022-10-13 10:41:11",
+      "orderTime": "2022-10-13 10:41:11",
+      "tableIndex": 0
+    },
+    {
+      "actOrderNo": 14798,
+      "orderCode": "01192",
+      "frequCode": "QD",
+      "frequCodeName": "一次/日",
+      "drugFlag": "i",
+      "supplyCode": "025",
+      "supplyCodeName": "接瓶续滴",
+      "drugQuan": 1,
+      "drugSpecification": "0.9% 100ml /袋",
+      "miniUnit": "14",
+      "miniUnitName": "袋",
+      "drugWeightUnit": " ",
+      "selfBuy": "0",
+      "drugVolume": 100,
+      "drugVolUnit": "06",
+      "dose": 100,
+      "doseUnit": "06",
+      "doseUnitName": "ml",
+      "orderName": "氯化钠注射液(湖南科伦)",
+      "discription": "400.00元 每个部位(自费项目)",
+      "delFlag": "0",
+      "serial": "01",
+      "execUnit": "1010100",
+      "execUnitName": "七病室",
+      "newActOrderNo": 0,
+      "currentPage": 0,
+      "pageSize": 0,
+      "total": 0,
+      "isChildren": false,
+      "id": "14798",
+      "drugFlagName": "大输液",
+      "actOrderNoStr": "14798",
+      "selfBuyName": "未知",
+      "startTime": "2022-10-13 10:41:11",
+      "orderTime": "2022-10-13 10:41:11",
+      "tableIndex": 1
+    },
+    {
+      "actOrderNo": 1111111,
+      "orderCode": "01192",
+      "frequCode": "001",
+      "frequCodeName": "口服",
+      "drugFlag": "i",
+      "supplyCode": "025",
+      "supplyCodeName": "接瓶续滴",
+      "drugQuan": 1,
+      "drugSpecification": "0.9% 100ml /袋",
+      "miniUnit": "14",
+      "miniUnitName": "袋",
+      "drugWeightUnit": " ",
+      "selfBuy": "0",
+      "drugVolume": 100,
+      "drugVolUnit": "06",
+      "dose": 100,
+      "doseUnit": "06",
+      "doseUnitName": "ml",
+      "orderName": "氯化钠注射液(湖南科伦)",
+      "discription": "400.00元 每个部位(自费项目)",
+      "delFlag": "0",
+      "serial": "01",
+      "execUnit": "1010100",
+      "execUnitName": "七病室",
+      "newActOrderNo": 0,
+      "currentPage": 0,
+      "pageSize": 0,
+      "total": 0,
+      "isChildren": false,
+      "id": "1111111",
+      "drugFlagName": "大输液",
+      "actOrderNoStr": "14798",
+      "selfBuyName": "未知",
+      "startTime": "2022-10-13 10:41:11",
+      "orderTime": "2022-10-13 10:41:11",
+      "tableIndex": 2
+    },
+    {
+      "rationalDrugUseId": null,
+      "id": "56547553",
+      "orderCode": "01361",
+      "nationalCode": null,
+      "orderName": "声阻抗检查",
+      "frequCode": "ONCE",
+      "frequCodeName": "一次",
+      "instruction": null,
+      "discription": "100.00元 次(自费项目)  |100",
+      "infantFlag": null,
+      "orderTime": "2022-10-17 14:17:24",
+      "startTime": "2022-10-17 14:17:24",
+      "endTime": null,
+      "physician": null,
+      "physicianName": null,
+      "drugSpecification": "诊疗项目",
+      "drugQuan": null,
+      "supplyCode": null,
+      "supplyCodeName": null,
+      "actOrderNo": null,
+      "drugFlag": "o",
+      "enterOper": null,
+      "enterTime": null,
+      "miniUnit": null,
+      "miniUnitName": null,
+      "drugWeight": null,
+      "drugWeightUnit": null,
+      "drugWeightUnitName": null,
+      "statusFlag": null,
+      "selfBuy": null,
+      "dose": 1,
+      "doseUnit": null,
+      "doseUnitName": null,
+      "drugOcc": null,
+      "drugVolume": null,
+      "drugVolUnit": null,
+      "parentNo": null,
+      "packSize": 1,
+      "packUnit": null,
+      "paySelf": null,
+      "serial": "00",
+      "groupNo": "00",
+      "doctorFlag": null,
+      "execUnit": "1120000",
+      "execUnitName": "麻醉科",
+      "regFlag": null,
+      "ybSelfFlag": null,
+      "emergencyFlag": null,
+      "kfFlag": null,
+      "kjywFlag": 0,
+      "stockAmount": 0,
+      "yyfs": null,
+      "ssqk": null,
+      "yysj": null,
+      "ypLevel": null,
+      "delFlag": null,
+      "modifier": null,
+      "zkWardCode": null,
+      "zkDeptCode": null,
+      "tableIndex": 3
+    }
+  ]
+}
 </script>
 
 <style scoped lang="scss">

+ 1 - 1
vite.config.js

@@ -50,7 +50,7 @@ export default defineConfig({
                 //这里配置运行时服务地址
                 target: 'http://172.16.32.125:8001',
                 secure: false, //如果运行时服务是https,此处配置为true
-                changeOrigin: true //支持跨域调用,这里配置为true
+                changeOrigin: true, //支持跨域调用,这里配置为true
             },
             '/bdp/dataservice/api': {
                 // 这个地址是,创智和宇的查询电子病历下拉框的接口